33require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
41global $conf, $db, $langs, $user;
44$langs->loadLangs(array(
'other',
'products'));
48$action =
GETPOST(
'action',
'aZ09');
49$confirm =
GETPOST(
'confirm',
'alpha');
52$fieldvalue = (!empty($id) ?
$id :
'');
55 $socid = $user->socid;
59$hookmanager->initHooks(array(
'productlotdocuments'));
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (empty($page) || $page == -1) {
71$offset = $limit * $page;
78 $sortfield =
"position_name";
81$modulepart =
'product_batch';
85 $tmp = explode(
'_', $ref);
89 $object->fetch($id, $productid, $batch);
92 if (isModEnabled(
'productbatch')) {
93 $upload_dir = $conf->productbatch->multidir_output[
$object->entity].
'/'.
get_exdir(0, 0, 0, 1, $object, $modulepart);
95 if (empty($filearray)) {
97 $object->fetch($id, $productid, $batch);
98 $upload_dir = $conf->productbatch->multidir_output[
$object->entity].
'/'.
get_exdir(0, 0, 0, 1, $object, $modulepart);
103$usercanread = $user->hasRight(
'produit',
'lire');
104$usercancreate = $user->hasRight(
'produit',
'creer');
105$usercandelete = $user->hasRight(
'produit',
'supprimer');
107if (empty($upload_dir)) {
108 $upload_dir = $conf->productbatch->multidir_output[$conf->entity];
111$permissiontoread = $usercanread;
112$permissiontoadd = $usercancreate;
113$permtoedit = $user->hasRight(
'produit',
'creer');
117if (!isModEnabled(
'productbatch')) {
121if ($user->socid > 0) {
126if (!$permissiontoread) {
135$parameters = array(
'id'=>$id);
136$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
141if (empty($reshook)) {
143 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
151$form =
new Form($db);
153llxHeader(
'', $langs->trans(
'ProductLot'),
'',
'', 0, 0,
'',
'',
'',
'mod-product page-stock_productlot_document');
161 $parameters = array();
162 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
163 print $hookmanager->resPrint;
169 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ? SORT_DESC : SORT_ASC), 1);
172 foreach ($filearray as $key => $file) {
173 $totalsize += $file[
'size'];
177 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/productlot_list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
180 if ($user->socid && !in_array(
'batch', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
184 dol_banner_tab($object,
'id', $linkback, $shownav,
'rowid',
'batch');
186 print
'<div class="fichecenter">';
188 print
'<div class="underbanner clearboth"></div>';
189 print
'<table class="border tableforfield" width="100%">';
192 print
'<tr><td class="titlefield">'.$langs->trans(
"Product").
'</td><td>';
193 $producttmp =
new Product($db);
194 $producttmp->fetch(
$object->fk_product);
195 print $producttmp->getNomUrl(1,
'stock').
" - ".$producttmp->label;
198 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
199 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
203 print
'<div class="clearboth"></div>';
207 $param =
'&id='.$object->id;
208 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
210 print $langs->trans(
"ErrorUnknown");
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage products or services.
Class with list of lots and properties.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formatted size.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
productlot_prepare_head($object)
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.