32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
41 $langs->loadLangs(array(
'other',
'products'));
45 $action =
GETPOST(
'action',
'aZ09');
46 $confirm =
GETPOST(
'confirm',
'alpha');
49 $fieldvalue = (!empty($id) ? $id :
'');
52 $socid = $user->socid;
57 $hookmanager->initHooks(array(
'productlotdocuments'));
60 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
61 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
62 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
64 if (empty($page) || $page == -1) {
67 $offset = $limit * $page;
68 $pageprev = $page - 1;
69 $pagenext = $page + 1;
74 $sortfield =
"position_name";
77 $modulepart =
'product_batch';
81 $tmp = explode(
'_', $ref);
85 $object->fetch($id, $productid, $batch);
86 $object->ref = $object->batch;
88 if (!empty($conf->productbatch->enabled)) {
89 $upload_dir = $conf->productbatch->multidir_output[$object->entity].
'/'.
get_exdir(0, 0, 0, 1, $object, $modulepart);
91 if (empty($filearray)) {
93 $object->fetch($id, $productid, $batch);
94 $upload_dir = $conf->productbatch->multidir_output[$object->entity].
'/'.
get_exdir(0, 0, 0, 1, $object, $modulepart);
99 $usercanread = $user->rights->produit->lire;
100 $usercancreate = $user->rights->produit->creer;
101 $usercandelete = $user->rights->produit->supprimer;
103 if (empty($upload_dir)) {
104 $upload_dir = $conf->productbatch->multidir_output[$conf->entity];
107 $permissiontoread = $usercanread;
108 $permissiontoadd = $usercancreate;
109 $permtoedit = $user->rights->produit->creer;
113 if (empty($conf->productbatch->enabled)) {
117 if ($user->socid > 0) {
122 if (!$permissiontoread) {
131 $parameters = array(
'id'=>$id);
132 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
137 if (empty($reshook)) {
139 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
149 llxHeader(
'', $langs->trans(
'ProductLot'),
'');
157 $parameters = array();
158 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
159 print $hookmanager->resPrint;
165 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
168 foreach ($filearray as $key => $file) {
169 $totalsize += $file[
'size'];
173 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/productlot_list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
176 if ($user->socid && !in_array(
'batch', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
180 dol_banner_tab($object,
'id', $linkback, $shownav,
'rowid',
'batch');
182 print
'<div class="fichecenter">';
184 print
'<div class="underbanner clearboth"></div>';
185 print
'<table class="border tableforfield" width="100%">';
188 print
'<tr><td class="titlefield">'.$langs->trans(
"Product").
'</td><td>';
189 $producttmp =
new Product($db);
190 $producttmp->fetch($object->fk_product);
191 print $producttmp->getNomUrl(1,
'stock').
" - ".$producttmp->label;
194 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
195 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
199 print
'<div style="clear:both"></div>';
203 $param =
'&id='.$object->id;
204 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
206 print $langs->trans(
"ErrorUnknown");
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class with list of lots and properties.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
productlot_prepare_head($object)
Prepare array with list of tabs.
Class to manage products or services.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.