35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
42$langs->loadLangs(array(
'admin',
'errors',
'orders',
'other'));
48$action =
GETPOST(
'action',
'aZ09');
49$value =
GETPOST(
'value',
'alpha');
50$modulepart =
GETPOST(
'modulepart',
'aZ09');
52$label =
GETPOST(
'label',
'alpha');
53$scandir =
GETPOST(
'scan_dir',
'alpha');
61include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
63if ($action ==
'updateMask') {
64 $maskconstorder =
GETPOST(
'maskconstorder',
'aZ09');
65 $maskorder =
GETPOST(
'maskorder',
'alpha');
67 if ($maskconstorder && preg_match(
'/_MASK$/', $maskconstorder)) {
68 $res =
dolibarr_set_const($db, $maskconstorder, $maskorder,
'chaine', 0,
'', $conf->entity);
80} elseif ($action ==
'specimen') {
81 $modele =
GETPOST(
'module',
'alpha');
84 $commande->initAsSpecimen();
90 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
91 foreach ($dirmodels as $reldir) {
92 $file =
dol_buildpath($reldir.
"core/modules/commande/doc/pdf_".$modele.
".modules.php", 0);
93 if (file_exists($file)) {
95 $classname =
"pdf_".$modele;
103 $module =
new $classname($db);
105 if ($module->write_file($commande, $langs) > 0) {
106 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=commande&file=SPECIMEN.pdf");
114 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
116} elseif ($action ==
'set') {
119} elseif ($action ==
'del') {
126} elseif ($action ==
'setdoc') {
128 if (
dolibarr_set_const($db,
"COMMANDE_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
131 $conf->global->COMMANDE_ADDON_PDF = $value;
139} elseif ($action ==
'setmod') {
144} elseif ($action ==
'set_COMMANDE_DRAFT_WATERMARK') {
145 $draft =
GETPOST(
"COMMANDE_DRAFT_WATERMARK");
146 $res =
dolibarr_set_const($db,
"COMMANDE_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
157} elseif ($action ==
'set_ORDER_FREE_TEXT') {
158 $freetext =
GETPOST(
"ORDER_FREE_TEXT",
'restricthtml');
160 $res =
dolibarr_set_const($db,
"ORDER_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
171} elseif ($action ==
'setribchq') {
172 $rib =
GETPOST(
'rib',
'alpha');
173 $chq =
GETPOST(
'chq',
'alpha');
175 $res =
dolibarr_set_const($db,
"FACTURE_RIB_NUMBER", $rib,
'chaine', 0,
'', $conf->entity);
176 $res =
dolibarr_set_const($db,
"FACTURE_CHQ_NUMBER", $chq,
'chaine', 0,
'', $conf->entity);
187} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
200 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
203} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
215 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
253$form =
new Form($db);
255$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
257llxHeader(
"", $langs->trans(
"OrdersSetup"));
259$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
260print
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>';
284foreach ($dirmodels as $reldir) {
288 $handle = opendir($dir);
289 if (is_resource($handle)) {
290 while (($file = readdir($handle)) !==
false) {
291 if (substr($file, 0, 13) ==
'mod_commande_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
292 $file = substr($file, 0,
dol_strlen($file) - 4);
294 require_once $dir.$file.
'.php';
296 $module =
new $file($db);
299 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
302 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
306 if ($module->isEnabled()) {
307 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
308 print $module->info($langs);
312 print
'<td class="nowrap">';
313 $tmp = $module->getExample();
314 if (preg_match(
'/^Error/', $tmp)) {
315 $langs->load(
"errors");
316 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
317 } elseif ($tmp ==
'NotConfigured') {
318 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
324 print
'<td class="center">';
325 if ($conf->global->COMMANDE_ADDON == $file) {
326 print
img_picto($langs->trans(
"Activated"),
'switch_on');
328 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.newToken().
'&value='.urlencode($file).
'">';
329 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
335 $commande->initAsSpecimen();
339 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
342 $nextval = $module->getNextValue($mysoc, $commande);
343 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
344 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
346 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
347 $nextval = $langs->trans($nextval);
349 $htmltooltip .= $nextval.
'<br>';
351 $htmltooltip .= $langs->trans($module->error).
'<br>';
355 print
'<td class="center">';
356 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
367print
"</table></div><br>\n";
379$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
380$sql .=
" WHERE type = '".$db->escape($type).
"'";
381$sql .=
" AND entity = ".$conf->entity;
382$resql = $db->query($sql);
385 $num_rows = $db->num_rows($resql);
386 while ($i < $num_rows) {
387 $array = $db->fetch_array($resql);
388 array_push($def, $array[0]);
396print
'<div class="div-table-responsive-no-min">';
397print
'<table class="noborder centpercent">'.
"\n";
398print
'<tr class="liste_titre">'.
"\n";
399print
'<td>'.$langs->trans(
"Name").
'</td>';
400print
'<td>'.$langs->trans(
"Description").
'</td>';
401print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
402print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
403print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
404print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
409foreach ($dirmodels as $reldir) {
410 foreach (array(
'',
'/doc') as $valdir) {
411 $realpath = $reldir.
"core/modules/commande".$valdir;
415 $handle = opendir($dir);
416 if (is_resource($handle)) {
417 while (($file = readdir($handle)) !==
false) {
423 foreach ($filelist as $file) {
424 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
425 if (file_exists($dir.
'/'.$file)) {
426 $name = substr($file, 4,
dol_strlen($file) - 16);
427 $classname = substr($file, 0,
dol_strlen($file) - 12);
429 require_once $dir.
'/'.$file;
430 $module =
new $classname($db);
432 $modulequalified = 1;
433 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
434 $modulequalified = 0;
436 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
437 $modulequalified = 0;
440 if ($modulequalified) {
441 print
'<tr class="oddeven"><td width="100">';
442 print(empty($module->name) ? $name : $module->
name);
444 if (method_exists($module,
'info')) {
445 print $module->info($langs);
447 print $module->description;
452 if (in_array($name, $def)) {
453 print
'<td class="center">'.
"\n";
454 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'">';
455 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
459 print
'<td class="center">'.
"\n";
460 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
465 print
'<td class="center">';
467 print
img_picto($langs->trans(
"Default"),
'on');
469 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
474 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
475 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
476 if ($module->type ==
'pdf') {
477 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
479 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
481 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
482 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
483 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
484 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
485 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
488 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
491 print
'<td class="center">';
492 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
496 print
'<td class="center">';
497 if ($module->type ==
'pdf') {
498 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
500 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
523print
load_fiche_titre($langs->trans(
"SuggestedPaymentModesIfNotDefinedInOrder"),
'',
'');
525print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
526print
'<input type="hidden" name="token" value="'.newToken().
'" />';
528print
'<div class="div-table-responsive-no-min">';
529print
'<table class="noborder centpercent">';
531print
'<tr class="liste_titre">';
533print
'<input type="hidden" name="action" value="setribchq">';
534print $langs->trans(
"PaymentMode").
'</td>';
535print
'<td align="right">';
536if (!isModEnabled(
'facture')) {
537 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
542print
'<tr class="oddeven">';
543print
"<td>".$langs->trans(
"SuggestPaymentByRIBOnAccount").
"</td>";
545if (!isModEnabled(
'facture')) {
546 if (isModEnabled(
"banque")) {
547 $sql =
"SELECT rowid, label";
548 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
549 $sql .=
" WHERE clos = 0";
550 $sql .=
" AND courant = 1";
551 $sql .=
" AND entity IN (".getEntity(
'bank_account').
")";
552 $resql = $db->query($sql);
554 $num = $db->num_rows($resql);
557 print
'<select name="rib" class="flat" id="rib">';
558 print
'<option value="0">'.$langs->trans(
"DoNotSuggestPaymentMode").
'</option>';
560 $row = $db->fetch_row($resql);
562 print
'<option value="'.$row[0].
'"';
563 print $conf->global->FACTURE_RIB_NUMBER == $row[0] ?
' selected' :
'';
564 print
'>'.$row[1].
'</option>';
570 print
"<i>".$langs->trans(
"NoActiveBankAccountDefined").
"</i>";
574 print
'<span class="opacitymedium">'.$langs->trans(
"BankModuleNotActive").
'</span>';
577 print
'<span class="opacitymedium">'.$langs->trans(
"SeeSetupOfModule", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
581print
'<tr class="oddeven">';
582print
"<td>".$langs->trans(
"SuggestPaymentByChequeToAddress").
"</td>";
584if (!isModEnabled(
'facture')) {
585 print
'<select class="flat" name="chq" id="chq">';
586 print
'<option value="0">'.$langs->trans(
"DoNotSuggestPaymentMode").
'</option>';
587 print
'<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ?
' selected' :
'').
'>'.$langs->trans(
"MenuCompanySetup").
' ('.($mysoc->name ? $mysoc->name : $langs->trans(
"NotDefined")).
')</option>';
589 $sql =
"SELECT rowid, label";
590 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
591 $sql .=
" WHERE clos = 0";
592 $sql .=
" AND courant = 1";
593 $sql .=
" AND entity IN (".getEntity(
'bank_account').
")";
595 $resql = $db->query($sql);
597 $num = $db->num_rows($resql);
600 $row = $db->fetch_row($resql);
602 print
'<option value="'.$row[0].
'"';
603 print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ?
' selected' :
'';
604 print
'>'.$langs->trans(
"OwnerOfBankAccount", $row[1]).
'</option>';
611 print
'<span class="opacitymedium">'.$langs->trans(
"SeeSetupOfModule", $langs->transnoentitiesnoconv(
"Module30Name")).
'</span>';
628print
'<div class="div-table-responsive-no-min">';
629print
'<table class="noborder centpercent">';
630print
'<tr class="liste_titre">';
631print
'<td>'.$langs->trans(
"Parameter").
'</td>';
632print
'<td class="center" width="60">'.$langs->trans(
"Value").
'</td>';
633print
"<td> </td>\n";
637$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
638$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
639foreach ($substitutionarray as $key => $val) {
640 $htmltext .= $key.
'<br>';
644print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
645print
'<input type="hidden" name="token" value="'.newToken().
'">';
646print
'<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
647print
'<tr class="oddeven"><td colspan="2">';
648print $form->textwithpicto($langs->trans(
"FreeLegalTextOnOrders"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
649$variablename =
'ORDER_FREE_TEXT';
651 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
653 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
655 print $doleditor->Create();
657print
'</td><td class="right">';
658print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
664print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
665print
'<input type="hidden" name="token" value="'.newToken().
'">';
666print
'<input type="hidden" name="action" value="set_COMMANDE_DRAFT_WATERMARK">';
667print
'<tr class="oddeven"><td>';
668print $form->textwithpicto($langs->trans(
"WatermarkOnDraftOrders"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
670print
'<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'COMMANDE_DRAFT_WATERMARK')).
'">';
671print
'</td><td class="right">';
672print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
676print
'<tr class="oddeven">';
677print
'<td>'.$langs->trans(
"AllowExternalDownload").
'</td>';
678print
'<td class="center" colspan="2">';
679print ajax_constantonoff(
'ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(),
null, 0, 0, 0, 2, 0, 1);
739print
'<div class="div-table-responsive-no-min">';
740print
'<table class="noborder centpercent">';
741print
'<tr class="liste_titre">';
742print
'<td>'.$langs->trans(
"Parameter").
'</td>';
743print
'<td class="center" width="60"></td>';
744print
'<td width="80"> </td>';
747print
'<tr class="oddeven"><td colspan="2">';
748print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification").
'<br>';
749print
'</td><td class="right">';
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.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
order_admin_prepare_head()
Return array head with list of tabs to view object informations.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.