dolibarr 21.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-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
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$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, null, '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') == $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} elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') {
246 // Activate ask for warehouse
247 $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
248
249 if (!($res > 0)) {
250 $error++;
251 }
252
253 if (!$error) {
254 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
255 } else {
256 setEventMessages($langs->trans("Error"), null, 'errors');
257 }
258} */
259
260
261
262/*
263 * View
264 */
265
266$form = new Form($db);
267
268$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
269
270llxHeader("", $langs->trans("OrdersSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-order');
271
272$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
273print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
274
276
277print dol_get_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order');
278
279/*
280 * Orders Numbering model
281 */
282
283print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', '');
284
285print '<div class="div-table-responsive-no-min">';
286print '<table class="noborder centpercent">';
287print '<tr class="liste_titre">';
288print '<td>'.$langs->trans("Name").'</td>';
289print '<td>'.$langs->trans("Description").'</td>';
290print '<td class="nowrap">'.$langs->trans("Example").'</td>';
291print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
292print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
293print '</tr>'."\n";
294
295clearstatcache();
296
297foreach ($dirmodels as $reldir) {
298 $dir = dol_buildpath($reldir."core/modules/commande/");
299
300 if (is_dir($dir)) {
301 $handle = opendir($dir);
302 if (is_resource($handle)) {
303 while (($file = readdir($handle)) !== false) {
304 if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
305 $file = substr($file, 0, dol_strlen($file) - 4);
306
307 require_once $dir.$file.'.php';
308
309 $module = new $file($db);
310
311 '@phan-var-force ModeleNumRefCommandes $module';
312
313 // Show modules according to features level
314 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
315 continue;
316 }
317 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
318 continue;
319 }
320
321 if ($module->isEnabled()) {
322 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
323 print $module->info($langs);
324 print '</td>';
325
326 // Show example of numbering model
327 print '<td class="nowrap">';
328 $tmp = $module->getExample();
329 if (preg_match('/^Error/', $tmp)) {
330 $langs->load("errors");
331 print '<div class="error">'.$langs->trans($tmp).'</div>';
332 } elseif ($tmp == 'NotConfigured') {
333 print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
334 } else {
335 print $tmp;
336 }
337 print '</td>'."\n";
338
339 print '<td class="center">';
340 if ($conf->global->COMMANDE_ADDON == $file) {
341 print img_picto($langs->trans("Activated"), 'switch_on');
342 } else {
343 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">';
344 print img_picto($langs->trans("Disabled"), 'switch_off');
345 print '</a>';
346 }
347 print '</td>';
348
349 $commande = new Commande($db);
350 $commande->initAsSpecimen();
351
352 // Info
353 $htmltooltip = '';
354 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
355 $commande->type = 0;
356
357 $nextval = $module->getNextValue($mysoc, $commande);
358 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
359 $htmltooltip .= ''.$langs->trans("NextValue").': ';
360 if ($nextval) {
361 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
362 $nextval = $langs->trans($nextval);
363 }
364 $htmltooltip .= $nextval.'<br>';
365 } else {
366 $htmltooltip .= $langs->trans($module->error).'<br>';
367 }
368 }
369
370 print '<td class="center">';
371 print $form->textwithpicto('', $htmltooltip, 1, 0);
372 print '</td>';
373
374 print "</tr>\n";
375 }
376 }
377 }
378 closedir($handle);
379 }
380 }
381}
382print "</table></div><br>\n";
383
384
385/*
386 * Document templates generators
387 */
388
389print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
390
391// Load array def with activated templates
392$def = array();
393$sql = "SELECT nom";
394$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
395$sql .= " WHERE type = '".$db->escape($type)."'";
396$sql .= " AND entity = ".$conf->entity;
397$resql = $db->query($sql);
398if ($resql) {
399 $i = 0;
400 $num_rows = $db->num_rows($resql);
401 while ($i < $num_rows) {
402 $array = $db->fetch_array($resql);
403 if (is_array($array)) {
404 array_push($def, $array[0]);
405 }
406 $i++;
407 }
408} else {
409 dol_print_error($db);
410}
411
412
413print '<div class="div-table-responsive-no-min">';
414print '<table class="noborder centpercent">'."\n";
415print '<tr class="liste_titre">'."\n";
416print '<td>'.$langs->trans("Name").'</td>';
417print '<td>'.$langs->trans("Description").'</td>';
418print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
419print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
420print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
421print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
422print "</tr>\n";
423
424clearstatcache();
425
426foreach ($dirmodels as $reldir) {
427 foreach (array('', '/doc') as $valdir) {
428 $realpath = $reldir."core/modules/commande".$valdir;
429 $dir = dol_buildpath($realpath);
430
431 if (is_dir($dir)) {
432 $handle = opendir($dir);
433 if (is_resource($handle)) {
434 $filelist = array();
435 while (($file = readdir($handle)) !== false) {
436 $filelist[] = $file;
437 }
438 closedir($handle);
439 arsort($filelist);
440
441 foreach ($filelist as $file) {
442 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
443 if (file_exists($dir.'/'.$file)) {
444 $name = substr($file, 4, dol_strlen($file) - 16);
445 $classname = substr($file, 0, dol_strlen($file) - 12);
446
447 require_once $dir.'/'.$file;
448 $module = new $classname($db);
449
450 '@phan-var-force ModelePDFCommandes $module';
451
452 $modulequalified = 1;
453 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
454 $modulequalified = 0;
455 }
456 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
457 $modulequalified = 0;
458 }
459
460 if ($modulequalified) {
461 print '<tr class="oddeven"><td width="100">';
462 print(empty($module->name) ? $name : $module->name);
463 print "</td><td>\n";
464 if (method_exists($module, 'info')) {
465 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
466 } else {
467 print $module->description;
468 }
469 print '</td>';
470
471 // Active
472 if (in_array($name, $def)) {
473 print '<td class="center">'."\n";
474 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
475 print img_picto($langs->trans("Enabled"), 'switch_on');
476 print '</a>';
477 print '</td>';
478 } else {
479 print '<td class="center">'."\n";
480 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>';
481 print "</td>";
482 }
483
484 // Default
485 print '<td class="center">';
486 if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
487 print img_picto($langs->trans("Default"), 'on');
488 } else {
489 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>';
490 }
491 print '</td>';
492
493 // Info
494 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
495 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
496 if ($module->type == 'pdf') {
497 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
498 }
499 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
500
501 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
502 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
503 $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
504 $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
505 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
506 //$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
507 //$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
508 $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
509
510
511 print '<td class="center">';
512 print $form->textwithpicto('', $htmltooltip, 1, 0);
513 print '</td>';
514
515 // Preview
516 print '<td class="center">';
517 if ($module->type == 'pdf') {
518 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
519 } else {
520 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
521 }
522 print '</td>';
523
524 print "</tr>\n";
525 }
526 }
527 }
528 }
529 }
530 }
531 }
532}
533
534print '</table>';
535print '</div>';
536
537
538/*
539 * Payment mode
540 */
541
542print '<br>';
543print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInOrder"), '', '');
544
545print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
546print '<input type="hidden" name="token" value="'.newToken().'" />';
547
548print '<div class="div-table-responsive-no-min">';
549print '<table class="noborder centpercent">';
550
551print '<tr class="liste_titre">';
552print '<td>';
553print '<input type="hidden" name="action" value="setribchq">';
554print $langs->trans("PaymentMode").'</td>';
555print '<td align="right">';
556if (!isModEnabled('invoice')) {
557 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
558}
559print '</td>';
560print "</tr>\n";
561
562print '<tr class="oddeven">';
563print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
564print "<td>";
565if (!isModEnabled('invoice')) {
566 if (isModEnabled("bank")) {
567 $sql = "SELECT rowid, label";
568 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
569 $sql .= " WHERE clos = 0";
570 $sql .= " AND courant = 1";
571 $sql .= " AND entity IN (".getEntity('bank_account').")";
572 $resql = $db->query($sql);
573 if ($resql) {
574 $num = $db->num_rows($resql);
575 $i = 0;
576 if ($num > 0) {
577 print '<select name="rib" class="flat" id="rib">';
578 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
579 while ($i < $num) {
580 $row = $db->fetch_row($resql);
581
582 print '<option value="'.$row[0].'"';
583 print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
584 print '>'.$row[1].'</option>';
585
586 $i++;
587 }
588 print "</select>";
589 } else {
590 print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
591 }
592 }
593 } else {
594 print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
595 }
596} else {
597 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
598}
599print "</td></tr>";
600
601print '<tr class="oddeven">';
602print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
603print "<td>";
604if (!isModEnabled('invoice')) {
605 print '<select class="flat" name="chq" id="chq">';
606 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
607 print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
608
609 $sql = "SELECT rowid, label";
610 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
611 $sql .= " WHERE clos = 0";
612 $sql .= " AND courant = 1";
613 $sql .= " AND entity IN (".getEntity('bank_account').")";
614
615 $resql = $db->query($sql);
616 if ($resql) {
617 $num = $db->num_rows($resql);
618 $i = 0;
619 while ($i < $num) {
620 $row = $db->fetch_row($resql);
621
622 print '<option value="'.$row[0].'"';
623 print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
624 print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
625
626 $i++;
627 }
628 }
629 print "</select>";
630} else {
631 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
632}
633print "</td></tr>";
634print "</table>";
635print '</div>';
636
637print "</form>";
638
639
640print '<br>';
641
642/*
643 * Other options
644 */
645
646print load_fiche_titre($langs->trans("OtherOptions"), '', '');
647
648print '<div class="div-table-responsive-no-min">';
649print '<table class="noborder centpercent">';
650print '<tr class="liste_titre">';
651print '<td>'.$langs->trans("Parameter").'</td>';
652print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
653print "<td>&nbsp;</td>\n";
654print "</tr>\n";
655
656$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
657$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
658$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
659foreach ($substitutionarray as $key => $val) {
660 $htmltext .= $key.'<br>';
661}
662$htmltext .= '</i>';
663
664print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
665print '<input type="hidden" name="token" value="'.newToken().'">';
666print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
667print '<tr class="oddeven"><td colspan="2">';
668print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
669$variablename = 'ORDER_FREE_TEXT';
670if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
671 print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
672} else {
673 include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
674 $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
675 print $doleditor->Create();
676}
677print '</td><td class="right">';
678print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
679print "</td></tr>\n";
680print '</form>';
681
682//Use draft Watermark
683
684print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
685print '<input type="hidden" name="token" value="'.newToken().'">';
686print '<input type="hidden" name="action" value="set_COMMANDE_DRAFT_WATERMARK">';
687print '<tr class="oddeven"><td>';
688print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
689print '</td><td>';
690print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('COMMANDE_DRAFT_WATERMARK')).'">';
691print '</td><td class="right">';
692print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
693print "</td></tr>\n";
694
695// Allow external download
696print '<tr class="oddeven">';
697print '<td>'.$langs->trans("AllowExternalDownload").'</td>';
698print '<td class="left" colspan="2">';
699print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
700print '</td></tr>';
701print '</form>';
702
703// Disallow to classify billed an order without invoice, only if module invoice is enable
704if (isModEnabled('invoice')) {
705 print '<tr class="oddeven"><td>'.$langs->trans("InvoiceClassifyBilledSupplierOrderWithoutInvoice"). '&nbsp;' ;
706 print $form->textwithpicto('', $langs->trans("InvoiceClassifyBilledSupplierOrderWithoutInvoiceHelp"), 1, 'help') . '</td>';
707 print '<td class="left" colspan="2">';
708 print ajax_constantonoff('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER');
709 print '</td></tr>';
710}
711
712/*
713// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
714// TODO Must be implemented by PDF templates
715// Ask for payment bank during order
716if (isModEnabled("banque")) {
717
718 print '<tr class="oddeven"><td>';
719 print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';
720 if (!empty($conf->use_javascript_ajax)) {
721 print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER');
722 } else {
723 if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) {
724 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>';
725 } else {
726 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>';
727 }
728 }
729 print '</td></tr>';
730} else {
731
732 print '<tr class="oddeven"><td>';
733 print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">'.$langs->trans('NotAvailable').'</td></tr>';
734}
735
736// Ask for warehouse during order
737if (isModEnabled('stock')) {
738 print '<tr class="oddeven"><td>';
739 print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';
740 if (!empty($conf->use_javascript_ajax)) {
741 print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
742 } else {
743 if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
744 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>';
745 } else {
746 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>';
747 }
748 }
749 print '</td></tr>';
750} else {
751 print '<tr class="oddeven"><td>';
752 print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">'.$langs->trans('NotAvailable').'</td></tr>';
753}
754*/
755
756print '</table>';
757print '</div>';
758
759print '<br>';
760
761
762/*
763 * Notifications
764 */
765
766print load_fiche_titre($langs->trans("Notifications"), '', '');
767
768print '<div class="div-table-responsive-no-min">';
769print '<table class="noborder centpercent">';
770print '<tr class="liste_titre">';
771print '<td>'.$langs->trans("Parameter").'</td>';
772print '<td class="center" width="60"></td>';
773print '<td width="80">&nbsp;</td>';
774print "</tr>\n";
775
776print '<tr class="oddeven"><td colspan="2">';
777print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
778print '</td><td class="right">';
779print "</td></tr>\n";
780
781print '</table>';
782print '</div>';
783
784// End of page
785llxFooter();
786$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:71
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)
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'.
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...
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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:765
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:152
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.