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