27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/mrp/lib/mrp_mo.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/mrp/lib/mrp.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
44$langs->loadLangs(array(
'admin',
'mrp',
'other'));
50$action =
GETPOST(
'action',
'aZ09');
51$value =
GETPOST(
'value',
'alpha');
52$modulepart =
GETPOST(
'modulepart',
'aZ09');
54$label =
GETPOST(
'label',
'alpha');
55$scandir =
GETPOST(
'scan_dir',
'alpha');
64include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
66if ($action ==
'updateMask') {
67 $maskconstmrp =
GETPOST(
'maskconstMo',
'aZ09');
68 $maskmrp =
GETPOST(
'maskMo',
'alpha');
72 if ($maskconstmrp && preg_match(
'/_MASK$/', $maskconstmrp)) {
81 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
83 setEventMessages($langs->trans(
"Error"),
null,
'errors');
85} elseif ($action ==
'specimen') {
86 $modele =
GETPOST(
'module',
'alpha');
89 $mo->initAsSpecimen();
94 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
95 foreach ($dirmodels as $reldir) {
96 $file =
dol_buildpath($reldir.
"core/modules/mrp/doc/pdf_".$modele.
".modules.php", 0);
97 if (file_exists($file)) {
98 $classname =
"pdf_".$modele;
103 if ($classname !==
'') {
107 '@phan-var-force ModelePDFMo $module';
109 if (
$module->write_file($mo, $langs) > 0) {
110 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=mrp&file=SPECIMEN.pdf");
113 setEventMessages(
$module->error,
null,
'errors');
117 $langs->load(
'errors');
118 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
119 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
121} elseif ($action ==
'set') {
124} elseif ($action ==
'del') {
131} elseif ($action ==
'setdoc') {
136 $conf->global->MRP_MO_ADDON_PDF = $value;
144} elseif ($action ==
'setmod') {
149} elseif ($action ==
'set_MRP_MO_DRAFT_WATERMARK') {
150 $draft =
GETPOST(
"MRP_MO_DRAFT_WATERMARK");
158 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
160 setEventMessages($langs->trans(
"Error"),
null,
'errors');
162} elseif ($action ==
'set_MRP_MO_FREE_TEXT') {
163 $freetext =
GETPOST(
"MRP_MO_FREE_TEXT",
'restricthtml');
172 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
174 setEventMessages($langs->trans(
"Error"),
null,
'errors');
183$form =
new Form($db);
185$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
187llxHeader(
"", $langs->trans(
"MrpSetupPage"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-mrp');
189$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>';
191print
load_fiche_titre($langs->trans(
"MrpSetupPage"), $linkback,
'title_setup');
203print
'<table class="noborder centpercent">';
204print
'<tr class="liste_titre">';
205print
'<td>'.$langs->trans(
"Name").
'</td>';
206print
'<td>'.$langs->trans(
"Description").
'</td>';
207print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
208print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
209print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
214foreach ($dirmodels as $reldir) {
218 $handle = opendir($dir);
219 if (is_resource($handle)) {
220 while (($file = readdir($handle)) !==
false) {
224 require_once $dir.$file.
'.php';
228 '@phan-var-force ModeleNumRefMos $module';
239 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
244 print
'<td class="nowrap">';
246 if (preg_match(
'/^Error/', $tmp)) {
247 $langs->load(
"errors");
248 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
249 } elseif ($tmp ==
'NotConfigured') {
250 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
256 print
'<td class="center">';
258 print img_picto($langs->trans(
"Activated"),
'switch_on');
260 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($file).
'">';
261 print img_picto($langs->trans(
"Disabled"),
'switch_off');
267 $mrp->initAsSpecimen();
269 $product->initAsSpecimen();
273 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
275 $nextval =
$module->getNextValue($product, $mrp);
276 if ((
string) $nextval != $langs->trans(
"NotAvailable")) {
277 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
279 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
280 $langs->load(
'errors');
281 $nextval = $langs->trans($nextval);
283 $htmltooltip .= $nextval.
'<br>';
285 $langs->load(
'errors');
286 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
290 print
'<td class="center">';
291 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
302print
"</table><br>\n";
309printDocumentModelList($type,
'mrp',
'MRP_MO_ADDON_PDF', $langs->trans(
"MOsModelModule"), array(
310 'MultiLanguage' =>
'option_multilang',
311 'WatermarkOnDraftMOs' =>
'option_draft_watermark',
320print
'<table class="noborder centpercent">';
321print
'<tr class="liste_titre">';
322print
'<td>'.$langs->trans(
"Parameter").
'</td>';
323print
'<td class="center" width="60"></td>';
324print
"<td> </td>\n";
328$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
329$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
330foreach ($substitutionarray as $key => $val) {
331 $htmltext .= $key.
'<br>';
335print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
336print
'<input type="hidden" name="token" value="'.newToken().
'">';
337print
'<input type="hidden" name="action" value="set_MRP_MO_FREE_TEXT">';
338print
'<tr class="oddeven"><td colspan="2">';
339print $form->textwithpicto($langs->trans(
"FreeLegalTextOnMOs"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
340$variablename =
'MRP_MO_FREE_TEXT';
342 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
344 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
346 print $doleditor->Create();
348print
'</td><td class="right">';
349print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
355print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">';
356print
'<input type="hidden" name="token" value="'.newToken().
'">';
357print
"<input type=\"hidden\" name=\"action\" value=\"set_MRP_MO_DRAFT_WATERMARK\">";
358print
'<tr class="oddeven"><td>';
359print $form->textwithpicto($langs->trans(
"WatermarkOnDraftMOs"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
361print
'<input class="flat minwidth200" type="text" name="MRP_MO_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'MRP_MO_DRAFT_WATERMARK')).
'">';
362print
'</td><td class="right">';
363print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
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(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage a WYSIWYG editor.
Class to manage products or services.
if(! $sortfield) if(! $sortorder) $module
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
mrpAdminPrepareHead()
Prepare admin pages header.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.