27require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/inventory/class/inventory.class.php';
41$langs->loadLangs(array(
"admin",
"errors",
"stocks"));
49$action =
GETPOST(
'action',
'aZ09');
50$value =
GETPOST(
'value',
'alpha');
51$label =
GETPOST(
'label',
'alpha');
52$scandir =
GETPOST(
'scan_dir',
'alpha');
61if ($action ==
'updateMask') {
62 $maskconstinventory =
GETPOST(
'maskconstinventory',
'aZ09');
63 $maskinventory =
GETPOST(
'maskInventory',
'alpha');
65 if ($maskconstinventory && preg_match(
'/_MASK$/', $maskconstinventory)) {
73 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
75 setEventMessages($langs->trans(
"Error"),
null,
'errors');
77} elseif ($action ==
'specimen') {
78 $modele =
GETPOST(
'module',
'alpha');
81 $tmpobject->initAsSpecimen();
86 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
87 foreach ($dirmodels as $reldir) {
88 $file =
dol_buildpath($reldir.
"core/modules/inventory/doc/pdf_".$modele.
".modules.php", 0);
89 if (file_exists($file)) {
90 $classname =
"pdf_".$modele;
95 if ($classname !==
'') {
99 '@phan-var-force ModelePDFInventory $module';
102 if (
$module->write_file($tmpobject, $langs) > 0) {
103 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=inventory&file=SPECIMEN.pdf");
106 setEventMessages(
$module->error,
null,
'errors');
110 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
111 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
113} elseif ($action ==
'set') {
115} elseif ($action ==
'del') {
122} elseif ($action ==
'setdoc') {
126 $conf->global->INVENTORY_ADDON_PDF = $value;
134} elseif ($action ==
'setmod') {
137} elseif ($action ==
'setstartmode') {
138 $startmode =
GETPOST(
'INVENTORY_DEFAULT_START_MODE',
'aZ09');
143 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
145 setEventMessages($langs->trans(
"Error"),
null,
'errors');
154$form =
new Form($db);
156$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
158$page_name =
"StockSetup";
159llxHeader(
'', $langs->trans($page_name),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-inventory');
162$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
173print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
174print
'<input type="hidden" name="token" value="'.newToken().
'">';
175print
'<input type="hidden" name="action" value="setstartmode">';
176print
'<div class="div-table-responsive-no-min">';
177print
'<table class="noborder centpercent">';
178print
'<tr class="liste_titre">';
179print
'<td>'.$langs->trans(
"Parameter").
'</td>';
180print
'<td class="right">'.$langs->trans(
"Value").
'</td>';
182print
'<tr class="oddeven">';
183print
'<td>'.$form->textwithpicto($langs->trans(
"InventoryStartMode"), $langs->trans(
"InventoryStartModeHelp")).
'</td>';
184print
'<td class="right">';
187 Inventory::START_MODE_NONE => $langs->trans(
"InventoryStartModeNone"),
188 Inventory::START_MODE_ZERO => $langs->trans(
"InventoryStartModeZero"),
191if (!array_key_exists($currentstartmode, $startmodes)) {
194print $form->selectarray(
'INVENTORY_DEFAULT_START_MODE', $startmodes, $currentstartmode, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth200');
195print
' <input type="submit" class="button small" value="'.$langs->trans(
"Modify").
'">';
204print
load_fiche_titre($langs->trans(
"NumberingModules", $langs->transnoentities(
"Inventory")),
'',
'');
206print
'<div class="div-table-responsive-no-min">';
207print
'<table class="noborder centpercent">';
208print
'<tr class="liste_titre">';
209print
'<td>'.$langs->trans(
"Name").
'</td>';
210print
'<td>'.$langs->trans(
"Description").
'</td>';
211print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
212print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
213print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
218foreach ($dirmodels as $reldir) {
222 $handle = opendir($dir);
223 if (is_resource($handle)) {
224 while (($file = readdir($handle)) !==
false) {
225 if (strpos($file,
'mod_inventory_') === 0 &&
dol_substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
228 require_once $dir.
'/'.$file.
'.php';
232 '@phan-var-force ModeleNumRefInventory $module';
243 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
248 print
'<td class="nowrap">';
250 if (preg_match(
'/^Error/', $tmp)) {
251 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
252 } elseif ($tmp ==
'NotConfigured') {
253 print $langs->trans($tmp);
259 print
'<td class="center">';
261 print img_picto($langs->trans(
"Activated"),
'switch_on');
263 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($file).
'">';
264 print img_picto($langs->trans(
"Disabled"),
'switch_off');
270 $mytmpinstance->initAsSpecimen();
274 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
276 $nextval =
$module->getNextValue($mytmpinstance);
277 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
278 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
280 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
281 $nextval = $langs->trans($nextval);
283 $htmltooltip .= $nextval.
'<br>';
285 $htmltooltip .= $langs->trans(
"InventoryRefTypedManually").
'<br>';
289 print
'<td class="center">';
290 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
301print
"</table></div><br>\n";
304printDocumentModelList(
'inventory',
'inventory',
'INVENTORY_ADDON_PDF', $langs->trans(
"DocumentModules", $langs->transnoentities(
"Inventory")), array(
305 'Logo' =>
'option_logo',
306 'MultiLanguage' =>
'option_multilang',
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
const START_MODE_CURRENT
How the lines of the inventory are initialized when it is started.
if(! $sortfield) if(! $sortorder) $module
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
stock_admin_prepare_head()
Return array head with list of tabs to view object information.