36require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
51$langs->loadLangs(array(
'admin',
'orders',
'other'));
57$action =
GETPOST(
'action',
'aZ09');
58$value =
GETPOST(
'value',
'alpha');
59$modulepart =
GETPOST(
'modulepart',
'aZ09');
61$label =
GETPOST(
'label',
'alpha');
62$scandir =
GETPOST(
'scan_dir',
'alpha');
72include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
74if ($action ==
'updateMask') {
75 $maskconstorder =
GETPOST(
'maskconstorder',
'aZ09');
76 $maskorder =
GETPOST(
'maskorder',
'alpha');
80 if ($maskconstorder && preg_match(
'/_MASK$/', $maskconstorder)) {
89 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
91 setEventMessages($langs->trans(
"Error"),
null,
'errors');
93} elseif ($action ==
'specimen') {
94 $modele =
GETPOST(
'module',
'alpha');
97 $commande->initAsSpecimen();
102 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
103 foreach ($dirmodels as $reldir) {
104 $file =
dol_buildpath($reldir.
"core/modules/commande/doc/pdf_".$modele.
".modules.php", 0);
105 if (file_exists($file)) {
106 $classname =
"pdf_".$modele;
111 if ($classname !==
'') {
115 '@phan-var-force ModelePDFCommandes $module';
118 if (
$module->write_file($commande, $langs) > 0) {
119 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=commande&file=SPECIMEN.pdf");
126 $langs->load(
'errors');
127 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
128 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
130} elseif ($action ==
'set') {
133} elseif ($action ==
'del') {
140} elseif ($action ==
'setdoc') {
145 $conf->global->COMMANDE_ADDON_PDF = $value;
153} elseif ($action ==
'setmod') {
158} elseif ($action ==
'set_COMMANDE_DRAFT_WATERMARK') {
159 $draft =
GETPOST(
"COMMANDE_DRAFT_WATERMARK");
167 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
169 setEventMessages($langs->trans(
"Error"),
null,
'errors');
171} elseif ($action ==
'set_ORDER_FREE_TEXT') {
172 $freetext =
GETPOST(
"ORDER_FREE_TEXT",
'restricthtml');
181 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
183 setEventMessages($langs->trans(
"Error"),
null,
'errors');
185} elseif ($action ==
'setribchq') {
186 $rib =
GETPOST(
'rib',
'alpha');
187 $chq =
GETPOST(
'chq',
'alpha');
197 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
199 setEventMessages($langs->trans(
"Error"),
null,
'errors');
201} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
211 setEventMessages($langs->trans(
'Error'),
null,
'errors');
213 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
214 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
217} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
226 setEventMessages($langs->trans(
'Error'),
null,
'errors');
228 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
229 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
254$form =
new Form($db);
256$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
258llxHeader(
"", $langs->trans(
"OrdersSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-order');
260$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>';
262print
load_fiche_titre($langs->trans(
"OrdersSetup"), $linkback,
'title_setup');
273print
'<div class="div-table-responsive-no-min">';
274print
'<table class="noborder centpercent">';
275print
'<tr class="liste_titre">';
276print
'<td>'.$langs->trans(
"Name").
'</td>';
277print
'<td>'.$langs->trans(
"Description").
'</td>';
278print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
279print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
280print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
285$arrayofmodules = array();
288foreach ($dirmodels as $reldir) {
292 $handle = opendir($dir);
293 if (is_resource($handle)) {
294 while (($file = readdir($handle)) !==
false) {
298 if (!class_exists($file)) {
299 require_once $dir.$file.
'.php';
303 '@phan-var-force ModeleNumRefCommandes $module';
316'@phan-var-force ModeleNumRefCommandes[] $arrayofmodules';
318foreach ($arrayofmodules as
$module) {
319 $file = strtolower(
$module->getName($langs));
320 if (!preg_match(
'/^mod_commande_/', $file)) {
321 $file =
'mod_commande_'.$file;
333 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
338 print
'<td class="nowrap">';
340 if (preg_match(
'/^Error/', $tmp)) {
341 $langs->load(
"errors");
342 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
343 } elseif ($tmp ==
'NotConfigured') {
344 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
350 print
'<td class="center">';
352 print img_picto($langs->trans(
"Activated"),
'switch_on');
354 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($file).
'">';
355 print img_picto($langs->trans(
"Disabled"),
'switch_off');
361 $commande->initAsSpecimen();
365 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
369 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
370 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
372 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
373 $langs->load(
'errors');
374 $nextval = $langs->trans($nextval);
376 $htmltooltip .= $nextval.
'<br>';
378 $langs->load(
'errors');
379 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
383 print
'<td class="center">';
384 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
390print
"</table></div><br>\n";
397printDocumentModelList($type,
'commande',
'COMMANDE_ADDON_PDF', $langs->trans(
"OrdersModelModule"), array(
398 'Logo' =>
'option_logo',
399 'PaymentMode' =>
'option_modereg',
400 'PaymentConditions' =>
'option_condreg',
401 'MultiLanguage' =>
'option_multilang',
402 'WatermarkOnDraftOrders' =>
'option_draft_watermark',
411print
load_fiche_titre($langs->trans(
"SuggestedPaymentModesIfNotDefinedInOrder"),
'',
'');
413print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" spellcheck="false">';
414print
'<input type="hidden" name="token" value="'.newToken().
'" />';
416print
'<div class="div-table-responsive-no-min">';
417print
'<table class="noborder centpercent">';
419print
'<tr class="liste_titre">';
421print
'<input type="hidden" name="action" value="setribchq">';
422print $langs->trans(
"PaymentMode").
'</td>';
423print
'<td align="right">';
425 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
430print
'<tr class="oddeven">';
431print
"<td>".$langs->trans(
"SuggestPaymentByRIBOnAccount").
"</td>";
435 $sql =
"SELECT rowid, label";
436 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
437 $sql .=
" WHERE clos = 0";
438 $sql .=
" AND courant = 1";
439 $sql .=
" AND entity IN (".getEntity(
'bank_account').
")";
440 $resql = $db->query($sql);
442 $num = $db->num_rows($resql);
445 print
'<select name="rib" class="flat" id="rib">';
446 print
'<option value="0">'.$langs->trans(
"DoNotSuggestPaymentMode").
'</option>';
448 $row = $db->fetch_row($resql);
450 print
'<option value="'.$row[0].
'"';
452 print
'>'.$row[1].
'</option>';
458 print
"<i>".$langs->trans(
"NoActiveBankAccountDefined").
"</i>";
462 print
'<span class="opacitymedium">'.$langs->trans(
"BankModuleNotActive").
'</span>';
465 print
'<span class="opacitymedium">'.$langs->trans(
"SeeSetupOfModule", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
469print
'<tr class="oddeven">';
470print
"<td>".$langs->trans(
"SuggestPaymentByChequeToAddress").
"</td>";
473 print
'<select class="flat" name="chq" id="chq">';
474 print
'<option value="0">'.$langs->trans(
"DoNotSuggestPaymentMode").
'</option>';
475 print
'<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ?
' selected' :
'').
'>'.$langs->trans(
"MenuCompanySetup").
' ('.(
$mysoc->name ?
$mysoc->name : $langs->trans(
"NotDefined")).
')</option>';
477 $sql =
"SELECT rowid, label";
478 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
479 $sql .=
" WHERE clos = 0";
480 $sql .=
" AND courant = 1";
481 $sql .=
" AND entity IN (".getEntity(
'bank_account').
")";
483 $resql = $db->query($sql);
485 $num = $db->num_rows($resql);
488 $row = $db->fetch_row($resql);
490 print
'<option value="'.$row[0].
'"';
492 print
'>'.$langs->trans(
"OwnerOfBankAccount", $row[1]).
'</option>';
499 print
'<span class="opacitymedium">'.$langs->trans(
"SeeSetupOfModule", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
516print
'<div class="div-table-responsive-no-min">';
517print
'<table class="noborder centpercent">';
518print
'<tr class="liste_titre">';
519print
'<td>'.$langs->trans(
"Parameter").
'</td>';
520print
'<td class="center" width="60"></td>';
521print
"<td> </td>\n";
525$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
526$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
527foreach ($substitutionarray as $key => $val) {
528 $htmltext .= $key.
'<br>';
532print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
533print
'<input type="hidden" name="token" value="'.newToken().
'">';
534print
'<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
535print
'<tr class="oddeven"><td colspan="2">';
536print $form->textwithpicto($langs->trans(
"FreeLegalTextOnOrders"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
537$variablename =
'ORDER_FREE_TEXT';
539 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
541 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
543 print $doleditor->Create();
545print
'</td><td class="right">';
546print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
552print
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'" spellcheck="false">';
553print
'<input type="hidden" name="token" value="'.newToken().
'">';
554print
'<input type="hidden" name="action" value="set_COMMANDE_DRAFT_WATERMARK">';
555print
'<tr class="oddeven"><td>';
556print $form->textwithpicto($langs->trans(
"WatermarkOnDraftOrders"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
558print
'<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'COMMANDE_DRAFT_WATERMARK')).
'">';
559print
'</td><td class="right">';
560print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
564print
'<tr class="oddeven">';
565print
'<td>'.$langs->trans(
"AllowExternalDownload").
'</td>';
566print
'<td class="left" colspan="2">';
567print ajax_constantonoff(
'ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(),
null, 0, 0, 0, 2, 0, 1);
573 print
'<tr class="oddeven"><td>'.$langs->trans(
"InvoiceClassifyBilledSupplierOrderWithoutInvoice").
' ' ;
574 print $form->textwithpicto(
'', $langs->trans(
"InvoiceClassifyBilledSupplierOrderWithoutInvoiceHelp"), 1,
'help') .
'</td>';
575 print
'<td class="left" colspan="2">';
576 print ajax_constantonoff(
'ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER');
581print
'<tr class="oddeven">';
582print
'<td>'.img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"Notifications").
'</td>';
583print
'<td colspan="2">';
584print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification");
588print
'<tr class="oddeven">';
589print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
590print
'<td colspan="2">';
591print img_picto(
'',
'url',
'class="pictofixedwidth"').
'<a href="'.DOL_URL_ROOT.
'/admin/pdf_other.php">'.$langs->trans(
"SeeInPDFSetupPage").
'</a>';
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 customers orders.
Class to manage a WYSIWYG editor.
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.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.
order_admin_prepare_head()
Return array head with list of tabs to view object information.
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.