dolibarr  13.0.2
expensereport.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2015 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) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
7  * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
8  * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
9  * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
31 require '../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
36 
37 // Load translation files required by the page
38 $langs->loadLangs(array('admin', 'errors', 'trips', 'other'));
39 
40 if (!$user->admin) accessforbidden();
41 
42 $action = GETPOST('action', 'aZ09');
43 $value = GETPOST('value', 'alpha');
44 $label = GETPOST('label', 'alpha');
45 $scandir = GETPOST('scan_dir', 'alpha');
46 $type = 'expensereport';
47 
48 
49 /*
50  * Actions
51  */
52 
53 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
54 
55 if ($action == 'updateMask')
56 {
57  $maskconst = GETPOST('maskconst', 'alpha');
58  $maskvalue = GETPOST('maskvalue', 'alpha');
59  if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
60 
61  if (!($res > 0)) {
62  $error++;
63  }
64 
65  if (!$error)
66  {
67  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
68  } else {
69  setEventMessages($langs->trans("Error"), null, 'errors');
70  }
71 } elseif ($action == 'specimen') // For fiche inter
72 {
73  $modele = GETPOST('module', 'alpha');
74 
75  $inter = new ExpenseReport($db);
76  $inter->initAsSpecimen();
77  $inter->status = 0; // Force statut draft to show watermark
78  $inter->fk_statut = 0; // Force statut draft to show watermark
79 
80  // Search template files
81  $file = ''; $classname = ''; $filefound = 0;
82  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
83  foreach ($dirmodels as $reldir)
84  {
85  $file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0);
86  if (file_exists($file))
87  {
88  $filefound = 1;
89  $classname = "pdf_".$modele;
90  break;
91  }
92  }
93 
94  if ($filefound)
95  {
96  require_once $file;
97 
98  $module = new $classname($db);
99 
100  if ($module->write_file($inter, $langs) > 0)
101  {
102  header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf");
103  return;
104  } else {
105  setEventMessages($module->error, $module->errors, 'errors');
106  dol_syslog($module->error, LOG_ERR);
107  }
108  } else {
109  setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
110  dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
111  }
112 }
113 
114 // Activate a model
115 elseif ($action == 'set')
116 {
117  $ret = addDocumentModel($value, $type, $label, $scandir);
118  if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF))
119  {
120  dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity);
121  }
122 } elseif ($action == 'del')
123 {
124  $ret = delDocumentModel($value, $type);
125  if ($ret > 0)
126  {
127  if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity);
128  }
129 }
130 
131 // Set default model
132 elseif ($action == 'setdoc')
133 {
134  if (dolibarr_set_const($db, "EXPENSEREPORT_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
135  {
136  // La constante qui a ete lue en avant du nouveau set
137  // on passe donc par une variable pour avoir un affichage coherent
138  $conf->global->EXPENSEREPORT_ADDON_PDF = $value;
139  }
140 
141  // On active le modele
142  $ret = delDocumentModel($value, $type);
143  if ($ret > 0)
144  {
145  $ret = addDocumentModel($value, $type, $label, $scandir);
146  }
147 } elseif ($action == 'setmod')
148 {
149  // TODO Verifier si module numerotation choisi peut etre active
150  // par appel methode canBeActivated
151 
152  dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity);
153 } elseif ($action == 'setoptions')
154 {
155  $db->begin();
156 
157  $freetext = GETPOST('EXPENSEREPORT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
158  $res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
159 
160  $draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha');
161  $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
162 
163  if (!$res1 > 0 || !$res2 > 0) $error++;
164 
165  if (!$error)
166  {
167  $db->commit();
168  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
169  } else {
170  $db->rollback();
171  setEventMessages($langs->trans("Error"), null, 'errors');
172  }
173 }
174 
175 
176 /*
177  * View
178  */
179 
180 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
181 
182 llxHeader('', $langs->trans("ExpenseReportsSetup"));
183 
184 $form = new Form($db);
185 
186 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
187 print load_fiche_titre($langs->trans("ExpenseReportsSetup"), $linkback, 'title_setup');
188 
189 
191 
192 print dol_get_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), -1, 'trip');
193 
194 /*
195  * Expense report numbering model
196  */
197 
198 print load_fiche_titre($langs->trans("ExpenseReportNumberingModules"), '', '');
199 
200 print '<table class="noborder centpercent">';
201 print '<tr class="liste_titre">';
202 print '<td>'.$langs->trans("Name").'</td>';
203 print '<td>'.$langs->trans("Description").'</td>';
204 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
205 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
206 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
207 print '</tr>'."\n";
208 
209 clearstatcache();
210 
211 foreach ($dirmodels as $reldir)
212 {
213  $dir = dol_buildpath($reldir."core/modules/expensereport/");
214 
215  if (is_dir($dir))
216  {
217  $handle = opendir($dir);
218  if (is_resource($handle))
219  {
220  while (($file = readdir($handle)) !== false)
221  {
222  if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
223  {
224  $file = substr($file, 0, dol_strlen($file) - 4);
225 
226  require_once $dir.$file.'.php';
227 
228  $module = new $file($db);
229 
230  // Show modules according to features level
231  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
232  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
233 
234  if ($module->isEnabled())
235  {
236  print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
237  print $module->info();
238  print '</td>';
239 
240  // Show example of numbering model
241  print '<td class="nowrap">';
242  $tmp = $module->getExample();
243  if (preg_match('/^Error/', $tmp)) {
244  $langs->load("errors");
245  print '<div class="error">'.$langs->trans($tmp).'</div>';
246  } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
247  else print $tmp;
248  print '</td>'."\n";
249 
250  print '<td class="center">';
251  if ($conf->global->EXPENSEREPORT_ADDON == $file)
252  {
253  print img_picto($langs->trans("Activated"), 'switch_on');
254  } else {
255  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
256  print img_picto($langs->trans("Disabled"), 'switch_off');
257  print '</a>';
258  }
259  print '</td>';
260 
261  $exp = new ExpenseReport($db);
262  $exp->initAsSpecimen();
263 
264  // Info
265  $htmltooltip = '';
266  $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
267  $nextval = $module->getNextValue($exp);
268  if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
269  $htmltooltip .= ''.$langs->trans("NextValue").': ';
270  if ($nextval) {
271  if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
272  $nextval = $langs->trans($nextval);
273  $htmltooltip .= $nextval.'<br>';
274  } else {
275  $htmltooltip .= $langs->trans($module->error).'<br>';
276  }
277  }
278 
279  print '<td class="center">';
280  print $form->textwithpicto('', $htmltooltip, 1, 0);
281  print '</td>';
282 
283  print "</tr>\n";
284  }
285  }
286  }
287  closedir($handle);
288  }
289  }
290 }
291 print "</table><br>\n";
292 
293 /*
294  * Documents models for Interventions
295  */
296 
297 print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', '');
298 
299 // Defini tableau def des modeles
300 $type = 'expensereport';
301 $def = array();
302 $sql = "SELECT nom";
303 $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
304 $sql .= " WHERE type = '".$db->escape($type)."'";
305 $sql .= " AND entity = ".$conf->entity;
306 $resql = $db->query($sql);
307 if ($resql)
308 {
309  $i = 0;
310  $num_rows = $db->num_rows($resql);
311  while ($i < $num_rows)
312  {
313  $array = $db->fetch_array($resql);
314  array_push($def, $array[0]);
315  $i++;
316  }
317 } else {
318  dol_print_error($db);
319 }
320 
321 print '<table class="noborder centpercent">';
322 print '<tr class="liste_titre">';
323 print '<td>'.$langs->trans("Name").'</td>';
324 print '<td>'.$langs->trans("Description").'</td>';
325 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
326 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
327 print '<td class="center" width="80">'.$langs->trans("ShortInfo").'</td>';
328 print '<td class="center" width="80">'.$langs->trans("Preview").'</td>';
329 print "</tr>\n";
330 
331 clearstatcache();
332 
333 foreach ($dirmodels as $reldir)
334 {
335  $dir = dol_buildpath($reldir."core/modules/expensereport/doc");
336 
337  if (is_dir($dir))
338  {
339  $handle = opendir($dir);
340  if (is_resource($handle))
341  {
342  while (($file = readdir($handle)) !== false)
343  {
344  $filelist[] = $file;
345  }
346  closedir($handle);
347  arsort($filelist);
348 
349  foreach ($filelist as $file)
350  {
351  if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
352  {
353  if (file_exists($dir.'/'.$file))
354  {
355  $name = substr($file, 4, dol_strlen($file) - 16);
356  $classname = substr($file, 0, dol_strlen($file) - 12);
357 
358  require_once $dir.'/'.$file;
359  $module = new $classname($db);
360 
361  $modulequalified = 1;
362  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
363  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
364 
365  if ($modulequalified)
366  {
367  print '<tr class="oddeven"><td width="100">';
368  print (empty($module->name) ? $name : $module->name);
369  print "</td><td>\n";
370  if (method_exists($module, 'info')) print $module->info($langs);
371  else print $module->description;
372  print '</td>';
373 
374  // Active
375  if (in_array($name, $def))
376  {
377  print '<td class="center">'."\n";
378  print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
379  print img_picto($langs->trans("Enabled"), 'switch_on');
380  print '</a>';
381  print "</td>";
382  } else {
383  print '<td class="center">'."\n";
384  print '<a 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>';
385  print "</td>";
386  }
387 
388  // Default
389  print '<td class="center">';
390  if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name")
391  {
392  print img_picto($langs->trans("Default"), 'on');
393  } else {
394  print '<a 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>';
395  }
396  print '</td>';
397 
398  // Info
399  $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
400  $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
401  $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
402  $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
403  $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
404  $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
405  $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
406  $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
407  $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
408  print '<td class="center">';
409  print $form->textwithpicto('', $htmltooltip, -1, 0);
410  print '</td>';
411 
412  // Preview
413  print '<td class="center">';
414  if ($module->type == 'pdf')
415  {
416  print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
417  } else {
418  print img_object($langs->trans("PreviewNotAvailable"), 'generic');
419  }
420  print '</td>';
421 
422  print '</tr>';
423  }
424  }
425  }
426  }
427  }
428  }
429 }
430 
431 print '</table>';
432 
433 
434 print '<br>';
435 
436 
437 
438 /*
439  * Other options
440  */
441 
442 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
443 print '<input type="hidden" name="token" value="'.newToken().'">';
444 print '<input type="hidden" name="action" value="setoptions">';
445 
446 print load_fiche_titre($langs->trans("OtherOptions"), '', '');
447 print '<table class="noborder centpercent">';
448 print '<tr class="liste_titre">';
449 print '<td>'.$langs->trans("Parameter").'</td>';
450 print '<td class="center" width="60"></td>';
451 print "</tr>\n";
452 
453 $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
454 $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
455 $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
456 foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
457 $htmltext .= '</i>';
458 
459 print '<tr class="oddeven"><td colspan="2">';
460 print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
461 $variablename = 'EXPENSEREPORT_FREE_TEXT';
462 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
463 {
464  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
465 } else {
466  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
467  $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
468  print $doleditor->Create();
469 }
470 print '</td></tr>'."\n";
471 
472 // Use draft Watermark
473 
474 print '<tr class="oddeven"><td colspan="2">';
475 print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
476 print '<input size="50" class="flat" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
477 print '</td></tr>'."\n";
478 
479 print '</table>';
480 
481 print '<div class="center">';
482 print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
483 print '</div>';
484 
485 print '</form>';
486 
487 print dol_get_fiche_end();
488 
489 // End of page
490 llxFooter();
491 $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
expensereport_admin_prepare_head()
Return array head with list of tabs to view object informations.
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.
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)
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 ...
Class to manage Trips and Expenses.
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;.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.