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