dolibarr  21.0.0-alpha
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  * Copyright (C) 2023 Nick Fragoulis
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
31 // Load Dolibarr environment
32 require '../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
41 
42 $action = GETPOST('action', 'aZ09');
43 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
44 $page_y = GETPOSTINT('page_y');
45 
46 // Load translation files required by the page
47 $langs->loadLangs(array('admin', 'companies', 'bills'));
48 
49 if (!$user->admin) {
51 }
52 
53 $error = 0;
54 
55 $tmparraysize = getDefaultImageSizes();
56 $maxwidthsmall = $tmparraysize['maxwidthsmall'];
57 $maxheightsmall = $tmparraysize['maxheightsmall'];
58 $maxwidthmini = $tmparraysize['maxwidthmini'];
59 $maxheightmini = $tmparraysize['maxheightmini'];
60 $quality = $tmparraysize['quality'];
61 
62 // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
63 $hookmanager->initHooks(array('admincompany', 'globaladmin'));
64 
65 
66 /*
67  * Actions
68  */
69 
70 $parameters = array();
71 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
72 if ($reshook < 0) {
73  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
74 }
75 
76 if (($action == 'update' && !GETPOST("cancel", 'alpha'))
77 || ($action == 'updateedit')) {
78  $tmparray = getCountry(GETPOSTINT('country_id'), 'all', $db, $langs, 0);
79  if (!empty($tmparray['id'])) {
80  if ($tmparray['code'] == 'FR' && $tmparray['id'] != $mysoc->country_id) {
81  // For FR, default value of option to show profid SIREN is on by default
82  $res = dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", 1, 'chaine', 0, '', $conf->entity);
83  }
84 
85  $mysoc->country_id = $tmparray['id'];
86  $mysoc->country_code = $tmparray['code'];
87  $mysoc->country_label = $tmparray['label'];
88 
89  $s = $mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
90  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity);
91 
92  activateModulesRequiredByCountry($mysoc->country_code);
93  }
94 
95  $tmparray = getState(GETPOSTINT('state_id'), 'all', $db, $langs, 0);
96  if (!empty($tmparray['id'])) {
97  $mysoc->state_id = $tmparray['id'];
98  $mysoc->state_code = $tmparray['code'];
99  $mysoc->state_label = $tmparray['label'];
100 
101  $s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
102  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity);
103  } else {
104  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity);
105  }
106 
107  $db->begin();
108 
109  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("name", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
110  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
111  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
112  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
113  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
114  dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity);
115  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("phone", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
116  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MOBILE", GETPOST("phone_mobile", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
117  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
118  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
119  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
120  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
121  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
122 
123  $dirforimage = $conf->mycompany->dir_output.'/logos/';
124 
125  $arrayofimages = array('logo', 'logo_squarred');
126  //var_dump($_FILES); exit;
127  foreach ($arrayofimages as $varforimage) {
128  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.
129  $langs->load("errors");
130  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
131  break;
132  }
133 
134  // Remove to check file size to large
135  /*if ($_FILES[$varforimage]["tmp_name"]) {*/
136  $reg = array();
137  if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
138  $original_file = $reg[1];
139 
140  $isimage = image_format_supported($original_file);
141  if ($isimage >= 0) {
142  dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
143  if (!is_dir($dirforimage)) {
144  dol_mkdir($dirforimage);
145  }
146  $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
147 
148  if (is_numeric($result) && $result > 0) {
149  $constant = "MAIN_INFO_SOCIETE_LOGO";
150  if ($varforimage == 'logo_squarred') {
151  $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
152  }
153 
154  dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity);
155 
156  // Create thumbs of logo (Note that PDF use original file and not thumbs)
157  if ($isimage > 0) {
158  // Create thumbs
159  //$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...
160 
161 
162  // Create small thumb, Used on logon for example
163  $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
164  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
165  $imgThumbSmall = $reg[1]; // Save only basename
166  dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
167  } else {
168  dol_syslog($imgThumbSmall);
169  }
170 
171  // Create mini thumb, Used on menu or for setup page for example
172  $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
173  if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
174  $imgThumbMini = $reg[1]; // Save only basename
175  dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
176  } else {
177  dol_syslog($imgThumbMini);
178  }
179  } else {
180  dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
181  }
182  } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
183  $error++;
184  $langs->load("errors");
185  $tmparray = explode(':', $result);
186  setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
187  } elseif (preg_match('/^ErrorFileSizeTooLarge/', $result)) {
188  $error++;
189  setEventMessages($langs->trans("ErrorFileSizeTooLarge"), null, 'errors');
190  } else {
191  $error++;
192  setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
193  }
194  } else {
195  $error++;
196  $langs->load("errors");
197  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
198  }
199  }
200  /*}*/
201  }
202 
203  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
204  dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
205  dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
206  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
207  dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
208  dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
209  dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
210  dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
211  dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
212  dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
213  dolibarr_set_const($db, "MAIN_INFO_PROFID7", GETPOST("MAIN_INFO_PROFID7", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
214  dolibarr_set_const($db, "MAIN_INFO_PROFID8", GETPOST("MAIN_INFO_PROFID8", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
215  dolibarr_set_const($db, "MAIN_INFO_PROFID9", GETPOST("MAIN_INFO_PROFID9", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
216  dolibarr_set_const($db, "MAIN_INFO_PROFID10", GETPOST("MAIN_INFO_PROFID10", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
217 
218  dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
219  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("socialobject", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
220 
221  dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOSTINT("SOCIETE_FISCAL_MONTH_START"), 'chaine', 0, '', $conf->entity);
222 
223  // Sale tax options
224  $usevat = GETPOST("optiontva", 'aZ09');
225  $uselocaltax1 = GETPOST("optionlocaltax1", 'aZ09');
226  $uselocaltax2 = GETPOST("optionlocaltax2", 'aZ09');
227  if ($uselocaltax1 == 'localtax1on' && !$usevat) {
228  setEventMessages($langs->trans("IfYouUseASecondTaxYouMustSetYouUseTheMainTax"), null, 'errors');
229  $error++;
230  }
231  if ($uselocaltax2 == 'localtax2on' && !$usevat) {
232  setEventMessages($langs->trans("IfYouUseAThirdTaxYouMustSetYouUseTheMainTax"), null, 'errors');
233  $error++;
234  }
235 
236  dolibarr_set_const($db, "FACTURE_TVAOPTION", $usevat, 'chaine', 0, '', $conf->entity);
237  dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", $uselocaltax1, 'chaine', 0, '', $conf->entity);
238  dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", $uselocaltax2, 'chaine', 0, '', $conf->entity);
239 
240  if (GETPOST("optionlocaltax1") == "localtax1on") {
241  if (!GETPOSTISSET('lt1')) {
242  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
243  } else {
244  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity);
245  }
246  dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity);
247  }
248  if (GETPOST("optionlocaltax2") == "localtax2on") {
249  if (!GETPOSTISSET('lt2')) {
250  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
251  } else {
252  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity);
253  }
254  dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity);
255  }
256 
257  // Credentials for AADE webservices, applicable only for Greece
258  if ($mysoc->country_code == 'GR') {
259  dolibarr_set_const($db, "MYDATA_AADE_USER", GETPOST("MYDATA_AADE_USER", 'alpha'), 'chaine', 0, '', $conf->entity);
260  dolibarr_set_const($db, "MYDATA_AADE_KEY", GETPOST("MYDATA_AADE_KEY", 'alpha'), 'chaine', 0, '', $conf->entity);
261  dolibarr_set_const($db, "AADE_WEBSERVICE_USER", GETPOST("AADE_WEBSERVICE_USER", 'alpha'), 'chaine', 0, '', $conf->entity);
262  dolibarr_set_const($db, "AADE_WEBSERVICE_KEY", GETPOST("AADE_WEBSERVICE_KEY", 'alpha'), 'chaine', 0, '', $conf->entity);
263  }
264 
265  // Remove constant MAIN_INFO_SOCIETE_SETUP_TODO_WARNING
266  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_SETUP_TODO_WARNING", $conf->entity);
267 
268  if (!$error) {
269  if (GETPOST('save')) { // To avoid to show message when we juste switch the country that resubmit the form.
270  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
271  }
272  $db->commit();
273  } else {
274  $db->rollback();
275  }
276 
277  if ($action != 'updateedit' && !$error) {
278  header("Location: ".$_SERVER["PHP_SELF"].($page_y ? '?page_y='.$page_y : ''));
279  exit;
280  }
281 }
282 
283 if ($action == 'addthumb' || $action == 'addthumbsquarred') { // Regenerate thumbs
284  if (file_exists($conf->mycompany->dir_output.'/logos/'.GETPOST("file"))) {
285  $isimage = image_format_supported(GETPOST("file"));
286 
287  // Create thumbs of logo
288  if ($isimage > 0) {
289  $constant = "MAIN_INFO_SOCIETE_LOGO";
290  if ($action == 'addthumbsquarred') {
291  $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
292  }
293 
294  $reg = array();
295 
296  // Create thumbs
297  //$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...
298 
299  // Create small thumb. Used on logon for example
300  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.GETPOST("file"), $maxwidthsmall, $maxheightsmall, '_small', $quality);
301  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
302  $imgThumbSmall = $reg[1]; // Save only basename
303  dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
304  } else {
305  dol_syslog($imgThumbSmall);
306  }
307 
308  // Create mini thumbs. Used on menu or for setup page for example
309  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.GETPOST("file"), $maxwidthmini, $maxheightmini, '_mini', $quality);
310  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
311  $imgThumbMini = $reg[1]; // Save only basename
312  dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
313  } else {
314  dol_syslog($imgThumbMini);
315  }
316 
317  header("Location: ".$_SERVER["PHP_SELF"]);
318  exit;
319  } else {
320  $error++;
321  $langs->load("errors");
322  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
323  dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO);
324  }
325  } else {
326  $error++;
327  $langs->load("errors");
328  setEventMessages($langs->trans("ErrorFileDoesNotExists", GETPOST("file")), null, 'errors');
329  dol_syslog($langs->transnoentities("ErrorFileDoesNotExists", GETPOST("file")), LOG_WARNING);
330  }
331 }
332 
333 
334 if ($action == 'removelogo' || $action == 'removelogosquarred') {
335  $constant = "MAIN_INFO_SOCIETE_LOGO";
336  if ($action == 'removelogosquarred') {
337  $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
338  }
339 
340  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
341 
342  $logofilename = $mysoc->logo;
343  $logofilenamebis = $mysoc->logo_squarred;
344  if ($action == 'removelogosquarred') {
345  $logofilename = $mysoc->logo_squarred;
346  $logofilenamebis = $mysoc->logo;
347  }
348 
349  $logofile = $conf->mycompany->dir_output.'/logos/'.$logofilename;
350  if ($logofilename != '' && $logofilename != $logofilenamebis) {
351  dol_delete_file($logofile);
352  }
353  dolibarr_del_const($db, $constant, $conf->entity);
354  if ($action == 'removelogosquarred') {
355  $mysoc->logo_squarred = '';
356  } else {
357  $mysoc->logo = '';
358  }
359 
360  $logofilename = $mysoc->logo_small;
361  $logofilenamebis = $mysoc->logo_squarred_small;
362  if ($action == 'removelogosquarred') {
363  $logofilename = $mysoc->logo_squarred_small;
364  $logofilenamebis = $mysoc->logo_small;
365  }
366 
367  $logosmallfile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
368  if ($logofilename != '' && $logofilename != $logofilenamebis) {
369  dol_delete_file($logosmallfile);
370  }
371  dolibarr_del_const($db, $constant."_SMALL", $conf->entity);
372  if ($action == 'removelogosquarred') {
373  $mysoc->logo_squarred_small = '';
374  } else {
375  $mysoc->logo_small = '';
376  }
377 
378  $logofilename = $mysoc->logo_mini;
379  $logofilenamebis = $mysoc->logo_squarred_mini;
380  if ($action == 'removelogosquarred') {
381  $logofilename = $mysoc->logo_squarred_mini;
382  $logofilenamebis = $mysoc->logo_mini;
383  }
384 
385  $logominifile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
386  if ($logofilename != '' && $logofilename != $logofilenamebis) {
387  dol_delete_file($logominifile);
388  }
389  dolibarr_del_const($db, $constant."_MINI", $conf->entity);
390  if ($action == 'removelogosquarred') {
391  $mysoc->logo_squarred_mini = '';
392  } else {
393  $mysoc->logo_mini = '';
394  }
395 }
396 
397 
398 /*
399  * View
400  */
401 
402 $wikihelp = 'EN:First_setup|FR:Premiers_param├ętrages|ES:Primeras_configuraciones';
403 llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-company');
404 
405 $form = new Form($db);
406 $formother = new FormOther($db);
407 $formcompany = new FormCompany($db);
408 
409 $countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' <a href="#trzipbeforecountry">('.$langs->trans("SeeAbove").')</a></span>';
410 
411 print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
412 
414 
415 print dol_get_fiche_head($head, 'company', '', -1, '');
416 
417 print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."</span><br>\n";
418 print "<br><br>\n";
419 
420 
421 // Edit parameters
422 
423 if (!empty($conf->use_javascript_ajax)) {
424  print "\n".'<script type="text/javascript">';
425  print '$(document).ready(function () {
426  $("#selectcountry_id").change(function() {
427  document.form_index.action.value="updateedit";
428  document.form_index.submit();
429  });
430  });';
431  print '</script>'."\n";
432 }
433 
434 print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
435 print '<input type="hidden" name="token" value="'.newToken().'">';
436 print '<input type="hidden" name="action" value="update">';
437 print '<input type="hidden" name="page_y" value="">';
438 
439 print '<table class="noborder centpercent editmode">';
440 print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th></th></tr>'."\n";
441 
442 // Company name
443 print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
444 print '<input name="name" id="name" maxlength="'.$mysoc->fields['nom']['length'].'" class="minwidth250" value="'.dol_escape_htmltag((GETPOSTISSET('name') ? GETPOST('name', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_NOM')))).'"'.(!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
445 
446 // Address
447 print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
448 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') : (getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'))).'</textarea></td></tr>'."\n";
449 
450 // Zip
451 print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
452 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') : (getDolGlobalString('MAIN_INFO_SOCIETE_ZIP')))).'"></td></tr>'."\n";
453 
454 print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
455 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') : (getDolGlobalString('MAIN_INFO_SOCIETE_TOWN')))).'"></td></tr>'."\n";
456 
457 // Country
458 print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td>';
459 print img_picto('', 'globe-americas', 'class="pictofixedwidth"');
460 print $form->select_country($mysoc->country_id, 'country_id', '', 0);
461 if ($user->admin) {
462  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
463 }
464 print '</td></tr>'."\n";
465 
466 print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">'.$langs->trans("State").'</label></td><td>';
467 $state_id = 0;
468 if (getDolGlobalString('MAIN_INFO_SOCIETE_STATE')) {
469  $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_STATE'));
470  $state_id = $tmp[0];
471 }
472 print img_picto('', 'state', 'class="pictofixedwidth"');
473 print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id', 'maxwidth200onsmartphone minwidth300');
474 print '</td></tr>'."\n";
475 
476 // Currency
477 print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
478 print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
479 print $form->selectCurrency($conf->currency, "currency");
480 print '</td></tr>'."\n";
481 
482 // Phone
483 print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
484 print img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth');
485 print '<input class="maxwidth150 widthcentpercentminusx" name="phone" id="phone" value="'.dol_escape_htmltag((GETPOSTISSET('phone') ? GETPOST('phone', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_TEL')))).'"></td></tr>';
486 print '</td></tr>'."\n";
487 
488 // Phone mobile
489 print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("PhoneMobile").'</label></td><td>';
490 print img_picto('', 'object_phoning_mobile', '', false, 0, 0, '', 'pictofixedwidth');
491 print '<input class="maxwidth150 widthcentpercentminusx" name="phone_mobile" id="phone_mobile" value="'.dol_escape_htmltag((GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MOBILE')))).'"></td></tr>';
492 print '</td></tr>'."\n";
493 
494 // Fax
495 print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
496 print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth');
497 print '<input class="maxwidth150" name="fax" id="fax" value="'.dol_escape_htmltag((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_FAX')))).'"></td></tr>';
498 print '</td></tr>'."\n";
499 
500 // Email
501 print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
502 print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
503 print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
504 print '</td></tr>'."\n";
505 
506 // Web
507 print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
508 print img_picto('', 'globe', '', false, 0, 0, '', 'pictofixedwidth');
509 print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" value="'.dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_WEB') ? $conf->global->MAIN_INFO_SOCIETE_WEB : ''))).'"></td></tr>';
510 print '</td></tr>'."\n";
511 
512 // Barcode
513 if (isModEnabled('barcode')) {
514  print '<tr class="oddeven"><td>';
515  print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
516  print '<span class="fa fa-barcode pictofixedwidth"></span>';
517  print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_GENCOD', '')).'"></td></tr>';
518  print '</td></tr>';
519 }
520 
521 // Tooltip for both Logo and LogSquarred
522 $tooltiplogo = $langs->trans('AvailableFormats').' : png, jpg, jpeg';
523 $maxfilesizearray = getMaxFileSizeArray();
524 $maxmin = $maxfilesizearray['maxmin'];
525 $tooltiplogo .= ($maxmin > 0) ? '<br>'.$langs->trans('MaxSize').' : '.$maxmin.' '.$langs->trans('Kb') : '';
526 
527 // Logo
528 print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), $tooltiplogo).'</label></td><td>';
529 print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
530 if ($maxmin > 0) {
531  print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
532 }
533 print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo" id="logo" accept="image/*">';
534 print '</div>';
535 if (!empty($mysoc->logo_small)) {
536  print '<div class="inline-block valignmiddle marginrightonly">';
537  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
538  print '</div>';
539  if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
540  print '<div class="inline-block valignmiddle">';
541  print '<img id="logo" style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
542  print '</div>';
543  } elseif (!empty($mysoc->logo)) {
544  if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
545  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_mini', $quality);
546  }
547  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality);
548  print '<div class="inline-block valignmiddle">';
549  print '<img id="logo" style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
550  print '</div>';
551  }
552 } elseif (!empty($mysoc->logo)) {
553  if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
554  print '<div class="inline-block valignmiddle">';
555  print '<img id="logo" style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
556  print '</div>';
557  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>';
558  } else {
559  print '<div class="inline-block valignmiddle">';
560  print '<img id="logo" height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
561  print '</div>';
562  }
563 }
564 print '</div>';
565 print '</td></tr>';
566 
567 // Logo (squarred)
568 print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), $tooltiplogo).'</label></td><td>';
569 print '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
570 $maxfilesizearray = getMaxFileSizeArray();
571 $maxmin = $maxfilesizearray['maxmin'];
572 if ($maxmin > 0) {
573  print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
574 }
575 print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo_squarred" id="logo_squarred" accept="image/*">';
576 print '</div>';
577 if (!empty($mysoc->logo_squarred_small)) {
578  print '<div class="inline-block valignmiddle marginrightonly">';
579  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
580  print '</div>';
581  if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
582  print '<div class="inline-block valignmiddle marginrightonly">';
583  print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
584  print '</div>';
585  } elseif (!empty($mysoc->logo_squarred)) {
586  if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
587  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_mini', $quality);
588  }
589  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality);
590  print '<div class="inline-block valignmiddle">';
591  print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
592  print '</div>';
593  }
594  print imgAddEditDeleteButton("logosquarred", '', $_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken());
595 } elseif (!empty($mysoc->logo_squarred)) {
596  if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
597  print '<div class="inline-block valignmiddle">';
598  print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
599  print '</div>';
600  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>';
601  print imgAddEditDeleteButton("logosquarred", '', $_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken());
602  } else {
603  print '<div class="inline-block valignmiddle">';
604  print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
605  print '</div>';
606  print imgAddEditDeleteButton("logosquarred", '', '');
607  }
608 }
609 print '</div>';
610 print '</td></tr>';
611 
612 // Note
613 print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
614 print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_NOTE') ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '')).'</textarea></td></tr>';
615 print '</td></tr>';
616 
617 print '</table>';
618 
619 print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
620 
621 print '<br><br>';
622 
623 
624 // IDs of the company (country-specific)
625 print '<div class="div-table-responsive-no-min">';
626 print '<table class="noborder centpercent editmode">';
627 print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td></td></tr>';
628 
629 $langs->load("companies");
630 
631 // Managing Director(s)
632 print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
633 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') : (getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS') ? $conf->global->MAIN_INFO_SOCIETE_MANAGERS : ''))).'"></td></tr>';
634 
635 // GDPR contact
636 print '<tr class="oddeven"><td>';
637 print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
638 print '</td><td>';
639 print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'alphanohtml') : (getDolGlobalString('MAIN_INFO_GDPR') ? $conf->global->MAIN_INFO_GDPR : ''))).'"></td></tr>';
640 
641 // Capital
642 print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
643 print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag((GETPOSTISSET('capital') ? GETPOST('capital', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_CAPITAL') ? $conf->global->MAIN_INFO_CAPITAL : ''))).'"></td></tr>';
644 
645 // Juridical Status
646 print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
647 if ($mysoc->country_code) {
648  print $formcompany->select_juridicalstatus(getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE'), $mysoc->country_code, '', 'forme_juridique_code');
649 } else {
650  print $countrynotdefined;
651 }
652 print '</td></tr>';
653 
654 // ProfId1
655 if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
656  print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
657  if (!empty($mysoc->country_code)) {
658  print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIREN')).'">';
659  } else {
660  print $countrynotdefined;
661  }
662  print '</td></tr>';
663 }
664 
665 // ProfId2
666 if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
667  print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>';
668  if (!empty($mysoc->country_code)) {
669  print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIRET')).'">';
670  } else {
671  print $countrynotdefined;
672  }
673  print '</td></tr>';
674 }
675 
676 // ProfId3
677 if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
678  print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>';
679  if (!empty($mysoc->country_code)) {
680  print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_APE')).'">';
681  } else {
682  print $countrynotdefined;
683  }
684  print '</td></tr>';
685 }
686 
687 // ProfId4
688 if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
689  print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>';
690  if (!empty($mysoc->country_code)) {
691  print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_RCS')).'">';
692  } else {
693  print $countrynotdefined;
694  }
695  print '</td></tr>';
696 }
697 
698 // ProfId5
699 if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
700  print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>';
701  if (!empty($mysoc->country_code)) {
702  print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID5')).'">';
703  } else {
704  print $countrynotdefined;
705  }
706  print '</td></tr>';
707 }
708 
709 // ProfId6
710 if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
711  print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>';
712  if (!empty($mysoc->country_code)) {
713  print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID6')).'">';
714  } else {
715  print $countrynotdefined;
716  }
717  print '</td></tr>';
718 }
719 
720 // ProfId7
721 if ($langs->transcountry("ProfId7", $mysoc->country_code) != '-') {
722  print '<tr class="oddeven"><td><label for="profid7">'.$langs->transcountry("ProfId7", $mysoc->country_code).'</label></td><td>';
723  if (!empty($mysoc->country_code)) {
724  print '<input name="MAIN_INFO_PROFID7" id="profid7" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID7')).'">';
725  } else {
726  print $countrynotdefined;
727  }
728  print '</td></tr>';
729 }
730 
731 // ProfId8
732 if ($langs->transcountry("ProfId8", $mysoc->country_code) != '-') {
733  print '<tr class="oddeven"><td><label for="profid8">'.$langs->transcountry("ProfId8", $mysoc->country_code).'</label></td><td>';
734  if (!empty($mysoc->country_code)) {
735  print '<input name="MAIN_INFO_PROFID8" id="profid8" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID8')).'">';
736  } else {
737  print $countrynotdefined;
738  }
739  print '</td></tr>';
740 }
741 
742 // ProfId9
743 if ($langs->transcountry("ProfId9", $mysoc->country_code) != '-') {
744  print '<tr class="oddeven"><td><label for="profid9">'.$langs->transcountry("ProfId9", $mysoc->country_code).'</label></td><td>';
745  if (!empty($mysoc->country_code)) {
746  print '<input name="MAIN_INFO_PROFID9" id="profid9" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID9')).'">';
747  } else {
748  print $countrynotdefined;
749  }
750  print '</td></tr>';
751 }
752 
753 // ProfId10
754 if ($langs->transcountry("ProfId10", $mysoc->country_code) != '-') {
755  print '<tr class="oddeven"><td><label for="profid10">'.$langs->transcountry("ProfId10", $mysoc->country_code).'</label></td><td>';
756  if (!empty($mysoc->country_code)) {
757  print '<input name="MAIN_INFO_PROFID10" id="profid10" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID10')).'">';
758  } else {
759  print $countrynotdefined;
760  }
761  print '</td></tr>';
762 }
763 
764 // Intra-community VAT number
765 print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
766 print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_TVAINTRA')).'">';
767 print '</td></tr>';
768 
769 // Object of the company
770 print '<tr class="oddeven"><td><label for="socialobject">'.$langs->trans("CompanyObject").'</label></td><td>';
771 print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_5.'">'.(getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT')).'</textarea></td></tr>';
772 print '</td></tr>';
773 
774 print '</table>';
775 print '</div>';
776 
777 
778 // Fiscal year start
779 print '<br>';
780 print '<table class="noborder centpercent editmode">';
781 print '<tr class="liste_titre">';
782 print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</td><td></td>';
783 print "</tr>\n";
784 
785 print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
786 print $formother->select_month(getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
787 
788 print "</table>";
789 
790 print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
791 
792 print '<br>';
793 
794 
795 // Sales taxes (VAT, IRPF, ...)
796 print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment');
797 
798 print '<table class="noborder centpercent editmode">';
799 print '<tr class="liste_titre">';
800 print '<td class="titlefieldcreate">'.$langs->trans("VATManagement").'</td><td></td>';
801 print '<td class="right">&nbsp;</td>';
802 print "</tr>\n";
803 
804 // Main tax
805 print '<tr class="oddeven"><td><label><input type="radio" name="optiontva" id="use_vat" value="1"'.(!getDolGlobalString('FACTURE_TVAOPTION') ? "" : " checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
806 print '<td colspan="2">';
807 $tooltiphelp = $langs->trans("VATIsUsedDesc");
808 if ($mysoc->country_code == 'FR') {
809  $tooltiphelp .= '<br><br><i>'.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i>";
810 }
811 print '<label for="use_vat">'.$form->textwithpicto($langs->trans("VATIsUsedStandard"), $tooltiphelp)."</label>";
812 print "</td></tr>\n";
813 
814 
815 print '<tr class="oddeven"><td width="140"><label><input type="radio" name="optiontva" id="no_vat" value="0"'.(!getDolGlobalString('FACTURE_TVAOPTION') ? " checked" : "")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
816 print '<td colspan="2">';
817 $tooltiphelp = '';
818 if ($mysoc->country_code == 'FR') {
819  $tooltiphelp = "<i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i>\n";
820 }
821 print '<label for="no_vat">'.$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>";
822 print "</td></tr>\n";
823 
824 print "</table>";
825 
826 // Second tax
827 print '<br>';
828 print '<table class="noborder centpercent editmode">';
829 print '<tr class="liste_titre">';
830 print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td></td>';
831 print '<td class="right">&nbsp;</td>';
832 print "</tr>\n";
833 
834 if ($mysoc->useLocalTax(1)) {
835  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
836  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"'.((getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == '1' || getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == "localtax1on") ? " checked" : "").'> <label for="lt1">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</label></td>";
837  print '<td colspan="2">';
838  print '<div class="nobordernopadding">';
839  $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
840  $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
841  print $form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp);
842  if (!isOnlyOneLocalTax(1)) {
843  print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
844  $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
845  }
846 
847  $opcions = array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
848 
849  print '<br><label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
850  print $form->selectarray("clt1", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC1'));
851  print "</div>";
852  print "</td></tr>\n";
853 
854  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"'.((!getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') || getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == "localtax1off") ? " checked" : "").'> <label for="nolt1">'.$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</label></td>";
855  print '<td colspan="2">';
856  $tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
857  $tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
858  print $form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp);
859  print "</td></tr>\n";
860 } else {
861  if (empty($mysoc->country_code)) {
862  print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
863  } else {
864  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>';
865  }
866 }
867 
868 print "</table>";
869 
870 // Third tax system
871 print '<br>';
872 print '<table class="noborder centpercent editmode">';
873 print '<tr class="liste_titre">';
874 print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td></td>';
875 print '<td class="right">&nbsp;</td>';
876 print "</tr>\n";
877 
878 if ($mysoc->useLocalTax(2)) {
879  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
880  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"'.((getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == '1' || getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == "localtax2on") ? " checked" : "").'> <label for="lt2">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</label></td>";
881  print '<td colspan="2">';
882  print '<div class="nobordernopadding">';
883  print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
884  $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
885  $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
886  if (!isOnlyOneLocalTax(2)) {
887  print '<br><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
888  $formcompany->select_localtax(2, getDolGlobalString('MAIN_INFO_VALUE_LOCALTAX2'), "lt2");
889  }
890  print '<br><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
891  print $form->selectarray("clt2", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC2'));
892  print "</div>";
893  print "</td></tr>\n";
894 
895  print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"'.((!getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') || getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == "localtax2off") ? " checked" : "").'> <label for="nolt2">'.$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</label></td>";
896  print '<td colspan="2">';
897  print "<div>";
898  $tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
899  $tooltiphelp = ($tooltiphelp != "LocalTax2IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
900  print "<label for=\"nolt2\">".$form->textwithpicto($langs->transcountry("LocalTax2IsNotUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
901  print "</div>";
902  print "</td></tr>\n";
903 } else {
904  if (empty($mysoc->country_code)) {
905  print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
906  } else {
907  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>';
908  }
909 }
910 
911 print "</table>";
912 
913 
914 // Tax stamp
915 print '<br>';
916 print '<table class="noborder centpercent editmode">';
917 print '<tr class="liste_titre">';
918 print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td></td>';
919 print '<td class="right">&nbsp;</td>';
920 print "</tr>\n";
921 if ($mysoc->useRevenueStamp()) {
922  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
923  print '<tr class="oddeven"><td>';
924  print $langs->trans("UseRevenueStamp");
925  print "</td>";
926  print '<td colspan="2">';
927  print $langs->trans("UseRevenueStampExample", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"));
928  print "</td></tr>\n";
929 } else {
930  if (empty($mysoc->country_code)) {
931  print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
932  } else {
933  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>';
934  }
935 }
936 
937 print "</table>";
938 
939 // AADE webservices credentials, applicable only for Greece
940 if ($mysoc->country_code == 'GR') {
941  print load_fiche_titre($langs->trans("AADEWebserviceCredentials"), '', '');
942  print '<table class="noborder centpercent editmode">';
943  print '<tr class="liste_titre">';
944  print '<td>'.$langs->trans("AccountParameter").'</td>';
945  print '<td>'.$langs->trans("Value").'</td>';
946  print '<td></td>';
947  print "</tr>\n";
948 
949  print '<tr class="oddeven"><td>';
950  print '<span class="titlefield fieldrequired">'.$langs->trans("MYDATA_AADE_USER").'</span></td><td>';
951  print '<input class="minwidth300" type="text" name="MYDATA_AADE_USER" value="'.getDolGlobalString('MYDATA_AADE_USER').'"';
952  print '</td><td></td></tr>';
953 
954  print '<tr class="oddeven"><td>';
955  print '<span class="titlefield fieldrequired">'.$langs->trans("MYDATA_AADE_KEY").'</span></td><td>';
956  print '<input class="minwidth300" type="text" name="MYDATA_AADE_KEY" value="'.getDolGlobalString('MYDATA_AADE_KEY').'"';
957  print '</td><td></td></tr>';
958 
959  print '<tr class="oddeven"><td>';
960  print '<span class="titlefield fieldrequired">'.$langs->trans("AADE_WEBSERVICE_USER").'</span></td><td>';
961  print '<input class="minwidth300" type="text" name="AADE_WEBSERVICE_USER" value="'.getDolGlobalString('AADE_WEBSERVICE_USER').'"';
962  print '</td><td></td></tr>';
963 
964  print '<tr class="oddeven"><td>';
965  print '<span class="titlefield fieldrequired">'.$langs->trans("AADE_WEBSERVICE_KEY").'</span></td><td>';
966  print '<input class="minwidth300" type="text" name="AADE_WEBSERVICE_KEY" value="'.getDolGlobalString('AADE_WEBSERVICE_KEY').'"';
967  print '</td><td></td></tr>';
968 
969  print '<br>';
970 
971  print "</table>";
972 }
973 
974 print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
975 
976 print '</form>';
977 
978 
979 // End of page
980 llxFooter();
981 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
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:656
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:580
activateModulesRequiredByCountry($country_code)
Activate external modules mandatory when country is country_code.
Definition: admin.lib.php:1515
company_admin_prepare_head()
Return array head with list of tabs to view object information.
Definition: admin.lib.php:2029
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:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
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.
Class permettant la generation de composants html autre Only common components are here.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getState($id, $withcode='0', $dbtouse=null, $withregion=0, $outputlangs=null, $entconv=1)
Return state translated from an id.
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:1469
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
Definition: files.lib.php:1331
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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 in HTML 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)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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:514
if(!defined('IMAGETYPE_WEBP')) getDefaultImageSizes()
Return default values for image sizes.
Definition: images.lib.php:45
imgAddEditDeleteButton($htmlid, $urledit, $urldelete)
Beautify an image by adding a link edit and delete on image.
Definition: images.lib.php:827
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
Definition: images.lib.php:85
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.