2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Frédéric FRANCE
2019-02-25 00:56:48 +01:00
parent 6ee186096c
commit 42a1387218
83 changed files with 1487 additions and 1490 deletions

View File

@@ -129,7 +129,7 @@ class AccountancyCategory // extends CommonObject
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@@ -142,7 +142,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@@ -239,7 +239,7 @@ class AccountancyCategory // extends CommonObject
* @param string $label Label * @param string $label Label
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $code = '', $label = '') public function fetch($id, $code = '', $label = '')
{ {
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
@@ -299,7 +299,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user = null, $notrigger = 0) public function update($user = null, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@@ -379,7 +379,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;

View File

@@ -8,7 +8,7 @@
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com> * Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@@ -64,7 +64,7 @@ class AccountancySystem
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@@ -77,7 +77,7 @@ class AccountancySystem
* @param string $ref ref * @param string $ref ref
* @return int <0 if KO, Id of record if OK and found * @return int <0 if KO, Id of record if OK and found
*/ */
function fetch($rowid = 0, $ref = '') public function fetch($rowid = 0, $ref = '')
{ {
global $conf; global $conf;
@@ -124,7 +124,7 @@ class AccountancySystem
* @param User $user making insert * @param User $user making insert
* @return int if KO, Id of line if OK * @return int if KO, Id of line if OK
*/ */
function create($user) public function create($user)
{ {
$now = dol_now(); $now = dol_now();

View File

@@ -138,7 +138,7 @@ class AccountingAccount extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf; global $conf;
@@ -154,7 +154,7 @@ class AccountingAccount extends CommonObject
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, 0 if not found, Id of record if OK and found * @return int <0 if KO, 0 if not found, Id of record if OK and found
*/ */
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
{ {
global $conf; global $conf;
@@ -216,7 +216,7 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $conf;
$error = 0; $error = 0;
@@ -325,7 +325,7 @@ class AccountingAccount extends CommonObject
* @param User $user Use making update * @param User $user Use making update
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user) public function update($user)
{ {
// Check parameters // Check parameters
if (empty($this->pcg_type) || $this->pcg_type == '-1') if (empty($this->pcg_type) || $this->pcg_type == '-1')
@@ -368,7 +368,7 @@ class AccountingAccount extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function checkUsage() public function checkUsage()
{ {
global $langs; global $langs;
@@ -402,7 +402,7 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers * @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
$error = 0; $error = 0;
@@ -466,7 +466,7 @@ class AccountingAccount extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@@ -530,7 +530,7 @@ class AccountingAccount extends CommonObject
* @param int $id of record * @param int $id of record
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
@@ -562,14 +562,14 @@ class AccountingAccount extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Account deactivated * Account deactivated
* *
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_desactivate($id) public function account_desactivate($id)
{ {
// phpcs:enable // phpcs:enable
$result = $this->checkUsage(); $result = $this->checkUsage();
@@ -597,14 +597,14 @@ class AccountingAccount extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Account activated * Account activated
* *
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_activate($id) public function account_activate($id)
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
@@ -632,12 +632,12 @@ class AccountingAccount 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
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->status, $mode); return $this->LibStatut($this->status, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@@ -645,7 +645,7 @@ class AccountingAccount 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
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -655,32 +655,32 @@ class AccountingAccount extends CommonObject
{ {
$prefix=''; $prefix='';
if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled'); elseif ($statut == 0) return $langs->trans('Disabled');
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled'); elseif ($statut == 0) return $langs->trans('Disabled');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4'); if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
} }
} }
} }

View File

@@ -74,7 +74,7 @@ class AccountingJournal extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@@ -86,7 +86,7 @@ class AccountingJournal extends CommonObject
* @param string $journal_code Journal code * @param string $journal_code Journal code
* @return int <0 if KO, Id of record if OK and found * @return int <0 if KO, Id of record if OK and found
*/ */
function fetch($rowid = null, $journal_code = null) public function fetch($rowid = null, $journal_code = null)
{ {
global $conf; global $conf;
@@ -146,7 +146,7 @@ class AccountingJournal extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
$sql = "SELECT rowid, code, label, nature, active"; $sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
@@ -213,7 +213,7 @@ class AccountingJournal extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0) public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
@@ -270,12 +270,12 @@ class AccountingJournal extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court * @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type * @return string Label of type
*/ */
function getLibType($mode = 0) public function getLibType($mode = 0)
{ {
return $this->LibType($this->nature, $mode); return $this->LibType($this->nature, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return type of an accounting journal * Return type of an accounting journal
* *
@@ -283,7 +283,7 @@ class AccountingJournal extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court * @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type * @return string Label of type
*/ */
function LibType($nature, $mode = 0) public function LibType($nature, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -294,20 +294,20 @@ class AccountingJournal extends CommonObject
{ {
$prefix=''; $prefix='';
if ($nature == 9) return $langs->trans('AccountingJournalType9'); if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 5) return $langs->trans('AccountingJournalType5'); elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
if ($nature == 4) return $langs->trans('AccountingJournalType4'); elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3'); elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2'); elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1'); elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($nature == 9) return $langs->trans('AccountingJournalType9'); if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 5) return $langs->trans('AccountingJournalType5'); elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
if ($nature == 4) return $langs->trans('AccountingJournalType4'); elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3'); elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2'); elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1'); elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
} }
} }
} }

View File

@@ -218,7 +218,7 @@ class Adherent extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = -1; $this->statut = -1;
@@ -229,7 +229,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function sending an email to the current member with the text supplied in parameter. * Function sending an email to the current member with the text supplied in parameter.
* *
@@ -246,7 +246,7 @@ class Adherent extends CommonObject
* @param string $moreinheader Add more html headers * @param string $moreinheader Add more html headers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -291,7 +291,7 @@ class Adherent extends CommonObject
* @param string $text Text to make substitution to * @param string $text Text to make substitution to
* @return string Value of input text string with substitutions done * @return string Value of input text string with substitutions done
*/ */
function makeSubstitution($text) public function makeSubstitution($text)
{ {
global $conf,$langs; global $conf,$langs;
@@ -358,7 +358,7 @@ class Adherent extends CommonObject
* @param string $morphy Nature of the adherent (physical or moral) * @param string $morphy Nature of the adherent (physical or moral)
* @return string Label * @return string Label
*/ */
function getmorphylib($morphy = '') public function getmorphylib($morphy = '')
{ {
global $langs; global $langs;
if (! $morphy) { $morphy=$this->morphy; } if (! $morphy) { $morphy=$this->morphy; }
@@ -374,7 +374,7 @@ class Adherent extends CommonObject
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
@@ -500,7 +500,7 @@ class Adherent extends CommonObject
* @param string $action Current action for hookmanager * @param string $action Current action for hookmanager
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update') public function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update')
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
@@ -752,7 +752,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update denormalized last subscription date. * Update denormalized last subscription date.
* This function is called when we delete a subscription for example. * This function is called when we delete a subscription for example.
@@ -760,7 +760,7 @@ class Adherent extends CommonObject
* @param User $user User making change * @param User $user User making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_end_date($user) public function update_end_date($user)
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
@@ -817,7 +817,7 @@ class Adherent 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=nothing to do, >0 if OK * @return int <0 if KO, 0=nothing to do, >0 if OK
*/ */
function delete($rowid, $user, $notrigger = 0) public function delete($rowid, $user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
@@ -927,7 +927,7 @@ class Adherent extends CommonObject
* @param int $nosyncuser Do not synchronize linked user * @param int $nosyncuser Do not synchronize linked user
* @return string If OK return clear password, 0 if no change, < 0 if error * @return string If OK return clear password, 0 if no change, < 0 if error
*/ */
function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0) public function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0)
{ {
global $conf, $langs; global $conf, $langs;
@@ -1038,7 +1038,7 @@ class Adherent extends CommonObject
* @param int $userid Id of user to link to * @param int $userid Id of user to link to
* @return int 1=OK, -1=KO * @return int 1=OK, -1=KO
*/ */
function setUserId($userid) public function setUserId($userid)
{ {
global $conf, $langs; global $conf, $langs;
@@ -1072,7 +1072,7 @@ class Adherent extends CommonObject
* @param int $thirdpartyid Id of user to link to * @param int $thirdpartyid Id of user to link to
* @return int 1=OK, -1=KO * @return int 1=OK, -1=KO
*/ */
function setThirdPartyId($thirdpartyid) public function setThirdPartyId($thirdpartyid)
{ {
global $conf, $langs; global $conf, $langs;
@@ -1108,14 +1108,14 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Method to load member from its login * Method to load member from its login
* *
* @param string $login login of member * @param string $login login of member
* @return void * @return void
*/ */
function fetch_login($login) public function fetch_login($login)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1139,7 +1139,7 @@ class Adherent extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Method to load member from its name * Method to load member from its name
* *
@@ -1147,7 +1147,7 @@ class Adherent extends CommonObject
* @param string $lastname Lastname * @param string $lastname Lastname
* @return void * @return void
*/ */
function fetch_name($firstname, $lastname) public function fetch_name($firstname, $lastname)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1183,7 +1183,7 @@ class Adherent extends CommonObject
* @param bool $fetch_subscriptions To load member subscriptions * @param bool $fetch_subscriptions To load member subscriptions
* @return int >0 if OK, 0 if not found, <0 if KO * @return int >0 if OK, 0 if not found, <0 if KO
*/ */
function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true) public function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
{ {
global $langs; global $langs;
@@ -1316,7 +1316,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to get member subscriptions data * Function to get member subscriptions data
* first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount * first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
@@ -1324,7 +1324,7 @@ class Adherent extends CommonObject
* *
* @return int <0 si KO, >0 si OK * @return int <0 si KO, >0 si OK
*/ */
function fetch_subscriptions() public function fetch_subscriptions()
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1400,7 +1400,7 @@ class Adherent extends CommonObject
* @param int $datesubend Date end subscription * @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO * @return int rowid of record added, <0 if KO
*/ */
function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0) public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
@@ -1486,7 +1486,7 @@ class Adherent extends CommonObject
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice. * @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0) public function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0)
{ {
global $conf, $langs, $user, $mysoc; global $conf, $langs, $user, $mysoc;
@@ -1779,7 +1779,7 @@ class Adherent extends CommonObject
* @param User $user user adherent qui valide * @param User $user user adherent qui valide
* @return int <0 if KO, 0 if nothing done, >0 if OK * @return int <0 if KO, 0 if nothing done, >0 if OK
*/ */
function validate($user) public function validate($user)
{ {
global $langs,$conf; global $langs,$conf;
@@ -1832,7 +1832,7 @@ class Adherent extends CommonObject
* @param User $user User making change * @param User $user User making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function resiliate($user) public function resiliate($user)
{ {
global $langs,$conf; global $langs,$conf;
@@ -1874,13 +1874,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to add member into external tools mailing-list, spip, etc. * Function to add member into external tools mailing-list, spip, etc.
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function add_to_abo() public function add_to_abo()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -1933,13 +1933,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to delete a member from external tools like mailing-list, spip, etc. * Function to delete a member from external tools like mailing-list, spip, etc.
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function del_to_abo() public function del_to_abo()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -1997,7 +1997,7 @@ class Adherent extends CommonObject
* *
* @return string Translated name of civility (translated with transnoentitiesnoconv) * @return string Translated name of civility (translated with transnoentitiesnoconv)
*/ */
function getCivilityLabel() public function getCivilityLabel()
{ {
global $langs; global $langs;
$langs->load("dict"); $langs->load("dict");
@@ -2018,7 +2018,7 @@ class Adherent extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1)
{ {
global $conf, $langs; global $conf, $langs;
@@ -2109,12 +2109,12 @@ class Adherent 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 * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $this->need_subscription, $this->datefin, $mode); return $this->LibStatut($this->statut, $this->need_subscription, $this->datefin, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@@ -2124,7 +2124,7 @@ class Adherent 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 * @return string Label
*/ */
function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0) public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -2202,13 +2202,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* 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
*/ */
function load_state_board() public function load_state_board()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -2238,14 +2238,14 @@ class Adherent extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Objet user * @param User $user Objet user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user) public function load_board($user)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@@ -2337,7 +2337,7 @@ class Adherent extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $user,$langs; global $user,$langs;
@@ -2390,7 +2390,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@@ -2400,7 +2400,7 @@ class Adherent extends CommonObject
* 2=Return key only (uid=qqq) * 2=Return key only (uid=qqq)
* @return string DN * @return string DN
*/ */
function _load_ldap_dn($info, $mode = 0) private function _load_ldap_dn($info, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -2412,13 +2412,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialise tableau info (tableau des attributs LDAP) * Initialise tableau info (tableau des attributs LDAP)
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs
*/ */
function _load_ldap_info() private function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -2525,7 +2525,7 @@ class Adherent extends CommonObject
* @param int $id Id of member to load * @param int $id Id of member to load
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT a.rowid, a.datec as datec,'; $sql = 'SELECT a.rowid, a.datec as datec,';
$sql.= ' a.datevalid as datev,'; $sql.= ' a.datevalid as datev,';
@@ -2581,7 +2581,7 @@ class Adherent extends CommonObject
* *
* @return int Number of EMailings * @return int Number of EMailings
*/ */
function getNbOfEMailings() public function getNbOfEMailings()
{ {
$sql = "SELECT count(mc.email) as nb"; $sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";

View File

@@ -89,7 +89,7 @@ class AdherentType extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = 1; $this->statut = 1;
@@ -103,7 +103,7 @@ class AdherentType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $conf;
@@ -170,7 +170,7 @@ class AdherentType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $hookmanager; global $conf, $hookmanager;
@@ -238,7 +238,7 @@ class AdherentType extends CommonObject
* *
* @return int > 0 if OK, 0 if not found, < 0 if KO * @return int > 0 if OK, 0 if not found, < 0 if KO
*/ */
function delete() public function delete()
{ {
global $user; global $user;
@@ -272,7 +272,7 @@ class AdherentType extends CommonObject
* @param int $rowid Id of member type to load * @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
@@ -306,13 +306,13 @@ class AdherentType extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of members' type * Return list of members' type
* *
* @return array List of types of members * @return array List of types of members
*/ */
function liste_array() public function liste_array()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -356,7 +356,7 @@ class AdherentType extends CommonObject
* 2=Return array of members id only * 2=Return array of members id only
* @return mixed Array of members or -1 on error * @return mixed Array of members or -1 on error
*/ */
function listMembersForMemberType($excludefilter = '', $mode = 0) public function listMembersForMemberType($excludefilter = '', $mode = 0)
{ {
global $conf, $user; global $conf, $user;
@@ -411,7 +411,7 @@ class AdherentType extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{ {
global $langs; global $langs;
@@ -434,12 +434,12 @@ class AdherentType extends CommonObject
* *
* @return string Return status of a type of member * @return string Return status of a type of member
*/ */
function getLibStatut() public function getLibStatut()
{ {
return ''; return '';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@@ -449,7 +449,7 @@ class AdherentType extends CommonObject
* 2=Return key only (uid=qqq) * 2=Return key only (uid=qqq)
* @return string DN * @return string DN
*/ */
function _load_ldap_dn($info, $mode = 0) private function _load_ldap_dn($info, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -461,13 +461,13 @@ class AdherentType extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions * Initialize the info array (array of LDAP values) that will be used to call LDAP functions
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs
*/ */
function _load_ldap_info() private function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -502,7 +502,7 @@ class AdherentType extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
@@ -530,7 +530,7 @@ class AdherentType extends CommonObject
* *
* @return string Return mail content of type or empty * @return string Return mail content of type or empty
*/ */
function getMailOnValid() public function getMailOnValid()
{ {
global $conf; global $conf;
@@ -547,7 +547,7 @@ class AdherentType extends CommonObject
* *
* @return string Return mail content of type or empty * @return string Return mail content of type or empty
*/ */
function getMailOnSubscription() public function getMailOnSubscription()
{ {
global $conf; global $conf;
@@ -565,7 +565,7 @@ class AdherentType extends CommonObject
* *
* @return string Return mail model content of type or empty * @return string Return mail model content of type or empty
*/ */
function getMailOnResiliate() public function getMailOnResiliate()
{ {
global $conf; global $conf;

View File

@@ -37,12 +37,12 @@ class AdherentStats extends Stats
*/ */
public $table_element; public $table_element;
var $socid; public $socid;
var $userid; public $userid;
var $from; public $from;
var $field; public $field;
var $where; public $where;
/** /**
@@ -52,7 +52,7 @@ class AdherentStats extends Stats
* @param int $socid Id third party * @param int $socid Id third party
* @param int $userid Id user for filter * @param int $userid Id user for filter
*/ */
function __construct($db, $socid = 0, $userid = 0) public function __construct($db, $socid = 0, $userid = 0)
{ {
global $user, $conf; global $user, $conf;
@@ -85,7 +85,7 @@ class AdherentStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of nb each month * @return array Array of nb each month
*/ */
function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
global $user; global $user;
@@ -105,7 +105,7 @@ class AdherentStats extends Stats
* *
* @return array Array of nb each year * @return array Array of nb each year
*/ */
function getNbByYear() public function getNbByYear()
{ {
global $user; global $user;
@@ -126,7 +126,7 @@ class AdherentStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of amount each month * @return array Array of amount each month
*/ */
function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
global $user; global $user;
@@ -147,7 +147,7 @@ class AdherentStats extends Stats
* @param int $year Year * @param int $year Year
* @return array Array of average each month * @return array Array of average each month
*/ */
function getAverageByMonth($year) public function getAverageByMonth($year)
{ {
global $user; global $user;
@@ -168,7 +168,7 @@ class AdherentStats extends Stats
* *
* @return array Array with nb, total amount, average for each year * @return array Array with nb, total amount, average for each year
*/ */
function getAllByYear() public function getAllByYear()
{ {
global $user; global $user;

View File

@@ -44,7 +44,7 @@ class Orders extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@@ -62,7 +62,7 @@ class Orders extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{ {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
@@ -100,7 +100,7 @@ class Orders extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@@ -185,7 +185,7 @@ class Orders extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of order * @return int ID of order
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401, "Insuffisant rights"); throw new RestException(401, "Insuffisant rights");
@@ -220,7 +220,7 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) public function getLines($id)
{ {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
@@ -252,7 +252,7 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function postLine($id, $request_data = null) public function postLine($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -314,7 +314,7 @@ class Orders extends DolibarrApi
* *
* @return object * @return object
*/ */
function putLine($id, $lineid, $request_data = null) public function putLine($id, $lineid, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -375,7 +375,7 @@ class Orders extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -413,7 +413,7 @@ class Orders extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function postContact($id, $contactid, $type) public function postContact($id, $contactid, $type)
{ {
if(!DolibarrApiAccess::$user->rights->commande->creer) { if(!DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -455,7 +455,7 @@ class Orders extends DolibarrApi
* @throws 404 * @throws 404
* @throws 500 * @throws 500
*/ */
function deleteContact($id, $rowid) public function deleteContact($id, $rowid)
{ {
if(!DolibarrApiAccess::$user->rights->commande->creer) { if(!DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -488,7 +488,7 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->commande->creer) { if (! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -529,7 +529,7 @@ class Orders extends DolibarrApi
* @param int $id Order ID * @param int $id Order ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->commande->supprimer) { if(! DolibarrApiAccess::$user->rights->commande->supprimer) {
throw new RestException(401); throw new RestException(401);
@@ -577,7 +577,7 @@ class Orders extends DolibarrApi
* *
* @return array * @return array
*/ */
function validate($id, $idwarehouse = 0, $notrigger = 0) public function validate($id, $idwarehouse = 0, $notrigger = 0)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -629,7 +629,7 @@ class Orders extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function reopen($id) public function reopen($id)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
@@ -667,7 +667,7 @@ class Orders extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function setinvoiced($id) public function setinvoiced($id)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
@@ -710,7 +710,7 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function close($id, $notrigger = 0) public function close($id, $notrigger = 0)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -756,7 +756,7 @@ class Orders extends DolibarrApi
* *
* @return array * @return array
*/ */
function settodraft($id, $idwarehouse = -1) public function settodraft($id, $idwarehouse = -1)
{ {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@@ -807,7 +807,7 @@ class Orders extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function createOrderFromProposal($proposalid) public function createOrderFromProposal($proposalid)
{ {
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
@@ -844,7 +844,7 @@ class Orders extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) private function _cleanObjectDatas($object)
{ {
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
@@ -866,7 +866,7 @@ class Orders extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$commande = array(); $commande = array();
foreach (Orders::$FIELDS as $field) { foreach (Orders::$FIELDS as $field) {

View File

@@ -243,7 +243,7 @@ class Commande extends CommonOrder
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
@@ -260,7 +260,7 @@ class Commande extends CommonOrder
* @param Societe $soc Object thirdparty * @param Societe $soc Object thirdparty
* @return string Order free reference * @return string Order free reference
*/ */
function getNextNumRef($soc) public function getNextNumRef($soc)
{ {
global $langs, $conf; global $langs, $conf;
$langs->load("order"); $langs->load("order");
@@ -318,7 +318,7 @@ class Commande extends CommonOrder
* @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 OK, 0=Nothing done, >0 if KO * @return int <=0 if OK, 0=Nothing done, >0 if KO
*/ */
function valid($user, $idwarehouse = 0, $notrigger = 0) public function valid($user, $idwarehouse = 0, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -471,7 +471,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@@ -479,7 +479,7 @@ class Commande extends CommonOrder
* @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_draft($user, $idwarehouse = -1) public function set_draft($user, $idwarehouse = -1)
{ {
//phpcs:enable //phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -562,7 +562,7 @@ class Commande extends CommonOrder
* @param User $user Object user that change status * @param User $user Object user that change status
* @return int <0 if KO, 0 if nothing is done, >0 if OK * @return int <0 if KO, 0 if nothing is done, >0 if OK
*/ */
function set_reopen($user) public function set_reopen($user)
{ {
// phpcs:enable // phpcs:enable
$error=0; $error=0;
@@ -622,7 +622,7 @@ class Commande extends CommonOrder
* @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
*/ */
function cloture($user, $notrigger = 0) public function cloture($user, $notrigger = 0)
{ {
global $conf; global $conf;
@@ -682,7 +682,7 @@ class Commande extends CommonOrder
* @param int $idwarehouse Id warehouse to use for stock change. * @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function cancel($idwarehouse = -1) public function cancel($idwarehouse = -1)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
@@ -763,7 +763,7 @@ class Commande extends CommonOrder
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
$error=0; $error=0;
@@ -1067,7 +1067,7 @@ class Commande extends CommonOrder
* @param int $socid Id of thirdparty * @param int $socid Id of thirdparty
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($socid = 0) public function createFromClone($socid = 0)
{ {
global $user,$hookmanager; global $user,$hookmanager;
@@ -1152,7 +1152,7 @@ class Commande extends CommonOrder
* @param User $user User making creation * @param User $user User making creation
* @return int <0 if KO, 0 if nothing done, 1 if OK * @return int <0 if KO, 0 if nothing done, 1 if OK
*/ */
function createFromProposal($object, User $user) public function createFromProposal($object, User $user)
{ {
global $conf, $hookmanager; global $conf, $hookmanager;
@@ -1309,7 +1309,7 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0) public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0)
{ {
global $mysoc, $conf, $langs, $user; global $mysoc, $conf, $langs, $user;
@@ -1523,7 +1523,7 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add line into array * Add line into array
* $this->client must be loaded * $this->client must be loaded
@@ -1531,14 +1531,14 @@ class Commande extends CommonOrder
* @param int $idproduct Product Id * @param int $idproduct Product Id
* @param float $qty Quantity * @param float $qty Quantity
* @param float $remise_percent Product discount relative * @param float $remise_percent Product discount relative
* @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param int $date_start Start date of the line
* @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param int $date_end End date of the line
* @return void * @return void
* *
* TODO Remplacer les appels a cette fonction par generation objet Ligne * TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products * insere dans tableau $this->products
*/ */
function add_product($idproduct, $qty, $remise_percent = 0.0, $date_start = '', $date_end = '') public function add_product($idproduct, $qty, $remise_percent = 0.0, $date_start = '', $date_end = '')
{ {
// phpcs:enable // phpcs:enable
global $conf, $mysoc; global $conf, $mysoc;
@@ -1583,7 +1583,6 @@ class Commande extends CommonOrder
$line->product_desc=$prod->description; $line->product_desc=$prod->description;
$line->fk_unit=$prod->fk_unit; $line->fk_unit=$prod->fk_unit;
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Save the start and end date of the line in the object // Save the start and end date of the line in the object
if ($date_start) { $line->date_start = $date_start; } if ($date_start) { $line->date_start = $date_start; }
if ($date_end) { $line->date_end = $date_end; } if ($date_end) { $line->date_end = $date_end; }
@@ -1623,7 +1622,7 @@ class Commande extends CommonOrder
* @param string $ref_int Internal reference of other object * @param string $ref_int Internal reference of other object
* @return int >0 if OK, <0 if KO, 0 if not found * @return int >0 if OK, <0 if KO, 0 if not found
*/ */
function fetch($id, $ref = '', $ref_ext = '', $ref_int = '') public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
{ {
// Check parameters // Check parameters
@@ -1776,7 +1775,7 @@ class Commande extends CommonOrder
* @param int $idremise Id de la remise fixe * @param int $idremise Id de la remise fixe
* @return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
*/ */
function insert_discount($idremise) public function insert_discount($idremise)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1848,14 +1847,14 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* 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
*/ */
function fetch_lines($only_product = 0) public function fetch_lines($only_product = 0)
{ {
// phpcs:enable // phpcs:enable
$this->lines=array(); $this->lines=array();
@@ -1971,7 +1970,7 @@ class Commande extends CommonOrder
* *
* @return int <0 if KO, Nbr of product lines if OK * @return int <0 if KO, Nbr of product lines if OK
*/ */
function getNbOfProductsLines() public function getNbOfProductsLines()
{ {
$nb=0; $nb=0;
foreach($this->lines as $line) foreach($this->lines as $line)
@@ -1986,7 +1985,7 @@ class Commande extends CommonOrder
* *
* @return int <0 if KO, Nbr of service lines if OK * @return int <0 if KO, Nbr of service lines if OK
*/ */
function getNbOfServicesLines() public function getNbOfServicesLines()
{ {
$nb=0; $nb=0;
foreach($this->lines as $line) foreach($this->lines as $line)
@@ -1997,11 +1996,11 @@ class Commande extends CommonOrder
} }
/** /**
* Count numbe rof shipments for this order * Count number of shipments for this order
* *
* @return int <0 if KO, Nb of shipment found if OK * @return int <0 if KO, Nb of shipment found if OK
*/ */
function getNbOfShipments() public function getNbOfShipments()
{ {
$nb = 0; $nb = 0;
@@ -2037,7 +2036,7 @@ class Commande extends CommonOrder
* @param int $filtre_statut Filter on shipment status * @param int $filtre_statut Filter on shipment status
* @return int <0 if KO, Nb of lines found if OK * @return int <0 if KO, Nb of lines found if OK
*/ */
function loadExpeditions($filtre_statut = -1) public function loadExpeditions($filtre_statut = -1)
{ {
$this->expeditions = array(); $this->expeditions = array();
@@ -2077,7 +2076,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns a array with expeditions lines number * Returns a array with expeditions lines number
* *
@@ -2085,7 +2084,7 @@ class Commande extends CommonOrder
* *
* TODO deprecate, move to Shipping class * TODO deprecate, move to Shipping class
*/ */
function nb_expedition() public function nb_expedition()
{ {
// phpcs:enable // phpcs:enable
$sql = 'SELECT count(*)'; $sql = 'SELECT count(*)';
@@ -2104,7 +2103,7 @@ class Commande extends CommonOrder
else dol_print_error($this->db); else dol_print_error($this->db);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return a array with the pending stock by product * Return a array with the pending stock by product
* *
@@ -2113,7 +2112,7 @@ class Commande extends CommonOrder
* *
* TODO FONCTION NON FINIE A FINIR * TODO FONCTION NON FINIE A FINIR
*/ */
function stock_array($filtre_statut = self::STATUS_CANCELED) public function stock_array($filtre_statut = self::STATUS_CANCELED)
{ {
// phpcs:enable // phpcs:enable
$this->stocks = array(); $this->stocks = array();
@@ -2153,7 +2152,7 @@ class Commande extends CommonOrder
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* @return int >0 if OK, 0 if nothing to do, <0 if KO * @return int >0 if OK, 0 if nothing to do, <0 if KO
*/ */
function deleteline($user = null, $lineid = 0) public function deleteline($user = null, $lineid = 0)
{ {
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
@@ -2222,7 +2221,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Applique une remise relative * Applique une remise relative
* *
@@ -2231,7 +2230,7 @@ class Commande extends CommonOrder
* @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
*/ */
function set_remise($user, $remise, $notrigger = 0) public function set_remise($user, $remise, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
@@ -2290,7 +2289,7 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Applique une remise absolue * Applique une remise absolue
* *
@@ -2299,7 +2298,7 @@ class Commande extends CommonOrder
* @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
*/ */
function set_remise_absolue($user, $remise, $notrigger = 0) public function set_remise_absolue($user, $remise, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
@@ -2358,7 +2357,7 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set the order date * Set the order date
* *
@@ -2367,7 +2366,7 @@ class Commande extends CommonOrder
* @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
*/ */
function set_date($user, $date, $notrigger = 0) public function set_date($user, $date, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
@@ -2424,7 +2423,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set the planned delivery date * Set the planned delivery date
* *
@@ -2433,7 +2432,7 @@ class Commande extends CommonOrder
* @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 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function set_date_livraison($user, $date_livraison, $notrigger = 0) public function set_date_livraison($user, $date_livraison, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
@@ -2490,7 +2489,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of orders (eventuelly filtered on a user) into an array * Return list of orders (eventuelly filtered on a user) into an array
* *
@@ -2504,7 +2503,7 @@ class Commande extends CommonOrder
* @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
*/ */
function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC') public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -2572,7 +2571,7 @@ class Commande extends CommonOrder
* @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 OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function availability($availability_id, $notrigger = 0) public function availability($availability_id, $notrigger = 0)
{ {
global $user; global $user;
@@ -2635,7 +2634,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update order demand_reason * Update order demand_reason
* *
@@ -2643,7 +2642,7 @@ class Commande extends CommonOrder
* @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 ok, <0 if ko * @return int >0 if ok, <0 if ko
*/ */
function demand_reason($demand_reason_id, $notrigger = 0) public function demand_reason($demand_reason_id, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -2707,7 +2706,7 @@ class Commande extends CommonOrder
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set customer ref * Set customer ref
* *
@@ -2716,7 +2715,7 @@ class Commande extends CommonOrder
* @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
*/ */
function set_ref_client($user, $ref_client, $notrigger = 0) public function set_ref_client($user, $ref_client, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
@@ -2779,7 +2778,7 @@ class Commande extends CommonOrder
* @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
*/ */
function classifyBilled(User $user, $notrigger = 0) public function classifyBilled(User $user, $notrigger = 0)
{ {
$error = 0; $error = 0;
@@ -2835,7 +2834,7 @@ class Commande extends CommonOrder
* *
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
function classifyUnBilled() public function classifyUnBilled()
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
$error = 0; $error = 0;
@@ -2914,7 +2913,7 @@ class Commande extends CommonOrder
* @param int $notrigger disable line update trigger * @param int $notrigger disable line update trigger
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{ {
global $conf, $mysoc, $langs, $user; global $conf, $mysoc, $langs, $user;
@@ -3104,7 +3103,7 @@ class Commande extends CommonOrder
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $conf; global $conf;
@@ -3199,7 +3198,7 @@ class Commande extends CommonOrder
* @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
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -3321,14 +3320,14 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Object user * @param User $user Object user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user) public function load_board($user)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@@ -3387,7 +3386,7 @@ class Commande extends CommonOrder
* *
* @return string Label * @return string Label
*/ */
function getLabelSource() public function getLabelSource()
{ {
global $langs; global $langs;
@@ -3403,12 +3402,12 @@ class Commande extends CommonOrder
* @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 of status * @return string Label of status
*/ */
function getLibStatut($mode) public function getLibStatut($mode)
{ {
return $this->LibStatut($this->statut, $this->billed, $mode); return $this->LibStatut($this->statut, $this->billed, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of status * Return label of status
* *
@@ -3418,7 +3417,7 @@ class Commande extends CommonOrder
* @param int $donotshowbilled Do not show billed status after order status * @param int $donotshowbilled Do not show billed status after order status
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($statut, $billed, $mode, $donotshowbilled = 0) public function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;
@@ -3430,72 +3429,72 @@ class Commande extends CommonOrder
if ($mode == 0) if ($mode == 0)
{ {
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled'); if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft'); elseif ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext; elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext; elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext; elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort'); if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort'); elseif ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext; elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext; elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext; elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceledShort'); if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceledShort');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraftShort'); elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraftShort');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'), 'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext; elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'), 'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'), 'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext; elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'), 'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBillShort'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBillShort');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDeliveredShort'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5'); if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0'); elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1'); elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3'); elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6'); elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceled'); if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceled');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraft'); elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraft');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext; elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3').' '.$langs->trans('StatusOrderSent').$billedtext; elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBill'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBill');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext; elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDelivered'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDelivered');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5'); if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0'); elseif ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1'); elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
if ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3'); elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6'); elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceled').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5'); if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceled').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraft').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0'); elseif ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraft').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidated').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1'); elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidated').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
if ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSent').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3'); elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSent').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBill').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4'); elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBill').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessed').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6'); elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessed').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDelivered').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6'); elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDelivered').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
} }
} }
@@ -3511,7 +3510,7 @@ class Commande extends CommonOrder
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@@ -3588,7 +3587,7 @@ class Commande extends CommonOrder
* @param int $id Id of order * @param int $id Id of order
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, date_creation as datec, tms as datem,'; $sql = 'SELECT c.rowid, date_creation as datec, tms as datem,';
$sql.= ' date_valid as datev,'; $sql.= ' date_valid as datev,';
@@ -3646,7 +3645,7 @@ class Commande extends CommonOrder
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $langs; global $langs;
@@ -3734,7 +3733,7 @@ class Commande extends CommonOrder
* *
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function load_state_board() public function load_state_board()
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -3776,7 +3775,7 @@ class Commande extends CommonOrder
* *
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function getLinesArray() public function getLinesArray()
{ {
return $this->fetch_lines(); return $this->fetch_lines();
} }
@@ -3880,7 +3879,7 @@ class OrderLine extends CommonOrderLine
public $table_element='commandedet'; public $table_element='commandedet';
var $oldline; public $oldline;
/** /**
* Id of parent order * Id of parent order
@@ -3897,38 +3896,37 @@ class OrderLine extends CommonOrderLine
public $commande_id; public $commande_id;
// From llx_commandedet // From llx_commandedet
var $fk_parent_line; public $fk_parent_line;
var $fk_facture; public $fk_facture;
/** /**
* @var string Order lines label * @var string Order lines label
*/ */
public $label; public $label;
var $fk_remise_except; public $fk_remise_except;
var $rang = 0; public $rang = 0;
var $fk_fournprice; public $fk_fournprice;
/** /**
* Buy price without taxes * Buy price without taxes
* @var float * @var float
*/ */
var $pa_ht; public $pa_ht;
var $marge_tx; public $marge_tx;
var $marque_tx; public $marque_tx;
/** /**
* @deprecated * @deprecated
* @see remise_percent, fk_remise_except * @see remise_percent, fk_remise_except
*/ */
var $remise; public $remise;
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Start and end date of the line // Start and end date of the line
var $date_start; public $date_start;
var $date_end; public $date_end;
var $skip_update_total; // Skip update price total for special lines public $skip_update_total; // Skip update price total for special lines
/** /**
@@ -3936,7 +3934,7 @@ class OrderLine extends CommonOrderLine
* *
* @param DoliDB $db handler d'acces base de donnee * @param DoliDB $db handler d'acces base de donnee
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db= $db; $this->db= $db;
} }
@@ -3947,7 +3945,7 @@ class OrderLine extends CommonOrderLine
* @param int $rowid Id line order * @param int $rowid Id line order
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,'; $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,';
$sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,'; $sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,';
@@ -4032,7 +4030,7 @@ class OrderLine extends CommonOrderLine
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function delete(User $user, $notrigger = 0) public function delete(User $user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
@@ -4093,7 +4091,7 @@ class OrderLine extends CommonOrderLine
* @param int $notrigger 1 = disable triggers * @param int $notrigger 1 = disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function insert($user = null, $notrigger = 0) public function insert($user = null, $notrigger = 0)
{ {
global $langs, $conf; global $langs, $conf;
@@ -4238,7 +4236,7 @@ class OrderLine extends CommonOrderLine
* @param int $notrigger 1 = disable triggers * @param int $notrigger 1 = disable triggers
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
@@ -4365,14 +4363,14 @@ class OrderLine extends CommonOrderLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* 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
*/ */
function update_total() public function update_total()
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();

View File

@@ -39,12 +39,12 @@ class CommandeStats extends Stats
*/ */
public $table_element; public $table_element;
var $socid; public $socid;
var $userid; public $userid;
var $from; public $from;
var $field; public $field;
var $where; public $where;
/** /**
@@ -55,7 +55,7 @@ class CommandeStats extends Stats
* @param string $mode Option ('customer', 'supplier') * @param string $mode Option ('customer', 'supplier')
* @param int $userid Id user for filter (creation user) * @param int $userid Id user for filter (creation user)
*/ */
function __construct($db, $socid, $mode, $userid = 0) public function __construct($db, $socid, $mode, $userid = 0)
{ {
global $user, $conf; global $user, $conf;
@@ -74,7 +74,7 @@ class CommandeStats extends Stats
$this->field_line='total_ht'; $this->field_line='total_ht';
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled $this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
} }
if ($mode == 'supplier') elseif ($mode == 'supplier')
{ {
$object=new CommandeFournisseur($this->db); $object=new CommandeFournisseur($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as c"; $this->from = MAIN_DB_PREFIX.$object->table_element." as c";
@@ -101,7 +101,7 @@ class CommandeStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month * @return array Array with number by month
*/ */
function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
global $user; global $user;
@@ -123,7 +123,7 @@ class CommandeStats extends Stats
* @return array Array with number by year * @return array Array with number by year
* *
*/ */
function getNbByYear() public function getNbByYear()
{ {
global $user; global $user;
@@ -144,7 +144,7 @@ class CommandeStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month * @return array Array with amount by month
*/ */
function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
global $user; global $user;
@@ -166,7 +166,7 @@ class CommandeStats extends Stats
* @param int $year year for stats * @param int $year year for stats
* @return array array with number by month * @return array array with number by month
*/ */
function getAverageByMonth($year) public function getAverageByMonth($year)
{ {
global $user; global $user;
@@ -186,7 +186,7 @@ class CommandeStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getAllByYear() public function getAllByYear()
{ {
global $user; global $user;
@@ -206,7 +206,7 @@ class CommandeStats extends Stats
* @param int $year Year to scan * @param int $year Year to scan
* @return array Array of values * @return array Array of values
*/ */
function getAllByProduct($year) public function getAllByProduct($year)
{ {
global $user; global $user;

View File

@@ -143,19 +143,19 @@ class Contact extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = 1; // By default, status is enabled $this->statut = 1; // By default, status is enabled
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load indicators into this->nb for board * Load indicators into this->nb for board
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_state_board() public function load_state_board()
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -200,7 +200,7 @@ class Contact extends CommonObject
* @param User $user Object user that create * @param User $user Object user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user) public function create($user)
{ {
global $conf, $langs; global $conf, $langs;
@@ -313,7 +313,7 @@ class Contact extends CommonObject
* @param int $nosyncuser No sync linked user (external users and contacts are linked) * @param int $nosyncuser No sync linked user (external users and contacts are linked)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($id, $user = null, $notrigger = 0, $action = 'update', $nosyncuser = 0) public function update($id, $user = null, $notrigger = 0, $action = 'update', $nosyncuser = 0)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
@@ -491,7 +491,7 @@ class Contact extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@@ -501,7 +501,7 @@ class Contact extends CommonObject
* 2=Return key only (uid=qqq) * 2=Return key only (uid=qqq)
* @return string DN * @return string DN
*/ */
function _load_ldap_dn($info, $mode = 0) private function _load_ldap_dn($info, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -513,13 +513,13 @@ class Contact extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialise tableau info (tableau des attributs LDAP) * Initialise tableau info (tableau des attributs LDAP)
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs
*/ */
function _load_ldap_info() private function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@@ -597,7 +597,7 @@ class Contact extends CommonObject
* @param int $notrigger 0=no, 1=yes * @param int $notrigger 0=no, 1=yes
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function update_perso($id, $user = null, $notrigger = 0) public function update_perso($id, $user = null, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
$error=0; $error=0;
@@ -686,7 +686,7 @@ class Contact extends CommonObject
* @param string $email Email * @param string $email Email
* @return int -1 if KO, 0 if OK but not found, 1 if OK * @return int -1 if KO, 0 if OK but not found, 1 if OK
*/ */
function fetch($id, $user = null, $ref_ext = '', $email = '') public function fetch($id, $user = null, $ref_ext = '', $email = '')
{ {
global $langs; global $langs;
@@ -869,7 +869,7 @@ class Contact extends CommonObject
* *
* @return void * @return void
*/ */
function setGenderFromCivility() public function setGenderFromCivility()
{ {
unset($this->gender); unset($this->gender);
if (in_array($this->civility_id, array('MR'))) { if (in_array($this->civility_id, array('MR'))) {
@@ -879,7 +879,7 @@ class Contact extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load number of elements the contact is used as a link for * Load number of elements the contact is used as a link for
* ref_facturation * ref_facturation
@@ -889,7 +889,7 @@ class Contact extends CommonObject
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function load_ref_elements() public function load_ref_elements()
{ {
// phpcs:enable // phpcs:enable
// Compte les elements pour lesquels il est contact // Compte les elements pour lesquels il est contact
@@ -931,7 +931,7 @@ class Contact extends CommonObject
* @param int $notrigger Disable all trigger * @param int $notrigger Disable all trigger
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($notrigger = 0) public function delete($notrigger = 0)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@@ -1045,7 +1045,7 @@ class Contact extends CommonObject
* @param int $id Id du contact a charger * @param int $id Id du contact a charger
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,"; $sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,";
$sql.= " c.tms as tms, c.fk_user_modif"; $sql.= " c.tms as tms, c.fk_user_modif";
@@ -1090,7 +1090,7 @@ class Contact extends CommonObject
* *
* @return int Number of EMailings * @return int Number of EMailings
*/ */
function getNbOfEMailings() public function getNbOfEMailings()
{ {
$sql = "SELECT count(mc.email) as nb"; $sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m";
@@ -1125,7 +1125,7 @@ class Contact extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0) public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
@@ -1203,7 +1203,7 @@ class Contact extends CommonObject
* *
* @return string Translated name of civility * @return string Translated name of civility
*/ */
function getCivilityLabel() public function getCivilityLabel()
{ {
global $langs; global $langs;
$langs->load("dict"); $langs->load("dict");
@@ -1219,12 +1219,12 @@ class Contact 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 contact status * @return string Label of contact status
*/ */
function getLibStatut($mode) public function getLibStatut($mode)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut($this->statut, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@@ -1232,7 +1232,7 @@ class Contact 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 Libelle * @return string Libelle
*/ */
function LibStatut($statut, $mode) public function LibStatut($statut, $mode)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1270,14 +1270,14 @@ class Contact extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return translated label of Public or Private * Return translated label of Public or Private
* *
* @param int $statut Type (0 = public, 1 = private) * @param int $statut Type (0 = public, 1 = private)
* @return string Label translated * @return string Label translated
*/ */
function LibPubPriv($statut) public function LibPubPriv($statut)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1293,14 +1293,13 @@ class Contact extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
// Get first id of existing company and save it into $socid // Get first id of existing company and save it into $socid
$socid = 0; $socid = 0;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe ORDER BY rowid LIMIT 1"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe ORDER BY rowid LIMIT 1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) $socid=$obj->rowid; if ($obj) $socid=$obj->rowid;
} }
@@ -1337,7 +1336,7 @@ class Contact extends CommonObject
* @param int $statut Status to set * @param int $statut Status to set
* @return int <0 if KO, 0 if nothing is done, >0 if OK * @return int <0 if KO, 0 if nothing is done, >0 if OK
*/ */
function setstatus($statut) public function setstatus($statut)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;

View File

@@ -57,7 +57,7 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase
* *
* @return AccountingAccountTest * @return AccountingAccountTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class ActionCommTest extends PHPUnit_Framework_TestCase
* *
* @return ActionCommTest * @return ActionCommTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
* *
* @return AdherentTest * @return AdherentTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class AdminLibTest extends PHPUnit_Framework_TestCase
* *
* @return AdminLibTest * @return AdminLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
* *
* @return BankAccountTest * @return BankAccountTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -60,7 +60,7 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase
* *
* @return BankAccountTest * @return BankAccountTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -87,7 +87,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
* *
* @return BuildDocTest * @return BuildDocTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
* *
* @return CMailFile * @return CMailFile
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
* *
* @return CategorieTest * @return CategorieTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
* *
* @return ChargeSocialesTest * @return ChargeSocialesTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -70,7 +70,7 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
* *
* @return SecurityTest * @return SecurityTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -70,7 +70,7 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
* *
* @return SecurityTest * @return SecurityTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
* *
* @return CommandeFournisseurTest * @return CommandeFournisseurTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
* *
* @return CommandeTest * @return CommandeTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class CommonInvoiceTest extends PHPUnit\Framework\TestCase
* *
* @return CommonObjectTest * @return CommonObjectTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
* *
* @return CommonObjectTest * @return CommonObjectTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
* *
* @return CompanyBankAccountTest * @return CompanyBankAccountTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class CompanyLibTest extends PHPUnit_Framework_TestCase
* *
* @return AdminLibTest * @return AdminLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -66,7 +66,7 @@ class ContactTest extends PHPUnit_Framework_TestCase
* *
* @return ContactTest * @return ContactTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class ContratTest extends PHPUnit_Framework_TestCase
* *
* @return ContratTest * @return ContratTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -60,7 +60,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
* *
* @return CoreTest * @return CoreTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class DateLibTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class DiscountTest extends PHPUnit_Framework_TestCase
* *
* @return DiscountTest * @return DiscountTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
* *
* @return EntrepotTest * @return EntrepotTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class ExpenseReportTest extends PHPUnit_Framework_TestCase
* *
* @return ExpenseReportTest * @return ExpenseReportTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -62,7 +62,7 @@ class ExportTest extends PHPUnit_Framework_TestCase
* *
* @return ExportTest * @return ExportTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
* *
* @return FactureFournisseurTest * @return FactureFournisseurTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
* *
* @return FactureTest * @return FactureTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class FactureTest extends PHPUnit_Framework_TestCase
* *
* @return FactureTest * @return FactureTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
* *
* @return FactureTest * @return FactureTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class FichinterTest extends PHPUnit_Framework_TestCase
* *
* @return ContratTest * @return ContratTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
* *
* @return FilesLibTest * @return FilesLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class FormAdminTest extends PHPUnit_Framework_TestCase
* *
* @return FactureTest * @return FactureTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
* *
* @return CoreTest * @return CoreTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
* *
* @return CoreTest * @return CoreTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class GetUrlLibTest extends PHPUnit_Framework_TestCase
* *
* @return FilesLibTest * @return FilesLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -60,7 +60,7 @@ class HolidayTest extends PHPUnit_Framework_TestCase
* *
* @return HolidayTest * @return HolidayTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase
* *
* @return ImagesLibTest * @return ImagesLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -60,7 +60,7 @@ class ImportTest extends PHPUnit_Framework_TestCase
* *
* @return ImportTest * @return ImportTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -28,16 +28,16 @@ global $conf,$user,$langs,$db;
//require_once 'PHPUnit/Autoload.php'; //require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
/** /**
@@ -60,7 +60,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
* *
* @return CoreTest * @return CoreTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
@@ -138,36 +138,36 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
$arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]'; $arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]';
$encoded=json_encode($arraytotest); $encoded=json_encode($arraytotest);
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected, $encoded);
$decoded=json_decode($encoded,true); $decoded=json_decode($encoded, true);
$this->assertEquals($arraytotest,$decoded,'test for json_xxx'); $this->assertEquals($arraytotest, $decoded, 'test for json_xxx');
$encoded=dol_json_encode($arraytotest); $encoded=dol_json_encode($arraytotest);
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected, $encoded);
$decoded=dol_json_decode($encoded,true); $decoded=dol_json_decode($encoded, true);
$this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx'); $this->assertEquals($arraytotest, $decoded, 'test for dol_json_xxx');
// Same test but array start with 2 instead of 0 // Same test but array start with 2 instead of 0
$arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "')); $arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
$arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}'; $arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}';
$encoded=json_encode($arraytotest); $encoded=json_encode($arraytotest);
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected, $encoded);
$decoded=json_decode($encoded,true); $decoded=json_decode($encoded, true);
$this->assertEquals($arraytotest,$decoded,'test for json_xxx'); $this->assertEquals($arraytotest, $decoded, 'test for json_xxx');
$encoded=dol_json_encode($arraytotest); $encoded=dol_json_encode($arraytotest);
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected, $encoded);
$decoded=dol_json_decode($encoded,true); $decoded=dol_json_decode($encoded, true);
$this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx'); $this->assertEquals($arraytotest, $decoded, 'test for dol_json_xxx');
// Test with object // Test with object
$now=gmmktime(12,0,0,1,1,1970); $now=gmmktime(12, 0, 0, 1, 1, 1970);
$objecttotest=new stdClass(); $objecttotest=new stdClass();
$objecttotest->property1='abc'; $objecttotest->property1='abc';
$objecttotest->property2=1234; $objecttotest->property2=1234;
$objecttotest->property3=$now; $objecttotest->property3=$now;
$encoded=dol_json_encode($objecttotest); $encoded=dol_json_encode($objecttotest);
$this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}',$encoded); $this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}', $encoded);
} }
} }

View File

@@ -70,7 +70,7 @@ class LangTest extends PHPUnit_Framework_TestCase
* *
* @return SecurityTest * @return SecurityTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class LoanTest extends PHPUnit_Framework_TestCase
* *
* @return LoanTest * @return LoanTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase
* *
* @return BuildDocTest * @return BuildDocTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -60,7 +60,7 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
* *
* @return ContratTest * @return ContratTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
* *
* @return NumberingModulesTest * @return NumberingModulesTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class PaypalTest extends PHPUnit_Framework_TestCase
* *
* @return ProductTest * @return ProductTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
* *
* @return PdfDocTest * @return PdfDocTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -60,7 +60,7 @@ class PgsqlTest extends PHPUnit_Framework_TestCase
* *
* @return ContactTest * @return ContactTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -65,7 +65,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
* *
* @return CoreTest * @return CoreTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class ProductTest extends PHPUnit_Framework_TestCase
* *
* @return ProductTest * @return ProductTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -59,7 +59,7 @@ class ProjectTest extends PHPUnit_Framework_TestCase
* *
* @return ProjectTest * @return ProjectTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class PropalTest extends PHPUnit_Framework_TestCase
* *
* @return PropalTest * @return PropalTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -62,7 +62,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -70,7 +70,7 @@ class ScriptsTest extends PHPUnit_Framework_TestCase
* *
* @return SecurityTest * @return SecurityTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -70,7 +70,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase
* *
* @return SecurityTest * @return SecurityTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -58,7 +58,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
* *
* @return SocieteTest * @return SocieteTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
* *
* @return PropalTest * @return PropalTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
* *
* @return UserGroupTest * @return UserGroupTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class UserTest extends PHPUnit_Framework_TestCase
* *
* @return UserTest * @return UserTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class UtilsTest extends PHPUnit_Framework_TestCase
* *
* @return UserTest * @return UserTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -67,7 +67,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -68,7 +68,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -68,7 +68,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -61,7 +61,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
* *
* @return DateLibTest * @return DateLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();

View File

@@ -57,7 +57,7 @@ class XCalLibTest extends PHPUnit_Framework_TestCase
* *
* @return FilesLibTest * @return FilesLibTest
*/ */
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();