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