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