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