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',
'errors',
'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 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
127 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
129} elseif ($action ==
'set') {
132} elseif ($action ==
'del') {
139} elseif ($action ==
'setdoc') {
144 $conf->global->COMMANDE_ADDON_PDF = $value;
152} elseif ($action ==
'setmod') {
157} elseif ($action ==
'set_COMMANDE_DRAFT_WATERMARK') {
158 $draft =
GETPOST(
"COMMANDE_DRAFT_WATERMARK");
166 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
168 setEventMessages($langs->trans(
"Error"),
null,
'errors');
170} elseif ($action ==
'set_ORDER_FREE_TEXT') {
171 $freetext =
GETPOST(
"ORDER_FREE_TEXT",
'restricthtml');
180 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
182 setEventMessages($langs->trans(
"Error"),
null,
'errors');
184} elseif ($action ==
'setribchq') {
185 $rib =
GETPOST(
'rib',
'alpha');
186 $chq =
GETPOST(
'chq',
'alpha');
196 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
198 setEventMessages($langs->trans(
"Error"),
null,
'errors');
200} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
210 setEventMessages($langs->trans(
'Error'),
null,
'errors');
212 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
213 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
216} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
225 setEventMessages($langs->trans(
'Error'),
null,
'errors');
227 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
228 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
253$form =
new Form($db);
255$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
257llxHeader(
"", $langs->trans(
"OrdersSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-order');
259$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>';
261print
load_fiche_titre($langs->trans(
"OrdersSetup"), $linkback,
'title_setup');
272print
'<div class="div-table-responsive-no-min">';
273print
'<table class="noborder centpercent">';
274print
'<tr class="liste_titre">';
275print
'<td>'.$langs->trans(
"Name").
'</td>';
276print
'<td>'.$langs->trans(
"Description").
'</td>';
277print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
278print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
279print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
284$arrayofmodules = array();
287foreach ($dirmodels as $reldir) {
291 $handle = opendir($dir);
292 if (is_resource($handle)) {
293 while (($file = readdir($handle)) !==
false) {
297 if (!class_exists($file)) {
298 require_once $dir.$file.
'.php';
302 '@phan-var-force ModeleNumRefCommandes $module';
315'@phan-var-force ModeleNumRefCommandes[] $arrayofmodules';
317foreach ($arrayofmodules as
$module) {
318 $file = strtolower(
$module->getName($langs));
319 if (!preg_match(
'/^mod_commande_/', $file)) {
320 $file =
'mod_commande_'.$file;
332 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
337 print
'<td class="nowrap">';
339 if (preg_match(
'/^Error/', $tmp)) {
340 $langs->load(
"errors");
341 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
342 } elseif ($tmp ==
'NotConfigured') {
343 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
349 print
'<td class="center">';
351 print img_picto($langs->trans(
"Activated"),
'switch_on');
353 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($file).
'">';
354 print img_picto($langs->trans(
"Disabled"),
'switch_off');
360 $commande->initAsSpecimen();
364 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
368 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
369 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
371 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
372 $nextval = $langs->trans($nextval);
374 $htmltooltip .= $nextval.
'<br>';
376 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
380 print
'<td class="center">';
381 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
387print
"</table></div><br>\n";
394printDocumentModelList($type,
'commande',
'COMMANDE_ADDON_PDF', $langs->trans(
"OrdersModelModule"), array(
395 'Logo' =>
'option_logo',
396 'PaymentMode' =>
'option_modereg',
397 'PaymentConditions' =>
'option_condreg',
398 'MultiLanguage' =>
'option_multilang',
399 'WatermarkOnDraftOrders' =>
'option_draft_watermark',
408print
load_fiche_titre($langs->trans(
"SuggestedPaymentModesIfNotDefinedInOrder"),
'',
'');
410print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" spellcheck="false">';
411print
'<input type="hidden" name="token" value="'.newToken().
'" />';
413print
'<div class="div-table-responsive-no-min">';
414print
'<table class="noborder centpercent">';
416print
'<tr class="liste_titre">';
418print
'<input type="hidden" name="action" value="setribchq">';
419print $langs->trans(
"PaymentMode").
'</td>';
420print
'<td align="right">';
422 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
427print
'<tr class="oddeven">';
428print
"<td>".$langs->trans(
"SuggestPaymentByRIBOnAccount").
"</td>";
432 $sql =
"SELECT rowid, label";
433 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
434 $sql .=
" WHERE clos = 0";
435 $sql .=
" AND courant = 1";
436 $sql .=
" AND entity IN (".getEntity(
'bank_account').
")";
437 $resql = $db->query($sql);
439 $num = $db->num_rows($resql);
442 print
'<select name="rib" class="flat" id="rib">';
443 print
'<option value="0">'.$langs->trans(
"DoNotSuggestPaymentMode").
'</option>';
445 $row = $db->fetch_row($resql);
447 print
'<option value="'.$row[0].
'"';
449 print
'>'.$row[1].
'</option>';
455 print
"<i>".$langs->trans(
"NoActiveBankAccountDefined").
"</i>";
459 print
'<span class="opacitymedium">'.$langs->trans(
"BankModuleNotActive").
'</span>';
462 print
'<span class="opacitymedium">'.$langs->trans(
"SeeSetupOfModule", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
466print
'<tr class="oddeven">';
467print
"<td>".$langs->trans(
"SuggestPaymentByChequeToAddress").
"</td>";
470 print
'<select class="flat" name="chq" id="chq">';
471 print
'<option value="0">'.$langs->trans(
"DoNotSuggestPaymentMode").
'</option>';
472 print
'<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ?
' selected' :
'').
'>'.$langs->trans(
"MenuCompanySetup").
' ('.(
$mysoc->name ?
$mysoc->name : $langs->trans(
"NotDefined")).
')</option>';
474 $sql =
"SELECT rowid, label";
475 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
476 $sql .=
" WHERE clos = 0";
477 $sql .=
" AND courant = 1";
478 $sql .=
" AND entity IN (".getEntity(
'bank_account').
")";
480 $resql = $db->query($sql);
482 $num = $db->num_rows($resql);
485 $row = $db->fetch_row($resql);
487 print
'<option value="'.$row[0].
'"';
489 print
'>'.$langs->trans(
"OwnerOfBankAccount", $row[1]).
'</option>';
496 print
'<span class="opacitymedium">'.$langs->trans(
"SeeSetupOfModule", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
513print
'<div class="div-table-responsive-no-min">';
514print
'<table class="noborder centpercent">';
515print
'<tr class="liste_titre">';
516print
'<td>'.$langs->trans(
"Parameter").
'</td>';
517print
'<td class="center" width="60"></td>';
518print
"<td> </td>\n";
522$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
523$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
524foreach ($substitutionarray as $key => $val) {
525 $htmltext .= $key.
'<br>';
529print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
530print
'<input type="hidden" name="token" value="'.newToken().
'">';
531print
'<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
532print
'<tr class="oddeven"><td colspan="2">';
533print $form->textwithpicto($langs->trans(
"FreeLegalTextOnOrders"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
534$variablename =
'ORDER_FREE_TEXT';
536 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
538 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
540 print $doleditor->Create();
542print
'</td><td class="right">';
543print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
549print
'<form method="post" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'" spellcheck="false">';
550print
'<input type="hidden" name="token" value="'.newToken().
'">';
551print
'<input type="hidden" name="action" value="set_COMMANDE_DRAFT_WATERMARK">';
552print
'<tr class="oddeven"><td>';
553print $form->textwithpicto($langs->trans(
"WatermarkOnDraftOrders"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
555print
'<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'COMMANDE_DRAFT_WATERMARK')).
'">';
556print
'</td><td class="right">';
557print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
561print
'<tr class="oddeven">';
562print
'<td>'.$langs->trans(
"AllowExternalDownload").
'</td>';
563print
'<td class="left" colspan="2">';
564print ajax_constantonoff(
'ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(),
null, 0, 0, 0, 2, 0, 1);
570 print
'<tr class="oddeven"><td>'.$langs->trans(
"InvoiceClassifyBilledSupplierOrderWithoutInvoice").
' ' ;
571 print $form->textwithpicto(
'', $langs->trans(
"InvoiceClassifyBilledSupplierOrderWithoutInvoiceHelp"), 1,
'help') .
'</td>';
572 print
'<td class="left" colspan="2">';
573 print ajax_constantonoff(
'ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER');
578print
'<tr class="oddeven">';
579print
'<td>'.img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"Notifications").
'</td>';
580print
'<td colspan="2">';
581print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification");
585print
'<tr class="oddeven">';
586print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
587print
'<td colspan="2">';
588print 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.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
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.
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.