dolibarr  17.0.4
pdf_other.php
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
7  * Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
28 // Load Dolibarr environment
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
36 
37 // Load translation files required by the page
38 $langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
39 
40 if (!$user->admin) {
42 }
43 
44 $action = GETPOST('action', 'aZ09');
45 
46 
47 /*
48  * Actions
49  */
50 
51 if ($action == 'update') {
52  if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
53  dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
54  }
55  if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
56  dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
57  }
58  if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
59  dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
60  }
61  if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
62  dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
63  }
64  if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
65  dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOST("INVOICE_ADD_ZATCA_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
66  dolibarr_del_const($db, "INVOICE_ADD_SWISS_QR_CODE", $conf->entity);
67  }
68  if (GETPOSTISSET('INVOICE_ADD_SWISS_QR_CODE')) {
69  dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
70  dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
71  }
72  if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
73  dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
74  dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
75  }
76 
77  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
78 
79  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
80  exit;
81 }
82 
83 
84 
85 /*
86  * View
87  */
88 
89 $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
90 llxHeader('', $langs->trans("Setup"), $wikihelp);
91 
92 $form = new Form($db);
93 $formother = new FormOther($db);
94 $formadmin = new FormAdmin($db);
95 
96 print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
97 
98 $head = pdf_admin_prepare_head();
99 
100 print dol_get_fiche_head($head, 'other', '', -1, '');
101 
102 $tooltiptext = '';
103 print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
104 print "<br>\n";
105 
106 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
107 print '<input type="hidden" name="token" value="'.newToken().'">';
108 print '<input type="hidden" name="action" value="update">';
109 
110 if (isModEnabled('propal')) {
111  print load_fiche_titre($langs->trans("Proposal"), '', 'proposal');
112 
113  print '<div class="div-table-responsive-no-min">';
114  print '<table summary="more" class="noborder centpercent">';
115  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
116 
117  print '<tr class="oddeven"><td>';
118  print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
119  print '</td><td>';
120  if ($conf->use_javascript_ajax) {
121  print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
122  } else {
123  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
124  print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
125  }
126  print '</td></tr>';
127 
128  print '</table>';
129  print '</div>';
130 }
131 
132 
133 if (isModEnabled('facture')) {
134  print load_fiche_titre($langs->trans("Invoices"), '', 'bill');
135 
136  print '<div class="div-table-responsive-no-min">';
137  print '<table summary="more" class="noborder centpercent">';
138  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
139 
140  print '<tr class="oddeven"><td>';
141  print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
142  print '</td><td>';
143  if ($conf->use_javascript_ajax) {
144  print ajax_constantonoff('INVOICE_ADD_ZATCA_QR_CODE');
145  } else {
146  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
147  print $form->selectarray("INVOICE_ADD_ZATCA_QR_CODE", $arrval, $conf->global->INVOICE_ADD_ZATCA_QR_CODE);
148  }
149  print '</td></tr>';
150 
151  print '<tr class="oddeven"><td>';
152  print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), '');
153  print '</td><td>';
154  if ($conf->use_javascript_ajax) {
155  print ajax_constantonoff('INVOICE_ADD_SWISS_QR_CODE');
156  } else {
157  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
158  print $form->selectarray("INVOICE_ADD_SWISS_QR_CODE", $arrval, $conf->global->INVOICE_ADD_SWISS_QR_CODE);
159  }
160  print '</td></tr>';
161 
162  print '<tr class="oddeven"><td>';
163  print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
164  print '</td><td>';
165  if ($conf->use_javascript_ajax) {
166  print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
167  } else {
168  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
169  print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
170  }
171  print '</td></tr>';
172 
173  print '</table>';
174  print '</div>';
175 }
176 
177 
178 
179 if (isModEnabled('reception')) {
180  print load_fiche_titre($langs->trans("Receptions"), '', 'reception');
181 
182  print '<div class="div-table-responsive-no-min">';
183  print '<table summary="more" class="noborder centpercent">';
184  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
185 
186  print '<tr class="oddeven"><td>';
187  print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");
188  print '</td><td>';
189  if ($conf->use_javascript_ajax) {
190  print ajax_constantonoff('RECEPTION_PDF_HIDE_ORDERED');
191  } else {
192  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
193  print $form->selectarray("RECEPTION_PDF_HIDE_ORDERED", $arrval, $conf->global->RECEPTION_PDF_HIDE_ORDERED);
194  }
195  print '</td></tr>';
196 
197  print '<tr class="oddeven"><td>';
198  print $langs->trans("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT");
199  print '</td><td>';
200  if ($conf->use_javascript_ajax) {
201  print ajax_constantonoff('MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT');
202  } else {
203  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
204  print $form->selectarray("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT", $arrval, $conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT);
205  }
206  print '</td></tr>';
207 
208  print '</table>';
209  print '</div>';
210 }
211 
212 
213 print '<br><div class="center">';
214 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
215 print '</div>';
216 
217 print '</form>';
218 
219 
220 // End of page
221 llxFooter();
222 $db->close();
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).
Definition: admin.lib.php:632
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:556
if(GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) if(GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:90
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='')
On/off button for constant.
Definition: ajax.lib.php:600
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 generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
pdf_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: pdf.lib.php:46
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.