diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index cca1f59bf8e..c9a0f1f9d49 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -631,6 +631,7 @@ if ($resql)
// Linked object
if (! empty($arrayfields['a.fk_element']['checked'])) {
print '
';
+ //var_dump($obj->fkelement.' '.$obj->elementtype);
if ($obj->fk_element > 0 && ! empty($obj->elementtype)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print dolGetElementUrl($obj->fk_element,$obj->elementtype,1);
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index dbdb7edf760..78ef6c2f1c3 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -601,7 +601,7 @@ class FormFile
$modellist=call_user_func($class.'::liste_modeles',$this->db);
}
else
- {
+ {
dol_print_error($this->db,'Bad value for modulepart');
return -1;
}
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 0b8d42f3a9e..c95deeef81f 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -1830,6 +1830,11 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
$module='projet';
$subelement='task';
}
+ if ($objecttype == 'stock') {
+ $classpath = 'product/stock/class';
+ $module='stock';
+ $subelement='stock';
+ }
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
@@ -1840,22 +1845,30 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
$classpath = 'fourn/class';
$module='fournisseur';
}
- if ($objecttype == 'order_supplier') {
+ elseif ($objecttype == 'order_supplier') {
$classfile = 'fournisseur.commande';
$classname='CommandeFournisseur';
$classpath = 'fourn/class';
$module='fournisseur';
}
-
+ elseif ($objecttype == 'stock') {
+ $classpath = 'product/stock/class';
+ $classfile='entrepot';
+ $classname='Entrepot';
+ }
if (! empty($conf->$module->enabled))
{
$res=dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
if ($res)
{
- $object = new $classname($db);
- $res=$object->fetch($objectid);
- if ($res > 0) $ret=$object->getNomUrl($withpicto,$option);
- unset($object);
+ if (class_exists($classname))
+ {
+ $object = new $classname($db);
+ $res=$object->fetch($objectid);
+ if ($res > 0) $ret=$object->getNomUrl($withpicto,$option);
+ unset($object);
+ }
+ else dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR);
}
}
return $ret;
diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php
index f1c72601b97..16c33b94e07 100644
--- a/htdocs/core/modules/stock/modules_stock.php
+++ b/htdocs/core/modules/stock/modules_stock.php
@@ -1,9 +1,5 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
- * Copyright (C) 2004 Eric Seigne
- * Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2016 Charlie Benke
+/* Copyright (C) 2018 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,10 +19,9 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/**
- * \class ModeleStock
- * \brief Parent class for stock models of doc generators
+ * Parent class for stock models of doc generators
*/
-abstract class ModeleStock extends CommonDocGenerator
+abstract class ModelePDFStock extends CommonDocGenerator
{
var $error='';
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index a0ab4508d9c..addc827700e 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -2165,8 +2165,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
$genallowed=$usercanread;
$delallowed=$usercancreate;
- $var=true;
-
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index eca9086c48a..2bd0a10bc51 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -117,7 +117,7 @@ if ($action == 'add' && $user->rights->stock->creer)
// Delete warehouse
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer)
{
- $object->fetch($_REQUEST["id"]);
+ $object->fetch(GETPOST('id','int'));
$result=$object->delete($user);
if ($result > 0)
{
@@ -169,9 +169,17 @@ if ($cancel == $langs->trans("Cancel"))
$action = '';
}
+
+// Actions to build doc
+$upload_dir = $conf->stock->dir_output;
+$permissioncreate = $user->rights->stock->creer;
+include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
+
+
/*
* Build document
*/
+/*
if ($action == 'builddoc') // En get ou en post
{
if ($id > 0 || $ref)
@@ -185,7 +193,7 @@ if ($action == 'builddoc') // En get ou en post
}
}
- // Save last template used to generate document
+ // Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
@@ -218,7 +226,7 @@ elseif ($action == 'remove_file')
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
-
+*/
/*
* View
@@ -728,8 +736,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$usercanread;
$delallowed=$usercancreate;
-
- $var=true;
+ $modulepart = 'stock';
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index 757d01868b5..90ca3a73cc9 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -418,8 +418,6 @@ if (empty($action))
$genallowed=$usercanread;
$delallowed=$usercancreate;
- $var=true;
-
print $formfile->showdocuments('product_batch',dol_sanitizeFileName($object->ref),$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 735b5a81195..9f1a486fcaa 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -612,8 +612,6 @@ if ($id > 0 || ! empty($ref))
$genallowed=($user->rights->projet->lire);
$delallowed=($user->rights->projet->creer);
- $var=true;
-
print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
print '';
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 48dc1049706..ddab0daed0c 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -2455,7 +2455,7 @@ else
print ' ';
/*
* Documents generes
- */
+ */
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->user->dir_output . "/" . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|