dolibarr  18.0.0-alpha
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('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
54  dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
55  }
56  if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
57  dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
58  }
59  if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
60  dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
61  }
62  if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
63  dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
64  }
65  if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
66  dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOST("INVOICE_ADD_ZATCA_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
67  dolibarr_del_const($db, "INVOICE_ADD_SWISS_QR_CODE", $conf->entity);
68  }
69  if (GETPOSTISSET('INVOICE_ADD_SWISS_QR_CODE')) {
70  dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
71  dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
72  }
73  if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
74  dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
75  }
76  if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
77  dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
78  dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
79  }
80 
81  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
82 
83  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
84  exit;
85 }
86 
87 
88 
89 /*
90  * View
91  */
92 
93 $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
94 llxHeader('', $langs->trans("Setup"), $wikihelp);
95 
96 $form = new Form($db);
97 $formother = new FormOther($db);
98 $formadmin = new FormAdmin($db);
99 
100 print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
101 
102 $head = pdf_admin_prepare_head();
103 
104 print dol_get_fiche_head($head, 'other', '', -1, '');
105 
106 $tooltiptext = '';
107 print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
108 print "<br>\n";
109 
110 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
111 print '<input type="hidden" name="token" value="'.newToken().'">';
112 print '<input type="hidden" name="action" value="update">';
113 
114 if (isModEnabled('propal')) {
115  print load_fiche_titre($langs->trans("Proposal"), '', 'proposal');
116 
117  print '<div class="div-table-responsive-no-min">';
118  print '<table summary="more" class="noborder centpercent">';
119  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
120 
121  print '<tr class="oddeven"><td>';
122  print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
123  print '</td><td>';
124  if ($conf->use_javascript_ajax) {
125  print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
126  } else {
127  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
128  print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
129  }
130  print '</td></tr>';
131 
132  print '</table>';
133  print '</div>';
134 }
135 
136 
137 if (isModEnabled('facture')) {
138  print load_fiche_titre($langs->trans("Invoices"), '', 'bill');
139 
140  print '<div class="div-table-responsive-no-min">';
141  print '<table summary="more" class="noborder centpercent">';
142  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
143 
144  print '<tr class="oddeven"><td>';
145  print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
146  print '</td><td>';
147  if ($conf->use_javascript_ajax) {
148  print ajax_constantonoff('INVOICE_ADD_ZATCA_QR_CODE');
149  } else {
150  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
151  print $form->selectarray("INVOICE_ADD_ZATCA_QR_CODE", $arrval, $conf->global->INVOICE_ADD_ZATCA_QR_CODE);
152  }
153  print '</td></tr>';
154 
155  print '<tr class="oddeven"><td>';
156  print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), '');
157  print '</td><td>';
158  if ($conf->use_javascript_ajax) {
159  print ajax_constantonoff('INVOICE_ADD_SWISS_QR_CODE');
160  } else {
161  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
162  print $form->selectarray("INVOICE_ADD_SWISS_QR_CODE", $arrval, $conf->global->INVOICE_ADD_SWISS_QR_CODE);
163  }
164  print '</td></tr>';
165 
166  // Mention category of operations
167  // French Decret n°2099-1299 2022-10-07
168  print '<tr class="oddeven"><td>';
169  print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
170  print '</td><td>';
171  $arrval = array('0'=>$langs->trans("No"),
172  '1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
173  '2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
174  );
175  print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, $conf->global->INVOICE_CATEGORY_OF_OPERATION, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
176  print '</td></tr>';
177 
178  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
179  if ($conf->use_javascript_ajax) {
180  print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
181  } else {
182  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
183  print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
184  }
185  print '</td></tr>';
186 
187  print '</table>';
188  print '</div>';
189 }
190 
191 
192 
193 if (isModEnabled('reception')) {
194  print load_fiche_titre($langs->trans("Receptions"), '', 'reception');
195 
196  print '<div class="div-table-responsive-no-min">';
197  print '<table summary="more" class="noborder centpercent">';
198  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
199 
200  print '<tr class="oddeven"><td>';
201  print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");
202  print '</td><td>';
203  if ($conf->use_javascript_ajax) {
204  print ajax_constantonoff('RECEPTION_PDF_HIDE_ORDERED');
205  } else {
206  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
207  print $form->selectarray("RECEPTION_PDF_HIDE_ORDERED", $arrval, $conf->global->RECEPTION_PDF_HIDE_ORDERED);
208  }
209  print '</td></tr>';
210 
211  print '<tr class="oddeven"><td>';
212  print $langs->trans("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT");
213  print '</td><td>';
214  if ($conf->use_javascript_ajax) {
215  print ajax_constantonoff('MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT');
216  } else {
217  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
218  print $form->selectarray("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT", $arrval, $conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT);
219  }
220  print '</td></tr>';
221 
222  print '</table>';
223  print '</div>';
224 }
225 
226 
227 print '<br><div class="center">';
228 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
229 print '</div>';
230 
231 print '</form>';
232 
233 
234 // End of page
235 llxFooter();
236 $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:557
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5363
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:530
$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:46
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:604
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1873
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:147
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:633
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:431
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8509
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:1106