diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php
index a70316737f9..239677a0368 100644
--- a/htdocs/accountancy/admin/categories.php
+++ b/htdocs/accountancy/admin/categories.php
@@ -20,9 +20,8 @@
* \ingroup Advanced accountancy
* \brief Page to assign mass categories to accounts
*/
-require '../../main.inc.php';
-// Class
+require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
@@ -104,7 +103,7 @@ print '
';
print '| ' . $langs->trans("AccountingCategory") . ' | ';
print '';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
-print '';
+print '';
print ' |
';
if (! empty($cat_id)) {
@@ -115,11 +114,11 @@ if (! empty($cat_id)) {
print '| ' . $langs->trans("AddCompteFromBK") . ' | ';
print '';
if (is_array($AccCat->lines_cptbk) && count($AccCat->lines_cptbk) > 0) {
- print ' ';
}
print ' |
';
}
diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php
index 40290bd845b..ec3131dda8b 100644
--- a/htdocs/accountancy/class/accountancycategory.class.php
+++ b/htdocs/accountancy/class/accountancycategory.class.php
@@ -150,23 +150,27 @@ class AccountancyCategory
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
+ $this->db->begin();
+
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
+ $this->db->rollback();
return -1;
}
- $this->db->begin();
- while ( $obj = $this->db->fetch_object($resql)) {
- if (array_key_exists(length_accountg($obj->account_number), $cpts)) {
+ while ( $obj = $this->db->fetch_object($resql))
+ {
+ if (array_key_exists(length_accountg($obj->account_number), $cpts))
+ {
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
$sql .= " SET fk_accounting_category=" . $id_cat;
$sql .= " WHERE rowid=".$obj->rowid;
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $this->db->query($sql);
- if (! $resql) {
+ $resqlupdate = $this->db->query($sql);
+ if (! $resqlupdate) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php
index 63e7018b522..8c7f6903bb3 100644
--- a/htdocs/core/class/html.formaccounting.class.php
+++ b/htdocs/core/class/html.formaccounting.class.php
@@ -90,7 +90,7 @@ class FormAccounting
$num = $db->num_rows($resql);
if ($num)
{
- print '';
+ print '';
$i = 0;
if ($useempty) print '';
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index ab33509ebd6..d9a09d748d1 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -943,7 +943,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 10);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20);
- if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 22);
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 22);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40);
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
{
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 12776ab6347..1b1032804f6 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -26,6 +26,8 @@ InvoiceLabel=Invoice label
OverviewOfAmountOfLinesNotBound=Overview of amount of lines not bound to accounting account
OverviewOfAmountOfLinesBound=Overview of amount of lines already bound to accounting account
OtherInfo=Other information
+DeleteCptCategory=Remove accounting account from group
+ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group ?
AccountancyArea=Accountancy area
AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: