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