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