Fix link to warehouses for events

This commit is contained in:
Laurent Destailleur 2018-05-24 12:16:04 +02:00
parent de447d88d7
commit e51aa68284
9 changed files with 37 additions and 27 deletions

View File

@ -631,6 +631,7 @@ if ($resql)
// Linked object // Linked object
if (! empty($arrayfields['a.fk_element']['checked'])) { if (! empty($arrayfields['a.fk_element']['checked'])) {
print '<td>'; print '<td>';
//var_dump($obj->fkelement.' '.$obj->elementtype);
if ($obj->fk_element > 0 && ! empty($obj->elementtype)) { if ($obj->fk_element > 0 && ! empty($obj->elementtype)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print dolGetElementUrl($obj->fk_element,$obj->elementtype,1); print dolGetElementUrl($obj->fk_element,$obj->elementtype,1);

View File

@ -601,7 +601,7 @@ class FormFile
$modellist=call_user_func($class.'::liste_modeles',$this->db); $modellist=call_user_func($class.'::liste_modeles',$this->db);
} }
else else
{ {
dol_print_error($this->db,'Bad value for modulepart'); dol_print_error($this->db,'Bad value for modulepart');
return -1; return -1;
} }

View File

@ -1830,6 +1830,11 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
$module='projet'; $module='projet';
$subelement='task'; $subelement='task';
} }
if ($objecttype == 'stock') {
$classpath = 'product/stock/class';
$module='stock';
$subelement='stock';
}
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
@ -1840,22 +1845,30 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
$classpath = 'fourn/class'; $classpath = 'fourn/class';
$module='fournisseur'; $module='fournisseur';
} }
if ($objecttype == 'order_supplier') { elseif ($objecttype == 'order_supplier') {
$classfile = 'fournisseur.commande'; $classfile = 'fournisseur.commande';
$classname='CommandeFournisseur'; $classname='CommandeFournisseur';
$classpath = 'fourn/class'; $classpath = 'fourn/class';
$module='fournisseur'; $module='fournisseur';
} }
elseif ($objecttype == 'stock') {
$classpath = 'product/stock/class';
$classfile='entrepot';
$classname='Entrepot';
}
if (! empty($conf->$module->enabled)) if (! empty($conf->$module->enabled))
{ {
$res=dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); $res=dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
if ($res) if ($res)
{ {
$object = new $classname($db); if (class_exists($classname))
$res=$object->fetch($objectid); {
if ($res > 0) $ret=$object->getNomUrl($withpicto,$option); $object = new $classname($db);
unset($object); $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; return $ret;

View File

@ -1,9 +1,5 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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'; require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/** /**
* \class ModeleStock * Parent class for stock models of doc generators
* \brief Parent class for stock models of doc generators
*/ */
abstract class ModeleStock extends CommonDocGenerator abstract class ModelePDFStock extends CommonDocGenerator
{ {
var $error=''; var $error='';

View File

@ -2165,8 +2165,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
$genallowed=$usercanread; $genallowed=$usercanread;
$delallowed=$usercancreate; $delallowed=$usercancreate;
$var=true;
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles; $somethingshown=$formfile->numoffiles;

View File

@ -117,7 +117,7 @@ if ($action == 'add' && $user->rights->stock->creer)
// Delete warehouse // Delete warehouse
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer)
{ {
$object->fetch($_REQUEST["id"]); $object->fetch(GETPOST('id','int'));
$result=$object->delete($user); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
{ {
@ -169,9 +169,17 @@ if ($cancel == $langs->trans("Cancel"))
$action = ''; $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 * Build document
*/ */
/*
if ($action == 'builddoc') // En get ou en post if ($action == 'builddoc') // En get ou en post
{ {
if ($id > 0 || $ref) 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')); if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language // Define output language
@ -218,7 +226,7 @@ elseif ($action == 'remove_file')
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
} }
*/
/* /*
* View * View
@ -728,8 +736,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$usercanread; $genallowed=$usercanread;
$delallowed=$usercancreate; $delallowed=$usercancreate;
$modulepart = 'stock';
$var=true;
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles; $somethingshown=$formfile->numoffiles;

View File

@ -418,8 +418,6 @@ if (empty($action))
$genallowed=$usercanread; $genallowed=$usercanread;
$delallowed=$usercancreate; $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); 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; $somethingshown=$formfile->numoffiles;

View File

@ -612,8 +612,6 @@ if ($id > 0 || ! empty($ref))
$genallowed=($user->rights->projet->lire); $genallowed=($user->rights->projet->lire);
$delallowed=($user->rights->projet->creer); $delallowed=($user->rights->projet->creer);
$var=true;
print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print $formfile->showdocuments('project_task',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -2455,7 +2455,7 @@ else
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
/* /*
* Documents generes * Documents generes
*/ */
$filename = dol_sanitizeFileName($object->ref); $filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->user->dir_output . "/" . dol_sanitizeFileName($object->ref); $filedir = $conf->user->dir_output . "/" . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;