dolibarr  13.0.2
propal.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 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 Eric Seigne <eric.seigne@ryxeo.com>
7  * Copyright (C) 2005-2012 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  *
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.'/comm/propal/class/propal.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
36 
37 // Load translation files required by the page
38 $langs->loadLangs(array("admin", "other", "errors", "propal"));
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 = 'propal';
47 
48 /*
49  * Actions
50  */
51 
52 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
53 
54 $error = 0;
55 if ($action == 'updateMask') {
56  $maskconstpropal = GETPOST('maskconstpropal', 'alpha');
57  $maskpropal = GETPOST('maskpropal', 'alpha');
58  if ($maskconstpropal) $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity);
59 
60  if (!($res > 0)) $error++;
61 
62  if (!$error)
63  {
64  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
65  } else {
66  setEventMessages($langs->trans("Error"), null, 'errors');
67  }
68 } elseif ($action == 'specimen') {
69  $modele = GETPOST('module', 'alpha');
70 
71  $propal = new Propal($db);
72  $propal->initAsSpecimen();
73 
74  // Search template files
75  $file = ''; $classname = ''; $filefound = 0;
76  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
77  foreach ($dirmodels as $reldir)
78  {
79  $file = dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php");
80  if (file_exists($file))
81  {
82  $filefound = 1;
83  $classname = "pdf_".$modele;
84  break;
85  }
86  }
87 
88  if ($filefound) {
89  require_once $file;
90 
91  $module = new $classname($db);
92 
93  if ($module->write_file($propal, $langs) > 0)
94  {
95  header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
96  return;
97  } else {
98  setEventMessages($module->error, $module->errors, 'errors');
99  dol_syslog($module->error, LOG_ERR);
100  }
101  } else {
102  setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
103  dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
104  }
105 } elseif ($action == 'setribchq') {
106  $rib = GETPOST('rib', 'alpha');
107  $chq = GETPOST('chq', 'alpha');
108 
109  $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
110  $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
111 
112  if (!($res > 0)) $error++;
113 
114  if (!$error)
115  {
116  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
117  } else {
118  setEventMessages($langs->trans("Error"), null, 'errors');
119  }
120 } elseif ($action == 'set_PROPALE_DRAFT_WATERMARK') {
121  $draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha');
122 
123  $res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
124  if (!($res > 0)) $error++;
125 
126  if (!$error)
127  {
128  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
129  } else {
130  setEventMessages($langs->trans("Error"), null, 'errors');
131  }
132 } elseif ($action == 'set_PROPOSAL_FREE_TEXT') {
133  $freetext = GETPOST('PROPOSAL_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
134 
135  $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
136 
137  if (!($res > 0)) $error++;
138 
139  if (!$error)
140  {
141  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
142  } else {
143  setEventMessages($langs->trans("Error"), null, 'errors');
144  }
145 } elseif ($action == 'setdefaultduration') {
146  $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
147 
148  if (!($res > 0)) $error++;
149 
150  if (!$error)
151  {
152  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
153  } else {
154  setEventMessages($langs->trans("Error"), null, 'errors');
155  }
156 } elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') {
157  $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
158 
159  if (!($res > 0)) $error++;
160 
161  if (!$error) {
162  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
163  } else {
164  setEventMessages($langs->trans("Error"), null, 'errors');
165  }
166 } elseif ($action == 'set') {
167  // Activate a model
168  $ret = addDocumentModel($value, $type, $label, $scandir);
169 } elseif ($action == 'del') {
170  $ret = delDocumentModel($value, $type);
171  if ($ret > 0) {
172  if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF', $conf->entity);
173  }
174 } elseif ($action == 'setdoc') {
175  if (dolibarr_set_const($db, "PROPALE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
176  $conf->global->PROPALE_ADDON_PDF = $value;
177  }
178 
179  // On active le modele
180  $ret = delDocumentModel($value, $type);
181  if ($ret > 0) {
182  $ret = addDocumentModel($value, $type, $label, $scandir);
183  }
184 } elseif ($action == 'setmod') {
185  // TODO Verifier si module numerotation choisi peut etre active
186  // par appel methode canBeActivated
187 
188  dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity);
189 }
190 
191 
192 /*
193  * View
194  */
195 
196 $form = new Form($db);
197 
198 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
199 
200 llxHeader('', $langs->trans("PropalSetup"));
201 
202 //if ($mesg) print $mesg;
203 
204 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
205 print load_fiche_titre($langs->trans("PropalSetup"), $linkback, 'title_setup');
206 
207 $head = propal_admin_prepare_head();
208 
209 print dol_get_fiche_head($head, 'general', $langs->trans("Proposals"), -1, 'propal');
210 
211 /*
212  * Module numerotation
213  */
214 print load_fiche_titre($langs->trans("ProposalsNumberingModules"), '', '');
215 
216 print '<table class="noborder centpercent">';
217 print '<tr class="liste_titre">';
218 print '<td>'.$langs->trans("Name")."</td>\n";
219 print '<td>'.$langs->trans("Description")."</td>\n";
220 print '<td class="nowrap">'.$langs->trans("Example")."</td>\n";
221 print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
222 print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
223 print '</tr>'."\n";
224 
225 clearstatcache();
226 
227 foreach ($dirmodels as $reldir)
228 {
229  $dir = dol_buildpath($reldir."core/modules/propale");
230 
231  if (is_dir($dir))
232  {
233  $handle = opendir($dir);
234  if (is_resource($handle))
235  {
236  while (($file = readdir($handle)) !== false)
237  {
238  if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
239  {
240  $file = substr($file, 0, dol_strlen($file) - 4);
241 
242  require_once $dir.'/'.$file.'.php';
243 
244  $module = new $file;
245 
246  // Show modules according to features level
247  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
248  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
249 
250  if ($module->isEnabled())
251  {
252  print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
253  print $module->info();
254  print '</td>';
255 
256  // Show example of numbering module
257  print '<td class="nowrap">';
258  $tmp = $module->getExample();
259  if (preg_match('/^Error/', $tmp)) {
260  $langs->load("errors");
261  print '<div class="error">'.$langs->trans($tmp).'</div>';
262  } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
263  else print $tmp;
264  print '</td>'."\n";
265 
266  print '<td class="center">';
267  if ($conf->global->PROPALE_ADDON == "$file")
268  {
269  print img_picto($langs->trans("Activated"), 'switch_on');
270  } else {
271  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
272  print img_picto($langs->trans("Disabled"), 'switch_off');
273  print '</a>';
274  }
275  print '</td>';
276 
277  $propal = new Propal($db);
278  $propal->initAsSpecimen();
279 
280  // Info
281  $htmltooltip = '';
282  $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
283  $propal->type = 0;
284  $nextval = $module->getNextValue($mysoc, $propal);
285  if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
286  $htmltooltip .= ''.$langs->trans("NextValue").': ';
287  if ($nextval) {
288  if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
289  $nextval = $langs->trans($nextval);
290  $htmltooltip .= $nextval.'<br>';
291  } else {
292  $htmltooltip .= $langs->trans($module->error).'<br>';
293  }
294  }
295 
296  print '<td class="center">';
297  print $form->textwithpicto('', $htmltooltip, 1, 0);
298  print '</td>';
299 
300  print "</tr>\n";
301  }
302  }
303  }
304  closedir($handle);
305  }
306  }
307 }
308 print "</table><br>\n";
309 
310 
311 /*
312  * Document templates generators
313  */
314 
315 print load_fiche_titre($langs->trans("ProposalsPDFModules"), '', '');
316 
317 // Load array def with activated templates
318 $def = array();
319 $sql = "SELECT nom";
320 $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
321 $sql .= " WHERE type = '".$db->escape($type)."'";
322 $sql .= " AND entity = ".$conf->entity;
323 $resql = $db->query($sql);
324 if ($resql)
325 {
326  $i = 0;
327  $num_rows = $db->num_rows($resql);
328  while ($i < $num_rows)
329  {
330  $array = $db->fetch_array($resql);
331  array_push($def, $array[0]);
332  $i++;
333  }
334 } else {
335  dol_print_error($db);
336 }
337 
338 
339 print "<table class=\"noborder\" width=\"100%\">\n";
340 print "<tr class=\"liste_titre\">\n";
341 print " <td>".$langs->trans("Name")."</td>\n";
342 print " <td>".$langs->trans("Description")."</td>\n";
343 print '<td align="center" width="40">'.$langs->trans("Status")."</td>\n";
344 print '<td align="center" width="40">'.$langs->trans("Default")."</td>\n";
345 print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
346 print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
347 print "</tr>\n";
348 
349 clearstatcache();
350 
351 foreach ($dirmodels as $reldir)
352 {
353  foreach (array('', '/doc') as $valdir)
354  {
355  $realpath = $reldir."core/modules/propale".$valdir;
356  $dir = dol_buildpath($realpath);
357 
358  if (is_dir($dir))
359  {
360  $handle = opendir($dir);
361  if (is_resource($handle))
362  {
363  while (($file = readdir($handle)) !== false)
364  {
365  $filelist[] = $file;
366  }
367  closedir($handle);
368  arsort($filelist);
369 
370  foreach ($filelist as $file)
371  {
372  if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
373  {
374  if (file_exists($dir.'/'.$file))
375  {
376  $name = substr($file, 4, dol_strlen($file) - 16);
377  $classname = substr($file, 0, dol_strlen($file) - 12);
378 
379  require_once $dir.'/'.$file;
380  $module = new $classname($db);
381 
382  $modulequalified = 1;
383  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
384  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
385 
386  if ($modulequalified)
387  {
388  $var = !$var;
389  print '<tr class="oddeven"><td width="100">';
390  print (empty($module->name) ? $name : $module->name);
391  print "</td><td>\n";
392  if (method_exists($module, 'info')) print $module->info($langs);
393  else print $module->description;
394  print '</td>';
395 
396  // Active
397  if (in_array($name, $def))
398  {
399  print '<td class="center">'."\n";
400  print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
401  print img_picto($langs->trans("Enabled"), 'switch_on');
402  print '</a>';
403  print '</td>';
404  } else {
405  print "<td align=\"center\">\n";
406  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>';
407  print "</td>";
408  }
409 
410  // Defaut
411  print "<td align=\"center\">";
412  if ($conf->global->PROPALE_ADDON_PDF == "$name")
413  {
414  print img_picto($langs->trans("Default"), 'on');
415  } else {
416  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>';
417  }
418  print '</td>';
419 
420  // Info
421  $htmltooltip = $langs->trans("Name").': '.$module->name;
422  $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
423  if ($module->type == 'pdf')
424  {
425  $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
426  }
427  $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
428 
429  $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
430  $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
431  $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
432  $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
433  $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
434  //$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
435  //$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
436  $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark, 1, 1);
437 
438 
439  print '<td class="center">';
440  print $form->textwithpicto('', $htmltooltip, 1, 0);
441  print '</td>';
442 
443  // Preview
444  print '<td class="center">';
445  if ($module->type == 'pdf')
446  {
447  print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
448  } else {
449  print img_object($langs->trans("PreviewNotAvailable"), 'generic');
450  }
451  print '</td>';
452 
453  print "</tr>\n";
454  }
455  }
456  }
457  }
458  }
459  }
460  }
461 }
462 
463 print '</table>';
464 
465 
466 /*
467  * Payment mode
468  */
469 
470 print '<br>';
471 print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInProposal"), '', '');
472 
473 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
474 print '<input type="hidden" name="token" value="'.newToken().'" />';
475 
476 print '<table class="noborder centpercent">';
477 
478 print '<tr class="liste_titre">';
479 print '<td>';
480 print '<input type="hidden" name="action" value="setribchq">';
481 print $langs->trans("PaymentMode").'</td>';
482 print '<td align="right">';
483 if (empty($conf->facture->enabled)) {
484  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
485 }
486 print '</td>';
487 print "</tr>\n";
488 
489 print '<tr class="oddeven">';
490 print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
491 print "<td>";
492 if (empty($conf->facture->enabled))
493 {
494  if (!empty($conf->banque->enabled))
495  {
496  $sql = "SELECT rowid, label";
497  $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
498  $sql .= " WHERE clos = 0";
499  $sql .= " AND courant = 1";
500  $sql .= " AND entity IN (".getEntity('bank_account').")";
501  $resql = $db->query($sql);
502  if ($resql)
503  {
504  $num = $db->num_rows($resql);
505  $i = 0;
506  if ($num > 0)
507  {
508  print '<select name="rib" class="flat" id="rib">';
509  print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
510  while ($i < $num)
511  {
512  $row = $db->fetch_row($resql);
513 
514  print '<option value="'.$row[0].'"';
515  print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
516  print '>'.$row[1].'</option>';
517 
518  $i++;
519  }
520  print "</select>";
521  } else {
522  print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
523  }
524  }
525  } else {
526  print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
527  }
528 } else {
529  print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
530 }
531 print "</td></tr>";
532 
533 print '<tr class="oddeven">';
534 print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
535 print "<td>";
536 if (empty($conf->facture->enabled))
537 {
538  print '<select class="flat" name="chq" id="chq">';
539  print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
540  print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
541 
542  $sql = "SELECT rowid, label";
543  $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
544  $sql .= " WHERE clos = 0";
545  $sql .= " AND courant = 1";
546  $sql .= " AND entity IN (".getEntity('bank_account').")";
547 
548  $resql = $db->query($sql);
549  if ($resql)
550  {
551  $num = $db->num_rows($resql);
552  $i = 0;
553  while ($i < $num)
554  {
555  $row = $db->fetch_row($resql);
556 
557  print '<option value="'.$row[0].'"';
558  print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
559  print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
560 
561  $i++;
562  }
563  }
564  print "</select>";
565 } else {
566  print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
567 }
568 print "</td></tr>";
569 print "</table>";
570 print "</form>";
571 
572 
573 print '<br>';
574 
575 
576 /*
577  * Other options
578  */
579 
580 print load_fiche_titre($langs->trans("OtherOptions"), '', '');
581 
582 print "<table class=\"noborder\" width=\"100%\">";
583 print "<tr class=\"liste_titre\">";
584 print "<td>".$langs->trans("Parameter")."</td>\n";
585 print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
586 print "<td>&nbsp;</td>\n";
587 print "</tr>";
588 
589 
590 print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
591 print '<input type="hidden" name="token" value="'.newToken().'">';
592 print "<input type=\"hidden\" name=\"action\" value=\"setdefaultduration\">";
593 print '<tr class="oddeven">';
594 print '<td>'.$langs->trans("DefaultProposalDurationValidity").'</td>';
595 print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".$conf->global->PROPALE_VALIDITY_DURATION."\"></td>";
596 print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
597 print '</tr>';
598 print '</form>';
599 
600 /*
601 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
602 print '<input type="hidden" name="token" value="'.newToken().'">';
603 print '<input type="hidden" name="action" value="setusecustomercontactasrecipient">';
604 print '<tr class="oddeven"><td>';
605 print $langs->trans("UseCustomerContactAsPropalRecipientIfExist");
606 print '</td><td width="60" align="center">';
607 print $form->selectyesno("value",$conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1);
608 print '</td><td class="right">';
609 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
610 print "</td></tr>\n";
611 print '</form>';
612 */
613 
614 $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
615 $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
616 $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
617 foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
618 $htmltext .= '</i>';
619 
620 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
621 print '<input type="hidden" name="token" value="'.newToken().'">';
622 print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
623 print '<tr class="oddeven"><td colspan="2">';
624 print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
625 $variablename = 'PROPOSAL_FREE_TEXT';
626 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
627 {
628  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
629 } else {
630  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
631  $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
632  print $doleditor->Create();
633 }
634 print '</td><td class="right">';
635 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
636 print "</td></tr>\n";
637 print '</form>';
638 
639 
640 print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
641 print '<input type="hidden" name="token" value="'.newToken().'">';
642 print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
643 print '<tr class="oddeven"><td>';
644 print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
645 print '</td><td>';
646 print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
647 print '</td><td class="right">';
648 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
649 print "</td></tr>\n";
650 print '</form>';
651 
652 /* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
653 if ($conf->banque->enabled)
654 {
655 
656  print '<tr class="oddeven"><td>';
657  print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp</td><td class="right">';
658  if (! empty($conf->use_javascript_ajax))
659  {
660  print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL');
661  }
662  else
663  {
664  if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL))
665  {
666  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL&amp;token='.newToken().'&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
667  }
668  else
669  {
670  print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL&amp;token='.newToken().'&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
671  }
672  }
673  print '</td></tr>';
674 }
675 else
676 {
677 
678  print '<tr class="oddeven"><td>';
679  print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
680 }
681 */
682 
683 print '</table>';
684 
685 
686 
687 /*
688  * Directory
689  */
690 print '<br>';
691 print load_fiche_titre($langs->trans("PathToDocuments"), '', '');
692 
693 print "<table class=\"noborder\" width=\"100%\">\n";
694 print "<tr class=\"liste_titre\">\n";
695 print " <td>".$langs->trans("Name")."</td>\n";
696 print " <td>".$langs->trans("Value")."</td>\n";
697 print "</tr>\n";
698 print "<tr class=\"oddeven\">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->multidir_output[$conf->entity]."</td>\n</tr>\n";
699 print "</table>\n<br>";
700 
701 
702 /*
703  * Notifications
704  */
705 
706 print load_fiche_titre($langs->trans("Notifications"), '', '');
707 print '<table class="noborder centpercent">';
708 print '<tr class="liste_titre">';
709 print '<td>'.$langs->trans("Parameter").'</td>';
710 print '<td align="center" width="60"></td>';
711 print '<td width="80">&nbsp;</td>';
712 print "</tr>\n";
713 
714 print '<tr class="oddeven"><td colspan="2">';
715 print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
716 print '</td><td class="right">';
717 print "</td></tr>\n";
718 
719 print '</table>';
720 
721 // End of page
722 llxFooter();
723 $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.
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.
propal_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: propal.lib.php:112
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 ...
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.
Class to manage proposals.