Removed deprecated code
This commit is contained in:
parent
a67c00ee7a
commit
360dd71c58
@ -20,11 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/livraison/livraison.class.php
|
\file htdocs/livraison/livraison.class.php
|
||||||
\ingroup livraison
|
\ingroup livraison
|
||||||
\brief Fichier de la classe de gestion des bons de livraison
|
\brief Fichier de la classe de gestion des bons de livraison
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php");
|
||||||
@ -34,9 +34,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class Livraison
|
\class Livraison
|
||||||
\brief Classe de gestion des bons de livraison
|
\brief Classe de gestion des bons de livraison
|
||||||
*/
|
*/
|
||||||
class Livraison extends CommonObject
|
class Livraison extends CommonObject
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
@ -53,12 +53,12 @@ class Livraison extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisation
|
* Initialisation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function Livraison($DB)
|
function Livraison($DB)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->lignes = array();
|
$this->lignes = array();
|
||||||
@ -68,13 +68,13 @@ class Livraison extends CommonObject
|
|||||||
$this->statuts[1] = $langs->trans("Validated");
|
$this->statuts[1] = $langs->trans("Validated");
|
||||||
|
|
||||||
$this->products = array();
|
$this->products = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Cr<EFBFBD><EFBFBD> bon de livraison en base
|
* \brief Create delivery receipt in database
|
||||||
* \param user Objet du user qui cr<EFBFBD>e
|
* \param user Objet du user qui cree
|
||||||
* \return int <0 si erreur, id livraison cr<EFBFBD><EFBFBD>e si ok
|
* \return int <0 si erreur, id livraison cree si ok
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -92,12 +92,10 @@ class Livraison extends CommonObject
|
|||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."livraison (ref, fk_soc, date_creation, fk_user_author,";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."livraison (ref, fk_soc, date_creation, fk_user_author,";
|
||||||
$sql.= " fk_adresse_livraison";
|
$sql.= " fk_adresse_livraison";
|
||||||
if ($this->commande_id) $sql.= ", fk_commande";
|
|
||||||
if ($this->expedition_id) $sql.= ", fk_expedition";
|
if ($this->expedition_id) $sql.= ", fk_expedition";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$sql.= " VALUES ('(PROV)', ".$this->socid.", now(), $user->id,";
|
$sql.= " VALUES ('(PROV)', ".$this->socid.", now(), $user->id,";
|
||||||
$sql.= " ".($this->adresse_livraison_id > 0?$this->adresse_livraison_id:"null");
|
$sql.= " ".($this->adresse_livraison_id > 0?$this->adresse_livraison_id:"null");
|
||||||
if ($this->commande_id) $sql.= ", $this->commande_id";
|
|
||||||
if ($this->expedition_id) $sql.= ", $this->expedition_id";
|
if ($this->expedition_id) $sql.= ", $this->expedition_id";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
@ -121,8 +119,8 @@ class Livraison extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insertion des produits dans la base
|
* Insertion des produits dans la base
|
||||||
*/
|
*/
|
||||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||||
{
|
{
|
||||||
$origin_id=$this->lignes[$i]->origin_line_id;
|
$origin_id=$this->lignes[$i]->origin_line_id;
|
||||||
@ -134,6 +132,18 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($conf->livraison->enabled && $this->origin_id)
|
||||||
|
{
|
||||||
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_liv (fk_livraison, fk_commande) VALUES ('.$this->id.','.$this->origin_id.')';
|
||||||
|
if (!$this->db->query($sql))
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (! $conf->expedition->enabled)
|
if (! $conf->expedition->enabled)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||||
@ -180,9 +190,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function create_line($transaction, $commande_ligne_id, $qty, $fk_product=0)
|
function create_line($transaction, $commande_ligne_id, $qty, $fk_product=0)
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -208,9 +218,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lit un bon de livraison
|
* Lit un bon de livraison
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -274,23 +284,23 @@ class Livraison extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->origin = "propal";
|
$this->origin = "propal";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->statut == 0) $this->brouillon = 1;
|
if ($this->statut == 0) $this->brouillon = 1;
|
||||||
|
|
||||||
$file = $conf->livraison->dir_output . "/" .get_exdir($livraison->id,2) . "/" . $this->id.".pdf";
|
$file = $conf->livraison->dir_output . "/" .get_exdir($livraison->id,2) . "/" . $this->id.".pdf";
|
||||||
$this->pdf_filename = $file;
|
$this->pdf_filename = $file;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes
|
* Lignes
|
||||||
*/
|
*/
|
||||||
$result=$this->fetch_lignes();
|
$result=$this->fetch_lignes();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -308,10 +318,10 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Valide l'expedition, et met a jour le stock si stock g<EFBFBD>r
|
* \brief Valide l'expedition, et met a jour le stock si stock g<EFBFBD>r
|
||||||
* \param user Objet de l'utilisateur qui valide
|
* \param user Objet de l'utilisateur qui valide
|
||||||
* \return int
|
* \return int
|
||||||
*/
|
*/
|
||||||
function valid($user)
|
function valid($user)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -346,17 +356,17 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tester si non dej<65> au statut valid<69>. Si oui, on arrete afin d'<27>viter
|
// Tester si non dej<65> au statut valid<69>. Si oui, on arrete afin d'<27>viter
|
||||||
// de d<>cr<63>menter 2 fois le stock.
|
// de d<>cr<63>menter 2 fois le stock.
|
||||||
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."livraison where ref='".$this->ref."' AND fk_statut <> 0";
|
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."livraison where ref='".$this->ref."' AND fk_statut <> 0";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."livraison ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."livraison ";
|
||||||
$sql.= " SET ref='".addslashes($this->ref)."', fk_statut = 1, date_valid = now(), fk_user_valid = ".$user->id;
|
$sql.= " SET ref='".addslashes($this->ref)."', fk_statut = 1, date_valid = now(), fk_user_valid = ".$user->id;
|
||||||
@ -460,9 +470,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Cr<EFBFBD><EFBFBD> le bon de livraison depuis une exp<EFBFBD>dition existante
|
/** \brief Cr<EFBFBD><EFBFBD> le bon de livraison depuis une exp<EFBFBD>dition existante
|
||||||
\param user Utilisateur qui cr<EFBFBD>e
|
\param user Utilisateur qui cr<EFBFBD>e
|
||||||
\param sending_id Id de l'exp<EFBFBD>dition qui sert de mod<EFBFBD>le
|
\param sending_id Id de l'exp<EFBFBD>dition qui sert de mod<EFBFBD>le
|
||||||
*/
|
*/
|
||||||
function create_from_sending($user, $sending_id)
|
function create_from_sending($user, $sending_id)
|
||||||
{
|
{
|
||||||
$expedition = new Expedition($this->db);
|
$expedition = new Expedition($this->db);
|
||||||
@ -497,9 +507,9 @@ class Livraison extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute une ligne
|
* Ajoute une ligne
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function addline( $id, $qty )
|
function addline( $id, $qty )
|
||||||
{
|
{
|
||||||
$num = sizeof($this->lignes);
|
$num = sizeof($this->lignes);
|
||||||
@ -512,9 +522,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function delete_line($idligne)
|
function delete_line($idligne)
|
||||||
{
|
{
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
@ -535,9 +545,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime la fiche
|
* Supprime la fiche
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function delete()
|
function delete()
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -591,9 +601,9 @@ class Livraison extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lit le document associe
|
* Lit le document associe
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fetch_object()
|
function fetch_object()
|
||||||
{
|
{
|
||||||
$object = $this->origin;
|
$object = $this->origin;
|
||||||
@ -603,9 +613,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fetch_adresse_livraison($id)
|
function fetch_adresse_livraison($id)
|
||||||
{
|
{
|
||||||
$idadresse = $id;
|
$idadresse = $id;
|
||||||
@ -615,9 +625,9 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function fetch_lignes()
|
function fetch_lignes()
|
||||||
{
|
{
|
||||||
$this->lignes = array();
|
$this->lignes = array();
|
||||||
@ -662,14 +672,14 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le libell<EFBFBD> du statut d'une expedition
|
* \brief Retourne le libell<EFBFBD> du statut d'une expedition
|
||||||
* \return string Libell<EFBFBD>
|
* \return string Libell<EFBFBD>
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut,$mode);
|
return $this->LibStatut($this->statut,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
||||||
@ -677,29 +687,29 @@ class Livraison extends CommonObject
|
|||||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||||
* \return string Libell<EFBFBD>
|
* \return string Libell<EFBFBD>
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode)
|
function LibStatut($statut,$mode)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
if ($mode==0)
|
if ($mode==0)
|
||||||
{
|
{
|
||||||
if ($statut==-1) return $this->statuts[$statut];
|
if ($statut==-1) return $this->statuts[$statut];
|
||||||
if ($statut==0) return $this->statuts[$statut];
|
if ($statut==0) return $this->statuts[$statut];
|
||||||
if ($statut==1) return $this->statuts[$statut];
|
if ($statut==1) return $this->statuts[$statut];
|
||||||
}
|
}
|
||||||
if ($mode==1)
|
if ($mode==1)
|
||||||
{
|
{
|
||||||
if ($statut==-1) return $this->statuts[$statut];
|
if ($statut==-1) return $this->statuts[$statut];
|
||||||
if ($statut==0) return $this->statuts[$statut];
|
if ($statut==0) return $this->statuts[$statut];
|
||||||
if ($statut==1) return $this->statuts[$statut];
|
if ($statut==1) return $this->statuts[$statut];
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut==-1) return img_picto($langs->trans('StatusSendingCanceled'),'statut5').' '.$langs->trans('StatusSendingDraft');
|
if ($statut==-1) return img_picto($langs->trans('StatusSendingCanceled'),'statut5').' '.$langs->trans('StatusSendingDraft');
|
||||||
if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft');
|
if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft');
|
||||||
if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated');
|
if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -757,9 +767,9 @@ class Livraison extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class LivraisonLigne
|
\class LivraisonLigne
|
||||||
\brief Classe de gestion des lignes de bons de livraison
|
\brief Classe de gestion des lignes de bons de livraison
|
||||||
*/
|
*/
|
||||||
class LivraisonLigne
|
class LivraisonLigne
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user