diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 01787ca3372..c684e041660 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -46,14 +46,14 @@ $confirm=GETPOST('confirm', 'alpha'); // Security check $fieldname = (! empty($ref)?'ref':'rowid'); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); +$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','fk_user_author',$fieldname); $sortfield=GETPOST('sortfield', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha'); $page=GETPOST('page', 'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="b.dateo,b.rowid"; -if ($page < 0) { $page = 0 ; } +if (empty($page) || $page == -1) { $page = 0; } $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; @@ -490,53 +490,55 @@ if ($action == 'new') if (count($lines[$bid])) { - foreach ($lines[$bid] as $lid => $value) - { - $account_id = $bid; - if (! isset($accounts[$bid])) - $accounts[$bid]=0; - $accounts[$bid] += 1; + foreach ($lines[$bid] as $lid => $value) + { + //$account_id = $bid; FIXME not used - print ''; - print ''.dol_print_date($value["date"],'day').''; - print ''.$value["numero"]."\n"; - print ''.$value["emetteur"]."\n"; - print ''.$value["banque"]."\n"; - print ''.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).''; + // FIXME $accounts[$bid] is a label ! + /*if (! isset($accounts[$bid])) + $accounts[$bid]=0; + $accounts[$bid] += 1;*/ - // Link to payment - print ''; - $paymentstatic->id=$value["paymentid"]; - $paymentstatic->ref=$value["paymentid"]; - if ($paymentstatic->id) - { - print $paymentstatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; - // Link to bank transaction - print ''; - $accountlinestatic->rowid=$value["id"]; - if ($accountlinestatic->rowid) - { - print $accountlinestatic->getNomUrl(1); - } - else - { - print ' '; - } - print ''; + print ''; + print ''.dol_print_date($value["date"],'day').''; + print ''.$value["numero"]."\n"; + print ''.$value["emetteur"]."\n"; + print ''.$value["banque"]."\n"; + print ''.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).''; - print ''; - print ''; - print '' ; - print ''; + // Link to payment + print ''; + $paymentstatic->id=$value["paymentid"]; + $paymentstatic->ref=$value["paymentid"]; + if ($paymentstatic->id) + { + print $paymentstatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; + // Link to bank transaction + print ''; + $accountlinestatic->rowid=$value["id"]; + if ($accountlinestatic->rowid) + { + print $accountlinestatic->getNomUrl(1); + } + else + { + print ' '; + } + print ''; - $i++; - } + print ''; + print ''; + print '' ; + print ''; + + $i++; + } } print ""; print ''; @@ -688,10 +690,12 @@ else { while ($objp = $db->fetch_object($resql)) { - $account_id = $objp->bid; - if (! isset($accounts[$objp->bid])) + //$account_id = $objp->bid; FIXME not used + + // FIXME $accounts[$objp->bid] is a label + /*if (! isset($accounts[$objp->bid])) $accounts[$objp->bid]=0; - $accounts[$objp->bid] += 1; + $accounts[$objp->bid] += 1;*/ print ''; print ''.$i.'';