Ajout des curseurs next et previous
This commit is contained in:
parent
f91670044c
commit
cf9b090074
@ -239,10 +239,20 @@ if ($_GET['action'] == 'new')
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$remise->load_previous_next_id();
|
||||
$previous_id = $remise->previous_id ? '<a href="'.$_SERVER["PHP_SELF"].'?id='.$remise->previous_id.'">'.img_previous().'</a>':'';
|
||||
$next_id = $remise->next_id ? '<a href="'.$_SERVER["PHP_SELF"].'?id='.$remise->next_id.'">'.img_next().'</a>':'';
|
||||
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="30%">'.$langs->trans('Numero').'</td><td width="70%">'.$remise->number.'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dolibarr_print_date($remise->date_bordereau).'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans('Account').'</td><td width="70%">';
|
||||
print '<tr><td width="30%">'.$langs->trans('Numero').'</td><td width="50%">'.$remise->number.'</td><td width="20%" align="right">';
|
||||
print $previous_id.' '.$next_id;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans('Date').'</td><td colspan="2" width="70%">'.dolibarr_print_date($remise->date_bordereau).'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans('Account').'</td><td colspan="2" width="70%">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$remise->account_id.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$remise->account_label.'</a>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user