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