Qual: Uniformize code

This commit is contained in:
Juanjo Menent 2011-12-14 18:09:34 +01:00
parent c701eacbce
commit e652674784

View File

@ -116,10 +116,11 @@ class Propal extends CommonObject
/** /**
* \brief Constructeur * Class Constructor
* \param DB Database handler *
* \param socid Id third party * @param DoliDB $DB Database handler
* \param propalid Id proposal * @param int $socid Id third party
* @param int $propalid Id proposal
*/ */
function Propal($DB, $socid="", $propalid=0) function Propal($DB, $socid="", $propalid=0)
{ {
@ -152,9 +153,11 @@ class Propal extends CommonObject
/** /**
* Add line into array products * Add line into array products
* $this->client doit etre charge * $this->client doit etre charge
* @param idproduct Id du produit a ajouter *
* @param qty Quantity * @param int $idproduct Product Id to add
* @param remise_percent Remise relative effectuee sur le produit * @param int $qty Quantity
* @param int $remise_percent Discount effected on Product
*
* TODO Remplacer les appels a cette fonction par generation objet Ligne * TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products * insere dans tableau $this->products
*/ */
@ -201,9 +204,10 @@ class Propal extends CommonObject
} }
/** /**
* \brief Ajout d'une ligne remise fixe dans la proposition, en base * Adding line of fixed discount in the proposal in DB
* \param idremise Id de la remise fixe *
* \return int >0 si ok, <0 si ko * @param int @idremise Id of fixed discount
* @return int >0 si ok, <0 si ko
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@ -282,23 +286,24 @@ class Propal extends CommonObject
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit) * 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) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
* *
* @param propalid Id de la propale * @param int $propalid Id de la propale
* @param desc Description de la ligne * @param string $desc Description de la ligne
* @param pu_ht Prix unitaire * @param double $pu_ht Prix unitaire
* @param qty Quantite * @param double $qty Quantite
* @param txtva Taux de tva * @param double $txtva Taux de 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 fk_product Id du produit/service predefini * @param int $fk_product Id du produit/service predefini
* @param remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param price_base_type HT or TTC * @param double $price_base_type HT or TTC
* @param pu_ttc Prix unitaire TTC * @param dobule $pu_ttc Prix unitaire TTC
* @param info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param type Type of line (product, service) * @param int $type Type of line (product, service)
* @param rang Position of line * @param int $rang Position of line
* @param special_code Special code * @param int $special_code Special code
* @param fk_parent_line Id of parent line * @param int $fk_parent_line Id of parent line
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*
* @see add_product * @see add_product
*/ */
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0) function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0)
@ -432,20 +437,20 @@ class Propal extends CommonObject
/** /**
* Update a proposal line * Update a proposal line
* *
* @param rowid Id de la ligne * @param int $rowid Id de la ligne
* @param pu Prix unitaire (HT ou TTC selon price_base_type) * @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
* @param qty Quantity * @param double $qty Quantity
* @param remise_percent Remise effectuee sur le produit * @param double $remise_percent Remise effectuee sur le produit
* @param txtva Taux de TVA * @param double $txtva Taux de 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 desc Description * @param string $desc Description
* @param price_base_type HT ou TTC * @param double $price_base_type HT ou TTC
* @param info_bits Miscellanous informations * @param int $info_bits Miscellanous informations
* @param special_code Set special code ('' = we don't change it) * @param int $special_code Set special code ('' = we don't change it)
* @param fk_parent_line Id of line parent * @param int $fk_parent_line Id of line parent
* @param skip_update_total Skip update total * @param int $skip_update_total Skip update total
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0) function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0)
{ {
@ -555,7 +560,7 @@ class Propal extends CommonObject
/** /**
* Supprime une ligne de detail * Delete detail line
* *
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
@ -592,7 +597,7 @@ class Propal extends CommonObject
* this->ref can be set or empty. If empty, we will use "(PROVid)" * this->ref can be set or empty. If empty, we will use "(PROVid)"
* *
* @param User $user User that create * @param User $user User that create
* @param int $notrigger Disable trigger * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function create($user='', $notrigger=0) function create($user='', $notrigger=0)
@ -822,9 +827,10 @@ class Propal extends CommonObject
/** /**
* \brief Insert en base un objet propal completement definie par ses donnees membres (resultant d'une copie par exemple). * Insert into DB a proposal object completely defined by its data members (ex, results from copy).
* \return int l'id du nouvel objet propal en base si ok, <0 si ko * @param User $user User that create
* \see create * @return int Id of the new object if ok, <0 if ko
* @see create
*/ */
function create_from($user) function create_from($user)
{ {
@ -933,10 +939,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Load a proposal from database and its ligne array * Load a proposal from database and its ligne array
* \param rowid id of object to load *
* \param ref Ref of proposal * @param int $rowid id of object to load
* \return int >0 if OK, <0 if KO * @param string $ref Ref of proposal
* @return int >0 if OK, <0 if KO
*/ */
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
@ -1128,6 +1135,7 @@ class Propal extends CommonObject
* Set status to validated * Set status to validated
* *
* @param User $user Object user that validate * @param User $user Object user that validate
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function valid($user, $notrigger=0) function valid($user, $notrigger=0)
@ -1213,10 +1221,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Define end validity date * Define end validity date
* \param user Object user that modify *
* \param date_fin_validite End of validity date * @param User $user Object user that modify
* \return int <0 if KO, >0 if OK * @param timestamp $date_fin_validite End of validity date
* @return int <0 if KO, >0 if OK
*/ */
function set_echeance($user, $date_fin_validite) function set_echeance($user, $date_fin_validite)
{ {
@ -1239,10 +1248,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Set delivery date * Set delivery date
* \param user Objet utilisateur qui modifie *
* \param date_livraison date de livraison * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param timestamp $date_livraison Delivery date
* @return int <0 if ko, >0 if ok
*/ */
function set_date_livraison($user, $date_livraison) function set_date_livraison($user, $date_livraison)
{ {
@ -1267,10 +1277,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Define delivery address * Define delivery address
* \param user Objet utilisateur qui modifie *
* \param fk_address Delivery address id * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param int $fk_address Delivery address id
* @return int <0 si ko, >0 si ok
*/ */
function set_adresse_livraison($user, $fk_address) function set_adresse_livraison($user, $fk_address)
{ {
@ -1296,7 +1307,7 @@ class Propal extends CommonObject
/** /**
* Set delivery * Set delivery
* *
* @param User $user Objet utilisateur qui modifie * @param User $user Object user that modify
* @param int $id Availability id * @param int $id Availability id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -1325,7 +1336,7 @@ class Propal extends CommonObject
/** /**
* Set source of demand * Set source of demand
* *
* @param User $user Objet utilisateur qui modifie * @param User $user Object user that modify
* @param int $id Input reason id * @param int $id Input reason id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -1352,11 +1363,11 @@ class Propal extends CommonObject
} }
/** /**
* Positionne numero reference client * Set customer reference number
* *
* @param user Utilisateur qui modifie * @param User $user Object user that modify
* @param ref_client Reference client * @param string $ref_client Customer reference
* @return int <0 si ko, >0 si ok * @return int <0 if ko, >0 if ok
*/ */
function set_ref_client($user, $ref_client) function set_ref_client($user, $ref_client)
{ {
@ -1385,10 +1396,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Definit une remise globale relative sur la proposition * Set an overall discount on the proposal
* \param user Objet utilisateur qui modifie *
* \param remise Montant remise * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/ */
function set_remise_percent($user, $remise) function set_remise_percent($user, $remise)
{ {
@ -1418,10 +1430,11 @@ class Propal extends CommonObject
/** /**
* \brief Definit une remise globale absolue sur la proposition * Set an absolute overall discount on the proposal
* \param user Objet utilisateur qui modifie *
* \param remise Montant remise * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/ */
function set_remise_absolue($user, $remise) function set_remise_absolue($user, $remise)
{ {
@ -1452,11 +1465,11 @@ class Propal extends CommonObject
/** /**
* \brief Cloture de la proposition commerciale * Closure of the commercial proposal
* \param user Utilisateur qui cloture * @param User $user Object user that closure
* \param statut Statut * @param int $statut Statut
* \param note Commentaire * @param text $note Commentaire
* \return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function cloture($user, $statut, $note) function cloture($user, $statut, $note)
{ {
@ -1517,8 +1530,9 @@ class Propal extends CommonObject
} }
/** /**
* \brief Classe la propale comme facturee * Class invoiced the Propal
* \return int <0 si ko, >0 si ok *
* @return int <0 si ko, >0 si ok
*/ */
function classer_facturee() function classer_facturee()
{ {
@ -1535,10 +1549,10 @@ class Propal extends CommonObject
} }
/** /**
* Set draft status * Set draft status
* *
* @param User $user Object user that modify * @param User $user Object user that modify
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_draft($user) function set_draft($user)
{ {
@ -1561,15 +1575,15 @@ class Propal extends CommonObject
/** /**
* Return list of proposal (eventually filtered on user) into an array * Return list of proposal (eventually filtered on user) into an array
* *
* @param shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref) * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref)
* @param draft 0=not draft, 1=draft * @param int $draft 0=not draft, 1=draft
* @param notcurrentuser 0=current user, 1=not current user * @param int $notcurrentuser 0=current user, 1=not current user
* @param socid Id third pary * @param int $socid Id third pary
* @param limit For pagination * @param int $limit For pagination
* @param offset For pagination * @param int $offset For pagination
* @param sortfield Sort criteria * @param string $sortfield Sort criteria
* @param sortorder Sort order * @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK * @return int -1 if KO, array with result if OK
*/ */
function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC')
{ {
@ -1623,9 +1637,9 @@ class Propal extends CommonObject
} }
/** /**
* Renvoie un tableau contenant les numeros de factures associees * Returns an array with the numbers of related invoices
* *
* @return array Tableau des id de factures * @return array Array of invoices
*/ */
function getInvoiceArrayList() function getInvoiceArrayList()
{ {
@ -1633,7 +1647,7 @@ class Propal extends CommonObject
} }
/** /**
* Renvoie un tableau contenant les id et ref des factures associees * Returns an array with id and ref of related invoices
* *
* @param int $id Id propal * @param int $id Id propal
* @return array Array of invoices id * @return array Array of invoices id
@ -1715,8 +1729,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Efface propal * Delete proposal
* \param user Objet du user qui efface *
* @param User $user Object user that delete
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int 1 if ok, otherwise if error
*/ */
function delete($user, $notrigger=0) function delete($user, $notrigger=0)
{ {
@ -1808,10 +1825,10 @@ class Propal extends CommonObject
/** /**
* Change les conditions de reglement de la facture * Change the payments conditions of the invoice
* *
* @param cond_reglement_id Id de la nouvelle condition de reglement * @param int $cond_reglement_id Id of new payment condition
* @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)
{ {
@ -1843,10 +1860,10 @@ class Propal extends CommonObject
/** /**
* Change le mode de reglement * Change the payment mode
* *
* @param mode_reglement_id Id du nouveau mode * @param int $mode_reglement_id Id of new payment mode
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function mode_reglement($mode_reglement_id) function mode_reglement($mode_reglement_id)
{ {
@ -1877,10 +1894,10 @@ class Propal extends CommonObject
} }
/** /**
* Change le delai de livraison * Change the delivery time
* *
* @param availability_id Id du nouveau delai de livraison * @param int $availability_id Id of new delivery time
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function availability($availability_id) function availability($availability_id)
{ {
@ -1911,9 +1928,10 @@ class Propal extends CommonObject
} }
/** /**
* \brief Change l'origine de la demande * Change source demand
* \param demand_reason_id Id de la nouvelle origine de demande *
* \return int >0 si ok, <0 si ko * @param int $demand_reason_id Id of new source demand
* @return int >0 si ok, <0 si ko
*/ */
function demand_reason($demand_reason_id) function demand_reason($demand_reason_id)
{ {
@ -1945,8 +1963,9 @@ class Propal extends CommonObject
/** /**
* \brief Information sur l'objet propal * Object Proposal Information
* \param id id de la propale *
* @param int $id Proposal id
*/ */
function info($id) function info($id)
{ {
@ -2002,7 +2021,8 @@ class Propal extends CommonObject
/** /**
* Return label of status of proposal (draft, validated, ...) * Return label of status of proposal (draft, validated, ...)
* @param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto *
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
@ -2012,8 +2032,9 @@ class Propal extends CommonObject
/** /**
* Return label of a status (draft, validated, ...) * Return label of a status (draft, validated, ...)
* @param statut id statut *
* @param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $statut id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut,$mode=1) function LibStatut($statut,$mode=1)
@ -2066,9 +2087,10 @@ class Propal 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 mode "opened" pour propal a fermer, "signed" pour propale a facturer * @param User $user Object user
* @return int <0 if KO, >0 if OK * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return int <0 if KO, >0 if OK
*/ */
function load_board($user,$mode) function load_board($user,$mode)
{ {
@ -2213,7 +2235,7 @@ class Propal 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 if ko, >0 if ok
*/ */
function load_state_board() function load_state_board()
{ {
@ -2252,8 +2274,8 @@ class Propal extends CommonObject
/** /**
* Renvoie la reference de propale suivante non utilisee en fonction du module * Returns the reference to the following non used Proposal used depending on the active numbering module
* de numerotation actif defini dans PROPALE_ADDON * defined into PROPALE_ADDON
* *
* @param Societe $soc Object thirdparty * @param Societe $soc Object thirdparty
* @return string Reference libre pour la propale * @return string Reference libre pour la propale
@ -2298,11 +2320,12 @@ class Propal 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 get_params Parametres added to url * @param string $option Where point the link
* @return string String with URL * @param string $get_params Parametres added to url
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='')
{ {
@ -2333,7 +2356,9 @@ class Propal extends CommonObject
} }
/** /**
* Return an array of propal lines * Retrieve an array of propal lines
*
* @return int <0 if ko, >0 if ok
*/ */
function getLinesArray() function getLinesArray()
{ {
@ -2459,8 +2484,9 @@ class PropaleLigne
var $skip_update_total; // Skip update price total for special lines var $skip_update_total; // Skip update price total for special lines
/** /**
* \brief Constructeur d'objets ligne de propal * Class line Contructor
* \param DB handler d'acces base de donnee *
* @param DoliDB $DB Database handler
*/ */
function PropaleLigne($DB) function PropaleLigne($DB)
{ {
@ -2468,8 +2494,9 @@ class PropaleLigne
} }
/** /**
* \brief Recupere l'objet ligne de propal * Retrieve the propal line object
* \param rowid id de la ligne de propal *
* @param int $rowid propal line id
*/ */
function fetch($rowid) function fetch($rowid)
{ {
@ -2525,7 +2552,7 @@ class PropaleLigne
/** /**
* Insert object line propal in database * Insert object line propal in database
* *
* @param int $notrigger 1=no trigger ran * @param int $notrigger 1=Does not execute triggers, 0= execuete 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)
@ -2615,7 +2642,7 @@ class PropaleLigne
/** /**
* Delete line in database * Delete line in database
* @return int <0 si ko, >0 si ok * @return int <0 if ko, >0 if ok
*/ */
function delete() function delete()
{ {
@ -2649,9 +2676,10 @@ class PropaleLigne
} }
/** /**
* Mise a jour de l'objet ligne de propale en base * Update propal line object into DB
* *
* @return int <0 si ko, >0 si ok * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if ko, >0 if ok
*/ */
function update($notrigger=0) function update($notrigger=0)
{ {
@ -2728,9 +2756,10 @@ class PropaleLigne
} }
/** /**
* \brief Mise a jour en base des champs total_xxx de ligne * Update DB line fields total_xxx
* \remarks Utilise par migration * Used by migration
* \return int <0 si ko, >0 si ok *
* @return int <0 if ko, >0 if ok
*/ */
function update_total() function update_total()
{ {