diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php
index 2f1b22cf778..37f065d1c2e 100644
--- a/htdocs/accountancy/admin/categories_list.php
+++ b/htdocs/accountancy/admin/categories_list.php
@@ -328,6 +328,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
// activate
if ($action == $acts[0]) {
+ $sql = '';
$rowidcol = "rowid";
if ($rowid) {
@@ -346,6 +347,7 @@ if ($action == $acts[0]) {
// disable
if ($action == $acts[1]) {
+ $sql = '';
$rowidcol = "rowid";
if ($rowid) {
@@ -364,6 +366,7 @@ if ($action == $acts[1]) {
// favorite
if ($action == 'activate_favorite') {
+ $sql = '';
$rowidcol = "rowid";
if ($rowid) {
@@ -382,6 +385,7 @@ if ($action == 'activate_favorite') {
// disable favorite
if ($action == 'disable_favorite') {
+ $sql = '';
$rowidcol = "rowid";
if ($rowid) {
diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index 8cb10b061e5..60c52103254 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -52,6 +52,10 @@ $list_account_main = array(
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
);
+if (isModEnabled('expensereport')) {
+ $list_account_main[] = 'ACCOUNTING_ACCOUNT_EXPENSEREPORT';
+}
+
$list_account = array();
$list_account[] = '---Product---';
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index 9e6b39a9b00..d716ad9f3a0 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -221,6 +221,7 @@ if ($result) {
$account_supplier = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); // NotDefined is a reserved word
$account_customer = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); // NotDefined is a reserved word
$account_employee = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); // NotDefined is a reserved word
+ $account_expensereport = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT', 'NotDefined'); // NotDefined is a reserved word
$account_pay_vat = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT', 'NotDefined'); // NotDefined is a reserved word
$account_pay_donation = getDolGlobalString('DONATION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word
$account_pay_subscription = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word
@@ -625,6 +626,9 @@ if (!$error && $action == 'writebookkeeping') {
$accountingaccountpayment = new AccountingAccount($db);
$accountingaccountpayment->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true);
+ $accountingaccountexpensereport = new AccountingAccount($db);
+ $accountingaccountexpensereport->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_EXPENSEREPORT, true);
+
$accountingaccountsuspense = new AccountingAccount($db);
$accountingaccountsuspense->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'), true);
@@ -757,8 +761,8 @@ if (!$error && $action == 'writebookkeeping') {
} elseif ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
- $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
- $bookkeeping->label_compte = $accountingaccountpayment->label;
+ $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT');
+ $bookkeeping->label_compte = $accountingaccountexpensereport->label;
} elseif ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
@@ -1013,7 +1017,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
} elseif ($tabtype[$key] == 'payment') {
print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep;
} elseif ($tabtype[$key] == 'payment_expensereport') {
- print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep;
+ print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT').'"'.$sep;
} elseif ($tabtype[$key] == 'payment_salary') {
print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep;
} else {
@@ -1135,7 +1139,8 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1'
- || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
+ || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1'
+ || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSERERPORT') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSERERPORT') == '-1') {
print($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
$desc = str_replace('{link}', '
'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc);
@@ -1294,7 +1299,7 @@ if (empty($action) || $action == 'view') {
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
}
if ($tabtype[$key] == 'payment_expensereport') {
- $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
+ $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT');
}
if ($tabtype[$key] == 'payment_salary') {
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index 881070ad6fd..077f8f755b1 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -162,7 +162,7 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
- $account_salary = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined');
+ $account_salary = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT', 'NotDefined');
$account_vat = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined');
$i = 0;
@@ -247,7 +247,7 @@ if ($action == 'writebookkeeping' && !$error) {
$error = 0;
$accountingaccountexpense = new AccountingAccount($db);
- $accountingaccountexpense->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true);
+ $accountingaccountexpense->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'), true);
foreach ($taber as $key => $val) { // Loop on each expense report
$errorforline = 0;
@@ -279,7 +279,7 @@ if ($action == 'writebookkeeping' && !$error) {
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
- $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
+ $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT');
$bookkeeping->label_compte = $accountingaccountexpense->label;
$bookkeeping->label_operation = $tabuser[$key]['name'];
@@ -590,7 +590,7 @@ if (empty($action) || $action == 'view') {
}
// Button to write into Ledger
- if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
+ if (!getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') == '-1') {
print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
$desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc);
@@ -602,7 +602,7 @@ if (empty($action) || $action == 'view') {
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
print '';
}
- if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
+ if (!getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') == '-1') {
print '';
} else {
if ($in_bookkeeping == 'notyet') {
@@ -726,7 +726,7 @@ if (empty($action) || $action == 'view') {
print "
".$expensereportstatic->getNomUrl(1)." | ";
// Account
print "";
- $accountoshow = length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
+ $accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'));
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print ''.$langs->trans("MainAccountForUsersNotDefined").'';
} else {
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index d895854ab2c..da9b0271b15 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -13,6 +13,7 @@
* Copyright (C) 2016 Raphaël Doursenaud
* Copyright (C) 2019-2022 Frédéric France
* Copyright (C) 2020-2022 Open-Dsi
+ * Copyright (C) 2024 Charlene Benke
*
* 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
@@ -2130,6 +2131,11 @@ if ($id > 0) {
$canbemodified = 1;
}
+ if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) {
+ $canbedisabled = 0;
+ $canbemodified = 0;
+ $iserasable = 0;
+ }
// Build Url. The table is id=, the id of line is rowid=
$rowidcol = empty($tabrowid[$id]) ? 'rowid' : $tabrowid[$id];
// If rowidcol not defined
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index cee9b17d6c0..d8b67a715cd 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -178,6 +178,7 @@ ACCOUNTING_SELL_JOURNAL=Sales journal - sales and returns
ACCOUNTING_PURCHASE_JOURNAL=Purchase journal - purchase and returns
ACCOUNTING_BANK_JOURNAL=Cash journal - receipts and disbursements
ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal
+ACCOUNTING_ACCOUNT_EXPENSEREPORT=Default accounting account for "expense reports"
ACCOUNTING_MISCELLANEOUS_JOURNAL=General journal
ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal
ACCOUNTING_INVENTORY_JOURNAL=Inventory journal
|