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