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