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