dolibarr  16.0.5
company.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
7  * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
8  * Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
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 
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
39 
40 $action = GETPOST('action', 'aZ09');
41 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
42 
43 // Load translation files required by the page
44 $langs->loadLangs(array('admin', 'companies', 'bills'));
45 
46 if (!$user->admin) {
48 }
49 
50 $error = 0;
51 
52 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
53 $hookmanager->initHooks(array('admincompany', 'globaladmin'));
54 
55 
56 /*
57  * Actions
58  */
59 
60 $parameters = array();
61 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
62 if ($reshook < 0) {
63  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
64 }
65 
66 if (($action == 'update' && !GETPOST("cancel", 'alpha'))
67 || ($action == 'updateedit')) {
68  $tmparray = getCountry(GETPOST('country_id', 'int'), 'all', $db, $langs, 0);
69  if (!empty($tmparray['id'])) {
70  $mysoc->country_id = $tmparray['id'];
71  $mysoc->country_code = $tmparray['code'];
72  $mysoc->country_label = $tmparray['label'];
73 
74  $s = $mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
75  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity);
76 
77  activateModulesRequiredByCountry($mysoc->country_code);
78  }
79 
80  $tmparray = getState(GETPOST('state_id', 'int'), 'all', $db, $langs, 0);
81  if (!empty($tmparray['id'])) {
82  $mysoc->state_id = $tmparray['id'];
83  $mysoc->state_code = $tmparray['code'];
84  $mysoc->state_label = $tmparray['label'];
85 
86  $s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
87  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity);
88  } else {
89  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity);
90  }
91 
92  $db->begin();
93 
94  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
95  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
96  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
97  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
98  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
99  dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity);
100  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
101  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
102  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
103  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
104  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
105  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
106 
107  $dirforimage = $conf->mycompany->dir_output.'/logos/';
108 
109  $arrayofimages = array('logo', 'logo_squarred');
110  //var_dump($_FILES); exit;
111  foreach ($arrayofimages as $varforimage) {
112  if ($_FILES[$varforimage]["name"] && !preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
113  $langs->load("errors");
114  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
115  break;
116  }
117 
118  // Remove to check file size to large
119  /*if ($_FILES[$varforimage]["tmp_name"]) {*/
120  $reg = array();
121  if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
122  $original_file = $reg[1];
123 
124  $isimage = image_format_supported($original_file);
125  if ($isimage >= 0) {
126  dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
127  if (!is_dir($dirforimage)) {
128  dol_mkdir($dirforimage);
129  }
130  $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
131  if ($result > 0) {
132  $constant = "MAIN_INFO_SOCIETE_LOGO";
133  if ($varforimage == 'logo_squarred') {
134  $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
135  }
136 
137  dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity);
138 
139  // Create thumbs of logo (Note that PDF use original file and not thumbs)
140  if ($isimage > 0) {
141  // Create thumbs
142  //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get...
143 
144  // Create small thumb, Used on logon for example
145  $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
146  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
147  $imgThumbSmall = $reg[1]; // Save only basename
148  dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
149  } else {
150  dol_syslog($imgThumbSmall);
151  }
152 
153  // Create mini thumb, Used on menu or for setup page for example
154  $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
155  if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
156  $imgThumbMini = $reg[1]; // Save only basename
157  dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
158  } else {
159  dol_syslog($imgThumbMini);
160  }
161  } else {
162  dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
163  }
164  } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
165  $error++;
166  $langs->load("errors");
167  $tmparray = explode(':', $result);
168  setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
169  } elseif (preg_match('/^ErrorFileSizeTooLarge/', $result)) {
170  $error++;
171  setEventMessages($langs->trans("ErrorFileSizeTooLarge"), null, 'errors');
172  } else {
173  $error++;
174  setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
175  }
176  } else {
177  $error++;
178  $langs->load("errors");
179  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
180  }
181  }
182  /*}*/
183  }
184 
185  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
186  dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
187  dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
188  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
189  dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
190  dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
191  dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
192  dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
193  dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
194  dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
195 
196  dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
197  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
198 
199  dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START", 'int'), 'chaine', 0, '', $conf->entity);
200 
201  // Sale tax options
202  $usevat = GETPOST("optiontva", 'aZ09');
203  $uselocaltax1 = GETPOST("optionlocaltax1", 'aZ09');
204  $uselocaltax2 = GETPOST("optionlocaltax2", 'aZ09');
205  if ($uselocaltax1 == 'localtax1on' && !$usevat) {
206  setEventMessages($langs->trans("IfYouUseASecondTaxYouMustSetYouUseTheMainTax"), null, 'errors');
207  $error++;
208  }
209  if ($uselocaltax2 == 'localtax2on' && !$usevat) {
210  setEventMessages($langs->trans("IfYouUseAThirdTaxYouMustSetYouUseTheMainTax"), null, 'errors');
211  $error++;
212  }
213 
214  dolibarr_set_const($db, "FACTURE_TVAOPTION", $usevat, 'chaine', 0, '', $conf->entity);
215  dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", $uselocaltax1, 'chaine', 0, '', $conf->entity);
216  dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", $uselocaltax2, 'chaine', 0, '', $conf->entity);
217 
218  if (GETPOST("optionlocaltax1") == "localtax1on") {
219  if (!GETPOSTISSET('lt1')) {
220  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
221  } else {
222  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity);
223  }
224  dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity);
225  }
226  if (GETPOST("optionlocaltax2") == "localtax2on") {
227  if (!GETPOSTISSET('lt2')) {
228  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
229  } else {
230  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity);
231  }
232  dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity);
233  }
234 
235  if (!$error) {
236  if (GETPOST('save')) { // To avoid to show message when we juste switch the country that resubmit the form.
237  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
238  }
239  $db->commit();
240  } else {
241  $db->rollback();
242  }
243 
244  if ($action != 'updateedit' && !$error) {
245  header("Location: ".$_SERVER["PHP_SELF"]);
246  exit;
247  }
248 }
249 
250 if ($action == 'addthumb' || $action == 'addthumbsquarred') { // Regenerate thumbs
251  if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"])) {
252  $isimage = image_format_supported($_GET["file"]);
253 
254  // Create thumbs of logo
255  if ($isimage > 0) {
256  $constant = "MAIN_INFO_SOCIETE_LOGO";
257  if ($action == 'addthumbsquarred') {
258  $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
259  }
260 
261  $reg = array();
262 
263  // Create thumbs
264  //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get...
265 
266  // Create small thumb. Used on logon for example
267  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality);
268  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
269  $imgThumbSmall = $reg[1]; // Save only basename
270  dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
271  } else {
272  dol_syslog($imgThumbSmall);
273  }
274 
275  // Create mini thumbs. Used on menu or for setup page for example
276  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
277  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
278  $imgThumbMini = $reg[1]; // Save only basename
279  dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
280  } else {
281  dol_syslog($imgThumbMini);
282  }
283 
284  header("Location: ".$_SERVER["PHP_SELF"]);
285  exit;
286  } else {
287  $error++;
288  $langs->load("errors");
289  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
290  dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO);
291  }
292  } else {
293  $error++;
294  $langs->load("errors");
295  setEventMessages($langs->trans("ErrorFileDoesNotExists", GETPOST("file")), null, 'errors');
296  dol_syslog($langs->transnoentities("ErrorFileDoesNotExists", GETPOST("file")), LOG_WARNING);
297  }
298 }
299 
300 
301 if ($action == 'removelogo' || $action == 'removelogosquarred') {
302  $constant = "MAIN_INFO_SOCIETE_LOGO";
303  if ($action == 'removelogosquarred') {
304  $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
305  }
306 
307  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
308 
309  $logofilename = $mysoc->logo;
310  $logofilenamebis = $mysoc->logo_squarred;
311  if ($action == 'removelogosquarred') {
312  $logofilename = $mysoc->logo_squarred;
313  $logofilenamebis = $mysoc->logo;
314  }
315 
316  $logofile = $conf->mycompany->dir_output.'/logos/'.$logofilename;
317  if ($logofilename != '' && $logofilename != $logofilenamebis) {
318  dol_delete_file($logofile);
319  }
320  dolibarr_del_const($db, $constant, $conf->entity);
321  if ($action == 'removelogosquarred') {
322  $mysoc->logo_squarred = '';
323  } else {
324  $mysoc->logo = '';
325  }
326 
327  $logofilename = $mysoc->logo_small;
328  $logofilenamebis = $mysoc->logo_squarred_small;
329  if ($action == 'removelogosquarred') {
330  $logofilename = $mysoc->logo_squarred_small;
331  $logofilenamebis = $mysoc->logo_small;
332  }
333 
334  $logosmallfile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
335  if ($logofilename != '' && $logofilename != $logofilenamebis) {
336  dol_delete_file($logosmallfile);
337  }
338  dolibarr_del_const($db, $constant."_SMALL", $conf->entity);
339  if ($action == 'removelogosquarred') {
340  $mysoc->logo_squarred_small = '';
341  } else {
342  $mysoc->logo_small = '';
343  }
344 
345  $logofilename = $mysoc->logo_mini;
346  $logofilenamebis = $mysoc->logo_squarred_mini;
347  if ($action == 'removelogosquarred') {
348  $logofilename = $mysoc->logo_squarred_mini;
349  $logofilenamebis = $mysoc->logo_mini;
350  }
351 
352  $logominifile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
353  if ($logofilename != '' && $logofilename != $logofilenamebis) {
354  dol_delete_file($logominifile);
355  }
356  dolibarr_del_const($db, $constant."_MINI", $conf->entity);
357  if ($action == 'removelogosquarred') {
358  $mysoc->logo_squarred_mini = '';
359  } else {
360  $mysoc->logo_mini = '';
361  }
362 }
363 
364 
365 /*
366  * View
367  */
368 
369 $wikihelp = 'EN:First_setup|FR:Premiers_param├ętrages|ES:Primeras_configuraciones';
370 llxHeader('', $langs->trans("Setup"), $wikihelp);
371 
372 $form = new Form($db);
373 $formother = new FormOther($db);
374 $formcompany = new FormCompany($db);
375 
376 $countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' <a href="#trzipbeforecountry">('.$langs->trans("SeeAbove").')</a></span>';
377 
378 print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
379 
381 
382 print dol_get_fiche_head($head, 'company', '', -1, '');
383 
384 print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."</span><br>\n";
385 print "<br><br>\n";
386 
387 
388 // Edit parameters
389 
390 if (!empty($conf->use_javascript_ajax)) {
391  print "\n".'<script type="text/javascript">';
392  print '$(document).ready(function () {
393  $("#selectcountry_id").change(function() {
394  document.form_index.action.value="updateedit";
395  document.form_index.submit();
396  });
397  });';
398  print '</script>'."\n";
399 }
400 
401 print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
402 print '<input type="hidden" name="token" value="'.newToken().'">';
403 print '<input type="hidden" name="action" value="update">';
404 
405 print '<table class="noborder centpercent editmode">';
406 print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
407 
408 // Name
409 print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
410 print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('nom') ? GETPOST('nom', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? $conf->global->MAIN_INFO_SOCIETE_NOM : ''))).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
411 
412 // Address
413 print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
414 print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
415 
416 // Zip
417 print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
418 print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
419 
420 print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
421 print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
422 
423 // Country
424 print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td>';
425 print img_picto('', 'globe-americas', 'class="pictofixedwidth"');
426 print $form->select_country($mysoc->country_id, 'country_id', '', 0);
427 if ($user->admin) {
428  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
429 }
430 print '</td></tr>'."\n";
431 
432 print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">'.$langs->trans("State").'</label></td><td>';
433 $state_id = 0;
434 if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE)) {
435  $tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
436  $state_id = $tmp[0];
437 }
438 print img_picto('', 'state', 'class="pictofixedwidth"');
439 print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id', 'maxwidth200onsmartphone minwidth300');
440 print '</td></tr>'."\n";
441 
442 // Currency
443 print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
444 print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
445 print $form->selectCurrency($conf->currency, "currency");
446 print '</td></tr>'."\n";
447 
448 // Phone
449 print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
450 print img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth');
451 print '<input class="maxwidth150 widthcentpercentminusx" name="tel" id="phone" value="'.dol_escape_htmltag((GETPOSTISSET('tel') ? GETPOST('tel', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TEL) ? $conf->global->MAIN_INFO_SOCIETE_TEL : ''))).'"></td></tr>';
452 print '</td></tr>'."\n";
453 
454 // Fax
455 print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
456 print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth');
457 print '<input class="maxwidth150" name="fax" id="fax" value="'.dol_escape_htmltag((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_FAX) ? $conf->global->MAIN_INFO_SOCIETE_FAX : ''))).'"></td></tr>';
458 print '</td></tr>'."\n";
459 
460 // Email
461 print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
462 print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
463 print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
464 print '</td></tr>'."\n";
465 
466 // Web
467 print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
468 print img_picto('', 'globe', '', false, 0, 0, '', 'pictofixedwidth');
469 print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" value="'.dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_WEB) ? $conf->global->MAIN_INFO_SOCIETE_WEB : ''))).'"></td></tr>';
470 print '</td></tr>'."\n";
471 
472 // Barcode
473 if (!empty($conf->barcode->enabled)) {
474  print '<tr class="oddeven"><td>';
475  print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
476  print '<span class="fa fa-barcode pictofixedwidth"></span>';
477  print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_GENCODE) ? $conf->global->MAIN_INFO_SOCIETE_GENCODE : ''))).'"></td></tr>';
478  print '</td></tr>';
479 }
480 
481 // Logo
482 print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
483 print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
484 $maxfilesizearray = getMaxFileSizeArray();
485 $maxmin = $maxfilesizearray['maxmin'];
486 if ($maxmin > 0) {
487  print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
488 }
489 print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo" id="logo" accept="image/*">';
490 print '</div>';
491 if (!empty($mysoc->logo_small)) {
492  if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
493  print '<div class="inline-block valignmiddle">';
494  print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
495  print '</div>';
496  } elseif (!empty($mysoc->logo)) {
497  if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
498  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_mini', $quality);
499  }
500  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality);
501  print '<div class="inline-block valignmiddle">';
502  print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
503  print '</div>';
504  }
505  print '<div class="inline-block valignmiddle marginrightonly">';
506  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
507  print '</div>';
508 } elseif (!empty($mysoc->logo)) {
509  if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
510  print '<div class="inline-block valignmiddle">';
511  print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
512  print '</div>';
513  print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
514  } else {
515  print '<div class="inline-block valignmiddle">';
516  print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
517  print '</div>';
518  }
519 }
520 print '</div>';
521 print '</td></tr>';
522 
523 // Logo (squarred)
524 print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
525 print '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
526 $maxfilesizearray = getMaxFileSizeArray();
527 $maxmin = $maxfilesizearray['maxmin'];
528 if ($maxmin > 0) {
529  print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
530 }
531 print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo_squarred" id="logo_squarred" accept="image/*">';
532 print '</div>';
533 if (!empty($mysoc->logo_squarred_small)) {
534  if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
535  print '<div class="inline-block valignmiddle marginrightonly">';
536  print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
537  print '</div>';
538  } elseif (!empty($mysoc->logo_squarred)) {
539  if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
540  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_mini', $quality);
541  }
542  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality);
543  print '<div class="inline-block valignmiddle">';
544  print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
545  print '</div>';
546  }
547  print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
548 } elseif (!empty($mysoc->logo_squarred)) {
549  if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
550  print '<div class="inline-block valignmiddle">';
551  print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
552  print '</div>';
553  print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
554  } else {
555  print '<div class="inline-block valignmiddle">';
556  print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
557  print '</div>';
558  }
559 }
560 print '</div>';
561 print '</td></tr>';
562 
563 // Note
564 print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
565 print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '')).'</textarea></td></tr>';
566 print '</td></tr>';
567 
568 print '</table>';
569 
570 print '<br>';
571 
572 // IDs of the company (country-specific)
573 print '<div class="div-table-responsive-no-min">';
574 print '<table class="noborder centpercent editmode">';
575 print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
576 
577 $langs->load("companies");
578 
579 // Managing Director(s)
580 print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
581 print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_MANAGERS') ? GETPOST('MAIN_INFO_SOCIETE_MANAGERS', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MANAGERS) ? $conf->global->MAIN_INFO_SOCIETE_MANAGERS : ''))).'"></td></tr>';
582 
583 // GDPR contact
584 print '<tr class="oddeven"><td>';
585 print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
586 print '</td><td>';
587 print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'alphanohtml') : (!empty($conf->global->MAIN_INFO_GDPR) ? $conf->global->MAIN_INFO_GDPR : ''))).'"></td></tr>';
588 
589 // Capital
590 print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
591 print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag((GETPOSTISSET('capital') ? GETPOST('capital', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_CAPITAL) ? $conf->global->MAIN_INFO_CAPITAL : ''))).'"></td></tr>';
592 
593 // Juridical Status
594 print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
595 if ($mysoc->country_code) {
596  print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
597 } else {
598  print $countrynotdefined;
599 }
600 print '</td></tr>';
601 
602 // ProfId1
603 if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
604  print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
605  if (!empty($mysoc->country_code)) {
606  print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '').'">';
607  } else {
608  print $countrynotdefined;
609  }
610  print '</td></tr>';
611 }
612 
613 // ProfId2
614 if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
615  print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>';
616  if (!empty($mysoc->country_code)) {
617  print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '').'">';
618  } else {
619  print $countrynotdefined;
620  }
621  print '</td></tr>';
622 }
623 
624 // ProfId3
625 if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
626  print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>';
627  if (!empty($mysoc->country_code)) {
628  print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '').'">';
629  } else {
630  print $countrynotdefined;
631  }
632  print '</td></tr>';
633 }
634 
635 // ProfId4
636 if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
637  print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>';
638  if (!empty($mysoc->country_code)) {
639  print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '').'">';
640  } else {
641  print $countrynotdefined;
642  }
643  print '</td></tr>';
644 }
645 
646 // ProfId5
647 if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
648  print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>';
649  if (!empty($mysoc->country_code)) {
650  print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '').'">';
651  } else {
652  print $countrynotdefined;
653  }
654  print '</td></tr>';
655 }
656 
657 // ProfId6
658 if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
659  print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>';
660  if (!empty($mysoc->country_code)) {
661  print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '').'">';
662  } else {
663  print $countrynotdefined;
664  }
665  print '</td></tr>';
666 }
667 
668 // Intra-community VAT number
669 print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
670 print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
671 print '</td></tr>';
672 
673 // Object of the company
674 print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
675 print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
676 print '</td></tr>';
677 
678 print '</table>';
679 print '</div>';
680 
681 
682 // Fiscal year start
683 print '<br>';
684 print '<table class="noborder centpercent editmode">';
685 print '<tr class="liste_titre">';
686 print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
687 print "</tr>\n";
688 
689 print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
690 print $formother->select_month(!empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
691 
692 print "</table>";
693 print '<br>';
694 
695 
696 // Sales taxes (VAT, IRPF, ...)
697 print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment');
698 
699 print '<table class="noborder centpercent editmode">';
700 print '<tr class="liste_titre">';
701 print '<td class="titlefieldcreate">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
702 print '<td class="right">&nbsp;</td>';
703 print "</tr>\n";
704 
705 // Main tax
706 print '<tr class="oddeven"><td><label><input type="radio" name="optiontva" id="use_vat" value="1"'.(empty($conf->global->FACTURE_TVAOPTION) ? "" : " checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
707 print '<td colspan="2">';
708 $tooltiphelp = '';
709 if ($mysoc->country_code == 'FR') {
710  $tooltiphelp = '<i>'.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i>";
711 }
712 print '<label for="use_vat">'.$form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp)."</label>";
713 print "</td></tr>\n";
714 
715 
716 print '<tr class="oddeven"><td width="140"><label><input type="radio" name="optiontva" id="no_vat" value="0"'.(empty($conf->global->FACTURE_TVAOPTION) ? " checked" : "")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
717 print '<td colspan="2">';
718 $tooltiphelp = '';
719 if ($mysoc->country_code == 'FR') {
720  $tooltiphelp = "<i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i>\n";
721 }
722 print '<label for="no_vat">'.$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>";
723 print "</td></tr>\n";
724 
725 print "</table>";
726 
727 // Second tax
728 print '<br>';
729 print '<table class="noborder centpercent editmode">';
730 print '<tr class="liste_titre">';
731 print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
732 print '<td class="right">&nbsp;</td>';
733 print "</tr>\n";
734 
735 if ($mysoc->useLocalTax(1)) {
736  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
737  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"'.(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "").'> <label for="lt1">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</label></td>";
738  print '<td colspan="2">';
739  print '<div class="nobordernopadding">';
740  $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
741  $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
742  print $form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp);
743  if (!isOnlyOneLocalTax(1)) {
744  print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
745  $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
746  }
747 
748  $opcions = array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
749 
750  print '<br><label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
751  print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
752  print "</div>";
753  print "</td></tr>\n";
754 
755  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"'.((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "").'> <label for="nolt1">'.$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</label></td>";
756  print '<td colspan="2">';
757  $tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
758  $tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
759  print $form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp);
760  print "</td></tr>\n";
761 } else {
762  if (empty($mysoc->country_code)) {
763  print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
764  } else {
765  print '<tr class="oddeven nohover"><td class="" colspan="3"><span class="opacitymedium">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</span></td></tr>';
766  }
767 }
768 
769 print "</table>";
770 
771 // Third tax system
772 print '<br>';
773 print '<table class="noborder centpercent editmode">';
774 print '<tr class="liste_titre">';
775 print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
776 print '<td class="right">&nbsp;</td>';
777 print "</tr>\n";
778 
779 if ($mysoc->useLocalTax(2)) {
780  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
781  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"'.(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "").'> <label for="lt2">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</label></td>";
782  print '<td colspan="2">';
783  print '<div class="nobordernopadding">';
784  print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
785  $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
786  $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
787  if (!isOnlyOneLocalTax(2)) {
788  print '<br><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
789  $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
790  }
791  print '<br><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
792  print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
793  print "</div>";
794  print "</td></tr>\n";
795 
796  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"'.((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "").'> <label for="nolt2">'.$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</label></td>";
797  print '<td colspan="2">';
798  print "<div>";
799  $tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
800  $tooltiphelp = ($tooltiphelp != "LocalTax2IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
801  print "<label for=\"nolt2\">".$form->textwithpicto($langs->transcountry("LocalTax2IsNotUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
802  print "</div>";
803  print "</td></tr>\n";
804 } else {
805  if (empty($mysoc->country_code)) {
806  print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
807  } else {
808  print '<tr class="oddeven nohover"><td class="" colspan="3"><span class="opacitymedium">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</span></td></tr>';
809  }
810 }
811 
812 print "</table>";
813 
814 
815 // Tax stamp
816 print '<br>';
817 print '<table class="noborder centpercent editmode">';
818 print '<tr class="liste_titre">';
819 print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
820 print '<td class="right">&nbsp;</td>';
821 print "</tr>\n";
822 if ($mysoc->useRevenueStamp()) {
823  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
824  print '<tr class="oddeven"><td>';
825  print $langs->trans("UseRevenueStamp");
826  print "</td>";
827  print '<td colspan="2">';
828  print $langs->trans("UseRevenueStampExample", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"));
829  print "</td></tr>\n";
830 } else {
831  if (empty($mysoc->country_code)) {
832  print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
833  } else {
834  print '<tr class="oddeven nohover"><td class="" colspan="3"><span class="opacitymedium">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</span></td></tr>';
835  }
836 }
837 
838 print "</table>";
839 
840 print $form->buttonsSaveCancel("Save", '');
841 
842 print '</form>';
843 
844 
845 // End of page
846 llxFooter();
847 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:552
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5190
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:484
activateModulesRequiredByCountry
activateModulesRequiredByCountry($country_code)
Activate external modules mandatory when country is country_code.
Definition: admin.lib.php:1450
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
image_format_supported
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
Definition: images.lib.php:80
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
FormCompany
Class to build HTML component for third parties management Only common components are here.
Definition: html.formcompany.class.php:40
getState
getState($id, $withcode='', $dbtouse=0, $withregion=0, $outputlangs='', $entconv=1)
Return state translated from an id.
Definition: company.lib.php:569
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3866
dol_delete_file
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
Definition: files.lib.php:1231
getMaxFileSizeArray
getMaxFileSizeArray()
Return the max allowed for file upload.
Definition: security.lib.php:993
img_delete
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
Definition: functions.lib.php:4415
dol_move_uploaded_file
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
Definition: files.lib.php:1092
$wikihelp
if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:72
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1589
isOnlyOneLocalTax
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
Definition: functions.lib.php:5956
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:1808
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4786
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10864
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:627
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:386
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
getCountry
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
Definition: company.lib.php:489
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8123
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6589
vignette
vignette($file, $maxWidth=160, $maxHeight=120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0)
Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp).
Definition: images.lib.php:507
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59
company_admin_prepare_head
company_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: admin.lib.php:1952