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