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