FIX : colspan in bank entries

This commit is contained in:
Alexandre SPANGARO 2017-05-27 07:11:17 +02:00
parent e5fe629a0e
commit 1711107420

View File

@ -3,8 +3,8 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com> * Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* *
@ -195,7 +195,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_num_releve=''; $search_num_releve='';
$search_conciliated=''; $search_conciliated='';
$thirdparty=''; $thirdparty='';
$account=""; $account="";
if ($id > 0 || ! empty($ref)) $account=$object->id; if ($id > 0 || ! empty($ref)) $account=$object->id;
} }
@ -436,7 +436,6 @@ if ($id > 0 || ! empty($ref))
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }
} }
print '</div>'; print '</div>';
} }
} }
@ -548,9 +547,9 @@ if ($resql)
{ {
$var=True; $var=True;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
@ -559,16 +558,14 @@ if ($resql)
//if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); //if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
// Confirmation delete // Confirmation delete
if ($action == 'delete') if ($action == 'delete')
{ {
$text=$langs->trans('ConfirmDeleteTransaction'); $text=$langs->trans('ConfirmDeleteTransaction');
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
} }
// Lines of title fields // Lines of title fields
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n"; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -582,7 +579,7 @@ if ($resql)
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="ref" value="'.$ref.'">'; print '<input type="hidden" name="ref" value="'.$ref.'">';
if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">'; if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
// Form to reconcile // Form to reconcile
if ($user->rights->banque->consolidate && $action == 'reconcile') if ($user->rights->banque->consolidate && $action == 'reconcile')
{ {
@ -657,11 +654,10 @@ if ($resql)
}); });
}); });
</script> </script>
';
';
$i = 0; $i = 0;
// Title // Title
$bankcateg=new BankCateg($db); $bankcateg=new BankCateg($db);
$morehtml='<div data-role="fieldcontain">'; $morehtml='<div data-role="fieldcontain">';
@ -669,7 +665,7 @@ if ($resql)
$morehtml.='<input type="text" name="pageplusone" id="pageplusone" size="1" class="flat" value="'.($page+1).'">'; $morehtml.='<input type="text" name="pageplusone" id="pageplusone" size="1" class="flat" value="'.($page+1).'">';
$morehtml.='/'.$nbtotalofpages.' '; $morehtml.='/'.$nbtotalofpages.' ';
$morehtml.='</div>'; $morehtml.='</div>';
$picto='title_bank'; $picto='title_bank';
if ($id > 0 || ! empty($ref)) $picto=''; if ($id > 0 || ! empty($ref)) $picto='';
if (GETPOST("bid")) if (GETPOST("bid"))
@ -681,13 +677,12 @@ if ($resql)
{ {
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit); print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
} }
// We can add page now to param // We can add page now to param
if ($page != '') $param.='&page='.urlencode($page); if ($page != '') $param.='&page='.urlencode($page);
$moreforfilter = ''; $moreforfilter = '';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateOperationShort').' : '; $moreforfilter .= $langs->trans('DateOperationShort').' : ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' '; $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
@ -695,7 +690,7 @@ if ($resql)
//$moreforfilter .= ' - '; //$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>'; $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateValueShort').' : '; $moreforfilter .= $langs->trans('DateValueShort').' : ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' '; $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
@ -703,7 +698,7 @@ if ($resql)
//$moreforfilter .= ' - '; //$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>'; $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
@ -715,10 +710,10 @@ if ($resql)
print $moreforfilter; print $moreforfilter;
print '</div>'."\n"; print '</div>'."\n";
} }
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -803,7 +798,6 @@ if ($resql)
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
// Fields title // Fields title
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
@ -838,14 +832,13 @@ if ($resql)
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$balance = 0; // For balance $balance = 0; // For balance
$balancecalculated = false; $balancecalculated = false;
// Loop on each record // Loop on each record
$sign = 1; $sign = 1;
$totalarray=array(); $totalarray=array();
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
@ -885,9 +878,9 @@ if ($resql)
$balancecalculated=true; $balancecalculated=true;
} }
$balance = price2num($balance + ($sign * $objp->amount),'MT'); $balance = price2num($balance + ($sign * $objp->amount),'MT');
if (empty($cachebankaccount[$objp->bankid])) if (empty($cachebankaccount[$objp->bankid]))
{ {
$bankaccounttmp = new Account($db); $bankaccounttmp = new Account($db);
@ -899,8 +892,6 @@ if ($resql)
{ {
$bankaccount = $cachebankaccount[$objp->bankid]; $bankaccount = $cachebankaccount[$objp->bankid];
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -1012,19 +1003,19 @@ if ($resql)
} }
elseif ($links[$key]['type']=='company') elseif ($links[$key]['type']=='company')
{ {
} }
elseif ($links[$key]['type']=='user') elseif ($links[$key]['type']=='user')
{ {
} }
elseif ($links[$key]['type']=='member') elseif ($links[$key]['type']=='member')
{ {
} }
elseif ($links[$key]['type']=='sc') elseif ($links[$key]['type']=='sc')
{ {
} }
else else
{ {
@ -1044,11 +1035,10 @@ if ($resql)
print '</a>'; print '</a>';
} }
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date ope // Date ope
if (! empty($arrayfields['b.dateo']['checked'])) if (! empty($arrayfields['b.dateo']['checked']))
{ {
@ -1089,7 +1079,7 @@ if ($resql)
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n"; print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Third party // Third party
if (! empty($arrayfields['bu.label']['checked'])) if (! empty($arrayfields['bu.label']['checked']))
{ {
@ -1114,7 +1104,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Bank account // Bank account
if (! empty($arrayfields['ba.ref']['checked'])) if (! empty($arrayfields['ba.ref']['checked']))
{ {
@ -1123,7 +1113,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Debit // Debit
if (! empty($arrayfields['b.debit']['checked'])) if (! empty($arrayfields['b.debit']['checked']))
{ {
@ -1137,6 +1127,7 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield']; if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
} }
// Credit // Credit
if (! empty($arrayfields['b.credit']['checked'])) if (! empty($arrayfields['b.credit']['checked']))
{ {
@ -1150,7 +1141,7 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
} }
// Balance // Balance
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
@ -1169,8 +1160,9 @@ if ($resql)
{ {
print '<td align="right">-</td>'; print '<td align="right">-</td>';
} }
if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['b.num_releve']['checked'])) if (! empty($arrayfields['b.num_releve']['checked']))
{ {
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
@ -1197,7 +1189,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Action edit/delete // Action edit/delete
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
// Transaction reconciliated or edit link // Transaction reconciliated or edit link
@ -1254,7 +1246,7 @@ if ($resql)
$i++; $i++;
} }
// Show total line // Show total line
if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield'])) if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield']))
{ {
@ -1277,7 +1269,7 @@ if ($resql)
print "</table>"; print "</table>";
print "</div>"; print "</div>";
print '</form>'; print '</form>';
$db->free($resql); $db->free($resql);
} }