Uniformize constructor
Removed deprecated functions
This commit is contained in:
parent
d506420968
commit
ad3f13881b
@ -83,7 +83,6 @@ class box_fournisseurs extends ModeleBoxes {
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
//$supplierstatic=new Fournisseur($db);
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|||||||
@ -36,18 +36,15 @@ class Fournisseur extends Societe
|
|||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* Constructor
|
||||||
* \param DB handler acces base de donnees
|
*
|
||||||
* \param id id societe (0 par defaut)
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
|
function Fournisseur($db)
|
||||||
function Fournisseur($DB, $id=0, $user=0)
|
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$this->db = $DB;
|
$this->db = $db;
|
||||||
$this->id = $id;
|
|
||||||
$this->user = $user;
|
|
||||||
$this->client = 0;
|
$this->client = 0;
|
||||||
$this->fournisseur = 0;
|
$this->fournisseur = 0;
|
||||||
$this->effectif_id = 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 = "SELECT rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
$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
|
* Load statistics indicators
|
||||||
* \return int <0 si ko, >0 si ok
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
@ -213,10 +181,11 @@ class Fournisseur extends Societe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a supplier category
|
* Create a supplier category
|
||||||
* \param user User asking creation
|
*
|
||||||
* \param name Nom categorie
|
* @param user User asking creation
|
||||||
* \return int <0 si ko, 0 si ok
|
* @param name Nom categorie
|
||||||
|
* @return int <0 if KO, 0 if OK
|
||||||
*/
|
*/
|
||||||
function CreateCategory($user, $name)
|
function CreateCategory($user, $name)
|
||||||
{
|
{
|
||||||
@ -240,9 +209,9 @@ class Fournisseur extends Societe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne la liste des fournisseurs
|
* Retourne la liste des fournisseurs
|
||||||
*
|
|
||||||
*
|
*
|
||||||
|
* @return array Array of suppliers
|
||||||
*/
|
*/
|
||||||
function ListArray()
|
function ListArray()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1896,28 +1896,6 @@ class Product extends CommonObject
|
|||||||
return $list;
|
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
|
* Recopie les prix d'un produit/service sur un autre
|
||||||
*
|
*
|
||||||
|
|||||||
@ -115,16 +115,6 @@ if (empty($reshook))
|
|||||||
$action="";
|
$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
|
// Add a product or service
|
||||||
if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user