Uniformize code
This commit is contained in:
parent
9c3c9bde37
commit
3516e30e5c
@ -48,10 +48,12 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
|
||||
|
||||
$req_nb=GETPOST("req_nb",'',3);
|
||||
$thirdarty=GETPOST("thirdparty",'',3);
|
||||
$account=GETPOST("account");
|
||||
$vline=GETPOST("vline");
|
||||
$action=GETPOST("action");
|
||||
|
||||
$account=isset($_GET["account"])?$_GET["account"]:$_POST["account"];
|
||||
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
|
||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||
$page=isset($_GET["page"])?$_GET["page"]:0;
|
||||
$negpage=isset($_GET["negpage"])?$_GET["negpage"]:0;
|
||||
if ($negpage)
|
||||
@ -184,10 +186,10 @@ if ($account || $_GET["ref"])
|
||||
$param='';
|
||||
$sql_rech='';
|
||||
$mode_search = 0;
|
||||
if ($_REQUEST["req_nb"])
|
||||
if ($req_nb)
|
||||
{
|
||||
$sql_rech.= " AND b.num_chq like '%".$db->escape($_REQUEST["req_nb"])."%'";
|
||||
$param.='&req_nb='.urlencode($_REQUEST["req_nb"]);
|
||||
$sql_rech.= " AND b.num_chq like '%".$db->escape($req_nb)."%'";
|
||||
$param.='&req_nb='.urlencode($req_nb);
|
||||
$mode_search = 1;
|
||||
}
|
||||
if ($_REQUEST["req_desc"])
|
||||
@ -208,10 +210,10 @@ if ($account || $_GET["ref"])
|
||||
$param.='&req_credit='.urlencode($_REQUEST["req_credit"]);
|
||||
$mode_search = 1;
|
||||
}
|
||||
if ($_REQUEST["thirdparty"])
|
||||
if ($thirdparty)
|
||||
{
|
||||
$sql_rech.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape($_REQUEST["thirdparty"])."%')";
|
||||
$param.='&thirdparty='.urlencode($_REQUEST["thirdparty"]);
|
||||
$sql_rech.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape($thirdparty)."%')";
|
||||
$param.='&thirdparty='.urlencode($thirdparty);
|
||||
$mode_search = 1;
|
||||
}
|
||||
if ($_REQUEST["paiementtype"])
|
||||
@ -311,11 +313,11 @@ if ($account || $_GET["ref"])
|
||||
}
|
||||
$navig.= $langs->trans("Page")." "; // ' Page ';
|
||||
$navig.='<input type="text" name="negpage" size="1" class="flat" value="'.($nbpage-$page).'">';
|
||||
$navig.='<input type="hidden" name="req_nb" value="'.$_REQUEST["req_nb"].'">';
|
||||
$navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">';
|
||||
$navig.='<input type="hidden" name="req_desc" value="'.$_REQUEST["req_desc"].'">';
|
||||
$navig.='<input type="hidden" name="req_debit" value="'.$_REQUEST["req_debit"].'">';
|
||||
$navig.='<input type="hidden" name="req_credit" value="'.$_REQUEST["req_credit"].'">';
|
||||
$navig.='<input type="hidden" name="thirdparty" value="'.$_REQUEST["thirdparty"].'">';
|
||||
$navig.='<input type="hidden" name="thirdparty" value="'.$thirdparty.'">';
|
||||
$navig.='<input type="hidden" name="nbpage" value="'.$nbpage.'">';
|
||||
$navig.='<input type="hidden" name="account" value="'.($acct->id).'">';
|
||||
$navig.='/'.$nbpage.' ';
|
||||
@ -421,15 +423,16 @@ if ($account || $_GET["ref"])
|
||||
print '<input type="hidden" name="account" value="' . $acct->id . '">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
//$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...)
|
||||
$filtertype='';
|
||||
print $html->select_types_paiements($_REQUEST['paiementtype'],'paiementtype',$filtertype,2,1,1,8);
|
||||
print '</td>';
|
||||
print '<td><input type="text" class="flat" name="req_nb" value="'.$_REQUEST["req_nb"].'" size="2"></td>';
|
||||
print '<td><input type="text" class="flat" name="req_nb" value="'.$req_nb.'" size="2"></td>';
|
||||
print '<td><input type="text" class="flat" name="req_desc" value="'.$_REQUEST["req_desc"].'" size="24"></td>';
|
||||
print '<td><input type="text" class="flat" name="thirdparty" value="'.$_REQUEST["thirdparty"].'" size="14"></td>';
|
||||
print '<td><input type="text" class="flat" name="thirdparty" value="'.$thirdparty.'" size="14"></td>';
|
||||
print '<td align="right"><input type="text" class="flat" name="req_debit" value="'.$_REQUEST["req_debit"].'" size="4"></td>';
|
||||
print '<td align="right"><input type="text" class="flat" name="req_credit" value="'.$_REQUEST["req_credit"].'" size="4"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
@ -533,6 +536,8 @@ if ($account || $_GET["ref"])
|
||||
if ($objp->fk_type == 'SOLD') $label=' ';
|
||||
print $label;
|
||||
print "</td>\n";
|
||||
|
||||
// Num
|
||||
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
|
||||
// Description
|
||||
|
||||
@ -75,7 +75,7 @@ $html = new Form($db);
|
||||
if ($vline) $viewline = $vline;
|
||||
else $viewline = 50;
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
|
||||
$sql.= " b.fk_account, b.fk_type,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||
$sql.= " bu.label as labelurl, bu.url_id";
|
||||
@ -84,8 +84,19 @@ if (! empty($_REQUEST["bid"])) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
if (GETPOST("req_nb"))
|
||||
{
|
||||
$sql.= " AND b.num_chq like '%".$db->escape(GETPOST("req_nb"))."%'";
|
||||
$param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
}
|
||||
if (GETPOST("thirdparty"))
|
||||
{
|
||||
$sql.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape(GETPOST("thirdparty"))."%')";
|
||||
$param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
}
|
||||
if (! empty($_REQUEST["bid"]))
|
||||
{
|
||||
$sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$_REQUEST["bid"];
|
||||
@ -141,32 +152,36 @@ if ($resql)
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("Numero").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("Description").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="liste_titre" align="left">'.$langs->trans("Account").'</td>';
|
||||
print '<td class="liste_titre" align="left"> '.$langs->trans("Account").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form method="post" action="search.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="description" size="28" value="'.$description.'">';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$html->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="description" size="24" value="'.$description.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.GETPOST("thirdparty").'" size="14"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="text" class="flat" name="debit" size="6" value="'.$debit.'">';
|
||||
print '<input type="text" class="flat" name="debit" size="4" value="'.$debit.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="text" class="flat" name="credit" size="6" value="'.$credit.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$html->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8);
|
||||
print '<input type="text" class="flat" name="credit" size="4" value="'.$credit.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
@ -189,83 +204,25 @@ if ($resql)
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid."</a> ";
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="left" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")." </td>\n";
|
||||
// Date ope
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
||||
|
||||
// Description
|
||||
// Date value
|
||||
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
|
||||
|
||||
// Payment type
|
||||
print "<td align=\"center\">";
|
||||
$labeltype=$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||
else print $labeltype;
|
||||
print "</td>\n";
|
||||
|
||||
// Num
|
||||
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
|
||||
// Description
|
||||
print "<td>";
|
||||
|
||||
/* This bloc is same than in page compta/bank/account.php
|
||||
|
||||
// Show generic description
|
||||
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
||||
{
|
||||
// Generic description because between (). We show it after translating.
|
||||
print $langs->trans($reg[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_trunc($objp->label,60);
|
||||
}
|
||||
// Add links after description
|
||||
$links = $acct->get_url($objp->rowid);
|
||||
foreach($links as $key=>$val)
|
||||
{
|
||||
if ($links[$key]['type']=='payment') {
|
||||
$paymentstatic->id=$links[$key]['url_id'];
|
||||
print ' '.$paymentstatic->getNomUrl(2);
|
||||
}
|
||||
else if ($links[$key]['type']=='payment_supplier') {
|
||||
$paymentsupplierstatic->id=$links[$key]['url_id'];
|
||||
$paymentsupplierstatic->ref=$links[$key]['url_id'];
|
||||
print ' '.$paymentsupplierstatic->getNomUrl(2);
|
||||
}
|
||||
else if ($links[$key]['type']=='company') {
|
||||
}
|
||||
else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc
|
||||
$chargestatic->id=$links[$key]['url_id'];
|
||||
$chargestatic->ref=$links[$key]['url_id'];
|
||||
$chargestatic->lib=$langs->trans("SocialContribution");
|
||||
print ' '.$chargestatic->getNomUrl(2);
|
||||
}
|
||||
else if ($links[$key]['type']=='payment_sc')
|
||||
{
|
||||
//print ' - ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
|
||||
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
||||
//print $langs->trans("SocialContributionPayment");
|
||||
print '</a>';
|
||||
|
||||
}
|
||||
else if ($links[$key]['type']=='payment_vat')
|
||||
{
|
||||
$paymentvatstatic->id=$links[$key]['url_id'];
|
||||
$paymentvatstatic->ref=$links[$key]['url_id'];
|
||||
print ' '.$paymentvatstatic->getNomUrl(2);
|
||||
}
|
||||
else if ($links[$key]['type']=='banktransfert') {
|
||||
// Do not show this link (avoid confusion). Can already be accessed from transaction detail
|
||||
}
|
||||
else if ($links[$key]['type']=='member') {
|
||||
}
|
||||
else {
|
||||
//print ' - ';
|
||||
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
|
||||
{
|
||||
// Label generique car entre parentheses. On l'affiche en le traduisant
|
||||
if ($reg[1]=='paiement') $reg[1]='Payment';
|
||||
print $langs->trans($reg[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $links[$key]['label'];
|
||||
}
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid."&account=".$objp->fk_account."\">";
|
||||
$reg=array();
|
||||
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
|
||||
@ -299,13 +256,6 @@ if ($resql)
|
||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
||||
}
|
||||
|
||||
// Payment type
|
||||
print "<td align=\"center\">";
|
||||
$labeltype=$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
|
||||
if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance");
|
||||
else print $labeltype;
|
||||
print "</td>\n";
|
||||
|
||||
// Bank account
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
$bankaccountstatic->id=$objp->bankid;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user