2006-08-12 17:32:57 +02:00
< ? php
2019-06-04 02:15:52 +02:00
/* Copyright ( C ) 2001 - 2007 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2004 - 2019 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2005 - 2017 Regis Houssin < regis . houssin @ inodbox . com >
2014-07-03 17:39:31 +02:00
* Copyright ( C ) 2010 - 2014 Juanjo Menent < jmenent @ 2 byte . es >
2017-04-24 16:36:58 +02:00
* Copyright ( C ) 2011 - 2017 Philippe Grand < philippe . grand @ atoo - net . com >
2019-01-28 21:39:22 +01:00
* Copyright ( C ) 2015 Alexandre Spangaro < aspangaro @ open - dsi . fr >
2017-09-20 13:30:59 +02:00
* Copyright ( C ) 2017 Rui Strecht < rui . strecht @ aliartalentos . com >
2006-08-12 17:32:57 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2006-08-12 17:32:57 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2006-08-12 17:32:57 +02:00
*/
/**
2008-11-16 02:54:33 +01:00
* \file htdocs / admin / company . php
* \ingroup company
2010-07-14 17:59:38 +02:00
* \brief Setup page to configure company / foundation
2008-11-16 02:54:33 +01:00
*/
2006-08-12 17:32:57 +02:00
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php' ;
2017-03-31 11:39:12 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php' ;
2006-08-12 17:32:57 +02:00
2019-11-14 12:09:15 +01:00
$action = GETPOST ( 'action' , 'aZ09' );
$contextpage = GETPOST ( 'contextpage' , 'aZ' ) ? GETPOST ( 'contextpage' , 'aZ' ) : 'admincompany' ; // To manage different context of search
2012-03-23 00:51:38 +01:00
2018-05-26 18:41:16 +02:00
// Load translation files required by the page
2020-04-07 14:06:08 +02:00
$langs -> loadLangs ( array ( 'admin' , 'companies' , 'bills' ));
2006-08-12 17:32:57 +02:00
2021-02-26 22:04:03 +01:00
if ( ! $user -> admin ) {
accessforbidden ();
}
2012-07-09 12:54:27 +02:00
2019-11-14 12:09:15 +01:00
$error = 0 ;
2010-01-13 14:11:32 +01:00
2017-10-06 08:45:59 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2019-11-14 12:09:15 +01:00
$hookmanager -> initHooks ( array ( 'admincompany' , 'globaladmin' ));
2017-10-06 08:45:59 +02:00
2018-09-09 12:53:30 +02:00
2010-01-13 14:11:32 +01:00
/*
* Actions
*/
2008-04-05 16:18:13 +02:00
2019-11-14 12:09:15 +01:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2021-02-26 22:04:03 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2017-10-06 08:45:59 +02:00
2019-11-14 12:09:15 +01:00
if (( $action == 'update' && ! GETPOST ( " cancel " , 'alpha' ))
2021-02-26 22:04:03 +01:00
|| ( $action == 'updateedit' )) {
2019-11-14 12:09:15 +01:00
$tmparray = getCountry ( GETPOST ( 'country_id' , 'int' ), 'all' , $db , $langs , 0 );
2021-02-26 22:04:03 +01:00
if ( ! empty ( $tmparray [ 'id' ])) {
2019-11-14 12:09:15 +01:00
$mysoc -> country_id = $tmparray [ 'id' ];
$mysoc -> country_code = $tmparray [ 'code' ];
$mysoc -> country_label = $tmparray [ 'label' ];
2015-06-29 06:28:04 +02:00
2019-11-14 12:09:15 +01:00
$s = $mysoc -> country_id . ':' . $mysoc -> country_code . ':' . $mysoc -> country_label ;
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_COUNTRY " , $s , 'chaine' , 0 , '' , $conf -> entity );
2017-12-08 16:15:41 +01:00
activateModulesRequiredByCountry ( $mysoc -> country_code );
2015-06-29 06:28:04 +02:00
}
2019-11-14 12:09:15 +01:00
$tmparray = getState ( GETPOST ( 'state_id' , 'int' ), 'all' , $db , $langs , 0 );
2021-02-26 22:04:03 +01:00
if ( ! empty ( $tmparray [ 'id' ])) {
2019-11-14 12:09:15 +01:00
$mysoc -> state_id = $tmparray [ 'id' ];
$mysoc -> state_code = $tmparray [ 'code' ];
$mysoc -> state_label = $tmparray [ 'label' ];
2019-03-28 00:09:59 +01:00
2019-11-14 12:09:15 +01:00
$s = $mysoc -> state_id . ':' . $mysoc -> state_code . ':' . $mysoc -> state_label ;
2019-06-22 14:47:46 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_STATE " , $s , 'chaine' , 0 , '' , $conf -> entity );
2020-05-21 09:35:30 +02:00
} else {
2019-06-22 14:47:46 +02:00
dolibarr_del_const ( $db , " MAIN_INFO_SOCIETE_STATE " , $conf -> entity );
2019-03-28 00:09:59 +01:00
}
2020-10-27 19:46:07 +01:00
$db -> begin ();
2019-06-22 11:22:04 +02:00
2022-06-13 10:44:20 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_NOM " , GETPOST ( " nom " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_ADDRESS " , GETPOST ( " MAIN_INFO_SOCIETE_ADDRESS " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_TOWN " , GETPOST ( " MAIN_INFO_SOCIETE_TOWN " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
2020-02-02 15:01:57 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_ZIP " , GETPOST ( " MAIN_INFO_SOCIETE_ZIP " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_REGION " , GETPOST ( " region_code " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
2019-06-23 19:32:29 +02:00
dolibarr_set_const ( $db , " MAIN_MONNAIE " , GETPOST ( " currency " , 'aZ09' ), 'chaine' , 0 , '' , $conf -> entity );
2020-02-02 15:01:57 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_TEL " , GETPOST ( " tel " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_FAX " , GETPOST ( " fax " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_MAIL " , GETPOST ( " mail " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_WEB " , GETPOST ( " web " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
2020-09-18 01:29:17 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_NOTE " , GETPOST ( " note " , 'restricthtml' ), 'chaine' , 0 , '' , $conf -> entity );
2020-02-02 15:01:57 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_GENCOD " , GETPOST ( " barcode " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
2017-09-06 11:39:30 +02:00
2019-11-14 12:09:15 +01:00
$dirforimage = $conf -> mycompany -> dir_output . '/logos/' ;
2019-10-11 11:27:05 +02:00
$arrayofimages = array ( 'logo' , 'logo_squarred' );
2022-09-27 19:21:29 +02:00
//var_dump($_FILES); exit;
2021-02-26 22:04:03 +01:00
foreach ( $arrayofimages as $varforimage ) {
2020-09-07 10:18:17 +02:00
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.
2020-08-06 17:37:00 +02:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorBadImageFormat " ), null , 'errors' );
break ;
}
2022-09-27 19:21:29 +02:00
// Remove to check file size to large
/*if ($_FILES[$varforimage]["tmp_name"]) {*/
2019-10-11 11:27:05 +02:00
$reg = array ();
2022-09-27 19:31:22 +02:00
if ( preg_match ( '/([^\\/:]+)$/i' , $_FILES [ $varforimage ][ " name " ], $reg )) {
$original_file = $reg [ 1 ];
$isimage = image_format_supported ( $original_file );
if ( $isimage >= 0 ) {
dol_syslog ( " Move file " . $_FILES [ $varforimage ][ " tmp_name " ] . " to " . $dirforimage . $original_file );
if ( ! is_dir ( $dirforimage )) {
dol_mkdir ( $dirforimage );
}
$result = dol_move_uploaded_file ( $_FILES [ $varforimage ][ " tmp_name " ], $dirforimage . $original_file , 1 , 0 , $_FILES [ $varforimage ][ 'error' ]);
if ( $result > 0 ) {
$constant = " MAIN_INFO_SOCIETE_LOGO " ;
if ( $varforimage == 'logo_squarred' ) {
$constant = " MAIN_INFO_SOCIETE_LOGO_SQUARRED " ;
2019-10-11 11:27:05 +02:00
}
2022-09-27 19:31:22 +02:00
dolibarr_set_const ( $db , $constant , $original_file , 'chaine' , 0 , '' , $conf -> entity );
// Create thumbs of logo (Note that PDF use original file and not thumbs)
if ( $isimage > 0 ) {
// Create thumbs
//$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...
// Create small thumb, Used on logon for example
$imgThumbSmall = vignette ( $dirforimage . $original_file , $maxwidthsmall , $maxheightsmall , '_small' , $quality );
if ( image_format_supported ( $imgThumbSmall ) >= 0 && preg_match ( '/([^\\/:]+)$/i' , $imgThumbSmall , $reg )) {
$imgThumbSmall = $reg [ 1 ]; // Save only basename
dolibarr_set_const ( $db , $constant . " _SMALL " , $imgThumbSmall , 'chaine' , 0 , '' , $conf -> entity );
} else {
dol_syslog ( $imgThumbSmall );
2021-02-26 22:04:03 +01:00
}
2017-09-06 11:39:30 +02:00
2022-09-27 19:31:22 +02:00
// Create mini thumb, Used on menu or for setup page for example
$imgThumbMini = vignette ( $dirforimage . $original_file , $maxwidthmini , $maxheightmini , '_mini' , $quality );
if ( image_format_supported ( $imgThumbMini ) >= 0 && preg_match ( '/([^\\/:]+)$/i' , $imgThumbMini , $reg )) {
$imgThumbMini = $reg [ 1 ]; // Save only basename
dolibarr_set_const ( $db , $constant . " _MINI " , $imgThumbMini , 'chaine' , 0 , '' , $conf -> entity );
2021-02-26 22:04:03 +01:00
} else {
2022-09-27 19:31:22 +02:00
dol_syslog ( $imgThumbMini );
2021-02-26 22:04:03 +01:00
}
2020-05-21 09:35:30 +02:00
} else {
2022-09-27 19:31:22 +02:00
dol_syslog ( " ErrorImageFormatNotSupported " , LOG_WARNING );
2015-06-29 06:28:04 +02:00
}
2022-09-27 19:31:22 +02:00
} elseif ( preg_match ( '/^ErrorFileIsInfectedWithAVirus/' , $result )) {
2015-06-29 06:28:04 +02:00
$error ++ ;
2019-10-11 11:27:05 +02:00
$langs -> load ( " errors " );
2022-09-27 19:31:22 +02:00
$tmparray = explode ( ':' , $result );
setEventMessages ( $langs -> trans ( 'ErrorFileIsInfectedWithAVirus' , $tmparray [ 1 ]), null , 'errors' );
} elseif ( preg_match ( '/^ErrorFileSizeTooLarge/' , $result )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFileSizeTooLarge " ), null , 'errors' );
} else {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFailedToSaveFile " ), null , 'errors' );
2015-06-29 06:28:04 +02:00
}
2022-09-27 19:31:22 +02:00
} else {
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorBadImageFormat " ), null , 'errors' );
2015-06-29 06:28:04 +02:00
}
2022-09-27 19:31:22 +02:00
}
2022-09-27 19:21:29 +02:00
/*}*/
2015-06-29 06:28:04 +02:00
}
2022-06-13 10:44:20 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_MANAGERS " , GETPOST ( " MAIN_INFO_SOCIETE_MANAGERS " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_GDPR " , GETPOST ( " MAIN_INFO_GDPR " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_CAPITAL " , GETPOST ( " capital " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_FORME_JURIDIQUE " , GETPOST ( " forme_juridique_code " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SIREN " , GETPOST ( " siren " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SIRET " , GETPOST ( " siret " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_APE " , GETPOST ( " ape " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_RCS " , GETPOST ( " rcs " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_PROFID5 " , GETPOST ( " MAIN_INFO_PROFID5 " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_PROFID6 " , GETPOST ( " MAIN_INFO_PROFID6 " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
2018-04-06 19:12:13 +02:00
2022-06-13 10:44:20 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_TVAINTRA " , GETPOST ( " tva " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_OBJECT " , GETPOST ( " object " , 'alphanohtml' ), 'chaine' , 0 , '' , $conf -> entity );
2011-06-24 21:57:45 +02:00
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " SOCIETE_FISCAL_MONTH_START " , GETPOST ( " SOCIETE_FISCAL_MONTH_START " , 'int' ), 'chaine' , 0 , '' , $conf -> entity );
2015-06-29 06:28:04 +02:00
2018-10-25 14:39:54 +02:00
// Sale tax options
2019-01-27 11:55:16 +01:00
$usevat = GETPOST ( " optiontva " , 'aZ09' );
$uselocaltax1 = GETPOST ( " optionlocaltax1 " , 'aZ09' );
$uselocaltax2 = GETPOST ( " optionlocaltax2 " , 'aZ09' );
2021-02-26 22:04:03 +01:00
if ( $uselocaltax1 == 'localtax1on' && ! $usevat ) {
2018-10-25 14:39:54 +02:00
setEventMessages ( $langs -> trans ( " IfYouUseASecondTaxYouMustSetYouUseTheMainTax " ), null , 'errors' );
$error ++ ;
}
2021-02-26 22:04:03 +01:00
if ( $uselocaltax2 == 'localtax2on' && ! $usevat ) {
2018-10-25 14:39:54 +02:00
setEventMessages ( $langs -> trans ( " IfYouUseAThirdTaxYouMustSetYouUseTheMainTax " ), null , 'errors' );
$error ++ ;
}
2015-06-29 06:28:04 +02:00
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " FACTURE_TVAOPTION " , $usevat , 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " FACTURE_LOCAL_TAX1_OPTION " , $uselocaltax1 , 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , " FACTURE_LOCAL_TAX2_OPTION " , $uselocaltax2 , 'chaine' , 0 , '' , $conf -> entity );
2015-06-29 06:28:04 +02:00
2021-03-25 16:59:47 +01:00
if ( GETPOST ( " optionlocaltax1 " ) == " localtax1on " ) {
2021-02-08 22:12:12 +01:00
if ( ! GETPOSTISSET ( 'lt1' )) {
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_VALUE_LOCALTAX1 " , 0 , 'chaine' , 0 , '' , $conf -> entity );
2020-05-21 09:35:30 +02:00
} else {
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_VALUE_LOCALTAX1 " , GETPOST ( 'lt1' , 'aZ09' ), 'chaine' , 0 , '' , $conf -> entity );
2015-06-29 06:28:04 +02:00
}
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_LOCALTAX_CALC1 " , GETPOST ( " clt1 " , 'aZ09' ), 'chaine' , 0 , '' , $conf -> entity );
2015-06-29 06:28:04 +02:00
}
2021-03-25 16:59:47 +01:00
if ( GETPOST ( " optionlocaltax2 " ) == " localtax2on " ) {
2021-02-08 22:12:12 +01:00
if ( ! GETPOSTISSET ( 'lt2' )) {
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_VALUE_LOCALTAX2 " , 0 , 'chaine' , 0 , '' , $conf -> entity );
2020-05-21 09:35:30 +02:00
} else {
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_VALUE_LOCALTAX2 " , GETPOST ( 'lt2' , 'aZ09' ), 'chaine' , 0 , '' , $conf -> entity );
2015-06-29 06:28:04 +02:00
}
2019-01-27 11:55:16 +01:00
dolibarr_set_const ( $db , " MAIN_INFO_LOCALTAX_CALC2 " , GETPOST ( " clt2 " , 'aZ09' ), 'chaine' , 0 , '' , $conf -> entity );
2015-06-29 06:28:04 +02:00
}
2021-02-26 22:04:03 +01:00
if ( ! $error ) {
2021-02-08 22:12:12 +01:00
if ( GETPOST ( 'save' )) { // To avoid to show message when we juste switch the country that resubmit the form.
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
}
2018-10-25 14:39:54 +02:00
$db -> commit ();
2020-05-21 09:35:30 +02:00
} else {
2018-10-25 14:39:54 +02:00
$db -> rollback ();
}
2021-02-26 22:04:03 +01:00
if ( $action != 'updateedit' && ! $error ) {
2015-06-29 06:28:04 +02:00
header ( " Location: " . $_SERVER [ " PHP_SELF " ]);
exit ;
}
2006-08-12 17:32:57 +02:00
}
2021-02-26 22:04:03 +01:00
if ( $action == 'addthumb' || $action == 'addthumbsquarred' ) { // Regenerate thumbs
if ( file_exists ( $conf -> mycompany -> dir_output . '/logos/' . $_GET [ " file " ])) {
2019-11-14 12:09:15 +01:00
$isimage = image_format_supported ( $_GET [ " file " ]);
2015-06-29 06:28:04 +02:00
// Create thumbs of logo
2021-02-26 22:04:03 +01:00
if ( $isimage > 0 ) {
2019-10-11 11:27:05 +02:00
$constant = " MAIN_INFO_SOCIETE_LOGO " ;
2021-02-26 22:04:03 +01:00
if ( $action == 'addthumbsquarred' ) {
$constant = " MAIN_INFO_SOCIETE_LOGO_SQUARRED " ;
}
2019-10-11 11:27:05 +02:00
$reg = array ();
2020-10-27 19:46:07 +01:00
// Create thumbs
2020-10-23 20:08:35 +02:00
//$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...
2016-04-09 14:12:21 +02:00
2017-03-31 11:39:12 +02:00
// Create small thumb. Used on logon for example
2019-01-27 11:55:16 +01:00
$imgThumbSmall = vignette ( $conf -> mycompany -> dir_output . '/logos/' . $_GET [ " file " ], $maxwidthsmall , $maxheightsmall , '_small' , $quality );
2021-02-26 22:04:03 +01:00
if ( image_format_supported ( $imgThumbSmall ) >= 0 && preg_match ( '/([^\\/:]+)$/i' , $imgThumbSmall , $reg )) {
2019-11-14 12:09:15 +01:00
$imgThumbSmall = $reg [ 1 ]; // Save only basename
2019-10-11 11:27:05 +02:00
dolibarr_set_const ( $db , $constant . " _SMALL " , $imgThumbSmall , 'chaine' , 0 , '' , $conf -> entity );
2021-02-26 22:04:03 +01:00
} else {
dol_syslog ( $imgThumbSmall );
}
2015-06-29 06:28:04 +02:00
2017-03-31 11:39:12 +02:00
// Create mini thumbs. Used on menu or for setup page for example
2019-01-27 11:55:16 +01:00
$imgThumbMini = vignette ( $conf -> mycompany -> dir_output . '/logos/' . $_GET [ " file " ], $maxwidthmini , $maxheightmini , '_mini' , $quality );
2021-02-26 22:04:03 +01:00
if ( image_format_supported ( $imgThumbSmall ) >= 0 && preg_match ( '/([^\\/:]+)$/i' , $imgThumbMini , $reg )) {
2019-11-14 12:09:15 +01:00
$imgThumbMini = $reg [ 1 ]; // Save only basename
2019-10-11 11:27:05 +02:00
dolibarr_set_const ( $db , $constant . " _MINI " , $imgThumbMini , 'chaine' , 0 , '' , $conf -> entity );
2021-02-26 22:04:03 +01:00
} else {
dol_syslog ( $imgThumbMini );
}
2015-06-29 06:28:04 +02:00
header ( " Location: " . $_SERVER [ " PHP_SELF " ]);
exit ;
2020-05-21 09:35:30 +02:00
} else {
2015-06-29 06:28:04 +02:00
$error ++ ;
$langs -> load ( " errors " );
2015-10-23 12:58:30 +02:00
setEventMessages ( $langs -> trans ( " ErrorBadImageFormat " ), null , 'errors' );
2019-05-10 20:09:41 +02:00
dol_syslog ( $langs -> transnoentities ( " ErrorBadImageFormat " ), LOG_INFO );
2015-06-29 06:28:04 +02:00
}
2020-05-21 09:35:30 +02:00
} else {
2015-06-29 06:28:04 +02:00
$error ++ ;
$langs -> load ( " errors " );
2021-03-31 12:41:44 +02:00
setEventMessages ( $langs -> trans ( " ErrorFileDoesNotExists " , GETPOST ( " file " )), null , 'errors' );
dol_syslog ( $langs -> transnoentities ( " ErrorFileDoesNotExists " , GETPOST ( " file " )), LOG_WARNING );
2015-06-29 06:28:04 +02:00
}
2007-08-09 20:22:39 +02:00
}
2015-06-29 06:28:04 +02:00
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogo' || $action == 'removelogosquarred' ) {
2019-10-11 11:27:05 +02:00
$constant = " MAIN_INFO_SOCIETE_LOGO " ;
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
$constant = " MAIN_INFO_SOCIETE_LOGO_SQUARRED " ;
}
2015-06-29 06:28:04 +02:00
2019-10-11 11:27:05 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2015-06-29 06:28:04 +02:00
2019-10-11 11:27:05 +02:00
$logofilename = $mysoc -> logo ;
2019-10-11 11:38:49 +02:00
$logofilenamebis = $mysoc -> logo_squarred ;
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
2019-10-11 11:38:49 +02:00
$logofilename = $mysoc -> logo_squarred ;
$logofilenamebis = $mysoc -> logo ;
}
2019-11-14 12:09:15 +01:00
$logofile = $conf -> mycompany -> dir_output . '/logos/' . $logofilename ;
2021-02-26 22:04:03 +01:00
if ( $logofilename != '' && $logofilename != $logofilenamebis ) {
dol_delete_file ( $logofile );
}
2019-10-11 11:27:05 +02:00
dolibarr_del_const ( $db , $constant , $conf -> entity );
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
$mysoc -> logo_squarred = '' ;
} else {
$mysoc -> logo = '' ;
}
2019-10-11 11:27:05 +02:00
$logofilename = $mysoc -> logo_small ;
2019-10-11 11:38:49 +02:00
$logofilenamebis = $mysoc -> logo_squarred_small ;
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
2019-10-11 11:38:49 +02:00
$logofilename = $mysoc -> logo_squarred_small ;
$logofilenamebis = $mysoc -> logo_small ;
}
2019-11-14 12:09:15 +01:00
$logosmallfile = $conf -> mycompany -> dir_output . '/logos/thumbs/' . $logofilename ;
2021-02-26 22:04:03 +01:00
if ( $logofilename != '' && $logofilename != $logofilenamebis ) {
dol_delete_file ( $logosmallfile );
}
2019-10-11 11:27:05 +02:00
dolibarr_del_const ( $db , $constant . " _SMALL " , $conf -> entity );
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
$mysoc -> logo_squarred_small = '' ;
} else {
$mysoc -> logo_small = '' ;
}
2019-10-11 11:27:05 +02:00
$logofilename = $mysoc -> logo_mini ;
2019-10-11 11:38:49 +02:00
$logofilenamebis = $mysoc -> logo_squarred_mini ;
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
2019-10-11 11:38:49 +02:00
$logofilename = $mysoc -> logo_squarred_mini ;
$logofilenamebis = $mysoc -> logo_mini ;
}
2019-11-14 12:09:15 +01:00
$logominifile = $conf -> mycompany -> dir_output . '/logos/thumbs/' . $logofilename ;
2021-02-26 22:04:03 +01:00
if ( $logofilename != '' && $logofilename != $logofilenamebis ) {
dol_delete_file ( $logominifile );
}
2019-10-11 11:27:05 +02:00
dolibarr_del_const ( $db , $constant . " _MINI " , $conf -> entity );
2021-02-26 22:04:03 +01:00
if ( $action == 'removelogosquarred' ) {
$mysoc -> logo_squarred_mini = '' ;
} else {
$mysoc -> logo_mini = '' ;
}
2006-08-12 17:32:57 +02:00
}
2010-08-21 17:30:17 +02:00
2006-08-12 17:32:57 +02:00
/*
2010-08-21 17:30:17 +02:00
* View
2006-08-12 17:32:57 +02:00
*/
2019-11-14 12:09:15 +01:00
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones' ;
2019-01-27 11:55:16 +01:00
llxHeader ( '' , $langs -> trans ( " Setup " ), $wikihelp );
2006-08-12 17:32:57 +02:00
2019-11-14 12:09:15 +01:00
$form = new Form ( $db );
$formother = new FormOther ( $db );
$formcompany = new FormCompany ( $db );
2008-11-16 02:54:33 +01:00
2022-03-31 16:55:48 +02:00
$countrynotdefined = '<span class="error">' . $langs -> trans ( " ErrorSetACountryFirst " ) . ' <a href="#trzipbeforecountry">(' . $langs -> trans ( " SeeAbove " ) . ')</a></span>' ;
2006-08-12 17:32:57 +02:00
2019-01-27 11:55:16 +01:00
print load_fiche_titre ( $langs -> trans ( " CompanyFoundation " ), '' , 'title_setup' );
2006-08-12 17:32:57 +02:00
2018-03-18 06:09:50 +01:00
$head = company_admin_prepare_head ();
2022-02-07 14:25:20 +01:00
print dol_get_fiche_head ( $head , 'company' , '' , - 1 , '' );
2018-03-18 06:09:50 +01:00
2019-10-11 14:09:26 +02:00
print '<span class="opacitymedium">' . $langs -> trans ( " CompanyFundationDesc " , $langs -> transnoentities ( " Save " )) . " </span><br> \n " ;
2021-10-18 15:25:56 +02:00
print " <br><br> \n " ;
2006-08-12 17:32:57 +02:00
2015-06-29 06:28:04 +02:00
2021-12-10 14:50:20 +01:00
// Edit parameters
2021-07-11 01:12:52 +02:00
if ( ! empty ( $conf -> use_javascript_ajax )) {
2021-11-29 15:09:18 +01:00
print " \n " . '<script type="text/javascript">' ;
2021-07-11 01:12:52 +02:00
print ' $ ( document ) . ready ( function () {
2019-10-11 14:09:26 +02:00
$ ( " #selectcountry_id " ) . change ( function () {
document . form_index . action . value = " updateedit " ;
document . form_index . submit ();
});
}); ' ;
2021-07-11 01:12:52 +02:00
print '</script>' . " \n " ;
}
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
print '<form enctype="multipart/form-data" method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '" name="form_index">' ;
2019-12-18 23:12:31 +01:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2019-10-11 14:09:26 +02:00
print '<input type="hidden" name="action" value="update">' ;
2017-09-06 11:39:30 +02:00
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2021-07-12 10:45:18 +02:00
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">' . $langs -> trans ( " CompanyInfo " ) . '</th><th>' . $langs -> trans ( " Value " ) . '</th></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// Name
2020-02-27 16:33:24 +01:00
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">' . $langs -> trans ( " CompanyName " ) . '</label></td><td>' ;
2022-06-13 10:44:20 +02:00
print '<input name="nom" id="name" class="minwidth200" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'nom' ) ? GETPOST ( 'nom' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_NOM ) ? $conf -> global -> MAIN_INFO_SOCIETE_NOM : '' ))) . '"' . ( empty ( $conf -> global -> MAIN_INFO_SOCIETE_NOM ) ? ' autofocus="autofocus"' : '' ) . '></td></tr>' . " \n " ;
2017-09-06 11:39:30 +02:00
2019-12-30 21:17:41 +01:00
// Address
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">' . $langs -> trans ( " CompanyAddress " ) . '</label></td><td>' ;
2022-06-13 10:44:20 +02:00
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="' . ROWS_3 . '">' . ( GETPOSTISSET ( 'MAIN_INFO_SOCIETE_ADDRESS' ) ? GETPOST ( 'MAIN_INFO_SOCIETE_ADDRESS' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_ADDRESS ) ? $conf -> global -> MAIN_INFO_SOCIETE_ADDRESS : '' )) . '</textarea></td></tr>' . " \n " ;
2017-09-06 11:39:30 +02:00
2020-11-29 16:02:39 +01:00
// Zip
2022-03-31 16:55:48 +02:00
print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">' . $langs -> trans ( " CompanyZip " ) . '</label></td><td>' ;
2022-06-13 10:44:20 +02:00
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'MAIN_INFO_SOCIETE_ZIP' ) ? GETPOST ( 'MAIN_INFO_SOCIETE_ZIP' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_ZIP ) ? $conf -> global -> MAIN_INFO_SOCIETE_ZIP : '' ))) . '"></td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2022-03-31 16:55:48 +02:00
print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">' . $langs -> trans ( " CompanyTown " ) . '</label></td><td>' ;
2022-06-13 10:44:20 +02:00
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'MAIN_INFO_SOCIETE_TOWN' ) ? GETPOST ( 'MAIN_INFO_SOCIETE_TOWN' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_TOWN ) ? $conf -> global -> MAIN_INFO_SOCIETE_TOWN : '' ))) . '"></td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// Country
2021-12-10 16:02:42 +01:00
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">' . $langs -> trans ( " Country " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'globe-americas' , 'class="pictofixedwidth"' );
2021-06-15 01:18:17 +02:00
print $form -> select_country ( $mysoc -> country_id , 'country_id' , '' , 0 );
2021-02-26 22:04:03 +01:00
if ( $user -> admin ) {
print info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
}
2019-10-11 14:09:26 +02:00
print '</td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2021-12-10 16:02:42 +01:00
print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">' . $langs -> trans ( " State " ) . '</label></td><td>' ;
2019-11-14 12:09:15 +01:00
$state_id = 0 ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_STATE )) {
2019-11-14 12:09:15 +01:00
$tmp = explode ( ':' , $conf -> global -> MAIN_INFO_SOCIETE_STATE );
$state_id = $tmp [ 0 ];
2019-10-11 14:09:26 +02:00
}
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'state' , 'class="pictofixedwidth"' );
2021-12-10 15:57:10 +01:00
print $formcompany -> select_state ( $state_id , $mysoc -> country_code , 'state_id' , 'maxwidth200onsmartphone minwidth300' );
2019-10-11 14:09:26 +02:00
print '</td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-12-30 21:17:41 +01:00
// Currency
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="currency">' . $langs -> trans ( " CompanyCurrency " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'multicurrency' , 'class="pictofixedwidth"' );
2019-10-11 14:09:26 +02:00
print $form -> selectCurrency ( $conf -> currency , " currency " );
print '</td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-12-30 21:17:41 +01:00
// Phone
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="phone">' . $langs -> trans ( " Phone " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'object_phoning' , '' , false , 0 , 0 , '' , 'pictofixedwidth' );
2021-06-15 01:18:17 +02:00
print '<input class="maxwidth150 widthcentpercentminusx" name="tel" id="phone" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'tel' ) ? GETPOST ( 'tel' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_TEL ) ? $conf -> global -> MAIN_INFO_SOCIETE_TEL : '' ))) . '"></td></tr>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-12-30 21:17:41 +01:00
// Fax
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="fax">' . $langs -> trans ( " Fax " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'object_phoning_fax' , '' , false , 0 , 0 , '' , 'pictofixedwidth' );
2021-06-15 01:18:17 +02:00
print '<input class="maxwidth150" name="fax" id="fax" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'fax' ) ? GETPOST ( 'fax' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_FAX ) ? $conf -> global -> MAIN_INFO_SOCIETE_FAX : '' ))) . '"></td></tr>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-12-30 21:17:41 +01:00
// Email
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="email">' . $langs -> trans ( " EMail " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'object_email' , '' , false , 0 , 0 , '' , 'pictofixedwidth' );
2021-12-10 14:50:20 +01:00
print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'mail' ) ? GETPOST ( 'mail' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_MAIL ) ? $conf -> global -> MAIN_INFO_SOCIETE_MAIL : '' ))) . '"></td></tr>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' . " \n " ;
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// Web
print '<tr class="oddeven"><td><label for="web">' . $langs -> trans ( " Web " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print img_picto ( '' , 'globe' , '' , false , 0 , 0 , '' , 'pictofixedwidth' );
2021-06-15 01:18:17 +02:00
print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'web' ) ? GETPOST ( 'web' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_WEB ) ? $conf -> global -> MAIN_INFO_SOCIETE_WEB : '' ))) . '"></td></tr>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' . " \n " ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// Barcode
2019-11-14 12:09:15 +01:00
if ( ! empty ( $conf -> barcode -> enabled )) {
2020-03-28 13:38:25 +01:00
print '<tr class="oddeven"><td>' ;
print '<label for="barcode">' . $langs -> trans ( " Gencod " ) . '</label></td><td>' ;
2021-07-04 19:23:04 +02:00
print '<span class="fa fa-barcode pictofixedwidth"></span>' ;
2021-06-15 01:18:17 +02:00
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'barcode' ) ? GETPOST ( 'barcode' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_GENCODE ) ? $conf -> global -> MAIN_INFO_SOCIETE_GENCODE : '' ))) . '"></td></tr>' ;
2019-10-11 11:27:05 +02:00
print '</td></tr>' ;
2019-10-11 14:09:26 +02:00
}
2019-10-11 11:27:05 +02:00
2019-10-11 14:09:26 +02:00
// Logo
2019-10-21 00:55:52 +02:00
print '<tr class="oddeven"><td><label for="logo">' . $form -> textwithpicto ( $langs -> trans ( " Logo " ), 'png, jpg' ) . '</label></td><td>' ;
2021-06-15 01:18:17 +02:00
print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">' ;
2022-06-19 19:02:16 +02:00
$maxfilesizearray = getMaxFileSizeArray ();
$maxmin = $maxfilesizearray [ 'maxmin' ];
if ( $maxmin > 0 ) {
2022-06-20 02:23:37 +02:00
print '<input type="hidden" name="MAX_FILE_SIZE" value="' . ( $maxmin * 1024 ) . '">' ; // MAX_FILE_SIZE must precede the field type=file
2022-06-19 19:02:16 +02:00
}
2021-06-15 01:18:17 +02:00
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo" id="logo" accept="image/*">' ;
2020-03-28 13:38:25 +01:00
print '</div>' ;
2020-10-05 14:06:14 +02:00
if ( ! empty ( $mysoc -> logo_small )) {
if ( file_exists ( $conf -> mycompany -> dir_output . '/logos/thumbs/' . $mysoc -> logo_small )) {
2020-03-28 13:38:25 +01:00
print '<div class="inline-block valignmiddle">' ;
2021-12-11 19:58:03 +01:00
print '<img style="max-height: 80px; max-width: 200px;" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/thumbs/' . $mysoc -> logo_small ) . '">' ;
2020-03-28 13:38:25 +01:00
print '</div>' ;
2020-12-09 09:28:46 +01:00
} elseif ( ! empty ( $mysoc -> logo )) {
2021-02-26 22:04:03 +01:00
if ( ! file_exists ( $conf -> mycompany -> dir_output . '/logos/thumbs/' . $mysoc -> logo_mini )) {
$imgThumbMini = vignette ( $conf -> mycompany -> dir_output . '/logos/' . $mysoc -> logo , $maxwidthmini , $maxheightmini , '_mini' , $quality );
}
$imgThumbSmall = vignette ( $conf -> mycompany -> dir_output . '/logos/' . $mysoc -> logo , $maxwidthmini , $maxheightmini , '_small' , $quality );
print '<div class="inline-block valignmiddle">' ;
2021-06-15 01:18:17 +02:00
print '<img style="max-height: 80px; max-width: 200px;" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/thumbs/' . basename ( $imgThumbSmall )) . '">' ;
2021-02-26 22:04:03 +01:00
print '</div>' ;
2019-10-11 14:09:26 +02:00
}
2021-06-15 01:18:17 +02:00
print '<div class="inline-block valignmiddle marginrightonly">' ;
2021-12-11 19:58:03 +01:00
print '<a class="reposition" href="' . $_SERVER [ " PHP_SELF " ] . '?action=removelogo&token=' . newToken () . '">' . img_delete ( $langs -> trans ( " Delete " ), '' , 'marginleftonly' ) . '</a>' ;
2021-06-15 01:18:17 +02:00
print '</div>' ;
2020-08-06 17:28:57 +02:00
} elseif ( ! empty ( $mysoc -> logo )) {
if ( file_exists ( $conf -> mycompany -> dir_output . '/logos/' . $mysoc -> logo )) {
print '<div class="inline-block valignmiddle">' ;
2021-12-11 19:58:03 +01:00
print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/' . $mysoc -> logo ) . '">' ;
2020-08-06 17:28:57 +02:00
print '</div>' ;
2021-12-11 19:58:03 +01:00
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>' ;
2020-08-06 17:28:57 +02:00
} else {
print '<div class="inline-block valignmiddle">' ;
2020-10-05 14:06:14 +02:00
print '<img height="80" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">' ;
2020-08-06 17:28:57 +02:00
print '</div>' ;
}
2019-10-11 14:09:26 +02:00
}
2020-02-27 16:33:24 +01:00
print '</div>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' ;
// Logo (squarred)
2019-10-21 00:55:52 +02:00
print '<tr class="oddeven"><td><label for="logo_squarred">' . $form -> textwithpicto ( $langs -> trans ( " LogoSquarred " ), 'png, jpg' ) . '</label></td><td>' ;
2021-06-15 01:18:17 +02:00
print '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">' ;
2022-06-19 19:02:16 +02:00
$maxfilesizearray = getMaxFileSizeArray ();
$maxmin = $maxfilesizearray [ 'maxmin' ];
if ( $maxmin > 0 ) {
2022-06-20 02:23:37 +02:00
print '<input type="hidden" name="MAX_FILE_SIZE" value="' . ( $maxmin * 1024 ) . '">' ; // MAX_FILE_SIZE must precede the field type=file
2022-06-19 19:02:16 +02:00
}
2021-06-15 01:18:17 +02:00
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo_squarred" id="logo_squarred" accept="image/*">' ;
2020-03-28 13:38:25 +01:00
print '</div>' ;
2020-10-05 14:06:14 +02:00
if ( ! empty ( $mysoc -> logo_squarred_small )) {
if ( file_exists ( $conf -> mycompany -> dir_output . '/logos/thumbs/' . $mysoc -> logo_squarred_small )) {
2020-03-28 13:38:25 +01:00
print '<div class="inline-block valignmiddle marginrightonly">' ;
2021-12-11 19:58:03 +01:00
print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/thumbs/' . $mysoc -> logo_squarred_small ) . '">' ;
2020-03-28 13:38:25 +01:00
print '</div>' ;
2020-12-09 09:28:46 +01:00
} elseif ( ! empty ( $mysoc -> logo_squarred )) {
2021-02-26 22:04:03 +01:00
if ( ! file_exists ( $conf -> mycompany -> dir_output . '/logos/thumbs/' . $mysoc -> logo_squarred_mini )) {
$imgThumbMini = vignette ( $conf -> mycompany -> dir_output . '/logos/' . $mysoc -> logo_squarred , $maxwidthmini , $maxheightmini , '_mini' , $quality );
}
$imgThumbSmall = vignette ( $conf -> mycompany -> dir_output . '/logos/' . $mysoc -> logo_squarred , $maxwidthmini , $maxheightmini , '_small' , $quality );
print '<div class="inline-block valignmiddle">' ;
2021-12-11 19:58:03 +01:00
print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/thumbs/' . basename ( $imgThumbSmall )) . '">' ;
2021-02-26 22:04:03 +01:00
print '</div>' ;
2019-10-11 14:09:26 +02:00
}
2021-12-11 19:58:03 +01:00
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>' ;
2020-08-06 17:28:57 +02:00
} elseif ( ! empty ( $mysoc -> logo_squarred )) {
if ( file_exists ( $conf -> mycompany -> dir_output . '/logos/' . $mysoc -> logo_squarred )) {
print '<div class="inline-block valignmiddle">' ;
2021-12-11 19:58:03 +01:00
print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode ( 'logos/' . $mysoc -> logo_squarred ) . '">' ;
2020-08-06 17:28:57 +02:00
print '</div>' ;
2021-12-11 19:58:03 +01:00
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>' ;
2021-02-26 22:04:03 +01:00
} else {
2020-08-06 17:28:57 +02:00
print '<div class="inline-block valignmiddle">' ;
2020-10-05 14:06:14 +02:00
print '<img height="80" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">' ;
2020-08-06 17:28:57 +02:00
print '</div>' ;
}
2019-10-11 14:09:26 +02:00
}
2020-02-27 16:33:24 +01:00
print '</div>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">' . $langs -> trans ( " Note " ) . '</label></td><td>' ;
2020-12-30 14:02:53 +01:00
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="' . ROWS_5 . '">' . ( GETPOSTISSET ( 'note' ) ? GETPOST ( 'note' , 'restricthtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_NOTE ) ? $conf -> global -> MAIN_INFO_SOCIETE_NOTE : '' )) . '</textarea></td></tr>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' ;
2018-05-15 11:50:42 +02:00
2019-10-11 14:09:26 +02:00
print '</table>' ;
2018-05-15 11:50:42 +02:00
2019-10-11 14:09:26 +02:00
print '<br>' ;
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// IDs of the company (country-specific)
2021-06-15 01:18:17 +02:00
print '<div class="div-table-responsive-no-min">' ;
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2021-07-12 10:45:18 +02:00
print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">' . $langs -> trans ( " CompanyIds " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td></tr>' ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
$langs -> load ( " companies " );
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// Managing Director(s)
print '<tr class="oddeven"><td><label for="director">' . $langs -> trans ( " ManagingDirectors " ) . '</label></td><td>' ;
2022-06-13 10:44:20 +02:00
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth300" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'MAIN_INFO_SOCIETE_MANAGERS' ) ? GETPOST ( 'MAIN_INFO_SOCIETE_MANAGERS' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_MANAGERS ) ? $conf -> global -> MAIN_INFO_SOCIETE_MANAGERS : '' ))) . '"></td></tr>' ;
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// GDPR contact
print '<tr class="oddeven"><td>' ;
print $form -> textwithpicto ( $langs -> trans ( " GDPRContact " ), $langs -> trans ( " GDPRContactDesc " ));
print '</td><td>' ;
2022-06-13 10:44:20 +02:00
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth300" value="' . dol_escape_htmltag (( GETPOSTISSET ( " MAIN_INFO_GDPR " ) ? GETPOST ( " MAIN_INFO_GDPR " , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_GDPR ) ? $conf -> global -> MAIN_INFO_GDPR : '' ))) . '"></td></tr>' ;
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// Capital
print '<tr class="oddeven"><td><label for="capital">' . $langs -> trans ( " Capital " ) . '</label></td><td>' ;
2022-06-13 10:44:20 +02:00
print '<input name="capital" id="capital" class="maxwidth100" value="' . dol_escape_htmltag (( GETPOSTISSET ( 'capital' ) ? GETPOST ( 'capital' , 'alphanohtml' ) : ( ! empty ( $conf -> global -> MAIN_INFO_CAPITAL ) ? $conf -> global -> MAIN_INFO_CAPITAL : '' ))) . '"></td></tr>' ;
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// Juridical Status
print '<tr class="oddeven"><td><label for="forme_juridique_code">' . $langs -> trans ( " JuridicalStatus " ) . '</label></td><td>' ;
if ( $mysoc -> country_code ) {
print $formcompany -> select_juridicalstatus ( $conf -> global -> MAIN_INFO_SOCIETE_FORME_JURIDIQUE , $mysoc -> country_code , '' , 'forme_juridique_code' );
} else {
print $countrynotdefined ;
}
print '</td></tr>' ;
2017-09-06 11:39:30 +02:00
2019-12-30 21:17:41 +01:00
// ProfId1
2021-02-26 22:04:03 +01:00
if ( $langs -> transcountry ( " ProfId1 " , $mysoc -> country_code ) != '-' ) {
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="profid1">' . $langs -> transcountry ( " ProfId1 " , $mysoc -> country_code ) . '</label></td><td>' ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $mysoc -> country_code )) {
2019-11-14 12:09:15 +01:00
print '<input name="siren" id="profid1" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_SIREN ) ? $conf -> global -> MAIN_INFO_SIREN : '' ) . '">' ;
2020-05-21 09:35:30 +02:00
} else {
2019-10-11 14:09:26 +02:00
print $countrynotdefined ;
2015-06-29 06:28:04 +02:00
}
print '</td></tr>' ;
2019-10-11 14:09:26 +02:00
}
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
// ProfId2
2021-02-26 22:04:03 +01:00
if ( $langs -> transcountry ( " ProfId2 " , $mysoc -> country_code ) != '-' ) {
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="profid2">' . $langs -> transcountry ( " ProfId2 " , $mysoc -> country_code ) . '</label></td><td>' ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $mysoc -> country_code )) {
2019-11-14 12:09:15 +01:00
print '<input name="siret" id="profid2" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_SIRET ) ? $conf -> global -> MAIN_INFO_SIRET : '' ) . '">' ;
2020-05-21 09:35:30 +02:00
} else {
2019-10-11 14:09:26 +02:00
print $countrynotdefined ;
2012-11-27 13:05:21 +01:00
}
2015-06-29 06:28:04 +02:00
print '</td></tr>' ;
2019-10-11 14:09:26 +02:00
}
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// ProfId3
2021-02-26 22:04:03 +01:00
if ( $langs -> transcountry ( " ProfId3 " , $mysoc -> country_code ) != '-' ) {
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="profid3">' . $langs -> transcountry ( " ProfId3 " , $mysoc -> country_code ) . '</label></td><td>' ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $mysoc -> country_code )) {
2019-11-14 12:09:15 +01:00
print '<input name="ape" id="profid3" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_APE ) ? $conf -> global -> MAIN_INFO_APE : '' ) . '">' ;
2020-05-21 09:35:30 +02:00
} else {
2019-10-11 14:09:26 +02:00
print $countrynotdefined ;
2019-06-22 14:47:46 +02:00
}
2015-06-29 06:28:04 +02:00
print '</td></tr>' ;
2019-10-11 14:09:26 +02:00
}
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// ProfId4
2021-02-26 22:04:03 +01:00
if ( $langs -> transcountry ( " ProfId4 " , $mysoc -> country_code ) != '-' ) {
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="profid4">' . $langs -> transcountry ( " ProfId4 " , $mysoc -> country_code ) . '</label></td><td>' ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $mysoc -> country_code )) {
2019-11-14 12:09:15 +01:00
print '<input name="rcs" id="profid4" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_RCS ) ? $conf -> global -> MAIN_INFO_RCS : '' ) . '">' ;
2020-05-21 09:35:30 +02:00
} else {
2019-10-11 14:09:26 +02:00
print $countrynotdefined ;
2015-06-29 06:28:04 +02:00
}
2019-10-11 14:09:26 +02:00
print '</td></tr>' ;
}
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// ProfId5
2021-02-26 22:04:03 +01:00
if ( $langs -> transcountry ( " ProfId5 " , $mysoc -> country_code ) != '-' ) {
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="profid5">' . $langs -> transcountry ( " ProfId5 " , $mysoc -> country_code ) . '</label></td><td>' ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $mysoc -> country_code )) {
2019-11-14 12:09:15 +01:00
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_PROFID5 ) ? $conf -> global -> MAIN_INFO_PROFID5 : '' ) . '">' ;
2020-05-21 09:35:30 +02:00
} else {
2019-10-11 14:09:26 +02:00
print $countrynotdefined ;
2015-06-29 06:28:04 +02:00
}
print '</td></tr>' ;
2019-10-11 14:09:26 +02:00
}
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// ProfId6
2021-02-26 22:04:03 +01:00
if ( $langs -> transcountry ( " ProfId6 " , $mysoc -> country_code ) != '-' ) {
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="profid6">' . $langs -> transcountry ( " ProfId6 " , $mysoc -> country_code ) . '</label></td><td>' ;
2021-02-26 22:04:03 +01:00
if ( ! empty ( $mysoc -> country_code )) {
2019-11-14 12:09:15 +01:00
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_PROFID6 ) ? $conf -> global -> MAIN_INFO_PROFID6 : '' ) . '">' ;
2020-05-21 09:35:30 +02:00
} else {
2019-10-11 14:09:26 +02:00
print $countrynotdefined ;
2019-10-11 11:27:05 +02:00
}
print '</td></tr>' ;
2019-10-11 14:09:26 +02:00
}
2019-10-11 11:27:05 +02:00
2019-12-30 21:17:41 +01:00
// Intra-community VAT number
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="intra_vat">' . $langs -> trans ( " VATIntra " ) . '</label></td><td>' ;
2019-11-14 12:09:15 +01:00
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . dol_escape_htmltag ( ! empty ( $conf -> global -> MAIN_INFO_TVAINTRA ) ? $conf -> global -> MAIN_INFO_TVAINTRA : '' ) . '">' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// Object of the company
print '<tr class="oddeven"><td><label for="object">' . $langs -> trans ( " CompanyObject " ) . '</label></td><td>' ;
2019-11-14 12:09:15 +01:00
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="' . ROWS_5 . '">' . ( ! empty ( $conf -> global -> MAIN_INFO_SOCIETE_OBJECT ) ? $conf -> global -> MAIN_INFO_SOCIETE_OBJECT : '' ) . '</textarea></td></tr>' ;
2019-10-11 14:09:26 +02:00
print '</td></tr>' ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
print '</table>' ;
2021-06-15 01:18:17 +02:00
print '</div>' ;
2017-09-06 11:39:30 +02:00
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
// Fiscal year start
print '<br>' ;
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2019-10-11 14:09:26 +02:00
print '<tr class="liste_titre">' ;
2021-07-12 10:45:18 +02:00
print '<td class="titlefieldcreate">' . $langs -> trans ( " FiscalYearInformation " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td>' ;
2019-10-11 14:09:26 +02:00
print " </tr> \n " ;
2017-09-06 11:39:30 +02:00
2019-10-11 14:09:26 +02:00
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">' . $langs -> trans ( " FiscalMonthStart " ) . '</label></td><td>' ;
2021-04-12 16:03:56 +02:00
print $formother -> select_month ( ! empty ( $conf -> global -> SOCIETE_FISCAL_MONTH_START ) ? $conf -> global -> SOCIETE_FISCAL_MONTH_START : '' , 'SOCIETE_FISCAL_MONTH_START' , 0 , 1 , 'maxwidth100' ) . '</td></tr>' ;
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
print " </table> " ;
2020-04-07 14:06:08 +02:00
print '<br>' ;
2017-09-06 11:39:30 +02:00
2015-06-29 06:28:04 +02:00
2020-04-07 14:06:08 +02:00
// Sales taxes (VAT, IRPF, ...)
2020-05-06 03:47:28 +02:00
print load_fiche_titre ( $langs -> trans ( " TypeOfSaleTaxes " ), '' , 'object_payment' );
2020-04-07 14:06:08 +02:00
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2019-10-11 14:09:26 +02:00
print '<tr class="liste_titre">' ;
2021-07-12 10:45:18 +02:00
print '<td class="titlefieldcreate">' . $langs -> trans ( " VATManagement " ) . '</td><td>' . $langs -> trans ( " Description " ) . '</td>' ;
2019-10-11 14:09:26 +02:00
print '<td class="right"> </td>' ;
print " </tr> \n " ;
2017-09-06 11:39:30 +02:00
2020-04-07 14:06:08 +02:00
// Main tax
2021-07-12 10:45:18 +02:00
print '<tr class="oddeven"><td><label><input type="radio" name="optiontva" id="use_vat" value="1"' . ( empty ( $conf -> global -> FACTURE_TVAOPTION ) ? " " : " checked " ) . " > " . $langs -> trans ( " VATIsUsed " ) . " </label></td> " ;
2019-10-11 14:09:26 +02:00
print '<td colspan="2">' ;
2020-03-28 15:20:26 +01:00
$tooltiphelp = '' ;
2021-02-26 22:04:03 +01:00
if ( $mysoc -> country_code == 'FR' ) {
$tooltiphelp = '<i>' . $langs -> trans ( " Example " ) . ': ' . $langs -> trans ( " VATIsUsedExampleFR " ) . " </i> " ;
}
2021-09-06 18:41:04 +02:00
print '<label for="use_vat">' . $form -> textwithpicto ( $langs -> trans ( " VATIsUsedDesc " ), $tooltiphelp ) . " </label> " ;
2019-10-11 14:09:26 +02:00
print " </td></tr> \n " ;
2017-09-06 11:39:30 +02:00
2015-06-29 06:28:04 +02:00
2020-12-12 18:31:26 +01:00
print '<tr class="oddeven"><td width="140"><label><input type="radio" name="optiontva" id="no_vat" value="0"' . ( empty ( $conf -> global -> FACTURE_TVAOPTION ) ? " checked " : " " ) . " > " . $langs -> trans ( " VATIsNotUsed " ) . " </label></td> " ;
2019-10-11 14:09:26 +02:00
print '<td colspan="2">' ;
2020-03-28 15:20:26 +01:00
$tooltiphelp = '' ;
2021-02-26 22:04:03 +01:00
if ( $mysoc -> country_code == 'FR' ) {
$tooltiphelp = " <i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> trans ( " VATIsNotUsedExampleFR " ) . " </i> \n " ;
}
2021-09-06 18:41:04 +02:00
print '<label for="no_vat">' . $form -> textwithpicto ( $langs -> trans ( " VATIsNotUsedDesc " ), $tooltiphelp ) . " </label> " ;
2019-10-11 14:09:26 +02:00
print " </td></tr> \n " ;
2018-03-06 11:54:05 +01:00
2019-10-11 14:09:26 +02:00
print " </table> " ;
2015-06-29 06:28:04 +02:00
2020-04-07 14:06:08 +02:00
// Second tax
print '<br>' ;
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2020-04-07 14:06:08 +02:00
print '<tr class="liste_titre">' ;
2021-07-12 10:45:18 +02:00
print '<td class="titlefieldcreate">' . $form -> textwithpicto ( $langs -> transcountry ( " LocalTax1Management " , $mysoc -> country_code ), $langs -> transcountry ( " LocalTax1IsUsedDesc " , $mysoc -> country_code )) . '</td><td>' . $langs -> trans ( " Description " ) . '</td>' ;
2020-04-07 14:06:08 +02:00
print '<td class="right"> </td>' ;
print " </tr> \n " ;
2021-02-26 22:04:03 +01:00
if ( $mysoc -> useLocalTax ( 1 )) {
2019-10-11 14:09:26 +02:00
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
2021-09-06 18:41:04 +02:00
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"' . (( $conf -> global -> FACTURE_LOCAL_TAX1_OPTION == '1' || $conf -> global -> FACTURE_LOCAL_TAX1_OPTION == " localtax1on " ) ? " checked " : " " ) . '> <label for="lt1">' . $langs -> transcountry ( " LocalTax1IsUsed " , $mysoc -> country_code ) . " </label></td> " ;
2019-10-11 14:09:26 +02:00
print '<td colspan="2">' ;
2020-03-28 15:20:26 +01:00
print '<div class="nobordernopadding">' ;
$tooltiphelp = $langs -> transcountry ( " LocalTax1IsUsedExample " , $mysoc -> country_code );
$tooltiphelp = ( $tooltiphelp != " LocalTax1IsUsedExample " ? " <i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> transcountry ( " LocalTax1IsUsedExample " , $mysoc -> country_code ) . " </i> \n " : " " );
2021-09-06 18:41:04 +02:00
print $form -> textwithpicto ( $langs -> transcountry ( " LocalTax1IsUsedDesc " , $mysoc -> country_code ), $tooltiphelp );
2021-02-26 22:04:03 +01:00
if ( ! isOnlyOneLocalTax ( 1 )) {
2020-03-28 15:20:26 +01:00
print '<br><label for="lt1">' . $langs -> trans ( " LTRate " ) . '</label>: ' ;
2019-10-11 14:09:26 +02:00
$formcompany -> select_localtax ( 1 , $conf -> global -> MAIN_INFO_VALUE_LOCALTAX1 , " lt1 " );
}
2017-09-06 11:39:30 +02:00
2019-11-14 12:09:15 +01:00
$opcions = array ( $langs -> trans ( " CalcLocaltax1 " ) . ' ' . $langs -> trans ( " CalcLocaltax1Desc " ), $langs -> trans ( " CalcLocaltax2 " ) . ' - ' . $langs -> trans ( " CalcLocaltax2Desc " ), $langs -> trans ( " CalcLocaltax3 " ) . ' - ' . $langs -> trans ( " CalcLocaltax3Desc " ));
2015-06-29 06:28:04 +02:00
2020-03-28 15:20:26 +01:00
print '<br><label for="clt1">' . $langs -> trans ( " CalcLocaltax " ) . '</label>: ' ;
2019-10-11 14:09:26 +02:00
print $form -> selectarray ( " clt1 " , $opcions , $conf -> global -> MAIN_INFO_LOCALTAX_CALC1 );
2020-03-28 15:20:26 +01:00
print " </div> " ;
2019-10-11 14:09:26 +02:00
print " </td></tr> \n " ;
2021-09-06 18:41:04 +02:00
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"' . (( empty ( $conf -> global -> FACTURE_LOCAL_TAX1_OPTION ) || $conf -> global -> FACTURE_LOCAL_TAX1_OPTION == " localtax1off " ) ? " checked " : " " ) . '> <label for="nolt1">' . $langs -> transcountry ( " LocalTax1IsNotUsed " , $mysoc -> country_code ) . " </label></td> " ;
2019-10-11 14:09:26 +02:00
print '<td colspan="2">' ;
2020-03-28 15:20:26 +01:00
$tooltiphelp = $langs -> transcountry ( " LocalTax1IsNotUsedExample " , $mysoc -> country_code );
$tooltiphelp = ( $tooltiphelp != " LocalTax1IsNotUsedExample " ? " <i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> transcountry ( " LocalTax1IsNotUsedExample " , $mysoc -> country_code ) . " </i> \n " : " " );
2021-09-06 18:41:04 +02:00
print $form -> textwithpicto ( $langs -> transcountry ( " LocalTax1IsNotUsedDesc " , $mysoc -> country_code ), $tooltiphelp );
2019-10-11 14:09:26 +02:00
print " </td></tr> \n " ;
2020-04-07 14:06:08 +02:00
} else {
2021-02-26 22:04:03 +01:00
if ( empty ( $mysoc -> country_code )) {
2020-12-05 14:46:29 +01:00
print '<tr class="oddeven nohover"><td class="">' . $countrynotdefined . '</td><td></td><td></td></tr>' ;
2020-04-07 14:06:08 +02:00
} else {
2021-07-12 10:45:18 +02:00
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>' ;
2020-04-07 14:06:08 +02:00
}
2019-10-11 14:09:26 +02:00
}
2020-04-07 14:06:08 +02:00
print " </table> " ;
// Third tax system
print '<br>' ;
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2020-04-07 14:06:08 +02:00
print '<tr class="liste_titre">' ;
2021-07-12 10:45:18 +02:00
print '<td class="titlefieldcreate">' . $form -> textwithpicto ( $langs -> transcountry ( " LocalTax2Management " , $mysoc -> country_code ), $langs -> transcountry ( " LocalTax2IsUsedDesc " , $mysoc -> country_code )) . '</td><td>' . $langs -> trans ( " Description " ) . '</td>' ;
2020-04-07 14:06:08 +02:00
print '<td class="right"> </td>' ;
print " </tr> \n " ;
2021-02-26 22:04:03 +01:00
if ( $mysoc -> useLocalTax ( 2 )) {
2019-10-11 14:09:26 +02:00
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
2021-09-06 18:41:04 +02:00
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"' . (( $conf -> global -> FACTURE_LOCAL_TAX2_OPTION == '1' || $conf -> global -> FACTURE_LOCAL_TAX2_OPTION == " localtax2on " ) ? " checked " : " " ) . '> <label for="lt2">' . $langs -> transcountry ( " LocalTax2IsUsed " , $mysoc -> country_code ) . " </label></td> " ;
2015-06-29 06:28:04 +02:00
print '<td colspan="2">' ;
2020-03-28 15:20:26 +01:00
print '<div class="nobordernopadding">' ;
2020-12-05 14:46:29 +01:00
print '<label for="lt2">' . $langs -> transcountry ( " LocalTax2IsUsedDesc " , $mysoc -> country_code ) . " </label> " ;
2020-03-28 15:20:26 +01:00
$tooltiphelp = $langs -> transcountry ( " LocalTax2IsUsedExample " , $mysoc -> country_code );
$tooltiphelp = ( $tooltiphelp != " LocalTax2IsUsedExample " ? " <i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> transcountry ( " LocalTax2IsUsedExample " , $mysoc -> country_code ) . " </i> \n " : " " );
2021-02-26 22:04:03 +01:00
if ( ! isOnlyOneLocalTax ( 2 )) {
2020-10-27 19:46:07 +01:00
print '<br><label for="lt2">' . $langs -> trans ( " LTRate " ) . '</label>: ' ;
$formcompany -> select_localtax ( 2 , $conf -> global -> MAIN_INFO_VALUE_LOCALTAX2 , " lt2 " );
2019-10-11 14:09:26 +02:00
}
2020-03-28 15:20:26 +01:00
print '<br><label for="clt2">' . $langs -> trans ( " CalcLocaltax " ) . '</label>: ' ;
2019-10-11 14:09:26 +02:00
print $form -> selectarray ( " clt2 " , $opcions , $conf -> global -> MAIN_INFO_LOCALTAX_CALC2 );
2020-03-28 15:20:26 +01:00
print " </div> " ;
2015-06-29 06:28:04 +02:00
print " </td></tr> \n " ;
2021-09-06 18:41:04 +02:00
print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"' . (( empty ( $conf -> global -> FACTURE_LOCAL_TAX2_OPTION ) || $conf -> global -> FACTURE_LOCAL_TAX2_OPTION == " localtax2off " ) ? " checked " : " " ) . '> <label for="nolt2">' . $langs -> transcountry ( " LocalTax2IsNotUsed " , $mysoc -> country_code ) . " </label></td> " ;
2015-06-29 06:28:04 +02:00
print '<td colspan="2">' ;
2020-03-28 15:20:26 +01:00
print " <div> " ;
$tooltiphelp = $langs -> transcountry ( " LocalTax2IsNotUsedExample " , $mysoc -> country_code );
$tooltiphelp = ( $tooltiphelp != " LocalTax2IsNotUsedExample " ? " <i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> transcountry ( " LocalTax2IsNotUsedExample " , $mysoc -> country_code ) . " </i> \n " : " " );
print " <label for= \" nolt2 \" > " . $form -> textwithpicto ( $langs -> transcountry ( " LocalTax2IsNotUsedDesc " , $mysoc -> country_code ), $tooltiphelp ) . " </label> " ;
print " </div> " ;
2015-06-29 06:28:04 +02:00
print " </td></tr> \n " ;
2020-04-07 14:06:08 +02:00
} else {
2021-02-26 22:04:03 +01:00
if ( empty ( $mysoc -> country_code )) {
2020-12-05 14:46:29 +01:00
print '<tr class="oddeven nohover"><td class="">' . $countrynotdefined . '</td><td></td><td></td></tr>' ;
2020-04-07 14:06:08 +02:00
} else {
2021-07-12 10:45:18 +02:00
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>' ;
2020-04-07 14:06:08 +02:00
}
}
print " </table> " ;
2020-04-08 16:13:29 +02:00
// Tax stamp
2020-04-07 14:06:08 +02:00
print '<br>' ;
2020-04-08 16:13:29 +02:00
print '<table class="noborder centpercent editmode">' ;
2020-04-07 14:06:08 +02:00
print '<tr class="liste_titre">' ;
2021-09-06 18:41:04 +02:00
print '<td>' . $form -> textwithpicto ( $langs -> trans ( " RevenueStamp " ), $langs -> trans ( " RevenueStampDesc " )) . '</td><td>' . $langs -> trans ( " Description " ) . '</td>' ;
2020-04-07 14:06:08 +02:00
print '<td class="right"> </td>' ;
print " </tr> \n " ;
2021-02-26 22:04:03 +01:00
if ( $mysoc -> useRevenueStamp ()) {
2020-04-07 14:06:08 +02:00
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
2020-04-08 16:13:29 +02:00
print '<tr class="oddeven"><td>' ;
2020-04-07 14:06:08 +02:00
print $langs -> trans ( " UseRevenueStamp " );
print " </td> " ;
print '<td colspan="2">' ;
print $langs -> trans ( " UseRevenueStampExample " , $langs -> transnoentitiesnoconv ( " Setup " ), $langs -> transnoentitiesnoconv ( " Dictionaries " ), $langs -> transnoentitiesnoconv ( " DictionaryRevenueStamp " ));
print " </td></tr> \n " ;
} else {
2021-02-26 22:04:03 +01:00
if ( empty ( $mysoc -> country_code )) {
2020-12-05 14:46:29 +01:00
print '<tr class="oddeven nohover"><td class="">' . $countrynotdefined . '</td><td></td><td></td></tr>' ;
2020-04-07 14:06:08 +02:00
} else {
2021-07-12 10:45:18 +02:00
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>' ;
2020-04-07 14:06:08 +02:00
}
2019-10-11 14:09:26 +02:00
}
2017-09-06 11:39:30 +02:00
2020-04-07 14:06:08 +02:00
print " </table> " ;
2021-08-20 14:41:30 +02:00
print $form -> buttonsSaveCancel ( " Save " , '' );
2015-06-29 06:28:04 +02:00
2019-10-11 14:09:26 +02:00
print '</form>' ;
2015-06-29 06:28:04 +02:00
2006-08-12 17:32:57 +02:00
2018-07-28 17:26:56 +02:00
// End of page
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-03-23 00:51:38 +01:00
$db -> close ();