32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38 $langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy",
"other"));
41 if (empty($user->rights->accounting->chartofaccount)) {
45 $action =
GETPOST(
'action',
'aZ09');
49 'ACCOUNTING_LENGTH_GACCOUNT',
50 'ACCOUNTING_LENGTH_AACCOUNT',
56 $list_binding = array(
57 'ACCOUNTING_DATE_START_BINDING',
58 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
68 if (in_array($action, array(
69 'setBANK_DISABLE_DIRECT_INPUT',
70 'setACCOUNTANCY_COMBO_FOR_AUX',
71 'setACCOUNTING_MANAGE_ZERO',
72 'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
73 'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
74 $constname = preg_replace(
'/^set/',
'', $action);
75 $constvalue =
GETPOST(
'value',
'int');
76 $res =
dolibarr_set_const($db, $constname, $constvalue,
'yesno', 0,
'', $conf->entity);
88 if ($action ==
'update') {
92 foreach ($list as $constname) {
93 $constvalue =
GETPOST($constname,
'alpha');
94 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
102 foreach ($list_binding as $constname) {
103 $constvalue =
GETPOST($constname,
'alpha');
105 if ($constname ==
'ACCOUNTING_DATE_START_BINDING') {
109 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
123 if ($action ==
'setlistsorttodo') {
124 $setlistsorttodo =
GETPOST(
'value',
'int');
125 $res =
dolibarr_set_const($db,
"ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo,
'yesno', 0,
'', $conf->entity);
137 if ($action ==
'setlistsortdone') {
138 $setlistsortdone =
GETPOST(
'value',
'int');
139 $res =
dolibarr_set_const($db,
"ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone,
'yesno', 0,
'', $conf->entity);
151 if ($action ==
'setmanagezero') {
152 $setmanagezero =
GETPOST(
'value',
'int');
153 $res =
dolibarr_set_const($db,
"ACCOUNTING_MANAGE_ZERO", $setmanagezero,
'yesno', 0,
'', $conf->entity);
165 if ($action ==
'setdisabledirectinput') {
166 $setdisabledirectinput =
GETPOST(
'value',
'int');
167 $res =
dolibarr_set_const($db,
"BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput,
'yesno', 0,
'', $conf->entity);
179 if ($action ==
'setenabledraftexport') {
180 $setenabledraftexport =
GETPOST(
'value',
'int');
181 $res =
dolibarr_set_const($db,
"ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport,
'yesno', 0,
'', $conf->entity);
193 if ($action ==
'setenablesubsidiarylist') {
194 $setenablesubsidiarylist =
GETPOST(
'value',
'int');
195 $res =
dolibarr_set_const($db,
"ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist,
'yesno', 0,
'', $conf->entity);
207 if ($action ==
'setdisablebindingonsales') {
208 $setdisablebindingonsales =
GETPOST(
'value',
'int');
209 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales,
'yesno', 0,
'', $conf->entity);
221 if ($action ==
'setdisablebindingonpurchases') {
222 $setdisablebindingonpurchases =
GETPOST(
'value',
'int');
223 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases,
'yesno', 0,
'', $conf->entity);
235 if ($action ==
'setdisablebindingonexpensereports') {
236 $setdisablebindingonexpensereports =
GETPOST(
'value',
'int');
237 $res =
dolibarr_set_const($db,
"ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports,
'yesno', 0,
'', $conf->entity);
256 $title = $langs->trans(
'ConfigAccountingExpert');
265 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
266 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") .
'</div>';
268 if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
269 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") .
'</div>';
271 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
272 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"MAIN_COMPANY_PERENTITY_SHARED") .
'</div>';
274 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
275 print
'<div class="info">' . $langs->trans(
"ConstantIsOn",
"MAIN_PRODUCT_PERENTITY_SHARED") .
'</div>';
279 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
280 print
'<input type="hidden" name="token" value="'.newToken().
'">';
281 print
'<input type="hidden" name="action" value="update">';
284 print
'<table class="noborder centpercent">';
285 print
'<tr class="liste_titre">';
286 print
'<td colspan="2">'.$langs->trans(
'Options').
'</td>';
306 print
'<tr class="oddeven">';
307 print
'<td>'.$langs->trans(
"BANK_DISABLE_DIRECT_INPUT").
'</td>';
308 if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
309 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setBANK_DISABLE_DIRECT_INPUT&value=0">';
310 print
img_picto($langs->trans(
"Activated"),
'switch_on');
313 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
314 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
319 print
'<tr class="oddeven">';
320 print
'<td>'.$langs->trans(
"ACCOUNTANCY_COMBO_FOR_AUX");
321 print
' - <span class="opacitymedium">'.$langs->trans(
"NotRecommended").
'</span>';
324 if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
325 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
326 print
img_picto($langs->trans(
"Activated"),
'switch_on');
329 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
330 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
335 print
'<tr class="oddeven">';
336 print
'<td>'.$langs->trans(
"ACCOUNTING_MANAGE_ZERO").
'</td>';
337 if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
338 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_MANAGE_ZERO&value=0">';
339 print
img_picto($langs->trans(
"Activated"),
'switch_on');
342 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_MANAGE_ZERO&value=1">';
343 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
349 foreach ($list as $key) {
350 print
'<tr class="oddeven value">';
352 if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key ==
'ACCOUNTING_LENGTH_GACCOUNT' || $key ==
'ACCOUNTING_LENGTH_AACCOUNT')) {
357 $label = $langs->trans($key);
358 print
'<td>'.$label.
'</td>';
360 print
'<td class="right">';
361 print
'<input type="text" class="maxwidth50 right" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
370 print
'<table class="noborder centpercent">';
371 print
'<tr class="liste_titre">';
372 print
'<td colspan="2">'.$langs->trans(
'BindingOptions').
'</td>';
376 print
'<tr class="oddeven">';
377 print
'<td>'.$langs->trans(
"ACCOUNTING_LIST_SORT_VENTILATION_TODO").
'</td>';
378 if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
379 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
380 print
img_picto($langs->trans(
"Activated"),
'switch_on');
383 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
384 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
389 print
'<tr class="oddeven">';
390 print
'<td>'.$langs->trans(
"ACCOUNTING_LIST_SORT_VENTILATION_DONE").
'</td>';
391 if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
392 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">';
393 print
img_picto($langs->trans(
"Activated"),
'switch_on');
396 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
397 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
403 foreach ($list_binding as $key) {
404 print
'<tr class="oddeven value">';
407 $label = $langs->trans($key);
408 print
'<td>'.$label.
'</td>';
410 print
'<td class="right">';
411 if ($key ==
'ACCOUNTING_DATE_START_BINDING') {
412 print
$form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
413 } elseif ($key ==
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
414 $array = array(0=>$langs->trans(
"PreviousMonth"), 1=>$langs->trans(
"CurrentMonth"), 2=>$langs->trans(
"Fiscalyear"));
415 print
$form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0));
417 print
'<input type="text" class="maxwidth100" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
424 print
'<tr class="oddeven">';
425 print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_SALES").
'</td>';
426 if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
427 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonsales&value=0">';
428 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
431 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonsales&value=1">';
432 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
437 print
'<tr class="oddeven">';
438 print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").
'</td>';
439 if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
440 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonpurchases&value=0">';
441 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
444 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonpurchases&value=1">';
445 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
450 print
'<tr class="oddeven">';
451 print
'<td>'.$langs->trans(
"ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").
'</td>';
452 if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
453 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonexpensereports&value=0">';
454 print
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'warning');
457 print
'<td class="right"><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?token='.
newToken().
'&action=setdisablebindingonexpensereports&value=1">';
458 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
465 print
'<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans(
'Modify').
'"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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).
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
newToken()
Return the value of token currently saved into session with name 'newtoken'.