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