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 :
'');
51 if ($user->socid) $socid = $user->socid;
55 $hookmanager->initHooks(array(
'productlotdocuments'));
58 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
59 $sortfield =
GETPOST(
"sortfield",
'alpha');
60 $sortorder =
GETPOST(
"sortorder",
'alpha');
62 if (empty($page) || $page == -1) { $page = 0; }
63 $offset = $limit * $page;
64 $pageprev = $page - 1;
65 $pagenext = $page + 1;
66 if (!$sortorder) $sortorder =
"ASC";
67 if (!$sortfield) $sortfield =
"position_name";
69 $modulepart =
'product_batch';
75 $tmp = explode(
'_', $ref);
79 $object->fetch($id, $productid, $batch);
80 $object->ref = $object->batch;
82 if (!empty($conf->productbatch->enabled)) $upload_dir = $conf->productbatch->multidir_output[$object->entity].
'/'.
get_exdir(0, 0, 0, 1, $object, $modulepart);
90 $parameters = array(
'id'=>$id);
91 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
92 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
97 include_once DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
100 $permtoedit = $user->rights->produit->creer;
107 $form =
new Form($db);
109 llxHeader(
'', $langs->trans(
'ProductLot'),
'');
118 $parameters = array();
119 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
120 print $hookmanager->resPrint;
121 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
124 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
127 foreach ($filearray as $key => $file)
129 $totalsize += $file[
'size'];
133 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/productlot_list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
136 if ($user->socid && !in_array(
'batch', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
138 dol_banner_tab($object,
'id', $linkback, $shownav,
'rowid',
'batch');
140 print '<div class="fichecenter">';
142 print '<div class="underbanner clearboth"></div>';
143 print '<table class="border tableforfield" width="100%">';
145 print '<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
146 print '<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
150 print '<div style="clear:both"></div>';
154 $permission = ($user->rights->produit->creer);
155 $param =
'&id='.$object->id;
156 include_once DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
158 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.
productlot_prepare_head($object)
Prepare array with list of tabs.
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.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
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.