This commit is contained in:
Laurent Destailleur 2012-01-04 13:54:07 +01:00
parent cf6e0b7380
commit 16c6dd3c95
3 changed files with 73 additions and 60 deletions

View File

@ -138,12 +138,14 @@ class FormProduct
} }
/** /**
* \brief Output a combo box with list of units * Output a combo box with list of units
* \param name Name of HTML field * pour l'instant on ne definit pas les unites dans la base
* \param measuring_style Unit to show: weight, size, surface, volume *
* \param default Force unit * @param string $name Name of HTML field
* \param adddefault Add empty unit called "Default" * @param string $measuring_style Unit to show: weight, size, surface, volume
* \remarks pour l'instant on ne definit pas les unites dans la base * @param string $default Force unit
* @param int $adddefault Add empty unit called "Default"
* @return void
*/ */
function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
{ {
@ -152,11 +154,13 @@ class FormProduct
/** /**
* Return a combo box with list of units * Return a combo box with list of units
* @param name Name of HTML field * For the moment, units labels are defined in measuring_units_string
* @param measuring_style Unit to show: weight, size, surface, volume *
* @param default Force unit * @param string $name Name of HTML field
* @param adddefault Add empty unit called "Default" * @param string $measuring_style Unit to show: weight, size, surface, volume
* @see For the moment, units labels are defined in measuring_units_string * @param string $default Force unit
* @param int $adddefault Add empty unit called "Default"
* @return void
*/ */
function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
{ {

View File

@ -1510,7 +1510,7 @@ class Product extends CommonObject
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities * @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/ */
function get_nb_vente($socid=0,$mode) function get_nb_vente($socid,$mode)
{ {
global $conf; global $conf;
global $user; global $user;
@ -1539,7 +1539,7 @@ class Product extends CommonObject
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities * @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/ */
function get_nb_achat($socid=0,$mode) function get_nb_achat($socid,$mode)
{ {
global $conf; global $conf;
global $user; global $user;
@ -1568,7 +1568,7 @@ class Product extends CommonObject
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities * @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/ */
function get_nb_propal($socid=0,$mode) function get_nb_propal($socid,$mode)
{ {
global $conf; global $conf;
global $user; global $user;
@ -1596,7 +1596,7 @@ class Product extends CommonObject
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities * @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/ */
function get_nb_order($socid=0,$mode) function get_nb_order($socid,$mode)
{ {
global $conf, $user; global $conf, $user;
@ -1621,6 +1621,7 @@ class Product extends CommonObject
* *
* @param int $id_pere Id du produit auquel sera lie le produit a lier * @param int $id_pere Id du produit auquel sera lie le produit a lier
* @param int $id_fils Id du produit a lier * @param int $id_fils Id du produit a lier
* @param int $qty Quantity
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function add_sousproduit($id_pere, $id_fils,$qty) function add_sousproduit($id_pere, $id_fils,$qty)
@ -1871,20 +1872,20 @@ class Product extends CommonObject
/** /**
* Recopie les prix d'un produit/service sur un autre * Recopie les prix d'un produit/service sur un autre
* *
* @param fromId Id produit source * @param int $fromId Id product source
* @param toId Id produit cible * @param int $toId Id product target
* @return int < 0 si erreur, > 0 si ok * @return nt < 0 if KO, > 0 if OK
*/ */
function clone_price($fromId, $toId) function clone_price($fromId, $toId)
{ {
$this->db->begin(); $this->db->begin();
// les prix // les prix
$sql = "INSERT ".MAIN_DB_PREFIX."product_price (" $sql = "INSERT ".MAIN_DB_PREFIX."product_price (";
. " fk_product, date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell )" $sql.= " fk_product, date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell)";
. " SELECT ".$toId . ", date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell " $sql.= " SELECT ".$toId . ", date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell";
. " FROM ".MAIN_DB_PREFIX."product_price " $sql.= " FROM ".MAIN_DB_PREFIX."product_price ";
. " WHERE fk_product = ". $fromId; $sql.= " WHERE fk_product = ". $fromId;
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
@ -1920,11 +1921,11 @@ class Product extends CommonObject
}*/ }*/
// les prix de fournisseurs. // les prix de fournisseurs.
$sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur_price (" $sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur_price (";
. " datec, fk_product, fk_soc, price, quantity, fk_user )" $sql.= " datec, fk_product, fk_soc, price, quantity, fk_user)";
. " SELECT '".$this->db->idate(mktime())."', ".$toId. ", fk_soc, price, quantity, fk_user" $sql.= " SELECT '".$this->db->idate(mktime())."', ".$toId. ", fk_soc, price, quantity, fk_user";
. " FROM ".MAIN_DB_PREFIX."product_fournisseur_price" $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
. " WHERE fk_product = ".$fromId; $sql.= " WHERE fk_product = ".$fromId;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) if (! $resql)
@ -2037,7 +2038,7 @@ class Product extends CommonObject
/** /**
* reconstruit l'arborescence des categories sous la forme d'un tableau * reconstruit l'arborescence des categories sous la forme d'un tableau
* *
* @param int $multiply * @param int $multiply Because each sublevel must be multiplicated by parent nb
* @return array $this->res * @return array $this->res
*/ */
function get_arbo_each_prod($multiply=1) function get_arbo_each_prod($multiply=1)
@ -2055,7 +2056,7 @@ class Product extends CommonObject
} }
/** /**
* renvoie tous les sousproduits dans le tableau res, chaque ligne de res contient : id -> qty * Renvoie tous les sousproduits dans le tableau res, chaque ligne de res contient : id -> qty
* *
* @return array $this->res * @return array $this->res
*/ */
@ -2411,6 +2412,7 @@ class Product extends CommonObject
* @param string $file Nom du fichier uploade * @param string $file Nom du fichier uploade
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut) * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void
*/ */
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
{ {
@ -2439,10 +2441,10 @@ class Product extends CommonObject
/** /**
* Build thumb * Build thumb
* *
* @param string $sdir Repertoire destination finale
* @param string $file Chemin du fichier d'origine * @param string $file Chemin du fichier d'origine
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut) * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void
*/ */
function add_thumb($file, $maxWidth = 160, $maxHeight = 120) function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
{ {
@ -2460,7 +2462,7 @@ class Product extends CommonObject
* *
* @param string $sdir Repertoire destination finale * @param string $sdir Repertoire destination finale
* @param string $file url de l'image * @param string $file url de l'image
* @author Jean Heimburger june 2007 * @return void
*/ */
function add_photo_web($sdir, $file) function add_photo_web($sdir, $file)
{ {
@ -2750,6 +2752,7 @@ class Product extends CommonObject
* Efface la photo du produit et sa vignette * Efface la photo du produit et sa vignette
* *
* @param string $file Chemin de l'image * @param string $file Chemin de l'image
* @return void
*/ */
function delete_photo($file) function delete_photo($file)
{ {
@ -2777,6 +2780,7 @@ class Product extends CommonObject
* Load size of image file * Load size of image file
* *
* @param string $file Path to file * @param string $file Path to file
* @return void
*/ */
function get_image_size($file) function get_image_size($file)
{ {
@ -2823,6 +2827,7 @@ class Product extends CommonObject
* Mise a jour du code barre * Mise a jour du code barre
* *
* @param User $user Utilisateur qui fait la modification * @param User $user Utilisateur qui fait la modification
* @return void
*/ */
function update_barcode($user) function update_barcode($user)
{ {
@ -2830,7 +2835,7 @@ class Product extends CommonObject
$sql.= " SET barcode = '".$this->barcode."'"; $sql.= " SET barcode = '".$this->barcode."'";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("Product::update_barcode sql=".$sql); dol_syslog(get_class($this)."::update_barcode sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -2847,6 +2852,7 @@ class Product extends CommonObject
* Mise a jour du type de code barre * Mise a jour du type de code barre
* *
* @param User $user Utilisateur qui fait la modification * @param User $user Utilisateur qui fait la modification
* @return void
*/ */
function update_barcode_type($user) function update_barcode_type($user)
{ {
@ -2854,7 +2860,7 @@ class Product extends CommonObject
$sql.= " SET fk_barcode_type = '".$this->barcode_type."'"; $sql.= " SET fk_barcode_type = '".$this->barcode_type."'";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("Product::update_barcode_type sql=".$sql); dol_syslog(get_class($this)."::update_barcode_type sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -42,18 +42,21 @@ class Service extends CommonObject
var $debut_epoch; var $debut_epoch;
var $fin_epoch; var $fin_epoch;
/**
function Service($DB, $id=0) { * Constructor
$this->db = $DB; *
$this->id = $id; * @param DoliDB $db Database handler
*/
return 1; function Service($db)
{
$this->db = $db;
} }
/** /**
* Charge indicateurs this->nb de tableau de bord * Charge indicateurs this->nb de tableau de bord
* @return int <0 si ko, >0 si ok *
* @return int <0 if KO, >0 if OK
*/ */
function load_state_board() function load_state_board()
{ {