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