dolibarr 19.0.3
commande.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
5 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
6 * Copyright (C) 2004 Andre Cianfarani <acianfa@free.fr>
7 * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
8 * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
9 * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
10 * Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
11 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
12 * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27
34// Load Dolibarr environment
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';
40
41// Load translation files required by the page
42$langs->loadLangs(array('admin', 'errors', 'orders', 'other'));
43
44if (!$user->admin) {
46}
47
48$action = GETPOST('action', 'aZ09');
49$value = GETPOST('value', 'alpha');
50$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
51
52$label = GETPOST('label', 'alpha');
53$scandir = GETPOST('scan_dir', 'alpha');
54$type = 'order';
55
56
57/*
58 * Actions
59 */
60
61include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
62
63if ($action == 'updateMask') {
64 $maskconstorder = GETPOST('maskconstorder', 'aZ09');
65 $maskorder = GETPOST('maskorder', 'alpha');
66
67 if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
68 $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
69 }
70
71 if (!($res > 0)) {
72 $error++;
73 }
74
75 if (!$error) {
76 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
77 } else {
78 setEventMessages($langs->trans("Error"), null, 'errors');
79 }
80} elseif ($action == 'specimen') {
81 $modele = GETPOST('module', 'alpha');
82
83 $commande = new Commande($db);
84 $commande->initAsSpecimen();
85
86 // Search template files
87 $file = '';
88 $classname = '';
89 $filefound = 0;
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)) {
94 $filefound = 1;
95 $classname = "pdf_".$modele;
96 break;
97 }
98 }
99
100 if ($filefound) {
101 require_once $file;
102
103 $module = new $classname($db);
104
105 if ($module->write_file($commande, $langs) > 0) {
106 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
107 return;
108 } else {
109 setEventMessages($module->error, null, 'errors');
110 dol_syslog($module->error, LOG_ERR);
111 }
112 } else {
113 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
114 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
115 }
116} elseif ($action == 'set') {
117 // Activate a model
118 $ret = addDocumentModel($value, $type, $label, $scandir);
119} elseif ($action == 'del') {
120 $ret = delDocumentModel($value, $type);
121 if ($ret > 0) {
122 if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) {
123 dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
124 }
125 }
126} elseif ($action == 'setdoc') {
127 // Set default model
128 if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
129 // The constant that was read before the new set
130 // We therefore requires a variable to have a coherent view
131 $conf->global->COMMANDE_ADDON_PDF = $value;
132 }
133
134 // On active le modele
135 $ret = delDocumentModel($value, $type);
136 if ($ret > 0) {
137 $ret = addDocumentModel($value, $type, $label, $scandir);
138 }
139} elseif ($action == 'setmod') {
140 // TODO Check if numbering module chosen can be activated
141 // by calling method canBeActivated
142
143 dolibarr_set_const($db, "COMMANDE_ADDON", $value, 'chaine', 0, '', $conf->entity);
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);
147
148 if (!($res > 0)) {
149 $error++;
150 }
151
152 if (!$error) {
153 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
154 } else {
155 setEventMessages($langs->trans("Error"), null, 'errors');
156 }
157} elseif ($action == 'set_ORDER_FREE_TEXT') {
158 $freetext = GETPOST("ORDER_FREE_TEXT", 'restricthtml'); // No alpha here, we want exact string
159
160 $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
161
162 if (!($res > 0)) {
163 $error++;
164 }
165
166 if (!$error) {
167 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
168 } else {
169 setEventMessages($langs->trans("Error"), null, 'errors');
170 }
171} elseif ($action == 'setribchq') {
172 $rib = GETPOST('rib', 'alpha');
173 $chq = GETPOST('chq', 'alpha');
174
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);
177
178 if (!($res > 0)) {
179 $error++;
180 }
181
182 if (!$error) {
183 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
184 } else {
185 setEventMessages($langs->trans("Error"), null, 'errors');
186 }
187} elseif (preg_match('/set_(.*)/', $action, $reg)) {
188 $code = $reg[1];
189 $value = (GETPOST($code) ? GETPOST($code) : 1);
190
191 $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
192 if (!($res > 0)) {
193 $error++;
194 }
195
196 if ($error) {
197 setEventMessages($langs->trans('Error'), null, 'errors');
198 } else {
199 setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
200 header("Location: " . $_SERVER["PHP_SELF"]);
201 exit();
202 }
203} elseif (preg_match('/del_(.*)/', $action, $reg)) {
204 $code = $reg[1];
205 $res = dolibarr_del_const($db, $code, $conf->entity);
206
207 if (!($res > 0)) {
208 $error++;
209 }
210
211 if ($error) {
212 setEventMessages($langs->trans('Error'), null, 'errors');
213 } else {
214 setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
215 header("Location: " . $_SERVER["PHP_SELF"]);
216 exit();
217 }
218}
219/*elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') {
220 // Activate ask for payment bank
221 $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
222
223 if (!($res > 0)) {
224 $error++;
225 }
226
227 if (!$error) {
228 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
229 } else {
230 setEventMessages($langs->trans("Error"), null, 'errors');
231 }
232} elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') {
233 // Activate ask for warehouse
234 $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
235
236 if (!($res > 0)) {
237 $error++;
238 }
239
240 if (!$error) {
241 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
242 } else {
243 setEventMessages($langs->trans("Error"), null, 'errors');
244 }
245} */
246
247
248
249/*
250 * View
251 */
252
253$form = new Form($db);
254
255$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
256
257llxHeader("", $langs->trans("OrdersSetup"));
258
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');
261
263
264print dol_get_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order');
265
266/*
267 * Orders Numbering model
268 */
269
270print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', '');
271
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>';
280print '</tr>'."\n";
281
282clearstatcache();
283
284foreach ($dirmodels as $reldir) {
285 $dir = dol_buildpath($reldir."core/modules/commande/");
286
287 if (is_dir($dir)) {
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);
293
294 require_once $dir.$file.'.php';
295
296 $module = new $file($db);
297
298 // Show modules according to features level
299 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
300 continue;
301 }
302 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
303 continue;
304 }
305
306 if ($module->isEnabled()) {
307 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
308 print $module->info($langs);
309 print '</td>';
310
311 // Show example of numbering model
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>';
319 } else {
320 print $tmp;
321 }
322 print '</td>'."\n";
323
324 print '<td class="center">';
325 if ($conf->global->COMMANDE_ADDON == $file) {
326 print img_picto($langs->trans("Activated"), 'switch_on');
327 } else {
328 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
329 print img_picto($langs->trans("Disabled"), 'switch_off');
330 print '</a>';
331 }
332 print '</td>';
333
334 $commande = new Commande($db);
335 $commande->initAsSpecimen();
336
337 // Info
338 $htmltooltip = '';
339 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
340 $commande->type = 0;
341
342 $nextval = $module->getNextValue($mysoc, $commande);
343 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
344 $htmltooltip .= ''.$langs->trans("NextValue").': ';
345 if ($nextval) {
346 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
347 $nextval = $langs->trans($nextval);
348 }
349 $htmltooltip .= $nextval.'<br>';
350 } else {
351 $htmltooltip .= $langs->trans($module->error).'<br>';
352 }
353 }
354
355 print '<td class="center">';
356 print $form->textwithpicto('', $htmltooltip, 1, 0);
357 print '</td>';
358
359 print "</tr>\n";
360 }
361 }
362 }
363 closedir($handle);
364 }
365 }
366}
367print "</table></div><br>\n";
368
369
370/*
371 * Document templates generators
372 */
373
374print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
375
376// Load array def with activated templates
377$def = array();
378$sql = "SELECT nom";
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);
383if ($resql) {
384 $i = 0;
385 $num_rows = $db->num_rows($resql);
386 while ($i < $num_rows) {
387 $array = $db->fetch_array($resql);
388 array_push($def, $array[0]);
389 $i++;
390 }
391} else {
392 dol_print_error($db);
393}
394
395
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>';
405print "</tr>\n";
406
407clearstatcache();
408
409foreach ($dirmodels as $reldir) {
410 foreach (array('', '/doc') as $valdir) {
411 $realpath = $reldir."core/modules/commande".$valdir;
412 $dir = dol_buildpath($realpath);
413
414 if (is_dir($dir)) {
415 $handle = opendir($dir);
416 if (is_resource($handle)) {
417 while (($file = readdir($handle)) !== false) {
418 $filelist[] = $file;
419 }
420 closedir($handle);
421 arsort($filelist);
422
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);
428
429 require_once $dir.'/'.$file;
430 $module = new $classname($db);
431
432 $modulequalified = 1;
433 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
434 $modulequalified = 0;
435 }
436 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
437 $modulequalified = 0;
438 }
439
440 if ($modulequalified) {
441 print '<tr class="oddeven"><td width="100">';
442 print(empty($module->name) ? $name : $module->name);
443 print "</td><td>\n";
444 if (method_exists($module, 'info')) {
445 print $module->info($langs);
446 } else {
447 print $module->description;
448 }
449 print '</td>';
450
451 // Active
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');
456 print '</a>';
457 print '</td>';
458 } else {
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>';
461 print "</td>";
462 }
463
464 // Default
465 print '<td class="center">';
466 if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
467 print img_picto($langs->trans("Default"), 'on');
468 } else {
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>';
470 }
471 print '</td>';
472
473 // Info
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;
478 }
479 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
480
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);
486 //$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
487 //$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
488 $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
489
490
491 print '<td class="center">';
492 print $form->textwithpicto('', $htmltooltip, 1, 0);
493 print '</td>';
494
495 // Preview
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>';
499 } else {
500 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
501 }
502 print '</td>';
503
504 print "</tr>\n";
505 }
506 }
507 }
508 }
509 }
510 }
511 }
512}
513
514print '</table>';
515print '</div>';
516
517
518/*
519 * Payment mode
520 */
521
522print '<br>';
523print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInOrder"), '', '');
524
525print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
526print '<input type="hidden" name="token" value="'.newToken().'" />';
527
528print '<div class="div-table-responsive-no-min">';
529print '<table class="noborder centpercent">';
530
531print '<tr class="liste_titre">';
532print '<td>';
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").'">';
538}
539print '</td>';
540print "</tr>\n";
541
542print '<tr class="oddeven">';
543print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
544print "<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);
553 if ($resql) {
554 $num = $db->num_rows($resql);
555 $i = 0;
556 if ($num > 0) {
557 print '<select name="rib" class="flat" id="rib">';
558 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
559 while ($i < $num) {
560 $row = $db->fetch_row($resql);
561
562 print '<option value="'.$row[0].'"';
563 print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
564 print '>'.$row[1].'</option>';
565
566 $i++;
567 }
568 print "</select>";
569 } else {
570 print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
571 }
572 }
573 } else {
574 print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
575 }
576} else {
577 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
578}
579print "</td></tr>";
580
581print '<tr class="oddeven">';
582print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
583print "<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>';
588
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').")";
594
595 $resql = $db->query($sql);
596 if ($resql) {
597 $num = $db->num_rows($resql);
598 $i = 0;
599 while ($i < $num) {
600 $row = $db->fetch_row($resql);
601
602 print '<option value="'.$row[0].'"';
603 print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
604 print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
605
606 $i++;
607 }
608 }
609 print "</select>";
610} else {
611 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
612}
613print "</td></tr>";
614print "</table>";
615print '</div>';
616
617print "</form>";
618
619
620print '<br>';
621
622/*
623 * Other options
624 */
625
626print load_fiche_titre($langs->trans("OtherOptions"), '', '');
627
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>&nbsp;</td>\n";
634print "</tr>\n";
635
636$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
637$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
638$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
639foreach ($substitutionarray as $key => $val) {
640 $htmltext .= $key.'<br>';
641}
642$htmltext .= '</i>';
643
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';
650if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
651 print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
652} else {
653 include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
654 $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
655 print $doleditor->Create();
656}
657print '</td><td class="right">';
658print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
659print "</td></tr>\n";
660print '</form>';
661
662//Use draft Watermark
663
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>';
669print '</td><td>';
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").'">';
673print "</td></tr>\n";
674
675// Allow external download
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);
680print '</td></tr>';
681print '</form>';
682
683/*
684// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
685// TODO Must be implemented by PDF templates
686// Ask for payment bank during order
687if (isModEnabled("banque")) {
688
689 print '<tr class="oddeven"><td>';
690 print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';
691 if (!empty($conf->use_javascript_ajax)) {
692 print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER');
693 } else {
694 if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) {
695 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
696 } else {
697 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
698 }
699 }
700 print '</td></tr>';
701} else {
702
703 print '<tr class="oddeven"><td>';
704 print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">'.$langs->trans('NotAvailable').'</td></tr>';
705}
706
707// Ask for warehouse during order
708if (isModEnabled('stock')) {
709 print '<tr class="oddeven"><td>';
710 print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';
711 if (!empty($conf->use_javascript_ajax)) {
712 print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
713 } else {
714 if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
715 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
716 } else {
717 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
718 }
719 }
720 print '</td></tr>';
721} else {
722 print '<tr class="oddeven"><td>';
723 print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">'.$langs->trans('NotAvailable').'</td></tr>';
724}
725*/
726
727print '</table>';
728print '</div>';
729
730print '<br>';
731
732
733/*
734 * Notifications
735 */
736
737print load_fiche_titre($langs->trans("Notifications"), '', '');
738
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">&nbsp;</td>';
745print "</tr>\n";
746
747print '<tr class="oddeven"><td colspan="2">';
748print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
749print '</td><td class="right">';
750print "</td></tr>\n";
751
752print '</table>';
753print '</div>';
754
755// End of page
756llxFooter();
757$db->close();
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.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage generation of HTML components Only common components must be here.
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).
Definition pdf.lib.php:762
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:124
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.