diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 3bcea99dc39..c45419daabf 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -140,6 +140,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
$arrayfields = array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
+ 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
@@ -148,7 +149,6 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
- 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
@@ -642,7 +642,7 @@ if (empty($reshook)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
- $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$url = './card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid;
@@ -665,11 +665,17 @@ print '
';
// Filters lines
print '';
+
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print ' | ';
}
+// Code journal
+if (!empty($arrayfields['t.code_journal']['checked']))
+{
+ print ' | ';
+}
// Date document
if (!empty($arrayfields['t.doc_date']['checked']))
{
@@ -758,11 +764,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '
'.$langs->trans("NotReconciled").'';
print '';
}
-// Code journal
-if (!empty($arrayfields['t.code_journal']['checked']))
-{
- print ' | ';
-}
+
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -814,6 +816,7 @@ print "
\n";
print '';
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
+if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
@@ -822,7 +825,6 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
-if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -888,6 +890,16 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
+ // Journal code
+ if (!empty($arrayfields['t.code_journal']['checked']))
+ {
+ $accountingjournal = new AccountingJournal($db);
+ $result = $accountingjournal->fetch('', $line->code_journal);
+ $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
+ print '| '.$journaltoshow.' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+
// Document date
if (!empty($arrayfields['t.doc_date']['checked']))
{
@@ -1006,16 +1018,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
- // Journal code
- if (!empty($arrayfields['t.code_journal']['checked']))
- {
- $accountingjournal = new AccountingJournal($db);
- $result = $accountingjournal->fetch('', $line->code_journal);
- $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
- print ''.$journaltoshow.' | ';
- if (!$i) $totalarray['nbfield']++;
- }
-
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 6bab55f0f52..55e57b4463f 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -128,8 +128,8 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
- 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
+ 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@@ -426,7 +426,7 @@ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $obj
if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
- $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
@@ -471,6 +471,11 @@ print '';
// Filters lines
print '';
+// Movement number
+if (!empty($arrayfields['t.piece_num']['checked']))
+{
+ print ' | ';
+}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print ' | ';
@@ -486,11 +491,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '';
print '';
}
-// Movement number
-if (!empty($arrayfields['t.piece_num']['checked']))
-{
- print ' | ';
-}
// Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print ' | ';
@@ -540,9 +540,9 @@ print '';
print "
\n";
print '';
+if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
-if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
@@ -633,6 +633,17 @@ while ($i < min($num, $limit))
print '
';
+ // Piece number
+ if (!empty($arrayfields['t.piece_num']['checked']))
+ {
+ print '| ';
+ $object->id = $line->id;
+ $object->piece_num = $line->piece_num;
+ print $object->getNomUrl(1, '', 0, '', 1);
+ print ' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
@@ -650,17 +661,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
- // Piece number
- if (!empty($arrayfields['t.piece_num']['checked']))
- {
- print '';
- $object->id = $line->id;
- $object->piece_num = $line->piece_num;
- print $object->getNomUrl(1, '', 0, '', 1);
- print ' | ';
- if (!$i) $totalarray['nbfield']++;
- }
-
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php
index f010e9efbcf..be7eacfe8c6 100644
--- a/htdocs/accountancy/bookkeeping/listbysubaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php
@@ -128,8 +128,8 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
- 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
+ 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@@ -427,8 +427,8 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
- $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly'));
- $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
+ $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
@@ -475,6 +475,11 @@ print '';
// Filters lines
print '';
+// Movement number
+if (!empty($arrayfields['t.piece_num']['checked']))
+{
+ print ' | ';
+}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print ' | ';
@@ -490,11 +495,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '';
print '';
}
-// Movement number
-if (!empty($arrayfields['t.piece_num']['checked']))
-{
- print ' | ';
-}
// Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print ' | ';
@@ -544,9 +544,9 @@ print '';
print "
\n";
print '';
+if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
-if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
@@ -627,8 +627,12 @@ while ($i < min($num, $limit))
} else {
// Should not happen: subledger account must be null or a non empty value
print ''.$langs->trans("Unknown");
- if ($line->subledger_label) print ' ('.$line->subledger_label.')';
- $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
+ if ($line->subledger_label) {
+ print ' ('.$line->subledger_label.')';
+ $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
+ } else {
+ $htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
+ }
print $form->textwithpicto('', $htmltext);
print '';
}
@@ -645,6 +649,17 @@ while ($i < min($num, $limit))
print '
';
+ // Piece number
+ if (!empty($arrayfields['t.piece_num']['checked']))
+ {
+ print '| ';
+ $object->id = $line->id;
+ $object->piece_num = $line->piece_num;
+ print $object->getNomUrl(1, '', 0, '', 1);
+ print ' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
@@ -662,17 +677,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
- // Piece number
- if (!empty($arrayfields['t.piece_num']['checked']))
- {
- print '';
- $object->id = $line->id;
- $object->piece_num = $line->piece_num;
- print $object->getNomUrl(1, '', 0, '', 1);
- print ' | ';
- if (!$i) $totalarray['nbfield']++;
- }
-
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 8261a5f4173..1871f517f02 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -831,7 +831,11 @@ class BookKeeping extends CommonObject
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) {
- $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
+ if (is_array($value)) {
+ $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
+ } else {
+ $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
+ }
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}