Go to the documentation of this file.
29 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
31 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
32 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
33 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
34 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
36 if (!$res && file_exists(
"../main.inc.php")) $res = @include
"../main.inc.php";
37 if (!$res && file_exists(
"../../main.inc.php")) $res = @include
"../../main.inc.php";
38 if (!$res && file_exists(
"../../../main.inc.php")) $res = @include
"../../../main.inc.php";
39 if (!$res) die(
"Include of main fails");
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php';
49 $langs->loadLangs(array(
"stocks",
"companies",
"other",
"mails"));
52 $action =
GETPOST(
'action',
'aZ09');
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 =
"name";
73 $diroutputmassaction = $conf->stocktransfer->dir_output.
'/temp/massgeneration/'.$user->id;
74 $hookmanager->initHooks(array(
'stocktransferdocument',
'globalcard'));
76 $extrafields->fetch_name_optionals_label($object->table_element);
79 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
82 if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity].
"/stocktransfer/".
dol_sanitizeFileName($object->ref);
89 $permissiontoadd = $user->rights->stocktransfer->stocktransfer->write;
97 include_once DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
106 $title = $langs->trans(
"ModuleStockTransferName").
' - '.$langs->trans(
"Files");
117 print
dol_get_fiche_head($head,
'document', $langs->trans(
"StockTransfer"), -1, $object->picto);
121 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
123 foreach ($filearray as $key => $file) {
124 $totalsize += $file[
'size'];
129 $linkback =
'<a href="'.dol_buildpath(
'/stocktransfer/stocktransfer_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
131 $morehtmlref =
'<div class="refidno">';
169 $morehtmlref .=
'</div>';
171 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
173 print
'<div class="fichecenter">';
175 print
'<div class="underbanner clearboth"></div>';
176 print
'<table class="border centpercent tableforfield">';
179 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
182 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.$totalsize.
' '.$langs->trans(
"bytes").
'</td></tr>';
190 $modulepart =
'stocktransfer';
195 $param =
'&id='.$object->id;
198 $relativepathwithnofile =
'stocktransfer/'.dol_sanitizeFileName($object->ref).
'/';
200 include_once DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_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.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
stocktransferPrepareHead($object)
Prepare array of tabs for StockTransfer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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 ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.