Ajout du libellé non renseigné
This commit is contained in:
parent
71a6cc925b
commit
966d298f95
@ -51,13 +51,14 @@ class RejetPrelevement
|
|||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
$this->motifs = array();
|
$this->motifs = array();
|
||||||
|
$this->motifs[0] = "Non renseigné";
|
||||||
$this->motifs[1] = "Provision insuffisante";
|
$this->motifs[1] = "Provision insuffisante";
|
||||||
$this->motifs[2] = "Tirage contesté";
|
$this->motifs[2] = "Tirage contesté";
|
||||||
$this->motifs[3] = "Pas de bon à payer";
|
$this->motifs[3] = "Pas de bon à payer";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function create($user, $id, $motif, $bonid)
|
function create($user, $id, $motif, $date_rejet, $bonid)
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
@ -73,9 +74,10 @@ class RejetPrelevement
|
|||||||
/* Insert la ligne de rejet dans la base */
|
/* Insert la ligne de rejet dans la base */
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_rejet ";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_rejet ";
|
||||||
$sql .= " (fk_prelevement_lignes";
|
$sql .= " (fk_prelevement_lignes, date_rejet";
|
||||||
$sql .= " , motif , fk_user_creation, date_creation)";
|
$sql .= " , motif , fk_user_creation, date_creation)";
|
||||||
$sql .= " VALUES (".$id;
|
$sql .= " VALUES (".$id;
|
||||||
|
$sql .= " ,'".$this->db->idate($date_rejet)."'";
|
||||||
$sql .= " ,".$motif.",". $user->id.", now())";
|
$sql .= " ,".$motif.",". $user->id.", now())";
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
@ -282,75 +284,39 @@ class RejetPrelevement
|
|||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT f.fk_soc,f.facnumber,f.amount,f.tva,f.total,f.total_ttc,f.remise,f.remise_percent";
|
$sql = "SELECT ".$this->db->pdate("pr.date_rejet")." as dr";
|
||||||
$sql .= ",".$this->db->pdate("f.datef")." as df,f.fk_projet";
|
$sql .= ", motif";
|
||||||
$sql .= ",".$this->db->pdate("f.date_lim_reglement")." as dlr";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
||||||
$sql .= ", c.rowid as cond_regl_id, c.libelle, c.libelle_facture";
|
$sql .= " WHERE pr.fk_prelevement_lignes =".$rowid;
|
||||||
$sql .= ", f.note, f.paye, f.fk_statut, f.fk_user_author";
|
|
||||||
$sql .= ", fk_mode_reglement";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."cond_reglement as c";
|
|
||||||
$sql .= " WHERE f.rowid=$rowid AND c.rowid = f.fk_cond_reglement";
|
|
||||||
|
|
||||||
if ($societe_id > 0)
|
|
||||||
{
|
|
||||||
$sql .= " AND f.fk_soc = ".$societe_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
if ($this->db->query($sql))
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($result))
|
if ($this->db->num_rows())
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object();
|
||||||
|
|
||||||
$this->id = $rowid;
|
$this->id = $rowid;
|
||||||
$this->datep = $obj->dp;
|
$this->date_rejet = $obj->dr;
|
||||||
$this->date = $obj->df;
|
$this->motif = $this->motifs[$obj->motif];
|
||||||
$this->ref = $obj->facnumber;
|
|
||||||
$this->amount = $obj->amount;
|
|
||||||
$this->remise = $obj->remise;
|
|
||||||
$this->total_ht = $obj->total;
|
|
||||||
$this->total_tva = $obj->tva;
|
|
||||||
$this->total_ttc = $obj->total_ttc;
|
|
||||||
$this->paye = $obj->paye;
|
|
||||||
$this->remise_percent = $obj->remise_percent;
|
|
||||||
$this->socidp = $obj->fk_soc;
|
|
||||||
$this->statut = $obj->fk_statut;
|
|
||||||
$this->date_lim_reglement = $obj->dlr;
|
|
||||||
$this->cond_reglement_id = $obj->cond_regl_id;
|
|
||||||
$this->cond_reglement = $obj->libelle;
|
|
||||||
$this->cond_reglement_facture = $obj->libelle_facture;
|
|
||||||
$this->projetid = $obj->fk_projet;
|
|
||||||
$this->note = stripslashes($obj->note);
|
|
||||||
$this->user_author = $obj->fk_user_author;
|
|
||||||
$this->lignes = array();
|
|
||||||
|
|
||||||
$this->mode_reglement = $obj->fk_mode_reglement;
|
|
||||||
|
|
||||||
if ($this->statut == 0)
|
|
||||||
{
|
|
||||||
$this->brouillon = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//dolibarr_print_error($this->db);
|
dolibarr_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0");
|
||||||
dolibarr_syslog("Erreur Facture::Fetch rowid=$rowid numrows=0");
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//dolibarr_print_error($this->db);
|
dolibarr_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid");
|
||||||
dolibarr_syslog("Erreur Facture::Fetch rowid=$rowid Erreur dans fetch de la facture");
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user