dolibarr 23.0.3
order.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-2025 Frédéric France <frederic.france@free.fr>
13 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 */
28
35// Load Dolibarr environment
36require '../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
41
51// Load translation files required by the page
52$langs->loadLangs(array('admin', 'errors', 'orders', 'other'));
53
54if (!$user->admin) {
56}
57
58$action = GETPOST('action', 'aZ09');
59$value = GETPOST('value', 'alpha');
60$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
61
62$label = GETPOST('label', 'alpha');
63$scandir = GETPOST('scan_dir', 'alpha');
64$type = 'order';
65
66
67/*
68 * Actions
69 */
70
71$error = 0;
72
73include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
74
75if ($action == 'updateMask') {
76 $maskconstorder = GETPOST('maskconstorder', 'aZ09');
77 $maskorder = GETPOST('maskorder', 'alpha');
78
79 $res = 0;
80
81 if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
82 $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
83 }
84
85 if (!($res > 0)) {
86 $error++;
87 }
88
89 if (!$error) {
90 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
91 } else {
92 setEventMessages($langs->trans("Error"), null, 'errors');
93 }
94} elseif ($action == 'specimen') {
95 $modele = GETPOST('module', 'alpha');
96
97 $commande = new Commande($db);
98 $commande->initAsSpecimen();
99
100 // Search template files
101 $file = '';
102 $classname = '';
103 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
104 foreach ($dirmodels as $reldir) {
105 $file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
106 if (file_exists($file)) {
107 $classname = "pdf_".$modele;
108 break;
109 }
110 }
111
112 if ($classname !== '') {
113 require_once $file;
114
115 $module = new $classname($db);
116 '@phan-var-force ModelePDFCommandes $module';
119 if ($module->write_file($commande, $langs) > 0) {
120 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
121 return;
122 } else {
123 setEventMessages($module->error, $module->errors, 'errors');
124 dol_syslog($module->error, LOG_ERR);
125 }
126 } else {
127 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
128 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
129 }
130} elseif ($action == 'set') {
131 // Activate a model
132 $ret = addDocumentModel($value, $type, $label, $scandir);
133} elseif ($action == 'del') {
134 $ret = delDocumentModel($value, $type);
135 if ($ret > 0) {
136 if (getDolGlobalString('COMMANDE_ADDON_PDF') == (string) $value) {
137 dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
138 }
139 }
140} elseif ($action == 'setdoc') {
141 // Set default model
142 if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
143 // The constant that was read before the new set
144 // We therefore requires a variable to have a coherent view
145 $conf->global->COMMANDE_ADDON_PDF = $value;
146 }
147
148 // On active le modele
149 $ret = delDocumentModel($value, $type);
150 if ($ret > 0) {
151 $ret = addDocumentModel($value, $type, $label, $scandir);
152 }
153} elseif ($action == 'setmod') {
154 // TODO Check if numbering module chosen can be activated
155 // by calling method canBeActivated
156
157 dolibarr_set_const($db, "COMMANDE_ADDON", $value, 'chaine', 0, '', $conf->entity);
158} elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK') {
159 $draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
160 $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), '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 == 'set_ORDER_FREE_TEXT') {
172 $freetext = GETPOST("ORDER_FREE_TEXT", 'restricthtml'); // No alpha here, we want exact string
173
174 $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
175
176 if (!($res > 0)) {
177 $error++;
178 }
179
180 if (!$error) {
181 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
182 } else {
183 setEventMessages($langs->trans("Error"), null, 'errors');
184 }
185} elseif ($action == 'setribchq') {
186 $rib = GETPOST('rib', 'alpha');
187 $chq = GETPOST('chq', 'alpha');
188
189 $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
190 $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
191
192 if (!($res > 0)) {
193 $error++;
194 }
195
196 if (!$error) {
197 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
198 } else {
199 setEventMessages($langs->trans("Error"), null, 'errors');
200 }
201} elseif (preg_match('/set_(.*)/', $action, $reg)) {
202 $code = $reg[1];
203 $value = (GETPOST($code) ? GETPOST($code) : 1);
204
205 $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
206 if (!($res > 0)) {
207 $error++;
208 }
209
210 if ($error) {
211 setEventMessages($langs->trans('Error'), null, 'errors');
212 } else {
213 setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
214 header("Location: " . $_SERVER["PHP_SELF"]);
215 exit();
216 }
217} elseif (preg_match('/del_(.*)/', $action, $reg)) {
218 $code = $reg[1];
219 $res = dolibarr_del_const($db, $code, $conf->entity);
220
221 if (!($res > 0)) {
222 $error++;
223 }
224
225 if ($error) {
226 setEventMessages($langs->trans('Error'), null, 'errors');
227 } else {
228 setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
229 header("Location: " . $_SERVER["PHP_SELF"]);
230 exit();
231 }
232}
233/*elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') {
234 // Activate ask for payment bank
235 $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
236
237 if (!($res > 0)) {
238 $error++;
239 }
240
241 if (!$error) {
242 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
243 } else {
244 setEventMessages($langs->trans("Error"), null, 'errors');
245 }
246} */
247
248
249
250/*
251 * View
252 */
253
254$form = new Form($db);
255
256$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
257
258llxHeader("", $langs->trans("OrdersSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-order');
259
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>';
261
262print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
263
265
266print dol_get_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order');
267
268
269// Numbering module
270
271print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', '');
272
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>';
281print '</tr>'."\n";
282
283clearstatcache();
284
285$arrayofmodules = array();
286
287
288foreach ($dirmodels as $reldir) {
289 $dir = dol_buildpath($reldir."core/modules/commande/");
290
291 if (is_dir($dir)) {
292 $handle = opendir($dir);
293 if (is_resource($handle)) {
294 while (($file = readdir($handle)) !== false) {
295 if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
296 $file = substr($file, 0, dol_strlen($file) - 4);
297
298 if (!class_exists($file)) {
299 require_once $dir.$file.'.php';
300
301 $module = new $file($db);
303 '@phan-var-force ModeleNumRefCommandes $module';
304
305 $arrayofmodules[] = $module;
306 }
307 }
308 }
309 closedir($handle);
310 }
311 }
312}
313
314$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
316'@phan-var-force ModeleNumRefCommandes[] $arrayofmodules';
317
318foreach ($arrayofmodules as $module) {
319 $file = strtolower($module->getName($langs));
320 if (!preg_match('/^mod_commande_/', $file)) {
321 $file = 'mod_commande_'.$file;
322 }
323
324 // Show modules according to features level
325 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
326 continue;
327 }
328 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
329 continue;
330 }
331
332 if ($module->isEnabled()) {
333 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
334 print $module->info($langs);
335 print '</td>';
336
337 // Show example of numbering model
338 print '<td class="nowrap">';
339 $tmp = $module->getExample();
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>';
345 } else {
346 print $tmp;
347 }
348 print '</td>'."\n";
349
350 print '<td class="center">';
351 if (getDolGlobalString('COMMANDE_ADDON') == $file) {
352 print img_picto($langs->trans("Activated"), 'switch_on');
353 } else {
354 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
355 print img_picto($langs->trans("Disabled"), 'switch_off');
356 print '</a>';
357 }
358 print '</td>';
359
360 $commande = new Commande($db);
361 $commande->initAsSpecimen();
362
363 // Info
364 $htmltooltip = '';
365 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
366 $commande->type = 0;
367
368 $nextval = $module->getNextValue($mysoc, $commande);
369 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
370 $htmltooltip .= ''.$langs->trans("NextValue").': ';
371 if ($nextval) {
372 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
373 $nextval = $langs->trans($nextval);
374 }
375 $htmltooltip .= $nextval.'<br>';
376 } else {
377 $htmltooltip .= $langs->trans($module->error).'<br>';
378 }
379 }
380
381 print '<td class="center">';
382 print $form->textwithpicto('', $htmltooltip, 1, 'info');
383 print '</td>';
384
385 print "</tr>\n";
386 }
387}
388print "</table></div><br>\n";
389
390
391/*
392 * Document templates generators
393 */
394
395print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
396
397// Load array def with activated templates
398$def = array();
399$sql = "SELECT nom";
400$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
401$sql .= " WHERE type = '".$db->escape($type)."'";
402$sql .= " AND entity = ".((int) $conf->entity);
403$resql = $db->query($sql);
404if ($resql) {
405 $i = 0;
406 $num_rows = $db->num_rows($resql);
407 while ($i < $num_rows) {
408 $array = $db->fetch_array($resql);
409 if (is_array($array)) {
410 array_push($def, $array[0]);
411 }
412 $i++;
413 }
414} else {
415 dol_print_error($db);
416}
417
418
419print '<div class="div-table-responsive-no-min">';
420print '<table class="noborder centpercent">'."\n";
421print '<tr class="liste_titre">'."\n";
422print '<td>'.$langs->trans("Name").'</td>';
423print '<td>'.$langs->trans("Description").'</td>';
424print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
425print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
426print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
427print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
428print "</tr>\n";
429
430clearstatcache();
431
432foreach ($dirmodels as $reldir) {
433 foreach (array('', '/doc') as $valdir) {
434 $realpath = $reldir."core/modules/commande".$valdir;
435 $dir = dol_buildpath($realpath);
436
437 if (is_dir($dir)) {
438 $handle = opendir($dir);
439 if (is_resource($handle)) {
440 $filelist = array();
441 while (($file = readdir($handle)) !== false) {
442 $filelist[] = $file;
443 }
444 closedir($handle);
445 arsort($filelist);
446
447 foreach ($filelist as $file) {
448 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
449 if (file_exists($dir.'/'.$file)) {
450 $name = substr($file, 4, dol_strlen($file) - 16);
451 $classname = substr($file, 0, dol_strlen($file) - 12);
452
453 require_once $dir.'/'.$file;
454 $module = new $classname($db);
455
456 '@phan-var-force ModelePDFCommandes $module';
457
458 $modulequalified = 1;
459 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
460 $modulequalified = 0;
461 }
462 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
463 $modulequalified = 0;
464 }
465
466 if ($modulequalified) {
467 print '<tr class="oddeven"><td width="100">';
468 print(empty($module->name) ? $name : $module->name);
469 print "</td><td>\n";
470 if (method_exists($module, 'info')) {
471 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
472 } else {
473 print $module->description;
474 }
475 print '</td>';
476
477 // Active
478 if (in_array($name, $def)) {
479 print '<td class="center">'."\n";
480 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
481 print img_picto($langs->trans("Enabled"), 'switch_on');
482 print '</a>';
483 print '</td>';
484 } else {
485 print '<td class="center">'."\n";
486 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>';
487 print "</td>";
488 }
489
490 // Default
491 print '<td class="center">';
492 if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
493 print img_picto($langs->trans("Default"), 'on');
494 } else {
495 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>';
496 }
497 print '</td>';
498
499 // Info
500 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
501 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
502 if ($module->type == 'pdf') {
503 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
504 }
505 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
506
507 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
508 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
509 $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
510 $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
511 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
512 //$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
513 //$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
514 $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
515
516
517 print '<td class="center">';
518 print $form->textwithpicto('', $htmltooltip, 1, 'info');
519 print '</td>';
520
521 // Preview
522 print '<td class="center">';
523 if ($module->type == 'pdf') {
524 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
525 } else {
526 print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
527 }
528 print '</td>';
529
530 print "</tr>\n";
531 }
532 }
533 }
534 }
535 }
536 }
537 }
538}
539
540print '</table>';
541print '</div>';
542
543
544/*
545 * Payment mode
546 */
547
548print '<br>';
549print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInOrder"), '', '');
550
551print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
552print '<input type="hidden" name="token" value="'.newToken().'" />';
553
554print '<div class="div-table-responsive-no-min">';
555print '<table class="noborder centpercent">';
556
557print '<tr class="liste_titre">';
558print '<td>';
559print '<input type="hidden" name="action" value="setribchq">';
560print $langs->trans("PaymentMode").'</td>';
561print '<td align="right">';
562if (!isModEnabled('invoice')) {
563 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
564}
565print '</td>';
566print "</tr>\n";
567
568print '<tr class="oddeven">';
569print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
570print "<td>";
571if (!isModEnabled('invoice')) {
572 if (isModEnabled("bank")) {
573 $sql = "SELECT rowid, label";
574 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
575 $sql .= " WHERE clos = 0";
576 $sql .= " AND courant = 1";
577 $sql .= " AND entity IN (".getEntity('bank_account').")";
578 $resql = $db->query($sql);
579 if ($resql) {
580 $num = $db->num_rows($resql);
581 $i = 0;
582 if ($num > 0) {
583 print '<select name="rib" class="flat" id="rib">';
584 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
585 while ($i < $num) {
586 $row = $db->fetch_row($resql);
587
588 print '<option value="'.$row[0].'"';
589 print getDolGlobalString('FACTURE_RIB_NUMBER') == $row[0] ? ' selected' : '';
590 print '>'.$row[1].'</option>';
591
592 $i++;
593 }
594 print "</select>";
595 } else {
596 print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
597 }
598 }
599 } else {
600 print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
601 }
602} else {
603 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
604}
605print "</td></tr>";
606
607print '<tr class="oddeven">';
608print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
609print "<td>";
610if (!isModEnabled('invoice')) {
611 print '<select class="flat" name="chq" id="chq">';
612 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
613 print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
614
615 $sql = "SELECT rowid, label";
616 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
617 $sql .= " WHERE clos = 0";
618 $sql .= " AND courant = 1";
619 $sql .= " AND entity IN (".getEntity('bank_account').")";
620
621 $resql = $db->query($sql);
622 if ($resql) {
623 $num = $db->num_rows($resql);
624 $i = 0;
625 while ($i < $num) {
626 $row = $db->fetch_row($resql);
627
628 print '<option value="'.$row[0].'"';
629 print getDolGlobalString('FACTURE_CHQ_NUMBER') == $row[0] ? ' selected' : '';
630 print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
631
632 $i++;
633 }
634 }
635 print "</select>";
636} else {
637 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
638}
639print "</td></tr>";
640print "</table>";
641print '</div>';
642
643print "</form>";
644
645
646print '<br>';
647
648/*
649 * Other options
650 */
651
652print load_fiche_titre($langs->trans("OtherOptions"), '', '');
653
654print '<div class="div-table-responsive-no-min">';
655print '<table class="noborder centpercent">';
656print '<tr class="liste_titre">';
657print '<td>'.$langs->trans("Parameter").'</td>';
658print '<td class="center" width="60"></td>';
659print "<td>&nbsp;</td>\n";
660print "</tr>\n";
661
662$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
663$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
664$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
665foreach ($substitutionarray as $key => $val) {
666 $htmltext .= $key.'<br>';
667}
668$htmltext .= '</i>';
669
670print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
671print '<input type="hidden" name="token" value="'.newToken().'">';
672print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
673print '<tr class="oddeven"><td colspan="2">';
674print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
675$variablename = 'ORDER_FREE_TEXT';
676if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
677 print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
678} else {
679 include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
680 $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
681 print $doleditor->Create();
682}
683print '</td><td class="right">';
684print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
685print "</td></tr>\n";
686print '</form>';
687
688//Use draft Watermark
689
690print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
691print '<input type="hidden" name="token" value="'.newToken().'">';
692print '<input type="hidden" name="action" value="set_COMMANDE_DRAFT_WATERMARK">';
693print '<tr class="oddeven"><td>';
694print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
695print '</td><td>';
696print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('COMMANDE_DRAFT_WATERMARK')).'">';
697print '</td><td class="right">';
698print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
699print "</td></tr>\n";
700
701// Allow external download
702print '<tr class="oddeven">';
703print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
704print '<td class="left" colspan="2">';
705print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
706print '</td></tr>';
707print '</form>';
708
709// Disallow to classify billed an order without invoice, only if module invoice is enable
710if (isModEnabled('invoice')) {
711 print '<tr class="oddeven"><td>'.$langs->trans("InvoiceClassifyBilledSupplierOrderWithoutInvoice"). '&nbsp;' ;
712 print $form->textwithpicto('', $langs->trans("InvoiceClassifyBilledSupplierOrderWithoutInvoiceHelp"), 1, 'help') . '</td>';
713 print '<td class="left" colspan="2">';
714 print ajax_constantonoff('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER');
715 print '</td></tr>';
716}
717
718// Notifications
719print '<tr class="oddeven">';
720print '<td>'.img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("Notifications").'</td>';
721print '<td colspan="2">';
722print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification");
723print '</td></tr>';
724
725// More PDF options
726print '<tr class="oddeven">';
727print '<td>'.img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("MoreOptionsRelatedToPDF").'</td>';
728print '<td colspan="2">';
729print img_picto('', 'url', 'class="pictofixedwidth"').'<a href="'.DOL_URL_ROOT.'/admin/pdf_other.php">'.$langs->trans("SeeInPDFSetupPage").'</a>';
730print '</td></tr>';
731
732
733print '</table>';
734print '</div>';
735
736print '<br>';
737
738
739// End of page
740llxFooter();
741$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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage generation of HTML components Only common components must be here.
global $mysoc
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
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.
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'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
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).
Definition pdf.lib.php:824
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.