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