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