diff --git a/htdocs/comm/class/adresse_livraison.class.php b/htdocs/comm/class/adresse_livraison.class.php
index a7e0a257200..218614c0485 100644
--- a/htdocs/comm/class/adresse_livraison.class.php
+++ b/htdocs/comm/class/adresse_livraison.class.php
@@ -19,17 +19,17 @@
*/
/**
- \file htdocs/comm/adresse_livraison.class.php
- \ingroup societe, expedition
- \brief Fichier de la classe des adresses de livraison
- \version $Id$
-*/
+ \file htdocs/comm/adresse_livraison.class.php
+ \ingroup societe, expedition
+ \brief Fichier de la classe des adresses de livraison
+ \version $Id$
+ */
/**
- \class AdresseLivraison
- \brief Classe permettant la gestion des adresses de livraison
-*/
+ \class AdresseLivraison
+ \brief Classe permettant la gestion des adresses de livraison
+ */
class AdresseLivraison
{
@@ -50,97 +50,97 @@ class AdresseLivraison
var $note;
- /**
- * \brief Constructeur de la classe
- * \param DB handler acces base de donnees
- * \param id id societe (0 par defaut)
- */
- function AdresseLivraison($DB, $id=0)
- {
- global $conf;
+ /**
+ * \brief Constructeur de la classe
+ * \param DB handler acces base de donnees
+ * \param id id societe (0 par defaut)
+ */
+ function AdresseLivraison($DB, $id=0)
+ {
+ global $conf;
- $this->db = $DB;
+ $this->db = $DB;
- $this->id = $id;
+ $this->id = $id;
- return 1;
- }
+ return 1;
+ }
- /**
- * \brief Cree l'adresse de livraison de la societe en base
- * \param user Objet utilisateur qui demande la creation
- * \return int 0 si ok, < 0 si erreur
- */
+ /**
+ * \brief Cree l'adresse de livraison de la societe en base
+ * \param user Objet utilisateur qui demande la creation
+ * \return int 0 si ok, < 0 si erreur
+ */
- function create($socid, $user='')
- {
- global $langs,$conf;
+ function create($socid, $user='')
+ {
+ global $langs,$conf;
- // Nettoyage parametres
- $this->nom=trim($this->nom);
- $this->label=trim($this->label);
+ // Nettoyage parametres
+ $this->nom=trim($this->nom);
+ $this->label=trim($this->label);
- dol_syslog("AdresseLivraison::create label=".$this->label);
+ dol_syslog("AdresseLivraison::create label=".$this->label);
- $this->db->begin();
+ $this->db->begin();
- $result = $this->verify();
+ $result = $this->verify();
- if ($result >= 0)
- {
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_adresse_livraison (label, fk_societe, nom, datec, fk_user_creat) ";
- $sql .= " VALUES ('".addslashes($this->label)."', '".$socid."', '".addslashes($this->nom)."', ".$this->db->idate(mktime()).", '".$user->id."')";
+ if ($result >= 0)
+ {
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_adresse_livraison (label, fk_societe, nom, datec, fk_user_creat) ";
+ $sql .= " VALUES ('".addslashes($this->label)."', '".$socid."', '".addslashes($this->nom)."', ".$this->db->idate(mktime()).", '".$user->id."')";
- $result=$this->db->query($sql);
- if ($result)
- {
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_adresse_livraison");
+ $result=$this->db->query($sql);
+ if ($result)
+ {
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_adresse_livraison");
- $ret = $this->update($this->id, $socid, $user);
+ $ret = $this->update($this->id, $socid, $user);
- if ($ret >= 0)
- {
- dol_syslog("AdresseLivraison::create success id=".$this->id);
- $this->db->commit();
- return 0;
- }
- else
- {
- dol_syslog("AdresseLivraison::create echec update");
- $this->db->rollback();
- return -3;
- }
- }
- else
+ if ($ret >= 0)
+ {
+ dol_syslog("AdresseLivraison::create success id=".$this->id);
+ $this->db->commit();
+ return 0;
+ }
+ else
+ {
+ dol_syslog("AdresseLivraison::create echec update");
+ $this->db->rollback();
+ return -3;
+ }
+ }
+ else
- {
- if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
- {
+ {
+ if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
+ {
- $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom);
- }
- else
- {
- dol_syslog("AdresseLivraison::create echec insert sql=$sql");
- }
- $this->db->rollback();
- return -2;
- }
+ $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom);
+ }
+ else
+ {
+ dol_syslog("AdresseLivraison::create echec insert sql=$sql");
+ }
+ $this->db->rollback();
+ return -2;
+ }
- }
- else
- {
- $this->db->rollback();
- dol_syslog("AdresseLivraison::create echec verify sql=$sql");
- return -1;
- }
- }
+ }
+ else
+ {
+ $this->db->rollback();
+ dol_syslog("AdresseLivraison::create echec verify sql=$sql");
+ return -1;
+ }
+ }
-/**
- * \brief Verification lors de la modification de l'adresse de livraison
- * \return 0 si ok, < 0 en cas d'erreur
- */
+ /**
+ * \brief Verification lors de la modification de l'adresse de livraison
+ * \return 0 si ok, < 0 en cas d'erreur
+ */
function verify()
{
$this->label=trim($this->label);
@@ -155,202 +155,202 @@ class AdresseLivraison
}
- /**
- * \brief Mise a jour des parametres de l'adresse de livraison
- * \param id id adresse de livraison
- * \param user Utilisateur qui demande la mise a jour
- * \return int <0 si ko, >=0 si ok
- */
- function update($id, $socid, $user='')
- {
- global $langs;
+ /**
+ * \brief Mise a jour des parametres de l'adresse de livraison
+ * \param id id adresse de livraison
+ * \param user Utilisateur qui demande la mise a jour
+ * \return int <0 si ko, >=0 si ok
+ */
+ function update($id, $socid, $user='')
+ {
+ global $langs;
- dol_syslog("AdresseLivraison::Update");
+ dol_syslog("AdresseLivraison::Update");
// Nettoyage des parametres
- $this->fk_societe = $socid;
- $this->label = trim($this->label);
- $this->nom = trim($this->nom);
- $this->adresse = trim($this->adresse); // TODO obsolete
- $this->address = trim($this->address);
- $this->cp = trim($this->cp);
- $this->ville = trim($this->ville);
- $this->pays_id = trim($this->pays_id);
- $this->tel = trim($this->tel);
- $this->tel = preg_replace("/\s/","",$this->tel);
- $this->tel = preg_replace("/\./","",$this->tel);
- $this->fax = trim($this->fax);
- $this->fax = preg_replace("/\s/","",$this->fax);
- $this->fax = preg_replace("/\./","",$this->fax);
- $this->note = trim($this->note);
+ $this->fk_societe = $socid;
+ $this->label = trim($this->label);
+ $this->nom = trim($this->nom);
+ $this->adresse = trim($this->adresse); // TODO obsolete
+ $this->address = trim($this->address);
+ $this->cp = trim($this->cp);
+ $this->ville = trim($this->ville);
+ $this->pays_id = trim($this->pays_id);
+ $this->tel = trim($this->tel);
+ $this->tel = preg_replace("/\s/","",$this->tel);
+ $this->tel = preg_replace("/\./","",$this->tel);
+ $this->fax = trim($this->fax);
+ $this->fax = preg_replace("/\s/","",$this->fax);
+ $this->fax = preg_replace("/\./","",$this->fax);
+ $this->note = trim($this->note);
- $result = $this->verify(); // Verifie que nom et label obligatoire
+ $result = $this->verify(); // Verifie que nom et label obligatoire
- if ($result >= 0)
- {
- dol_syslog("AdresseLivraison::Update verify ok");
+ if ($result >= 0)
+ {
+ dol_syslog("AdresseLivraison::Update verify ok");
- $sql = "UPDATE ".MAIN_DB_PREFIX."societe_adresse_livraison";
- $sql.= " SET label = '" . addslashes($this->label) ."'"; // Champ obligatoire
- $sql.= ",nom = '" . addslashes($this->nom) ."'"; // Champ obligatoire
- $sql.= ",address = '" . addslashes($this->address) ."'";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."societe_adresse_livraison";
+ $sql.= " SET label = '" . addslashes($this->label) ."'"; // Champ obligatoire
+ $sql.= ",nom = '" . addslashes($this->nom) ."'"; // Champ obligatoire
+ $sql.= ",address = '" . addslashes($this->address) ."'";
- if ($this->cp)
- { $sql .= ",cp = '" . $this->cp ."'"; }
+ if ($this->cp)
+ { $sql .= ",cp = '" . $this->cp ."'"; }
- if ($this->ville)
- { $sql .= ",ville = '" . addslashes($this->ville) ."'"; }
+ if ($this->ville)
+ { $sql .= ",ville = '" . addslashes($this->ville) ."'"; }
- $sql .= ",fk_pays = '" . ($this->pays_id?$this->pays_id:'0') ."'";
- $sql.= ",note = '" . addslashes($this->note) ."'";
+ $sql .= ",fk_pays = '" . ($this->pays_id?$this->pays_id:'0') ."'";
+ $sql.= ",note = '" . addslashes($this->note) ."'";
- if ($this->tel)
- { $sql .= ",tel = '" . $this->tel ."'"; }
+ if ($this->tel)
+ { $sql .= ",tel = '" . $this->tel ."'"; }
- if ($this->fax)
- { $sql .= ",fax = '" . $this->fax ."'"; }
+ if ($this->fax)
+ { $sql .= ",fax = '" . $this->fax ."'"; }
- if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
- $sql .= " WHERE fk_societe = '" . $socid ."' AND rowid = '" . $id ."'";
+ if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
+ $sql .= " WHERE fk_societe = '" . $socid ."' AND rowid = '" . $id ."'";
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $result = 1;
- }
- else
- {
- if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
- {
- // Doublon
- $this->error = $langs->trans("ErrorDuplicateField");
- $result = -1;
- }
- else
- {
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $result = 1;
+ }
+ else
+ {
+ if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
+ {
+ // Doublon
+ $this->error = $langs->trans("ErrorDuplicateField");
+ $result = -1;
+ }
+ else
+ {
- $this->error = $langs->trans("Error sql=$sql");
- dol_syslog("AdresseLivraison::Update echec sql=$sql");
- $result = -2;
- }
- }
- }
+ $this->error = $langs->trans("Error sql=$sql");
+ dol_syslog("AdresseLivraison::Update echec sql=$sql");
+ $result = -2;
+ }
+ }
+ }
- return $result;
+ return $result;
- }
+ }
- /**
- * \brief Charge depuis la base toutes les adresses de livraison d'une societe
- * \param socid Id de la societe a charger en memoire
- * \param user Objet de l'utilisateur
- * \return int >0 si ok, <0 si ko
- */
- function fetch($socid, $user=0)
- {
- global $langs, $conf;
+ /**
+ * \brief Charge depuis la base toutes les adresses de livraison d'une societe
+ * \param socid Id de la societe a charger en memoire
+ * \param user Objet de l'utilisateur
+ * \return int >0 si ok, <0 si ko
+ */
+ function fetch($socid, $user=0)
+ {
+ global $langs, $conf;
- $sql = 'SELECT rowid, nom, client, fournisseur';
- $sql .= ' FROM '.MAIN_DB_PREFIX.'societe';
- $sql .= ' WHERE rowid = '.$socid;
+ $sql = 'SELECT rowid, nom, client, fournisseur';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe';
+ $sql .= ' WHERE rowid = '.$socid;
- $resqlsoc=$this->db->query($sql);
+ $resqlsoc=$this->db->query($sql);
- if ($resqlsoc)
- {
- if ($this->db->num_rows($resqlsoc))
- {
- $obj = $this->db->fetch_object($resqlsoc);
+ if ($resqlsoc)
+ {
+ if ($this->db->num_rows($resqlsoc))
+ {
+ $obj = $this->db->fetch_object($resqlsoc);
- $this->nom_societe = $obj->nom;
- $this->socid = $obj->rowid;
- $this->id = $obj->rowid;
- $this->client = $obj->client;
- $this->fournisseur = $obj->fournisseur;
- }
+ $this->nom_societe = $obj->nom;
+ $this->socid = $obj->rowid;
+ $this->id = $obj->rowid;
+ $this->client = $obj->client;
+ $this->fournisseur = $obj->fournisseur;
+ }
- $this->lignes = array();
- $this->db->free($resqlsoc);
+ $this->lignes = array();
+ $this->db->free($resqlsoc);
- // Adresses de livraison liees a la societe
- if ($this->socid)
- {
- $sql = 'SELECT a.rowid as id, a.label, a.nom, a.address,'.$this->db->pdate('a.datec').' as dc';
- $sql .= ','. $this->db->pdate('a.tms').' as date_update, a.fk_societe';
- $sql .= ', a.cp, a.ville, a.note, a.fk_pays, a.tel, a.fax';
- $sql .= ', p.code as pays_code, p.libelle as pays';
- $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_adresse_livraison as a';
- $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid';
- $sql .= ' WHERE a.fk_societe = '.$this->socid;
+ // Adresses de livraison liees a la societe
+ if ($this->socid)
+ {
+ $sql = 'SELECT a.rowid as id, a.label, a.nom, a.address, a.datec as dc';
+ $sql .= ', a.tms as date_update, a.fk_societe';
+ $sql .= ', a.cp, a.ville, a.note, a.fk_pays, a.tel, a.fax';
+ $sql .= ', p.code as pays_code, p.libelle as pays';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_adresse_livraison as a';
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid';
+ $sql .= ' WHERE a.fk_societe = '.$this->socid;
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $num = $this->db->num_rows($resql);
- $i = 0;
- while ($i < $num)
- {
- $objp = $this->db->fetch_object($resql);
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+ while ($i < $num)
+ {
+ $objp = $this->db->fetch_object($resql);
- $ligne = new AdresseLivraisonLigne();
+ $ligne = new AdresseLivraisonLigne();
- $ligne->id = $objp->id;
- $ligne->date_creation = $objp->dc;
- $ligne->date_update = $objp->date_update;
- $ligne->label = stripslashes($objp->label);
- $ligne->nom = stripslashes($objp->nom);
- $ligne->address = stripslashes($objp->address);
- $ligne->adresse = stripslashes($objp->address); // TODO obsolete
- $ligne->cp = $objp->cp;
- $ligne->ville = stripslashes($objp->ville);
- $ligne->adresse_full = stripslashes($objp->address) . "\n". $objp->cp . ' '. stripslashes($objp->ville);
- $ligne->full_address = stripslashes($objp->address) . "\n". $objp->cp . ' '. stripslashes($objp->ville); // TODO obsolete
- $ligne->pays_id = $objp->fk_pays;
- $ligne->pays_code = $objp->fk_pays?$objp->pays_code:'';
- $ligne->pays = $objp->fk_pays?($langs->trans('Country'.$objp->pays_code)!='Country'.$objp->pays_code?strtoupper($langs->trans('Country'.$objp->pays_code)):$objp->pays):'';
- $ligne->tel = $objp->tel;
- $ligne->fax = $objp->fax;
- $ligne->note = $objp->note;
+ $ligne->id = $objp->id;
+ $ligne->date_creation = $this->db->jdate($objp->dc);
+ $ligne->date_update = $this->db->jdate($objp->date_update);
+ $ligne->label = $objp->label;
+ $ligne->nom = $objp->nom;
+ $ligne->address = $objp->address;
+ $ligne->adresse = $objp->address; // TODO obsolete
+ $ligne->cp = $objp->cp;
+ $ligne->ville = $objp->ville;
+ $ligne->adresse_full = $objp->address . "\n". $objp->cp . ' '. $objp->ville;
+ $ligne->full_address = $objp->address . "\n". $objp->cp . ' '. $objp->ville; // TODO obsolete
+ $ligne->pays_id = $objp->fk_pays;
+ $ligne->pays_code = $objp->fk_pays?$objp->pays_code:'';
+ $ligne->pays = $objp->fk_pays?($langs->trans('Country'.$objp->pays_code)!='Country'.$objp->pays_code?strtoupper($langs->trans('Country'.$objp->pays_code)):$objp->pays):'';
+ $ligne->tel = $objp->tel;
+ $ligne->fax = $objp->fax;
+ $ligne->note = $objp->note;
- $this->lignes[$i] = $ligne;
- $i++;
- }
- $this->db->free($resql);
- return 1;
- }
- else
- {
- dol_syslog('Erreur AdresseLivraison::Fetch aucune adresse dde livraison');
- return -1;
- }
- }
- else
- {
- dol_syslog('AdresseLivraison::Societe inconnue');
- return -2;
- }
- }
- else
- {
- dol_syslog('Erreur Societe::Fetch '.$this->db->error());
- $this->error=$this->db->error();
- }
- }
+ $this->lignes[$i] = $ligne;
+ $i++;
+ }
+ $this->db->free($resql);
+ return 1;
+ }
+ else
+ {
+ dol_syslog('Erreur AdresseLivraison::Fetch aucune adresse dde livraison');
+ return -1;
+ }
+ }
+ else
+ {
+ dol_syslog('AdresseLivraison::Societe inconnue');
+ return -2;
+ }
+ }
+ else
+ {
+ dol_syslog('Erreur Societe::Fetch '.$this->db->error());
+ $this->error=$this->db->error();
+ }
+ }
- /**
- * \brief Charge depuis la base l'objet adresse de livraison
- * \param id Id de l'adresse de livraison a charger en memoire
- * \param user Objet de l'utilisateur
- * \return int >0 si ok, <0 si ko
- */
- function fetch_adresse($id, $user=0)
- {
+ /**
+ * \brief Charge depuis la base l'objet adresse de livraison
+ * \param id Id de l'adresse de livraison a charger en memoire
+ * \param user Objet de l'utilisateur
+ * \return int >0 si ok, <0 si ko
+ */
+ function fetch_adresse($id, $user=0)
+ {
global $langs;
global $conf;
- $sql = 'SELECT a.rowid, a.fk_societe, a.label, a.nom, a.address,'.$this->db->pdate('a.datec').' as dc';
- $sql .= ','. $this->db->pdate('a.tms').' as date_update';
+ $sql = 'SELECT a.rowid, a.fk_societe, a.label, a.nom, a.address, a.datec as date_creation';
+ $sql .= ', a.tms as date_update';
$sql .= ', a.cp,a.ville, a.note, a.fk_pays, a.tel, a.fax';
$sql .= ', p.code as pays_code, p.libelle as pays';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_adresse_livraison as a';
@@ -366,17 +366,17 @@ class AdresseLivraison
$this->id = $obj->rowid;
$this->socid = $obj->fk_societe;
- $this->date_update = $obj->date_update;
- $this->date_creation = $obj->date_creation;
+ $this->date_update = $this->db->jdate($obj->date_update);
+ $this->date_creation = $this->db->jdate($obj->date_creation);
- $this->label = stripslashes($obj->label);
- $this->nom = stripslashes($obj->nom);
- $this->adresse = stripslashes($obj->address); // TODO obsolete
- $this->address = stripslashes($obj->address);
+ $this->label = $obj->label;
+ $this->nom = $obj->nom;
+ $this->adresse = $obj->address; // TODO obsolete
+ $this->address = $obj->address;
$this->cp = $obj->cp;
- $this->ville = stripslashes($obj->ville);
- $this->adresse_full = stripslashes($obj->address) . "\n". $obj->cp . ' '. stripslashes($obj->ville);
- $this->full_address = stripslashes($obj->address) . "\n". $obj->cp . ' '. stripslashes($obj->ville); //TODO obsolete
+ $this->ville = $obj->ville;
+ $this->adresse_full = $obj->address . "\n". $obj->cp . ' '. $obj->ville;
+ $this->full_address = $obj->address . "\n". $obj->cp . ' '. $obj->ville; //TODO obsolete
$this->pays_id = $obj->fk_pays;
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
@@ -409,94 +409,94 @@ class AdresseLivraison
}
- /**
- * \brief Suppression d'une adresse de livraison
- * \param id id de la societe a supprimer
- */
- function delete($id,$socid)
- {
- dol_syslog("AdresseLivraison::Delete");
+ /**
+ * \brief Suppression d'une adresse de livraison
+ * \param id id de la societe a supprimer
+ */
+ function delete($id,$socid)
+ {
+ dol_syslog("AdresseLivraison::Delete");
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_adresse_livraison";
- $sql .= " WHERE rowid=".$id." AND fk_societe = ".$socid;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_adresse_livraison";
+ $sql .= " WHERE rowid=".$id." AND fk_societe = ".$socid;
- $result = $this->db->query($sql);
+ $result = $this->db->query($sql);
- if (!$result)
- {
- print $this->db->error() . '
' . $sql;
- }
- }
+ if (!$result)
+ {
+ print $this->db->error() . '
' . $sql;
+ }
+ }
- /*
- * \brief Charge les informations d'ordre info dans l'objet societe
- * \param id id de la societe a charger
- */
- function info($id)
- {
- $sql = "SELECT s.rowid, s.nom, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("datea")." as datea,";
- $sql.= " fk_user_creat, fk_user_modif";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- $sql.= " WHERE s.rowid = ".$id;
+ /*
+ * \brief Charge les informations d'ordre info dans l'objet societe
+ * \param id id de la societe a charger
+ */
+ function info($id)
+ {
+ $sql = "SELECT s.rowid, s.nom, datec, datea,";
+ $sql.= " fk_user_creat, fk_user_modif";
+ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql.= " WHERE s.rowid = ".$id;
- $result=$this->db->query($sql);
- if ($result)
- {
- if ($this->db->num_rows($result))
- {
- $obj = $this->db->fetch_object($result);
+ $result=$this->db->query($sql);
+ if ($result)
+ {
+ if ($this->db->num_rows($result))
+ {
+ $obj = $this->db->fetch_object($result);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
- if ($obj->fk_user_creat) {
- $cuser = new User($this->db);
- $cuser->fetch($obj->fk_user_creat);
- $this->user_creation = $cuser;
- }
+ if ($obj->fk_user_creat) {
+ $cuser = new User($this->db);
+ $cuser->fetch($obj->fk_user_creat);
+ $this->user_creation = $cuser;
+ }
- if ($obj->fk_user_modif) {
- $muser = new User($this->db);
- $muser->fetch($obj->fk_user_modif);
- $this->user_modification = $muser;
- }
- $this->ref = $obj->nom;
- $this->date_creation = $obj->datec;
- $this->date_modification = $obj->datea;
- }
+ if ($obj->fk_user_modif) {
+ $muser = new User($this->db);
+ $muser->fetch($obj->fk_user_modif);
+ $this->user_modification = $muser;
+ }
+ $this->ref = $obj->nom;
+ $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_modification = $this->db->jdate($obj->datea);
+ }
- $this->db->free($result);
+ $this->db->free($result);
- }
- else
- {
- dol_print_error($this->db);
- }
- }
+ }
+ else
+ {
+ dol_print_error($this->db);
+ }
+ }
}
class AdresseLivraisonLigne
{
- var $id;
- var $date_creation;
- var $date_update;
- var $label;
- var $nom;
- var $adresse;
- var $cp;
- var $ville;
- var $adresse_full;
- var $pays_id;
- var $pays_code;
- var $pays;
- var $tel;
- var $fax;
- var $note;
+ var $id;
+ var $date_creation;
+ var $date_update;
+ var $label;
+ var $nom;
+ var $adresse;
+ var $cp;
+ var $ville;
+ var $adresse_full;
+ var $pays_id;
+ var $pays_code;
+ var $pays;
+ var $tel;
+ var $fax;
+ var $note;
- function AdresseLivraisonLigne()
- {
- }
+ function AdresseLivraisonLigne()
+ {
+ }
}
?>
\ No newline at end of file
diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php
index dcdc39176e6..b3eaa68c9d1 100644
--- a/htdocs/comm/prospect/fiche.php
+++ b/htdocs/comm/prospect/fiche.php
@@ -191,7 +191,7 @@ if ($socid > 0)
print '
| propalid\">"; print img_object($langs->trans("ShowPropal"),"propal"); print " ".$objp->ref."\n"; - if ( $objp->dp < ($now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) + if ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1) { print " ".img_warning(); } - print " | ".dol_print_date($objp->dp,"day")." | \n"; + print "".dol_print_date($db->jdate($objp->dp),"day")." | \n"; print "".price($objp->total_ht)." | \n"; print "".$propal_static->LibStatut($objp->fk_statut,5)." | \n"; $i++; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index da024cd77ee..13075ff2168 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -171,7 +171,7 @@ if ($conf->agenda->enabled) show_array_actions_to_do(10); */ if ($conf->propal->enabled && $user->rights->propale->lire) { - $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.total as total_ttc, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; + $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.total as total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."c_propalst as c"; @@ -207,7 +207,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) print "socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom." | \n"; print ""; - print dol_print_date($obj->dp,'day')." | \n"; + print dol_print_date($db->jdate($obj->dp),'day')."\n"; print "".price($obj->total_ttc)." | \n"; $i++; $total += $obj->price; diff --git a/htdocs/compta/export/class/ComptaJournalPaiement.class.php b/htdocs/compta/export/class/ComptaJournalPaiement.class.php index 80822245fb7..4c80cd51bac 100644 --- a/htdocs/compta/export/class/ComptaJournalPaiement.class.php +++ b/htdocs/compta/export/class/ComptaJournalPaiement.class.php @@ -21,12 +21,12 @@ * $Id$ */ - /** - * \file htdocs/compta/export/ComptaJournalPaiement.php - * \ingroup compta - * \brief Fichier de la classe export compta journal - * \version $Revision$ - */ +/** + * \file htdocs/compta/export/ComptaJournalPaiement.php + * \ingroup compta + * \brief Fichier de la classe export compta journal + * \version $Revision$ + */ require_once(DOL_DOCUMENT_ROOT.'/compta/export/class/ComptaJournalPdf.class.php'); @@ -40,242 +40,242 @@ class ComptaJournalPaiement function ComptaJournalPaiement ($db=0) { $this->db = $db; - } - - function GeneratePdf($user, $dir, $excid, $excref) - { - global $conf; - - $date = strftime("%Y%m",time()); - - $file = $dir . "JournalPaiement".$excref . ".pdf"; - - $grand_total_debit = 0; - $grand_total_credit = 0; - - if (file_exists($dir)) - { - $this->pdf = new ComptaJournalPdf('P','mm','A4'); - - $this->pdf->AliasNbPages(); - - $this->pdf->Open(); - $this->pdf->AddPage(); - - $this->tab_top = 90; - $this->tab_height = 90; - - $this->pdf->SetTitle("Journal des paiements"); - $this->pdf->SetCreator("Dolibarr ".DOL_VERSION); - $this->pdf->SetAuthor($user->fullname); - - $this->pdf->SetMargins(10, 10, 10); - $this->pdf->SetAutoPageBreak(1,10); - - /* - * - */ - - $this->pdf->SetFillColor(220,220,220); - - $this->pdf->SetFont('Arial','', 9); - - $this->pdf->SetXY (10, 10); - $nexY = $this->pdf->GetY(); - - $sql = "SELECT p.rowid,".$this->db->pdate("p.datep")." as dp, p.statut"; - $sql.= ", pf.amount"; - $sql.= ", c.libelle, p.num_paiement"; - $sql.= ", f.facnumber, f.increment"; - $sql.= ", s.nom"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p"; - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c"; - $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; - $sql.= ", ".MAIN_DB_PREFIX."facture as f"; - $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE p.fk_paiement = c.id"; - $sql.= " AND pf.fk_paiement = p.rowid"; - $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND p.statut = 1 "; - $sql.= " AND pf.fk_facture = f.rowid"; - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " AND p.fk_export_compta = ".$excid; - $sql.= " ORDER BY date_format(p.datep,'%Y%m%d') ASC, s.nom ASC"; - - $oldate = ''; - - $resql = $this->db->query($sql); - - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $var = True; - $journ = 'CE'; - $this->hligne = 5; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - if ($oldate <> strftime("%d%m%Y",$obj->dp)) - { - if ($oldate <> '') - { - $this->pdf->SetFont('Arial','B',9); - - $this->pdf->cell(143,$this->hligne,''); - - $this->pdf->cell(16,$this->hligne,'Total : ',0,0,'R'); - $this->pdf->cell(18,$this->hligne,$total_debit,0,0,'R'); - $this->pdf->cell(18,$this->hligne,$total_credit,0,0,'R'); - $this->pdf->ln(); - } - - $journal = "Journal $journ du ".strftime('%A, %e %B %G',$obj->dp); - $total_credit = 0 ; - $total_debit = 0 ; - $this->pdf->SetFont('Arial','B',10); - - $this->pdf->cell(10,$this->hligne,"$journal"); - $this->pdf->ln(); - - $this->pdf->SetFont('Arial','',9); - - $this->pdf->cell(16,$this->hligne,'Date'); - - $this->pdf->cell(20,$this->hligne,'N Facture'); - - $this->pdf->cell(20,$this->hligne,'Tiers'); - - $this->pdf->cell(87,$this->hligne,'Libelle'); - - $this->pdf->cell(16,$this->hligne,'Echeance',0,0,'R'); - - $this->pdf->cell(18,$this->hligne,'Debit',0,0,'R'); - - $this->pdf->cell(18,$this->hligne,'Credit',0,0,'R'); - $this->pdf->ln(); - - $oldate = strftime("%d%m%Y",$obj->dp); - } - - /* - * - */ - $socnom = $obj->nom; - $libelle = $obj->libelle; - - if (strlen($obj->nom) > 31) - { - $socnom = substr($obj->nom, 0 , 31); - } - - $this->pdf->SetFont('Arial','',9); - - if ($obj->amount >= 0) - { - $credit = ''; - $debit = abs($obj->amount); - $total_debit = $total_debit + $debit; - $grand_total_debit = $grand_total_debit + $debit; - } - else - { - $credit = abs($obj->amount); - $debit = ''; - $total_credit = $total_credit + $credit; - $grand_total_credit = $grand_total_credit + $credit; - $libelle = "Rejet Prelevement"; - } - - $s = $socnom . ' '.$libelle; - - $facnumber = $obj->facnumber; - if (strlen(trim($obj->increment)) > 0) - { - $facnumber = $obj->increment; - } - - $this->_print_ligne($obj->dp, $facnumber, '41100000', $s, $credit, $debit); - - if ($obj->amount >= 0) - { - $credit = abs($obj->amount); - $debit = ''; - $total_credit = $total_credit + $credit; - $grand_total_credit = $grand_total_credit + $credit; - } - else - { - $credit = ''; - $debit = abs($obj->amount); - $total_debit = $total_debit + $debit; - $grand_total_debit = $grand_total_debit + $debit; - } - - $s = $socnom . ' '.$libelle; - $this->_print_ligne($obj->dp, $facnumber, '5122000', $s, $credit, $debit); - - $i++; - } - - $this->pdf->SetFont('Arial','B',9); - - $this->pdf->cell(143,$this->hligne,''); - - $this->pdf->cell(16,$this->hligne,'Total : ',0,0,'R'); - $this->pdf->cell(18,$this->hligne,$total_debit,0,0,'R'); - $this->pdf->cell(18,$this->hligne,$total_credit,0,0,'R'); - $this->pdf->ln(); - - /* - * - */ - $this->pdf->cell(143,$this->hligne,''); - - $this->pdf->cell(16,$this->hligne,'Grand Total : ',0,0,'R'); - $this->pdf->cell(18,$this->hligne,$grand_total_debit,0,0,'R'); - $this->pdf->cell(18,$this->hligne,$grand_total_credit,0,0,'R'); - $this->pdf->ln(); - - /* - * - */ - - $this->pdf->Close(); - - $this->pdf->Output($file); - - return 1; - } - else - { - $this->error=""; - return 0; - } - } - else - { - $this->error=$langs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR"); - return 0; - } - } - - /* - * - */ - Function _print_ligne($a, $b, $c, $d, $e, $f) - { - $this->pdf->cell(16,$this->hligne, strftime('%d%m%y',$a)); - $this->pdf->cell(20,$this->hligne, $b); - $this->pdf->cell(20,$this->hligne, $c); - $this->pdf->cell(87,$this->hligne, $d); - $this->pdf->cell(16,$this->hligne, strftime('%d%m%y',$a),0,0,'R'); - $this->pdf->cell(18,$this->hligne, $e,0,0,'R'); - $this->pdf->cell(18,$this->hligne, $f,0,0,'R'); - $this->pdf->ln(); - } + } + + function GeneratePdf($user, $dir, $excid, $excref) + { + global $conf; + + $date = strftime("%Y%m",time()); + + $file = $dir . "JournalPaiement".$excref . ".pdf"; + + $grand_total_debit = 0; + $grand_total_credit = 0; + + if (file_exists($dir)) + { + $this->pdf = new ComptaJournalPdf('P','mm','A4'); + + $this->pdf->AliasNbPages(); + + $this->pdf->Open(); + $this->pdf->AddPage(); + + $this->tab_top = 90; + $this->tab_height = 90; + + $this->pdf->SetTitle("Journal des paiements"); + $this->pdf->SetCreator("Dolibarr ".DOL_VERSION); + $this->pdf->SetAuthor($user->fullname); + + $this->pdf->SetMargins(10, 10, 10); + $this->pdf->SetAutoPageBreak(1,10); + + /* + * + */ + + $this->pdf->SetFillColor(220,220,220); + + $this->pdf->SetFont('Arial','', 9); + + $this->pdf->SetXY (10, 10); + $nexY = $this->pdf->GetY(); + + $sql = "SELECT p.rowid,p.datep as dp, p.statut"; + $sql.= ", pf.amount"; + $sql.= ", c.libelle, p.num_paiement"; + $sql.= ", f.facnumber, f.increment"; + $sql.= ", s.nom"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c"; + $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; + $sql.= ", ".MAIN_DB_PREFIX."facture as f"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE p.fk_paiement = c.id"; + $sql.= " AND pf.fk_paiement = p.rowid"; + $sql.= " AND f.fk_soc = s.rowid"; + $sql.= " AND p.statut = 1 "; + $sql.= " AND pf.fk_facture = f.rowid"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " AND p.fk_export_compta = ".$excid; + $sql.= " ORDER BY date_format(p.datep,'%Y%m%d') ASC, s.nom ASC"; + + $oldate = ''; + + $resql = $this->db->query($sql); + + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + $var = True; + $journ = 'CE'; + $this->hligne = 5; + + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + + if ($oldate <> strftime("%d%m%Y",$this->db->jdate($obj->dp))) + { + if ($oldate <> '') + { + $this->pdf->SetFont('Arial','B',9); + + $this->pdf->cell(143,$this->hligne,''); + + $this->pdf->cell(16,$this->hligne,'Total : ',0,0,'R'); + $this->pdf->cell(18,$this->hligne,$total_debit,0,0,'R'); + $this->pdf->cell(18,$this->hligne,$total_credit,0,0,'R'); + $this->pdf->ln(); + } + + $journal = "Journal $journ du ".strftime('%A, %e %B %G',$this->db->jdate($obj->dp)); + $total_credit = 0 ; + $total_debit = 0 ; + $this->pdf->SetFont('Arial','B',10); + + $this->pdf->cell(10,$this->hligne,"$journal"); + $this->pdf->ln(); + + $this->pdf->SetFont('Arial','',9); + + $this->pdf->cell(16,$this->hligne,'Date'); + + $this->pdf->cell(20,$this->hligne,'N Facture'); + + $this->pdf->cell(20,$this->hligne,'Tiers'); + + $this->pdf->cell(87,$this->hligne,'Libelle'); + + $this->pdf->cell(16,$this->hligne,'Echeance',0,0,'R'); + + $this->pdf->cell(18,$this->hligne,'Debit',0,0,'R'); + + $this->pdf->cell(18,$this->hligne,'Credit',0,0,'R'); + $this->pdf->ln(); + + $oldate = strftime("%d%m%Y",$this->db->jdate($obj->dp)); + } + + /* + * + */ + $socnom = $obj->nom; + $libelle = $obj->libelle; + + if (strlen($obj->nom) > 31) + { + $socnom = substr($obj->nom, 0 , 31); + } + + $this->pdf->SetFont('Arial','',9); + + if ($obj->amount >= 0) + { + $credit = ''; + $debit = abs($obj->amount); + $total_debit = $total_debit + $debit; + $grand_total_debit = $grand_total_debit + $debit; + } + else + { + $credit = abs($obj->amount); + $debit = ''; + $total_credit = $total_credit + $credit; + $grand_total_credit = $grand_total_credit + $credit; + $libelle = "Rejet Prelevement"; + } + + $s = $socnom . ' '.$libelle; + + $facnumber = $obj->facnumber; + if (strlen(trim($obj->increment)) > 0) + { + $facnumber = $obj->increment; + } + + $this->_print_ligne($this->db->jdate($obj->dp), $facnumber, '41100000', $s, $credit, $debit); + + if ($obj->amount >= 0) + { + $credit = abs($obj->amount); + $debit = ''; + $total_credit = $total_credit + $credit; + $grand_total_credit = $grand_total_credit + $credit; + } + else + { + $credit = ''; + $debit = abs($obj->amount); + $total_debit = $total_debit + $debit; + $grand_total_debit = $grand_total_debit + $debit; + } + + $s = $socnom . ' '.$libelle; + $this->_print_ligne($this->db->jdate($obj->dp), $facnumber, '5122000', $s, $credit, $debit); + + $i++; + } + + $this->pdf->SetFont('Arial','B',9); + + $this->pdf->cell(143,$this->hligne,''); + + $this->pdf->cell(16,$this->hligne,'Total : ',0,0,'R'); + $this->pdf->cell(18,$this->hligne,$total_debit,0,0,'R'); + $this->pdf->cell(18,$this->hligne,$total_credit,0,0,'R'); + $this->pdf->ln(); + + /* + * + */ + $this->pdf->cell(143,$this->hligne,''); + + $this->pdf->cell(16,$this->hligne,'Grand Total : ',0,0,'R'); + $this->pdf->cell(18,$this->hligne,$grand_total_debit,0,0,'R'); + $this->pdf->cell(18,$this->hligne,$grand_total_credit,0,0,'R'); + $this->pdf->ln(); + + /* + * + */ + + $this->pdf->Close(); + + $this->pdf->Output($file); + + return 1; + } + else + { + $this->error=""; + return 0; + } + } + else + { + $this->error=$langs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR"); + return 0; + } + } + + /* + * + */ + Function _print_ligne($a, $b, $c, $d, $e, $f) + { + $this->pdf->cell(16,$this->hligne, strftime('%d%m%y',$a)); + $this->pdf->cell(20,$this->hligne, $b); + $this->pdf->cell(20,$this->hligne, $c); + $this->pdf->cell(87,$this->hligne, $d); + $this->pdf->cell(16,$this->hligne, strftime('%d%m%y',$a),0,0,'R'); + $this->pdf->cell(18,$this->hligne, $e,0,0,'R'); + $this->pdf->cell(18,$this->hligne, $f,0,0,'R'); + $this->pdf->ln(); + } } ?> diff --git a/htdocs/compta/export/class/ComptaJournalPdf.class.php b/htdocs/compta/export/class/ComptaJournalPdf.class.php index 96a0a3c2b14..61e734fdfc3 100644 --- a/htdocs/compta/export/class/ComptaJournalPdf.class.php +++ b/htdocs/compta/export/class/ComptaJournalPdf.class.php @@ -35,14 +35,14 @@ require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php'); */ class ComptaJournalPdf extends FPDF { - function Footer() - { - $this->SetY(-10); - //Police Arial italique 8 - $this->SetFont('Arial','I',8); + function Footer() + { + $this->SetY(-10); + //Police Arial italique 8 + $this->SetFont('Arial','I',8); - $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); - } + $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); + } } ?> diff --git a/htdocs/compta/export/class/ComptaJournalVente.class.php b/htdocs/compta/export/class/ComptaJournalVente.class.php index 868ff816f68..89c22c88f7b 100644 --- a/htdocs/compta/export/class/ComptaJournalVente.class.php +++ b/htdocs/compta/export/class/ComptaJournalVente.class.php @@ -20,246 +20,246 @@ * $Id$ */ - /** - \file htdocs/compta/export/ComptaJournalVente.php - \ingroup compta - \brief Fichier de la classe export compta journal - \version $Revision$ -*/ +/** + \file htdocs/compta/export/ComptaJournalVente.php + \ingroup compta + \brief Fichier de la classe export compta journal + \version $Revision$ + */ require_once(DOL_DOCUMENT_ROOT.'/compta/export/class/ComptaJournalPdf.class.php'); /** - \class ComptaJournalVente - \brief Classe export compta journal -*/ + \class ComptaJournalVente + \brief Classe export compta journal + */ class ComptaJournalVente { - function ComptaJournalVente ($db=0) - { - $this->db = $db; - } - - - function GeneratePdf($user, $dir, $excid, $excref) - { - $date = strftime("%Y%m",time()); - - $file = $dir . "JournalVente".$excref . ".pdf"; - - if (file_exists($dir)) + function ComptaJournalVente ($db=0) { + $this->db = $db; + } + + + function GeneratePdf($user, $dir, $excid, $excref) + { + $date = strftime("%Y%m",time()); + + $file = $dir . "JournalVente".$excref . ".pdf"; + + if (file_exists($dir)) + { $pdf = new ComptaJournalPdf('P','mm','A4'); $pdf->AliasNbPages(); $pdf->Open(); $pdf->AddPage(); - + $this->tab_top = 90; $this->tab_height = 90; - + $pdf->SetTitle("Journal des ventes"); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($user->fullname); - + $pdf->SetMargins(10, 10, 10); $pdf->SetAutoPageBreak(1,10); - + /* * - */ - + */ + $pdf->SetFillColor(220,220,220); - + $pdf->SetFont('Arial','', 9); - + $pdf->SetXY (10, 10 ); $nexY = $pdf->GetY(); - - $sql = "SELECT f.rowid as facid, f.facnumber, ".$this->db->pdate("f.datef")." as dp"; + + $sql = "SELECT f.rowid as facid, f.facnumber, f.datef as dp"; $sql .= " , f.total_ttc as amount, f.tva"; $sql .= " , s.nom, s.code_compta"; $sql .= " , l.price, l.tva_tx"; $sql .= " , c.numero, f.increment"; $sql .= " , l.rowid as lrowid"; - + $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l"; $sql .= " , ".MAIN_DB_PREFIX."facture as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c"; - + $sql .= " WHERE f.rowid = l.fk_facture "; $sql .= " AND s.rowid = f.fk_soc"; $sql .= " AND f.fk_statut = 1 "; $sql .= " AND l.fk_code_ventilation <> 0 "; - $sql .= " AND l.fk_export_compta <> 0"; + $sql .= " AND l.fk_export_compta <> 0"; $sql .= " AND c.rowid = l.fk_code_ventilation"; $sql .= " AND l.fk_export_compta = ".$excid; - + $sql .= " ORDER BY date_format(f.datef,'%Y%m%d') ASC, f.rowid, l.rowid"; - + $oldate = ''; $oldfac = ''; $resql = $this->db->query($sql); if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - $var = True; - $journ = 'VI'; - $hligne = 5; + { + $num = $this->db->num_rows($resql); + $i = 0; + $var = True; + $journ = 'VI'; + $hligne = 5; - $wc = array(0,14,6,16,16,90,16,12,4,16); + $wc = array(0,14,6,16,16,90,16,12,4,16); - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); - if ($oldate <> strftime("%d%m%Y",$obj->dp)) - { + if ($oldate <> strftime("%d%m%Y",$this->db->jdate($obj->dp))) + { - $journal = "Journal $journ du ".strftime('%A, %e %B %G',$obj->dp); - $total_credit = 0 ; - $total_debit = 0 ; - $pdf->SetFont('Arial','B',10); + $journal = "Journal $journ du ".strftime('%A, %e %B %G',$this->db->jdate($obj->dp)); + $total_credit = 0 ; + $total_debit = 0 ; + $pdf->SetFont('Arial','B',10); - $pdf->cell(10,$hligne,"$journal"); - $pdf->ln(); + $pdf->cell(10,$hligne,"$journal"); + $pdf->ln(); - $pdf->SetFont('Arial','',9); + $pdf->SetFont('Arial','',9); - $pdf->cell($wc[1],$hligne,'Date'); - $pdf->cell($wc[2],$hligne,''); - $pdf->cell($wc[3],$hligne,'Compte'); - $pdf->cell($wc[4],$hligne,'Tiers'); - $pdf->cell($wc[5],$hligne,'Libell�'); - $pdf->cell($wc[6],$hligne,'Facture'); - $pdf->cell($wc[7],$hligne,'Montant',0,0,'R'); - $pdf->cell($wc[8],$hligne,''); - $pdf->cell($wc[9],$hligne,'Echeance',0,0,'R'); + $pdf->cell($wc[1],$hligne,'Date'); + $pdf->cell($wc[2],$hligne,''); + $pdf->cell($wc[3],$hligne,'Compte'); + $pdf->cell($wc[4],$hligne,'Tiers'); + $pdf->cell($wc[5],$hligne,'Libell�'); + $pdf->cell($wc[6],$hligne,'Facture'); + $pdf->cell($wc[7],$hligne,'Montant',0,0,'R'); + $pdf->cell($wc[8],$hligne,''); + $pdf->cell($wc[9],$hligne,'Echeance',0,0,'R'); - $pdf->ln(); + $pdf->ln(); - $oldate = strftime("%d%m%Y",$obj->dp); - } + $oldate = strftime("%d%m%Y",$this->db->jdate($obj->dp)); + } - /* - * - */ - $socnom = $obj->nom; - $libelle = "Facture"; - $amount = abs($obj->amount); - $price = abs(price($obj->price)); - $tva = abs($obj->tva); + /* + * + */ + $socnom = $obj->nom; + $libelle = "Facture"; + $amount = abs($obj->amount); + $price = abs(price($obj->price)); + $tva = abs($obj->tva); - $facnumber = $obj->facnumber; - if (strlen(trim($obj->increment)) > 0) - { - $facnumber = $obj->increment; - } + $facnumber = $obj->facnumber; + if (strlen(trim($obj->increment)) > 0) + { + $facnumber = $obj->increment; + } - if (strlen($obj->nom) > 31) - { + if (strlen($obj->nom) > 31) + { $socnom = substr($obj->nom, 0 , 31); - } + } - $pdf->SetFont('Arial','',9); + $pdf->SetFont('Arial','',9); - if ($obj->amount >= 0) - { - $d = "D"; - $c = "C"; + if ($obj->amount >= 0) + { + $d = "D"; + $c = "C"; - $credit = ''; - $debit = $amount; - $total_debit = $total_debit + $debit; - $grand_total_debit = $grand_total_debit + $debit; + $credit = ''; + $debit = $amount; + $total_debit = $total_debit + $debit; + $grand_total_debit = $grand_total_debit + $debit; - } - else - { - $d = "C"; - $c = "D"; + } + else + { + $d = "C"; + $c = "D"; - $credit = $amount; - $debit = ''; - $total_credit = $total_credit + $credit; - $grand_total_credit = $grand_total_credit + $credit; - } + $credit = $amount; + $debit = ''; + $total_credit = $total_credit + $credit; + $grand_total_credit = $grand_total_credit + $credit; + } - if ($oldfac <> $obj->facid) - { - $oldfac = $obj->facid; + if ($oldfac <> $obj->facid) + { + $oldfac = $obj->facid; - $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$obj->dp)); - $pdf->cell($wc[2],$hligne,'VI'); - $pdf->cell($wc[3],$hligne,'41100000'); - $pdf->cell($wc[4],$hligne,$obj->code_compta); - $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle); - $pdf->cell($wc[6],$hligne,$facnumber); - $pdf->cell($wc[7],$hligne,$amount,0,0,'R'); - $pdf->cell($wc[8],$hligne,$d); - $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$obj->dp),0,0,'R'); - $pdf->ln(); - - $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$obj->dp)); - $pdf->cell($wc[2],$hligne,'VI'); - $pdf->cell($wc[3],$hligne,'4457119'); - $pdf->cell($wc[4],$hligne,''); - $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle); - $pdf->cell($wc[6],$hligne,$facnumber); - $pdf->cell($wc[7],$hligne,$tva,0,0,'R'); - $pdf->cell($wc[8],$hligne,$c); - $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$obj->dp),0,0,'R'); - $pdf->ln(); - } + $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp))); + $pdf->cell($wc[2],$hligne,'VI'); + $pdf->cell($wc[3],$hligne,'41100000'); + $pdf->cell($wc[4],$hligne,$obj->code_compta); + $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle); + $pdf->cell($wc[6],$hligne,$facnumber); + $pdf->cell($wc[7],$hligne,$amount,0,0,'R'); + $pdf->cell($wc[8],$hligne,$d); + $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)),0,0,'R'); + $pdf->ln(); - $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$obj->dp)); - $pdf->cell($wc[2],$hligne,'VI'); - $pdf->cell($wc[3],$hligne,$obj->numero); - $pdf->cell($wc[4],$hligne,''); - $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle); - $pdf->cell($wc[6],$hligne,$facnumber); - $pdf->cell($wc[7],$hligne,$price,0,0,'R'); - $pdf->cell($wc[8],$hligne,$c); - $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$obj->dp),0,0,'R'); - $pdf->ln(); + $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp))); + $pdf->cell($wc[2],$hligne,'VI'); + $pdf->cell($wc[3],$hligne,'4457119'); + $pdf->cell($wc[4],$hligne,''); + $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle); + $pdf->cell($wc[6],$hligne,$facnumber); + $pdf->cell($wc[7],$hligne,$tva,0,0,'R'); + $pdf->cell($wc[8],$hligne,$c); + $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)),0,0,'R'); + $pdf->ln(); + } - $i++; - } - - /* - * - * - */ + $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp))); + $pdf->cell($wc[2],$hligne,'VI'); + $pdf->cell($wc[3],$hligne,$obj->numero); + $pdf->cell($wc[4],$hligne,''); + $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle); + $pdf->cell($wc[6],$hligne,$facnumber); + $pdf->cell($wc[7],$hligne,$price,0,0,'R'); + $pdf->cell($wc[8],$hligne,$c); + $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)),0,0,'R'); + $pdf->ln(); - $pdf->Close(); - - $pdf->Output($file); + $i++; + } - $result = 0; - } + /* + * + * + */ + + $pdf->Close(); + + $pdf->Output($file); + + $result = 0; + } else - { - $result -1; - } - } - else - { + { + $result -1; + } + } + else + { $result = -2; + } + + return $result; + } - - return $result; - - } - /* - * - * - */ + /* + * + * + */ } ?> diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 954167eae85..85053c7c2ed 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -191,7 +191,7 @@ class FactureRec extends Facture dol_syslog("Facture::Fetch rowid=".$rowid.", societe_id=".$socid, LOG_DEBUG); $sql = 'SELECT f.titre,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; - $sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr'; + $sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.note, f.note_public, f.fk_user_author'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; @@ -231,7 +231,7 @@ class FactureRec extends Facture $this->close_note = $obj->close_note; $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; - $this->date_lim_reglement = $obj->dlr; + $this->date_lim_reglement = $this->db->jdate($obj->dlr); $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement = $obj->mode_reglement_libelle; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index 0c250b26da4..b5fcfa5a4c9 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -55,7 +55,7 @@ if ($page == -1) $page = 0 ; $limit = $conf->liste_limit; $offset = $limit * $page ; -$sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, p.amount, p.statut"; +$sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; $sql .=", c.libelle as paiement_type, p.num_paiement"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c"; if ($socid) @@ -96,7 +96,7 @@ if ($resql) $var=!$var; print "|
| '.''.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.' | '; - print ''.dol_print_date($objp->dp,'day')." | \n"; + print ''.dol_print_date($db->jdate($objp->dp),'day')." | \n"; print "$objp->paiement_type $objp->num_paiement | \n"; print ''.price($objp->amount).' | '; print ''; diff --git a/htdocs/compta/paiement/cheque/remisecheque.class.php b/htdocs/compta/paiement/cheque/remisecheque.class.php index 21e5940ce5a..e0eb9914ed2 100644 --- a/htdocs/compta/paiement/cheque/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/remisecheque.class.php @@ -68,7 +68,7 @@ class RemiseCheque extends CommonObject global $conf; $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("bc.date_bordereau"). " as date_bordereau"; + $sql.= ", bc.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"; @@ -84,7 +84,7 @@ class RemiseCheque extends CommonObject { $this->id = $obj->rowid; $this->amount = $obj->amount; - $this->date_bordereau = $obj->date_bordereau; + $this->date_bordereau = $this->db->jdate($obj->date_bordereau); $this->account_id = $obj->fk_bank_account; $this->account_label = $obj->account_label; $this->author_id = $obj->fk_user_author; diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index 2107c02c40c..e8116bd05fb 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -216,10 +216,10 @@ class BonPrelevement extends CommonObject global $conf; $sql = "SELECT p.rowid, p.ref, p.amount, p.note, p.credite"; - $sql.= ", ".$this->db->pdate("p.datec")." as dc"; - $sql.= ", ".$this->db->pdate("p.date_trans")." as date_trans"; + $sql.= ", p.datec as dc"; + $sql.= ", p.date_trans as date_trans"; $sql.= ", p.method_trans, p.fk_user_trans"; - $sql.= ", ".$this->db->pdate("p.date_credit")." as date_credit"; + $sql.= ", p.date_credit as date_credit"; $sql.= ", p.fk_user_credit"; $sql.= ", p.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; @@ -237,15 +237,15 @@ class BonPrelevement extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; $this->amount = $obj->amount; - $this->note = stripslashes($obj->note); - $this->datec = $obj->dc; + $this->note = $obj->note; + $this->datec = $this->db->jdate($obj->dc); $this->credite = $obj->credite; - $this->date_trans = $obj->date_trans; + $this->date_trans = $this->db->jdate($obj->date_trans); $this->method_trans = $obj->method_trans; $this->user_trans = $obj->fk_user_trans; - $this->date_credit = $obj->date_credit; + $this->date_credit = $this->db->jdate($obj->date_credit); $this->user_credit = $obj->fk_user_credit; $this->statut = $obj->statut; diff --git a/htdocs/compta/prelevement/class/rejet-prelevement.class.php b/htdocs/compta/prelevement/class/rejet-prelevement.class.php index d8f11b05101..b0bb632ec1c 100644 --- a/htdocs/compta/prelevement/class/rejet-prelevement.class.php +++ b/htdocs/compta/prelevement/class/rejet-prelevement.class.php @@ -294,8 +294,7 @@ class RejetPrelevement function fetch($rowid) { - $sql = "SELECT ".$this->db->pdate("pr.date_rejet")." as dr"; - $sql.= ", motif"; + $sql = "SELECT pr.date_rejet as dr, motif"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr"; $sql.= " WHERE pr.fk_prelevement_lignes =".$rowid; @@ -307,7 +306,7 @@ class RejetPrelevement $obj = $this->db->fetch_object(); $this->id = $rowid; - $this->date_rejet = $obj->dr; + $this->date_rejet = $this->db->jdate($obj->dr); $this->motif = $this->motifs[$obj->motif]; $this->db->free(); diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index ca4225bc47d..bbff5fff20c 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -117,7 +117,7 @@ function factures ($db, $year, $month, $paye) { global $bc,$conf; - $sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.total,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; + $sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.total, f.datef as df, f.paye, f.rowid as facid "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ",".MAIN_DB_PREFIX."facture as f"; $sql.= " WHERE f.fk_statut = 1"; @@ -154,7 +154,7 @@ function factures ($db, $year, $month, $paye) print " | facid."\">".$objp->facnumber." | \n"; if ($objp->df > 0 ) { - print "".dol_print_date($objp->df)." | \n"; + print "".dol_print_date($db->jdate($objp->df))." | \n"; } else { diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index e18f17effaf..d8bf9f64512 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -40,10 +40,10 @@ class Tva extends CommonObject var $errors=array(); //!< To return several error codes (or messages) //var $element='tva'; //!< Id that identify managed objects //var $table_element='tva'; //!< Name of table without prefix where object is stored - + var $id; var $ref; - + var $tms; var $datep; var $datev; @@ -54,20 +54,20 @@ class Tva extends CommonObject var $fk_user_creat; var $fk_user_modif; - - + + /** * \brief Constructor * \param DB Database handler */ - function Tva($DB) + function Tva($DB) { $this->db = $DB; return 1; } - + /** * \brief Create in database * \param user User that create @@ -76,9 +76,9 @@ class Tva extends CommonObject function create($user) { global $conf, $langs; - + // Clean parameters - + $this->amount=trim($this->amount); $this->label=trim($this->label); $this->note=trim($this->note); @@ -86,14 +86,14 @@ class Tva extends CommonObject $this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_modif=trim($this->fk_user_modif); - + // Check parameters // Put here code to add control on parameters values - + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; - + $sql.= "tms,"; $sql.= "datep,"; $sql.= "datev,"; @@ -103,9 +103,9 @@ class Tva extends CommonObject $sql.= "fk_bank,"; $sql.= "fk_user_creat,"; $sql.= "fk_user_modif"; - + $sql.= ") VALUES ("; - + $sql.= " ".$this->db->idate($this->tms).","; $sql.= " ".$this->db->idate($this->datep).","; $sql.= " ".$this->db->idate($this->datev).","; @@ -115,7 +115,7 @@ class Tva extends CommonObject $sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").","; $sql.= " '".$this->fk_user_creat."',"; $sql.= " '".$this->fk_user_modif."'"; - + $sql.= ")"; dol_syslog("Tva::create sql=".$sql, LOG_DEBUG); @@ -123,7 +123,7 @@ class Tva extends CommonObject if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); - + // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($this->db); @@ -150,9 +150,9 @@ class Tva extends CommonObject function update($user=0, $notrigger=0) { global $conf, $langs; - + // Clean parameters - + $this->amount=trim($this->amount); $this->label=trim($this->label); $this->note=trim($this->note); @@ -160,14 +160,14 @@ class Tva extends CommonObject $this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_modif=trim($this->fk_user_modif); - + // Check parameters // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."tva SET"; - + $sql.= " tms=".$this->db->idate($this->tms).","; $sql.= " datep=".$this->db->idate($this->datep).","; $sql.= " datev=".$this->db->idate($this->datev).","; @@ -178,7 +178,7 @@ class Tva extends CommonObject $sql.= " fk_user_creat='".$this->fk_user_creat."',"; $sql.= " fk_user_modif='".$this->fk_user_modif."'"; - + $sql.= " WHERE rowid=".$this->id; dol_syslog("Tva::update sql=".$sql, LOG_DEBUG); @@ -202,8 +202,8 @@ class Tva extends CommonObject return 1; } - - + + /* * \brief Load object in memory from database * \param id id object @@ -215,10 +215,10 @@ class Tva extends CommonObject global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; - - $sql.= " ".$this->db->pdate('t.tms')." as tms,"; - $sql.= " ".$this->db->pdate('t.datep')." as datep,"; - $sql.= " ".$this->db->pdate('t.datev')." as datev,"; + + $sql.= " t.tms,"; + $sql.= " t.datep,"; + $sql.= " t.datev,"; $sql.= " t.amount,"; $sql.= " t.label,"; $sql.= " t.note,"; @@ -228,11 +228,11 @@ class Tva extends CommonObject $sql.= " b.fk_account,"; $sql.= " b.fk_type,"; $sql.= " b.rappro"; - + $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; $sql.= " WHERE t.rowid = ".$id; - + dol_syslog("Tva::fetch sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -240,24 +240,24 @@ class Tva extends CommonObject if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); - + $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->tms = $obj->tms; - $this->datep = $obj->datep; - $this->datev = $obj->datev; + $this->tms = $this->db->jdate($obj->tms); + $this->datep = $this->db->jdate($obj->datep); + $this->datev = $this->db->jdate($obj->datev); $this->amount = $obj->amount; $this->label = $obj->label; - $this->note = $obj->note; + $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; $this->fk_account = $obj->fk_account; $this->fk_type = $obj->fk_type; - $this->rappro = $obj->rappro; + $this->rappro = $obj->rappro; } $this->db->free($resql); - + return 1; } else @@ -267,8 +267,8 @@ class Tva extends CommonObject return -1; } } - - + + /* * \brief Delete object in database * \param user User that delete @@ -277,10 +277,10 @@ class Tva extends CommonObject function delete($user) { global $conf, $langs; - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."tva"; $sql.= " WHERE rowid=".$this->id; - + dol_syslog("Tva::delete sql=".$sql); $resql = $this->db->query($sql); if (! $resql) @@ -289,7 +289,7 @@ class Tva extends CommonObject dol_syslog("Tva::delete ".$this->error, LOG_ERR); return -1; } - + // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($this->db); @@ -300,7 +300,7 @@ class Tva extends CommonObject return 1; } - + /** * \brief Initialise object with example values * \remarks id must be 0 if object instance is a specimen. @@ -308,7 +308,7 @@ class Tva extends CommonObject function initAsSpecimen() { $this->id=0; - + $this->tms=''; $this->datep=''; $this->datev=''; @@ -319,10 +319,10 @@ class Tva extends CommonObject $this->fk_user_creat=''; $this->fk_user_modif=''; - + } - + /* * \brief Hum la fonction s'appelle 'Solde' elle doit a mon avis calcluer le solde de TVA, non ? * @@ -470,32 +470,32 @@ class Tva extends CommonObject function addPayment($user) { global $conf,$langs; - + $this->db->begin(); - + // Check parameters $this->amount=price2num($this->amount); if (! $this->label) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); - return -3; + return -3; } if ($this->amount <= 0) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); - return -4; + return -4; } if ($conf->banque->enabled && (empty($this->accountid) || $this->accountid <= 0)) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account")); - return -5; + return -5; } if ($conf->banque->enabled && (empty($this->paymenttype) || $this->paymenttype <= 0)) { $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); - return -5; + return -5; } - + // Insertion dans table des paiement tva $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep, datev, amount"; if ($this->note) $sql.=", note"; @@ -525,9 +525,9 @@ class Tva extends CommonObject $acc = new Account($this->db); $result=$acc->fetch($this->accountid); if ($result <= 0) dol_print_error($db); - + $bank_line_id = $acc->addline($this->datep, $this->paymenttype, $this->label, -abs($this->amount), '', '', $user); - + // Mise a jour fk_bank dans llx_tva. On connait ainsi la ligne de tva qui a g�n�r� l'�criture bancaire if ($bank_line_id > 0) { @@ -538,8 +538,8 @@ class Tva extends CommonObject $this->error=$acc->error; $ok=0; } - - // Mise a jour liens + + // Mise a jour liens $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/compta/tva/fiche.php?id=', "(VATPayment)", "payment_vat"); if ($result < 0) { @@ -547,8 +547,8 @@ class Tva extends CommonObject $ok=0; } } - - if ($ok) + + if ($ok) { $this->db->commit(); return $this->id; @@ -573,7 +573,7 @@ class Tva extends CommonObject return -1; } } - + /** * \brief Mise a jour du lien entre le paiement tva et la ligne g�n�r�e dans llx_bank * \param id_bank Id compte bancaire @@ -605,20 +605,20 @@ class Tva extends CommonObject function getNomUrl($withpicto=0,$option='') { global $langs; - + $result=''; - + $lien = ''; $lienfin=''; - + $picto='payment'; $label=$langs->trans("ShowVatPayment").': '.$this->ref; - + if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; - } + } } ?>