diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index bd0f1fed8a1..3ab73c40917 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -239,10 +239,20 @@ if ($_GET['action'] == 'new') } else { + + $remise->load_previous_next_id(); + $previous_id = $remise->previous_id ? ''.img_previous().'':''; + $next_id = $remise->next_id ? ''.img_next().'':''; + + + print ''; - print ''; - print ''; - print '\n"; + + print ''; + print ''; diff --git a/htdocs/compta/paiement/cheque/remisecheque.class.php b/htdocs/compta/paiement/cheque/remisecheque.class.php index f207dcd31e3..b5f9cb50bd2 100644 --- a/htdocs/compta/paiement/cheque/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/remisecheque.class.php @@ -50,6 +50,8 @@ class RemiseCheque function RemiseCheque($DB) { $this->db = $DB; + $this->next_id = 0; + $this->previous_id = 0; } /** @@ -435,5 +437,39 @@ class RemiseCheque } return 0; } + /** + \brief Charge les propriétés ref_previous et ref_next + \return int <0 si ko, 0 si ok + */ + function load_previous_next_id() + { + $this->errno = 0; + + $sql = "SELECT MAX(rowid)"; + $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; + $sql.= " WHERE rowid < '".$this->id."'"; + + $result = $this->db->query($sql) ; + if (! $result) + { + $this->errno = -1035; + } + $row = $this->db->fetch_row($result); + $this->previous_id = $row[0]; + + $sql = "SELECT MIN(rowid)"; + $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; + $sql.= " WHERE rowid > '".$this->id."'"; + $result = $this->db->query($sql) ; + if (! $result) + { + $this->errno = -1035; + } + $row = $this->db->fetch_row($result); + $this->next_id = $row[0]; + + return $this->errno; + } + } ?>
'.$langs->trans('Numero').''.$remise->number.'
'.$langs->trans('Date').''.dolibarr_print_date($remise->date_bordereau).'
'.$langs->trans('Account').''; + print '
'.$langs->trans('Numero').''.$remise->number.''; + print $previous_id.' '.$next_id; + print "
'.$langs->trans('Date').''.dolibarr_print_date($remise->date_bordereau).'
'.$langs->trans('Account').''; print ''.img_object($langs->trans("ShowAccount"),'account').' '.$remise->account_label.''; print '