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