Skip to content
Snippets Groups Projects
Commit ad3f1388 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Uniformize constructor

Removed deprecated functions
parent d5064209
Branches
Tags
No related merge requests found
......@@ -83,7 +83,6 @@ class box_fournisseurs extends ModeleBoxes {
$num = $db->num_rows($result);
$i = 0;
//$supplierstatic=new Fournisseur($db);
while ($i < $num)
{
$objp = $db->fetch_object($result);
......
......@@ -36,18 +36,15 @@ class Fournisseur extends Societe
var $db;
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
* \param id id societe (0 par defaut)
* Constructor
*
* @param DoliDB $db Database handler
*/
function Fournisseur($DB, $id=0, $user=0)
function Fournisseur($db)
{
global $config;
$this->db = $DB;
$this->id = $id;
$this->user = $user;
$this->db = $db;
$this->client = 0;
$this->fournisseur = 0;
$this->effectif_id = 0;
......@@ -57,7 +54,12 @@ class Fournisseur extends Societe
}
function nb_open_commande()
/**
* Return nb of orders
*
* @return int Nb of orders
*/
function getNbOfOrders()
{
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
......@@ -137,44 +139,10 @@ class Fournisseur extends Societe
}
function ProductCommande($user, $fk_product)
{
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
include_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
$commf = new CommandeFournisseur($this->db);
$nbc = $this->nb_open_commande();
dol_syslog("Fournisseur::ProductCommande : nbc = ".$nbc);
if ($nbc == 0)
{
if ( $this->create_commande($user) == 0 )
{
$idc = $this->single_open_commande;
}
}
elseif ($nbc == 1)
{
$idc = $this->single_open_commande;
}
if ($idc > 0)
{
$prod = new ProductFournisseur($this->db);
$prod->fetch($fk_product);
//$prod->fetch_fourn_data($this->id);
$commf->fetch($idc);
$commf->addline("Toto",120,1,$prod->tva, $prod->id, 0, $prod->ref_fourn);
}
}
/**
* \brief Charge indicateurs this->nb de tableau de bord
* \return int <0 si ko, >0 si ok
* Load statistics indicators
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{
......@@ -213,10 +181,11 @@ class Fournisseur extends Societe
}
/**
* \brief Create a supplier category
* \param user User asking creation
* \param name Nom categorie
* \return int <0 si ko, 0 si ok
* Create a supplier category
*
* @param user User asking creation
* @param name Nom categorie
* @return int <0 if KO, 0 if OK
*/
function CreateCategory($user, $name)
{
......@@ -242,7 +211,7 @@ class Fournisseur extends Societe
/**
* Retourne la liste des fournisseurs
*
*
* @return array Array of suppliers
*/
function ListArray()
{
......
......@@ -1896,28 +1896,6 @@ class Product extends CommonObject
return $list;
}
/**
* Saisie une commande fournisseur
*
* @param user Objet user de celui qui demande
* @return int <0 si ko, >0 si ok
*/
function fastappro($user)
{
include_once DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php";
$list = $this->list_suppliers();
if (count($list) > 0)
{
dol_syslog("Product::fastappro");
$fournisseur = new Fournisseur($this->db);
$fournisseur->fetch($this->fourn_appro_open);
$fournisseur->ProductCommande($user, $this->id);
}
return 1;
}
/**
* Recopie les prix d'un produit/service sur un autre
*
......
......@@ -115,16 +115,6 @@ if (empty($reshook))
$action="";
}
if ($action == 'fastappro')
{
$product = new Product($db);
$result=$product->fetch($id,$ref);
$result=$product->fastappro($user);
Header("Location: fiche.php?id=".$product->id);
exit;
}
// Add a product or service
if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment