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