From 95fa183fac33b7ea8432ae213534b70502e50702 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Dec 2017 08:49:03 +0100 Subject: [PATCH 1/4] Fix: Avoid warning "A non-numeric value encountered" --- htdocs/compta/paiement/cheque/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 01787ca3372..a9810396e0c 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -53,7 +53,7 @@ $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 ; From 8e1a9064cb053eebf4db0bacbc47d742c986f62f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Dec 2017 09:00:05 +0100 Subject: [PATCH 2/4] Fix: avoid warning again --- htdocs/compta/paiement/cheque/card.php | 87 +++++++++++++------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index a9810396e0c..7029bd6ec72 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -490,53 +490,54 @@ 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; + if (! isset($accounts[$bid]) || $accounts[$bid] == '') { + $accounts[$bid]=0; + } + $accounts[$bid] += 1; - 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 ''.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).''; - // 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 ''; + // 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 ''; - print '' ; - print ''; + print ''; + print ''; + print '' ; + print ''; - $i++; - } + $i++; + } } print ""; print ''; From c4b2c3e6976f98f5f3700ebe3b886f26979e8a04 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Dec 2017 09:16:36 +0100 Subject: [PATCH 3/4] FIXME $accounts[$bid] is a label ! --- htdocs/compta/paiement/cheque/card.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 7029bd6ec72..eb69a386719 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -492,11 +492,12 @@ if ($action == 'new') { foreach ($lines[$bid] as $lid => $value) { - $account_id = $bid; - if (! isset($accounts[$bid]) || $accounts[$bid] == '') { + //$account_id = $bid; FIXME not used + + // FIXME $accounts[$bid] is a label ! + /*if (! isset($accounts[$bid])) $accounts[$bid]=0; - } - $accounts[$bid] += 1; + $accounts[$bid] += 1;*/ print ''; print ''.dol_print_date($value["date"],'day').''; @@ -689,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.''; From 04327189f756d476157af50e684679c48507c04e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Dec 2017 09:41:33 +0100 Subject: [PATCH 4/4] Fix: access error when user not right to view all customers --- htdocs/compta/paiement/cheque/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index eb69a386719..c684e041660 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -46,7 +46,7 @@ $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');