diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 319ac308802..b936711d604 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -132,7 +132,7 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
$param = '';
-$parameters = array('socid'=>$socid);
+$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -358,7 +358,7 @@ if ($action != 'export_csv') {
$moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
$moreforfilter .= '';
- $moreforfilter .= '';
+ //$moreforfilter .= '
';
$moreforfilter .= '
';
// Accountancy account
$moreforfilter .= $langs->trans('AccountAccounting').': ';
@@ -409,7 +409,7 @@ if ($action != 'export_csv') {
print '';
// Fields from hook
- $parameters = array('arrayfields'=>$arrayfields);
+ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@@ -439,7 +439,7 @@ if ($action != 'export_csv') {
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
// Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -668,7 +668,7 @@ if ($action != 'export_csv') {
}
print '';
- $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index b687310193a..adb296924af 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1153,7 +1153,7 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
- * @param int $option option (0: general account or 1: subaccount)
+ * @param int $option option (0: aggregate by general account or 1: aggreegate by subaccount)
* @return int <0 if KO, >0 if OK
*/
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
@@ -1209,9 +1209,9 @@ class BookKeeping extends CommonObject
}
if (!empty($option)) {
- $sql .= ' AND t.subledger_account IS NOT NULL';
- $sql .= ' AND t.subledger_account != ""';
- $sql .= ' GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label';
+ $sql .= " AND t.subledger_account IS NOT NULL";
+ $sql .= " AND t.subledger_account <> ''";
+ $sql .= " GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label";
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else {
@@ -1237,8 +1237,10 @@ class BookKeeping extends CommonObject
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
- $line->subledger_account = $obj->subledger_account;
- $line->subledger_label = $obj->subledger_label;
+ if (!empty($option)) {
+ $line->subledger_account = $obj->subledger_account;
+ $line->subledger_label = $obj->subledger_label;
+ }
$line->debit = $obj->debit;
$line->credit = $obj->credit;