Skip to content

Commit

Permalink
start changing phpcs:ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Sep 1, 2018
1 parent c3438b7 commit 3e723af
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 134 deletions.
66 changes: 43 additions & 23 deletions htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ function __construct($db, $socid="", $propalid=0)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Add line into array products
* $this->thirdparty should be loaded
* Add line into array products
* $this->thirdparty should be loaded
*
* @param int $idproduct Product Id to add
* @param int $qty Quantity
Expand All @@ -244,9 +245,9 @@ function __construct($db, $socid="", $propalid=0)
* TODO Replace calls to this function by generation objet Ligne
* inserted into table $this->products
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function add_product($idproduct, $qty, $remise_percent=0)
{
// phpcs:enable
global $conf, $mysoc;

if (! $qty) $qty = 1;
Expand Down Expand Up @@ -293,15 +294,16 @@ function add_product($idproduct, $qty, $remise_percent=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Adding line of fixed discount in the proposal in DB
*
* @param int $idremise Id of fixed discount
* @return int >0 if OK, <0 if KO
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function insert_discount($idremise)
{
// phpcs:enable
global $langs;

include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
Expand Down Expand Up @@ -1172,16 +1174,17 @@ function create($user, $notrigger=0)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Insert into DB a proposal object completely defined by its data members (ex, results from copy).
*
* @param User $user User that create
* @return int Id of the new object if ok, <0 if ko
* @see create
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function create_from($user)
{
// phpcs:enable
// i love this function because $this->products is not used in create function...
$this->products=$this->lines;

Expand Down Expand Up @@ -1564,15 +1567,16 @@ function update(User $user, $notrigger=0)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Load array lines
*
* @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function fetch_lines($only_product=0)
{
// phpcs:enable
$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,';
Expand Down Expand Up @@ -1803,6 +1807,7 @@ function valid($user, $notrigger=0)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Define proposal date
*
Expand All @@ -1811,9 +1816,9 @@ function valid($user, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_date($user, $date, $notrigger=0)
{
// phpcs:enable
if (empty($date))
{
$this->error='ErrorBadParameter';
Expand Down Expand Up @@ -1871,6 +1876,7 @@ function set_date($user, $date, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Define end validity date
*
Expand All @@ -1879,9 +1885,9 @@ function set_date($user, $date, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_echeance($user, $date_fin_validite, $notrigger=0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer))
{
$error=0;
Expand Down Expand Up @@ -1932,6 +1938,7 @@ function set_echeance($user, $date_fin_validite, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set delivery date
*
Expand All @@ -1940,9 +1947,9 @@ function set_echeance($user, $date_fin_validite, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_date_livraison($user, $date_livraison, $notrigger=0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer))
{
$error=0;
Expand Down Expand Up @@ -1993,6 +2000,7 @@ function set_date_livraison($user, $date_livraison, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set delivery
*
Expand All @@ -2001,9 +2009,9 @@ function set_date_livraison($user, $date_livraison, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_availability($user, $id, $notrigger=0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
{
$error=0;
Expand Down Expand Up @@ -2063,6 +2071,7 @@ function set_availability($user, $id, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set source of demand
*
Expand All @@ -2071,9 +2080,9 @@ function set_availability($user, $id, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_demand_reason($user, $id, $notrigger=0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
{
$error=0;
Expand Down Expand Up @@ -2135,6 +2144,7 @@ function set_demand_reason($user, $id, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set customer reference number
*
Expand All @@ -2143,9 +2153,9 @@ function set_demand_reason($user, $id, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_ref_client($user, $ref_client, $notrigger=0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer))
{
$error=0;
Expand Down Expand Up @@ -2199,6 +2209,7 @@ function set_ref_client($user, $ref_client, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set an overall discount on the proposal
*
Expand All @@ -2207,9 +2218,9 @@ function set_ref_client($user, $ref_client, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_remise_percent($user, $remise, $notrigger=0)
{
// phpcs:enable
$remise=trim($remise)?trim($remise):0;

if (! empty($user->rights->propal->creer))
Expand Down Expand Up @@ -2265,6 +2276,7 @@ function set_remise_percent($user, $remise, $notrigger=0)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set an absolute overall discount on the proposal
*
Expand All @@ -2273,9 +2285,9 @@ function set_remise_percent($user, $remise, $notrigger=0)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_remise_absolue($user, $remise, $notrigger=0)
{
// phpcs:enable
$remise=trim($remise)?trim($remise):0;

if (! empty($user->rights->propal->creer))
Expand Down Expand Up @@ -2550,16 +2562,17 @@ function classifyBilled(User $user, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set draft status
*
* @param User $user Object user that modify
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function set_draft($user, $notrigger=0)
{
// phpcs:enable
$error=0;

$this->db->begin();
Expand Down Expand Up @@ -2608,6 +2621,7 @@ function set_draft($user, $notrigger=0)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Return list of proposal (eventually filtered on user) into an array
*
Expand All @@ -2621,9 +2635,9 @@ function set_draft($user, $notrigger=0)
* @param string $sortorder Sort order
* @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')
{
// phpcs:enable
global $user;

$ga = array();
Expand Down Expand Up @@ -2695,15 +2709,16 @@ function getInvoiceArrayList()
return $this->InvoiceArrayList($this->id);
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Returns an array with id and ref of related invoices
*
* @param int $id Id propal
* @return array Array of invoices id
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function InvoiceArrayList($id)
{
// phpcs:enable
$ga = array();
$linkedInvoices = array();

Expand Down Expand Up @@ -2974,6 +2989,7 @@ function availability($availability_id, $notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Change source demand
*
Expand All @@ -2982,9 +2998,9 @@ function availability($availability_id, $notrigger=0)
* @return int >0 si ok, <0 si ko
* @deprecated use set_demand_reason
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function demand_reason($demand_reason_id, $notrigger=0)
{
// phpcs:enable
global $user;

if ($this->statut >= self::STATUS_DRAFT)
Expand Down Expand Up @@ -3115,16 +3131,17 @@ function getLibStatut($mode=0)
return $this->LibStatut($this->statut, $mode);
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Return label of a status (draft, validated, ...)
*
* @param int $statut id statut
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function LibStatut($statut,$mode=1)
{
// phpcs:enable
global $conf;

// Init/load array of translation of status
Expand Down Expand Up @@ -3158,19 +3175,20 @@ function LibStatut($statut,$mode=1)
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 == 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)
*
* @param User $user Object user
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_board($user,$mode)
{
// phpcs:enable
global $conf, $langs;

$clause = " WHERE";
Expand Down Expand Up @@ -3336,14 +3354,15 @@ function initAsSpecimen()
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if ko, >0 if ok
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function load_state_board()
{
// phpcs:enable
global $user;

$this->nb=array();
Expand Down Expand Up @@ -4223,15 +4242,16 @@ function update($notrigger=0)
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Update DB line fields total_xxx
* Used by migration
*
* @return int <0 if ko, >0 if ok
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function update_total()
{
// phpcs:enable
$this->db->begin();

// Mise a jour ligne en base
Expand Down
Loading

0 comments on commit 3e723af

Please sign in to comment.