start changing phpcs:ignore

This commit is contained in:
Frédéric FRANCE 2018-09-01 23:46:13 +02:00
parent c3438b79c8
commit 3e723af018
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
12 changed files with 235 additions and 134 deletions

View File

@ -232,9 +232,10 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Add line into array products * Add line into array products
* $this->thirdparty should be loaded * $this->thirdparty should be loaded
* *
* @param int $idproduct Product Id to add * @param int $idproduct Product Id to add
* @param int $qty Quantity * @param int $qty Quantity
@ -244,9 +245,9 @@ class Propal extends CommonObject
* TODO Replace calls to this function by generation objet Ligne * TODO Replace calls to this function by generation objet Ligne
* inserted into table $this->products * inserted into table $this->products
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function add_product($idproduct, $qty, $remise_percent=0) function add_product($idproduct, $qty, $remise_percent=0)
{ {
// phpcs:enable
global $conf, $mysoc; global $conf, $mysoc;
if (! $qty) $qty = 1; if (! $qty) $qty = 1;
@ -293,15 +294,16 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Adding line of fixed discount in the proposal in DB * Adding line of fixed discount in the proposal in DB
* *
* @param int $idremise Id of fixed discount * @param int $idremise Id of fixed discount
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function insert_discount($idremise) function insert_discount($idremise)
{ {
// phpcs:enable
global $langs; global $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -1172,6 +1174,7 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Insert into DB a proposal object completely defined by its data members (ex, results from copy). * Insert into DB a proposal object completely defined by its data members (ex, results from copy).
* *
@ -1179,9 +1182,9 @@ class Propal extends CommonObject
* @return int Id of the new object if ok, <0 if ko * @return int Id of the new object if ok, <0 if ko
* @see create * @see create
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function create_from($user) function create_from($user)
{ {
// phpcs:enable
// i love this function because $this->products is not used in create function... // i love this function because $this->products is not used in create function...
$this->products=$this->lines; $this->products=$this->lines;
@ -1564,15 +1567,16 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load array lines * Load array lines
* *
* @param int $only_product Return only physical products * @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_lines($only_product=0) function fetch_lines($only_product=0)
{ {
// phpcs:enable
$this->lines=array(); $this->lines=array();
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
@ -1803,6 +1807,7 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Define proposal date * Define proposal date
* *
@ -1811,9 +1816,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_date($user, $date, $notrigger=0) function set_date($user, $date, $notrigger=0)
{ {
// phpcs:enable
if (empty($date)) if (empty($date))
{ {
$this->error='ErrorBadParameter'; $this->error='ErrorBadParameter';
@ -1871,6 +1876,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Define end validity date * Define end validity date
* *
@ -1879,9 +1885,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_echeance($user, $date_fin_validite, $notrigger=0) function set_echeance($user, $date_fin_validite, $notrigger=0)
{ {
// phpcs:enable
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
{ {
$error=0; $error=0;
@ -1932,6 +1938,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set delivery date * Set delivery date
* *
@ -1940,9 +1947,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_date_livraison($user, $date_livraison, $notrigger=0) function set_date_livraison($user, $date_livraison, $notrigger=0)
{ {
// phpcs:enable
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
{ {
$error=0; $error=0;
@ -1993,6 +2000,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set delivery * Set delivery
* *
@ -2001,9 +2009,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_availability($user, $id, $notrigger=0) function set_availability($user, $id, $notrigger=0)
{ {
// phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
{ {
$error=0; $error=0;
@ -2063,6 +2071,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set source of demand * Set source of demand
* *
@ -2071,9 +2080,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_demand_reason($user, $id, $notrigger=0) function set_demand_reason($user, $id, $notrigger=0)
{ {
// phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
{ {
$error=0; $error=0;
@ -2135,6 +2144,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set customer reference number * Set customer reference number
* *
@ -2143,9 +2153,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_ref_client($user, $ref_client, $notrigger=0) function set_ref_client($user, $ref_client, $notrigger=0)
{ {
// phpcs:enable
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
{ {
$error=0; $error=0;
@ -2199,6 +2209,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set an overall discount on the proposal * Set an overall discount on the proposal
* *
@ -2207,9 +2218,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_remise_percent($user, $remise, $notrigger=0) function set_remise_percent($user, $remise, $notrigger=0)
{ {
// phpcs:enable
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
@ -2265,6 +2276,7 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set an absolute overall discount on the proposal * Set an absolute overall discount on the proposal
* *
@ -2273,9 +2285,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_remise_absolue($user, $remise, $notrigger=0) function set_remise_absolue($user, $remise, $notrigger=0)
{ {
// phpcs:enable
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
@ -2550,6 +2562,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@ -2557,9 +2570,9 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_draft($user, $notrigger=0) function set_draft($user, $notrigger=0)
{ {
// phpcs:enable
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
@ -2608,6 +2621,7 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return list of proposal (eventually filtered on user) into an array * Return list of proposal (eventually filtered on user) into an array
* *
@ -2621,9 +2635,9 @@ class Propal extends CommonObject
* @param string $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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
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')
{ {
// phpcs:enable
global $user; global $user;
$ga = array(); $ga = array();
@ -2695,15 +2709,16 @@ class Propal extends CommonObject
return $this->InvoiceArrayList($this->id); return $this->InvoiceArrayList($this->id);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Returns an array with id and ref of related invoices * 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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function InvoiceArrayList($id) function InvoiceArrayList($id)
{ {
// phpcs:enable
$ga = array(); $ga = array();
$linkedInvoices = array(); $linkedInvoices = array();
@ -2974,6 +2989,7 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Change source demand * Change source demand
* *
@ -2982,9 +2998,9 @@ class Propal extends CommonObject
* @return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
* @deprecated use set_demand_reason * @deprecated use set_demand_reason
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function demand_reason($demand_reason_id, $notrigger=0) function demand_reason($demand_reason_id, $notrigger=0)
{ {
// phpcs:enable
global $user; global $user;
if ($this->statut >= self::STATUS_DRAFT) if ($this->statut >= self::STATUS_DRAFT)
@ -3115,6 +3131,7 @@ class Propal extends CommonObject
return $this->LibStatut($this->statut, $mode); return $this->LibStatut($this->statut, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return label of a status (draft, validated, ...) * Return label of a status (draft, validated, ...)
* *
@ -3122,9 +3139,9 @@ class Propal extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long 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, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($statut,$mode=1) function LibStatut($statut,$mode=1)
{ {
// phpcs:enable
global $conf; global $conf;
// Init/load array of translation of status // Init/load array of translation of status
@ -3158,9 +3175,10 @@ class Propal extends CommonObject
if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut];
if ($mode == 5) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans); if ($mode == 5) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans);
if ($mode == 6) return '<span class="hideonsmartphone">'.$this->labelstatut[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans); if ($mode == 6) return '<span class="hideonsmartphone">'.$this->labelstatut[$statut].' </span>'.img_picto($this->labelstatut[$statut],$statuttrans);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
@ -3168,9 +3186,9 @@ class Propal extends CommonObject
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_board($user,$mode) function load_board($user,$mode)
{ {
// phpcs:enable
global $conf, $langs; global $conf, $langs;
$clause = " WHERE"; $clause = " WHERE";
@ -3336,14 +3354,15 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge indicateurs this->nb de tableau de bord * Charge indicateurs this->nb de tableau de bord
* *
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_state_board() function load_state_board()
{ {
// phpcs:enable
global $user; global $user;
$this->nb=array(); $this->nb=array();
@ -4223,15 +4242,16 @@ class PropaleLigne extends CommonObjectLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Update DB line fields total_xxx * Update DB line fields total_xxx
* Used by migration * Used by migration
* *
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_total() function update_total()
{ {
// phpcs:enable
$this->db->begin(); $this->db->begin();
// Mise a jour ligne en base // Mise a jour ligne en base

View File

@ -236,6 +236,7 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Activate a contract line * Activate a contract line
* *
@ -246,9 +247,9 @@ class Contrat extends CommonObject
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function active_line($user, $line_id, $date, $date_end='', $comment='') function active_line($user, $line_id, $date, $date_end='', $comment='')
{ {
// phpcs:enable
$result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
if ($result < 0) if ($result < 0)
{ {
@ -259,6 +260,7 @@ class Contrat extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Close a contract line * Close a contract line
* *
@ -268,9 +270,9 @@ class Contrat extends CommonObject
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function close_line($user, $line_id, $date_end, $comment='') function close_line($user, $line_id, $date_end, $comment='')
{ {
// phpcs:enable
$result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
if ($result < 0) if ($result < 0)
{ {
@ -702,15 +704,16 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load lines array into this->lines. * Load lines array into this->lines.
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed * This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
* *
* @return ContratLigne[] Return array of contract lines * @return ContratLigne[] Return array of contract lines
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_lines() function fetch_lines()
{ {
// phpcs:enable
$this->nbofserviceswait=0; $this->nbofserviceswait=0;
$this->nbofservicesopened=0; $this->nbofservicesopened=0;
$this->nbofservicesexpired=0; $this->nbofservicesexpired=0;
@ -1780,6 +1783,7 @@ class Contrat extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Update statut of contract according to services * Update statut of contract according to services
* *
@ -1787,9 +1791,9 @@ class Contrat extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @deprecated This function will never be used. Status of a contract is status of its lines. * @deprecated This function will never be used. Status of a contract is status of its lines.
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_statut($user) function update_statut($user)
{ {
// phpcs:enable
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
// If draft, we keep it (should not happen) // If draft, we keep it (should not happen)
@ -1819,6 +1823,7 @@ class Contrat extends CommonObject
return $this->LibStatut($this->statut,$mode); return $this->LibStatut($this->statut,$mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Renvoi label of a given contrat status * Renvoi label of a given contrat status
* *
@ -1826,9 +1831,9 @@ class Contrat extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
* @return string Label * @return string Label
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($statut,$mode) function LibStatut($statut,$mode)
{ {
// phpcs:enable
global $langs; global $langs;
$langs->load("contracts"); $langs->load("contracts");
if ($mode == 0) if ($mode == 0)
@ -2002,15 +2007,16 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return list of line rowid * Return list of line rowid
* *
* @param int $statut Status of lines to get * @param int $statut Status of lines to get
* @return array Array of line's rowid * @return array Array of line's rowid
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function array_detail($statut=-1) function array_detail($statut=-1)
{ {
// phpcs:enable
$tab=array(); $tab=array();
$sql = "SELECT cd.rowid"; $sql = "SELECT cd.rowid";
@ -2078,6 +2084,7 @@ class Contrat extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
@ -2085,9 +2092,9 @@ class Contrat extends CommonObject
* @param string $mode "inactive" pour services a activer, "expired" pour services expires * @param string $mode "inactive" pour services a activer, "expired" pour services expires
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_board($user,$mode) function load_board($user,$mode)
{ {
// phpcs:enable
global $conf, $langs; global $conf, $langs;
$this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c";
@ -2157,14 +2164,15 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* 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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_state_board() function load_state_board()
{ {
// phpcs:enable
global $conf, $user; global $conf, $user;
$this->nb=array(); $this->nb=array();
@ -2580,6 +2588,7 @@ class ContratLigne extends CommonObjectLine
return $this->LibStatut($this->statut,$mode,((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1)); return $this->LibStatut($this->statut,$mode,((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1));
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return label of a contract line status * Return label of a contract line status
* *
@ -2589,9 +2598,9 @@ class ContratLigne extends CommonObjectLine
* @param string $moreatt More attribute * @param string $moreatt More attribute
* @return string Libelle * @return string Libelle
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
static function LibStatut($statut,$mode,$expired=-1,$moreatt='') static function LibStatut($statut,$mode,$expired=-1,$moreatt='')
{ {
// phpcs:enable
global $langs; global $langs;
$langs->load("contracts"); $langs->load("contracts");
if ($mode == 0) if ($mode == 0)
@ -3003,15 +3012,16 @@ class ContratLigne extends CommonObjectLine
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Mise a jour en base des champs total_xxx de ligne * Mise a jour en base des champs total_xxx de ligne
* Used by migration process * Used by migration process
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_total() function update_total()
{ {
// phpcs:enable
$this->db->begin(); $this->db->begin();
// Mise a jour ligne en base // Mise a jour ligne en base
@ -3120,6 +3130,7 @@ class ContratLigne extends CommonObjectLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Activate a contract line * Activate a contract line
* *
@ -3129,9 +3140,9 @@ class ContratLigne extends CommonObjectLine
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function active_line($user, $date, $date_end = '', $comment = '') function active_line($user, $date, $date_end = '', $comment = '')
{ {
// phpcs:enable
global $langs, $conf; global $langs, $conf;
$error = 0; $error = 0;
@ -3178,6 +3189,7 @@ class ContratLigne extends CommonObjectLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Close a contract line * Close a contract line
* *
@ -3187,9 +3199,9 @@ class ContratLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function close_line($user, $date_end, $comment = '', $notrigger=0) function close_line($user, $date_end, $comment = '', $notrigger=0)
{ {
// phpcs:enable
global $langs, $conf; global $langs, $conf;
// Update object // Update object

View File

@ -368,6 +368,7 @@ class Cronjob extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
@ -380,10 +381,10 @@ class Cronjob extends CommonObject
* @param int $processing Processing or not * @param int $processing Processing or not
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='', $processing=-1) function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='', $processing=-1)
{ {
global $langs; // phpcs:enable
global $langs;
$this->lines=array(); $this->lines=array();
@ -920,6 +921,7 @@ class Cronjob extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Run a job. * Run a job.
* Once job is finished, status and nb of run is updated. * Once job is finished, status and nb of run is updated.
@ -928,9 +930,9 @@ class Cronjob extends CommonObject
* @param string $userlogin User login * @param string $userlogin User login
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function run_jobs($userlogin) function run_jobs($userlogin)
{ {
// phpcs:enable
global $langs, $conf; global $langs, $conf;
$now=dol_now(); $now=dol_now();
@ -1191,6 +1193,7 @@ class Cronjob extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Reprogram a job * Reprogram a job
* *
@ -1198,9 +1201,9 @@ class Cronjob extends CommonObject
* @param timestamp $now Date returned by dol_now() * @param timestamp $now Date returned by dol_now()
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function reprogram_jobs($userlogin, $now) function reprogram_jobs($userlogin, $now)
{ {
// phpcs:enable
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG); dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
@ -1279,6 +1282,7 @@ class Cronjob extends CommonObject
return $this->LibStatut($this->status,$mode); return $this->LibStatut($this->status,$mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@ -1286,10 +1290,10 @@ class Cronjob extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @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 * @return string Label of status
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($status,$mode=0) function LibStatut($status,$mode=0)
{ {
global $langs; // phpcs:enable
global $langs;
$langs->load('users'); $langs->load('users');
if ($mode == 0) if ($mode == 0)

View File

@ -48,14 +48,14 @@ class Expedition extends CommonObject
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element="shipping"; public $element="shipping";
public $fk_element="fk_expedition"; public $fk_element="fk_expedition";
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element="expedition"; public $table_element="expedition";
public $table_element_line="expeditiondet"; public $table_element_line="expeditiondet";
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'sending'; public $picto = 'sending';
@ -380,6 +380,7 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Create a expedition line * Create a expedition line
* *
@ -389,9 +390,9 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @return int <0 if KO, line_id if OK * @return int <0 if KO, line_id if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0)
{ {
//phpcs:enable
$expeditionline = new ExpeditionLigne($this->db); $expeditionline = new ExpeditionLigne($this->db);
$expeditionline->fk_expedition = $this->id; $expeditionline->fk_expedition = $this->id;
$expeditionline->entrepot_id = $entrepot_id; $expeditionline->entrepot_id = $entrepot_id;
@ -407,6 +408,7 @@ class Expedition extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Create the detail (eat-by date) of the expedition line * Create the detail (eat-by date) of the expedition line
* *
@ -414,9 +416,9 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function create_line_batch($line_ext,$array_options=0) function create_line_batch($line_ext,$array_options=0)
{ {
// phpcs:enable
$error = 0; $error = 0;
$stockLocationQty = array(); // associated array with batch qty in stock location $stockLocationQty = array(); // associated array with batch qty in stock location
@ -478,7 +480,7 @@ class Expedition extends CommonObject
$sql.= ", e.note_private, e.note_public"; $sql.= ", e.note_private, e.note_public";
$sql.= ', e.fk_incoterms, e.location_incoterms'; $sql.= ', e.fk_incoterms, e.location_incoterms';
$sql.= ', i.libelle as libelle_incoterms'; $sql.= ', i.libelle as libelle_incoterms';
$sql.= ', s.libelle as shipping_method'; $sql.= ', s.libelle as shipping_method';
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
@ -807,15 +809,16 @@ class Expedition extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Create a delivery receipt from a shipment * Create a delivery receipt from a shipment
* *
* @param User $user User * @param User $user User
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function create_delivery($user) function create_delivery($user)
{ {
// phpcs:enable
global $conf; global $conf;
if ($conf->livraison_bon->enabled) if ($conf->livraison_bon->enabled)
@ -915,6 +918,7 @@ class Expedition extends CommonObject
$this->lines[$num] = $line; $this->lines[$num] = $line;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Add a shipment line with batch record * Add a shipment line with batch record
* *
@ -922,9 +926,9 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function addline_batch($dbatch,$array_options=0) function addline_batch($dbatch,$array_options=0)
{ {
// phpcs:enable
global $conf,$langs; global $conf,$langs;
$num = count($this->lines); $num = count($this->lines);
@ -1303,14 +1307,15 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load lines * Load lines
* *
* @return int >0 if OK, Otherwise if KO * @return int >0 if OK, Otherwise if KO
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_lines() function fetch_lines()
{ {
// phpcs:enable
global $conf, $mysoc; global $conf, $mysoc;
// TODO: recuperer les champs du document associe a part // TODO: recuperer les champs du document associe a part
@ -1590,6 +1595,7 @@ class Expedition extends CommonObject
return $this->LibStatut($this->statut,$mode); return $this->LibStatut($this->statut,$mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return label of a status * Return label of a status
* *
@ -1597,9 +1603,9 @@ class Expedition extends CommonObject
* @param int $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 of status * @return string Label of status
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($statut,$mode) function LibStatut($statut,$mode)
{ {
// phpcs:enable
global $langs; global $langs;
if ($mode==0) if ($mode==0)
@ -1713,6 +1719,7 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Set the planned delivery date * Set the planned delivery date
* *
@ -1720,9 +1727,9 @@ class Expedition extends CommonObject
* @param timestamp $date_livraison Date de livraison * @param timestamp $date_livraison Date de livraison
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_date_livraison($user, $date_livraison) function set_date_livraison($user, $date_livraison)
{ {
// phpcs:enable
if ($user->rights->expedition->creer) if ($user->rights->expedition->creer)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; $sql = "UPDATE ".MAIN_DB_PREFIX."expedition";
@ -1748,14 +1755,15 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label). * Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
* *
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_delivery_methods() function fetch_delivery_methods()
{ {
// phpcs:enable
global $langs; global $langs;
$this->meths = array(); $this->meths = array();
@ -1775,15 +1783,16 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Fetch all deliveries method and return an array. Load array this->listmeths. * Fetch all deliveries method and return an array. Load array this->listmeths.
* *
* @param id $id only this carrier, all if none * @param id $id only this carrier, all if none
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function list_delivery_methods($id='') function list_delivery_methods($id='')
{ {
// phpcs:enable
global $langs; global $langs;
$this->listmeths = array(); $this->listmeths = array();
@ -1810,6 +1819,7 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Update/create delivery method. * Update/create delivery method.
* *
@ -1817,9 +1827,9 @@ class Expedition extends CommonObject
* *
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_delivery_method($id='') function update_delivery_method($id='')
{ {
// phpcs:enable
if ($id=='') if ($id=='')
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
@ -1839,6 +1849,7 @@ class Expedition extends CommonObject
if ($resql < 0) dol_print_error($this->db,''); if ($resql < 0) dol_print_error($this->db,'');
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Activate delivery method. * Activate delivery method.
* *
@ -1846,15 +1857,16 @@ class Expedition extends CommonObject
* *
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function activ_delivery_method($id) function activ_delivery_method($id)
{ {
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
$sql.= ' WHERE rowid='.$id; $sql.= ' WHERE rowid='.$id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* DesActivate delivery method. * DesActivate delivery method.
* *
@ -1862,9 +1874,9 @@ class Expedition extends CommonObject
* *
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function disable_delivery_method($id) function disable_delivery_method($id)
{ {
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
$sql.= ' WHERE rowid='.$id; $sql.= ' WHERE rowid='.$id;
@ -1872,15 +1884,16 @@ class Expedition extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Forge an set tracking url * Forge an set tracking url
* *
* @param string $value Value * @param string $value Value
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function GetUrlTrackingStatus($value='') function GetUrlTrackingStatus($value='')
{ {
// phpcs:enable
if (! empty($this->shipping_method_id)) if (! empty($this->shipping_method_id))
{ {
$sql = "SELECT em.code, em.tracking"; $sql = "SELECT em.code, em.tracking";
@ -2058,14 +2071,15 @@ class Expedition extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
* *
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_billed() function set_billed()
{ {
// phpcs:enable
global $user; global $user;
$error=0; $error=0;
@ -2293,7 +2307,7 @@ class ExpeditionLigne extends CommonObjectLine
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element='expeditiondet'; public $element='expeditiondet';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */

View File

@ -450,16 +450,17 @@ class PaymentExpenseReport extends CommonObject
return ''; return '';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
* @param int $statut Id statut * @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @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 du statut * @return string Libelle du statut
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($statut,$mode=0) function LibStatut($statut,$mode=0)
{ {
// phpcs:enable
global $langs; global $langs;
return ''; return '';
@ -604,15 +605,16 @@ class PaymentExpenseReport extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Update link between the expense report payment and the generated line in llx_bank * Update link between the expense report payment and the generated line in llx_bank
* *
* @param int $id_bank Id if bank * @param int $id_bank Id if bank
* @return int >0 if OK, <=0 if KO * @return int >0 if OK, <=0 if KO
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_fk_bank($id_bank) function update_fk_bank($id_bank)
{ {
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);

View File

@ -1068,7 +1068,7 @@ else
print '</td></tr>'; print '</td></tr>';
} }
if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) if (empty($conf->global->PRODUCT_DISABLE_VOLUME))
{ {
// Volume // Volume
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">';
print '<input name="volume" size="4" value="'.GETPOST('volume').'">'; print '<input name="volume" size="4" value="'.GETPOST('volume').'">';

View File

@ -167,6 +167,7 @@ class FormProduct
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return full path to current warehouse in $tab (recursive function) * Return full path to current warehouse in $tab (recursive function)
* *
@ -174,10 +175,9 @@ class FormProduct
* @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call)
* @return String full label with all parents, separated by ' >> ' * @return String full label with all parents, separated by ' >> '
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
private function get_parent_path($tab, $final_label='') private function get_parent_path($tab, $final_label='')
{ {
//phpcs:enable
if(empty($final_label)) $final_label = $tab['label']; if(empty($final_label)) $final_label = $tab['label'];
if(empty($tab['parent_id'])) return $final_label; if(empty($tab['parent_id'])) return $final_label;
@ -282,6 +282,7 @@ class FormProduct
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Output a combo box with list of units * Output a combo box with list of units
* pour l'instant on ne definit pas les unites dans la base * pour l'instant on ne definit pas les unites dans la base
@ -292,12 +293,13 @@ class FormProduct
* @param int $adddefault Add empty unit called "Default" * @param int $adddefault Add empty unit called "Default"
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
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)
{ {
//phpcs:enable
print $this->load_measuring_units($name, $measuring_style, $default, $adddefault); print $this->load_measuring_units($name, $measuring_style, $default, $adddefault);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return a combo box with list of units * Return a combo box with list of units
* For the moment, units labels are defined in measuring_units_string * For the moment, units labels are defined in measuring_units_string
@ -308,9 +310,9 @@ class FormProduct
* @param int $adddefault Add empty unit called "Default" * @param int $adddefault Add empty unit called "Default"
* @return string * @return string
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
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)
{ {
//phpcs:enable
global $langs,$conf,$mysoc; global $langs,$conf,$mysoc;
$langs->load("other"); $langs->load("other");

View File

@ -692,19 +692,20 @@ class Product extends CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Check barcode * Check barcode
* *
* @param string $valuetotest Value to test * @param string $valuetotest Value to test
* @param string $typefortest Type of barcode (ISBN, EAN, ...) * @param string $typefortest Type of barcode (ISBN, EAN, ...)
* @return int 0 if OK * @return int 0 if OK
* -1 ErrorBadBarCodeSyntax * -1 ErrorBadBarCodeSyntax
* -2 ErrorBarCodeRequired * -2 ErrorBarCodeRequired
* -3 ErrorBarCodeAlreadyUsed * -3 ErrorBarCodeAlreadyUsed
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function check_barcode($valuetotest,$typefortest) function check_barcode($valuetotest,$typefortest)
{ {
// phpcs:enable
global $conf; global $conf;
if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM))
{ {
@ -1446,6 +1447,7 @@ class Product extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Insert a track that we changed a customer price * Insert a track that we changed a customer price
* *
@ -1453,9 +1455,9 @@ class Product extends CommonObject
* @param int $level price level to change * @param int $level price level to change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function _log_price($user,$level=0) function _log_price($user,$level=0)
{ {
// phpcs:enable
global $conf; global $conf;
$now=dol_now(); $now=dol_now();
@ -1485,6 +1487,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Delete a price line * Delete a price line
* *
@ -1492,9 +1495,9 @@ class Product extends CommonObject
* @param int $rowid Line id to delete * @param int $rowid Line id to delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function log_price_delete($user, $rowid) function log_price_delete($user, $rowid)
{ {
// phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty";
$sql.= " WHERE fk_product_price=".$rowid; $sql.= " WHERE fk_product_price=".$rowid;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -1514,6 +1517,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Read price used by a provider. * Read price used by a provider.
* We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref. * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref.
@ -1526,9 +1530,9 @@ class Product extends CommonObject
* @param int $fk_soc If of supplier * @param int $fk_soc If of supplier
* @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0) function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0)
{ {
// phpcs:enable
global $conf; global $conf;
$result = 0; $result = 0;
@ -2216,15 +2220,16 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats propale pour le produit/service * Charge tableau des stats propale pour le produit/service
* *
* @param int $socid Id societe * @param int $socid Id societe
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_propale($socid=0) function load_stats_propale($socid=0)
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2260,15 +2265,16 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats propale pour le produit/service * Charge tableau des stats propale pour le produit/service
* *
* @param int $socid Id thirdparty * @param int $socid Id thirdparty
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_proposal_supplier($socid=0) function load_stats_proposal_supplier($socid=0)
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2304,6 +2310,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats commande client pour le produit/service * Charge tableau des stats commande client pour le produit/service
* *
@ -2312,9 +2319,9 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Array of stats (nb=nb of order, qty=qty ordered) * @return array Array of stats (nb=nb of order, qty=qty ordered)
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0) function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0)
{ {
// phpcs:enable
global $conf,$user; global $conf,$user;
$sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,"; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,";
@ -2401,6 +2408,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats commande fournisseur pour le produit/service * Charge tableau des stats commande fournisseur pour le produit/service
* *
@ -2409,9 +2417,9 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualStock = 0) function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualStock = 0)
{ {
// phpcs:enable
global $conf,$user; global $conf,$user;
$sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_suppliers, COUNT(DISTINCT c.rowid) as nb,"; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_suppliers, COUNT(DISTINCT c.rowid) as nb,";
@ -2445,6 +2453,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats expedition client pour le produit/service * Charge tableau des stats expedition client pour le produit/service
* *
@ -2453,9 +2462,9 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0) function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0)
{ {
// phpcs:enable
global $conf,$user; global $conf,$user;
$sql = "SELECT COUNT(DISTINCT e.fk_soc) as nb_customers, COUNT(DISTINCT e.rowid) as nb,"; $sql = "SELECT COUNT(DISTINCT e.fk_soc) as nb_customers, COUNT(DISTINCT e.rowid) as nb,";
@ -2493,6 +2502,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats réception fournisseur pour le produit/service * Charge tableau des stats réception fournisseur pour le produit/service
* *
@ -2501,9 +2511,9 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_reception($socid=0,$filtrestatut='', $forVirtualStock = 0) function load_stats_reception($socid=0,$filtrestatut='', $forVirtualStock = 0)
{ {
// phpcs:enable
global $conf,$user; global $conf,$user;
$sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,";
@ -2537,15 +2547,16 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats contrat pour le produit/service * Charge tableau des stats contrat pour le produit/service
* *
* @param int $socid Id societe * @param int $socid Id societe
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_contrat($socid=0) function load_stats_contrat($socid=0)
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2580,15 +2591,16 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats facture pour le produit/service * Charge tableau des stats facture pour le produit/service
* *
* @param int $socid Id societe * @param int $socid Id societe
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_facture($socid=0) function load_stats_facture($socid=0)
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2623,15 +2635,16 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Charge tableau des stats facture pour le produit/service * Charge tableau des stats facture pour le produit/service
* *
* @param int $socid Id societe * @param int $socid Id societe
* @return array Tableau des stats * @return array Tableau des stats
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stats_facture_fournisseur($socid=0) function load_stats_facture_fournisseur($socid=0)
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2666,6 +2679,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return an array formated for showing graphs * Return an array formated for showing graphs
* *
@ -2674,9 +2688,9 @@ class Product extends CommonObject
* @param int $year Year (0=current year) * @param int $year Year (0=current year)
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function _get_stats($sql, $mode, $year=0) function _get_stats($sql, $mode, $year=0)
{ {
// phpcs:enable
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -2731,6 +2745,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return nb of units or customers invoices in which product is included * Return nb of units or customers invoices in which product is included
* *
@ -2741,9 +2756,9 @@ class Product extends CommonObject
* @param string $morefilter More sql filters * @param string $morefilter More sql filters
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='')
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2768,6 +2783,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return nb of units or supplier invoices in which product is included * Return nb of units or supplier invoices in which product is included
* *
@ -2778,9 +2794,9 @@ class Product extends CommonObject
* @param string $morefilter More sql filters * @param string $morefilter More sql filters
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='')
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2804,6 +2820,7 @@ class Product extends CommonObject
return $this->_get_stats($sql,$mode, $year); return $this->_get_stats($sql,$mode, $year);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return nb of units or proposals in which product is included * Return nb of units or proposals in which product is included
* *
@ -2814,9 +2831,9 @@ class Product extends CommonObject
* @param string $morefilter More sql filters * @param string $morefilter More sql filters
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='')
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2840,6 +2857,7 @@ class Product extends CommonObject
return $this->_get_stats($sql,$mode, $year); return $this->_get_stats($sql,$mode, $year);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return nb of units or proposals in which product is included * Return nb of units or proposals in which product is included
* *
@ -2850,9 +2868,9 @@ class Product extends CommonObject
* @param string $morefilter More sql filters * @param string $morefilter More sql filters
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='')
{ {
// phpcs:enable
global $conf; global $conf;
global $user; global $user;
@ -2876,6 +2894,7 @@ class Product extends CommonObject
return $this->_get_stats($sql,$mode, $year); return $this->_get_stats($sql,$mode, $year);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return nb of units or orders in which product is included * Return nb of units or orders in which product is included
* *
@ -2886,9 +2905,9 @@ class Product extends CommonObject
* @param string $morefilter More sql filters * @param string $morefilter More sql filters
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='')
{ {
// phpcs:enable
global $conf, $user; global $conf, $user;
$sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')";
@ -2911,6 +2930,7 @@ class Product extends CommonObject
return $this->_get_stats($sql,$mode, $year); return $this->_get_stats($sql,$mode, $year);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return nb of units or orders in which product is included * Return nb of units or orders in which product is included
* *
@ -2921,9 +2941,9 @@ class Product extends CommonObject
* @param string $morefilter More sql filters * @param string $morefilter More sql filters
* @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
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='')
{ {
// phpcs:enable
global $conf, $user; global $conf, $user;
$sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')";
@ -2946,6 +2966,7 @@ class Product extends CommonObject
return $this->_get_stats($sql,$mode, $year); return $this->_get_stats($sql,$mode, $year);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Link a product/service to a parent product/service * Link a product/service to a parent product/service
* *
@ -2955,9 +2976,9 @@ class Product extends CommonObject
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1) function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1)
{ {
// phpcs:enable
// Clean parameters // Clean parameters
if (! is_numeric($id_pere)) $id_pere=0; if (! is_numeric($id_pere)) $id_pere=0;
if (! is_numeric($id_fils)) $id_fils=0; if (! is_numeric($id_fils)) $id_fils=0;
@ -3003,6 +3024,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Modify composed product * Modify composed product
* *
@ -3012,9 +3034,9 @@ class Product extends CommonObject
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1) function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1)
{ {
// phpcs:enable
// Clean parameters // Clean parameters
if (! is_numeric($id_pere)) $id_pere=0; if (! is_numeric($id_pere)) $id_pere=0;
if (! is_numeric($id_fils)) $id_fils=0; if (! is_numeric($id_fils)) $id_fils=0;
@ -3037,6 +3059,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Retire le lien entre un sousproduit et un produit/service * Retire le lien entre un sousproduit et un produit/service
* *
@ -3044,9 +3067,9 @@ class Product extends CommonObject
* @param int $fk_child Id du produit a ne plus lie * @param int $fk_child Id du produit a ne plus lie
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function del_sousproduit($fk_parent, $fk_child) function del_sousproduit($fk_parent, $fk_child)
{ {
// phpcs:enable
if (! is_numeric($fk_parent)) $fk_parent=0; if (! is_numeric($fk_parent)) $fk_parent=0;
if (! is_numeric($fk_child)) $fk_child=0; if (! is_numeric($fk_child)) $fk_child=0;
@ -3064,16 +3087,17 @@ class Product extends CommonObject
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Verifie si c'est un sous-produit * Verifie si c'est un sous-produit
* *
* @param int $fk_parent Id du produit auquel le produit est lie * @param int $fk_parent Id du produit auquel le produit est lie
* @param int $fk_child Id du produit lie * @param int $fk_child Id du produit lie
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function is_sousproduit($fk_parent, $fk_child) function is_sousproduit($fk_parent, $fk_child)
{ {
// phpcs:enable
$sql = "SELECT fk_product_pere, qty, incdec"; $sql = "SELECT fk_product_pere, qty, incdec";
$sql.= " FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association";
$sql.= " WHERE fk_product_pere = '".$fk_parent."'"; $sql.= " WHERE fk_product_pere = '".$fk_parent."'";
@ -3105,6 +3129,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Add a supplier price for the product. * Add a supplier price for the product.
* Note: Duplicate ref is accepted for different quantity only, or for different companies. * Note: Duplicate ref is accepted for different quantity only, or for different companies.
@ -3115,9 +3140,9 @@ class Product extends CommonObject
* @param float $quantity Quantity minimum for price * @param float $quantity Quantity minimum for price
* @return int < 0 if KO, 0 if link already exists for this product, > 0 if OK * @return int < 0 if KO, 0 if link already exists for this product, > 0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity) function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity)
{ {
// phpcs:enable
global $conf; global $conf;
$now=dol_now(); $now=dol_now();
@ -3210,14 +3235,15 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Renvoie la liste des fournisseurs du produit/service * Renvoie la liste des fournisseurs du produit/service
* *
* @return array Tableau des id de fournisseur * @return array Tableau des id de fournisseur
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function list_suppliers() function list_suppliers()
{ {
// phpcs:enable
global $conf; global $conf;
$list = array(); $list = array();
@ -3243,6 +3269,7 @@ class Product extends CommonObject
return $list; return $list;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Recopie les prix d'un produit/service sur un autre * Recopie les prix d'un produit/service sur un autre
* *
@ -3250,9 +3277,9 @@ class Product extends CommonObject
* @param int $toId Id product target * @param int $toId Id product target
* @return nt < 0 if KO, > 0 if OK * @return nt < 0 if KO, > 0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function clone_price($fromId, $toId) function clone_price($fromId, $toId)
{ {
// phpcs:enable
$this->db->begin(); $this->db->begin();
// les prix // les prix
@ -3272,6 +3299,7 @@ class Product extends CommonObject
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Clone links between products * Clone links between products
* *
@ -3279,9 +3307,9 @@ class Product extends CommonObject
* @param int $toId Product id * @param int $toId Product id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function clone_associations($fromId, $toId) function clone_associations($fromId, $toId)
{ {
// phpcs:enable
$this->db->begin(); $this->db->begin();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)'; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)';
@ -3299,6 +3327,7 @@ class Product extends CommonObject
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre * Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre
* *
@ -3306,9 +3335,9 @@ class Product extends CommonObject
* @param int $toId Id produit cible * @param int $toId Id produit cible
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function clone_fournisseurs($fromId, $toId) function clone_fournisseurs($fromId, $toId)
{ {
// phpcs:enable
$this->db->begin(); $this->db->begin();
$now=dol_now(); $now=dol_now();
@ -3347,6 +3376,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits * Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits
* Define value of this->res * Define value of this->res
@ -3358,9 +3388,9 @@ class Product extends CommonObject
* @param int $id_parent Id parent * @param int $id_parent Id parent
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_parent=0) function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_parent=0)
{ {
// phpcs:enable
global $conf,$langs; global $conf,$langs;
$product = new Product($this->db); $product = new Product($this->db);
@ -3407,6 +3437,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Build the tree of subproducts into an array * Build the tree of subproducts into an array
* this->sousprods is loaded by this->get_sousproduits_arbo() * this->sousprods is loaded by this->get_sousproduits_arbo()
@ -3414,9 +3445,9 @@ class Product extends CommonObject
* @param int $multiply Because each sublevel must be multiplicated by parent nb * @param int $multiply Because each sublevel must be multiplicated by parent nb
* @return array $this->res * @return array $this->res
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_arbo_each_prod($multiply=1) function get_arbo_each_prod($multiply=1)
{ {
// phpcs:enable
$this->res = array(); $this->res = array();
if (isset($this->sousprods) && is_array($this->sousprods)) if (isset($this->sousprods) && is_array($this->sousprods))
{ {
@ -3558,15 +3589,16 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return tree of all subproducts for product. Tree contains id, name and quantity. * Return tree of all subproducts for product. Tree contains id, name and quantity.
* Set this->sousprods * Set this->sousprods
* *
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_sousproduits_arbo() function get_sousproduits_arbo()
{ {
// phpcs:enable
$parent=array(); $parent=array();
foreach($this->getChildsArbo($this->id) as $keyChild => $valueChild) // Warning. getChildsArbo can call getChildsArbo recursively. Starting point is $value[0]=id of product foreach($this->getChildsArbo($this->id) as $keyChild => $valueChild) // Warning. getChildsArbo can call getChildsArbo recursively. Starting point is $value[0]=id of product
@ -3760,6 +3792,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return label of a given status * Return label of a given status
* *
@ -3768,9 +3801,9 @@ class Product extends CommonObject
* @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" * @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
* @return string Label of status * @return string Label of status
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($status,$mode=0,$type=0) function LibStatut($status,$mode=0,$type=0)
{ {
// phpcs:enable
global $conf, $langs; global $conf, $langs;
$langs->load('products'); $langs->load('products');
@ -3855,6 +3888,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Adjust stock in a warehouse for product * Adjust stock in a warehouse for product
* *
@ -3869,9 +3903,9 @@ class Product extends CommonObject
* @param int $origin_id Origin id of element * @param int $origin_id Origin id of element
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $inventorycode='', $origin_element='', $origin_id=null) function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $inventorycode='', $origin_element='', $origin_id=null)
{ {
// phpcs:enable
if ($id_entrepot) if ($id_entrepot)
{ {
$this->db->begin(); $this->db->begin();
@ -3901,6 +3935,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Adjust stock in a warehouse for product with batch number * Adjust stock in a warehouse for product with batch number
* *
@ -3918,9 +3953,9 @@ class Product extends CommonObject
* @param int $origin_id Origin id of element * @param int $origin_id Origin id of element
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='', $inventorycode='', $origin_element='', $origin_id=null) function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='', $inventorycode='', $origin_element='', $origin_id=null)
{ {
// phpcs:enable
if ($id_entrepot) if ($id_entrepot)
{ {
$this->db->begin(); $this->db->begin();
@ -3950,6 +3985,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) * Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products)
* This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id.
@ -3964,9 +4000,9 @@ class Product extends CommonObject
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
* @see load_virtual_stock, getBatchInfo * @see load_virtual_stock, getBatchInfo
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_stock($option='') function load_stock($option='')
{ {
// phpcs:enable
global $conf; global $conf;
$this->stock_reel = 0; $this->stock_reel = 0;
@ -4031,6 +4067,7 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load value ->stock_theorique of a product. Property this->id must be defined. * Load value ->stock_theorique of a product. Property this->id must be defined.
* This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id.
@ -4038,9 +4075,9 @@ class Product extends CommonObject
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
* @see load_stock, getBatchInfo * @see load_stock, getBatchInfo
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_virtual_stock() function load_virtual_stock()
{ {
// phpcs:enable
global $conf; global $conf;
$stock_commande_client=0; $stock_commande_client=0;
@ -4131,6 +4168,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Move an uploaded file described into $file array into target directory $sdir. * Move an uploaded file described into $file array into target directory $sdir.
* *
@ -4138,9 +4176,9 @@ class Product extends CommonObject
* @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...) * @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function add_photo($sdir, $file) function add_photo($sdir, $file)
{ {
// phpcs:enable
global $conf; global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -4173,15 +4211,16 @@ class Product extends CommonObject
else return -1; else return -1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return if at least one photo is available * Return if at least one photo is available
* *
* @param string $sdir Directory to scan * @param string $sdir Directory to scan
* @return boolean True if at least one photo is available, False if not * @return boolean True if at least one photo is available, False if not
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function is_photo_available($sdir) function is_photo_available($sdir)
{ {
// phpcs:enable
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
@ -4210,6 +4249,7 @@ class Product extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Retourne tableau de toutes les photos du produit * Retourne tableau de toutes les photos du produit
* *
@ -4217,9 +4257,9 @@ class Product extends CommonObject
* @param int $nbmax Nombre maximum de photos (0=pas de max) * @param int $nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos * @return array Tableau de photos
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function liste_photos($dir,$nbmax=0) function liste_photos($dir,$nbmax=0)
{ {
// phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
@ -4266,15 +4306,16 @@ class Product extends CommonObject
return $tabobj; return $tabobj;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* 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 * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function delete_photo($file) function delete_photo($file)
{ {
// phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
@ -4302,29 +4343,31 @@ class Product extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load size of image file * Load size of image file
* *
* @param string $file Path to file * @param string $file Path to file
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_image_size($file) function get_image_size($file)
{ {
// phpcs:enable
$file_osencoded=dol_osencode($file); $file_osencoded=dol_osencode($file);
$infoImg = getimagesize($file_osencoded); // Get information on image $infoImg = getimagesize($file_osencoded); // Get information on image
$this->imgWidth = $infoImg[0]; // Largeur de l'image $this->imgWidth = $infoImg[0]; // Largeur de l'image
$this->imgHeight = $infoImg[1]; // Hauteur de l'image $this->imgHeight = $infoImg[1]; // Hauteur de l'image
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Load indicators this->nb for the dashboard * Load indicators this->nb for the dashboard
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_state_board() function load_state_board()
{ {
// phpcs:enable
global $conf, $user, $hookmanager; global $conf, $user, $hookmanager;
$this->nb=array(); $this->nb=array();
@ -4380,6 +4423,7 @@ class Product extends CommonObject
return ($this->type == Product::TYPE_SERVICE ? true : false); return ($this->type == Product::TYPE_SERVICE ? true : false);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Get a barcode from the module to generate barcode values. * Get a barcode from the module to generate barcode values.
* Return value is stored into this->barcode * Return value is stored into this->barcode
@ -4388,9 +4432,9 @@ class Product extends CommonObject
* @param string $type Barcode type (ean, isbn, ...) * @param string $type Barcode type (ean, isbn, ...)
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_barcode($object,$type='') function get_barcode($object,$type='')
{ {
// phpcs:enable
global $conf; global $conf;
$result=''; $result='';
@ -4509,14 +4553,15 @@ class Product extends CommonObject
} }
/** // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Return minimum product recommended price * Return minimum product recommended price
* *
* @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function min_recommended_price() function min_recommended_price()
{ {
// phpcs:enable
global $conf; global $conf;
$maxpricesupplier=0; $maxpricesupplier=0;

View File

@ -73,7 +73,7 @@ class Productbatch extends CommonObject
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->clean_param(); $this->cleanParam();
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -204,7 +204,7 @@ class Productbatch extends CommonObject
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->clean_param(); $this->cleanParam();
// TODO Check qty is ok for stock move. Negative may not be allowed. // TODO Check qty is ok for stock move. Negative may not be allowed.
if ($this->qty < 0) if ($this->qty < 0)
@ -402,8 +402,7 @@ class Productbatch extends CommonObject
* *
* @return void * @return void
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function cleanParam()
private function clean_param()
{ {
if (isset($this->fk_product_stock)) $this->fk_product_stock=(int) trim($this->fk_product_stock); if (isset($this->fk_product_stock)) $this->fk_product_stock=(int) trim($this->fk_product_stock);
if (isset($this->batch)) $this->batch=trim($this->batch); if (isset($this->batch)) $this->batch=trim($this->batch);

View File

@ -38,7 +38,7 @@ class Inventory extends CommonObject
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element = 'inventory'; public $element = 'inventory';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
@ -48,7 +48,7 @@ class Inventory extends CommonObject
* @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/ */
public $ismultientitymanaged = 1; public $ismultientitymanaged = 1;
/** /**
* @var string String with name of icon for inventory * @var string String with name of icon for inventory
*/ */
@ -123,22 +123,22 @@ class Inventory extends CommonObject
* @var int Name of subtable line * @var int Name of subtable line
*/ */
//public $table_element_line = 'inventorydet'; //public $table_element_line = 'inventorydet';
/** /**
* @var int Field with ID of parent key if this field has a parent * @var int Field with ID of parent key if this field has a parent
*/ */
//public $fk_element = 'fk_inventory'; //public $fk_element = 'fk_inventory';
/** /**
* @var int Name of subtable class that manage subtable lines * @var int Name of subtable class that manage subtable lines
*/ */
//public $class_element_line = 'Inventoryline'; //public $class_element_line = 'Inventoryline';
/** /**
* @var array Array of child tables (child tables to delete before deleting a record) * @var array Array of child tables (child tables to delete before deleting a record)
*/ */
//protected $childtables=array('inventorydet'); //protected $childtables=array('inventorydet');
/** /**
* @var InventoryLine[] Array of subtable lines * @var InventoryLine[] Array of subtable lines
*/ */
@ -339,6 +339,7 @@ class Inventory extends CommonObject
return $this->LibStatut($this->status,$mode); return $this->LibStatut($this->status,$mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return the status * Return the status
* *
@ -346,9 +347,9 @@ class Inventory extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto, 6=Long 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, 5=Long label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
static function LibStatut($status,$mode=0) static function LibStatut($status,$mode=0)
{ {
// phpcs:enable
global $langs; global $langs;
if ($mode == 0) if ($mode == 0)

View File

@ -44,7 +44,7 @@ class ProductStockEntrepot extends CommonObject
* @var string Id to identify managed objects * @var string Id to identify managed objects
*/ */
public $element = 'ProductStockEntrepot'; public $element = 'ProductStockEntrepot';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
@ -511,6 +511,7 @@ class ProductStockEntrepot extends CommonObject
return $this->LibStatut($this->status,$mode); return $this->LibStatut($this->status,$mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Renvoi le libelle d'un status donne * Renvoi le libelle d'un status donne
* *
@ -518,9 +519,9 @@ class ProductStockEntrepot extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @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 * @return string Label of status
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($status,$mode=0) function LibStatut($status,$mode=0)
{ {
// phpcs:enable
global $langs; global $langs;
if ($mode == 0) if ($mode == 0)

View File

@ -250,6 +250,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// This is code copied from main.inc.php !!!!!!!!!!!!!!! // This is code copied from main.inc.php !!!!!!!!!!!!!!!
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). * Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF).
* *
@ -257,9 +258,9 @@ class CoreTest extends PHPUnit_Framework_TestCase
* @param string $type 1=GET, 0=POST, 2=PHP_SELF * @param string $type 1=GET, 0=POST, 2=PHP_SELF
* @return int >0 if there is an injection * @return int >0 if there is an injection
*/ */
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function test_sql_and_script_inject($val, $type) function test_sql_and_script_inject($val, $type)
{ {
// phpcs:enable
$inj = 0; $inj = 0;
// For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
if ($type != 2) if ($type != 2)