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