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