2014-08-27 07:03:42 +02:00
< ? php
2017-05-25 06:57:28 +02:00
/* Copyright ( C ) 2013 - 2014 Olivier Geffroy < jeff @ jeffinfo . com >
* Copyright ( C ) 2013 - 2014 Florian Henry < florian . henry @ open - concept . pro >
2021-10-13 02:48:42 +02:00
* Copyright ( C ) 2013 - 2021 Alexandre Spangaro < aspangaro @ open - dsi . fr >
2017-05-25 06:57:28 +02:00
* Copyright ( C ) 2014 - 2015 Ari Elbaz ( elarifr ) < github @ accedinfo . com >
2014-09-19 15:04:36 +02:00
* Copyright ( C ) 2014 Marcos García < marcosgdf @ gmail . com >
2017-05-25 06:57:28 +02:00
* Copyright ( C ) 2014 Juanjo Menent < jmenent @ 2 byte . es >
* Copyright ( C ) 2015 Jean - François Ferry < jfefe @ aternatik . fr >
2017-10-13 02:02:13 +02:00
* Copyright ( C ) 2017 Laurent Destailleur < eldy @ destailleur . fr >
2021-03-09 18:44:06 +01:00
* Copyright ( C ) 2021 Ferran Marcet < fmarcet @ 2 byte . es >
2014-08-27 07:03:42 +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
* the Free Software Foundation ; either version 3 of the License , or
* ( 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 />.
2014-08-27 07:03:42 +02:00
*/
/**
2016-04-17 15:44:04 +02:00
* \file htdocs / accountancy / admin / index . php
2019-05-13 22:25:15 +02:00
* \ingroup Accountancy ( Double entries )
2016-04-17 15:44:04 +02:00
* \brief Setup page to configure accounting expert module
2014-08-27 07:03:42 +02:00
*/
2016-02-01 15:07:12 +01:00
2018-04-07 22:27:42 +02:00
require '../../main.inc.php' ;
2019-11-13 19:35:02 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php' ;
2020-08-17 15:27:05 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
2014-08-27 07:03:42 +02:00
2018-05-26 23:52:52 +02:00
// Load translation files required by the page
2020-09-01 16:18:07 +02:00
$langs -> loadLangs ( array ( " compta " , " bills " , " admin " , " accountancy " , " other " ));
2014-08-27 07:03:42 +02:00
2017-09-16 06:53:29 +02:00
// Security access
2020-12-30 19:17:28 +01:00
if ( empty ( $user -> rights -> accounting -> chartofaccount )) {
2016-02-01 15:07:12 +01:00
accessforbidden ();
2016-10-13 21:48:07 +02:00
}
2014-08-27 07:03:42 +02:00
2018-11-05 17:53:31 +01:00
$action = GETPOST ( 'action' , 'aZ09' );
2014-08-27 07:03:42 +02:00
2016-10-15 15:51:28 +02:00
// Parameters ACCOUNTING_* and others
2019-11-13 19:35:02 +01:00
$list = array (
2020-09-07 10:18:17 +02:00
'ACCOUNTING_LENGTH_GACCOUNT' ,
'ACCOUNTING_LENGTH_AACCOUNT' ,
2020-12-30 19:17:28 +01:00
// 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated.
// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
2016-10-15 15:51:28 +02:00
);
2020-08-17 15:27:05 +02:00
$list_binding = array (
'ACCOUNTING_DATE_START_BINDING' ,
2020-09-01 16:18:07 +02:00
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
2020-08-17 15:27:05 +02:00
);
2016-10-13 21:48:07 +02:00
2021-04-13 09:46:50 +02:00
$error = 0 ;
2014-08-27 07:03:42 +02:00
/*
* Actions
*/
2021-04-13 09:46:50 +02:00
if ( in_array ( $action , array (
'setBANK_DISABLE_DIRECT_INPUT' ,
'setACCOUNTANCY_COMBO_FOR_AUX' ,
'setACCOUNTING_MANAGE_ZERO' ,
'setACCOUNTING_LIST_SORT_VENTILATION_TODO' ,
'setACCOUNTING_LIST_SORT_VENTILATION_DONE' ))) {
$constname = preg_replace ( '/^set/' , '' , $action );
$constvalue = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , $constname , $constvalue , 'yesno' , 0 , '' , $conf -> entity );
if ( ! ( $res > 0 )) {
$error ++ ;
}
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
}
2016-02-01 15:07:12 +01:00
if ( $action == 'update' ) {
$error = 0 ;
2017-06-22 14:48:13 +02:00
2020-12-30 19:17:28 +01:00
if ( ! $error ) {
foreach ( $list as $constname ) {
2020-09-07 10:18:17 +02:00
$constvalue = GETPOST ( $constname , 'alpha' );
if ( ! dolibarr_set_const ( $db , $constname , $constvalue , 'chaine' , 0 , '' , $conf -> entity )) {
$error ++ ;
}
}
if ( $error ) {
setEventMessages ( $langs -> trans ( " Error " ), null , 'errors' );
}
2020-08-17 15:27:05 +02:00
2020-12-30 19:17:28 +01:00
foreach ( $list_binding as $constname ) {
2020-08-17 15:27:05 +02:00
$constvalue = GETPOST ( $constname , 'alpha' );
if ( $constname == 'ACCOUNTING_DATE_START_BINDING' ) {
2021-03-27 06:56:34 +01:00
$constvalue = dol_mktime ( 0 , 0 , 0 , GETPOST ( $constname . 'month' , 'int' ), GETPOST ( $constname . 'day' , 'int' ), GETPOST ( $constname . 'year' , 'int' ));
2020-08-17 15:27:05 +02:00
}
if ( ! dolibarr_set_const ( $db , $constname , $constvalue , 'chaine' , 0 , '' , $conf -> entity )) {
$error ++ ;
}
}
if ( $error ) {
setEventMessages ( $langs -> trans ( " Error " ), null , 'errors' );
}
2016-02-01 15:07:12 +01:00
}
2017-06-22 14:48:13 +02:00
2020-09-07 10:18:17 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
}
2016-10-15 15:51:28 +02:00
}
if ( $action == 'setlistsorttodo' ) {
2020-09-07 10:18:17 +02:00
$setlistsorttodo = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_LIST_SORT_VENTILATION_TODO " , $setlistsorttodo , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-09-07 10:18:17 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2016-10-15 15:51:28 +02:00
2020-09-07 10:18:17 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2016-10-15 15:51:28 +02:00
}
if ( $action == 'setlistsortdone' ) {
2020-09-07 10:18:17 +02:00
$setlistsortdone = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_LIST_SORT_VENTILATION_DONE " , $setlistsortdone , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-09-07 10:18:17 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2020-09-07 10:18:17 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2016-10-15 15:51:28 +02:00
}
if ( $action == 'setmanagezero' ) {
2020-09-07 10:18:17 +02:00
$setmanagezero = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_MANAGE_ZERO " , $setmanagezero , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-09-07 10:18:17 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2020-09-07 10:18:17 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2016-10-15 15:51:28 +02:00
}
2017-03-19 20:47:30 +01:00
if ( $action == 'setdisabledirectinput' ) {
$setdisabledirectinput = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " BANK_DISABLE_DIRECT_INPUT " , $setdisabledirectinput , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2019-11-13 19:35:02 +01:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2019-11-13 19:35:02 +01:00
if ( ! $error ) {
2019-10-20 01:09:11 +02:00
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2017-03-19 20:47:30 +01:00
}
2018-06-05 20:37:39 +02:00
if ( $action == 'setenabledraftexport' ) {
$setenabledraftexport = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL " , $setenabledraftexport , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2019-11-13 19:35:02 +01:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2019-11-13 19:35:02 +01:00
if ( ! $error ) {
2019-10-20 01:09:11 +02:00
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2018-06-05 20:37:39 +02:00
}
2019-02-25 22:22:31 +01:00
if ( $action == 'setenablesubsidiarylist' ) {
2020-09-07 10:18:17 +02:00
$setenablesubsidiarylist = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTANCY_COMBO_FOR_AUX " , $setenablesubsidiarylist , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-09-07 10:18:17 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2020-09-07 10:18:17 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2019-02-25 22:22:31 +01:00
}
2020-08-18 07:38:46 +02:00
if ( $action == 'setdisablebindingonsales' ) {
$setdisablebindingonsales = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_DISABLE_BINDING_ON_SALES " , $setdisablebindingonsales , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-08-18 07:38:46 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2020-08-18 07:38:46 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
}
if ( $action == 'setdisablebindingonpurchases' ) {
$setdisablebindingonpurchases = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_DISABLE_BINDING_ON_PURCHASES " , $setdisablebindingonpurchases , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-08-18 07:38:46 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2020-08-18 07:38:46 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
}
if ( $action == 'setdisablebindingonexpensereports' ) {
$setdisablebindingonexpensereports = GETPOST ( 'value' , 'int' );
$res = dolibarr_set_const ( $db , " ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS " , $setdisablebindingonexpensereports , 'yesno' , 0 , '' , $conf -> entity );
2021-01-23 17:49:08 +01:00
if ( ! ( $res > 0 )) {
2020-08-18 07:38:46 +02:00
$error ++ ;
2020-12-30 19:17:28 +01:00
}
2021-01-23 17:49:08 +01:00
2020-08-18 07:38:46 +02:00
if ( ! $error ) {
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " Error " ), null , 'mesgs' );
}
2019-02-25 22:22:31 +01:00
}
2021-01-23 17:49:08 +01:00
2014-08-27 07:03:42 +02:00
/*
* View
*/
2021-01-23 17:49:08 +01:00
2020-08-17 15:27:05 +02:00
$form = new Form ( $db );
2014-08-27 07:03:42 +02:00
2019-11-13 19:35:02 +01:00
$title = $langs -> trans ( 'ConfigAccountingExpert' );
2019-10-02 18:14:41 +02:00
llxHeader ( '' , $title );
2014-08-27 07:03:42 +02:00
2019-11-13 19:35:02 +01:00
$linkback = '' ;
2018-02-26 09:20:05 +01:00
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
2021-07-05 06:58:10 +02:00
print load_fiche_titre ( $title , $linkback , 'accountancy' );
2014-08-27 07:03:42 +02:00
2021-10-13 02:48:42 +02:00
// Show message if accountancy hidden options are activated to help to resolve some problems
if ( ! $user -> admin ) {
if ( ! empty ( $conf -> global -> FACTURE_DEPOSITS_ARE_JUST_PAYMENTS )) {
print '<div class="info">' . $langs -> trans ( " ConstantIsOn " , " FACTURE_DEPOSITS_ARE_JUST_PAYMENTS " ) . '</div>' ;
}
2022-10-12 11:52:33 +02:00
if ( ! empty ( $conf -> global -> FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS )) {
print '<div class="info">' . $langs -> trans ( " ConstantIsOn " , " FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS " ) . '</div>' ;
}
2021-10-13 02:48:42 +02:00
if ( ! empty ( $conf -> global -> ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY )) {
print '<div class="info">' . $langs -> trans ( " ConstantIsOn " , " ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY " ) . '</div>' ;
}
if ( ! empty ( $conf -> global -> MAIN_COMPANY_PERENTITY_SHARED )) {
print '<div class="info">' . $langs -> trans ( " ConstantIsOn " , " MAIN_COMPANY_PERENTITY_SHARED " ) . '</div>' ;
}
if ( ! empty ( $conf -> global -> MAIN_PRODUCT_PERENTITY_SHARED )) {
print '<div class="info">' . $langs -> trans ( " ConstantIsOn " , " MAIN_PRODUCT_PERENTITY_SHARED " ) . '</div>' ;
}
}
2019-11-13 19:35:02 +01:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="post">' ;
2019-12-18 23:12:31 +01:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2014-08-27 07:03:42 +02:00
print '<input type="hidden" name="action" value="update">' ;
2020-08-17 15:27:05 +02:00
// Params
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">' ;
2016-10-15 15:51:28 +02:00
print '<tr class="liste_titre">' ;
2020-08-17 15:27:05 +02:00
print '<td colspan="2">' . $langs -> trans ( 'Options' ) . '</td>' ;
2016-10-15 15:51:28 +02:00
print " </tr> \n " ;
2020-08-18 06:23:35 +02:00
// TO DO Mutualize code for yes/no constants
/* Set this option as a hidden option but keep it for some needs .
print '<tr>' ;
print '<td>' . $langs -> trans ( " ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL )) {
2020-09-30 15:13:28 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&enabledraftexport&value=0">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print '</a></td>' ;
} else {
2020-09-30 15:13:28 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&enabledraftexport&value=1">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
}
print '</tr>' ;
*/
2017-03-19 20:47:30 +01:00
2020-11-07 15:33:23 +01:00
print '<tr class="oddeven">' ;
2020-08-18 06:23:35 +02:00
print '<td>' . $langs -> trans ( " BANK_DISABLE_DIRECT_INPUT " ) . '</td>' ;
if ( ! empty ( $conf -> global -> BANK_DISABLE_DIRECT_INPUT )) {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setBANK_DISABLE_DIRECT_INPUT&value=0">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print '</a></td>' ;
} else {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setBANK_DISABLE_DIRECT_INPUT&value=1">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
}
2020-11-07 15:33:23 +01:00
print '</tr>' ;
2020-08-18 06:23:35 +02:00
2020-08-18 06:28:16 +02:00
print '<tr class="oddeven">' ;
2021-05-03 12:01:26 +02:00
print '<td>' . $langs -> trans ( " ACCOUNTANCY_COMBO_FOR_AUX " );
print ' - <span class="opacitymedium">' . $langs -> trans ( " NotRecommended " ) . '</span>' ;
print '</td>' ;
2021-02-22 21:36:42 +01:00
2020-08-18 06:23:35 +02:00
if ( ! empty ( $conf -> global -> ACCOUNTANCY_COMBO_FOR_AUX )) {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">' ;
2020-09-08 21:27:28 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print '</a></td>' ;
2020-08-18 06:23:35 +02:00
} else {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">' ;
2020-09-08 21:27:28 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
2020-08-18 06:23:35 +02:00
}
print '</tr>' ;
2020-08-18 06:28:16 +02:00
print '<tr class="oddeven">' ;
2020-08-18 06:23:35 +02:00
print '<td>' . $langs -> trans ( " ACCOUNTING_MANAGE_ZERO " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_MANAGE_ZERO )) {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTING_MANAGE_ZERO&value=0">' ;
2020-09-08 21:27:28 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print '</a></td>' ;
2020-08-18 06:23:35 +02:00
} else {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTING_MANAGE_ZERO&value=1">' ;
2020-09-08 21:27:28 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
2020-08-18 06:23:35 +02:00
}
print '</tr>' ;
2020-08-17 15:27:05 +02:00
2020-08-18 06:23:35 +02:00
// Param a user $user->rights->accounting->chartofaccount can access
2020-12-30 19:17:28 +01:00
foreach ( $list as $key ) {
2020-08-18 06:23:35 +02:00
print '<tr class="oddeven value">' ;
2020-08-17 15:27:05 +02:00
2020-12-30 19:17:28 +01:00
if ( ! empty ( $conf -> global -> ACCOUNTING_MANAGE_ZERO ) && ( $key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT' )) {
continue ;
}
2020-08-17 15:27:05 +02:00
2020-08-18 06:23:35 +02:00
// Param
$label = $langs -> trans ( $key );
print '<td>' . $label . '</td>' ;
// Value
print '<td class="right">' ;
2022-06-28 11:07:06 +02:00
print '<input type="text" class="maxwidth50 right" id="' . $key . '" name="' . $key . '" value="' . getDolGlobalString ( $key ) . '">' ;
2020-08-17 15:27:05 +02:00
2020-08-18 06:23:35 +02:00
print '</td>' ;
print '</tr>' ;
2016-10-15 15:51:28 +02:00
}
2020-08-17 15:27:05 +02:00
print '</table>' ;
print '<br>' ;
2016-10-15 15:51:28 +02:00
2020-08-17 15:27:05 +02:00
// Binding params
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre">' ;
print '<td colspan="2">' . $langs -> trans ( 'BindingOptions' ) . '</td>' ;
print " </tr> \n " ;
2020-08-18 06:23:35 +02:00
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " ACCOUNTING_LIST_SORT_VENTILATION_TODO " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_LIST_SORT_VENTILATION_TODO )) {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print '</a></td>' ;
} else {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
2020-08-17 15:27:05 +02:00
}
2020-08-18 06:23:35 +02:00
print '</tr>' ;
2020-08-18 06:28:16 +02:00
print '<tr class="oddeven">' ;
2020-08-18 06:23:35 +02:00
print '<td>' . $langs -> trans ( " ACCOUNTING_LIST_SORT_VENTILATION_DONE " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_LIST_SORT_VENTILATION_DONE )) {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print '</a></td>' ;
} else {
2021-04-13 09:46:50 +02:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">' ;
2020-08-18 06:23:35 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
}
print '</tr>' ;
2016-10-15 15:51:28 +02:00
2017-07-07 20:07:28 +02:00
// Param a user $user->rights->accounting->chartofaccount can access
2020-12-30 19:17:28 +01:00
foreach ( $list_binding as $key ) {
2020-08-18 06:23:35 +02:00
print '<tr class="oddeven value">' ;
// Param
$label = $langs -> trans ( $key );
print '<td>' . $label . '</td>' ;
// Value
print '<td class="right">' ;
if ( $key == 'ACCOUNTING_DATE_START_BINDING' ) {
2022-06-12 07:19:08 +02:00
print $form -> selectDate (( ! empty ( $conf -> global -> $key ) ? $db -> idate ( $conf -> global -> $key ) : - 1 ), $key , 0 , 0 , 1 );
2020-09-01 16:18:07 +02:00
} elseif ( $key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER' ) {
2020-09-14 04:30:04 +02:00
$array = array ( 0 => $langs -> trans ( " PreviousMonth " ), 1 => $langs -> trans ( " CurrentMonth " ), 2 => $langs -> trans ( " Fiscalyear " ));
print $form -> selectarray ( $key , $array , ( isset ( $conf -> global -> ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER ) ? $conf -> global -> ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0 ));
2020-09-08 21:27:28 +02:00
} else {
2022-06-21 20:25:25 +02:00
print '<input type="text" class="maxwidth100" id="' . $key . '" name="' . $key . '" value="' . getDolGlobalString ( $key ) . '">' ;
2020-08-17 15:27:05 +02:00
}
2020-08-18 06:23:35 +02:00
print '</td>' ;
print '</tr>' ;
2016-10-15 15:51:28 +02:00
}
2020-08-18 07:38:46 +02:00
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " ACCOUNTING_DISABLE_BINDING_ON_SALES " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_DISABLE_BINDING_ON_SALES )) {
2021-03-09 18:44:06 +01:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setdisablebindingonsales&value=0">' ;
2021-04-13 09:46:50 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' , '' , false , 0 , 0 , '' , 'warning' );
2020-08-18 07:38:46 +02:00
print '</a></td>' ;
} else {
2021-03-09 18:44:06 +01:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setdisablebindingonsales&value=1">' ;
2020-08-18 07:38:46 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
}
print '</tr>' ;
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " ACCOUNTING_DISABLE_BINDING_ON_PURCHASES " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_DISABLE_BINDING_ON_PURCHASES )) {
2021-03-09 18:44:06 +01:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setdisablebindingonpurchases&value=0">' ;
2021-04-13 09:46:50 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' , '' , false , 0 , 0 , '' , 'warning' );
2020-08-18 07:38:46 +02:00
print '</a></td>' ;
} else {
2021-03-09 18:44:06 +01:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setdisablebindingonpurchases&value=1">' ;
2020-08-18 07:38:46 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
}
print '</tr>' ;
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS " ) . '</td>' ;
if ( ! empty ( $conf -> global -> ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS )) {
2021-03-09 18:44:06 +01:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setdisablebindingonexpensereports&value=0">' ;
2021-04-13 09:46:50 +02:00
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' , '' , false , 0 , 0 , '' , 'warning' );
2020-08-18 07:38:46 +02:00
print '</a></td>' ;
} else {
2021-03-09 18:44:06 +01:00
print '<td class="right"><a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?token=' . newToken () . '&action=setdisablebindingonexpensereports&value=1">' ;
2020-08-18 07:38:46 +02:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
print '</a></td>' ;
}
print '</tr>' ;
2016-10-15 15:51:28 +02:00
print '</table>' ;
2021-08-24 17:04:17 +02:00
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="' . $langs -> trans ( 'Modify' ) . '"></div>' ;
2015-09-03 11:54:03 +02:00
2014-12-01 12:03:23 +01:00
print '</form>' ;
2015-09-03 11:54:03 +02:00
2018-07-28 14:02:33 +02:00
// End of page
2014-08-27 07:03:42 +02:00
llxFooter ();
2015-05-07 12:20:20 +02:00
$db -> close ();