dolibarr  18.0.0
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  * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
29 // Load Dolibarr environment
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
37 
38 // Load translation files required by the page
39 $langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips'));
40 
41 if (!$user->admin) {
43 }
44 
45 $action = GETPOST('action', 'aZ09');
46 
47 
48 /*
49  * Actions
50  */
51 
52 if ($action == 'update') {
53  if (GETPOSTISSET('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) {
54  dolibarr_set_const($db, "MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", GETPOST("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING"), 'chaine', 0, '', $conf->entity);
55  }
56  if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
57  dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
58  }
59  if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
60  dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
61  }
62  if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
63  dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
64  }
65  if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
66  dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
67  }
68  if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
69  dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOST("INVOICE_ADD_ZATCA_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
70  dolibarr_del_const($db, "INVOICE_ADD_SWISS_QR_CODE", $conf->entity);
71  }
72  if (GETPOSTISSET('INVOICE_ADD_SWISS_QR_CODE')) {
73  dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'alpha'), 'chaine', 0, '', $conf->entity);
74  dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
75  }
76  if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
77  dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
78  }
79  if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
80  dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
81  dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
82  }
83 
84  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
85 
86  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
87  exit;
88 }
89 
90 
91 
92 /*
93  * View
94  */
95 
96 $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
97 llxHeader('', $langs->trans("Setup"), $wikihelp);
98 
99 $form = new Form($db);
100 $formother = new FormOther($db);
101 $formadmin = new FormAdmin($db);
102 
103 print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
104 
105 $head = pdf_admin_prepare_head();
106 
107 print dol_get_fiche_head($head, 'other', '', -1, '');
108 
109 $tooltiptext = '';
110 print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
111 print "<br>\n";
112 
113 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
114 print '<input type="hidden" name="token" value="'.newToken().'">';
115 print '<input type="hidden" name="action" value="update">';
116 
117 if (isModEnabled('propal')) {
118  print load_fiche_titre($langs->trans("Proposal"), '', 'proposal');
119 
120  print '<div class="div-table-responsive-no-min">';
121  print '<table summary="more" class="noborder centpercent">';
122  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
123 
124 
125  print '<tr class="oddeven"><td>';
126  print $form->textwithpicto($langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING"), '');
127  print '</td><td>';
128  if ($conf->use_javascript_ajax) {
129  print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
130  } else {
131  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
132  print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING);
133  }
134  print '</td></tr>';
135 
136  print '<tr class="oddeven"><td>';
137  print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
138  print '</td><td>';
139  if ($conf->use_javascript_ajax) {
140  print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
141  } else {
142  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
143  print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
144  }
145  print '</td></tr>';
146 
147  print '</table>';
148  print '</div>';
149 }
150 
151 
152 if (isModEnabled('facture')) {
153  print load_fiche_titre($langs->trans("Invoices"), '', 'bill');
154 
155  print '<div class="div-table-responsive-no-min">';
156  print '<table summary="more" class="noborder centpercent">';
157  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
158 
159  print '<tr class="oddeven"><td>';
160  print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
161  print '</td><td>';
162  if ($conf->use_javascript_ajax) {
163  print ajax_constantonoff('INVOICE_ADD_ZATCA_QR_CODE');
164  } else {
165  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
166  print $form->selectarray("INVOICE_ADD_ZATCA_QR_CODE", $arrval, getDolGlobalString('INVOICE_ADD_ZATCA_QR_CODE'));
167  }
168  print '</td></tr>';
169 
170  print '<tr class="oddeven"><td>';
171  if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
172  print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), $langs->trans("INVOICE_ADD_SWISS_QR_CODEMore"));
173  } else {
174  print $langs->trans("INVOICE_ADD_SWISS_QR_CODE");
175  }
176  print '</td><td>';
177  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
178  if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 1) {
179  $arrval['bottom'] = $langs->trans("AtBottomOfPage").' ('.$langs->trans("Experimental").' - Need PHP 8.1+ and some PHP libs)';
180  }
181  print $form->selectarray("INVOICE_ADD_SWISS_QR_CODE", $arrval, getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE'));
182  print '</td></tr>';
183 
184  // Mention category of operations
185  // French Decret n°2099-1299 2022-10-07
186  print '<tr class="oddeven"><td>';
187  print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
188  print '</td><td>';
189  $arrval = array('0'=>$langs->trans("No"),
190  '1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
191  '2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
192  );
193  print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, $conf->global->INVOICE_CATEGORY_OF_OPERATION, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
194  print '</td></tr>';
195 
196  print '<tr class="oddeven"><td>';
197  print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
198  print '</td><td>';
199  if ($conf->use_javascript_ajax) {
200  print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
201  } else {
202  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
203  print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
204  }
205  print '</td></tr>';
206 
207  print '</table>';
208  print '</div>';
209 }
210 
211 
212 
213 if (isModEnabled('reception')) {
214  print load_fiche_titre($langs->trans("Receptions"), '', 'reception');
215 
216  print '<div class="div-table-responsive-no-min">';
217  print '<table summary="more" class="noborder centpercent">';
218  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
219 
220  print '<tr class="oddeven"><td>';
221  print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");
222  print '</td><td>';
223  if ($conf->use_javascript_ajax) {
224  print ajax_constantonoff('RECEPTION_PDF_HIDE_ORDERED');
225  } else {
226  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
227  print $form->selectarray("RECEPTION_PDF_HIDE_ORDERED", $arrval, $conf->global->RECEPTION_PDF_HIDE_ORDERED);
228  }
229  print '</td></tr>';
230 
231  print '<tr class="oddeven"><td>';
232  print $langs->trans("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT");
233  print '</td><td>';
234  if ($conf->use_javascript_ajax) {
235  print ajax_constantonoff('MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT');
236  } else {
237  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
238  print $form->selectarray("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT", $arrval, $conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT);
239  }
240  print '</td></tr>';
241 
242  print '</table>';
243  print '</div>';
244 }
245 
246 
247 print '<br><div class="center">';
248 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
249 print '</div>';
250 
251 print '</form>';
252 
253 
254 // End of page
255 llxFooter();
256 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:562
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5477
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
$wikihelp
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
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
FormAdmin
Class to generate html code for admin pages.
Definition: html.formadmin.class.php:30
pdf_admin_prepare_head
pdf_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: pdf.lib.php:47
llxHeader
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
ajax_constantonoff
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='')
On/off button for constant.
Definition: ajax.lib.php:630
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:207
dol_get_fiche_head
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.
Definition: functions.lib.php:1979
getDolGlobalString
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:142
dolibarr_set_const
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:638
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:509
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1164