Uniformisation du code. La navigation des bordereau de cheque fonctionne sur le meme principe que les autres entits
This commit is contained in:
parent
435737dac0
commit
bc0b10f5a8
@ -151,9 +151,18 @@ if ($_GET['action'] == 'new')
|
||||
}
|
||||
else
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$result = $remisecheque->Fetch($_GET["id"]);
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$result = $remisecheque->Fetch($_GET["id"]);
|
||||
}
|
||||
if ($_GET["ref"])
|
||||
{
|
||||
$result = $remisecheque->Fetch('',$_GET["ref"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("CheckReceipt");
|
||||
@ -278,17 +287,11 @@ else
|
||||
$accountstatic->id=$remisecheque->account_id;
|
||||
$accountstatic->label=$remisecheque->account_label;
|
||||
|
||||
$remisecheque->load_previous_next_id();
|
||||
$previous_id = $remisecheque->previous_id ? '<a href="'.$_SERVER["PHP_SELF"].'?id='.$remisecheque->previous_id.'">'.img_previous().'</a>':'';
|
||||
$next_id = $remisecheque->next_id ? '<a href="'.$_SERVER["PHP_SELF"].'?id='.$remisecheque->next_id.'">'.img_next().'</a>':'';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans('Numero').'</td><td colspan="2" >';
|
||||
if ($previous_id || $next_id) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
|
||||
// print '<td width="20%" align="right">';
|
||||
print $remisecheque->number;
|
||||
//print $previous_id.' '.$next_id;
|
||||
if ($previous_id || $next_id) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_id.'</td><td class="nobordernopadding" align="center" width="20">'.$next_id.'</td></tr></table>';
|
||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="2" >';
|
||||
|
||||
print $html->showrefnav($remisecheque,'ref','', 1, 'number');
|
||||
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -27,27 +26,33 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class RemiseCheque
|
||||
\brief Classe permettant la gestion des remises de cheque
|
||||
*/
|
||||
|
||||
class RemiseCheque
|
||||
class RemiseCheque extends CommonObject
|
||||
{
|
||||
var $db;
|
||||
var $id;
|
||||
var $num;
|
||||
var $intitule;
|
||||
//! Numero d'erreur Plage 1024-1279
|
||||
var $errno;
|
||||
var $db;
|
||||
var $error;
|
||||
var $element='chequereceipt';
|
||||
var $table_element='bordereau_cheque';
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler accès base de données
|
||||
* \param id id compte (0 par defaut)
|
||||
*/
|
||||
|
||||
function RemiseCheque($DB,$langs='')
|
||||
var $id;
|
||||
var $num;
|
||||
var $intitule;
|
||||
//! Numero d'erreur Plage 1024-1279
|
||||
var $errno;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler accès base de données
|
||||
* \param id id compte (0 par defaut)
|
||||
*/
|
||||
function RemiseCheque($DB,$langs='')
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->langs = $langs;
|
||||
@ -57,16 +62,18 @@ class RemiseCheque
|
||||
|
||||
/**
|
||||
\brief Load record
|
||||
\param id Identifiant de ligne
|
||||
\param id Id record
|
||||
\param ref Ref record
|
||||
*/
|
||||
function Fetch($id)
|
||||
function Fetch($id,$ref)
|
||||
{
|
||||
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author,bc.fk_bank_account,bc.amount,bc.number,bc.statut,bc.nbcheque";
|
||||
$sql.= ",".$this->db->pdate("date_bordereau"). " as date_bordereau";
|
||||
$sql.=",ba.label as account_label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
|
||||
$sql.= " WHERE bc.rowid = $id;";
|
||||
if ($id) $sql.= " WHERE bc.rowid = ".$id;
|
||||
if ($ref) $sql.= " WHERE bc.number = '".addslashes($ref)."'";
|
||||
|
||||
dolibarr_syslog("RemiseCheque::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -91,6 +98,7 @@ class RemiseCheque
|
||||
{
|
||||
$this->number = $obj->number;
|
||||
}
|
||||
$this->ref = $this->number;
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user