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