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