Qual: Uniformize code

This commit is contained in:
Juanjo Menent 2011-12-16 12:47:23 +01:00
parent 81535dc868
commit 83bef28418
2 changed files with 205 additions and 174 deletions

View File

@ -295,7 +295,7 @@ class Propal extends CommonObject
* @param double $txlocaltax2 Local tax 2 rate * @param double $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id du produit/service predefini * @param int $fk_product Id du produit/service predefini
* @param double $remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param double $price_base_type HT or TTC * @param string $price_base_type HT or TTC
* @param dobule $pu_ttc Prix unitaire TTC * @param dobule $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $type Type of line (product, service) * @param int $type Type of line (product, service)

View File

@ -114,11 +114,12 @@ class Commande extends CommonObject
} }
/** /**
* \brief Renvoie la reference de commande suivante non utilisee en fonction du module * Returns the reference to the following non used Order depending on the active numbering module
* de numerotation actif defini dans COMMANDE_ADDON * defined into COMMANDE_ADDON
* \param soc objet societe *
* \return string reference libre pour la commande * @param Societe $soc Object thirdparty
*/ * @return string Order free reference
*/
function getNextNumRef($soc) function getNextNumRef($soc)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;
@ -165,11 +166,11 @@ class Commande extends CommonObject
/** /**
* Validate order * Validate order
* *
* @param User $user User making status change * @param User $user User making status change
* @param int $idwarehouse Id of warehouse to use for stock decrease * @param int $idwarehouse Id of warehouse to use for stock decrease
* @return int <=0 if OK, >0 if KO * @return int <=0 if OK, >0 if KO
*/ */
function valid($user, $idwarehouse=0) function valid($user, $idwarehouse=0)
{ {
@ -393,10 +394,11 @@ class Commande extends CommonObject
/** /**
* Tag the order as validated (opened) * Tag the order as validated (opened)
* Function used when order is reopend after being closed. * Function used when order is reopend after being closed.
* @param user Object user that change status *
* @return int <0 if KO, 0 if nothing is done, >0 if OK * @param User $user Object user that change status
* @return int <0 if KO, 0 if nothing is done, >0 if OK
*/ */
function set_reopen($user) function set_reopen($user)
{ {
@ -447,8 +449,8 @@ class Commande extends CommonObject
/** /**
* Close order * Close order
* *
* @param user Objet user that close * @param User $user Objet user that close
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function cloture($user) function cloture($user)
{ {
@ -577,11 +579,12 @@ class Commande extends CommonObject
} }
/** /**
* Create order * Create order
* Note that this->ref can be set or empty. If empty, we will use "(PROV)" * Note that this->ref can be set or empty. If empty, we will use "(PROV)"
* @param user Objet user that make creation *
* @param notrigger Disable all triggers * @param User $user Objet user that make creation
* @return int <0 if KO, >0 if OK * @param int notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
@ -767,11 +770,11 @@ class Commande extends CommonObject
/** /**
* Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
* *
* @param int $socid Id of thirdparty * @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance * @param HookManager $hookmanager Hook manager instance
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($socid=0,$hookmanager=false) function createFromClone($socid=0,$hookmanager=false)
{ {
@ -940,30 +943,33 @@ class Commande extends CommonObject
/** /**
* Add an order line into database (linked to product/service or not) * Add an order line into database (linked to product/service or not)
* @param commandeid Id of line *
* @param desc Description of line * @param int $commandeid Id of line
* @param pu_ht Unit price (without tax) * @param string $desc Description of line
* @param qty Quantite * @param double $pu_ht Unit price (without tax)
* @param txtva Taux de tva force, sinon -1 * @param double $qty Quantite
* @param txlocaltax1 Local tax 1 rate * @param double $txtva Taux de tva force, sinon -1
* @param txlocaltax2 Local tax 2 rate * @param double $txlocaltax1 Local tax 1 rate
* @param fk_product Id du produit/service predefini * @param double $txlocaltax2 Local tax 2 rate
* @param remise_percent Pourcentage de remise de la ligne * @param int $fk_product Id du produit/service predefini
* @param info_bits Bits de type de lignes * @param double $remise_percent Pourcentage de remise de la ligne
* @param fk_remise_except Id remise * @param int $info_bits Bits de type de lignes
* @param price_base_type HT or TTC * @param int $fk_remise_except Id remise
* @param pu_ttc Prix unitaire TTC * @param string $price_base_type HT or TTC
* @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param double $pu_ttc Prix unitaire TTC
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param type Type of line (0=product, 1=service) * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param rang Position of line * @param int $type Type of line (0=product, 1=service)
* @return int >0 if OK, <0 if KO * @param int $rang Position of line
* @see add_product * @return int >0 if OK, <0 if KO
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel *
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini * @see add_product
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) *
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/ */
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0) function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0)
{ {
@ -1097,16 +1103,18 @@ class Commande extends CommonObject
/** /**
* Add line into array * Add line into array
* $this->client doit etre charge * $this->client must be loaded
* @param idproduct Id du produit a ajouter *
* @param qty Quantite * @param int $idproduct Product Id
* @param remise_percent Remise relative effectuee sur le produit * @param double $qty Quantity
* @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param double $remise_percent Product discount relative
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @return void * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* TODO Remplacer les appels a cette fonction par generation objet Ligne * @return void
* insere dans tableau $this->products *
* TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products
*/ */
function add_product($idproduct, $qty, $remise_percent=0, $date_start='', $date_end='') function add_product($idproduct, $qty, $remise_percent=0, $date_start='', $date_end='')
{ {
@ -1175,11 +1183,12 @@ class Commande extends CommonObject
/** /**
* Get object and lines from database * Get object and lines from database
* @param id Id of object to load *
* @param ref Ref of object * @param int $id Id of object to load
* @param ref_ext External reference of object * @param string $ref Ref of object
* @param ref_int Internal reference of other object * @param string $ref_ext External reference of object
* @return int >0 if OK, <0 if KO * @param string $ref_int Internal reference of other object
* @return int >0 if OK, <0 if KO
*/ */
function fetch($id, $ref='', $ref_ext='', $ref_int='') function fetch($id, $ref='', $ref_ext='', $ref_int='')
{ {
@ -1306,9 +1315,10 @@ class Commande extends CommonObject
/** /**
* Ajout d'une ligne remise fixe dans la commande, en base * Adding line of fixed discount in the order in DB
* @param idremise Id de la remise fixe *
* @return int >0 si ok, <0 si ko * @param int $idremise Id de la remise fixe
* @return int >0 si ok, <0 si ko
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@ -1381,9 +1391,10 @@ class Commande extends CommonObject
/** /**
* Load array lines * Load array lines
* @param only_product Return only physical products *
* @return int <0 if KO, >0 if OK * @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/ */
function fetch_lines($only_product=0) function fetch_lines($only_product=0)
{ {
@ -1467,8 +1478,9 @@ class Commande extends CommonObject
/** /**
* Return number of line with type product. * Return number of line with type product.
* @return int <0 if KO, Nbr of product lines if OK *
* @return int <0 if KO, Nbr of product lines if OK
*/ */
function getNbOfProductsLines() function getNbOfProductsLines()
{ {
@ -1481,10 +1493,12 @@ class Commande extends CommonObject
} }
/** /**
* Load array this->expeditions of nb of products sent by line in order * Load array this->expeditions of nb of products sent by line in order
* @param filtre_statut Filter on status *
* @return int <0 if KO, Nb of lines found if OK * @param int $filtre_statut Filter on status
* TODO deprecated, move to Shipping class * @return int <0 if KO, Nb of lines found if OK
*
* TODO deprecated, move to Shipping class
*/ */
function loadExpeditions($filtre_statut=-1) function loadExpeditions($filtre_statut=-1)
{ {
@ -1529,7 +1543,8 @@ class Commande extends CommonObject
} }
/** /**
* Renvoie un tableau avec nombre de lignes d'expeditions * Returns a array with expeditions lines number
*
* TODO deprecated, move to Shipping class * TODO deprecated, move to Shipping class
*/ */
function nb_expedition() function nb_expedition()
@ -1551,10 +1566,12 @@ class Commande extends CommonObject
} }
/** /**
* Renvoie un tableau avec les livraisons par ligne * Return a array with sendings by line
* @param filtre_statut Filtre sur statut *
* @return int 0 si OK, <0 si KO * @param int $filtre_statut Filtre sur statut
* TODO deprecated, move to Shipping class * @return int 0 si OK, <0 si KO
*
* TODO deprecated, move to Shipping class
*/ */
function livraison_array($filtre_statut=-1) function livraison_array($filtre_statut=-1)
{ {
@ -1564,10 +1581,12 @@ class Commande extends CommonObject
} }
/** /**
* Renvoie un tableau avec les stocks restant par produit * Return a array with the pending stock by product
* @param filtre_statut Filtre sur statut *
* @return int 0 si OK, <0 si KO * @param int $filtre_statut Filtre sur statut
* TODO FONCTION NON FINIE A FINIR * @return int 0 si OK, <0 si KO
*
* TODO FONCTION NON FINIE A FINIR
*/ */
function stock_array($filtre_statut=-1) function stock_array($filtre_statut=-1)
{ {
@ -1603,8 +1622,9 @@ class Commande extends CommonObject
/** /**
* Delete an order line * Delete an order line
* @param lineid Id of line to delete *
* @return int >0 if OK, 0 if nothing to do, <0 if KO * @param int $lineid Id of line to delete
* @return int >0 if OK, 0 if nothing to do, <0 if KO
*/ */
function deleteline($lineid) function deleteline($lineid)
{ {
@ -1747,11 +1767,11 @@ class Commande extends CommonObject
/** /**
* Set the order date * Set the order date
* *
* @param user Object user making change * @param User $user Object user making change
* @param date Date * @param timestamp $date Date
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_date($user, $date) function set_date($user, $date)
{ {
@ -1782,11 +1802,11 @@ class Commande extends CommonObject
} }
/** /**
* Set the planned delivery date * Set the planned delivery date
* *
* @param user Objet utilisateur qui modifie * @param User $user Objet utilisateur qui modifie
* @param date_livraison Date de livraison * @param timestamp $date_livraison Date de livraison
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function set_date_livraison($user, $date_livraison) function set_date_livraison($user, $date_livraison)
{ {
@ -1817,11 +1837,11 @@ class Commande extends CommonObject
} }
/** /**
* Set address * Set address
* *
* @param user Object user making change * @param User $user Object user making change
* @param fk_address Adress of delivery * @param int $fk_address Adress of delivery
* @return int <0 ig KO, >0 if Ok * @return int <0 ig KO, >0 if Ok
*/ */
function set_adresse_livraison($user, $fk_address) function set_adresse_livraison($user, $fk_address)
{ {
@ -1845,11 +1865,11 @@ class Commande extends CommonObject
} }
/** /**
* Set availability * Set availability
* *
* @param user Object user making change * @param User $user Object user making change
* @param id If of availability delay * @param int $id If of availability delay
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_availability($user, $id) function set_availability($user, $id)
{ {
@ -1874,11 +1894,11 @@ class Commande extends CommonObject
} }
/** /**
* Set source of demand * Set source of demand
* *
* @param user Object user making change * @param User $user Object user making change
* @param id Id of source * @param int $id Id of source
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_demand_reason($user, $id) function set_demand_reason($user, $id)
{ {
@ -1905,9 +1925,9 @@ class Commande extends CommonObject
/** /**
* Return list of orders (eventuelly filtered on a user) into an array * Return list of orders (eventuelly filtered on a user) into an array
* *
* @param brouillon 0=non brouillon, 1=brouillon * @param int $brouillon 0=non brouillon, 1=brouillon
* @param user Objet user de filtre * @param User $user Objet user de filtre
* @return int -1 if KO, array with result if OK * @return int -1 if KO, array with result if OK
*/ */
function liste_array($brouillon=0, $user='') function liste_array($brouillon=0, $user='')
{ {
@ -1948,10 +1968,10 @@ class Commande extends CommonObject
} }
/** /**
* Change les conditions de reglement de la commande * Change les conditions de reglement de la commande
* *
* @param cond_reglement_id Id de la nouvelle condition de reglement * @param int $cond_reglement_id Id de la nouvelle condition de reglement
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function cond_reglement($cond_reglement_id) function cond_reglement($cond_reglement_id)
{ {
@ -1985,8 +2005,8 @@ class Commande extends CommonObject
/** /**
* Change le mode de reglement * Change le mode de reglement
* *
* @param mode Id du nouveau mode * @param int $mode Id du nouveau mode
* @return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
*/ */
function mode_reglement($mode_reglement_id) function mode_reglement($mode_reglement_id)
{ {
@ -2017,9 +2037,10 @@ class Commande extends CommonObject
} }
/** /**
* Change le delai de livraison * Change le delai de livraison
* @param availability_id Id du nouveau mode *
* @return int >0 if OK, <0 if KO * @param int $availability_id Id du nouveau mode
* @return int >0 if OK, <0 if KO
*/ */
function availability($availability_id) function availability($availability_id)
{ {
@ -2050,9 +2071,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Change la source de la demande * Change la source de la demande
* \param mode Id du nouveau mode *
* \return int >0 si ok, <0 si ko * @param int $demand_reason_id Id of new demand
* @return int >0 if ok, <0 if ko
*/ */
function demand_reason($demand_reason_id) function demand_reason($demand_reason_id)
{ {
@ -2083,10 +2105,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Set customer ref * Set customer ref
* \param user User that make change * @param User $user User that make change
* \param ref_client Customer ref * @param string $ref_client Customer ref
* \return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_ref_client($user, $ref_client) function set_ref_client($user, $ref_client)
{ {
@ -2118,8 +2140,9 @@ class Commande extends CommonObject
/** /**
* \brief Classe la commande comme facturee * Classify the order as invoiced
* \return int <0 si ko, >0 si ok *
* @return int <0 if ko, >0 if ok
*/ */
function classer_facturee() function classer_facturee()
{ {
@ -2148,20 +2171,20 @@ class Commande extends CommonObject
/** /**
* Update a line in database * Update a line in database
* *
* @param rowid Id of line to update * @param int $rowid Id of line to update
* @param desc Description de la ligne * @param string $desc Description de la ligne
* @param pu Prix unitaire * @param double $pu Prix unitaire
* @param qty Quantity * @param double $qty Quantity
* @param remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param tva_tx Taux TVA * @param double $tva_tx Taux TVA
* @param txlocaltax1 Local tax 1 rate * @param double $txlocaltax1 Local tax 1 rate
* @param txlocaltax2 Local tax 2 rate * @param double $txlocaltax2 Local tax 2 rate
* @param price_base_type HT or TTC * @param string $price_base_type HT or TTC
* @param info_bits Miscellaneous informations on line * @param int $info_bits Miscellaneous informations on line
* @param date_start Start date of the line * @param timestamp $date_start Start date of the line
* @param date_end End date of the line * @param timestamp $date_end End date of the line
* @param type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
{ {
@ -2379,10 +2402,10 @@ class Commande extends CommonObject
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param user Objet user * @param User $user Object user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_board($user) function load_board($user)
{ {
@ -2423,8 +2446,9 @@ class Commande extends CommonObject
} }
/** /**
* \brief Return source label of order * Return source label of order
* \return string Label *
* @return string Label
*/ */
function getLabelSource() function getLabelSource()
{ {
@ -2437,9 +2461,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Retourne le libelle du statut de la commande * Return status label of Order
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto *
* \return string Libelle * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/ */
function getLibStatut($mode) function getLibStatut($mode)
{ {
@ -2447,11 +2472,12 @@ class Commande extends CommonObject
} }
/** /**
* Renvoi le libelle d'un statut donne * Return label of status
* @param statut Id statut *
* @param facturee Si facturee * @param int $statut Id statut
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $facturee if invoiced
* @return string Label of status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/ */
function LibStatut($statut,$facturee,$mode) function LibStatut($statut,$facturee,$mode)
{ {
@ -2515,12 +2541,13 @@ class Commande extends CommonObject
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* @param withpicto Add picto into link *
* @param option Where point the link * @param int $withpicto Add picto into link
* @param max Max length to show * @param int $option Where point the link
* @param short Use short labels * @param int $max Max length to show
* @return string String with URL * @param int $short Use short labels
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
{ {
@ -2547,8 +2574,9 @@ class Commande extends CommonObject
/** /**
* \brief Charge les informations d'ordre info dans l'objet commande * Charge les informations d'ordre info dans l'objet commande
* \param id Id de la commande a charger *
* @param int $id Id of order
*/ */
function info($id) function info($id)
{ {
@ -2687,9 +2715,9 @@ class Commande extends CommonObject
/** /**
* 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 si ko, >0 si ok
*/ */
function load_state_board() function load_state_board()
{ {
@ -2728,6 +2756,8 @@ class Commande extends CommonObject
/** /**
* Return an array of order lines * Return an array of order lines
*
* @return array Lines of order
*/ */
function getLinesArray() function getLinesArray()
{ {
@ -2851,7 +2881,7 @@ class OrderLine
/** /**
* Constructor * Constructor
* *
* @param DB handler d'acces base de donnee * @param DoliDB $DB handler d'acces base de donnee
*/ */
function OrderLine($DB) function OrderLine($DB)
{ {
@ -2955,10 +2985,10 @@ class OrderLine
} }
/** /**
* Insert line into database * Insert line into database
* *
* @param notrigger 1 = disable triggers * @param int $notrigger 1 = disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger=0) function insert($notrigger=0)
{ {
@ -3055,9 +3085,10 @@ class OrderLine
} }
/** /**
* Mise a jour de l'objet ligne de commande en base * Update the line object into db
* *
* @return int <0 si ko, >0 si ok * @param int $notrigger 1 = disable triggers
* @return int <0 si ko, >0 si ok
*/ */
function update($notrigger=0) function update($notrigger=0)
{ {
@ -3137,9 +3168,9 @@ class OrderLine
} }
/** /**
* Mise a jour de l'objet ligne de commande en base * Update totals of order into database
* *
* @return int <0 si ko, >0 si ok * @return int <0 if ko, >0 if ok
*/ */
function update_total() function update_total()
{ {