29require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
33require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/lib/stocktransfer.lib.php';
45$langs->loadLangs(array(
"admin",
"stocks"));
53$action =
GETPOST(
'action',
'alpha');
54$backtopage =
GETPOST(
'backtopage',
'alpha');
56$value =
GETPOST(
'value',
'alpha');
57$label =
GETPOST(
'label',
'alpha');
58$scandir =
GETPOST(
'scan_dir',
'alpha');
60$arrayofparameters = array(
61 'STOCKTRANSFER_MYPARAM1' => array(
'css' =>
'minwidth200',
'enabled' => 1),
62 'STOCKTRANSFER_MYPARAM2' => array(
'css' =>
'minwidth500',
'enabled' => 1)
72include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
75if ($action ==
'updateMask') {
76 $maskconststocktransfer =
GETPOST(
'maskconststocktransfer',
'aZ09');
77 $maskstocktransfer =
GETPOST(
'maskStockTransfer',
'alpha');
79 if ($maskconststocktransfer && preg_match(
'/_MASK$/', $maskconststocktransfer)) {
87 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
89 setEventMessages($langs->trans(
"Error"),
null,
'errors');
91} elseif ($action ==
'specimen') {
92 $modele =
GETPOST(
'module',
'alpha');
93 $tmpobjectkey =
'StockTransfer';
95 $tmpobject =
new $tmpobjectkey($db);
96 $tmpobject->initAsSpecimen();
101 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
102 foreach ($dirmodels as $reldir) {
103 $file =
dol_buildpath($reldir.
"core/modules/stocktransfer/doc/pdf_".$modele.
".modules.php", 0);
104 if (file_exists($file)) {
105 $classname =
"pdf_".$modele;
110 if ($classname !==
'') {
114 '@phan-var-force ModelePDFStockTransfer $module';
117 if (
$module->write_file($tmpobject, $langs) > 0) {
118 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
121 setEventMessages(
$module->error,
null,
'errors');
125 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
126 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
128} elseif ($action ==
'set') {
130} elseif ($action ==
'del') {
131 $tmpobjectkey =
'StockTransfer';
135 $constforval = strtoupper($tmpobjectkey).
'_ADDON_PDF';
140} elseif ($action ==
'setdoc') {
141 $tmpobjectkey =
'StockTransfer';
142 $constforval = strtoupper($tmpobjectkey).
'_ADDON_PDF';
146 $conf->global->$constforval = $value;
154} elseif ($action ==
'setmod') {
157 $tmpobjectkey =
'StockTransfer';
158 $constforval =
'STOCKTRANSFER_'.strtoupper($tmpobjectkey).
"_ADDON";
168$form =
new Form($db);
170$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
172$page_name =
"StockTransferSetup";
173llxHeader(
'', $langs->trans($page_name),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-stocktransfer');
176$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>';
184$moduledir =
'stocktransfer';
185$myTmpObjects = array();
186$myTmpObjects[$moduledir] = array(
'includerefgeneration' => 1,
'includedocgeneration' => 1,
'class' =>
'StockTransfer');
188foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
190 print
load_fiche_titre($langs->trans(
"NumberingModules", $myTmpObjectKey),
'',
'');
192 print
'<div class="div-table-responsive-no-min">';
193 print
'<table class="noborder centpercent">';
194 print
'<tr class="liste_titre">';
195 print
'<td>'.$langs->trans(
"Name").
'</td>';
196 print
'<td>'.$langs->trans(
"Description").
'</td>';
197 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
198 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
199 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
204 foreach ($dirmodels as $reldir) {
208 $handle = opendir($dir);
209 if (is_resource($handle)) {
210 while (($file = readdir($handle)) !==
false) {
211 if (strpos($file,
'mod_'.strtolower($myTmpObjectKey).
'_') === 0 &&
dol_substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
214 require_once $dir.
'/'.$file.
'.php';
218 '@phan-var-force ModeleNumRefStockTransfer $module';
229 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
231 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
236 print
'<td class="nowrap">';
238 if (preg_match(
'/^Error/', $tmp)) {
239 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
240 } elseif ($tmp ==
'NotConfigured') {
241 print $langs->trans($tmp);
247 print
'<td class="center">';
248 $constforvar =
'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).
'_ADDON';
250 print img_picto($langs->trans(
"Activated"),
'switch_on');
252 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.$file.
'">';
253 print img_picto($langs->trans(
"Disabled"),
'switch_off');
258 $nameofclass = $myTmpObjectArray[
'class'];
259 $mytmpinstance =
new $nameofclass($db);
260 $mytmpinstance->initAsSpecimen();
264 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
266 $nextval =
$module->getNextValue($mytmpinstance);
267 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
268 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
270 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
271 $nextval = $langs->trans($nextval);
273 $htmltooltip .= $nextval.
'<br>';
275 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
279 print
'<td class="center">';
280 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
291 print
"</table></div><br>\n";
294 $type = strtolower($myTmpObjectKey);
296 printDocumentModelList($type, $moduledir, strtoupper($myTmpObjectKey).
'_ADDON_PDF', $langs->trans(
"DocumentModules", $myTmpObjectKey), array(
297 'Logo' =>
'option_logo',
298 'MultiLanguage' =>
'option_multilang',
306print
'<div class="div-table-responsive-no-min">';
307print
'<table class="noborder centpercent">';
309print
'<tr class="liste_titre">';
310print
'<td>'.$langs->trans(
"Parameter").
'</td>';
324print
'<tr class="oddeven">';
325print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
326print
'<td colspan="2">';
327print img_picto(
'',
'url',
'class="pictofixedwidth"').
'<a href="'.DOL_URL_ROOT.
'/admin/pdf_other.php">'.$langs->trans(
"SeeInPDFSetupPage").
'</a>';
330print
'</table></div>';
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.
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.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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.
stocktransferAdminPrepareHead()
Prepare admin pages header.