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