Merge branch 'develop' of github.com:Dolibarr/dolibarr into theme_top_menu

This commit is contained in:
John BOTELLA 2019-03-04 11:32:16 +01:00
commit 7cadaca8fc
652 changed files with 18689 additions and 18790 deletions

View File

@ -309,7 +309,7 @@ script:
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
set +e set +e
echo echo

View File

@ -34,7 +34,7 @@ Swift Mailer 5.4.2-DEV MIT license Yes
Stripe 4.7.0 MIT licence Yes Library for Stripe module Stripe 4.7.0 MIT licence Yes Library for Stripe module
JS libraries: JS libraries:
jQuery 3.1.1 MIT License Yes JS library jQuery 3.3.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)

View File

@ -11,8 +11,6 @@
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern> <exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern> <exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern> <exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*.min.css</exclude-pattern>
<exclude-pattern type="relative">*.js</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->
@ -201,7 +199,7 @@
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint"> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Squiz.Scope.MethodScope.Missing" />
<!-- Rules from PEAR Standard --> <!-- Rules from PEAR Standard -->

View File

@ -50,7 +50,7 @@ class autoTranslator
* @param string $_apikey Api key * @param string $_apikey Api key
* @return void * @return void
*/ */
function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey) public function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey)
{ {
// Set enviorment variables // Set enviorment variables

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

@ -167,10 +167,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref); $this->doc_ref = trim($this->doc_ref);
} }
if (isset($this->fk_doc)) { if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc); $this->fk_doc = (int) $this->fk_doc;
} }
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = (int) $this->fk_docdet;
} }
if (isset($this->thirdparty_code)) { if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code); $this->thirdparty_code = trim($this->thirdparty_code);
@ -411,7 +411,7 @@ class BookKeeping 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, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -487,10 +487,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref); $this->doc_ref = trim($this->doc_ref);
} }
if (isset($this->fk_doc)) { if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc); $this->fk_doc = (int) $this->fk_doc;
} }
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = (int) $this->fk_docdet;
} }
if (isset($this->thirdparty_code)) { if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code); $this->thirdparty_code = trim($this->thirdparty_code);
@ -1104,10 +1104,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref); $this->doc_ref = trim($this->doc_ref);
} }
if (isset($this->fk_doc)) { if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc); $this->fk_doc = (int) $this->fk_doc;
} }
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = (int) $this->fk_docdet;
} }
if (isset($this->thirdparty_code)) { if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code); $this->thirdparty_code = trim($this->thirdparty_code);
@ -1308,7 +1308,7 @@ class BookKeeping extends CommonObject
* @param string $importkey Import key * @param string $importkey Import key
* @return int Result * @return int Result
*/ */
function deleteByImportkey($importkey) public function deleteByImportkey($importkey)
{ {
$this->db->begin(); $this->db->begin();
@ -1338,7 +1338,7 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '') public function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '')
{ {
global $conf; global $conf;
@ -1378,7 +1378,7 @@ class BookKeeping extends CommonObject
* @param int $piecenum Piecenum to delete * @param int $piecenum Piecenum to delete
* @return int Result * @return int Result
*/ */
function deleteMvtNum($piecenum) public function deleteMvtNum($piecenum)
{ {
global $conf; global $conf;
@ -1473,8 +1473,8 @@ class BookKeeping extends CommonObject
$this->doc_date = $now; $this->doc_date = $now;
$this->doc_type = ''; $this->doc_type = '';
$this->doc_ref = ''; $this->doc_ref = '';
$this->fk_doc = ''; $this->fk_doc = 0;
$this->fk_docdet = ''; $this->fk_docdet = 0;
$this->thirdparty_code = 'CU001'; $this->thirdparty_code = 'CU001';
$this->subledger_account = '41100001'; $this->subledger_account = '41100001';
$this->subledger_label = 'My customer company'; $this->subledger_label = 'My customer company';
@ -1565,7 +1565,7 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAllPerMvt($piecenum, $mode = '') public function fetchAllPerMvt($piecenum, $mode = '')
{ {
global $conf; global $conf;
@ -1618,14 +1618,14 @@ class BookKeeping extends CommonObject
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Export bookkeping * Export bookkeping
* *
* @param string $model Model * @param string $model Model
* @return int Result * @return int Result
*/ */
function export_bookkeping($model = 'ebp') public function export_bookkeping($model = 'ebp')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1771,7 +1771,7 @@ class BookKeeping extends CommonObject
*/ */
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of accounts with label by chart of accounts * Return list of accounts with label by chart of accounts
* *
@ -1784,7 +1784,7 @@ class BookKeeping extends CommonObject
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1843,14 +1843,14 @@ class BookKeeping extends CommonObject
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Description of a root accounting account * Description of a root accounting account
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string Root account * @return string Root account
*/ */
function get_compte_racine($account = null) public function get_compte_racine($account = null)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1884,14 +1884,14 @@ class BookKeeping extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Description of accounting account * Description of accounting account
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string Account desc * @return string Account desc
*/ */
function get_compte_desc($account = null) public function get_compte_desc($account = null)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;

View File

@ -32,15 +32,15 @@ abstract class ActionsAdherentCardCommon
*/ */
public $db; public $db;
var $dirmodule; public $dirmodule;
var $targetmodule; public $targetmodule;
var $canvas; public $canvas;
var $card; public $card;
//! Template container //! Template container
var $tpl = array(); public $tpl = array();
//! Object container //! Object container
var $object; public $object;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
@ -59,7 +59,7 @@ abstract class ActionsAdherentCardCommon
* @param int $id Object id * @param int $id Object id
* @return object Object loaded * @return object Object loaded
*/ */
function getObject($id) public function getObject($id)
{ {
//$ret = $this->getInstanceDao(); //$ret = $this->getInstanceDao();
@ -75,7 +75,7 @@ abstract class ActionsAdherentCardCommon
//} //}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
@ -83,7 +83,7 @@ abstract class ActionsAdherentCardCommon
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;

View File

@ -39,7 +39,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function __construct($db, $dirmodule, $targetmodule, $canvas, $card) public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $db; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
@ -67,7 +67,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
@ -75,7 +75,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param int $id Id * @param int $id Id
* @return void * @return void
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $limit, $offset, $sortfield, $sortorder; global $limit, $offset, $sortfield, $sortorder;
@ -122,7 +122,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Fetch datas list and save into ->list_datas * Fetch datas list and save into ->list_datas
* *
@ -132,7 +132,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param string $sortorder Sort order ('ASC' or 'DESC') * @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void * @return void
*/ */
function LoadListDatas($limit, $offset, $sortfield, $sortorder) public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;

View File

@ -223,7 +223,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;
@ -234,7 +234,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.
* *
@ -251,7 +251,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;
@ -296,7 +296,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;
@ -363,7 +363,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; }
@ -379,7 +379,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;
@ -505,7 +505,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;
@ -760,7 +760,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.
@ -768,7 +768,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();
@ -825,7 +825,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;
@ -935,7 +935,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;
@ -1046,7 +1046,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;
@ -1080,7 +1080,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;
@ -1116,14 +1116,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;
@ -1147,7 +1147,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
* *
@ -1155,7 +1155,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;
@ -1191,7 +1191,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;
@ -1325,7 +1325,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
@ -1333,7 +1333,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;
@ -1409,7 +1409,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;
@ -1495,7 +1495,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;
@ -1788,7 +1788,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;
@ -1841,7 +1841,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;
@ -1883,13 +1883,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;
@ -1942,13 +1942,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;
@ -2006,7 +2006,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");
@ -2027,7 +2027,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;
@ -2118,12 +2118,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
* *
@ -2133,7 +2133,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;
@ -2211,13 +2211,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;
@ -2247,14 +2247,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;
@ -2346,7 +2346,7 @@ class Adherent extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $user,$langs; global $user,$langs;
@ -2400,7 +2400,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
* *
@ -2410,7 +2410,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;
@ -2422,13 +2422,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;
@ -2536,7 +2536,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,';
@ -2592,7 +2592,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";
@ -2774,9 +2774,13 @@ class Adherent extends CommonObject
{ {
$adherent->fetch_thirdparty(); $adherent->fetch_thirdparty();
// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
$languagefromcountrycode = getLanguageCodeFromCountryCode($adherent->country_code ? $adherent->country_code : $adherent->thirdparty->country_code);
$languagecodeformember = (empty($adherent->thirdparty->default_lang) ? ($languagefromcountrycode ? $languagefromcountrycode : $mysoc->default_lang) : $adherent->thirdparty->default_lang);
// Send reminder email // Send reminder email
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); $outputlangs->setDefaultLang($languagecodeformember);
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members"));
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang); dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);

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

@ -41,7 +41,7 @@ class Members extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -57,7 +57,7 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if(! DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
@ -91,7 +91,7 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -162,7 +162,7 @@ class Members extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of member * @return int ID of member
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
@ -187,7 +187,7 @@ class Members extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
@ -242,7 +242,7 @@ class Members extends DolibarrApi
* @param int $id member ID * @param int $id member ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->supprimer) { if(! DolibarrApiAccess::$user->rights->adherent->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -277,7 +277,7 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$member = array(); $member = array();
foreach (Members::$FIELDS as $field) { foreach (Members::$FIELDS as $field) {
@ -294,7 +294,7 @@ class Members 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);
@ -328,7 +328,7 @@ class Members extends DolibarrApi
* *
* @url GET {id}/subscriptions * @url GET {id}/subscriptions
*/ */
function getSubscriptions($id) public function getSubscriptions($id)
{ {
$obj_ret = array(); $obj_ret = array();
@ -361,7 +361,7 @@ class Members extends DolibarrApi
* *
* @url POST {id}/subscriptions * @url POST {id}/subscriptions
*/ */
function createSubscription($id, $start_date, $end_date, $amount, $label = '') public function createSubscription($id, $start_date, $end_date, $amount, $label = '')
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
@ -389,7 +389,7 @@ class Members extends DolibarrApi
* *
* @url GET {id}/categories * @url GET {id}/categories
*/ */
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{ {
if (! DolibarrApiAccess::$user->rights->categorie->lire) { if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401); throw new RestException(401);

View File

@ -37,7 +37,7 @@ class MembersTypes extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -53,7 +53,7 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if(! DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
@ -86,7 +86,7 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -154,7 +154,7 @@ class MembersTypes extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of member type * @return int ID of member type
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
@ -179,7 +179,7 @@ class MembersTypes extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
@ -220,7 +220,7 @@ class MembersTypes extends DolibarrApi
* @param int $id member type ID * @param int $id member type ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
@ -255,7 +255,7 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$membertype = array(); $membertype = array();
foreach (MembersTypes::$FIELDS as $field) { foreach (MembersTypes::$FIELDS as $field) {
@ -272,7 +272,7 @@ class MembersTypes 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);

View File

@ -40,7 +40,7 @@ class Subscriptions extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -56,7 +56,7 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
@ -85,7 +85,7 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -151,7 +151,7 @@ class Subscriptions extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of subscription * @return int ID of subscription
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
@ -176,7 +176,7 @@ class Subscriptions extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
@ -209,7 +209,7 @@ class Subscriptions extends DolibarrApi
* @param int $id ID of subscription to delete * @param int $id ID of subscription to delete
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
// The right to delete a subscription comes with the right to create one. // The right to delete a subscription comes with the right to create one.
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
@ -241,7 +241,7 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$subscription = array(); $subscription = array();
foreach (Subscriptions::$FIELDS as $field) { foreach (Subscriptions::$FIELDS as $field) {

View File

@ -71,7 +71,7 @@ class Subscription 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;
} }
@ -84,7 +84,7 @@ class Subscription extends CommonObject
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK * @return int <0 if KO, Id subscription created if OK
*/ */
function create($user, $notrigger = false) public function create($user, $notrigger = false)
{ {
global $langs; global $langs;
@ -155,7 +155,7 @@ class Subscription extends CommonObject
* @param int $rowid Id subscription * @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK * @return int <0 if KO, =0 if not found, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql ="SELECT rowid, fk_type, fk_adherent, datec,"; $sql ="SELECT rowid, fk_type, fk_adherent, datec,";
$sql.=" tms,"; $sql.=" tms,";
@ -207,7 +207,7 @@ class Subscription extends CommonObject
* @param int $notrigger 0=Disable triggers * @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
$error = 0; $error = 0;
@ -263,7 +263,7 @@ class Subscription extends CommonObject
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function delete($user, $notrigger = false) public function delete($user, $notrigger = false)
{ {
$error = 0; $error = 0;
@ -356,7 +356,7 @@ class Subscription 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($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{ {
global $langs; global $langs;
@ -395,19 +395,19 @@ class Subscription 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 ''; return '';
} }
// 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
* *
* @param int $statut Id statut * @param int $statut Id statut
* @return string Label * @return string Label
*/ */
function LibStatut($statut) public function LibStatut($statut)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -421,7 +421,7 @@ class Subscription extends CommonObject
* @param int $id Id subscription * @param int $id Id subscription
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, c.datec,'; $sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem'; $sql.= ' c.tms as datem';

View File

@ -511,7 +511,7 @@ if (! empty($arrayfields['state.nom']['checked']))
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Phone pro // Phone pro

View File

@ -69,7 +69,7 @@ class PrestaShopWebservice
* @param string $key Authentification key * @param string $key Authentification key
* @param mixed $debug Debug mode Activated (true) or deactivated (false) * @param mixed $debug Debug mode Activated (true) or deactivated (false)
*/ */
function __construct($url, $key, $debug = true) public function __construct($url, $key, $debug = true)
{ {
if (!extension_loaded('curl')) if (!extension_loaded('curl'))
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');

View File

@ -54,7 +54,7 @@ class Dolistore
* *
* @param boolean $debug Enable debug of request on screen * @param boolean $debug Enable debug of request on screen
*/ */
function __construct($debug = false) public function __construct($debug = false)
{ {
global $conf, $langs; global $conf, $langs;
@ -77,7 +77,7 @@ class Dolistore
* @param array $options Options * @param array $options Options
* @return void * @return void
*/ */
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{ {
global $conf, $langs; global $conf, $langs;
@ -163,14 +163,14 @@ class Dolistore
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return tree of Dolistore categories. $this->categories must have been loaded before. * Return tree of Dolistore categories. $this->categories must have been loaded before.
* *
* @param int $parent Id of parent category * @param int $parent Id of parent category
* @return string * @return string
*/ */
function get_categories($parent = 0) public function get_categories($parent = 0)
{ {
// phpcs:enable // phpcs:enable
if (!isset($this->categories)) die('not possible'); if (!isset($this->categories)) die('not possible');
@ -212,13 +212,13 @@ class Dolistore
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of product formated for output * Return list of product formated for output
* *
* @return string HTML output * @return string HTML output
*/ */
function get_products() public function get_products()
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;
@ -295,39 +295,39 @@ class Dolistore
return $html; return $html;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get previous link * get previous link
* *
* @param string $text symbol previous * @param string $text symbol previous
* @return string html previous link * @return string html previous link
*/ */
function get_previous_link($text = '<<') public function get_previous_link($text = '<<')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get next link * get next link
* *
* @param string $text symbol next * @param string $text symbol next
* @return string html next link * @return string html next link
*/ */
function get_next_link($text = '>>') public function get_next_link($text = '>>')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get previous url * get previous url
* *
* @return string previous url * @return string previous url
*/ */
function get_previous_url() public function get_previous_url()
{ {
// phpcs:enable // phpcs:enable
$param_array = array(); $param_array = array();
@ -345,13 +345,13 @@ class Dolistore
return $this->url."&".$param; return $this->url."&".$param;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get next url * get next url
* *
* @return string next url * @return string next url
*/ */
function get_next_url() public function get_next_url()
{ {
// phpcs:enable // phpcs:enable
$param_array = array(); $param_array = array();
@ -369,7 +369,7 @@ class Dolistore
return $this->url."&".$param; return $this->url."&".$param;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* version compare * version compare
* *
@ -377,7 +377,7 @@ class Dolistore
* @param string $v2 version 2 * @param string $v2 version 2
* @return int result of compare * @return int result of compare
*/ */
function version_compare($v1, $v2) public function version_compare($v1, $v2)
{ {
// phpcs:enable // phpcs:enable
$v1 = explode('.', $v1); $v1 = explode('.', $v1);

View File

@ -457,10 +457,10 @@ if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouM
print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup'); print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup');
// Start to show page // Start to show page
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n"; if ($mode=='common') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n"; if ($mode=='marketplace') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n"; if ($mode=='deploy') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n"; if ($mode=='develop') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
$head = modules_prepare_head(); $head = modules_prepare_head();

View File

@ -81,7 +81,7 @@ if ($action == 'addprinter' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter); $result= $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) if (! $error)
@ -107,7 +107,7 @@ if ($action == 'deleteprinter' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->DeletePrinter($printerid); $result= $printer->deletePrinter($printerid);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) if (! $error)
@ -133,7 +133,7 @@ if ($action == 'updateprinter' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid); $result= $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) { if (! $error) {
@ -156,7 +156,7 @@ if ($action == 'testprinter' && $user->admin) {
if (! $error) { if (! $error) {
// test // test
$ret = $printer->SendTestToPrinter($printerid); $ret = $printer->sendTestToPrinter($printerid);
if ($ret == 0) { if ($ret == 0) {
setEventMessages($langs->trans("TestSentToPrinter", $printername), null); setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
} else { } else {
@ -176,7 +176,7 @@ if ($action == 'updatetemplate' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->UpdateTemplate($templatename, $template, $templateid); $result= $printer->updateTemplate($templatename, $template, $templateid);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) { if (! $error) {

View File

@ -37,7 +37,7 @@ class DolibarrApi
/** /**
* @var Restler $r Restler object * @var Restler $r Restler object
*/ */
var $r; public $r;
/** /**
* Constructor * Constructor
@ -46,7 +46,7 @@ class DolibarrApi
* @param string $cachedir Cache dir * @param string $cachedir Cache dir
* @param boolean $refreshCache Update cache * @param boolean $refreshCache Update cache
*/ */
function __construct($db, $cachedir = '', $refreshCache = false) public function __construct($db, $cachedir = '', $refreshCache = false)
{ {
global $conf, $dolibarr_main_url_root; global $conf, $dolibarr_main_url_root;
@ -87,16 +87,16 @@ class DolibarrApi
); );
}*/ }*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @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) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
// Remove $db object property for object // Remove $db object property for object
unset($object->db); unset($object->db);
unset($object->isextrafieldmanaged); unset($object->isextrafieldmanaged);
@ -208,6 +208,7 @@ class DolibarrApi
return $object; return $object;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Check user access to a resource * Check user access to a resource
* *
@ -222,9 +223,9 @@ class DolibarrApi
* @return bool * @return bool
* @throws RestException * @throws RestException
*/ */
static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
{ {
// phpcs:enable
// Features/modules to check // Features/modules to check
$featuresarray = array($resource); $featuresarray = array($resource);
if (preg_match('/&/', $resource)) { if (preg_match('/&/', $resource)) {
@ -242,14 +243,16 @@ class DolibarrApi
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Return if a $sqlfilters parameter is valid * Return if a $sqlfilters parameter is valid
* *
* @param string $sqlfilters sqlfilter string * @param string $sqlfilters sqlfilter string
* @return boolean True if valid, False if not valid * @return boolean True if valid, False if not valid
*/ */
function _checkFilters($sqlfilters) protected function _checkFilters($sqlfilters)
{ {
// phpcs:enable
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
$tmp=$sqlfilters; $tmp=$sqlfilters;
@ -271,14 +274,15 @@ class DolibarrApi
return true; return true;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Function to forge a SQL criteria * Function to forge a SQL criteria
* *
* @param array $matches Array of found string by regex search * @param array $matches Array of found string by regex search
* @return string Forged criteria. Example: "t.field like 'abc%'" * @return string Forged criteria. Example: "t.field like 'abc%'"
*/ */
static function _forge_criteria_callback($matches) protected static function _forge_criteria_callback($matches)
{ {
// phpcs:enable // phpcs:enable
global $db; global $db;

View File

@ -43,7 +43,7 @@ class Documents extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;
@ -67,7 +67,7 @@ class Documents extends DolibarrApi
* *
* @url GET /download * @url GET /download
*/ */
public function index($module_part, $original_file='') public function index($module_part, $original_file = '')
{ {
global $conf, $langs; global $conf, $langs;
@ -86,8 +86,7 @@ class Documents extends DolibarrApi
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file']; $original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
{
throw new RestException(401); throw new RestException(401);
} }
if (!$accessallowed) { if (!$accessallowed) {
@ -127,7 +126,7 @@ class Documents extends DolibarrApi
* *
* @url PUT /builddoc * @url PUT /builddoc
*/ */
public function builddoc($module_part, $original_file='', $doctemplate='', $langcode='') public function builddoc($module_part, $original_file = '', $doctemplate = '', $langcode = '')
{ {
global $conf, $langs; global $conf, $langs;
@ -153,7 +152,7 @@ class Documents extends DolibarrApi
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file']; $original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) { if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
throw new RestException(401); throw new RestException(401);
} }
if (!$accessallowed) { if (!$accessallowed) {
@ -245,7 +244,7 @@ class Documents extends DolibarrApi
* *
* @url GET / * @url GET /
*/ */
function getDocumentsListByElement($modulepart, $id=0, $ref='', $sortfield='', $sortorder='') public function getDocumentsListByElement($modulepart, $id = 0, $ref = '', $sortfield = '', $sortorder = '')
{ {
global $conf; global $conf;
@ -392,7 +391,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
} }
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
if (empty($filearray)) { if (empty($filearray)) {
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.'); throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.');
} }
@ -428,6 +427,7 @@ class Documents extends DolibarrApi
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided) * @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'} * @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'}
* @param int $overwriteifexists Overwrite file if exists (1 by default) * @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return string
* *
* @throws 200 * @throws 200
* @throws 400 * @throws 400
@ -437,7 +437,7 @@ class Documents extends DolibarrApi
* *
* @url POST /upload * @url POST /upload
*/ */
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0) public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0)
{ {
global $db, $conf; global $db, $conf;
@ -592,6 +592,7 @@ class Documents extends DolibarrApi
return dol_basename($destfile); return dol_basename($destfile);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
@ -599,7 +600,8 @@ class Documents extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate_file($data) { private function _validate_file($data) {
// phpcs:enable
$result = array(); $result = array();
foreach (Documents::$DOCUMENT_FIELDS as $field) { foreach (Documents::$DOCUMENT_FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field]))

View File

@ -29,7 +29,7 @@ class Login
/** /**
* Constructor of the class * Constructor of the class
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;

View File

@ -38,7 +38,7 @@ class Setup extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;
@ -61,7 +61,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException * @throws 400 RestException
* @throws 200 OK * @throws 200 OK
*/ */
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -128,7 +128,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '') public function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -195,7 +195,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getCountryByID($id, $lang = '') public function getCountryByID($id, $lang = '')
{ {
$country = new Ccountry($this->db); $country = new Ccountry($this->db);
@ -228,7 +228,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException * @throws 400 RestException
* @throws 200 OK * @throws 200 OK
*/ */
function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -279,7 +279,7 @@ class Setup 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);
@ -334,7 +334,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '') public function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -397,7 +397,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '') public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -458,7 +458,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
//TODO link with multicurrency module //TODO link with multicurrency module
@ -516,7 +516,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '') public function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -595,7 +595,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '') public function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -659,7 +659,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException * @throws 400 RestException
* @throws 200 OK * @throws 200 OK
*/ */
function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -720,7 +720,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -780,7 +780,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -840,7 +840,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -898,7 +898,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getCheckIntegrity($target) public function getCheckIntegrity($target)
{ {
global $langs, $conf; global $langs, $conf;

View File

@ -31,7 +31,7 @@ class Status
* *
* @return array * @return array
*/ */
function index() public function index()
{ {
global $conf; global $conf;

View File

@ -23,8 +23,6 @@
*/ */
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/** /**
* Class for Asset * Class for Asset
@ -312,7 +310,7 @@ class Asset 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, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -369,12 +367,12 @@ class Asset 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
/** /**
* Return the status * Return the status
* *
@ -382,7 +380,7 @@ class Asset extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
static function LibStatut($status, $mode = 0) public static function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -425,7 +423,7 @@ class Asset extends CommonObject
* @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 rowid, date_creation as datec, tms as datem,'; $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql.= ' fk_user_creat, fk_user_modif'; $sql.= ' fk_user_creat, fk_user_modif';

View File

@ -76,7 +76,7 @@ class AssetType 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;
} }
@ -89,7 +89,7 @@ class AssetType 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;
@ -166,7 +166,7 @@ class AssetType 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;
@ -233,7 +233,7 @@ class AssetType 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;
@ -267,7 +267,7 @@ class AssetType 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.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note"; $sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
$sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d";
@ -300,13 +300,13 @@ class AssetType extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of asset's type * Return list of asset's 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;
@ -350,7 +350,7 @@ class AssetType extends CommonObject
* 2=Return array of asset id only * 2=Return array of asset id only
* @return mixed Array of asset or -1 on error * @return mixed Array of asset or -1 on error
*/ */
function listAssetForAssetType($excludefilter = '', $mode = 0) public function listAssetForAssetType($excludefilter = '', $mode = 0)
{ {
global $conf, $user; global $conf, $user;
@ -405,7 +405,7 @@ class AssetType 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;
@ -430,7 +430,7 @@ class AssetType extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
@ -453,7 +453,7 @@ class AssetType extends CommonObject
* *
* @return string Return status of a type of asset * @return string Return status of a type of asset
*/ */
function getLibStatut() public function getLibStatut()
{ {
return ''; return '';
} }

View File

@ -291,8 +291,7 @@ class BlockedLog
} }
elseif ($this->action == 'MODULE_RESET') elseif ($this->action == 'MODULE_RESET')
{ {
if ($this->signature == '0000000000') if ($this->signature == '0000000000') {
{
return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>'; return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>';
} }
else else
@ -387,13 +386,14 @@ class BlockedLog
$arrayoffieldstoexclude = array( $arrayoffieldstoexclude = array(
'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id', 'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id',
'table_element_line','ismultientitymanaged','isextrafieldmanaged', 'table_element_line','ismultientitymanaged','isextrafieldmanaged',
'linkedObjectsIds','linkedObjects','fk_delivery_address', 'linkedObjectsIds',
'linkedObjects',
'fk_delivery_address',
'context', 'context',
'projet' // There is already ->fk_project 'projet' // There is already ->fk_project
); );
// Add more fields to exclude depending on object type // Add more fields to exclude depending on object type
if ($this->element == 'cashcontrol') if ($this->element == 'cashcontrol') {
{
$arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array( $arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code', 'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code',
'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2', 'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2',
@ -727,15 +727,12 @@ class BlockedLog
*/ */
public function dolDecodeBlockedData($data, $mode = 0) public function dolDecodeBlockedData($data, $mode = 0)
{ {
try try {
{
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$aaa = unserialize($data); $aaa = unserialize($data);
//$aaa = unserialize($data); //$aaa = unserialize($data);
} } catch(Exception $e) {
catch(Exception $e)
{
//print $e->getErrs); //print $e->getErrs);
} }
return $aaa; return $aaa;
@ -1070,7 +1067,7 @@ class BlockedLog
* @param int $ignoresystem Ignore system events for the test * @param int $ignoresystem Ignore system events for the test
* @return bool * @return bool
*/ */
function alreadyUsed($ignoresystem = 0) public function alreadyUsed($ignoresystem = 0)
{ {
global $conf; global $conf;

View File

@ -56,7 +56,7 @@ class BillOfMaterialsApi extends DolibarrApi
* @url GET / * @url GET /
* *
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -74,7 +74,7 @@ class BillOfMaterialsApi extends DolibarrApi
* @url GET boms/{id} * @url GET boms/{id}
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->bom->read) { if(! DolibarrApiAccess::$user->rights->bom->read) {
throw new RestException(401); throw new RestException(401);
@ -109,7 +109,7 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @url GET /boms/ * @url GET /boms/
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -196,7 +196,7 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @url POST boms/ * @url POST boms/
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->bom->create) { if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401); throw new RestException(401);
@ -222,7 +222,7 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @url PUT boms/{id} * @url PUT boms/{id}
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->bom->create) { if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401); throw new RestException(401);
@ -255,7 +255,7 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @url DELETE bom/{id} * @url DELETE bom/{id}
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->bom->delete) { if(! DolibarrApiAccess::$user->rights->bom->delete) {
throw new RestException(401); throw new RestException(401);
@ -289,7 +289,7 @@ class BillOfMaterialsApi 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);
@ -311,7 +311,7 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$bom = array(); $bom = array();
foreach (BillOfMaterialsApi::$FIELDS as $field) { foreach (BillOfMaterialsApi::$FIELDS as $field) {

View File

@ -398,7 +398,7 @@ class BillOfMaterials 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, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -981,7 +981,7 @@ class BillOfMaterialsLine 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, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;

View File

@ -82,7 +82,7 @@ class Bookmark 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;
} }
@ -93,7 +93,7 @@ class Bookmark extends CommonObject
* @param int $id Bookmark Id Loader * @param int $id Bookmark Id Loader
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id) public function fetch($id)
{ {
global $conf; global $conf;
@ -135,7 +135,7 @@ class Bookmark extends CommonObject
* *
* @return int <0 si ko, rowid du bookmark cree si ok * @return int <0 si ko, rowid du bookmark cree si ok
*/ */
function create() public function create()
{ {
global $conf; global $conf;
@ -192,7 +192,7 @@ class Bookmark extends CommonObject
* *
* @return int <0 if KO, > if OK * @return int <0 if KO, > if OK
*/ */
function update() public function update()
{ {
// Clean parameters // Clean parameters
$this->url=trim($this->url); $this->url=trim($this->url);
@ -227,7 +227,7 @@ class Bookmark extends CommonObject
* @param int $id Id removed bookmark * @param int $id Id removed bookmark
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function remove($id) public function remove($id)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE rowid = ".$id; $sql .= " WHERE rowid = ".$id;
@ -268,7 +268,7 @@ class Bookmark 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 ''; return '';
} }

View File

@ -60,7 +60,7 @@ class Auth
* @param string $aPasswd Password * @param string $aPasswd Password
* @return void * @return void
*/ */
function passwd($aPasswd) public function passwd($aPasswd)
{ {
$this->passwd = $aPasswd; $this->passwd = $aPasswd;
} }

View File

@ -53,7 +53,7 @@ class Categories extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -70,7 +70,7 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if (! DolibarrApiAccess::$user->rights->categorie->lire) { if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401); throw new RestException(401);
@ -103,7 +103,7 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -173,7 +173,7 @@ class Categories extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of category * @return int ID of category
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->categorie->creer) { if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401); throw new RestException(401);
@ -198,7 +198,7 @@ class Categories extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->categorie->creer) { if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401); throw new RestException(401);
@ -234,7 +234,7 @@ class Categories extends DolibarrApi
* @param int $id Category ID * @param int $id Category ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) { if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -267,7 +267,7 @@ class Categories extends DolibarrApi
* @param Categorie $object Object to clean * @param Categorie $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);
@ -324,7 +324,7 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$category = array(); $category = array();
foreach (Categories::$FIELDS as $field) { foreach (Categories::$FIELDS as $field) {

View File

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -221,7 +221,7 @@ class Categorie 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;
} }
@ -234,7 +234,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', '...') or (0, 1, ...) * @param string $type Type of category ('product', '...') or (0, 1, ...)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $label = '', $type = null) public function fetch($id, $label = '', $type = null)
{ {
global $conf; global $conf;
@ -305,7 +305,7 @@ class Categorie extends CommonObject
* -3 : Invalid category * -3 : Invalid category
* -4 : category already exists * -4 : category already exists
*/ */
function create($user) public function create($user)
{ {
global $conf,$langs,$hookmanager; global $conf,$langs,$hookmanager;
$langs->load('categories'); $langs->load('categories');
@ -426,7 +426,7 @@ class Categorie extends CommonObject
* -1 : SQL error * -1 : SQL error
* -2 : invalid category * -2 : invalid category
*/ */
function update(User $user) public function update(User $user)
{ {
global $conf, $langs,$hookmanager; global $conf, $langs,$hookmanager;
@ -501,7 +501,7 @@ class Categorie 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 KO >0 OK * @return int <0 KO >0 OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
@ -580,7 +580,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Link an object to the category * Link an object to the category
* *
@ -588,7 +588,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', ...) * @param string $type Type of category ('product', ...)
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/ */
function add_type($obj, $type) public function add_type($obj, $type)
{ {
// phpcs:enable // phpcs:enable
global $user,$langs,$conf; global $user,$langs,$conf;
@ -682,7 +682,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete object from category * Delete object from category
* *
@ -691,7 +691,7 @@ class Categorie extends CommonObject
* *
* @return int 1 if OK, -1 if KO * @return int 1 if OK, -1 if KO
*/ */
function del_type($obj, $type) public function del_type($obj, $type)
{ {
// phpcs:enable // phpcs:enable
global $user,$langs,$conf; global $user,$langs,$conf;
@ -749,7 +749,7 @@ class Categorie extends CommonObject
* @return array|int -1 if KO, array of instance of object if OK * @return array|int -1 if KO, array of instance of object if OK
* @see containsObject * @see containsObject
*/ */
function getObjectsInCateg($type, $onlyids = 0) public function getObjectsInCateg($type, $onlyids = 0)
{ {
$objs = array(); $objs = array();
@ -796,7 +796,7 @@ class Categorie extends CommonObject
* @return int Number of occurrences * @return int Number of occurrences
* @see getObjectsInCateg * @see getObjectsInCateg
*/ */
function containsObject($type, $object_id) public function containsObject($type, $object_id)
{ {
$sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type]; $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id; $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id;
@ -821,7 +821,7 @@ class Categorie extends CommonObject
* @param int $page Page number * @param int $page Page number
* @return array|int Array of categories, 0 if no cat, -1 on error * @return array|int Array of categories, 0 if no cat, -1 on error
*/ */
function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{ {
global $conf; global $conf;
@ -907,13 +907,13 @@ class Categorie extends CommonObject
return $categories; return $categories;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return childs of a category * Return childs of a category
* *
* @return array|int <0 KO, array ok * @return array|int <0 KO, array ok
*/ */
function get_filles() public function get_filles()
{ {
// phpcs:enable // phpcs:enable
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
@ -974,7 +974,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Rebuilding the category tree as an array * Rebuilding the category tree as an array
* Return an array of table('id','id_mere',...) trie selon arbre et avec: * Return an array of table('id','id_mere',...) trie selon arbre et avec:
@ -990,7 +990,7 @@ class Categorie extends CommonObject
* *
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error * @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/ */
function get_full_arbo($type, $markafterid = 0) public function get_full_arbo($type, $markafterid = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -1068,7 +1068,7 @@ class Categorie extends CommonObject
return $this->cats; return $this->cats;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
* *
@ -1076,7 +1076,7 @@ class Categorie extends CommonObject
* @param int $protection Deep counter to avoid infinite loop * @param int $protection Deep counter to avoid infinite loop
* @return void * @return void
*/ */
function build_path_from_id_categ($id_categ, $protection = 1000) public function build_path_from_id_categ($id_categ, $protection = 1000)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
@ -1112,13 +1112,13 @@ class Categorie extends CommonObject
return; return;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Display content of $this->cats * Display content of $this->cats
* *
* @return void * @return void
*/ */
function debug_cats() public function debug_cats()
{ {
// phpcs:enable // phpcs:enable
// Display $this->cats // Display $this->cats
@ -1135,7 +1135,7 @@ class Categorie extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns all categories * Returns all categories
* *
@ -1143,7 +1143,7 @@ class Categorie extends CommonObject
* @param boolean $parent Just parent categories if true * @param boolean $parent Just parent categories if true
* @return array|int Table of Object Category, -1 on error * @return array|int Table of Object Category, -1 on error
*/ */
function get_all_categories($type = null, $parent = false) public function get_all_categories($type = null, $parent = false)
{ {
// phpcs:enable // phpcs:enable
if (! is_numeric($type)) $type = $this->MAP_ID[$type]; if (! is_numeric($type)) $type = $this->MAP_ID[$type];
@ -1174,13 +1174,13 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type * Check if no category with same label already exists for this cat's parent or root and for this cat's type
* *
* @return integer 1 if already exist, 0 otherwise, -1 if error * @return integer 1 if already exist, 0 otherwise, -1 if error
*/ */
function already_exists() public function already_exists()
{ {
// phpcs:enable // phpcs:enable
$type=$this->type; $type=$this->type;
@ -1225,20 +1225,20 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns the top level categories (which are not girls) * Returns the top level categories (which are not girls)
* *
* @param int $type Type of category (0, 1, ...) * @param int $type Type of category (0, 1, ...)
* @return array * @return array
*/ */
function get_main_categories($type = null) public function get_main_categories($type = null)
{ {
// phpcs:enable // phpcs:enable
return $this->get_all_categories($type, true); return $this->get_all_categories($type, true);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns the path of the category, with the names of the categories * Returns the path of the category, with the names of the categories
* separated by $sep (" >> " by default) * separated by $sep (" >> " by default)
@ -1248,7 +1248,7 @@ class Categorie extends CommonObject
* @param int $nocolor 0 * @param int $nocolor 0
* @return array * @return array
*/ */
function print_all_ways($sep = " &gt;&gt; ", $url = '', $nocolor = 0) public function print_all_ways($sep = " &gt;&gt; ", $url = '', $nocolor = 0)
{ {
// phpcs:enable // phpcs:enable
$ways = array(); $ways = array();
@ -1297,13 +1297,13 @@ class Categorie extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns an array containing the list of parent categories * Returns an array containing the list of parent categories
* *
* @return int|array <0 KO, array OK * @return int|array <0 KO, array OK
*/ */
function get_meres() public function get_meres()
{ {
// phpcs:enable // phpcs:enable
$parents = array(); $parents = array();
@ -1333,14 +1333,14 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns in a table all possible paths to get to the category * Returns in a table all possible paths to get to the category
* starting with the major categories represented by Tables of categories * starting with the major categories represented by Tables of categories
* *
* @return array * @return array
*/ */
function get_all_ways() public function get_all_ways()
{ {
// phpcs:enable // phpcs:enable
$ways = array(); $ways = array();
@ -1374,9 +1374,9 @@ class Categorie extends CommonObject
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...) * @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category * @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs * labels, 'id'= Get array of category IDs
* @return array|int Array of category objects or < 0 if KO * @return Categorie[]|int Array of category objects or < 0 if KO
*/ */
function containing($id, $type, $mode = 'object') public function containing($id, $type, $mode = 'object')
{ {
$cats = array(); $cats = array();
@ -1456,9 +1456,9 @@ class Categorie extends CommonObject
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param boolean $exact Exact string search (true/false) * @param boolean $exact Exact string search (true/false)
* @param boolean $case Case sensitive (true/false) * @param boolean $case Case sensitive (true/false)
* @return array|int Array of category id, -1 if error * @return Categorie[]|int Array of Categorie, -1 if error
*/ */
function rechercher($id, $nom, $type, $exact = false, $case = false) public function rechercher($id, $nom, $type, $exact = false, $case = false)
{ {
// Deprecation warning // Deprecation warning
if (is_numeric($type)) { if (is_numeric($type)) {
@ -1521,7 +1521,7 @@ class Categorie extends CommonObject
* @param int $maxlength Max length of text * @param int $maxlength Max length of text
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $maxlength = 0) public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
{ {
global $langs; global $langs;
@ -1548,7 +1548,7 @@ class Categorie extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Deplace fichier uploade sous le nom $files dans le repertoire sdir * Deplace fichier uploade sous le nom $files dans le repertoire sdir
* *
@ -1556,7 +1556,7 @@ class Categorie extends CommonObject
* @param string $file Nom du fichier uploade * @param string $file Nom du fichier uploade
* @return void * @return void
*/ */
function add_photo($sdir, $file) public function add_photo($sdir, $file)
{ {
// phpcs:enable // phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1599,7 +1599,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return tableau de toutes les photos de la categorie * Return tableau de toutes les photos de la categorie
* *
@ -1607,7 +1607,7 @@ class Categorie extends CommonObject
* @param int $nbmax Nombre maximum de photos (0=pas de max) * @param int $nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos * @return array Tableau de photos
*/ */
function liste_photos($dir, $nbmax = 0) public function liste_photos($dir, $nbmax = 0)
{ {
// phpcs:enable // phpcs:enable
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
@ -1656,14 +1656,14 @@ class Categorie extends CommonObject
return $tabobj; return $tabobj;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Efface la photo de la categorie et sa vignette * Efface la photo de la categorie et sa vignette
* *
* @param string $file Path to file * @param string $file Path to file
* @return void * @return void
*/ */
function delete_photo($file) public function delete_photo($file)
{ {
// phpcs:enable // phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1686,14 +1686,14 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load size of image file * Load size of image file
* *
* @param string $file Path to file * @param string $file Path to file
* @return void * @return void
*/ */
function get_image_size($file) public function get_image_size($file)
{ {
// phpcs:enable // phpcs:enable
$infoImg = getimagesize($file); // Recuperation des infos de l'image $infoImg = getimagesize($file); // Recuperation des infos de l'image
@ -1708,7 +1708,7 @@ class Categorie extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setMultiLangs($user) public function setMultiLangs($user)
{ {
global $langs; global $langs;
@ -1789,7 +1789,7 @@ class Categorie extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function getMultiLangs() public function getMultiLangs()
{ {
global $langs; global $langs;
@ -1828,7 +1828,7 @@ class Categorie 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 ''; return '';
} }
@ -1841,7 +1841,7 @@ class Categorie extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
dol_syslog(get_class($this)."::initAsSpecimen"); dol_syslog(get_class($this)."::initAsSpecimen");

View File

@ -486,7 +486,7 @@ class ActionComm extends CommonObject
* @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($fuser, $socid) public function createFromClone($fuser, $socid)
{ {
global $db, $user, $langs, $conf, $hookmanager; global $db, $user, $langs, $conf, $hookmanager;
@ -502,7 +502,7 @@ class ActionComm extends CommonObject
// fetch optionals attributes and labels // fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
// $this->fetch_userassigned(); //$this->fetch_userassigned();
$this->fetchResources(); $this->fetchResources();
$this->id=0; $this->id=0;
@ -566,7 +566,7 @@ class ActionComm extends CommonObject
* @param string $ref_ext Ref ext to get * @param string $ref_ext Ref ext to get
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $ref = '', $ref_ext = '') public function fetch($id, $ref = '', $ref_ext = '')
{ {
global $langs; global $langs;
@ -680,7 +680,7 @@ class ActionComm extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchResources() public function fetchResources()
{ {
$sql ='SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency'; $sql ='SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
$sql.=' FROM '.MAIN_DB_PREFIX.'actioncomm_resources'; $sql.=' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
@ -720,13 +720,13 @@ class ActionComm extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialize this->userassigned array with list of id of user assigned to event * Initialize this->userassigned array with list of id of user assigned to event
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_userassigned() public function fetch_userassigned()
{ {
// phpcs:enable // phpcs:enable
$sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
@ -761,7 +761,7 @@ class ActionComm extends CommonObject
* @param int $notrigger 1 = disable triggers, 0 = enable triggers * @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @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 $user,$langs,$conf; global $user,$langs,$conf;
@ -838,7 +838,7 @@ class ActionComm extends CommonObject
* @param int $notrigger 1 = disable triggers, 0 = enable triggers * @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $langs,$conf,$hookmanager; global $langs,$conf,$hookmanager;
@ -999,7 +999,7 @@ class ActionComm extends CommonObject
* @param string $limit Limit number of answers * @param string $limit Limit number of answers
* @return array or string Error string if KO, array with actions if OK * @return array or string Error string if KO, array with actions if OK
*/ */
static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -1043,7 +1043,7 @@ class ActionComm 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)
* *
@ -1051,7 +1051,7 @@ class ActionComm extends CommonObject
* @param int $load_state_board Charge indicateurs this->nb de tableau de bord * @param int $load_state_board Charge indicateurs this->nb de tableau de bord
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user, $load_state_board = 0) public function load_board($user, $load_state_board = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -1112,7 +1112,7 @@ class ActionComm extends CommonObject
* @param int $id Id de la facture a charger * @param int $id Id de la facture a charger
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT '; $sql = 'SELECT ';
$sql.= ' a.id,'; $sql.= ' a.id,';
@ -1163,12 +1163,12 @@ class ActionComm extends CommonObject
* @param int $hidenastatus 1=Show nothing if status is "Not applicable" * @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @return string String with status * @return string String with status
*/ */
function getLibStatut($mode, $hidenastatus = 0) public function getLibStatut($mode, $hidenastatus = 0)
{ {
return $this->LibStatut($this->percentage, $mode, $hidenastatus, $this->datep); return $this->LibStatut($this->percentage, $mode, $hidenastatus, $this->datep);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of action status * Return label of action status
* *
@ -1178,7 +1178,7 @@ class ActionComm extends CommonObject
* @param int $datestart Date start of event * @param int $datestart Date start of event
* @return string Label * @return string Label
*/ */
function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '') public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1256,7 +1256,7 @@ class ActionComm 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($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
{ {
global $conf, $langs, $user, $hookmanager, $action; global $conf, $langs, $user, $hookmanager, $action;
@ -1379,7 +1379,7 @@ class ActionComm extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Export events from database into a cal file. * Export events from database into a cal file.
* *
@ -1390,7 +1390,7 @@ class ActionComm extends CommonObject
* @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...) * @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
* @return int <0 if error, nb of events in new file if ok * @return int <0 if error, nb of events in new file if ok
*/ */
function build_exportfile($format, $type, $cachedelay, $filename, $filters) public function build_exportfile($format, $type, $cachedelay, $filename, $filters)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs,$dolibarr_main_url_root,$mysoc; global $conf,$langs,$dolibarr_main_url_root,$mysoc;
@ -1618,7 +1618,7 @@ class ActionComm extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $user; global $user;

View File

@ -178,12 +178,12 @@ class ActionCommReminder 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
/** /**
* Return the status * Return the status
* *
@ -191,7 +191,7 @@ class ActionCommReminder extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
static function LibStatut($status, $mode = 0) public static function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;

View File

@ -44,7 +44,7 @@ class AgendaEvents extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -61,7 +61,7 @@ class AgendaEvents extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
throw new RestException(401, "Insuffisant rights to read an event"); throw new RestException(401, "Insuffisant rights to read an event");
@ -99,7 +99,7 @@ class AgendaEvents extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')"
* @return array Array of Agenda Events objects * @return array Array of Agenda Events objects
*/ */
function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -188,7 +188,7 @@ class AgendaEvents extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of Agenda Event * @return int ID of Agenda Event
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event"); throw new RestException(401, "Insuffisant rights to create your Agenda Event");
@ -227,7 +227,7 @@ class AgendaEvents extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event"); throw new RestException(401, "Insuffisant rights to create your Agenda Event");
@ -263,7 +263,7 @@ class AgendaEvents extends DolibarrApi
* *
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) { if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
throw new RestException(401, "Insuffisant rights to delete your Agenda Event"); throw new RestException(401, "Insuffisant rights to delete your Agenda Event");
@ -302,7 +302,7 @@ class AgendaEvents extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$event = array(); $event = array();
foreach (AgendaEvents::$FIELDS as $field) { foreach (AgendaEvents::$FIELDS as $field) {
@ -319,7 +319,7 @@ class AgendaEvents 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);

View File

@ -68,7 +68,7 @@ class CActionComm
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -79,7 +79,7 @@ class CActionComm
* @param int $id id or code of action type to read * @param int $id id or code of action type to read
* @return int 1=ok, 0=not found, -1=error * @return int 1=ok, 0=not found, -1=error
*/ */
function fetch($id) public function fetch($id)
{ {
$sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql = "SELECT id, code, type, libelle as label, color, active, picto";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
@ -118,7 +118,7 @@ class CActionComm
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of event types: array(id=>label) or array(code=>label) * Return list of event types: array(id=>label) or array(code=>label)
* *
@ -130,7 +130,7 @@ class CActionComm
* @param int $shortlabel 1=Get short label instead of long label * @param int $shortlabel 1=Get short label instead of long label
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
*/ */
function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs,$conf; global $langs,$conf;
@ -223,7 +223,7 @@ class CActionComm
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only
* @return string Label of action type * @return string Label of action type
*/ */
function getNomUrl($withpicto = 0) public function getNomUrl($withpicto = 0)
{ {
global $langs; global $langs;

View File

@ -32,12 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php';
*/ */
class ICal class ICal
{ {
var $file_text; // Text in file // Text in file
var $cal; // Array to save iCalendar parse data public $file_text;
var $event_count; // Number of Events public $cal; // Array to save iCalendar parse data
var $todo_count; // Number of Todos public $event_count; // Number of Events
var $freebusy_count; // Number of Freebusy public $todo_count; // Number of Todos
var $last_key; //Help variable save last key (multiline string) public $freebusy_count; // Number of Freebusy
public $last_key; //Help variable save last key (multiline string)
/** /**
@ -47,14 +48,14 @@ class ICal
{ {
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Read text file, icalender text file * Read text file, icalender text file
* *
* @param string $file File * @param string $file File
* @return string * @return string
*/ */
function read_file($file) public function read_file($file)
{ {
// phpcs:enable // phpcs:enable
$this->file = $file; $this->file = $file;
@ -69,25 +70,25 @@ class ICal
return $file_text; // return all text return $file_text; // return all text
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns the number of calendar events * Returns the number of calendar events
* *
* @return int * @return int
*/ */
function get_event_count() public function get_event_count()
{ {
// phpcs:enable // phpcs:enable
return $this->event_count; return $this->event_count;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns the number of to do * Returns the number of to do
* *
* @return int * @return int
*/ */
function get_todo_count() public function get_todo_count()
{ {
// phpcs:enable // phpcs:enable
return $this->todo_count; return $this->todo_count;
@ -99,7 +100,7 @@ class ICal
* @param string $uri Url * @param string $uri Url
* @return array|string * @return array|string
*/ */
function parse($uri) public function parse($uri)
{ {
$this->cal = array(); // new empty array $this->cal = array(); // new empty array
@ -201,7 +202,7 @@ class ICal
return $this->cal; return $this->cal;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add to $this->ical array one value and key. * Add to $this->ical array one value and key.
* *
@ -210,7 +211,7 @@ class ICal
* @param string $value Value * @param string $value Value
* @return void * @return void
*/ */
function add_to_array($type, $key, $value) public function add_to_array($type, $key, $value)
{ {
// phpcs:enable // phpcs:enable
@ -263,14 +264,14 @@ class ICal
$this->last_key = $key; $this->last_key = $key;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value");
* *
* @param string $text Text * @param string $text Text
* @return array * @return array
*/ */
function retun_key_value($text) public function retun_key_value($text)
{ {
// phpcs:enable // phpcs:enable
/* /*
@ -288,14 +289,14 @@ class ICal
return explode(':', $text, 2); return explode(':', $text, 2);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Parse RRULE return array * Parse RRULE return array
* *
* @param string $value string * @param string $value string
* @return array * @return array
*/ */
function ical_rrule($value) public function ical_rrule($value)
{ {
// phpcs:enable // phpcs:enable
$result = array(); $result = array();
@ -308,14 +309,14 @@ class ICal
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS) * Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS)
* *
* @param string $ical_date String date * @param string $ical_date String date
* @return int * @return int
*/ */
function ical_date_to_unix($ical_date) public function ical_date_to_unix($ical_date)
{ {
// phpcs:enable // phpcs:enable
$ical_date = str_replace('T', '', $ical_date); $ical_date = str_replace('T', '', $ical_date);
@ -331,7 +332,7 @@ class ICal
return $ntime; // ntime is a GTM time return $ntime; // ntime is a GTM time
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return unix date from iCal date format * Return unix date from iCal date format
* *
@ -339,7 +340,7 @@ class ICal
* @param string $value Value * @param string $value Value
* @return array * @return array
*/ */
function ical_dt_date($key, $value) public function ical_dt_date($key, $value)
{ {
// phpcs:enable // phpcs:enable
$return_value = array(); $return_value = array();
@ -362,13 +363,13 @@ class ICal
return array($key,$return_value); return array($key,$return_value);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return sorted eventlist as array or false if calendar is empty * Return sorted eventlist as array or false if calendar is empty
* *
* @return array|false * @return array|false
*/ */
function get_sort_event_list() public function get_sort_event_list()
{ {
// phpcs:enable // phpcs:enable
$temp = $this->get_event_list(); $temp = $this->get_event_list();
@ -383,7 +384,7 @@ class ICal
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Compare two unix timestamp * Compare two unix timestamp
* *
@ -391,67 +392,67 @@ class ICal
* @param array $b Operand b * @param array $b Operand b
* @return integer * @return integer
*/ */
function ical_dtstart_compare($a, $b) public function ical_dtstart_compare($a, $b)
{ {
// phpcs:enable // phpcs:enable
return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return eventlist array (not sorted eventlist array) * Return eventlist array (not sorted eventlist array)
* *
* @return array * @return array
*/ */
function get_event_list() public function get_event_list()
{ {
// phpcs:enable // phpcs:enable
return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:''); return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:'');
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return eventlist array (not sort eventlist array) * Return eventlist array (not sort eventlist array)
* *
* @return array * @return array
*/ */
function get_freebusy_list() public function get_freebusy_list()
{ {
// phpcs:enable // phpcs:enable
return $this->cal['VFREEBUSY']; return $this->cal['VFREEBUSY'];
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return to do array (not sorted todo array) * Return to do array (not sorted todo array)
* *
* @return array * @return array
*/ */
function get_todo_list() public function get_todo_list()
{ {
// phpcs:enable // phpcs:enable
return $this->cal['VTODO']; return $this->cal['VTODO'];
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return base calendar data * Return base calendar data
* *
* @return array * @return array
*/ */
function get_calender_data() public function get_calender_data()
{ {
// phpcs:enable // phpcs:enable
return $this->cal['VCALENDAR']; return $this->cal['VCALENDAR'];
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return array with all data * Return array with all data
* *
* @return array * @return array
*/ */
function get_all_data() public function get_all_data()
{ {
// phpcs:enable // phpcs:enable
return $this->cal; return $this->cal;

View File

@ -378,11 +378,15 @@ if ($object->id > 0)
print '</tr>'; print '</tr>';
} }
$isCustomer = ($object->client == 1 || $object->client == 3);
// Relative discounts (Discounts-Drawbacks-Rebates) // Relative discounts (Discounts-Drawbacks-Rebates)
if ($isCustomer)
{
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans("CustomerRelativeDiscountShort"); print $langs->trans("CustomerRelativeDiscountShort");
print '<td><td class="right">'; print '<td><td align="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0) if ($user->rights->societe->creer && !$user->societe_id > 0)
{ {
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>'; print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
@ -396,7 +400,7 @@ if ($object->id > 0)
print '<table width="100%" class="nobordernopadding">'; print '<table width="100%" class="nobordernopadding">';
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("CustomerAbsoluteDiscountShort"); print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td class="right">'; print '<td><td align="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0) if ($user->rights->societe->creer && !$user->societe_id > 0)
{ {
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>'; print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
@ -410,6 +414,7 @@ if ($object->id > 0)
//else print $langs->trans("DiscountNone"); //else print $langs->trans("DiscountNone");
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
// Max outstanding bill // Max outstanding bill
if ($object->client) if ($object->client)

View File

@ -58,20 +58,20 @@ class AdvanceTargetingMailing extends CommonObject
*/ */
public $id; public $id;
var $name; public $name;
var $entity; public $entity;
var $fk_element; public $fk_element;
var $type_element; public $type_element;
var $filtervalue; public $filtervalue;
var $fk_user_author; public $fk_user_author;
var $datec=''; public $datec='';
var $fk_user_mod; public $fk_user_mod;
var $tms=''; public $tms='';
var $select_target_type = array(); public $select_target_type = array();
var $type_statuscommprospect=array(); public $type_statuscommprospect=array();
var $thirdparty_lines; public $thirdparty_lines;
var $contact_lines; public $contact_lines;
/** /**
@ -79,7 +79,7 @@ class AdvanceTargetingMailing extends CommonObject
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $langs; global $langs;
$langs->load('customers'); $langs->load('customers');
@ -108,7 +108,7 @@ class AdvanceTargetingMailing 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;
@ -202,7 +202,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $id Id object * @param int $id Id object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id) public function fetch($id)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -253,14 +253,14 @@ class AdvanceTargetingMailing extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param int $id Id object * @param int $id Id object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_by_mailing($id = 0) public function fetch_by_mailing($id = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -319,7 +319,7 @@ class AdvanceTargetingMailing extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
@ -327,7 +327,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param string $type_element Type target * @param string $type_element Type target
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_by_element($id = 0, $type_element = 'mailing') public function fetch_by_element($id = 0, $type_element = 'mailing')
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -390,7 +390,7 @@ class AdvanceTargetingMailing 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, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -469,7 +469,7 @@ class AdvanceTargetingMailing 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;
@ -528,7 +528,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param array $arrayquery All element to Query * @param array $arrayquery All element to Query
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function savequery($user, $arrayquery) public function savequery($user, $arrayquery)
{ {
global $langs,$conf; global $langs,$conf;
@ -548,14 +548,14 @@ class AdvanceTargetingMailing extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load object in memory from database * Load object in memory from database
* *
* @param array $arrayquery All element to Query * @param array $arrayquery All element to Query
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function query_thirdparty($arrayquery) public function query_thirdparty($arrayquery)
{ {
// phpcs:enable // phpcs:enable
global $langs,$conf; global $langs,$conf;
@ -699,7 +699,7 @@ class AdvanceTargetingMailing extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load object in memory from database * Load object in memory from database
* *
@ -707,7 +707,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $withThirdpartyFilter add contact with tridparty filter * @param int $withThirdpartyFilter add contact with tridparty filter
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function query_contact($arrayquery, $withThirdpartyFilter = 0) public function query_contact($arrayquery, $withThirdpartyFilter = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs,$conf; global $langs,$conf;

View File

@ -42,7 +42,7 @@ class FormAdvTargetEmailing extends Form
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $langs; global $langs;
@ -56,7 +56,7 @@ class FormAdvTargetEmailing extends Form
* @param string $htmlname select field * @param string $htmlname select field
* @return string select field * @return string select field
*/ */
function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') public function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status')
{ {
global $conf, $langs; global $conf, $langs;
$options_array = array(); $options_array = array();
@ -93,7 +93,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array or Code or Label of preselected country * @param array $selected_array or Code or Label of preselected country
* @return string HTML string with select * @return string HTML string with select
*/ */
function multiselectCountry($htmlname = 'country_id', $selected_array = array()) public function multiselectCountry($htmlname = 'country_id', $selected_array = array())
{ {
global $conf, $langs; global $conf, $langs;
@ -154,7 +154,7 @@ class FormAdvTargetEmailing extends Form
* @param User $user User action * @param User $user User action
* @return string combo list code * @return string combo list code
*/ */
function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) public function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user)
{ {
global $conf; global $conf;
@ -195,7 +195,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array selected array * @param array $selected_array selected array
* @return string combo list code * @return string combo list code
*/ */
function multiselectselectLanguage($htmlname = '', $selected_array = array()) public function multiselectselectLanguage($htmlname = '', $selected_array = array())
{ {
global $conf,$langs; global $conf,$langs;
@ -222,7 +222,7 @@ class FormAdvTargetEmailing extends Form
* *
* @return string HTML combo * @return string HTML combo
*/ */
function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array())
{ {
$options_array=array(); $options_array=array();
@ -291,7 +291,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array Array * @param array $selected_array Array
* @return string HTML combo * @return string HTML combo
*/ */
function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) public function multiselectCivility($htmlname = 'civilite_id', $selected_array = array())
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$langs->load("dict"); $langs->load("dict");
@ -341,7 +341,7 @@ class FormAdvTargetEmailing extends Form
* @param int $showempty show empty * @param int $showempty show empty
* @return string HTML combo * @return string HTML combo
*/ */
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) public function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -357,7 +357,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array value selected * @param array $selected_array value selected
* @return string HTML combo * @return string HTML combo
*/ */
function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array())
{ {
return $this->multiselectCategories($htmlname, $selected_array, 2); return $this->multiselectCategories($htmlname, $selected_array, 2);
} }
@ -369,7 +369,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array value selected * @param array $selected_array value selected
* @return string HTML combo * @return string HTML combo
*/ */
function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array())
{ {
return $this->multiselectCategories($htmlname, $selected_array, 4); return $this->multiselectCategories($htmlname, $selected_array, 4);
} }

View File

@ -81,7 +81,7 @@ class Mailing 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;
@ -104,7 +104,7 @@ class Mailing extends CommonObject
* @param User $user Object of user making creation * @param User $user Object of user making creation
* @return int -1 if error, Id of created object if OK * @return int -1 if error, Id of created object if OK
*/ */
function create($user) public function create($user)
{ {
global $conf, $langs; global $conf, $langs;
@ -163,7 +163,7 @@ class Mailing extends CommonObject
* @param User $user Object of user making change * @param User $user Object of user making change
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function update($user) public function update($user)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing "; $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
$sql .= " SET titre = '".$this->db->escape($this->titre)."'"; $sql .= " SET titre = '".$this->db->escape($this->titre)."'";
@ -195,7 +195,7 @@ class Mailing extends CommonObject
* @param int $rowid Id of emailing * @param int $rowid Id of emailing
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
global $conf; global $conf;
@ -271,7 +271,7 @@ class Mailing extends CommonObject
* @param int $option2 Not used * @param int $option2 Not used
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($fromid, $option1, $option2) public function createFromClone($fromid, $option1, $option2)
{ {
global $user,$langs; global $user,$langs;
@ -394,7 +394,7 @@ class Mailing extends CommonObject
* @param User $user Objet user qui valide * @param User $user Objet user qui valide
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function valid($user) public function valid($user)
{ {
$now=dol_now(); $now=dol_now();
@ -421,7 +421,7 @@ class Mailing extends CommonObject
* @param int $rowid id du mailing a supprimer * @param int $rowid id du mailing a supprimer
* @return int 1 en cas de succes * @return int 1 en cas de succes
*/ */
function delete($rowid) public function delete($rowid)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
$sql.= " WHERE rowid = ".$rowid; $sql.= " WHERE rowid = ".$rowid;
@ -439,13 +439,13 @@ class Mailing extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete targets emailing * Delete targets emailing
* *
* @return int 1 if OK, 0 if error * @return int 1 if OK, 0 if error
*/ */
function delete_targets() public function delete_targets()
{ {
// phpcs:enable // phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
@ -465,14 +465,14 @@ class Mailing extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Change status of each recipient * Change status of each recipient
* *
* @param User $user Objet user qui valide * @param User $user Objet user qui valide
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function reset_targets_status($user) public function reset_targets_status($user)
{ {
// phpcs:enable // phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
@ -499,7 +499,7 @@ class Mailing extends CommonObject
* @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error) * @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error)
* @return int Nb of target with status * @return int Nb of target with status
*/ */
function countNbOfTargets($mode) public function countNbOfTargets($mode)
{ {
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql.= " WHERE fk_mailing = ".$this->id; $sql.= " WHERE fk_mailing = ".$this->id;
@ -537,7 +537,7 @@ class Mailing 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, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -608,12 +608,12 @@ class Mailing extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -621,7 +621,7 @@ class Mailing 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, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -634,30 +634,30 @@ class Mailing extends CommonObject
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3');
if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
if ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
if ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3');
if ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
} }
} }
@ -687,37 +687,37 @@ class Mailing extends CommonObject
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
} }
} }
} }

View File

@ -29,7 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
*/ */
class Proposals extends DolibarrApi class Proposals extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
@ -45,7 +44,7 @@ class Proposals extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -63,7 +62,7 @@ class Proposals extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{ {
if(! DolibarrApiAccess::$user->rights->propal->lire) { if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401); throw new RestException(401);
@ -97,7 +96,7 @@ class Proposals extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects * @return array Array of order objects
*/ */
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;
@ -182,7 +181,7 @@ class Proposals extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of proposal * @return int ID of proposal
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401, "Insuffisant rights"); throw new RestException(401, "Insuffisant rights");
@ -216,7 +215,7 @@ class Proposals extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) public function getLines($id)
{ {
if(! DolibarrApiAccess::$user->rights->propal->lire) { if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401); throw new RestException(401);
@ -248,9 +247,9 @@ class Proposals extends DolibarrApi
* *
* @return int * @return int
*/ */
function postLine($id, $request_data = null) public function postLine($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -259,8 +258,7 @@ class Proposals extends DolibarrApi
throw new RestException(404, 'Commercial Proposal not found'); throw new RestException(404, 'Commercial Proposal not found');
} }
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
{
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -313,7 +311,7 @@ class Proposals 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->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -382,7 +380,7 @@ class Proposals extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -422,7 +420,7 @@ class Proposals 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->propal->creer) { if(!DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -464,7 +462,7 @@ class Proposals extends DolibarrApi
* @throws 404 * @throws 404
* @throws 500 * @throws 500
*/ */
function deleteContact($id, $rowid) public function deleteContact($id, $rowid)
{ {
if(!DolibarrApiAccess::$user->rights->propal->creer) { if(!DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -497,21 +495,21 @@ class Proposals extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->propal->fetch($id); $result = $this->propal->fetch($id);
if( ! $result ) { if ( ! $result ) {
throw new RestException(404, 'Proposal not found'); throw new RestException(404, 'Proposal not found');
} }
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
if ($field == 'id') continue; if ($field == 'id') continue;
$this->propal->$field = $value; $this->propal->$field = $value;
} }
@ -546,7 +544,7 @@ class Proposals extends DolibarrApi
* *
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->propal->supprimer) { if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -581,7 +579,7 @@ class Proposals extends DolibarrApi
* *
* @return array * @return array
*/ */
function settodraft($id) public function settodraft($id)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -638,7 +636,7 @@ class Proposals extends DolibarrApi
* *
* @return array * @return array
*/ */
function validate($id, $notrigger = 0) public function validate($id, $notrigger = 0)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -686,7 +684,7 @@ class Proposals extends DolibarrApi
* *
* @return array * @return array
*/ */
function close($id, $status, $note_private = '', $notrigger = 0) public function close($id, $status, $note_private = '', $notrigger = 0)
{ {
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -731,7 +729,7 @@ class Proposals extends DolibarrApi
* *
* @return array * @return array
*/ */
function setinvoiced($id) public function setinvoiced($id)
{ {
if (! DolibarrApiAccess::$user->rights->propal->creer) { if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
@ -772,7 +770,7 @@ class Proposals extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$propal = array(); $propal = array();
foreach (Proposals::$FIELDS as $field) { foreach (Proposals::$FIELDS as $field) {
@ -790,7 +788,7 @@ class Proposals 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);

View File

@ -239,7 +239,7 @@ class Propal extends CommonObject
* @param int $socid Id third party * @param int $socid Id third party
* @param int $propalid Id proposal * @param int $propalid Id proposal
*/ */
function __construct($db, $socid = "", $propalid = 0) public function __construct($db, $socid = "", $propalid = 0)
{ {
global $conf,$langs; global $conf,$langs;
@ -254,7 +254,7 @@ class Propal extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add line into array products * Add line into array products
* $this->thirdparty should be loaded * $this->thirdparty should be loaded
@ -267,7 +267,7 @@ class Propal extends CommonObject
* TODO Replace calls to this function by generation objet Ligne * TODO Replace calls to this function by generation objet Ligne
* inserted into table $this->products * inserted into table $this->products
*/ */
function add_product($idproduct, $qty, $remise_percent = 0) public function add_product($idproduct, $qty, $remise_percent = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $mysoc; global $conf, $mysoc;
@ -316,14 +316,14 @@ class Propal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Adding line of fixed discount in the proposal in DB * Adding line of fixed discount in the proposal in DB
* *
* @param int $idremise Id of fixed discount * @param int $idremise Id of fixed discount
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function insert_discount($idremise) public function insert_discount($idremise)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -434,7 +434,7 @@ class Propal extends CommonObject
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @see add_product * @see add_product
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0) public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
{ {
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
@ -663,11 +663,11 @@ class Propal extends CommonObject
* @param int $notrigger disable line update trigger * @param int $notrigger disable line update trigger
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{ {
global $mysoc; global $mysoc;
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end"); txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -827,7 +827,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function deleteline($lineid) public function deleteline($lineid)
{ {
global $user; global $user;
@ -869,7 +869,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf,$hookmanager; global $conf,$hookmanager;
$error=0; $error=0;
@ -1193,7 +1193,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Insert into DB a proposal object completely defined by its data members (ex, results from copy). * Insert into DB a proposal object completely defined by its data members (ex, results from copy).
* *
@ -1201,7 +1201,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @return int Id of the new object if ok, <0 if ko * @return int Id of the new object if ok, <0 if ko
* @see create * @see create
*/ */
function create_from($user) public function create_from($user)
{ {
// phpcs:enable // phpcs:enable
// i love this function because $this->products is not used in create function... // i love this function because $this->products is not used in create function...
@ -1216,7 +1216,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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,$conf,$hookmanager; global $user,$conf,$hookmanager;
@ -1345,7 +1345,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param string $ref Ref of proposal * @param string $ref Ref of proposal
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function fetch($rowid, $ref = '') public function fetch($rowid, $ref = '')
{ {
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
@ -1509,7 +1509,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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;
@ -1597,14 +1597,14 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
// 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();
@ -1723,7 +1723,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 done, >=0 if OK * @return int <0 if KO, 0=Nothing done, >=0 if OK
*/ */
function valid($user, $notrigger = 0) public function valid($user, $notrigger = 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1838,7 +1838,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define proposal date * Define proposal date
* *
@ -1847,7 +1847,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 (empty($date)) if (empty($date))
@ -1907,7 +1907,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define end validity date * Define end validity date
* *
@ -1916,7 +1916,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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_echeance($user, $date_fin_validite, $notrigger = 0) public function set_echeance($user, $date_fin_validite, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
@ -1969,7 +1969,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set delivery date * Set delivery date
* *
@ -1978,7 +1978,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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_livraison($user, $date_livraison, $notrigger = 0) public function set_date_livraison($user, $date_livraison, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
@ -2031,7 +2031,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set delivery * Set delivery
* *
@ -2040,7 +2040,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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_availability($user, $id, $notrigger = 0) public function set_availability($user, $id, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
@ -2102,7 +2102,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set source of demand * Set source of demand
* *
@ -2111,7 +2111,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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_demand_reason($user, $id, $notrigger = 0) public function set_demand_reason($user, $id, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
@ -2175,7 +2175,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set customer reference number * Set customer reference number
* *
@ -2184,7 +2184,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 (! empty($user->rights->propal->creer)) if (! empty($user->rights->propal->creer))
@ -2240,7 +2240,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set an overall discount on the proposal * Set an overall discount on the proposal
* *
@ -2249,7 +2249,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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_percent($user, $remise, $notrigger = 0) public function set_remise_percent($user, $remise, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
@ -2307,7 +2307,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set an absolute overall discount on the proposal * Set an absolute overall discount on the proposal
* *
@ -2316,7 +2316,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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;
@ -2385,7 +2385,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 reopen($user, $statut, $note = '', $notrigger = 0) public function reopen($user, $statut, $note = '', $notrigger = 0)
{ {
$this->statut = $statut; $this->statut = $statut;
@ -2446,7 +2446,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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, $statut, $note = "", $notrigger = 0) public function cloture($user, $statut, $note = "", $notrigger = 0)
{ {
global $langs,$conf; global $langs,$conf;
@ -2549,7 +2549,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 classifyBilled(User $user, $notrigger = 0) public function classifyBilled(User $user, $notrigger = 0)
{ {
$error=0; $error=0;
@ -2597,7 +2597,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@ -2605,7 +2605,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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_draft($user, $notrigger = 0) public function set_draft($user, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
$error=0; $error=0;
@ -2656,7 +2656,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of proposal (eventually filtered on user) into an array * Return list of proposal (eventually filtered on user) into an array
* *
@ -2670,7 +2670,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC') public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC')
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@ -2739,19 +2739,19 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* *
* @return array Array of invoices * @return array Array of invoices
*/ */
function getInvoiceArrayList() public function getInvoiceArrayList()
{ {
return $this->InvoiceArrayList($this->id); return $this->InvoiceArrayList($this->id);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns an array with id and ref of related invoices * Returns an array with id and ref of related invoices
* *
* @param int $id Id propal * @param int $id Id propal
* @return array Array of invoices id * @return array Array of invoices id
*/ */
function InvoiceArrayList($id) public function InvoiceArrayList($id)
{ {
// phpcs:enable // phpcs:enable
$ga = array(); $ga = array();
@ -2838,7 +2838,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int 1 if ok, otherwise if error * @return int 1 if ok, otherwise if error
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf; global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -2962,7 +2962,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @deprecated use set_availability * @deprecated use set_availability
*/ */
function availability($availability_id, $notrigger = 0) public function availability($availability_id, $notrigger = 0)
{ {
global $user; global $user;
@ -3024,7 +3024,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Change source demand * Change source demand
* *
@ -3033,7 +3033,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
* @deprecated use set_demand_reason * @deprecated use set_demand_reason
*/ */
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;
@ -3103,7 +3103,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $id Proposal id * @param int $id Proposal id
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = "SELECT c.rowid, "; $sql = "SELECT c.rowid, ";
$sql.= " c.datec, c.date_valid as datev, c.date_cloture as dateo,"; $sql.= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
@ -3158,12 +3158,12 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut($this->statut, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of a status (draft, validated, ...) * Return label of a status (draft, validated, ...)
* *
@ -3171,7 +3171,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $mode = 1) public function LibStatut($statut, $mode = 1)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -3210,7 +3210,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
// 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)
* *
@ -3218,7 +3218,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user, $mode) public function load_board($user, $mode)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -3300,7 +3300,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $langs; global $langs;
@ -3386,13 +3386,13 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
} }
} }
// 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 $user; global $user;
@ -3438,7 +3438,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param Societe $soc Object thirdparty * @param Societe $soc Object thirdparty
* @return string Reference libre pour la propale * @return string Reference libre pour la propale
*/ */
function getNextNumRef($soc) public function getNextNumRef($soc)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("propal"); $langs->load("propal");
@ -3500,7 +3500,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @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 = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
@ -3574,7 +3574,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* *
* @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();
} }
@ -3754,7 +3754,7 @@ class PropaleLigne extends CommonObjectLine
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db= $db; $this->db= $db;
} }
@ -3765,7 +3765,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $rowid Propal line id * @param int $rowid Propal line id
* @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 pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,'; $sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,';
$sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,'; $sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,';
@ -3859,7 +3859,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger = 0) public function insert($notrigger = 0)
{ {
global $conf,$user; global $conf,$user;
@ -4002,7 +4002,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
function delete(User $user, $notrigger = 0) public function delete(User $user, $notrigger = 0)
{ {
global $conf; global $conf;
@ -4056,7 +4056,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
function update($notrigger = 0) public function update($notrigger = 0)
{ {
global $conf,$user; global $conf,$user;
@ -4178,14 +4178,14 @@ class PropaleLigne extends CommonObjectLine
} }
} }
// 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

@ -40,12 +40,12 @@ class PropaleStats 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;
/** /**
@ -56,7 +56,7 @@ class PropaleStats extends Stats
* @param int $userid Id user for filter (creation user) * @param int $userid Id user for filter (creation user)
* @param string $mode Option ('customer', 'supplier') * @param string $mode Option ('customer', 'supplier')
*/ */
function __construct($db, $socid = 0, $userid = 0, $mode = 'customer') public function __construct($db, $socid = 0, $userid = 0, $mode = 'customer')
{ {
global $user, $conf; global $user, $conf;
@ -106,7 +106,7 @@ class PropaleStats 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;
@ -128,7 +128,7 @@ class PropaleStats 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;
@ -149,7 +149,7 @@ class PropaleStats 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) public function getAmountByMonth($year, $format)
{ {
global $user; global $user;
@ -171,7 +171,7 @@ class PropaleStats 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;
@ -191,7 +191,7 @@ class PropaleStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getAllByYear() public function getAllByYear()
{ {
global $user; global $user;
@ -213,7 +213,7 @@ class PropaleStats 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

@ -564,7 +564,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Company type // Company type

View File

@ -106,7 +106,7 @@ if ($socid > 0)
$head = societe_prepare_head($object); $head = societe_prepare_head($object);
$isCustomer = $object->client == 1 || $object->client == 3; $isCustomer = ($object->client == 1 || $object->client == 3);
$isSupplier = $object->fournisseur == 1; $isSupplier = $object->fournisseur == 1;
print '<form method="POST" action="remise.php?id='.$object->id.'">'; print '<form method="POST" action="remise.php?id='.$object->id.'">';
@ -122,7 +122,7 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
if(! $isCustomer && ! $isSupplier) { if (! $isCustomer && ! $isSupplier) {
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>'; print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
dol_fiche_end(); dol_fiche_end();
@ -137,13 +137,13 @@ if ($socid > 0)
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if($isCustomer) { if ($isCustomer) {
// Customer discount // Customer discount
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>"; print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";
} }
if($isSupplier) { if ($isSupplier) {
// Supplier discount // Supplier discount
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans("SupplierRelativeDiscount").'</td><td>'.price2num($object->remise_supplier_percent)."%</td></tr>"; print $langs->trans("SupplierRelativeDiscount").'</td><td>'.price2num($object->remise_supplier_percent)."%</td></tr>";
@ -156,21 +156,28 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
if($isCustomer && ! $isSupplier) { /*if (! ($isCustomer && $isSupplier))
{
if ($isCustomer && ! $isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />'; print '<input type="hidden" name="discount_type" value="0" />';
} }
if (! $isCustomer && $isSupplier) {
if(! $isCustomer && $isSupplier) {
print '<input type="hidden" name="discount_type" value="1" />'; print '<input type="hidden" name="discount_type" value="1" />';
} }
}*/
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if($isCustomer && $isSupplier) { if ($isCustomer || $isSupplier)
{
// Discount type // Discount type
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>'; print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>';
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>'; if ($isCustomer) {
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>'; print '<input type="radio" name="discount_type" id="discount_type_0" checked value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
}
if ($isSupplier) {
print ' <input type="radio" name="discount_type" id="discount_type_1"'.($isCustomer?'':' checked').' value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
}
print '</td></tr>'; print '</td></tr>';
} }

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;
@ -554,7 +554,7 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag the order as validated (opened) * Tag the order as validated (opened)
* Function used when order is reopend after being closed. * Function used when order is reopend after being closed.
@ -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
@ -1769,14 +1768,14 @@ class Commande extends CommonOrder
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Adding line of fixed discount in the order in DB * Adding line of fixed discount in the order in DB
* *
* @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;
@ -3728,13 +3727,13 @@ class Commande extends CommonOrder
} }
// 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 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

@ -622,7 +622,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Company type // Company type

View File

@ -235,7 +235,7 @@ class Account extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct(DoliDB $db) public function __construct(DoliDB $db)
{ {
global $langs; global $langs;
@ -290,7 +290,7 @@ class Account extends CommonObject
* *
* @return int 1 if need to be concialiated, < 0 otherwise. * @return int 1 if need to be concialiated, < 0 otherwise.
*/ */
function canBeConciliated() public function canBeConciliated()
{ {
global $conf; global $conf;
@ -301,7 +301,7 @@ class Account extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add a link between bank line record and its source * Add a link between bank line record and its source
* *
@ -312,7 +312,7 @@ class Account extends CommonObject
* @param string $type Type of link ('payment', 'company', 'member', ...) * @param string $type Type of link ('payment', 'company', 'member', ...)
* @return int <0 if KO, id line if OK * @return int <0 if KO, id line if OK
*/ */
function add_url_line($line_id, $url_id, $url, $label, $type) public function add_url_line($line_id, $url_id, $url, $label, $type)
{ {
// phpcs:enable // phpcs:enable
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url (";
@ -342,7 +342,7 @@ class Account extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* TODO Move this into AccountLine * TODO Move this into AccountLine
* Return array with links from llx_bank_url * Return array with links from llx_bank_url
@ -352,7 +352,7 @@ class Account extends CommonObject
* @param string $type To search using type * @param string $type To search using type
* @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error
*/ */
function get_url($fk_bank = '', $url_id = '', $type = '') public function get_url($fk_bank = '', $url_id = '', $type = '')
{ {
// phpcs:enable // phpcs:enable
$lines = array(); $lines = array();
@ -417,7 +417,7 @@ class Account extends CommonObject
* @param int $datev Date value * @param int $datev Date value
* @return int Rowid of added entry, <0 if KO * @return int Rowid of added entry, <0 if KO
*/ */
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null) public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null)
{ {
// Deprecation warning // Deprecation warning
if (is_numeric($oper)) { if (is_numeric($oper)) {
@ -525,7 +525,7 @@ class Account extends CommonObject
* @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 create(User $user, $notrigger = 0) public function create(User $user, $notrigger = 0)
{ {
global $langs,$conf, $hookmanager; global $langs,$conf, $hookmanager;
@ -690,7 +690,7 @@ class Account extends CommonObject
* @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 update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $langs,$conf, $hookmanager; global $langs,$conf, $hookmanager;
@ -793,14 +793,14 @@ class Account extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update BBAN (RIB) account fields * Update BBAN (RIB) account fields
* *
* @param User $user Object user making update * @param User $user Object user making update
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_bban(User $user = null) public function update_bban(User $user = null)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -860,7 +860,7 @@ class Account extends CommonObject
* @param string $ref Ref of bank account to get * @param string $ref Ref of bank account to get
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
global $conf; global $conf;
@ -1008,7 +1008,7 @@ class Account extends CommonObject
* @param User $user User deleting * @param User $user User deleting
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete(User $user = null) public function delete(User $user = null)
{ {
global $conf; global $conf;
@ -1076,12 +1076,12 @@ class Account extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->clos, $mode); return $this->LibStatut($this->clos, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of given object status * Return label of given object status
* *
@ -1089,7 +1089,7 @@ class Account extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1120,13 +1120,13 @@ class Account extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi si un compte peut etre supprimer ou non (sans mouvements) * Renvoi si un compte peut etre supprimer ou non (sans mouvements)
* *
* @return boolean vrai si peut etre supprime, faux sinon * @return boolean vrai si peut etre supprime, faux sinon
*/ */
function can_be_deleted() public function can_be_deleted()
{ {
// phpcs:enable // phpcs:enable
$can_be_deleted=false; $can_be_deleted=false;
@ -1152,7 +1152,7 @@ class Account extends CommonObject
* *
* @return string Error string * @return string Error string
*/ */
function error() public function error()
{ {
return $this->error; return $this->error;
} }
@ -1163,7 +1163,7 @@ class Account extends CommonObject
* @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold) * @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold)
* @return int Current sold (value date <= today) * @return int Current sold (value date <= today)
*/ */
function solde($option = 0) public function solde($option = 0)
{ {
$solde=0; $solde=0;
@ -1189,7 +1189,7 @@ class Account extends CommonObject
return price2num($solde, 'MU'); return price2num($solde, 'MU');
} }
// 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)
* *
@ -1197,7 +1197,7 @@ class Account extends CommonObject
* @param int $filteraccountid To get info for a particular account id * @param int $filteraccountid To get info for a particular account id
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board(User $user, $filteraccountid = 0) public function load_board(User $user, $filteraccountid = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -1246,13 +1246,13 @@ class Account 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
* @param int $filteraccountid To get info for a particular account id * @param int $filteraccountid To get info for a particular account id
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
function load_state_board($filteraccountid = 0) public function load_state_board($filteraccountid = 0)
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@ -1329,7 +1329,7 @@ class Account extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0) public function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@ -1396,7 +1396,7 @@ class Account extends CommonObject
* *
* @return int 1 if correct, <=0 if wrong * @return int 1 if correct, <=0 if wrong
*/ */
function verif() public function verif()
{ {
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
@ -1430,7 +1430,7 @@ class Account extends CommonObject
* *
* @return string country code * @return string country code
*/ */
function getCountryCode() public function getCountryCode()
{ {
global $mysoc; global $mysoc;
@ -1467,7 +1467,7 @@ class Account extends CommonObject
* 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key * 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key
* 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number * 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
*/ */
function useDetailedBBAN() public function useDetailedBBAN()
{ {
$country_code=$this->getCountryCode(); $country_code=$this->getCountryCode();
@ -1481,7 +1481,7 @@ class Account extends CommonObject
* *
* @return int 1 = mandatory / 0 = Not mandatory * @return int 1 = mandatory / 0 = Not mandatory
*/ */
function needIBAN() public function needIBAN()
{ {
$country_code=$this->getCountryCode(); $country_code=$this->getCountryCode();
@ -1531,7 +1531,7 @@ class Account extends CommonObject
* @param int $id Id of object to load * @param int $id Id of object to load
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
} }
@ -1631,7 +1631,7 @@ class Account extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->specimen = 1; $this->specimen = 1;
$this->ref = 'MBA'; $this->ref = 'MBA';
@ -1752,7 +1752,7 @@ class AccountLine extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct(DoliDB $db) public function __construct(DoliDB $db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -1765,7 +1765,7 @@ class AccountLine extends CommonObject
* @param string $num External num to load (ex: num of transaction for paypal fee) * @param string $num External num to load (ex: num of transaction for paypal fee)
* @return int <0 if KO, 0 if OK but not found, >0 if OK and found * @return int <0 if KO, 0 if OK but not found, >0 if OK and found
*/ */
function fetch($rowid, $ref = '', $num = '') public function fetch($rowid, $ref = '', $num = '')
{ {
global $conf; global $conf;
@ -1887,7 +1887,7 @@ class AccountLine extends CommonObject
* @param User $user User object that delete * @param User $user User object that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete(User $user = null) public function delete(User $user = null)
{ {
$nbko=0; $nbko=0;
@ -1930,14 +1930,14 @@ class AccountLine extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete bank line records * Delete bank line records
* *
* @param User $user User object that delete * @param User $user User object that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete_urls(User $user = null) public function delete_urls(User $user = null)
{ {
// phpcs:enable // phpcs:enable
$nbko=0; $nbko=0;
@ -1976,7 +1976,7 @@ class AccountLine extends CommonObject
* @param int $notrigger 0=Disable all triggers * @param int $notrigger 0=Disable all 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)
{ {
$this->db->begin(); $this->db->begin();
@ -2002,7 +2002,7 @@ class AccountLine extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update conciliation field * Update conciliation field
* *
@ -2011,7 +2011,7 @@ class AccountLine extends CommonObject
* @param int $conciliated 1=Set transaction to conciliated, 0=Keep transaction non conciliated * @param int $conciliated 1=Set transaction to conciliated, 0=Keep transaction non conciliated
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_conciliation(User $user, $cat, $conciliated = 1) public function update_conciliation(User $user, $cat, $conciliated = 1)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -2067,7 +2067,7 @@ class AccountLine extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Increase/decrease value date of a rowid * Increase/decrease value date of a rowid
* *
@ -2075,7 +2075,7 @@ class AccountLine extends CommonObject
* @param int $sign 1 or -1 * @param int $sign 1 or -1
* @return int >0 if OK, 0 if KO * @return int >0 if OK, 0 if KO
*/ */
function datev_change($rowid, $sign = 1) public function datev_change($rowid, $sign = 1)
{ {
// phpcs:enable // phpcs:enable
$sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
@ -2107,34 +2107,34 @@ class AccountLine extends CommonObject
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Increase value date of a rowid * Increase value date of a rowid
* *
* @param int $id Id of line to change * @param int $id Id of line to change
* @return int >0 if OK, 0 if KO * @return int >0 if OK, 0 if KO
*/ */
function datev_next($id) public function datev_next($id)
{ {
// phpcs:enable // phpcs:enable
return $this->datev_change($id, 1); return $this->datev_change($id, 1);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Decrease value date of a rowid * Decrease value date of a rowid
* *
* @param int $id Id of line to change * @param int $id Id of line to change
* @return int >0 if OK, 0 if KO * @return int >0 if OK, 0 if KO
*/ */
function datev_previous($id) public function datev_previous($id)
{ {
// phpcs:enable // phpcs:enable
return $this->datev_change($id, -1); return $this->datev_change($id, -1);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Increase/decrease operation date of a rowid * Increase/decrease operation date of a rowid
* *
@ -2142,7 +2142,7 @@ class AccountLine extends CommonObject
* @param int $sign 1 or -1 * @param int $sign 1 or -1
* @return int >0 if OK, 0 if KO * @return int >0 if OK, 0 if KO
*/ */
function dateo_change($rowid, $sign = 1) public function dateo_change($rowid, $sign = 1)
{ {
// phpcs:enable // phpcs:enable
$sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
@ -2174,27 +2174,27 @@ class AccountLine extends CommonObject
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Increase operation date of a rowid * Increase operation date of a rowid
* *
* @param int $id Id of line to change * @param int $id Id of line to change
* @return int >0 if OK, 0 if KO * @return int >0 if OK, 0 if KO
*/ */
function dateo_next($id) public function dateo_next($id)
{ {
// phpcs:enable // phpcs:enable
return $this->dateo_change($id, 1); return $this->dateo_change($id, 1);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Decrease operation date of a rowid * Decrease operation date of a rowid
* *
* @param int $id Id of line to change * @param int $id Id of line to change
* @return int >0 if OK, 0 if KO * @return int >0 if OK, 0 if KO
*/ */
function dateo_previous($id) public function dateo_previous($id)
{ {
// phpcs:enable // phpcs:enable
return $this->dateo_change($id, -1); return $this->dateo_change($id, -1);
@ -2207,7 +2207,7 @@ class AccountLine extends CommonObject
* @param int $id Id of object to load * @param int $id Id of object to load
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT b.rowid, b.datec, b.tms as datem,'; $sql = 'SELECT b.rowid, b.datec, b.tms as datem,';
$sql.= ' b.fk_user_author, b.fk_user_rappro'; $sql.= ' b.fk_user_author, b.fk_user_rappro';
@ -2257,7 +2257,7 @@ class AccountLine extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0) public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0)
{ {
global $langs; global $langs;
@ -2298,12 +2298,12 @@ class AccountLine extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle * @return string Libelle
*/ */
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
* *
@ -2311,7 +2311,7 @@ class AccountLine 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 du statut * @return string Libelle du statut
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;

View File

@ -43,7 +43,7 @@ class BankAccounts extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;
@ -61,11 +61,11 @@ class BankAccounts extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
$list = array(); $list = array();
if(! DolibarrApiAccess::$user->rights->banque->lire) { if (! DolibarrApiAccess::$user->rights->banque->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -121,7 +121,7 @@ class BankAccounts extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if (! DolibarrApiAccess::$user->rights->banque->lire) { if (! DolibarrApiAccess::$user->rights->banque->lire) {
throw new RestException(401); throw new RestException(401);
@ -142,7 +142,7 @@ class BankAccounts extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of account * @return int ID of account
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->banque->configurer) { if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401); throw new RestException(401);
@ -173,7 +173,7 @@ class BankAccounts extends DolibarrApi
* @param array $request_data data * @param array $request_data data
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->banque->configurer) { if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401); throw new RestException(401);
@ -206,7 +206,7 @@ class BankAccounts extends DolibarrApi
* @param int $id ID of account * @param int $id ID of account
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if (! DolibarrApiAccess::$user->rights->banque->configurer) { if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401); throw new RestException(401);
@ -237,7 +237,7 @@ class BankAccounts extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$account = array(); $account = array();
foreach (BankAccounts::$FIELDS as $field) { foreach (BankAccounts::$FIELDS as $field) {
@ -254,7 +254,7 @@ class BankAccounts 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);
@ -273,7 +273,7 @@ class BankAccounts extends DolibarrApi
* *
* @url GET {id}/lines * @url GET {id}/lines
*/ */
function getLines($id) public function getLines($id)
{ {
$list = array(); $list = array();
@ -325,7 +325,7 @@ class BankAccounts extends DolibarrApi
* *
* @url POST {id}/lines * @url POST {id}/lines
*/ */
function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '') public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '')
{ {
if (! DolibarrApiAccess::$user->rights->banque->modifier) { if (! DolibarrApiAccess::$user->rights->banque->modifier) {
throw new RestException(401); throw new RestException(401);
@ -337,8 +337,16 @@ class BankAccounts extends DolibarrApi
throw new RestException(404, 'account not found'); throw new RestException(404, 'account not found');
} }
$result = $account->addline($date, $type, $label, $amount, $cheque_number, $category, $result = $account->addline(
DolibarrApiAccess::$user, $cheque_writer, $cheque_bank); $date,
$type,
$label,
$amount,
$cheque_number,
$category,
DolibarrApiAccess::$user,
$cheque_writer, $cheque_bank
);
if ($result < 0) { if ($result < 0) {
throw new RestException(503, 'Error when adding line to account: ' . $account->error); throw new RestException(503, 'Error when adding line to account: ' . $account->error);
} }
@ -358,7 +366,7 @@ class BankAccounts extends DolibarrApi
* *
* @url POST {id}/lines/{line_id}/links * @url POST {id}/lines/{line_id}/links
*/ */
function addLink($id, $line_id, $url_id, $url, $label, $type) public function addLink($id, $line_id, $url_id, $url, $label, $type)
{ {
if (! DolibarrApiAccess::$user->rights->banque->modifier) { if (! DolibarrApiAccess::$user->rights->banque->modifier) {
throw new RestException(401); throw new RestException(401);

View File

@ -99,7 +99,7 @@ class PaymentVarious 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->element = 'payment_various'; $this->element = 'payment_various';
@ -113,7 +113,7 @@ class PaymentVarious extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger) * @param int $notrigger 0=no, 1=yes (no update trigger)
* @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;
@ -184,7 +184,7 @@ class PaymentVarious extends CommonObject
* @param User $user User that load * @param User $user User that load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $user = null) public function fetch($id, $user = null)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -258,7 +258,7 @@ class PaymentVarious extends CommonObject
* @param User $user User that delete * @param User $user User that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user) public function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
@ -292,7 +292,7 @@ class PaymentVarious extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
@ -316,7 +316,7 @@ class PaymentVarious extends CommonObject
* @param User $user User that create * @param User $user 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;
@ -482,14 +482,14 @@ class PaymentVarious extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update link between payment various and line generate into llx_bank * Update link between payment various and line generate into llx_bank
* *
* @param int $id_bank Id bank account * @param int $id_bank Id bank account
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_fk_bank($id_bank) public function update_fk_bank($id_bank)
{ {
// phpcs:enable // phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank; $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank;
@ -513,12 +513,12 @@ class PaymentVarious extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle * @return string Libelle
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -526,7 +526,7 @@ class PaymentVarious extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle * @return string Libelle
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -575,7 +575,7 @@ class PaymentVarious 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 = '', $save_lastsearch_value = -1, $notooltip = 0) public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $langs; global $langs;
@ -644,7 +644,7 @@ class PaymentVarious extends CommonObject
* @param int $id Id of record * @param int $id Id of record
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT v.rowid, v.datec, v.fk_user_author'; $sql = 'SELECT v.rowid, v.datec, v.fk_user_author';
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_various as v'; $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';

View File

@ -83,7 +83,7 @@ class Deplacement 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;
@ -98,7 +98,7 @@ class Deplacement extends CommonObject
* @param User $user User that creates * @param User $user User that creates
* @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; global $conf;
@ -183,7 +183,7 @@ class Deplacement extends CommonObject
* @param User $user User making update * @param User $user User 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)
{ {
global $langs; global $langs;
@ -245,7 +245,7 @@ class Deplacement extends CommonObject
* @param string $ref Ref of record * @param string $ref Ref of record
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams"; $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
@ -288,7 +288,7 @@ class Deplacement extends CommonObject
* @param int $id Id of record to delete * @param int $id Id of record to delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($id) public function delete($id)
{ {
$this->db->begin(); $this->db->begin();
@ -316,12 +316,12 @@ class Deplacement extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle * @return string Libelle
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -329,7 +329,7 @@ class Deplacement extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle * @return string Libelle
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -345,26 +345,26 @@ class Deplacement extends CommonObject
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]); elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
} }
} }
@ -374,7 +374,7 @@ class Deplacement extends CommonObject
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0) public function getNomUrl($withpicto = 0)
{ {
global $langs; global $langs;
@ -400,7 +400,7 @@ class Deplacement extends CommonObject
* @param int $active Active or not * @param int $active Active or not
* @return array * @return array
*/ */
function listOfTypes($active = 1) public function listOfTypes($active = 1)
{ {
global $langs; global $langs;
@ -437,7 +437,7 @@ class Deplacement extends CommonObject
* @param int $id Id of record * @param int $id Id of record
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,'; $sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,';
$sql.= ' c.tms'; $sql.= ' c.tms';

View File

@ -35,12 +35,12 @@ class DeplacementStats 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;
/** /**
* Constructor * Constructor
@ -50,7 +50,7 @@ class DeplacementStats extends Stats
* @param mixed $userid Id user for filter or array of user ids * @param mixed $userid Id user for filter or array of user ids
* @return void * @return void
*/ */
function __construct($db, $socid = 0, $userid = 0) public function __construct($db, $socid = 0, $userid = 0)
{ {
global $conf; global $conf;
@ -78,7 +78,7 @@ class DeplacementStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getNbByYear() public function getNbByYear()
{ {
$sql = "SELECT YEAR(dated) as dm, count(*)"; $sql = "SELECT YEAR(dated) as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -96,7 +96,7 @@ class DeplacementStats 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 values * @return array Array of values
*/ */
function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
$sql = "SELECT MONTH(dated) as dm, count(*)"; $sql = "SELECT MONTH(dated) as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -118,7 +118,7 @@ class DeplacementStats 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 values * @return array Array of values
*/ */
function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
$sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")"; $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -138,7 +138,7 @@ class DeplacementStats 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 getAverageByMonth($year) public function getAverageByMonth($year)
{ {
$sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")"; $sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -155,7 +155,7 @@ class DeplacementStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getAllByYear() public function getAllByYear()
{ {
$sql = "SELECT date_format(dated,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql = "SELECT date_format(dated,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;

View File

@ -43,7 +43,7 @@ class Invoices extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -61,7 +61,7 @@ class Invoices extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{ {
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
@ -105,7 +105,7 @@ class Invoices extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -204,7 +204,7 @@ class Invoices extends DolibarrApi
* @param array $request_data Request datas * @param array $request_data Request datas
* @return int ID of invoice * @return int ID of invoice
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401, "Insuffisant rights"); throw new RestException(401, "Insuffisant rights");
@ -247,29 +247,29 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function createInvoiceFromOrder($orderid) public function createInvoiceFromOrder($orderid)
{ {
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
if(! DolibarrApiAccess::$user->rights->commande->lire) { if (! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
if(! DolibarrApiAccess::$user->rights->facture->creer) { if (! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
} }
if(empty($orderid)) { if (empty($orderid)) {
throw new RestException(400, 'Order ID is mandatory'); throw new RestException(400, 'Order ID is mandatory');
} }
$order = new Commande($this->db); $order = new Commande($this->db);
$result = $order->fetch($orderid); $result = $order->fetch($orderid);
if( ! $result ) { if ( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
$result = $this->invoice->createFromOrder($order, DolibarrApiAccess::$user); $result = $this->invoice->createFromOrder($order, DolibarrApiAccess::$user);
if( $result < 0) { if ( $result < 0) {
throw new RestException(405, $this->invoice->error); throw new RestException(405, $this->invoice->error);
} }
$this->invoice->fetchObjectLinked(); $this->invoice->fetchObjectLinked();
@ -285,7 +285,7 @@ class Invoices extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) public function getLines($id)
{ {
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
@ -323,7 +323,7 @@ class Invoices extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function putLine($id, $lineid, $request_data = null) public function putLine($id, $lineid, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -386,7 +386,7 @@ class Invoices 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->facture->creer) { if(!DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -428,7 +428,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 500 * @throws 500
*/ */
function deleteContact($id, $rowid) public function deleteContact($id, $rowid)
{ {
if(!DolibarrApiAccess::$user->rights->facture->creer) { if(!DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -468,7 +468,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
@ -506,7 +506,7 @@ class Invoices extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -547,7 +547,7 @@ class Invoices extends DolibarrApi
* @param int $id Invoice ID * @param int $id Invoice ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->facture->supprimer) { if(! DolibarrApiAccess::$user->rights->facture->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -597,7 +597,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 400 * @throws 400
*/ */
function postLine($id, $request_data = null) public function postLine($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -681,7 +681,7 @@ class Invoices extends DolibarrApi
* @throws 500 * @throws 500
* *
*/ */
function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -731,7 +731,7 @@ class Invoices extends DolibarrApi
* @throws 500 * @throws 500
* *
*/ */
function settodraft($id, $idwarehouse = -1) public function settodraft($id, $idwarehouse = -1)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -783,7 +783,7 @@ class Invoices 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->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -834,7 +834,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 500 * @throws 500
*/ */
function settopaid($id, $close_code = '', $close_note = '') public function settopaid($id, $close_code = '', $close_note = '')
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -885,7 +885,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 500 * @throws 500
*/ */
function settounpaid($id) public function settounpaid($id)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -934,7 +934,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 500 * @throws 500
*/ */
function markAsCreditAvailable($id) public function markAsCreditAvailable($id)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -1053,7 +1053,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function useDiscount($id, $discountid) public function useDiscount($id, $discountid)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
@ -1099,7 +1099,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function useCreditNote($id, $discountid) public function useCreditNote($id, $discountid)
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
@ -1144,7 +1144,7 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function getPayments($id) public function getPayments($id)
{ {
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
@ -1192,7 +1192,7 @@ class Invoices extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
{ {
global $conf; global $conf;
@ -1312,7 +1312,7 @@ class Invoices extends DolibarrApi
* @throws 403 * @throws 403
* @throws 404 * @throws 404
*/ */
function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') public function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
{ {
global $conf; global $conf;
@ -1423,7 +1423,7 @@ class Invoices 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);
@ -1446,7 +1446,7 @@ class Invoices extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$invoice = array(); $invoice = array();
foreach (Invoices::$FIELDS as $field) { foreach (Invoices::$FIELDS as $field) {

View File

@ -103,7 +103,7 @@ class FactureRec extends CommonInvoice
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -115,7 +115,7 @@ class FactureRec extends CommonInvoice
* @param int $facid Id of source invoice * @param int $facid Id of source invoice
* @return int <0 if KO, id of invoice created if OK * @return int <0 if KO, id of invoice created if OK
*/ */
function create($user, $facid) public function create($user, $facid)
{ {
global $conf; global $conf;
@ -312,6 +312,59 @@ class FactureRec extends CommonInvoice
} }
/**
* Update a line to invoice_rec.
*
* @param User $user User
* @param int $notrigger No trigger
* @return int <0 if KO, Id of line if OK
*/
public function update(User $user, $notrigger = 0)
{
global $conf;
$error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
$sql.= " fk_soc = ".$this->fk_soc;
// TODO Add missing fields
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILLREC_UPDATE', $user);
if ($result < 0)
{
$this->db->rollback();
return -2;
}
// End call triggers
}
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -2;
}
}
/** /**
* Load object and lines * Load object and lines
* *
@ -321,7 +374,7 @@ class FactureRec extends CommonInvoice
* @param int $ref_int Internal reference of other object * @param int $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($rowid, $ref = '', $ref_ext = '', $ref_int = '') public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
{ {
$sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc'; $sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise';
@ -449,19 +502,19 @@ class FactureRec extends CommonInvoice
* *
* @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();
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Recupere les lignes de factures predefinies dans this->lines * Recupere les lignes de factures predefinies dans this->lines
* *
* @return int 1 if OK, < 0 if KO * @return int 1 if OK, < 0 if KO
*/ */
function fetch_lines() public function fetch_lines()
{ {
// phpcs:enable // phpcs:enable
$this->lines=array(); $this->lines=array();
@ -573,7 +626,7 @@ class FactureRec extends CommonInvoice
* @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 delete(User $user, $notrigger = 0, $idwarehouse = -1) public function delete(User $user, $notrigger = 0, $idwarehouse = -1)
{ {
$rowid=$this->id; $rowid=$this->id;
@ -644,7 +697,7 @@ class FactureRec extends CommonInvoice
* @param int $date_end_fill 1=Flag to fill end date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0) public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0)
{ {
global $mysoc; global $mysoc;
@ -826,7 +879,7 @@ class FactureRec extends CommonInvoice
* @param int $date_end_fill 1=Flag to fill end date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0) public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0)
{ {
global $mysoc; global $mysoc;
@ -962,7 +1015,7 @@ class FactureRec extends CommonInvoice
* *
* @return int|false false if KO, timestamp if OK * @return int|false false if KO, timestamp if OK
*/ */
function getNextDate() public function getNextDate()
{ {
if (empty($this->date_when)) return false; if (empty($this->date_when)) return false;
return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency); return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency);
@ -973,7 +1026,7 @@ class FactureRec extends CommonInvoice
* *
* @return boolean False by default, True if maximum number of generation is reached * @return boolean False by default, True if maximum number of generation is reached
*/ */
function isMaxNbGenReached() public function isMaxNbGenReached()
{ {
$ret = false; $ret = false;
if ($this->nb_gen_max > 0 && ($this->nb_gen_done >= $this->nb_gen_max)) $ret = true; if ($this->nb_gen_max > 0 && ($this->nb_gen_done >= $this->nb_gen_max)) $ret = true;
@ -986,7 +1039,7 @@ class FactureRec extends CommonInvoice
* @param string $ret Default value to output * @param string $ret Default value to output
* @return boolean False by default, True if maximum number of generation is reached * @return boolean False by default, True if maximum number of generation is reached
*/ */
function strikeIfMaxNbGenReached($ret) public function strikeIfMaxNbGenReached($ret)
{ {
// Special case to strike the date // Special case to strike the date
return ($this->isMaxNbGenReached()?'<strike>':'').$ret.($this->isMaxNbGenReached()?'</strike>':''); return ($this->isMaxNbGenReached()?'<strike>':'').$ret.($this->isMaxNbGenReached()?'</strike>':'');
@ -1002,7 +1055,7 @@ class FactureRec extends CommonInvoice
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag. * @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/ */
function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0) public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0)
{ {
global $conf, $langs, $db, $user, $hookmanager; global $conf, $langs, $db, $user, $hookmanager;
@ -1159,7 +1212,7 @@ class FactureRec extends CommonInvoice
* @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, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
{ {
global $langs; global $langs;
@ -1210,13 +1263,13 @@ class FactureRec extends CommonInvoice
* @param integer $alreadypaid Not used on recurring invoices * @param integer $alreadypaid Not used on recurring invoices
* @return string Label of status * @return string Label of status
*/ */
function getLibStatut($mode = 0, $alreadypaid = -1) public function getLibStatut($mode = 0, $alreadypaid = -1)
{ {
return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type); return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of a status * Return label of a status
* *
@ -1227,7 +1280,7 @@ class FactureRec extends CommonInvoice
* @param int $type Type invoice * @param int $type Type invoice
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0) public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1328,7 +1381,7 @@ class FactureRec extends CommonInvoice
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
* @return void * @return void
*/ */
function initAsSpecimen($option = '') public function initAsSpecimen($option = '')
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@ -1480,31 +1533,27 @@ class FactureRec extends CommonInvoice
* @param string $unit unit of frequency (d, m, y) * @param string $unit unit of frequency (d, m, y)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setFrequencyAndUnit($frequency, $unit) public function setFrequencyAndUnit($frequency, $unit)
{
if (! $this->table_element)
{ {
if (! $this->table_element) {
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR); dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR);
return -1; return -1;
} }
if (!empty($frequency) && empty($unit)) if (!empty($frequency) && empty($unit)) {
{
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined", LOG_ERR); dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined", LOG_ERR);
return -2; return -2;
} }
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null'); $sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
if (!empty($unit)) if (!empty($unit)) {
{
$sql.= ', unit_frequency = \''.$this->db->escape($unit).'\''; $sql.= ', unit_frequency = \''.$this->db->escape($unit).'\'';
} }
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG); dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql)) {
{
$this->frequency = $frequency; $this->frequency = $frequency;
if (!empty($unit)) $this->unit_frequency = $unit; if (!empty($unit)) $this->unit_frequency = $unit;
return 1; return 1;
@ -1523,7 +1572,7 @@ class FactureRec extends CommonInvoice
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done * @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setNextDate($date, $increment_nb_gen_done = 0) public function setNextDate($date, $increment_nb_gen_done = 0)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@ -1555,7 +1604,7 @@ class FactureRec extends CommonInvoice
* @param int $nb number of maximum period * @param int $nb number of maximum period
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setMaxPeriod($nb) public function setMaxPeriod($nb)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@ -1588,7 +1637,7 @@ class FactureRec extends CommonInvoice
* @param int $validate 0 to create in draft, 1 to create and validate invoice * @param int $validate 0 to create in draft, 1 to create and validate invoice
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setAutoValidate($validate) public function setAutoValidate($validate)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@ -1619,7 +1668,7 @@ class FactureRec extends CommonInvoice
* @param int $validate 0 no document, 1 to generate document * @param int $validate 0 no document, 1 to generate document
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setGeneratePdf($validate) public function setGeneratePdf($validate)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@ -1650,7 +1699,7 @@ class FactureRec extends CommonInvoice
* @param string $model model of document generator * @param string $model model of document generator
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setModelPdf($model) public function setModelPdf($model)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@ -1694,8 +1743,8 @@ class FactureLigneRec extends CommonInvoiceLine
*/ */
public $table_element='facturedet_rec'; public $table_element='facturedet_rec';
var $date_start_fill; public $date_start_fill;
var $date_end_fill; public $date_end_fill;
/** /**
@ -1705,7 +1754,7 @@ class FactureLigneRec extends CommonInvoiceLine
* @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 delete(User $user, $notrigger = false) public function delete(User $user, $notrigger = false)
{ {
$error=0; $error=0;
@ -1748,7 +1797,7 @@ class FactureLigneRec extends CommonInvoiceLine
* @param int $rowid Id of invoice * @param int $rowid Id of invoice
* @return int 1 if OK, < 0 if KO * @return int 1 if OK, < 0 if KO
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; $sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
@ -1823,10 +1872,12 @@ class FactureLigneRec extends CommonInvoiceLine
* @param int $notrigger No trigger * @param int $notrigger No trigger
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
function update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $conf; global $conf;
$error = 0;
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET";
@ -1848,8 +1899,7 @@ class FactureLigneRec extends CommonInvoiceLine
$sql.= ", info_bits='".price2num($this->info_bits)."'"; $sql.= ", info_bits='".price2num($this->info_bits)."'";
$sql.= ", date_start_fill=".(int) $this->date_start_fill; $sql.= ", date_start_fill=".(int) $this->date_start_fill;
$sql.= ", date_end_fill=".(int) $this->date_end_fill; $sql.= ", date_end_fill=".(int) $this->date_end_fill;
if (empty($this->skip_update_total)) if (empty($this->skip_update_total)) {
{
$sql.= ", total_ht=".price2num($this->total_ht); $sql.= ", total_ht=".price2num($this->total_ht);
$sql.= ", total_tva=".price2num($this->total_tva); $sql.= ", total_tva=".price2num($this->total_tva);
$sql.= ", total_localtax1=".price2num($this->total_localtax1); $sql.= ", total_localtax1=".price2num($this->total_localtax1);
@ -1878,7 +1928,7 @@ class FactureLigneRec extends CommonInvoiceLine
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('LINEBILL_REC_UPDATE', $user); $result=$this->call_trigger('LINEBILLREC_UPDATE', $user);
if ($result < 0) if ($result < 0)
{ {
$this->db->rollback(); $this->db->rollback();

View File

@ -274,7 +274,7 @@ class Facture extends CommonInvoice
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -289,7 +289,7 @@ class Facture extends CommonInvoice
* @param int $forceduedate 1=Do not recalculate due date from payment condition but force it with value * @param int $forceduedate 1=Do not recalculate due date from payment condition but force it with value
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create(User $user, $notrigger = 0, $forceduedate = 0) public function create(User $user, $notrigger = 0, $forceduedate = 0)
{ {
global $langs,$conf,$mysoc,$hookmanager; global $langs,$conf,$mysoc,$hookmanager;
$error=0; $error=0;
@ -854,7 +854,7 @@ class Facture extends CommonInvoice
* @param int $invertdetail Reverse sign of amounts for lines * @param int $invertdetail Reverse sign of amounts for lines
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function createFromCurrent(User $user, $invertdetail = 0) public function createFromCurrent(User $user, $invertdetail = 0)
{ {
global $conf; global $conf;
@ -945,7 +945,7 @@ class Facture extends CommonInvoice
* @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, $conf; global $user,$hookmanager, $conf;
@ -1054,7 +1054,7 @@ class Facture extends CommonInvoice
* @param User $user Object user * @param User $user Object user
* @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 createFromOrder($object, User $user) public function createFromOrder($object, User $user)
{ {
global $hookmanager; global $hookmanager;
@ -1172,7 +1172,7 @@ class Facture extends CommonInvoice
* @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, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1)
{ {
global $langs, $conf, $user, $form; global $langs, $conf, $user, $form;
@ -1280,7 +1280,7 @@ class Facture extends CommonInvoice
* @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice * @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice
* @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($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false) public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false)
{ {
global $conf; global $conf;
@ -1431,13 +1431,13 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load all detailed lines into this->lines * Load all detailed lines into this->lines
* *
* @return int 1 if OK, < 0 if KO * @return int 1 if OK, < 0 if KO
*/ */
function fetch_lines() public function fetch_lines()
{ {
// phpcs:enable // phpcs:enable
$this->lines=array(); $this->lines=array();
@ -1547,7 +1547,7 @@ class Facture extends CommonInvoice
* *
* @return void * @return void
*/ */
function fetchPreviousNextSituationInvoice() public function fetchPreviousNextSituationInvoice()
{ {
global $conf; global $conf;
@ -1587,7 +1587,7 @@ class Facture extends CommonInvoice
* @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;
@ -1692,14 +1692,14 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount)
* *
* @param int $idremise Id of absolute discount * @param int $idremise Id of absolute discount
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function insert_discount($idremise) public function insert_discount($idremise)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1794,7 +1794,7 @@ class Facture extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set customer ref * Set customer ref
* *
@ -1802,7 +1802,7 @@ class Facture extends CommonInvoice
* @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($ref_client, $notrigger = 0) public function set_ref_client($ref_client, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@ -1867,7 +1867,7 @@ class Facture extends CommonInvoice
* @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=Refused, >0 if OK * @return int <0 if KO, 0=Refused, >0 if OK
*/ */
function delete($user, $notrigger = 0, $idwarehouse = -1) public function delete($user, $notrigger = 0, $idwarehouse = -1)
{ {
global $langs,$conf; global $langs,$conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -2031,7 +2031,7 @@ class Facture extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1
* ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
@ -2041,7 +2041,7 @@ class Facture extends CommonInvoice
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_paid($user, $close_code = '', $close_note = '') public function set_paid($user, $close_code = '', $close_note = '')
{ {
// phpcs:enable // phpcs:enable
$error=0; $error=0;
@ -2091,7 +2091,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
* Fonction utilisee quand un paiement prelevement est refuse, * Fonction utilisee quand un paiement prelevement est refuse,
@ -2100,7 +2100,7 @@ class Facture extends CommonInvoice
* @param User $user Object user that change status * @param User $user Object user that change status
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_unpaid($user) public function set_unpaid($user)
{ {
// phpcs:enable // phpcs:enable
$error=0; $error=0;
@ -2140,7 +2140,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
@ -2151,7 +2151,7 @@ class Facture extends CommonInvoice
* @param string $close_note Comment * @param string $close_note Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_canceled($user, $close_code = '', $close_note = '') public function set_canceled($user, $close_code = '', $close_note = '')
{ {
// phpcs:enable // phpcs:enable
@ -2214,7 +2214,7 @@ class Facture extends CommonInvoice
* @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 done because invoice is not a draft, >0 if OK * @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK
*/ */
function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0) public function validate($user, $force_number = '', $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';
@ -2471,7 +2471,7 @@ class Facture extends CommonInvoice
* @param Translate $langs Translate object * @param Translate $langs Translate object
* @return bool false if KO, true if OK * @return bool false if KO, true if OK
*/ */
function updatePriceNextInvoice(&$langs) public function updatePriceNextInvoice(&$langs)
{ {
foreach ($this->tab_next_situation_invoice as $next_invoice) foreach ($this->tab_next_situation_invoice as $next_invoice)
{ {
@ -2504,7 +2504,7 @@ class Facture extends CommonInvoice
return true; return true;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@ -2512,7 +2512,7 @@ class Facture extends CommonInvoice
* @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 set_draft($user, $idwarehouse = -1) public function set_draft($user, $idwarehouse = -1)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -2632,7 +2632,7 @@ class Facture extends CommonInvoice
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0)
{ {
// Deprecation warning // Deprecation warning
if ($label) { if ($label) {
@ -2862,7 +2862,7 @@ class Facture extends CommonInvoice
* @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, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{ {
global $conf,$user; global $conf,$user;
// Deprecation warning // Deprecation warning
@ -3053,7 +3053,7 @@ class Facture extends CommonInvoice
* @param float $situation_percent progress percentage need to be test * @param float $situation_percent progress percentage need to be test
* @return false if KO, true if OK * @return false if KO, true if OK
*/ */
function checkProgressLine($idline, $situation_percent) public function checkProgressLine($idline, $situation_percent)
{ {
$sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd
INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid)
@ -3073,7 +3073,7 @@ class Facture extends CommonInvoice
else return $situation_percent < $obj->situation_percent; else return $situation_percent < $obj->situation_percent;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update invoice line with percentage * Update invoice line with percentage
* *
@ -3081,7 +3081,7 @@ class Facture extends CommonInvoice
* @param int $percent Percentage * @param int $percent Percentage
* @return void * @return void
*/ */
function update_percent($line, $percent) public function update_percent($line, $percent)
{ {
// phpcs:enable // phpcs:enable
global $mysoc,$user; global $mysoc,$user;
@ -3111,7 +3111,7 @@ class Facture extends CommonInvoice
* @param int $rowid Id of line to delete * @param int $rowid Id of line to delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function deleteline($rowid) public function deleteline($rowid)
{ {
global $user; global $user;
@ -3171,7 +3171,7 @@ class Facture extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set percent discount * Set percent discount
* *
@ -3180,7 +3180,7 @@ class Facture extends CommonInvoice
* @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
// Clean parameters // Clean parameters
@ -3237,7 +3237,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set absolute discount * Set absolute discount
* *
@ -3246,7 +3246,7 @@ class Facture extends CommonInvoice
* @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
if (empty($remise)) $remise=0; if (empty($remise)) $remise=0;
@ -3313,7 +3313,7 @@ class Facture extends CommonInvoice
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string free ref or last ref * @return string free ref or last ref
*/ */
function getNextNumRef($soc, $mode = 'next') public function getNextNumRef($soc, $mode = 'next')
{ {
global $conf, $langs; global $conf, $langs;
$langs->load("bills"); $langs->load("bills");
@ -3402,7 +3402,7 @@ class Facture extends CommonInvoice
* @param int $id Id of object to load * @param int $id Id of object to load
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,'; $sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,';
$sql.= ' fk_user_author, fk_user_valid'; $sql.= ' fk_user_author, fk_user_valid';
@ -3441,7 +3441,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of invoices (eventually filtered on a user) into an array * Return list of invoices (eventually filtered on a user) into an array
* *
@ -3455,7 +3455,7 @@ class Facture extends CommonInvoice
* @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 = 'f.datef,f.rowid', $sortorder = 'DESC') public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'f.datef,f.rowid', $sortorder = 'DESC')
{ {
// phpcs:enable // phpcs:enable
global $conf,$user; global $conf,$user;
@ -3517,7 +3517,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of invoices qualified to be replaced by another invoice. * Return list of invoices qualified to be replaced by another invoice.
* Invoices matching the following rules are returned: * Invoices matching the following rules are returned:
@ -3526,7 +3526,7 @@ class Facture extends CommonInvoice
* @param int $socid Id thirdparty * @param int $socid Id thirdparty
* @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
*/ */
function list_replacable_invoices($socid = 0) public function list_replacable_invoices($socid = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -3567,7 +3567,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of invoices qualified to be corrected by a credit note. * Return list of invoices qualified to be corrected by a credit note.
* Invoices matching the following rules are returned: * Invoices matching the following rules are returned:
@ -3576,7 +3576,7 @@ class Facture extends CommonInvoice
* @param int $socid Id thirdparty * @param int $socid Id thirdparty
* @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) * @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
*/ */
function list_qualified_avoir_invoices($socid = 0) public function list_qualified_avoir_invoices($socid = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -3642,7 +3642,7 @@ class Facture extends CommonInvoice
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a withdrawal request for a standing order. * Create a withdrawal request for a standing order.
* Use the remain to pay excluding all existing open direct debit requests. * Use the remain to pay excluding all existing open direct debit requests.
@ -3651,7 +3651,7 @@ class Facture extends CommonInvoice
* @param float $amount Amount we request direct debit for * @param float $amount Amount we request direct debit for
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function demande_prelevement($fuser, $amount = 0) public function demande_prelevement($fuser, $amount = 0)
{ {
// phpcs:enable // phpcs:enable
@ -3754,7 +3754,7 @@ class Facture extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Supprime une demande de prelevement * Supprime une demande de prelevement
* *
@ -3762,7 +3762,7 @@ class Facture extends CommonInvoice
* @param int $did id de la demande a supprimer * @param int $did id de la demande a supprimer
* @return int <0 if OK, >0 if KO * @return int <0 if OK, >0 if KO
*/ */
function demande_prelevement_delete($fuser, $did) public function demande_prelevement_delete($fuser, $did)
{ {
// phpcs:enable // phpcs:enable
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
@ -3781,14 +3781,14 @@ class Facture extends CommonInvoice
} }
// 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;
@ -3853,7 +3853,7 @@ class Facture extends CommonInvoice
* *
* @return array Liste des id contacts facturation * @return array Liste des id contacts facturation
*/ */
function getIdBillingContact() public function getIdBillingContact()
{ {
return $this->getIdContact('external', 'BILLING'); return $this->getIdContact('external', 'BILLING');
} }
@ -3863,7 +3863,7 @@ class Facture extends CommonInvoice
* *
* @return array Liste des id contacts livraison * @return array Liste des id contacts livraison
*/ */
function getIdShippingContact() public function getIdShippingContact()
{ {
return $this->getIdContact('external', 'SHIPPING'); return $this->getIdContact('external', 'SHIPPING');
} }
@ -3877,7 +3877,7 @@ class Facture extends CommonInvoice
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
* @return void * @return void
*/ */
function initAsSpecimen($option = '') public function initAsSpecimen($option = '')
{ {
global $langs; global $langs;
@ -4028,13 +4028,13 @@ class Facture extends CommonInvoice
} }
} }
// 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)
* *
* @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, $user; global $conf, $user;
@ -4077,7 +4077,7 @@ class Facture extends CommonInvoice
* *
* @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();
} }
@ -4123,7 +4123,7 @@ class Facture extends CommonInvoice
* *
* @return int >= 1 if OK, -1 if error * @return int >= 1 if OK, -1 if error
*/ */
function newCycle() public function newCycle()
{ {
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f'; $sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql.= " WHERE f.entity in (".getEntity('invoice', 0).")"; $sql.= " WHERE f.entity in (".getEntity('invoice', 0).")";
@ -4146,25 +4146,25 @@ class Facture extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Checks if the invoice is the first of a cycle * Checks if the invoice is the first of a cycle
* *
* @return boolean * @return boolean
*/ */
function is_first() public function is_first()
{ {
// phpcs:enable // phpcs:enable
return ($this->situation_counter == 1); return ($this->situation_counter == 1);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns an array containing the previous situations as Facture objects * Returns an array containing the previous situations as Facture objects
* *
* @return mixed -1 if error, array of previous situations * @return mixed -1 if error, array of previous situations
*/ */
function get_prev_sits() public function get_prev_sits()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -4198,7 +4198,7 @@ class Facture extends CommonInvoice
* @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 setFinal(User $user, $notrigger = 0) public function setFinal(User $user, $notrigger = 0)
{ {
$error=0; $error=0;
@ -4239,14 +4239,14 @@ class Facture extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Checks if the invoice is the last in its cycle * Checks if the invoice is the last in its cycle
* *
* @return bool Last of the cycle status * @return bool Last of the cycle status
* *
*/ */
function is_last_in_cycle() public function is_last_in_cycle()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -4403,7 +4403,7 @@ class FactureLigne extends CommonInvoiceLine
* @param int $rowid id of invoice line to get * @param int $rowid id of invoice line to get
* @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 fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,'; $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,';
$sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,'; $sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
@ -4495,7 +4495,7 @@ class FactureLigne extends CommonInvoiceLine
* @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) public function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0)
{ {
global $langs,$user,$conf; global $langs,$user,$conf;
@ -4712,7 +4712,7 @@ class FactureLigne extends CommonInvoiceLine
* @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 update($user = '', $notrigger = 0) public function update($user = '', $notrigger = 0)
{ {
global $user,$conf; global $user,$conf;
@ -4846,7 +4846,7 @@ class FactureLigne extends CommonInvoiceLine
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete() public function delete()
{ {
global $user; global $user;
@ -4877,14 +4877,14 @@ class FactureLigne extends CommonInvoiceLine
} }
} }
// 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();
@ -4919,7 +4919,7 @@ class FactureLigne extends CommonInvoiceLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns situation_percent of the previous line. * Returns situation_percent of the previous line.
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
@ -4928,7 +4928,7 @@ class FactureLigne extends CommonInvoiceLine
* @param bool $include_credit_note Include credit note or not * @param bool $include_credit_note Include credit note or not
* @return int >= 0 * @return int >= 0
*/ */
function get_prev_progress($invoiceid, $include_credit_note = true) public function get_prev_progress($invoiceid, $include_credit_note = true)
{ {
// phpcs:enable // phpcs:enable
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {

View File

@ -32,17 +32,17 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
*/ */
class FactureStats extends Stats class FactureStats extends Stats
{ {
var $socid; public $socid;
var $userid; public $userid;
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element; public $table_element;
var $from; public $from;
var $field; public $field;
var $where; public $where;
/** /**
@ -53,7 +53,7 @@ class FactureStats 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;
@ -100,7 +100,7 @@ class FactureStats 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 values * @return array Array of values
*/ */
function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
global $user; global $user;
@ -123,7 +123,7 @@ class FactureStats 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;
@ -145,7 +145,7 @@ class FactureStats 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;
@ -168,7 +168,7 @@ class FactureStats 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 getAverageByMonth($year) public function getAverageByMonth($year)
{ {
global $user; global $user;
@ -188,7 +188,7 @@ class FactureStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getAllByYear() public function getAllByYear()
{ {
global $user; global $user;
@ -208,7 +208,7 @@ class FactureStats 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

@ -69,7 +69,7 @@ class PaymentTerm // 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;
} }
@ -82,7 +82,7 @@ class PaymentTerm // 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;
@ -173,7 +173,7 @@ class PaymentTerm // extends CommonObject
* @param int $id Id object * @param int $id Id object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id) public function fetch($id)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -229,7 +229,7 @@ class PaymentTerm // extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function getDefaultId() public function getDefaultId()
{ {
global $langs; global $langs;
@ -268,7 +268,7 @@ class PaymentTerm // 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;
@ -345,7 +345,7 @@ class PaymentTerm // 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;
@ -396,7 +396,7 @@ class PaymentTerm // extends CommonObject
* @param int $fromid Id of object to clone * @param int $fromid Id of object to clone
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($fromid) public function createFromClone($fromid)
{ {
global $user,$langs; global $user,$langs;
@ -425,10 +425,6 @@ class PaymentTerm // extends CommonObject
$error++; $error++;
} }
//if (! $error)
//{
//}
unset($object->context['createfromclone']); unset($object->context['createfromclone']);
// End // End
@ -452,7 +448,7 @@ class PaymentTerm // extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id=0;

View File

@ -759,7 +759,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Company type // Company type

View File

@ -75,7 +75,7 @@ class Localtax 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;
} }
@ -87,7 +87,7 @@ class Localtax extends CommonObject
* @param User $user User that create * @param User $user 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;
@ -163,7 +163,7 @@ class Localtax extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger) * @param int $notrigger 0=no, 1=yes (no update trigger)
* @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, $langs; global $conf, $langs;
@ -228,7 +228,7 @@ class Localtax extends CommonObject
* @param int $id Object id * @param int $id Object id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id) public function fetch($id)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -292,7 +292,7 @@ class Localtax extends CommonObject
* @param User $user User that delete * @param User $user User that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user) public function delete($user)
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('LOCALTAX_DELETE', $user); $result=$this->call_trigger('LOCALTAX_DELETE', $user);
@ -322,7 +322,7 @@ class Localtax extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
@ -345,7 +345,7 @@ class Localtax extends CommonObject
* @param int $year Year * @param int $year Year
* @return int ??? * @return int ???
*/ */
function solde($year = 0) public function solde($year = 0)
{ {
$reglee = $this->localtax_sum_reglee($year); $reglee = $this->localtax_sum_reglee($year);
@ -358,14 +358,14 @@ class Localtax extends CommonObject
return $solde; return $solde;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Total de la localtax des factures emises par la societe. * Total de la localtax des factures emises par la societe.
* *
* @param int $year Year * @param int $year Year
* @return int ??? * @return int ???
*/ */
function localtax_sum_collectee($year = 0) public function localtax_sum_collectee($year = 0)
{ {
// phpcs:enable // phpcs:enable
$sql = "SELECT sum(f.localtax) as amount"; $sql = "SELECT sum(f.localtax) as amount";
@ -398,14 +398,14 @@ class Localtax extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* localtax payed * localtax payed
* *
* @param int $year Year * @param int $year Year
* @return int ??? * @return int ???
*/ */
function localtax_sum_payee($year = 0) public function localtax_sum_payee($year = 0)
{ {
// phpcs:enable // phpcs:enable
@ -440,7 +440,7 @@ class Localtax extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* localtax payed * localtax payed
* Total de la localtax payed * Total de la localtax payed
@ -448,7 +448,7 @@ class Localtax extends CommonObject
* @param int $year Year * @param int $year Year
* @return int ??? * @return int ???
*/ */
function localtax_sum_reglee($year = 0) public function localtax_sum_reglee($year = 0)
{ {
// phpcs:enable // phpcs:enable
@ -489,7 +489,7 @@ class Localtax extends CommonObject
* @param User $user Object user that insert * @param User $user Object user that insert
* @return int <0 if KO, rowid in localtax table if OK * @return int <0 if KO, rowid in localtax table if OK
*/ */
function addPayment($user) public function addPayment($user)
{ {
global $conf,$langs; global $conf,$langs;
@ -596,21 +596,20 @@ class Localtax extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update the link betwen localtax payment and the line into llx_bank * Update the link betwen localtax payment and the line into llx_bank
* *
* @param int $id Id bank account * @param int $id Id bank account
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_fk_bank($id) public function update_fk_bank($id)
{ {
// phpcs:enable // phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.$id; $sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.$id;
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
return 1; return 1;
} }
else else
@ -628,7 +627,7 @@ class Localtax extends CommonObject
* @param string $option Sur quoi pointe le lien * @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $option = '') public function getNomUrl($withpicto = 0, $option = '')
{ {
global $langs; global $langs;
@ -652,12 +651,12 @@ class Localtax 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 getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -665,7 +664,7 @@ class Localtax 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 du statut * @return string Libelle du statut
*/ */
function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage

View File

@ -70,7 +70,7 @@ class RemiseCheque 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->next_id = 0; $this->next_id = 0;
@ -84,7 +84,7 @@ class RemiseCheque extends CommonObject
* @param string $ref Ref record * @param string $ref Ref record
* @return int <0 if KO, > 0 if OK * @return int <0 if KO, > 0 if OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
global $conf; global $conf;
@ -142,7 +142,7 @@ class RemiseCheque extends CommonObject
* @param array $toRemise array with cheques to remise * @param array $toRemise array with cheques to remise
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $account_id, $limit, $toRemise) public function create($user, $account_id, $limit, $toRemise)
{ {
global $conf; global $conf;
@ -299,7 +299,7 @@ class RemiseCheque extends CommonObject
* @param User $user Utilisateur qui effectue l'operation * @param User $user Utilisateur qui effectue l'operation
* @return int * @return int
*/ */
function delete($user = '') public function delete($user = '')
{ {
global $conf; global $conf;
@ -353,7 +353,7 @@ class RemiseCheque extends CommonObject
* @param User $user User * @param User $user User
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function validate($user) public function validate($user)
{ {
global $langs,$conf; global $langs,$conf;
@ -416,7 +416,7 @@ class RemiseCheque extends CommonObject
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string free ref or last ref * @return string free ref or last ref
*/ */
function getNextNumRef($mode = 'next') public function getNextNumRef($mode = 'next')
{ {
global $conf, $db, $langs, $mysoc; global $conf, $db, $langs, $mysoc;
$langs->load("bills"); $langs->load("bills");
@ -495,14 +495,14 @@ class RemiseCheque 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;
@ -550,13 +550,13 @@ class RemiseCheque 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 $user; global $user;
@ -598,7 +598,7 @@ class RemiseCheque extends CommonObject
* @param Translate $outputlangs Object langs * @param Translate $outputlangs Object langs
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function generatePdf($model, $outputlangs) public function generatePdf($model, $outputlangs)
{ {
global $langs,$conf; global $langs,$conf;
@ -682,7 +682,7 @@ class RemiseCheque extends CommonObject
* *
* @return int 0 en cas de succes * @return int 0 en cas de succes
*/ */
function updateAmount() public function updateAmount()
{ {
global $conf; global $conf;
@ -743,7 +743,7 @@ class RemiseCheque extends CommonObject
* @param int $account_id Compte bancaire concerne * @param int $account_id Compte bancaire concerne
* @return int * @return int
*/ */
function removeCheck($account_id) public function removeCheck($account_id)
{ {
$this->errno = 0; $this->errno = 0;
@ -776,7 +776,7 @@ class RemiseCheque extends CommonObject
* @param date $rejection_date Date to use on the negative payment * @param date $rejection_date Date to use on the negative payment
* @return int Id of negative payment line created * @return int Id of negative payment line created
*/ */
function rejectCheck($bank_id, $rejection_date) public function rejectCheck($bank_id, $rejection_date)
{ {
global $db, $user; global $db, $user;
@ -866,13 +866,13 @@ class RemiseCheque extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Charge les proprietes ref_previous et ref_next * Charge les proprietes ref_previous et ref_next
* *
* @return int <0 if KO, 0 if OK * @return int <0 if KO, 0 if OK
*/ */
function load_previous_next_id() public function load_previous_next_id()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -909,7 +909,7 @@ class RemiseCheque extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set the creation date * Set the creation date
* *
@ -917,7 +917,7 @@ class RemiseCheque extends CommonObject
* @param int $date Date creation * @param int $date Date creation
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_date($user, $date) public function set_date($user, $date)
{ {
// phpcs:enable // phpcs:enable
if ($user->rights->banque->cheque) if ($user->rights->banque->cheque)
@ -945,7 +945,7 @@ class RemiseCheque extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set the ref of bordereau * Set the ref of bordereau
* *
@ -953,7 +953,7 @@ class RemiseCheque extends CommonObject
* @param int $ref ref of bordereau * @param int $ref ref of bordereau
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_number($user, $ref) public function set_number($user, $ref)
{ {
// phpcs:enable // phpcs:enable
if ($user->rights->banque->cheque) if ($user->rights->banque->cheque)
@ -988,7 +988,7 @@ class RemiseCheque extends CommonObject
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
* @return void * @return void
*/ */
function initAsSpecimen($option = '') public function initAsSpecimen($option = '')
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@ -1013,7 +1013,7 @@ class RemiseCheque 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($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $conf, $langs; global $conf, $langs;
@ -1064,12 +1064,12 @@ class RemiseCheque 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 getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut($this->statut, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of a status * Return label of a status
* *
@ -1077,7 +1077,7 @@ class RemiseCheque extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Libelle du statut * @return string Libelle du statut
*/ */
function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
@ -1085,37 +1085,37 @@ class RemiseCheque extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($status == 0) return $langs->trans('ToValidate'); if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated'); elseif ($status == 1) return $langs->trans('Validated');
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($status == 0) return $langs->trans('ToValidate'); if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated'); elseif ($status == 1) return $langs->trans('Validated');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0').' '.$langs->trans('ToValidate'); if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated'); elseif ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0'); if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0');
if ($status == 1) return img_picto($langs->trans('Validated'), 'statut4'); elseif ($status == 1) return img_picto($langs->trans('Validated'), 'statut4');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0').' '.$langs->trans('ToValidate'); if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated'); elseif ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'), 'statut0'); if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'), 'statut0');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4'); elseif ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'), 'statut0'); if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'), 'statut0');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4'); elseif ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4');
} }
return $langs->trans('Unknown'); return $langs->trans('Unknown');
} }

View File

@ -225,7 +225,7 @@ class Paiement extends CommonObject
* @param Societe $thirdparty Thirdparty * @param Societe $thirdparty Thirdparty
* @return int id of created payment, < 0 if error * @return int id of created payment, < 0 if error
*/ */
function create($user, $closepaidinvoices = 0, $thirdparty = null) public function create($user, $closepaidinvoices = 0, $thirdparty = null)
{ {
global $conf, $langs; global $conf, $langs;
@ -497,7 +497,7 @@ class Paiement extends CommonObject
* @param int $notrigger No trigger * @param int $notrigger No trigger
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function delete($notrigger = 0) public function delete($notrigger = 0)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
@ -607,7 +607,7 @@ class Paiement extends CommonObject
* @param int $notrigger No trigger * @param int $notrigger No trigger
* @return int <0 if KO, bank_line_id if OK * @return int <0 if KO, bank_line_id if OK
*/ */
function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0) public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
@ -730,8 +730,7 @@ class Paiement extends CommonObject
} }
// Add link 'WithdrawalPayment' in bank_url // Add link 'WithdrawalPayment' in bank_url
if (! $error && $label == '(WithdrawalPayment)') if (! $error && $label == '(WithdrawalPayment)') {
{
$result=$acc->add_url_line( $result=$acc->add_url_line(
$bank_line_id, $bank_line_id,
$this->id_prelevement, $this->id_prelevement,
@ -776,14 +775,14 @@ class Paiement extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Mise a jour du lien entre le paiement et la ligne generee dans llx_bank * Mise a jour du lien entre le paiement et la ligne generee dans llx_bank
* *
* @param int $id_bank Id compte bancaire * @param int $id_bank Id compte bancaire
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_fk_bank($id_bank) public function update_fk_bank($id_bank)
{ {
// phpcs:enable // phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank;
@ -803,14 +802,14 @@ class Paiement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Updates the payment date * Updates the payment date
* *
* @param int $date New date * @param int $date New date
* @return int <0 if KO, 0 if OK * @return int <0 if KO, 0 if OK
*/ */
function update_date($date) public function update_date($date)
{ {
// phpcs:enable // phpcs:enable
$error=0; $error=0;
@ -868,18 +867,17 @@ class Paiement extends CommonObject
return -1; //no date given or already validated return -1; //no date given or already validated
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Updates the payment number * Updates the payment number
* *
* @param string $num New num * @param string $num New num
* @return int <0 if KO, 0 if OK * @return int <0 if KO, 0 if OK
*/ */
function update_num($num) public function update_num($num)
{ {
// phpcs:enable // phpcs:enable
if(!empty($num) && $this->statut!=1) if(!empty($num) && $this->statut!=1) {
{
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET num_paiement = '".$this->db->escape($num)."'"; $sql.= " SET num_paiement = '".$this->db->escape($num)."'";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
@ -906,7 +904,7 @@ class Paiement extends CommonObject
* @param User $user User making validation * @param User $user User making validation
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function valide(User $user = null) public function valide(User $user = null)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id;
@ -930,7 +928,7 @@ class Paiement extends CommonObject
* @param User $user User making reject * @param User $user User making reject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function reject(User $user = null) public function reject(User $user = null)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id;
@ -954,7 +952,7 @@ class Paiement extends CommonObject
* @param int $id id du paiement dont il faut afficher les infos * @param int $id id du paiement dont il faut afficher les infos
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT p.rowid, p.datec, p.fk_user_creat, p.fk_user_modif, p.tms'; $sql = 'SELECT p.rowid, p.datec, p.fk_user_creat, p.fk_user_modif, p.tms';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p';
@ -998,7 +996,7 @@ class Paiement extends CommonObject
* @param string $filter Critere de filtre * @param string $filter Critere de filtre
* @return array Tableau des id de factures * @return array Tableau des id de factures
*/ */
function getBillsArray($filter = '') public function getBillsArray($filter = '')
{ {
$sql = 'SELECT fk_facture'; $sql = 'SELECT fk_facture';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'facture as f';
@ -1036,7 +1034,7 @@ class Paiement extends CommonObject
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string free ref or last ref * @return string free ref or last ref
*/ */
function getNextNumRef($soc, $mode = 'next') public function getNextNumRef($soc, $mode = 'next')
{ {
global $conf, $db, $langs; global $conf, $db, $langs;
$langs->load("bills"); $langs->load("bills");
@ -1119,7 +1117,7 @@ class Paiement extends CommonObject
* *
* @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs * @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs
*/ */
function getWay() public function getWay()
{ {
global $conf; global $conf;
@ -1147,7 +1145,7 @@ class Paiement extends CommonObject
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
* @return void * @return void
*/ */
function initAsSpecimen($option = '') public function initAsSpecimen($option = '')
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@ -1173,7 +1171,7 @@ class Paiement extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0) public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -1231,12 +1229,12 @@ class Paiement 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 getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -1244,7 +1242,7 @@ class Paiement 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 du statut * @return string Libelle du statut
*/ */
function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
@ -1288,14 +1286,14 @@ class Paiement extends CommonObject
return ''; return '';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load the third party of object, from id into this->thirdparty * Load the third party of object, from id into this->thirdparty
* *
* @param int $force_thirdparty_id Force thirdparty id * @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_thirdparty($force_thirdparty_id = 0) public function fetch_thirdparty($force_thirdparty_id = 0)
{ {
// phpcs:enable // phpcs:enable
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';

View File

@ -81,7 +81,7 @@ class BonPrelevement extends CommonObject
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $filename Filename of withdraw receipt * @param string $filename Filename of withdraw receipt
*/ */
function __construct($db, $filename = '') public function __construct($db, $filename = '')
{ {
global $conf,$langs; global $conf,$langs;
@ -112,7 +112,7 @@ class BonPrelevement extends CommonObject
$this->fetched = 0; $this->fetched = 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add invoice to withdrawal * Add invoice to withdrawal
* *
@ -126,7 +126,7 @@ class BonPrelevement extends CommonObject
* @param string $number_key number key of account number * @param string $number_key number key of account number
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
{ {
// phpcs:enable // phpcs:enable
$result = 0; $result = 0;
@ -184,7 +184,7 @@ class BonPrelevement extends CommonObject
* @param string $number_key number key of account number * @param string $number_key number key of account number
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
{ {
$result = -1; $result = -1;
$concat = 0; $concat = 0;
@ -258,7 +258,7 @@ class BonPrelevement extends CommonObject
* @param int $error Id of error * @param int $error Id of error
* @return string Error string * @return string Error string
*/ */
function getErrorString($error) public function getErrorString($error)
{ {
global $langs; global $langs;
@ -276,7 +276,7 @@ class BonPrelevement extends CommonObject
* @param string $ref Ref of direct debit * @param string $ref Ref of direct debit
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function fetch($rowid, $ref = '') public function fetch($rowid, $ref = '')
{ {
global $conf; global $conf;
@ -331,13 +331,13 @@ class BonPrelevement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set credite and set status of linked invoices. Still used ?? * Set credite and set status of linked invoices. Still used ??
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function set_credite() public function set_credite()
{ {
// phpcs:enable // phpcs:enable
global $user,$conf; global $user,$conf;
@ -410,7 +410,7 @@ class BonPrelevement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set direct debit order to "credited" status. * Set direct debit order to "credited" status.
* *
@ -418,7 +418,7 @@ class BonPrelevement extends CommonObject
* @param int $date date of action * @param int $date date of action
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function set_infocredit($user, $date) public function set_infocredit($user, $date)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -557,7 +557,7 @@ class BonPrelevement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set withdrawal to transmited status * Set withdrawal to transmited status
* *
@ -566,7 +566,7 @@ class BonPrelevement extends CommonObject
* @param string $method method of transmision to bank * @param string $method method of transmision to bank
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function set_infotrans($user, $date, $method) public function set_infotrans($user, $date, $method)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -683,13 +683,13 @@ class BonPrelevement extends CommonObject
return $arr; return $arr;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns amount of withdrawal * Returns amount of withdrawal
* *
* @return double Total amount * @return double Total amount
*/ */
function SommeAPrelever() public function SommeAPrelever()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -722,7 +722,7 @@ class BonPrelevement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Get number of invoices to withdrawal * Get number of invoices to withdrawal
* TODO delete params banque and agence when not necesary * TODO delete params banque and agence when not necesary
@ -731,7 +731,7 @@ class BonPrelevement extends CommonObject
* @param int $agence dolibarr mysoc agence * @param int $agence dolibarr mysoc agence
* @return int <O if KO, number of invoices if OK * @return int <O if KO, number of invoices if OK
*/ */
function NbFactureAPrelever($banque = 0, $agence = 0) public function NbFactureAPrelever($banque = 0, $agence = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -765,7 +765,7 @@ class BonPrelevement extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a withdraw * Create a withdraw
* TODO delete params banque and agence when not necesary * TODO delete params banque and agence when not necesary
@ -777,7 +777,7 @@ class BonPrelevement extends CommonObject
* @param string $executiondate Date to execute the transfer * @param string $executiondate Date to execute the transfer
* @return int <0 if KO, nbre of invoice withdrawed if OK * @return int <0 if KO, nbre of invoice withdrawed if OK
*/ */
function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '') public function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '')
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -1138,7 +1138,7 @@ class BonPrelevement extends CommonObject
* @param User $user Object user that delete * @param User $user Object user that delete
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function delete($user = null) public function delete($user = null)
{ {
$this->db->begin(); $this->db->begin();
@ -1178,7 +1178,7 @@ class BonPrelevement extends CommonObject
* @param string $option link target * @param string $option link target
* @return string URL of target * @return string URL of target
*/ */
function getNomUrl($withpicto = 0, $option = '') public function getNomUrl($withpicto = 0, $option = '')
{ {
global $langs; global $langs;
@ -1200,14 +1200,14 @@ class BonPrelevement extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete a notification def by id * Delete a notification def by id
* *
* @param int $rowid id of notification * @param int $rowid id of notification
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function DeleteNotificationById($rowid) public function DeleteNotificationById($rowid)
{ {
// phpcs:enable // phpcs:enable
$result = 0; $result = 0;
@ -1225,7 +1225,7 @@ class BonPrelevement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete a notification * Delete a notification
* *
@ -1233,7 +1233,7 @@ class BonPrelevement extends CommonObject
* @param string $action notification action * @param string $action notification action
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function DeleteNotification($user, $action) public function DeleteNotification($user, $action)
{ {
// phpcs:enable // phpcs:enable
$result = 0; $result = 0;
@ -1251,7 +1251,7 @@ class BonPrelevement extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add a notification * Add a notification
* *
@ -1260,7 +1260,7 @@ class BonPrelevement extends CommonObject
* @param string $action notification action * @param string $action notification action
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function AddNotification($db, $user, $action) public function AddNotification($db, $user, $action)
{ {
// phpcs:enable // phpcs:enable
$result = 0; $result = 0;
@ -1299,7 +1299,7 @@ class BonPrelevement extends CommonObject
* @param string $executiondate Date to execute transfer * @param string $executiondate Date to execute transfer
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function generate($format = 'ALL', $executiondate = '') public function generate($format = 'ALL', $executiondate = '')
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
@ -1478,7 +1478,7 @@ class BonPrelevement extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write recipient of request (customer) * Write recipient of request (customer)
* *
@ -1493,7 +1493,7 @@ class BonPrelevement extends CommonObject
* @param string $rib_dom rib domiciliation * @param string $rib_dom rib domiciliation
* @return void * @return void
*/ */
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '') public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '')
{ {
// phpcs:enable // phpcs:enable
fputs($this->file, "06"); fputs($this->file, "06");
@ -1559,14 +1559,14 @@ class BonPrelevement extends CommonObject
* @param string $row_drum Id of customer bank account (rib.rowid) * @param string $row_drum Id of customer bank account (rib.rowid)
* @return string RUM number * @return string RUM number
*/ */
static function buildRumNumber($row_code_client, $row_datec, $row_drum) public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
{ {
global $langs; global $langs;
$pre = $langs->trans('RUM').'-'; $pre = $langs->trans('RUM').'-';
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write recipient of request (customer) * Write recipient of request (customer)
* *
@ -1588,7 +1588,7 @@ class BonPrelevement extends CommonObject
* @param string $row_drum rib.rowid used to generate rum * @param string $row_drum rib.rowid used to generate rum
* @return string Return string with SEPA part DrctDbtTxInf * @return string Return string with SEPA part DrctDbtTxInf
*/ */
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1646,13 +1646,13 @@ class BonPrelevement extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write sender of request (me) * Write sender of request (me)
* *
* @return void * @return void
*/ */
function EnregEmetteur() public function EnregEmetteur()
{ {
// phpcs:enable // phpcs:enable
fputs($this->file, "03"); fputs($this->file, "03");
@ -1713,7 +1713,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, "\n"); fputs($this->file, "\n");
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write sender of request (me). * Write sender of request (me).
* Note: The tag PmtInf is opened here but closed into caller * Note: The tag PmtInf is opened here but closed into caller
@ -1726,7 +1726,7 @@ class BonPrelevement extends CommonObject
* @param string $format FRST or RCUR or ALL * @param string $format FRST or RCUR or ALL
* @return string String with SEPA Sender * @return string String with SEPA Sender
*/ */
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST') public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST')
{ {
// phpcs:enable // phpcs:enable
// SEPA INITIALISATION // SEPA INITIALISATION
@ -1836,14 +1836,14 @@ class BonPrelevement extends CommonObject
return $XML_SEPA_INFO; return $XML_SEPA_INFO;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write end * Write end
* *
* @param int $total total amount * @param int $total total amount
* @return void * @return void
*/ */
function EnregTotal($total) public function EnregTotal($total)
{ {
// phpcs:enable // phpcs:enable
fputs($this->file, "08"); fputs($this->file, "08");
@ -1905,12 +1905,12 @@ class BonPrelevement extends CommonObject
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut($this->statut, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return status label for a status * Return status label for a status
* *
@ -1918,7 +1918,7 @@ class BonPrelevement extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
if (empty($this->labelstatut)) if (empty($this->labelstatut))
@ -1937,32 +1937,32 @@ class BonPrelevement extends CommonObject
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
if ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
if ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1'); if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1');
if ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3'); elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3');
if ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6'); elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
if ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
if ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
if ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
if ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
} }
} }
} }

View File

@ -41,7 +41,7 @@ class LignePrelevement
*/ */
public $db; public $db;
var $statuts = array(); public $statuts = array();
/** /**
@ -50,7 +50,7 @@ class LignePrelevement
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
* @param User $user Objet user * @param User $user Objet user
*/ */
function __construct($db, $user) public function __construct($db, $user)
{ {
global $conf,$langs; global $conf,$langs;
@ -71,7 +71,7 @@ class LignePrelevement
* @param int $rowid id de la facture a recuperer * @param int $rowid id de la facture a recuperer
* @return integer * @return integer
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
global $conf; global $conf;
@ -117,18 +117,18 @@ class LignePrelevement
return $result; return $result;
} }
/** /**
* Return status label of object * Return status label of object
* *
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); return $this->LibStatut($this->statut, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return status label for a status * Return status label for a status
* *
@ -136,7 +136,7 @@ class LignePrelevement
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -148,20 +148,20 @@ class LignePrelevement
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8');
} }
} }

View File

@ -47,7 +47,7 @@ class RejetPrelevement
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
* @param User $user Objet user * @param User $user Objet user
*/ */
function __construct($db, $user) public function __construct($db, $user)
{ {
global $langs; global $langs;
@ -82,7 +82,7 @@ class RejetPrelevement
* @param int $facturation Facturation * @param int $facturation Facturation
* @return void * @return void
*/ */
function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0)
{ {
global $langs,$conf; global $langs,$conf;
@ -198,14 +198,14 @@ class RejetPrelevement
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Send email to all users that has asked the withdraw request * Send email to all users that has asked the withdraw request
* *
* @param Facture $fac Invoice object * @param Facture $fac Invoice object
* @return void * @return void
*/ */
function _send_email($fac) private function _send_email($fac)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -334,7 +334,7 @@ class RejetPrelevement
* @param int $rowid id of invoice to retrieve * @param int $rowid id of invoice to retrieve
* @return int * @return int
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql = "SELECT pr.date_rejet as dr, motif, afacturer"; $sql = "SELECT pr.date_rejet as dr, motif, afacturer";

View File

@ -94,7 +94,7 @@ class PaymentSalary 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->element = 'payment_salary'; $this->element = 'payment_salary';
@ -108,7 +108,7 @@ class PaymentSalary extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger) * @param int $notrigger 0=no, 1=yes (no update trigger)
* @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;
@ -189,7 +189,7 @@ class PaymentSalary extends CommonObject
* @param User $user User that load * @param User $user User that load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $user = null) public function fetch($id, $user = null)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -265,7 +265,7 @@ class PaymentSalary extends CommonObject
* @param User $user User that delete * @param User $user User that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user) public function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
@ -299,7 +299,7 @@ class PaymentSalary extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
@ -323,7 +323,7 @@ class PaymentSalary extends CommonObject
* @param User $user User that create * @param User $user 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;
@ -509,14 +509,14 @@ class PaymentSalary extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update link between payment salary and line generate into llx_bank * Update link between payment salary and line generate into llx_bank
* *
* @param int $id_bank Id bank account * @param int $id_bank Id bank account
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_fk_bank($id_bank) public function update_fk_bank($id_bank)
{ {
// phpcs:enable // phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
@ -544,7 +544,7 @@ class PaymentSalary 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 with URL * @return string Chaine with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -614,7 +614,7 @@ class PaymentSalary extends CommonObject
* @param int $id Id of record * @param int $id Id of record
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author'; $sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author';
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps'; $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps';
@ -652,12 +652,12 @@ class PaymentSalary 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 getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -665,7 +665,7 @@ class PaymentSalary 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 du statut * @return string Libelle du statut
*/ */
function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage

View File

@ -34,12 +34,12 @@ class SalariesStats 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;
/** /**
* Constructor * Constructor
@ -49,7 +49,7 @@ class SalariesStats extends Stats
* @param mixed $userid Id user for filter or array of user ids * @param mixed $userid Id user for filter or array of user ids
* @return void * @return void
*/ */
function __construct($db, $socid = 0, $userid = 0) public function __construct($db, $socid = 0, $userid = 0)
{ {
global $conf; global $conf;
@ -62,8 +62,7 @@ class SalariesStats extends Stats
$this->field='amount'; $this->field='amount';
$this->where.= " entity = ".$conf->entity; $this->where.= " entity = ".$conf->entity;
if ($this->socid) if ($this->socid) {
{
$this->where.=" AND fk_soc = ".$this->socid; $this->where.=" AND fk_soc = ".$this->socid;
} }
if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',', $this->userid).')'; if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',', $this->userid).')';
@ -76,7 +75,7 @@ class SalariesStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getNbByYear() public function getNbByYear()
{ {
$sql = "SELECT YEAR(datep) as dm, count(*)"; $sql = "SELECT YEAR(datep) as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -94,7 +93,7 @@ class SalariesStats 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 values * @return array Array of values
*/ */
function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
$sql = "SELECT MONTH(datep) as dm, count(*)"; $sql = "SELECT MONTH(datep) as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -116,7 +115,7 @@ class SalariesStats 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 values * @return array Array of values
*/ */
function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
$sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -136,7 +135,7 @@ class SalariesStats 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 getAverageByMonth($year) public function getAverageByMonth($year)
{ {
$sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")"; $sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
@ -153,7 +152,7 @@ class SalariesStats extends Stats
* *
* @return array Array of values * @return array Array of values
*/ */
function getAllByYear() public function getAllByYear()
{ {
$sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;

View File

@ -404,7 +404,7 @@ class Cchargesociales
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '') public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
{ {
global $langs, $conf, $db; global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -438,12 +438,12 @@ class Cchargesociales
* @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 status donne * Renvoi le libelle d'un status donne
* *
@ -451,7 +451,7 @@ class Cchargesociales
* @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($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;

View File

@ -81,7 +81,7 @@ class ChargeSociales 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;
} }
@ -93,7 +93,7 @@ class ChargeSociales extends CommonObject
* @param string $ref Ref * @param string $ref Ref
* @return int <0 KO >0 OK * @return int <0 KO >0 OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
$sql = "SELECT cs.rowid, cs.date_ech"; $sql = "SELECT cs.rowid, cs.date_ech";
$sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
@ -152,7 +152,7 @@ class ChargeSociales extends CommonObject
* *
* @return boolean True or false * @return boolean True or false
*/ */
function check() public function check()
{ {
$newamount=price2num($this->amount, 'MT'); $newamount=price2num($this->amount, 'MT');
@ -172,7 +172,7 @@ class ChargeSociales extends CommonObject
* @param User $user User making creation * @param User $user User making creation
* @return int <0 if KO, id if OK * @return int <0 if KO, id if OK
*/ */
function create($user) public function create($user)
{ {
global $conf; global $conf;
$error=0; $error=0;
@ -182,8 +182,7 @@ class ChargeSociales extends CommonObject
// Nettoyage parametres // Nettoyage parametres
$newamount=price2num($this->amount, 'MT'); $newamount=price2num($this->amount, 'MT');
if (!$this->check()) if (!$this->check()) {
{
$this->error="ErrorBadParameter"; $this->error="ErrorBadParameter";
return -2; return -2;
} }
@ -206,8 +205,7 @@ class ChargeSociales extends CommonObject
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql) {
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
//dol_syslog("ChargesSociales::create this->id=".$this->id); //dol_syslog("ChargesSociales::create this->id=".$this->id);
@ -238,7 +236,7 @@ class ChargeSociales extends CommonObject
* @param User $user Object user making delete * @param User $user Object user making delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user) public function delete($user)
{ {
$error=0; $error=0;
@ -309,7 +307,7 @@ class ChargeSociales 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, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
@ -365,7 +363,7 @@ class ChargeSociales extends CommonObject
* @param int $year Year * @param int $year Year
* @return number * @return number
*/ */
function solde($year = 0) public function solde($year = 0)
{ {
global $conf; global $conf;
@ -399,14 +397,14 @@ class ChargeSociales extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag social contribution as payed completely * Tag social contribution as payed completely
* *
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_paid($user) public function set_paid($user)
{ {
// phpcs:enable // phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
@ -417,14 +415,14 @@ class ChargeSociales extends CommonObject
else return -1; else return -1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Remove tag payed on social contribution * Remove tag payed on social contribution
* *
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_unpaid($user) public function set_unpaid($user)
{ {
// phpcs:enable // phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
@ -442,12 +440,12 @@ class ChargeSociales extends CommonObject
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0, $alreadypaid = -1) public function getLibStatut($mode = 0, $alreadypaid = -1)
{ {
return $this->LibStatut($this->paye, $mode, $alreadypaid); return $this->LibStatut($this->paye, $mode, $alreadypaid);
} }
// 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
* *
@ -456,7 +454,7 @@ class ChargeSociales extends CommonObject
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $mode = 0, $alreadypaid = -1) public function LibStatut($statut, $mode = 0, $alreadypaid = -1)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -467,37 +465,37 @@ class ChargeSociales extends CommonObject
if ($mode == 0 || $mode == 1) if ($mode == 0 || $mode == 1)
{ {
if ($statut == 0) return $langs->trans("Unpaid"); if ($statut == 0) return $langs->trans("Unpaid");
if ($statut == 1) return $langs->trans("Paid"); elseif ($statut == 1) return $langs->trans("Paid");
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
} }
else return "Error, mode/status not found"; else return "Error, mode/status not found";
@ -514,7 +512,7 @@ class ChargeSociales 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 link * @return string String with link
*/ */
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
{ {
global $langs, $conf, $user, $form; global $langs, $conf, $user, $form;
@ -574,7 +572,7 @@ class ChargeSociales extends CommonObject
* *
* @return int Amount of payment already done, <0 if KO * @return int Amount of payment already done, <0 if KO
*/ */
function getSommePaiement() public function getSommePaiement()
{ {
$table='paiementcharge'; $table='paiementcharge';
$field='fk_charge'; $field='fk_charge';
@ -585,8 +583,7 @@ class ChargeSociales extends CommonObject
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql) {
{
$amount=0; $amount=0;
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -607,7 +604,7 @@ class ChargeSociales extends CommonObject
* @param int $id Id of social contribution * @param int $id Id of social contribution
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function info($id) public function info($id)
{ {
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
$sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; $sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
@ -663,7 +660,7 @@ class ChargeSociales extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
// Initialize parameters // Initialize parameters
$this->id=0; $this->id=0;

View File

@ -91,7 +91,7 @@ class PaymentSocialContribution 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;
} }
@ -104,7 +104,7 @@ class PaymentSocialContribution extends CommonObject
* @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more * @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more
* @return int <0 if KO, id of payment if OK * @return int <0 if KO, id of payment if OK
*/ */
function create($user, $closepaidcontrib = 0) public function create($user, $closepaidcontrib = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -221,7 +221,7 @@ class PaymentSocialContribution extends CommonObject
* @param int $id Id object * @param int $id Id object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id) public function fetch($id)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -292,7 +292,7 @@ class PaymentSocialContribution 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 PaymentSocialContribution 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;
@ -409,10 +409,10 @@ class PaymentSocialContribution extends CommonObject
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
} }
if (! $error) //if (! $error)
{ //{
if (! $notrigger) // if (! $notrigger)
{ // {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger. // want this action call a trigger.
@ -422,8 +422,8 @@ class PaymentSocialContribution extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } //if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers //// End call triggers
} // }
} //}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
@ -451,7 +451,7 @@ class PaymentSocialContribution extends CommonObject
* @param int $fromid Id of object to clone * @param int $fromid Id of object to clone
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($fromid) public function createFromClone($fromid)
{ {
global $user,$langs; global $user,$langs;
@ -510,7 +510,7 @@ class PaymentSocialContribution extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
@ -540,7 +540,7 @@ class PaymentSocialContribution extends CommonObject
* @param string $emetteur_banque Name of bank * @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{ {
global $conf; global $conf;
@ -624,14 +624,14 @@ class PaymentSocialContribution extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee * Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee
* *
* @param int $id_bank Id if bank * @param int $id_bank Id if bank
* @return int >0 if OK, <=0 if KO * @return int >0 if OK, <=0 if KO
*/ */
function update_fk_bank($id_bank) public function update_fk_bank($id_bank)
{ {
// phpcs:enable // phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
@ -656,12 +656,12 @@ class PaymentSocialContribution 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 getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -669,7 +669,7 @@ class PaymentSocialContribution 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 du statut * @return string Libelle du statut
*/ */
function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
@ -720,7 +720,7 @@ class PaymentSocialContribution extends CommonObject
* @param int $maxlen Longueur max libelle * @param int $maxlen Longueur max libelle
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $maxlen = 0) public function getNomUrl($withpicto = 0, $maxlen = 0)
{ {
global $langs; global $langs;
@ -729,8 +729,7 @@ class PaymentSocialContribution extends CommonObject
if (empty($this->ref)) $this->ref=$this->lib; if (empty($this->ref)) $this->ref=$this->lib;
$label = $langs->trans("ShowPayment").': '.$this->ref; $label = $langs->trans("ShowPayment").': '.$this->ref;
if (!empty($this->id)) if (!empty($this->id)) {
{
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';

View File

@ -81,7 +81,7 @@ class Tva 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;
} }
@ -93,7 +93,7 @@ class Tva extends CommonObject
* @param User $user User that create * @param User $user 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;
@ -173,7 +173,7 @@ class Tva extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger) * @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -241,7 +241,7 @@ class Tva extends CommonObject
* @param User $user User that load * @param User $user User that load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $user = null) public function fetch($id, $user = null)
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@ -309,7 +309,7 @@ class Tva extends CommonObject
* @param User $user User that delete * @param User $user User that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user) public function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
@ -343,7 +343,7 @@ class Tva extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
@ -365,7 +365,7 @@ class Tva extends CommonObject
* @param int $year Year * @param int $year Year
* @return double Amount * @return double Amount
*/ */
function solde($year = 0) public function solde($year = 0)
{ {
$reglee = $this->tva_sum_reglee($year); $reglee = $this->tva_sum_reglee($year);
@ -378,14 +378,14 @@ class Tva extends CommonObject
return $solde; return $solde;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Total of the VAT from invoices emitted by the thirdparty. * Total of the VAT from invoices emitted by the thirdparty.
* *
* @param int $year Year * @param int $year Year
* @return double Amount * @return double Amount
*/ */
function tva_sum_collectee($year = 0) public function tva_sum_collectee($year = 0)
{ {
// phpcs:enable // phpcs:enable
@ -419,14 +419,14 @@ class Tva extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* VAT payed * VAT payed
* *
* @param int $year Year * @param int $year Year
* @return double Amount * @return double Amount
*/ */
function tva_sum_payee($year = 0) public function tva_sum_payee($year = 0)
{ {
// phpcs:enable // phpcs:enable
@ -461,14 +461,14 @@ class Tva extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Total of the VAT payed * Total of the VAT payed
* *
* @param int $year Year * @param int $year Year
* @return double Amount * @return double Amount
*/ */
function tva_sum_reglee($year = 0) public function tva_sum_reglee($year = 0)
{ {
// phpcs:enable // phpcs:enable
@ -510,7 +510,7 @@ class Tva extends CommonObject
* @param User $user Object user that insert * @param User $user Object user that insert
* @return int <0 if KO, rowid in tva table if OK * @return int <0 if KO, rowid in tva table if OK
*/ */
function addPayment($user) public function addPayment($user)
{ {
global $conf,$langs; global $conf,$langs;
@ -654,14 +654,14 @@ class Tva extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update link between payment tva and line generate into llx_bank * Update link between payment tva and line generate into llx_bank
* *
* @param int $id_bank Id bank account * @param int $id_bank Id bank account
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_fk_bank($id_bank) public function update_fk_bank($id_bank)
{ {
// phpcs:enable // phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.(int) $id_bank; $sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.(int) $id_bank;
@ -687,7 +687,7 @@ class Tva extends CommonObject
* @param string $morecss More CSS * @param string $morecss More CSS
* @return string Chaine with URL * @return string Chaine with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '') public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '')
{ {
global $langs, $conf; global $langs, $conf;
@ -733,7 +733,7 @@ class Tva extends CommonObject
* *
* @return int Amount of payment already done, <0 if KO * @return int Amount of payment already done, <0 if KO
*/ */
function getSommePaiement() public function getSommePaiement()
{ {
$table='paiementcharge'; $table='paiementcharge';
$field='fk_charge'; $field='fk_charge';
@ -766,7 +766,7 @@ class Tva extends CommonObject
* @param int $id Id of vat payment * @param int $id Id of vat payment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function info($id) public function info($id)
{ {
$sql = "SELECT t.rowid, t.tms, t.fk_user_modif, t.datec, t.fk_user_creat"; $sql = "SELECT t.rowid, t.tms, t.fk_user_modif, t.datec, t.fk_user_creat";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
@ -813,12 +813,12 @@ class Tva 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 getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
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
* *
@ -826,7 +826,7 @@ class Tva 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 du statut * @return string Libelle du statut
*/ */
function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage

View File

@ -32,15 +32,15 @@ abstract class ActionsContactCardCommon
*/ */
public $db; public $db;
var $dirmodule; public $dirmodule;
var $targetmodule; public $targetmodule;
var $canvas; public $canvas;
var $card; public $card;
//! Template container //! Template container
var $tpl = array(); public $tpl = array();
//! Object container //! Object container
var $object; public $object;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
@ -60,7 +60,7 @@ abstract class ActionsContactCardCommon
* @param int $id Object id * @param int $id Object id
* @return object Object loaded * @return object Object loaded
*/ */
function getObject($id) public function getObject($id)
{ {
/*$ret = $this->getInstanceDao(); /*$ret = $this->getInstanceDao();
@ -76,7 +76,7 @@ abstract class ActionsContactCardCommon
//} //}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
@ -84,7 +84,7 @@ abstract class ActionsContactCardCommon
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;

View File

@ -38,7 +38,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function __construct($db, $dirmodule, $targetmodule, $canvas, $card) public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $db; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
@ -66,7 +66,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
@ -74,7 +74,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* @param int $id Id * @param int $id Id
* @return void * @return void
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $limit, $offset, $sortfield, $sortorder; global $limit, $offset, $sortfield, $sortorder;
@ -121,7 +121,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Fetch datas list and save into ->list_datas * Fetch datas list and save into ->list_datas
* *
@ -131,7 +131,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* @param string $sortorder Sort order ('ASC' or 'DESC') * @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void * @return void
*/ */
function LoadListDatas($limit, $offset, $sortfield, $sortorder) public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;

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;
@ -497,7 +497,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
* *
@ -507,7 +507,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;
@ -519,13 +519,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;
@ -594,7 +594,7 @@ class Contact extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update field alert birthday * Update field alert birthday
* *
@ -603,7 +603,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;
@ -692,7 +692,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;
@ -876,7 +876,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'))) {
@ -886,7 +886,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
@ -896,7 +896,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
@ -938,7 +938,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;
@ -1052,7 +1052,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";
@ -1097,7 +1097,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";
@ -1132,7 +1132,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;
@ -1210,7 +1210,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");
@ -1226,12 +1226,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
* *
@ -1239,7 +1239,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;
@ -1277,14 +1277,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;
@ -1300,14 +1300,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;
} }
@ -1344,7 +1343,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

@ -584,7 +584,7 @@ if (! empty($arrayfields['p.town']['checked']))
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.phone']['checked'])) if (! empty($arrayfields['p.phone']['checked']))

View File

@ -48,7 +48,7 @@ class Contracts extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -65,7 +65,7 @@ class Contracts extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->contrat->lire) { if(! DolibarrApiAccess::$user->rights->contrat->lire) {
throw new RestException(401); throw new RestException(401);
@ -101,7 +101,7 @@ class Contracts 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;
@ -184,7 +184,7 @@ class Contracts extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of contrat * @return int ID of contrat
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401, "Insuffisant rights"); throw new RestException(401, "Insuffisant rights");
@ -218,7 +218,7 @@ class Contracts extends DolibarrApi
* *
* @return array * @return array
*/ */
function getLines($id) public function getLines($id)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->lire) { if (! DolibarrApiAccess::$user->rights->contrat->lire) {
throw new RestException(401); throw new RestException(401);
@ -250,7 +250,7 @@ class Contracts extends DolibarrApi
* *
* @return int|bool * @return int|bool
*/ */
function postLine($id, $request_data = null) public function postLine($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -303,7 +303,7 @@ class Contracts extends DolibarrApi
* *
* @return array|bool * @return array|bool
*/ */
function putLine($id, $lineid, $request_data = null) public function putLine($id, $lineid, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -363,7 +363,7 @@ class Contracts extends DolibarrApi
* *
* @return array|bool * @return array|bool
*/ */
function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) public function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null)
{ {
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -401,7 +401,7 @@ class Contracts extends DolibarrApi
* *
* @return array|bool * @return array|bool
*/ */
function unactivateLine($id, $lineid, $datestart, $comment = null) public function unactivateLine($id, $lineid, $datestart, $comment = null)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->creer) { if (! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -442,7 +442,7 @@ class Contracts extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) public function deleteLine($id, $lineid)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->creer) { if (! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -477,7 +477,7 @@ class Contracts extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->creer) { if (! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -513,7 +513,7 @@ class Contracts extends DolibarrApi
* *
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->supprimer) { if (! DolibarrApiAccess::$user->rights->contrat->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -555,7 +555,7 @@ class Contracts extends DolibarrApi
* "notrigger": 0 * "notrigger": 0
* } * }
*/ */
function validate($id, $notrigger = 0) public function validate($id, $notrigger = 0)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->creer) { if (! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -601,7 +601,7 @@ class Contracts extends DolibarrApi
* "notrigger": 0 * "notrigger": 0
* } * }
*/ */
function close($id, $notrigger = 0) public function close($id, $notrigger = 0)
{ {
if (! DolibarrApiAccess::$user->rights->contrat->creer) { if (! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
@ -639,7 +639,7 @@ class Contracts 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);
@ -666,7 +666,7 @@ class Contracts extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$contrat = array(); $contrat = array();
foreach (Contracts::$FIELDS as $field) { foreach (Contracts::$FIELDS as $field) {

View File

@ -188,7 +188,7 @@ class Contrat 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;
} }
@ -199,7 +199,7 @@ class Contrat extends CommonObject
* @param Societe $soc Thirdparty object * @param Societe $soc Thirdparty object
* @return string free reference for contract * @return string free reference for contract
*/ */
function getNextNumRef($soc) public function getNextNumRef($soc)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;
$langs->load("contracts"); $langs->load("contracts");
@ -250,7 +250,7 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Activate a contract line * Activate a contract line
* *
@ -261,7 +261,7 @@ class Contrat extends CommonObject
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function active_line($user, $line_id, $date, $date_end = '', $comment = '') public function active_line($user, $line_id, $date, $date_end = '', $comment = '')
{ {
// phpcs:enable // phpcs:enable
$result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
@ -274,7 +274,7 @@ class Contrat extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close a contract line * Close a contract line
* *
@ -284,7 +284,7 @@ class Contrat extends CommonObject
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function close_line($user, $line_id, $date_end, $comment = '') public function close_line($user, $line_id, $date_end, $comment = '')
{ {
// phpcs:enable // phpcs:enable
$result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
@ -307,7 +307,7 @@ class Contrat extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see closeAll * @see closeAll
*/ */
function activateAll($user, $date_start = '', $notrigger = 0, $comment = '') public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '')
{ {
if (empty($date_start)) $date_start = dol_now(); if (empty($date_start)) $date_start = dol_now();
@ -363,7 +363,7 @@ class Contrat extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see activateAll * @see activateAll
*/ */
function closeAll(User $user, $notrigger = 0, $comment = '') public function closeAll(User $user, $notrigger = 0, $comment = '')
{ {
$this->db->begin(); $this->db->begin();
@ -419,7 +419,7 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function validate(User $user, $force_number = '', $notrigger = 0) public function validate(User $user, $force_number = '', $notrigger = 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $langs, $conf; global $langs, $conf;
@ -547,7 +547,7 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers * @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function reopen($user, $notrigger = 0) public function reopen($user, $notrigger = 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $langs, $conf; global $langs, $conf;
@ -614,7 +614,7 @@ class Contrat extends CommonObject
* @param string $ref_supplier Supplier ref * @param string $ref_supplier Supplier ref
* @return int <0 if KO, 0 if not found, Id of contract if OK * @return int <0 if KO, 0 if not found, Id of contract if OK
*/ */
function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '') public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '')
{ {
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,"; $sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
$sql.= " ref_supplier, ref_customer,"; $sql.= " ref_supplier, ref_customer,";
@ -711,14 +711,14 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load lines array into this->lines. * Load lines array into this->lines.
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed * This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
* *
* @return ContratLigne[] Return array of contract lines * @return ContratLigne[] Return array of contract lines
*/ */
function fetch_lines() public function fetch_lines()
{ {
// phpcs:enable // phpcs:enable
$this->nbofserviceswait=0; $this->nbofserviceswait=0;
@ -869,7 +869,7 @@ class Contrat extends CommonObject
* @param User $user User that create * @param User $user User that create
* @return int <0 if KO, id of contract if OK * @return int <0 if KO, id of contract if OK
*/ */
function create($user) public function create($user)
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
@ -1088,7 +1088,7 @@ class Contrat extends CommonObject
* @param User $user Utilisateur qui supprime * @param User $user Utilisateur qui supprime
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
function delete($user) public function delete($user)
{ {
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';
@ -1242,7 +1242,7 @@ class Contrat 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, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -1360,7 +1360,7 @@ class Contrat extends CommonObject
* @param string $rang Position * @param string $rang Position
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null, $rang = 0) public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null, $rang = 0)
{ {
global $user, $langs, $conf, $mysoc; global $user, $langs, $conf, $mysoc;
$error=0; $error=0;
@ -1570,7 +1570,7 @@ class Contrat extends CommonObject
* @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $fk_unit Code of the unit to use. Null to use the default one
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx = 0.0, $localtax2tx = 0.0, $date_debut_reel = '', $date_fin_reel = '', $price_base_type = 'HT', $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null) public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx = 0.0, $localtax2tx = 0.0, $date_debut_reel = '', $date_fin_reel = '', $price_base_type = 'HT', $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null)
{ {
global $user, $conf, $langs, $mysoc; global $user, $conf, $langs, $mysoc;
@ -1647,21 +1647,21 @@ class Contrat extends CommonObject
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'";
$sql.= ",price_ht='" . price2num($price)."'"; $sql.= ",price_ht='".price2num($price)."'";
$sql.= ",subprice='" . price2num($subprice)."'"; $sql.= ",subprice='".price2num($subprice)."'";
$sql.= ",remise='" . price2num($remise)."'"; $sql.= ",remise='".price2num($remise)."'";
$sql.= ",remise_percent='".price2num($remise_percent)."'"; $sql.= ",remise_percent='".price2num($remise_percent)."'";
$sql.= ",qty='".$qty."'"; $sql.= ",qty='".$qty."'";
$sql.= ",tva_tx='". price2num($tvatx)."'"; $sql.= ",tva_tx='".price2num($tvatx)."'";
$sql.= ",localtax1_tx='". price2num($localtax1tx)."'"; $sql.= ",localtax1_tx='".price2num($localtax1tx)."'";
$sql.= ",localtax2_tx='". price2num($localtax2tx)."'"; $sql.= ",localtax2_tx='".price2num($localtax2tx)."'";
$sql.= ",localtax1_type='".$localtax1_type."'"; $sql.= ",localtax1_type='".$localtax1_type."'";
$sql.= ",localtax2_type='".$localtax2_type."'"; $sql.= ",localtax2_type='".$localtax2_type."'";
$sql.= ", total_ht='". price2num($total_ht)."'"; $sql.= ", total_ht='".price2num($total_ht)."'";
$sql.= ", total_tva='". price2num($total_tva)."'"; $sql.= ", total_tva='".price2num($total_tva)."'";
$sql.= ", total_localtax1='".price2num($total_localtax1)."'"; $sql.= ", total_localtax1='".price2num($total_localtax1)."'";
$sql.= ", total_localtax2='".price2num($total_localtax2)."'"; $sql.= ", total_localtax2='".price2num($total_localtax2)."'";
$sql.= ", total_ttc='". price2num($total_ttc)."'"; $sql.= ", total_ttc='".price2num($total_ttc)."'";
$sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null"); $sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null");
$sql.= ", buy_price_ht='".price2num($pa_ht)."'"; $sql.= ", buy_price_ht='".price2num($pa_ht)."'";
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; } if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
@ -1733,7 +1733,7 @@ class Contrat extends CommonObject
* @param User $user User that delete * @param User $user User that delete
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function deleteline($idline, User $user) public function deleteline($idline, User $user)
{ {
global $conf, $langs; global $conf, $langs;
@ -1792,7 +1792,7 @@ class Contrat extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update statut of contract according to services * Update statut of contract according to services
* *
@ -1800,7 +1800,7 @@ class Contrat extends CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @deprecated This function will never be used. Status of a contract is status of its lines. * @deprecated This function will never be used. Status of a contract is status of its lines.
*/ */
function update_statut($user) public function update_statut($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
@ -1811,11 +1811,11 @@ class Contrat extends CommonObject
// Load $this->lines array // Load $this->lines array
// $this->fetch_lines(); // $this->fetch_lines();
// $newstatut=1; // $newstatut=1;
// foreach($this->lines as $key => $contractline) // foreach($this->lines as $key => $contractline)
// { // {
// // if ($contractline) // Loop on each service // // if ($contractline) // Loop on each service
// } // }
return 1; return 1;
} }
@ -1827,12 +1827,12 @@ class Contrat extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
* @return string Label * @return string Label
*/ */
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 label of a given contrat status * Renvoi label of a given contrat status
* *
@ -1840,7 +1840,7 @@ class Contrat extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $mode) public function LibStatut($statut, $mode)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1872,8 +1872,7 @@ class Contrat extends CommonObject
elseif ($mode == 4 || $mode == 6 || $mode == 7) elseif ($mode == 4 || $mode == 6 || $mode == 7)
{ {
$text=''; $text='';
if ($mode == 4) if ($mode == 4) {
{
$text ='<span class="hideonsmartphone">'; $text ='<span class="hideonsmartphone">';
$text.=($this->nbofserviceswait+$this->nbofservicesopened+$this->nbofservicesexpired+$this->nbofservicesclosed); $text.=($this->nbofserviceswait+$this->nbofservicesopened+$this->nbofservicesexpired+$this->nbofservicesclosed);
$text.=' '.$langs->trans("Services"); $text.=' '.$langs->trans("Services");
@ -1909,7 +1908,7 @@ class Contrat 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($withpicto = 0, $maxlength = 0, $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $maxlength = 0, $notooltip = 0, $save_lastsearch_value = -1)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@ -1973,7 +1972,7 @@ class Contrat extends CommonObject
* @param int $id id du contrat a charger * @param int $id id du contrat a charger
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,"; $sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,";
$sql.= " c.tms as date_modification,"; $sql.= " c.tms as date_modification,";
@ -2015,14 +2014,14 @@ class Contrat extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of line rowid * Return list of line rowid
* *
* @param int $statut Status of lines to get * @param int $statut Status of lines to get
* @return array Array of line's rowid * @return array Array of line's rowid
*/ */
function array_detail($statut = -1) public function array_detail($statut = -1)
{ {
// phpcs:enable // phpcs:enable
$tab=array(); $tab=array();
@ -2059,7 +2058,7 @@ class Contrat extends CommonObject
* @param string $option 'all' or 'others' * @param string $option 'all' or 'others'
* @return array Array of contracts id * @return array Array of contracts id
*/ */
function getListOfContracts($option = 'all') public function getListOfContracts($option = 'all')
{ {
$tab=array(); $tab=array();
@ -2092,7 +2091,7 @@ class Contrat 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)
* *
@ -2100,7 +2099,7 @@ class Contrat extends CommonObject
* @param string $mode "inactive" pour services a activer, "expired" pour services expires * @param string $mode "inactive" pour services a activer, "expired" pour services expires
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user, $mode) public function load_board($user, $mode)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -2172,13 +2171,13 @@ class Contrat 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 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 $conf, $user; global $conf, $user;
@ -2223,7 +2222,7 @@ class Contrat extends CommonObject
* *
* @return array Liste des id contacts facturation * @return array Liste des id contacts facturation
*/ */
function getIdBillingContact() public function getIdBillingContact()
{ {
return $this->getIdContact('external', 'BILLING'); return $this->getIdContact('external', 'BILLING');
} }
@ -2233,7 +2232,7 @@ class Contrat extends CommonObject
* *
* @return array Liste des id contacts prestation * @return array Liste des id contacts prestation
*/ */
function getIdServiceContact() public function getIdServiceContact()
{ {
return $this->getIdContact('external', 'SERVICE'); return $this->getIdContact('external', 'SERVICE');
} }
@ -2246,7 +2245,7 @@ class Contrat extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@ -2319,7 +2318,7 @@ class Contrat extends CommonObject
* *
* @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();
} }
@ -2382,7 +2381,7 @@ class Contrat 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 New id of clone * @return int New id of clone
*/ */
function createFromClone($socid = 0, $notrigger = 0) public function createFromClone($socid = 0, $notrigger = 0)
{ {
global $db, $user, $langs, $conf, $hookmanager, $extrafields; global $db, $user, $langs, $conf, $hookmanager, $extrafields;
@ -2631,7 +2630,7 @@ class ContratLigne extends CommonObjectLine
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -2643,12 +2642,12 @@ class ContratLigne extends CommonObjectLine
* @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 getLibStatut($mode) public function getLibStatut($mode)
{ {
return $this->LibStatut($this->statut, $mode, ((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1)); return $this->LibStatut($this->statut, $mode, ((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1));
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of a contract line status * Return label of a contract line status
* *
@ -2658,7 +2657,7 @@ class ContratLigne extends CommonObjectLine
* @param string $moreatt More attribute * @param string $moreatt More attribute
* @return string Libelle * @return string Libelle
*/ */
static function LibStatut($statut, $mode, $expired = -1, $moreatt = '') public static function LibStatut($statut, $mode, $expired = -1, $moreatt = '')
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -2720,7 +2719,7 @@ class ContratLigne extends CommonObjectLine
* @param int $maxlength Max length * @param int $maxlength Max length
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $maxlength = 0) public function getNomUrl($withpicto = 0, $maxlength = 0)
{ {
global $langs; global $langs;
@ -2747,7 +2746,7 @@ class ContratLigne extends CommonObjectLine
* @param string $ref Ref of contract * @param string $ref Ref of contract
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
// Check parameters // Check parameters
@ -2879,7 +2878,7 @@ class ContratLigne extends CommonObjectLine
* @param int $notrigger 0=no, 1=yes (no update trigger) * @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $langs, $mysoc; global $conf, $langs, $mysoc;
@ -3070,14 +3069,14 @@ class ContratLigne extends CommonObjectLine
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Mise a jour en base des champs total_xxx de ligne * Mise a jour en base des champs total_xxx de ligne
* Used by migration process * Used by migration process
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_total() public function update_total()
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
@ -3188,7 +3187,7 @@ class ContratLigne extends CommonObjectLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Activate a contract line * Activate a contract line
* *
@ -3198,7 +3197,7 @@ class ContratLigne extends CommonObjectLine
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function active_line($user, $date, $date_end = '', $comment = '') public function active_line($user, $date, $date_end = '', $comment = '')
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;
@ -3247,7 +3246,7 @@ class ContratLigne extends CommonObjectLine
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close a contract line * Close a contract line
* *
@ -3257,7 +3256,7 @@ class ContratLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function close_line($user, $date_end, $comment = '', $notrigger = 0) public function close_line($user, $date_end, $comment = '', $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;

View File

@ -499,7 +499,7 @@ if (! empty($arrayfields['state.nom']['checked']))
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Company type // Company type

View File

@ -32,20 +32,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_actions extends ModeleBoxes class box_actions extends ModeleBoxes
{ {
var $boxcode="lastactions"; public $boxcode="lastactions";
var $boximg="object_action"; public $boximg="object_action";
var $boxlabel="BoxLastActions"; public $boxlabel="BoxLastActions";
var $depends = array("agenda"); public $depends = array("agenda");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -54,7 +54,7 @@ class box_actions extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param = '') public function __construct($db, $param = '')
{ {
global $user; global $user;
@ -69,7 +69,7 @@ class box_actions extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
@ -188,7 +188,7 @@ class box_actions extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
global $langs, $conf; global $langs, $conf;
$out = parent::showBox($this->info_box_head, $this->info_box_contents); $out = parent::showBox($this->info_box_head, $this->info_box_contents);

View File

@ -30,21 +30,21 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_activity extends ModeleBoxes class box_activity extends ModeleBoxes
{ {
var $boxcode="activity"; public $boxcode="activity";
var $boximg="object_bill"; public $boximg="object_bill";
var $boxlabel='BoxGlobalActivity'; public $boxlabel='BoxGlobalActivity';
var $depends = array("facture"); public $depends = array("facture");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $enabled = 1; public $enabled = 1;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -53,7 +53,7 @@ class box_activity extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $conf, $user; global $conf, $user;
@ -74,7 +74,7 @@ class box_activity extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
@ -458,7 +458,7 @@ class box_activity extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -28,20 +28,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_bookmarks extends ModeleBoxes class box_bookmarks extends ModeleBoxes
{ {
var $boxcode="bookmarks"; public $boxcode="bookmarks";
var $boximg="object_bookmark"; public $boximg="object_bookmark";
var $boxlabel="BoxMyLastBookmarks"; public $boxlabel="BoxMyLastBookmarks";
var $depends = array("bookmark"); public $depends = array("bookmark");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -50,7 +50,7 @@ class box_bookmarks extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -65,7 +65,7 @@ class box_bookmarks extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$langs->load("boxes"); $langs->load("boxes");
@ -157,7 +157,7 @@ class box_bookmarks extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -32,20 +32,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_clients extends ModeleBoxes class box_clients extends ModeleBoxes
{ {
var $boxcode="lastcustomers"; public $boxcode="lastcustomers";
var $boximg="object_company"; public $boximg="object_company";
var $boxlabel="BoxLastCustomers"; public $boxlabel="BoxLastCustomers";
var $depends = array("societe"); public $depends = array("societe");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $enabled = 1; public $enabled = 1;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -54,7 +54,7 @@ class box_clients extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param = '') public function __construct($db, $param = '')
{ {
global $conf, $user; global $conf, $user;
@ -72,7 +72,7 @@ class box_clients extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$langs->load("boxes"); $langs->load("boxes");
@ -175,7 +175,7 @@ class box_clients extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -32,20 +32,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_commandes extends ModeleBoxes class box_commandes extends ModeleBoxes
{ {
var $boxcode="lastcustomerorders"; public $boxcode="lastcustomerorders";
var $boximg="object_order"; public $boximg="object_order";
var $boxlabel="BoxLastCustomerOrders"; public $boxlabel="BoxLastCustomerOrders";
var $depends = array("commande"); public $depends = array("commande");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -54,7 +54,7 @@ class box_commandes extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -69,7 +69,7 @@ class box_commandes extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
@ -198,7 +198,7 @@ class box_commandes extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -33,21 +33,21 @@ include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
*/ */
class box_comptes extends ModeleBoxes class box_comptes extends ModeleBoxes
{ {
var $boxcode="currentaccounts"; public $boxcode="currentaccounts";
var $boximg="object_bill"; public $boximg="object_bill";
var $boxlabel="BoxCurrentAccounts"; public $boxlabel="BoxCurrentAccounts";
var $depends = array("banque"); // Box active if module banque active public $depends = array("banque"); // Box active if module banque active
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $enabled = 1; public $enabled = 1;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -56,7 +56,7 @@ class box_comptes extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param = '') public function __construct($db, $param = '')
{ {
global $conf, $user; global $conf, $user;
@ -75,7 +75,7 @@ class box_comptes extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
@ -184,7 +184,7 @@ class box_comptes extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -34,20 +34,20 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
*/ */
class box_contacts extends ModeleBoxes class box_contacts extends ModeleBoxes
{ {
var $boxcode="lastcontacts"; public $boxcode="lastcontacts";
var $boximg="object_contact"; public $boximg="object_contact";
var $boxlabel="BoxLastContacts"; public $boxlabel="BoxLastContacts";
var $depends = array("societe"); public $depends = array("societe");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -56,7 +56,7 @@ class box_contacts extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -71,7 +71,7 @@ class box_contacts extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$langs->load("boxes"); $langs->load("boxes");
@ -185,7 +185,7 @@ class box_contacts extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -31,20 +31,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_contracts extends ModeleBoxes class box_contracts extends ModeleBoxes
{ {
var $boxcode="lastcontracts"; public $boxcode="lastcontracts";
var $boximg="object_contract"; public $boximg="object_contract";
var $boxlabel="BoxLastContracts"; public $boxlabel="BoxLastContracts";
var $depends = array("contrat"); // conf->contrat->enabled public $depends = array("contrat"); // conf->contrat->enabled
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -53,7 +53,7 @@ class box_contracts extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -68,7 +68,7 @@ class box_contracts extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
@ -189,7 +189,7 @@ class box_contracts extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -34,20 +34,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_external_rss extends ModeleBoxes class box_external_rss extends ModeleBoxes
{ {
var $boxcode="lastrssinfos"; public $boxcode="lastrssinfos";
var $boximg="object_rss"; public $boximg="object_rss";
var $boxlabel="BoxLastRssInfos"; public $boxlabel="BoxLastRssInfos";
var $depends = array("externalrss"); public $depends = array("externalrss");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $paramdef; // Params of box definition (not user params) public $paramdef; // Params of box definition (not user params)
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -56,7 +56,7 @@ class box_external_rss extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
$this->db=$db; $this->db=$db;
$this->paramdef=$param; $this->paramdef=$param;
@ -69,7 +69,7 @@ class box_external_rss extends ModeleBoxes
* @param int $cachedelay Delay we accept for cache file * @param int $cachedelay Delay we accept for cache file
* @return void * @return void
*/ */
function loadBox($max = 5, $cachedelay = 3600) public function loadBox($max = 5, $cachedelay = 3600)
{ {
global $user, $langs, $conf; global $user, $langs, $conf;
$langs->load("boxes"); $langs->load("boxes");
@ -195,7 +195,7 @@ class box_external_rss extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -30,20 +30,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_factures extends ModeleBoxes class box_factures extends ModeleBoxes
{ {
var $boxcode="lastcustomerbills"; public $boxcode="lastcustomerbills";
var $boximg="object_bill"; public $boximg="object_bill";
var $boxlabel="BoxLastCustomerBills"; public $boxlabel="BoxLastCustomerBills";
var $depends = array("facture"); public $depends = array("facture");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -52,7 +52,7 @@ class box_factures extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -67,7 +67,7 @@ class box_factures extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
@ -209,7 +209,7 @@ class box_factures extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -31,20 +31,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_factures_fourn extends ModeleBoxes class box_factures_fourn extends ModeleBoxes
{ {
var $boxcode="lastsupplierbills"; public $boxcode="lastsupplierbills";
var $boximg="object_bill"; public $boximg="object_bill";
var $boxlabel="BoxLastSupplierBills"; public $boxlabel="BoxLastSupplierBills";
var $depends = array("facture","fournisseur"); public $depends = array("facture","fournisseur");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -53,7 +53,7 @@ class box_factures_fourn extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -68,7 +68,7 @@ class box_factures_fourn extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
@ -214,7 +214,7 @@ class box_factures_fourn extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -30,20 +30,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_factures_fourn_imp extends ModeleBoxes class box_factures_fourn_imp extends ModeleBoxes
{ {
var $boxcode = "oldestunpaidsupplierbills"; public $boxcode = "oldestunpaidsupplierbills";
var $boximg = "object_bill"; public $boximg = "object_bill";
var $boxlabel = "BoxOldestUnpaidSupplierBills"; public $boxlabel = "BoxOldestUnpaidSupplierBills";
var $depends = array("facture","fournisseur"); public $depends = array("facture","fournisseur");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -52,7 +52,7 @@ class box_factures_fourn_imp extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -67,7 +67,7 @@ class box_factures_fourn_imp extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
@ -201,7 +201,7 @@ class box_factures_fourn_imp extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -33,20 +33,20 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
*/ */
class box_factures_imp extends ModeleBoxes class box_factures_imp extends ModeleBoxes
{ {
var $boxcode="oldestunpaidcustomerbills"; public $boxcode="oldestunpaidcustomerbills";
var $boximg="object_bill"; public $boximg="object_bill";
var $boxlabel="BoxOldestUnpaidCustomerBills"; public $boxlabel="BoxOldestUnpaidCustomerBills";
var $depends = array("facture"); public $depends = array("facture");
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -55,7 +55,7 @@ class box_factures_imp extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -70,7 +70,7 @@ class box_factures_imp extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 5) public function loadBox($max = 5)
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
@ -207,7 +207,7 @@ class box_factures_imp extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

View File

@ -31,20 +31,20 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
*/ */
class box_ficheinter extends ModeleBoxes class box_ficheinter extends ModeleBoxes
{ {
var $boxcode="ficheinter"; public $boxcode="ficheinter";
var $boximg="object_intervention"; public $boximg="object_intervention";
var $boxlabel="BoxFicheInter"; public $boxlabel="BoxFicheInter";
var $depends = array("ficheinter"); // conf->contrat->enabled public $depends = array("ficheinter"); // conf->contrat->enabled
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
var $param; public $param;
var $info_box_head = array(); public $info_box_head = array();
var $info_box_contents = array(); public $info_box_contents = array();
/** /**
@ -53,7 +53,7 @@ class box_ficheinter extends ModeleBoxes
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters * @param string $param More parameters
*/ */
function __construct($db, $param) public function __construct($db, $param)
{ {
global $user; global $user;
@ -68,7 +68,7 @@ class box_ficheinter extends ModeleBoxes
* @param int $max Maximum number of records to load * @param int $max Maximum number of records to load
* @return void * @return void
*/ */
function loadBox($max = 10) public function loadBox($max = 10)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
@ -176,7 +176,7 @@ class box_ficheinter extends ModeleBoxes
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return string * @return string
*/ */
function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
} }

Some files were not shown because too many files have changed in this diff Show More