forked from Wavyzz/dolibarr
wip
This commit is contained in:
@@ -129,7 +129,7 @@ class AccountancyCategory // extends CommonObject
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @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;
|
||||
$error=0;
|
||||
@@ -239,7 +239,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param string $label Label
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $code = '', $label = '')
|
||||
public function fetch($id, $code = '', $label = '')
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
@@ -299,7 +299,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user = null, $notrigger = 0)
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
@@ -379,7 +379,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
@@ -460,7 +460,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select accounting category of an accounting account present in chart of accounts
|
||||
@@ -509,7 +509,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select accounting category of an accounting account present in chart of accounts
|
||||
@@ -552,7 +552,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add an accounting account in an accounting category
|
||||
@@ -617,7 +617,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete an accounting account from an accounting category
|
||||
@@ -643,7 +643,7 @@ class AccountancyCategory // extends CommonObject
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||
@@ -651,12 +651,12 @@ class AccountancyCategory // extends CommonObject
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to know all category from accounting account
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.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
|
||||
@@ -98,18 +98,18 @@ class AccountancyExport
|
||||
global $langs;
|
||||
|
||||
return array (
|
||||
//self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
|
||||
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
|
||||
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
|
||||
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
|
||||
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
|
||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||
);
|
||||
//self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
|
||||
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
|
||||
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
|
||||
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
|
||||
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
|
||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,10 +64,10 @@ class AccountancySystem
|
||||
*
|
||||
* @param DoliDB $db handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ class AccountancySystem
|
||||
* @param string $ref ref
|
||||
* @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;
|
||||
|
||||
@@ -124,7 +124,7 @@ class AccountancySystem
|
||||
* @param User $user making insert
|
||||
* @return int if KO, Id of line if OK
|
||||
*/
|
||||
function create($user)
|
||||
public function create($user)
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
@@ -151,6 +151,6 @@ class AccountancySystem
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,13 +138,13 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handle
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load record in memory
|
||||
@@ -154,7 +154,7 @@ class AccountingAccount extends CommonObject
|
||||
* @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
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
|
||||
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -216,7 +216,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
@@ -317,7 +317,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
@@ -325,7 +325,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param User $user Use making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user)
|
||||
public function update($user)
|
||||
{
|
||||
// Check parameters
|
||||
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
|
||||
*/
|
||||
function checkUsage()
|
||||
public function checkUsage()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@@ -402,7 +402,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param int $notrigger 0=triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
@@ -453,9 +453,9 @@ class AccountingAccount extends CommonObject
|
||||
} else {
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
@@ -466,8 +466,8 @@ class AccountingAccount extends CommonObject
|
||||
* @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
|
||||
*/
|
||||
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;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
@@ -522,7 +522,7 @@ class AccountingAccount extends CommonObject
|
||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
@@ -530,7 +530,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param int $id of record
|
||||
* @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 .= ' 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
|
||||
*
|
||||
* @param int $id Id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function account_desactivate($id)
|
||||
public function account_desactivate($id)
|
||||
{
|
||||
// phpcs:enable
|
||||
$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
|
||||
*
|
||||
* @param int $id Id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function account_activate($id)
|
||||
public function account_activate($id)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->db->begin();
|
||||
@@ -615,15 +615,15 @@ class AccountingAccount extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($result) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode = 0)
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
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
|
||||
*
|
||||
@@ -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
|
||||
* @return string Label of status
|
||||
*/
|
||||
function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@@ -655,32 +655,32 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
$prefix='';
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
if ($statut == 0) return $langs->trans('Disabled');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
if ($statut == 0) return $langs->trans('Disabled');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ class AccountingJournal extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handle
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from database
|
||||
@@ -86,7 +86,7 @@ class AccountingJournal extends CommonObject
|
||||
* @param string $journal_code Journal code
|
||||
* @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;
|
||||
|
||||
@@ -146,7 +146,7 @@ class AccountingJournal extends CommonObject
|
||||
*
|
||||
* @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 .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
@@ -213,7 +213,7 @@ class AccountingJournal extends CommonObject
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @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;
|
||||
|
||||
@@ -270,12 +270,12 @@ class AccountingJournal extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court
|
||||
* @return string Label of type
|
||||
*/
|
||||
function getLibType($mode = 0)
|
||||
public function getLibType($mode = 0)
|
||||
{
|
||||
return $this->LibType($this->nature, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return type of an accounting journal
|
||||
*
|
||||
@@ -283,7 +283,7 @@ class AccountingJournal extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court
|
||||
* @return string Label of type
|
||||
*/
|
||||
function LibType($nature, $mode = 0)
|
||||
public function LibType($nature, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@@ -294,20 +294,20 @@ class AccountingJournal extends CommonObject
|
||||
{
|
||||
$prefix='';
|
||||
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||
if ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||
elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||
elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||
elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||
elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||
elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||
}
|
||||
if ($mode == 1)
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||
if ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||
elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||
elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||
elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||
elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||
elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->statut = -1;
|
||||
@@ -229,7 +229,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function sending an email to the current member with the text supplied in parameter.
|
||||
*
|
||||
@@ -246,7 +246,7 @@ class Adherent extends CommonObject
|
||||
* @param string $moreinheader Add more html headers
|
||||
* @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
|
||||
global $conf,$langs;
|
||||
@@ -291,7 +291,7 @@ class Adherent extends CommonObject
|
||||
* @param string $text Text to make substitution to
|
||||
* @return string Value of input text string with substitutions done
|
||||
*/
|
||||
function makeSubstitution($text)
|
||||
public function makeSubstitution($text)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@@ -358,7 +358,7 @@ class Adherent extends CommonObject
|
||||
* @param string $morphy Nature of the adherent (physical or moral)
|
||||
* @return string Label
|
||||
*/
|
||||
function getmorphylib($morphy = '')
|
||||
public function getmorphylib($morphy = '')
|
||||
{
|
||||
global $langs;
|
||||
if (! $morphy) { $morphy=$this->morphy; }
|
||||
@@ -374,7 +374,7 @@ class Adherent extends CommonObject
|
||||
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@@ -500,7 +500,7 @@ class Adherent extends CommonObject
|
||||
* @param string $action Current action for hookmanager
|
||||
* @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;
|
||||
|
||||
@@ -752,7 +752,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Update denormalized last subscription date.
|
||||
* This function is called when we delete a subscription for example.
|
||||
@@ -760,7 +760,7 @@ class Adherent extends CommonObject
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_end_date($user)
|
||||
public function update_end_date($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->db->begin();
|
||||
@@ -817,7 +817,7 @@ class Adherent extends CommonObject
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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;
|
||||
|
||||
@@ -927,7 +927,7 @@ class Adherent extends CommonObject
|
||||
* @param int $nosyncuser Do not synchronize linked user
|
||||
* @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;
|
||||
|
||||
@@ -1038,7 +1038,7 @@ class Adherent extends CommonObject
|
||||
* @param int $userid Id of user to link to
|
||||
* @return int 1=OK, -1=KO
|
||||
*/
|
||||
function setUserId($userid)
|
||||
public function setUserId($userid)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -1072,7 +1072,7 @@ class Adherent extends CommonObject
|
||||
* @param int $thirdpartyid Id of user to link to
|
||||
* @return int 1=OK, -1=KO
|
||||
*/
|
||||
function setThirdPartyId($thirdpartyid)
|
||||
public function setThirdPartyId($thirdpartyid)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -1108,14 +1108,14 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Method to load member from its login
|
||||
*
|
||||
* @param string $login login of member
|
||||
* @return void
|
||||
*/
|
||||
function fetch_login($login)
|
||||
public function fetch_login($login)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@@ -1139,7 +1139,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Method to load member from its name
|
||||
*
|
||||
@@ -1147,7 +1147,7 @@ class Adherent extends CommonObject
|
||||
* @param string $lastname Lastname
|
||||
* @return void
|
||||
*/
|
||||
function fetch_name($firstname, $lastname)
|
||||
public function fetch_name($firstname, $lastname)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@@ -1183,7 +1183,7 @@ class Adherent extends CommonObject
|
||||
* @param bool $fetch_subscriptions To load member subscriptions
|
||||
* @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;
|
||||
|
||||
@@ -1316,7 +1316,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to get member subscriptions data
|
||||
* first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
|
||||
@@ -1324,7 +1324,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function fetch_subscriptions()
|
||||
public function fetch_subscriptions()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@@ -1400,7 +1400,7 @@ class Adherent extends CommonObject
|
||||
* @param int $datesubend Date end subscription
|
||||
* @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;
|
||||
|
||||
@@ -1486,7 +1486,7 @@ class Adherent extends CommonObject
|
||||
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
|
||||
* @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;
|
||||
|
||||
@@ -1779,7 +1779,7 @@ class Adherent extends CommonObject
|
||||
* @param User $user user adherent qui valide
|
||||
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
||||
*/
|
||||
function validate($user)
|
||||
public function validate($user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
@@ -1832,7 +1832,7 @@ class Adherent extends CommonObject
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function resiliate($user)
|
||||
public function resiliate($user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
@@ -1874,13 +1874,13 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to add member into external tools mailing-list, spip, etc.
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function add_to_abo()
|
||||
public function add_to_abo()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
@@ -1933,13 +1933,13 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to delete a member from external tools like mailing-list, spip, etc.
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function del_to_abo()
|
||||
public function del_to_abo()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
@@ -1997,7 +1997,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @return string Translated name of civility (translated with transnoentitiesnoconv)
|
||||
*/
|
||||
function getCivilityLabel()
|
||||
public function getCivilityLabel()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("dict");
|
||||
@@ -2018,7 +2018,7 @@ class Adherent extends CommonObject
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @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;
|
||||
|
||||
@@ -2109,12 +2109,12 @@ class Adherent extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
function getLibStatut($mode = 0)
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
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
|
||||
*
|
||||
@@ -2124,7 +2124,7 @@ class Adherent extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @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
|
||||
global $langs;
|
||||
@@ -2202,13 +2202,13 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Charge indicateurs this->nb de tableau de bord
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_state_board()
|
||||
public function load_state_board()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@@ -2238,14 +2238,14 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Objet user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
public function load_board($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@@ -2337,7 +2337,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
@@ -2390,7 +2390,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||
*
|
||||
@@ -2400,7 +2400,7 @@ class Adherent extends CommonObject
|
||||
* 2=Return key only (uid=qqq)
|
||||
* @return string DN
|
||||
*/
|
||||
function _load_ldap_dn($info, $mode = 0)
|
||||
private function _load_ldap_dn($info, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@@ -2412,13 +2412,13 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Initialise tableau info (tableau des attributs LDAP)
|
||||
*
|
||||
* @return array Tableau info des attributs
|
||||
*/
|
||||
function _load_ldap_info()
|
||||
private function _load_ldap_info()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
@@ -2525,7 +2525,7 @@ class Adherent extends CommonObject
|
||||
* @param int $id Id of member to load
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT a.rowid, a.datec as datec,';
|
||||
$sql.= ' a.datevalid as datev,';
|
||||
@@ -2581,7 +2581,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @return int Number of EMailings
|
||||
*/
|
||||
function getNbOfEMailings()
|
||||
public function getNbOfEMailings()
|
||||
{
|
||||
$sql = "SELECT count(mc.email) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
|
||||
@@ -89,7 +89,7 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->statut = 1;
|
||||
@@ -103,7 +103,7 @@ class AdherentType extends CommonObject
|
||||
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||
* @return int >0 if OK, < 0 if KO
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -170,7 +170,7 @@ class AdherentType extends CommonObject
|
||||
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||
* @return int >0 if OK, < 0 if KO
|
||||
*/
|
||||
function update($user, $notrigger = 0)
|
||||
public function update($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
@@ -238,7 +238,7 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @return int > 0 if OK, 0 if not found, < 0 if KO
|
||||
*/
|
||||
function delete()
|
||||
public function delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -272,7 +272,7 @@ class AdherentType extends CommonObject
|
||||
* @param int $rowid Id of member type to load
|
||||
* @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 .= " 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 array List of types of members
|
||||
*/
|
||||
function liste_array()
|
||||
public function liste_array()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
@@ -356,7 +356,7 @@ class AdherentType extends CommonObject
|
||||
* 2=Return array of members id only
|
||||
* @return mixed Array of members or -1 on error
|
||||
*/
|
||||
function listMembersForMemberType($excludefilter = '', $mode = 0)
|
||||
public function listMembersForMemberType($excludefilter = '', $mode = 0)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
@@ -404,14 +404,14 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen length max label
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen length max label
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
|
||||
public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@@ -434,12 +434,12 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @return string Return status of a type of member
|
||||
*/
|
||||
function getLibStatut()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
public function getLibStatut()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* 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)
|
||||
* @return string DN
|
||||
*/
|
||||
function _load_ldap_dn($info, $mode = 0)
|
||||
private function _load_ldap_dn($info, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
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
|
||||
*
|
||||
* @return array Tableau info des attributs
|
||||
*/
|
||||
function _load_ldap_info()
|
||||
private function _load_ldap_info()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
@@ -502,7 +502,7 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
@@ -530,7 +530,7 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @return string Return mail content of type or empty
|
||||
*/
|
||||
function getMailOnValid()
|
||||
public function getMailOnValid()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -547,7 +547,7 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @return string Return mail content of type or empty
|
||||
*/
|
||||
function getMailOnSubscription()
|
||||
public function getMailOnSubscription()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -565,16 +565,16 @@ class AdherentType extends CommonObject
|
||||
*
|
||||
* @return string Return mail model content of type or empty
|
||||
*/
|
||||
function getMailOnResiliate()
|
||||
{
|
||||
global $conf;
|
||||
public function getMailOnResiliate()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// NOTE mail_resiliate not defined so never used
|
||||
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_resiliate;
|
||||
}
|
||||
// NOTE mail_resiliate not defined so never used
|
||||
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_resiliate;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public $table_element;
|
||||
|
||||
var $socid;
|
||||
var $userid;
|
||||
public $socid;
|
||||
public $userid;
|
||||
|
||||
var $from;
|
||||
var $field;
|
||||
var $where;
|
||||
public $from;
|
||||
public $field;
|
||||
public $where;
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ class AdherentStats extends Stats
|
||||
* @param int $socid Id third party
|
||||
* @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;
|
||||
|
||||
@@ -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
|
||||
* @return array Array of nb each month
|
||||
*/
|
||||
function getNbByMonth($year, $format = 0)
|
||||
public function getNbByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -105,7 +105,7 @@ class AdherentStats extends Stats
|
||||
*
|
||||
* @return array Array of nb each year
|
||||
*/
|
||||
function getNbByYear()
|
||||
public function getNbByYear()
|
||||
{
|
||||
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
|
||||
* @return array Array of amount each month
|
||||
*/
|
||||
function getAmountByMonth($year, $format = 0)
|
||||
public function getAmountByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -147,7 +147,7 @@ class AdherentStats extends Stats
|
||||
* @param int $year Year
|
||||
* @return array Array of average each month
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
public function getAverageByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -168,7 +168,7 @@ class AdherentStats extends Stats
|
||||
*
|
||||
* @return array Array with nb, total amount, average for each year
|
||||
*/
|
||||
function getAllByYear()
|
||||
public function getAllByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class BlockedLogAuthority
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the blockchain
|
||||
@@ -76,7 +76,7 @@ class BlockedLogAuthority
|
||||
}
|
||||
|
||||
return $this->blockchain;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash of the block chain to check
|
||||
@@ -87,7 +87,7 @@ class BlockedLogAuthority
|
||||
{
|
||||
|
||||
return md5($this->signature.$this->blockchain);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash of the block chain to check
|
||||
@@ -99,7 +99,7 @@ class BlockedLogAuthority
|
||||
{
|
||||
|
||||
return ($hash === $this->getBlockchainHash() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new block to the chain
|
||||
@@ -111,7 +111,7 @@ class BlockedLogAuthority
|
||||
{
|
||||
|
||||
$this->blockchain.=$block;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hash already exist into chain ?
|
||||
@@ -132,7 +132,7 @@ class BlockedLogAuthority
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -191,7 +191,7 @@ class BlockedLogAuthority
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create authority in database.
|
||||
@@ -245,7 +245,7 @@ class BlockedLogAuthority
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create authority in database.
|
||||
@@ -283,7 +283,7 @@ class BlockedLogAuthority
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For cron to sync to authority.
|
||||
@@ -326,6 +326,6 @@ class BlockedLogAuthority
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ class Orders extends DolibarrApi
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
$this->commande = new Commande($this->db);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id, $contact_list = 1)
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
@@ -100,7 +100,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @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;
|
||||
|
||||
@@ -185,11 +185,11 @@ class Orders extends DolibarrApi
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of order
|
||||
*/
|
||||
function post($request_data = null)
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
@@ -220,7 +220,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getLines($id)
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
@@ -252,7 +252,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function postLine($id, $request_data = null)
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -314,7 +314,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function putLine($id, $lineid, $request_data = null)
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -375,7 +375,7 @@ class Orders extends DolibarrApi
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function deleteLine($id, $lineid)
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -413,7 +413,7 @@ class Orders extends DolibarrApi
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function postContact($id, $contactid, $type)
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -455,7 +455,7 @@ class Orders extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function deleteContact($id, $rowid)
|
||||
public function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -488,7 +488,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function put($id, $request_data = null)
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -529,7 +529,7 @@ class Orders extends DolibarrApi
|
||||
* @param int $id Order ID
|
||||
* @return array
|
||||
*/
|
||||
function delete($id)
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->supprimer) {
|
||||
throw new RestException(401);
|
||||
@@ -577,7 +577,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -629,7 +629,7 @@ class Orders extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function reopen($id)
|
||||
public function reopen($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
@@ -667,7 +667,7 @@ class Orders extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function setinvoiced($id)
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
@@ -710,7 +710,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function close($id, $notrigger = 0)
|
||||
public function close($id, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -756,7 +756,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function settodraft($id, $idwarehouse = -1)
|
||||
public function settodraft($id, $idwarehouse = -1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -807,7 +807,7 @@ class Orders extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function createOrderFromProposal($proposalid)
|
||||
public function createOrderFromProposal($proposalid)
|
||||
{
|
||||
|
||||
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
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
function _cleanObjectDatas($object)
|
||||
private function _cleanObjectDatas($object)
|
||||
{
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
@@ -866,7 +866,7 @@ class Orders extends DolibarrApi
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate($data)
|
||||
private function _validate($data)
|
||||
{
|
||||
$commande = array();
|
||||
foreach (Orders::$FIELDS as $field) {
|
||||
|
||||
@@ -243,7 +243,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
@@ -260,7 +260,7 @@ class Commande extends CommonOrder
|
||||
* @param Societe $soc Object thirdparty
|
||||
* @return string Order free reference
|
||||
*/
|
||||
function getNextNumRef($soc)
|
||||
public function getNextNumRef($soc)
|
||||
{
|
||||
global $langs, $conf;
|
||||
$langs->load("order");
|
||||
@@ -318,7 +318,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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;
|
||||
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
|
||||
*
|
||||
@@ -479,8 +479,8 @@ 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)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_draft($user, $idwarehouse = -1)
|
||||
{
|
||||
public function set_draft($user, $idwarehouse = -1)
|
||||
{
|
||||
//phpcs:enable
|
||||
global $conf,$langs;
|
||||
|
||||
@@ -562,7 +562,7 @@ class Commande extends CommonOrder
|
||||
* @param User $user Object user that change status
|
||||
* @return int <0 if KO, 0 if nothing is done, >0 if OK
|
||||
*/
|
||||
function set_reopen($user)
|
||||
public function set_reopen($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
$error=0;
|
||||
@@ -622,7 +622,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function cloture($user, $notrigger = 0)
|
||||
public function cloture($user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -682,7 +682,7 @@ class Commande extends CommonOrder
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function cancel($idwarehouse = -1)
|
||||
public function cancel($idwarehouse = -1)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -763,7 +763,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$error=0;
|
||||
@@ -892,7 +892,7 @@ class Commande extends CommonOrder
|
||||
$vatrate = $line->tva_tx;
|
||||
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';
|
||||
|
||||
$result = $this->addline(
|
||||
$result = $this->addline(
|
||||
$line->desc,
|
||||
$line->subprice,
|
||||
$line->qty,
|
||||
@@ -1067,7 +1067,7 @@ class Commande extends CommonOrder
|
||||
* @param int $socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($socid = 0)
|
||||
public function createFromClone($socid = 0)
|
||||
{
|
||||
global $user,$hookmanager;
|
||||
|
||||
@@ -1152,7 +1152,7 @@ class Commande extends CommonOrder
|
||||
* @param User $user User making creation
|
||||
* @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;
|
||||
|
||||
@@ -1309,7 +1309,7 @@ class Commande extends CommonOrder
|
||||
* 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)
|
||||
*/
|
||||
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;
|
||||
|
||||
@@ -1523,22 +1523,22 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Add line into array
|
||||
* $this->client must be loaded
|
||||
*
|
||||
* @param int $idproduct Product Id
|
||||
* @param float $qty Quantity
|
||||
* @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_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @return void
|
||||
* @param int $idproduct Product Id
|
||||
* @param float $qty Quantity
|
||||
* @param float $remise_percent Product discount relative
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @return void
|
||||
*
|
||||
* TODO Remplacer les appels a cette fonction par generation objet Ligne
|
||||
* 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
|
||||
global $conf, $mysoc;
|
||||
@@ -1583,7 +1583,6 @@ class Commande extends CommonOrder
|
||||
$line->product_desc=$prod->description;
|
||||
$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
|
||||
if ($date_start) { $line->date_start = $date_start; }
|
||||
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
|
||||
* @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
|
||||
@@ -1776,7 +1775,7 @@ class Commande extends CommonOrder
|
||||
* @param int $idremise Id de la remise fixe
|
||||
* @return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function insert_discount($idremise)
|
||||
public function insert_discount($idremise)
|
||||
{
|
||||
// phpcs:enable
|
||||
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
|
||||
*
|
||||
* @param int $only_product Return only physical products
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_lines($only_product = 0)
|
||||
public function fetch_lines($only_product = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->lines=array();
|
||||
@@ -1971,7 +1970,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return int <0 if KO, Nbr of product lines if OK
|
||||
*/
|
||||
function getNbOfProductsLines()
|
||||
public function getNbOfProductsLines()
|
||||
{
|
||||
$nb=0;
|
||||
foreach($this->lines as $line)
|
||||
@@ -1986,7 +1985,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return int <0 if KO, Nbr of service lines if OK
|
||||
*/
|
||||
function getNbOfServicesLines()
|
||||
public function getNbOfServicesLines()
|
||||
{
|
||||
$nb=0;
|
||||
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
|
||||
*/
|
||||
function getNbOfShipments()
|
||||
public function getNbOfShipments()
|
||||
{
|
||||
$nb = 0;
|
||||
|
||||
@@ -2037,7 +2036,7 @@ class Commande extends CommonOrder
|
||||
* @param int $filtre_statut Filter on shipment status
|
||||
* @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();
|
||||
|
||||
@@ -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
|
||||
*
|
||||
@@ -2085,7 +2084,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* TODO deprecate, move to Shipping class
|
||||
*/
|
||||
function nb_expedition()
|
||||
public function nb_expedition()
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'SELECT count(*)';
|
||||
@@ -2104,7 +2103,7 @@ class Commande extends CommonOrder
|
||||
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
|
||||
*
|
||||
@@ -2113,7 +2112,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* 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
|
||||
$this->stocks = array();
|
||||
@@ -2153,7 +2152,7 @@ class Commande extends CommonOrder
|
||||
* @param int $lineid Id of line to delete
|
||||
* @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)
|
||||
{
|
||||
@@ -2222,7 +2221,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Applique une remise relative
|
||||
*
|
||||
@@ -2231,7 +2230,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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
|
||||
$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
|
||||
*
|
||||
@@ -2299,7 +2298,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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
|
||||
$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
|
||||
*
|
||||
@@ -2367,7 +2366,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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
|
||||
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
|
||||
*
|
||||
@@ -2433,7 +2432,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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
|
||||
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
|
||||
*
|
||||
@@ -2504,7 +2503,7 @@ class Commande extends CommonOrder
|
||||
* @param string $sortorder Sort order
|
||||
* @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
|
||||
global $user;
|
||||
@@ -2572,7 +2571,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function availability($availability_id, $notrigger = 0)
|
||||
public function availability($availability_id, $notrigger = 0)
|
||||
{
|
||||
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
|
||||
*
|
||||
@@ -2643,7 +2642,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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
|
||||
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
|
||||
*
|
||||
@@ -2716,7 +2715,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @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
|
||||
if ($user->rights->commande->creer)
|
||||
@@ -2779,7 +2778,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function classifyBilled(User $user, $notrigger = 0)
|
||||
public function classifyBilled(User $user, $notrigger = 0)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
@@ -2835,7 +2834,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function classifyUnBilled()
|
||||
public function classifyUnBilled()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
@@ -2914,7 +2913,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @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;
|
||||
|
||||
@@ -3104,7 +3103,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update(User $user, $notrigger = 0)
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -3199,7 +3198,7 @@ class Commande extends CommonOrder
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
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)
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
public function load_board($user)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@@ -3387,7 +3386,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return string Label
|
||||
*/
|
||||
function getLabelSource()
|
||||
public function getLabelSource()
|
||||
{
|
||||
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
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
public function getLibStatut($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
|
||||
*
|
||||
@@ -3418,7 +3417,7 @@ class Commande extends CommonOrder
|
||||
* @param int $donotshowbilled Do not show billed status after order status
|
||||
* @return string Label of status
|
||||
*/
|
||||
function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
|
||||
public function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
@@ -3430,72 +3429,72 @@ class Commande extends CommonOrder
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
|
||||
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
|
||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
|
||||
if ($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');
|
||||
if ($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_DRAFT) return $langs->trans('StatusOrderDraft');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
elseif ($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('StatusOrderProcessed').$billedtext;
|
||||
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
|
||||
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
|
||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
if ($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');
|
||||
if ($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_DRAFT) return $langs->trans('StatusOrderDraftShort');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
elseif ($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('StatusOrderProcessed').$billedtext;
|
||||
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
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');
|
||||
if ($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;
|
||||
if ($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;
|
||||
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_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraftShort');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'), 'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'), 'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
|
||||
elseif ($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('StatusOrderProcessed').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
||||
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)
|
||||
{
|
||||
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
|
||||
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0');
|
||||
if ($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');
|
||||
if ($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');
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
|
||||
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3');
|
||||
elseif ($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('StatusOrderProcessed').$billedtext, 'statut6');
|
||||
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
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');
|
||||
if ($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;
|
||||
if ($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;
|
||||
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_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraft');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
|
||||
elseif ($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('StatusOrderProcessedShort').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
|
||||
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)
|
||||
{
|
||||
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');
|
||||
if ($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');
|
||||
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');
|
||||
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');
|
||||
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_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
|
||||
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');
|
||||
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');
|
||||
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)
|
||||
{
|
||||
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');
|
||||
if ($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');
|
||||
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');
|
||||
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');
|
||||
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_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraft').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
|
||||
elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidated').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSent').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
|
||||
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');
|
||||
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');
|
||||
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
|
||||
* @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;
|
||||
|
||||
@@ -3588,7 +3587,7 @@ class Commande extends CommonOrder
|
||||
* @param int $id Id of order
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, date_creation as datec, tms as datem,';
|
||||
$sql.= ' date_valid as datev,';
|
||||
@@ -3646,7 +3645,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@@ -3734,7 +3733,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function load_state_board()
|
||||
public function load_state_board()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user;
|
||||
@@ -3776,7 +3775,7 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
public function getLinesArray()
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
}
|
||||
@@ -3880,7 +3879,7 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
public $table_element='commandedet';
|
||||
|
||||
var $oldline;
|
||||
public $oldline;
|
||||
|
||||
/**
|
||||
* Id of parent order
|
||||
@@ -3897,38 +3896,37 @@ class OrderLine extends CommonOrderLine
|
||||
public $commande_id;
|
||||
|
||||
// From llx_commandedet
|
||||
var $fk_parent_line;
|
||||
var $fk_facture;
|
||||
public $fk_parent_line;
|
||||
public $fk_facture;
|
||||
|
||||
/**
|
||||
* @var string Order lines label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
var $fk_remise_except;
|
||||
var $rang = 0;
|
||||
var $fk_fournprice;
|
||||
public $fk_remise_except;
|
||||
public $rang = 0;
|
||||
public $fk_fournprice;
|
||||
|
||||
/**
|
||||
* Buy price without taxes
|
||||
* @var float
|
||||
*/
|
||||
var $pa_ht;
|
||||
var $marge_tx;
|
||||
var $marque_tx;
|
||||
public $pa_ht;
|
||||
public $marge_tx;
|
||||
public $marque_tx;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @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
|
||||
var $date_start;
|
||||
var $date_end;
|
||||
public $date_start;
|
||||
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,10 +3934,10 @@ class OrderLine extends CommonOrderLine
|
||||
*
|
||||
* @param DoliDB $db handler d'acces base de donnee
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db= $db;
|
||||
}
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db= $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load line order
|
||||
@@ -3947,7 +3945,7 @@ class OrderLine extends CommonOrderLine
|
||||
* @param int $rowid Id line order
|
||||
* @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.= ' 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
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function delete(User $user, $notrigger = 0)
|
||||
public function delete(User $user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -4093,7 +4091,7 @@ class OrderLine extends CommonOrderLine
|
||||
* @param int $notrigger 1 = disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function insert($user = null, $notrigger = 0)
|
||||
public function insert($user = null, $notrigger = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
@@ -4238,7 +4236,7 @@ class OrderLine extends CommonOrderLine
|
||||
* @param int $notrigger 1 = disable triggers
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update(User $user, $notrigger = 0)
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
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
|
||||
* Used by migration
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_total()
|
||||
public function update_total()
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->db->begin();
|
||||
|
||||
@@ -34,17 +34,17 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
*/
|
||||
class CommandeStats extends Stats
|
||||
{
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element;
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element;
|
||||
|
||||
var $socid;
|
||||
var $userid;
|
||||
public $socid;
|
||||
public $userid;
|
||||
|
||||
var $from;
|
||||
var $field;
|
||||
var $where;
|
||||
public $from;
|
||||
public $field;
|
||||
public $where;
|
||||
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ class CommandeStats extends Stats
|
||||
* @param string $mode Option ('customer', 'supplier')
|
||||
* @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;
|
||||
|
||||
@@ -74,7 +74,7 @@ class CommandeStats extends Stats
|
||||
$this->field_line='total_ht';
|
||||
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
elseif ($mode == 'supplier')
|
||||
{
|
||||
$object=new CommandeFournisseur($this->db);
|
||||
$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
|
||||
* @return array Array with number by month
|
||||
*/
|
||||
function getNbByMonth($year, $format = 0)
|
||||
public function getNbByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -123,7 +123,7 @@ class CommandeStats extends Stats
|
||||
* @return array Array with number by year
|
||||
*
|
||||
*/
|
||||
function getNbByYear()
|
||||
public function getNbByYear()
|
||||
{
|
||||
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
|
||||
* @return array Array with amount by month
|
||||
*/
|
||||
function getAmountByMonth($year, $format = 0)
|
||||
public function getAmountByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -166,7 +166,7 @@ class CommandeStats extends Stats
|
||||
* @param int $year year for stats
|
||||
* @return array array with number by month
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
public function getAverageByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -186,7 +186,7 @@ class CommandeStats extends Stats
|
||||
*
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAllByYear()
|
||||
public function getAllByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
@@ -206,7 +206,7 @@ class CommandeStats extends Stats
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAllByProduct($year)
|
||||
public function getAllByProduct($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
@@ -143,19 +143,19 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$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
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_state_board()
|
||||
public function load_state_board()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user;
|
||||
@@ -200,7 +200,7 @@ class Contact extends CommonObject
|
||||
* @param User $user Object user that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user)
|
||||
public function create($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -313,7 +313,7 @@ class Contact extends CommonObject
|
||||
* @param int $nosyncuser No sync linked user (external users and contacts are linked)
|
||||
* @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;
|
||||
|
||||
@@ -491,7 +491,7 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||
*
|
||||
@@ -501,7 +501,7 @@ class Contact extends CommonObject
|
||||
* 2=Return key only (uid=qqq)
|
||||
* @return string DN
|
||||
*/
|
||||
function _load_ldap_dn($info, $mode = 0)
|
||||
private function _load_ldap_dn($info, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@@ -513,13 +513,13 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Initialise tableau info (tableau des attributs LDAP)
|
||||
*
|
||||
* @return array Tableau info des attributs
|
||||
*/
|
||||
function _load_ldap_info()
|
||||
private function _load_ldap_info()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@@ -597,7 +597,7 @@ class Contact extends CommonObject
|
||||
* @param int $notrigger 0=no, 1=yes
|
||||
* @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
|
||||
$error=0;
|
||||
@@ -686,7 +686,7 @@ class Contact extends CommonObject
|
||||
* @param string $email Email
|
||||
* @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;
|
||||
|
||||
@@ -869,7 +869,7 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setGenderFromCivility()
|
||||
public function setGenderFromCivility()
|
||||
{
|
||||
unset($this->gender);
|
||||
if (in_array($this->civility_id, array('MR'))) {
|
||||
@@ -879,7 +879,7 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load number of elements the contact is used as a link for
|
||||
* ref_facturation
|
||||
@@ -889,7 +889,7 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function load_ref_elements()
|
||||
public function load_ref_elements()
|
||||
{
|
||||
// phpcs:enable
|
||||
// Compte les elements pour lesquels il est contact
|
||||
@@ -931,7 +931,7 @@ class Contact extends CommonObject
|
||||
* @param int $notrigger Disable all trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($notrigger = 0)
|
||||
public function delete($notrigger = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@@ -1045,7 +1045,7 @@ class Contact extends CommonObject
|
||||
* @param int $id Id du contact a charger
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
public function info($id)
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,";
|
||||
$sql.= " c.tms as tms, c.fk_user_modif";
|
||||
@@ -1090,7 +1090,7 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @return int Number of EMailings
|
||||
*/
|
||||
function getNbOfEMailings()
|
||||
public function getNbOfEMailings()
|
||||
{
|
||||
$sql = "SELECT count(mc.email) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m";
|
||||
@@ -1125,7 +1125,7 @@ class Contact extends CommonObject
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @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;
|
||||
|
||||
@@ -1203,7 +1203,7 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @return string Translated name of civility
|
||||
*/
|
||||
function getCivilityLabel()
|
||||
public function getCivilityLabel()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("dict");
|
||||
@@ -1219,12 +1219,12 @@ class Contact extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of contact status
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
public function getLibStatut($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
|
||||
*
|
||||
@@ -1232,7 +1232,7 @@ class Contact extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function LibStatut($statut, $mode)
|
||||
public function LibStatut($statut, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@@ -1270,14 +1270,14 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return translated label of Public or Private
|
||||
*
|
||||
* @param int $statut Type (0 = public, 1 = private)
|
||||
* @return string Label translated
|
||||
*/
|
||||
function LibPubPriv($statut)
|
||||
public function LibPubPriv($statut)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@@ -1293,14 +1293,13 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
// Get first id of existing company and save it into $socid
|
||||
$socid = 0;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe ORDER BY rowid LIMIT 1";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $socid=$obj->rowid;
|
||||
}
|
||||
@@ -1337,7 +1336,7 @@ class Contact extends CommonObject
|
||||
* @param int $statut Status to set
|
||||
* @return int <0 if KO, 0 if nothing is done, >0 if OK
|
||||
*/
|
||||
function setstatus($statut)
|
||||
public function setstatus($statut)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase
|
||||
*
|
||||
* @return AccountingAccountTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
@@ -187,19 +187,19 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testAccountingAccountUpdate($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject->label='New label';
|
||||
$result=$localobject->update($user);
|
||||
$localobject->label='New label';
|
||||
$result=$localobject->update($user);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
return $localobject->id;
|
||||
return $localobject->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,7 @@ class ActionCommTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ActionCommTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return AdherentTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class AdminLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return AdminLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return BankAccountTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return BankAccountTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return BuildDocTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CMailFile
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CategorieTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ require_once dirname(__FILE__).'/../../htdocs/compta/sociales/class/chargesocial
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
@@ -47,74 +47,74 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
*/
|
||||
class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return ChargeSocialesTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return ChargeSocialesTest
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
parent::__construct();
|
||||
|
||||
print __METHOD__."\n";
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,19 +124,19 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testChargeSocialesCreate()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new ChargeSociales($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user, $langs, $conf);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$localobject=new ChargeSociales($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user, $langs, $conf);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,18 +150,18 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testChargeSocialesFetch($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new ChargeSociales($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$localobject=new ChargeSociales($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
return $localobject;
|
||||
$this->assertLessThan($result, 0);
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,17 +175,17 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testChargeSocialesValid($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$result=$localobject->set_paid($user);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$result=$localobject->set_paid($user);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
return $localobject;
|
||||
$this->assertLessThan($result, 0);
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,7 +213,7 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThanOrEqual($result, 0);
|
||||
|
||||
return $localobject->id;
|
||||
return $localobject->id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,18 +227,18 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testChargeSocialesDelete($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new ChargeSociales($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$result=$localobject->delete($id);
|
||||
$localobject=new ChargeSociales($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$result=$localobject->delete($id);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
@@ -164,12 +164,12 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
||||
preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
{
|
||||
if ($val[1] != '\'"' && $val[1] != '\'\'')
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
//if ($reg[0] != 'db') $ok=false;
|
||||
if ($val[1] != '\'"' && $val[1] != '\'\'')
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
//if ($reg[0] != 'db') $ok=false;
|
||||
}
|
||||
//print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n";
|
||||
$this->assertTrue($ok, 'Found a $this->db->idate to forge a sql request without quotes around this date field '.$file['fullname'].' :: '.$val[0]);
|
||||
@@ -201,7 +201,7 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
||||
preg_match_all('/(..............)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
{
|
||||
if ($val[1] != 'scape_htmltag(' && $val[1] != 'ing_nohtmltag(' && $val[1] != 'dol_escape_js(')
|
||||
if ($val[1] != 'scape_htmltag(' && $val[1] != 'ing_nohtmltag(' && $val[1] != 'dol_escape_js(')
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
@@ -217,8 +217,8 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
||||
preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
$this->assertTrue($ok, 'Found a use of print_liste_field_titre with fist parameter that is a translated value instead of just the translation key in file '.$file['fullname'].'. Bad.');
|
||||
|
||||
@@ -230,7 +230,7 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
||||
preg_match_all('/<br \/>/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
{
|
||||
if ($file['name'] != 'functions.lib.php')
|
||||
if ($file['name'] != 'functions.lib.php')
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
|
||||
@@ -70,7 +70,7 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CommandeFournisseurTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CommandeTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class CommonInvoiceTest extends PHPUnit\Framework\TestCase
|
||||
*
|
||||
* @return CommonObjectTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CommonObjectTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CompanyBankAccountTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,13 +74,13 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -57,7 +57,7 @@ class CompanyLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return AdminLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ContactTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -82,14 +82,14 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -31,9 +31,9 @@ require_once dirname(__FILE__).'/../../htdocs/contrat/class/contrat.class.php';
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
@@ -47,74 +47,74 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
*/
|
||||
class ContratTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return ContratTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return ContratTest
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
parent::__construct();
|
||||
|
||||
print __METHOD__."\n";
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,20 +124,20 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testContratCreate()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,19 +151,19 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testContratFetch($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
return $localobject;
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,18 +206,18 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testContratDelete($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$result=$localobject->delete($user);
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$result=$localobject->delete($user);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CoreTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,12 +75,12 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -58,7 +58,7 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,8 +74,8 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class DiscountTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DiscountTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,7 +75,7 @@ class DiscountTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -58,7 +58,7 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return EntrepotTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,8 +74,8 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class ExpenseReportTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ExpenseReportTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class ExportTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ExportTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -79,7 +79,7 @@ class ExportTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
//$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -59,7 +59,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FactureFournisseurTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -76,7 +76,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -59,7 +59,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FactureTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,10 +75,10 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
@@ -114,7 +114,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class FactureTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FactureTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FactureTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,7 +75,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
@@ -97,7 +97,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
@@ -113,7 +113,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class FichinterTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ContratTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,7 +75,7 @@ class FichinterTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -59,7 +59,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FilesLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,8 +75,8 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -58,7 +58,7 @@ class FormAdminTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FactureTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,7 +75,7 @@ class FormAdminTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
@@ -111,9 +111,9 @@ class FormAdminTest extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CoreTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -61,11 +61,11 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*
|
||||
* @return CoreTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
@@ -97,11 +97,11 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
@@ -114,10 +114,10 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
@@ -131,22 +131,22 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testIsValidMXRecord()
|
||||
{
|
||||
// Nb of line is same than entry text
|
||||
// Nb of line is same than entry text
|
||||
|
||||
$input="yahoo.com";
|
||||
$result=isValidMXRecord($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(1, $result);
|
||||
$input="yahoo.com";
|
||||
$result=isValidMXRecord($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(1, $result);
|
||||
|
||||
$input="yhaoo.com";
|
||||
$result=isValidMXRecord($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0, $result);
|
||||
$input="yhaoo.com";
|
||||
$result=isValidMXRecord($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0, $result);
|
||||
|
||||
$input="dolibarr.fr";
|
||||
$result=isValidMXRecord($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0, $result);
|
||||
$input="dolibarr.fr";
|
||||
$result=isValidMXRecord($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,87 +156,87 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDolGetFirstLineOfText()
|
||||
{
|
||||
// Nb of line is same than entry text
|
||||
// Nb of line is same than entry text
|
||||
|
||||
$input="aaaa";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa", $result);
|
||||
$input="aaaa";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa", $result);
|
||||
|
||||
$input="aaaa\nbbbbbbbbbbbb\n";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa\nbbbbbbbbbbbb", $result);
|
||||
$input="aaaa\nbbbbbbbbbbbb\n";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa\nbbbbbbbbbbbb", $result);
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb", $result);
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb", $result);
|
||||
|
||||
// Nb of line is lower
|
||||
// Nb of line is lower
|
||||
|
||||
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa...", $result);
|
||||
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa...", $result);
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa...", $result);
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa...", $result);
|
||||
|
||||
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa\nbbbbbbbbbbbb...", $result);
|
||||
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa\nbbbbbbbbbbbb...", $result);
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb...", $result);
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input, 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb...", $result);
|
||||
|
||||
// Nb of line is higher
|
||||
// Nb of line is higher
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 a');
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 a');
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 b');
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 b');
|
||||
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>\n";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 c');
|
||||
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>\n";
|
||||
$result=dolGetFirstLineOfText($input, 100);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 c');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testDolBuildPath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolBuildPath()
|
||||
{
|
||||
/*$tmp=dol_buildpath('/google/oauth2callback.php', 0);
|
||||
var_dump($tmp);
|
||||
*/
|
||||
/**
|
||||
* testDolBuildPath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolBuildPath()
|
||||
{
|
||||
/*$tmp=dol_buildpath('/google/oauth2callback.php', 0);
|
||||
var_dump($tmp);
|
||||
*/
|
||||
|
||||
/*$tmp=dol_buildpath('/google/oauth2callback.php', 1);
|
||||
var_dump($tmp);
|
||||
*/
|
||||
/*$tmp=dol_buildpath('/google/oauth2callback.php', 1);
|
||||
var_dump($tmp);
|
||||
*/
|
||||
|
||||
$result=dol_buildpath('/google/oauth2callback.php', 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertStringStartsWith('http', $result);
|
||||
|
||||
$result=dol_buildpath('/google/oauth2callback.php', 3);
|
||||
$result=dol_buildpath('/google/oauth2callback.php', 2);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertStringStartsWith('http', $result);
|
||||
}
|
||||
|
||||
$result=dol_buildpath('/google/oauth2callback.php', 3);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertStringStartsWith('http', $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -246,82 +246,82 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testGetBrowserInfo()
|
||||
{
|
||||
// MSIE 5.0
|
||||
// MSIE 5.0
|
||||
$user_agent ='Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; KITV4 Wanadoo; KITV5 Wanadoo)';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('ie', $tmp['browsername']);
|
||||
$this->assertEquals('5.0', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
// Firefox 0.9.1
|
||||
// Firefox 0.9.1
|
||||
$user_agent ='Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firefox/0.9.1';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('firefox', $tmp['browsername']);
|
||||
$this->assertEquals('0.9.1', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
$user_agent ='Mozilla/3.0 (Windows 98; U) Opera 6.03 [en]';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('opera', $tmp['browsername']);
|
||||
$this->assertEquals('6.03', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
$user_agent ='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('chrome', $tmp['browsername']);
|
||||
$this->assertEquals('19.0.1042.0', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
$user_agent ='chrome (Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11)';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('chrome', $tmp['browsername']);
|
||||
$this->assertEquals('17.0.963.56', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
$user_agent ='Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('safari', $tmp['browsername']);
|
||||
$this->assertEquals('533.21.1', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
//Internet Explorer 11
|
||||
$user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('ie', $tmp['browsername']);
|
||||
$this->assertEquals('11.0', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
//Internet Explorer 11
|
||||
$user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('ie', $tmp['browsername']);
|
||||
$this->assertEquals('11.0', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
//Internet Explorer 11 bis
|
||||
$user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; NP06; rv:11.0) like Gecko';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('ie', $tmp['browsername']);
|
||||
$this->assertEquals('11.0', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
//Internet Explorer 11 bis
|
||||
$user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; NP06; rv:11.0) like Gecko';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('ie', $tmp['browsername']);
|
||||
$this->assertEquals('11.0', $tmp['browserversion']);
|
||||
$this->assertEmpty($tmp['phone']);
|
||||
$this->assertFalse($tmp['tablet']);
|
||||
$this->assertEquals('classic', $tmp['layout']);
|
||||
|
||||
//iPad
|
||||
$user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('safari', $tmp['browsername']);
|
||||
$this->assertEquals('8536.25', $tmp['browserversion']);
|
||||
$this->assertEquals('ios', $tmp['browseros']);
|
||||
$this->assertEquals('tablet', $tmp['layout']);
|
||||
$this->assertEquals('iphone', $tmp['phone']);
|
||||
//iPad
|
||||
$user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25';
|
||||
$tmp=getBrowserInfo($user_agent);
|
||||
$this->assertEquals('safari', $tmp['browsername']);
|
||||
$this->assertEquals('8536.25', $tmp['browserversion']);
|
||||
$this->assertEquals('ios', $tmp['browseros']);
|
||||
$this->assertEquals('tablet', $tmp['layout']);
|
||||
$this->assertEquals('iphone', $tmp['phone']);
|
||||
}
|
||||
|
||||
|
||||
@@ -332,48 +332,48 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testGetLanguageCodeFromCountryCode()
|
||||
{
|
||||
global $mysoc;
|
||||
global $mysoc;
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('US');
|
||||
$this->assertEquals('en_US', $language, 'US');
|
||||
$language = getLanguageCodeFromCountryCode('US');
|
||||
$this->assertEquals('en_US', $language, 'US');
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('ES');
|
||||
$this->assertEquals('es_ES', $language, 'ES');
|
||||
$language = getLanguageCodeFromCountryCode('ES');
|
||||
$this->assertEquals('es_ES', $language, 'ES');
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('CL');
|
||||
$this->assertEquals('es_CL', $language, 'CL');
|
||||
$language = getLanguageCodeFromCountryCode('CL');
|
||||
$this->assertEquals('es_CL', $language, 'CL');
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('CA');
|
||||
$this->assertEquals('en_CA', $language, 'CA');
|
||||
$language = getLanguageCodeFromCountryCode('CA');
|
||||
$this->assertEquals('en_CA', $language, 'CA');
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('MQ');
|
||||
$this->assertEquals('fr_CA', $language);
|
||||
$language = getLanguageCodeFromCountryCode('MQ');
|
||||
$this->assertEquals('fr_CA', $language);
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('FR');
|
||||
$this->assertEquals('fr_FR', $language);
|
||||
$language = getLanguageCodeFromCountryCode('FR');
|
||||
$this->assertEquals('fr_FR', $language);
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('BE');
|
||||
$this->assertEquals('fr_BE', $language);
|
||||
$language = getLanguageCodeFromCountryCode('BE');
|
||||
$this->assertEquals('fr_BE', $language);
|
||||
|
||||
$mysoc->country_code = 'FR';
|
||||
$language = getLanguageCodeFromCountryCode('CH');
|
||||
$this->assertEquals('fr_CH', $language);
|
||||
$mysoc->country_code = 'FR';
|
||||
$language = getLanguageCodeFromCountryCode('CH');
|
||||
$this->assertEquals('fr_CH', $language);
|
||||
|
||||
$mysoc->country_code = 'DE';
|
||||
$language = getLanguageCodeFromCountryCode('CH');
|
||||
$this->assertEquals('de_CH', $language);
|
||||
$mysoc->country_code = 'DE';
|
||||
$language = getLanguageCodeFromCountryCode('CH');
|
||||
$this->assertEquals('de_CH', $language);
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('DE');
|
||||
$this->assertEquals('de_DE', $language);
|
||||
$language = getLanguageCodeFromCountryCode('DE');
|
||||
$this->assertEquals('de_DE', $language);
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('SA');
|
||||
$this->assertEquals('ar_SA', $language);
|
||||
$language = getLanguageCodeFromCountryCode('SA');
|
||||
$this->assertEquals('ar_SA', $language);
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('SE');
|
||||
$this->assertEquals('sv_SE', $language);
|
||||
$language = getLanguageCodeFromCountryCode('SE');
|
||||
$this->assertEquals('sv_SE', $language);
|
||||
|
||||
$language = getLanguageCodeFromCountryCode('DK');
|
||||
$this->assertEquals('da_DK', $language);
|
||||
$language = getLanguageCodeFromCountryCode('DK');
|
||||
$this->assertEquals('da_DK', $language);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -570,9 +570,9 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDolHtmlEntitiesBr()
|
||||
{
|
||||
// Text not already HTML
|
||||
// Text not already HTML
|
||||
|
||||
$input="A string\nwith a é, &, < and >.";
|
||||
$input="A string\nwith a é, &, < and >.";
|
||||
$after=dol_htmlentitiesbr($input, 0); // Add <br> before \n
|
||||
$this->assertEquals("A string<br>\nwith a é, &, < and >.", $after);
|
||||
|
||||
@@ -645,9 +645,9 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDolUnaccent()
|
||||
{
|
||||
// Text not already HTML
|
||||
// Text not already HTML
|
||||
|
||||
$input="A string\nwith a à ä é è ë ï ü ö ÿ, &, < and >.";
|
||||
$input="A string\nwith a à ä é è ë ï ü ö ÿ, &, < and >.";
|
||||
$after=dol_string_unaccent($input);
|
||||
$this->assertEquals("A string\nwith a a a e e e i u o y, &, < and >.", $after);
|
||||
}
|
||||
@@ -738,14 +738,14 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDolMkTime()
|
||||
{
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
$savtz=date_default_timezone_get();
|
||||
$savtz=date_default_timezone_get();
|
||||
|
||||
// Some test for UTC TZ
|
||||
date_default_timezone_set('UTC');
|
||||
// Some test for UTC TZ
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
// Check bad hours
|
||||
// Check bad hours
|
||||
$result=dol_mktime(25, 0, 0, 1, 1, 1970, 1, 1); // Error (25 hours)
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('', $result);
|
||||
@@ -831,30 +831,30 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDolFormatAddress()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$object=new Societe($db);
|
||||
$object->initAsSpecimen();
|
||||
$object=new Societe($db);
|
||||
$object->initAsSpecimen();
|
||||
|
||||
$object->country_code='FR';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\n99999 MyTown", $address);
|
||||
$object->country_code='FR';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\n99999 MyTown", $address);
|
||||
|
||||
$object->country_code='GB';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\nMyTown, MyState\n99999", $address);
|
||||
$object->country_code='GB';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\nMyTown, MyState\n99999", $address);
|
||||
|
||||
$object->country_code='US';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\nMyTown, MyState, 99999", $address);
|
||||
$object->country_code='US';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\nMyTown, MyState, 99999", $address);
|
||||
|
||||
$object->country_code='AU';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\nMyTown, MyState, 99999", $address);
|
||||
$object->country_code='AU';
|
||||
$address=dol_format_address($object);
|
||||
$this->assertEquals("21 jump street\nMyTown, MyState, 99999", $address);
|
||||
}
|
||||
|
||||
|
||||
@@ -903,7 +903,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__." s=".$s."\n";
|
||||
$this->assertContains('theme', $s, 'testImgPicto1');
|
||||
|
||||
$s=img_picto('title', 'img.png', 'style="float: right"', 0);
|
||||
$s=img_picto('title', 'img.png', 'style="float: right"', 0);
|
||||
print __METHOD__." s=".$s."\n";
|
||||
$this->assertContains('theme', $s, 'testImgPicto2');
|
||||
$this->assertContains('style="float: right"', $s, 'testImgPicto2');
|
||||
@@ -978,13 +978,13 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
$companyfr=new Societe($db);
|
||||
$companyfr->country_code='FR';
|
||||
$companyfr->tva_assuj=1;
|
||||
$companyfr->tva_intra='FR9999';
|
||||
$companyfr->tva_intra='FR9999';
|
||||
|
||||
// Buyers
|
||||
$companymc=new Societe($db);
|
||||
$companymc->country_code='MC';
|
||||
$companymc->tva_assuj=1;
|
||||
$companyfr->tva_intra='MC9999';
|
||||
$companyfr->tva_intra='MC9999';
|
||||
|
||||
$companyit=new Societe($db);
|
||||
$companyit->country_code='IT';
|
||||
@@ -1068,84 +1068,84 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testGetDefaultLocalTax()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
$companyfrnovat=new Societe($db);
|
||||
$companyfrnovat->country_code='FR';
|
||||
$companyfrnovat->tva_assuj=0;
|
||||
$companyfrnovat->localtax1_assuj=0;
|
||||
$companyfrnovat->localtax2_assuj=0;
|
||||
$companyfrnovat=new Societe($db);
|
||||
$companyfrnovat->country_code='FR';
|
||||
$companyfrnovat->tva_assuj=0;
|
||||
$companyfrnovat->localtax1_assuj=0;
|
||||
$companyfrnovat->localtax2_assuj=0;
|
||||
|
||||
$companyes=new Societe($db);
|
||||
$companyes->country_code='ES';
|
||||
$companyes->tva_assuj=1;
|
||||
$companyes->localtax1_assuj=1;
|
||||
$companyes->localtax2_assuj=1;
|
||||
$companyes=new Societe($db);
|
||||
$companyes->country_code='ES';
|
||||
$companyes->tva_assuj=1;
|
||||
$companyes->localtax1_assuj=1;
|
||||
$companyes->localtax2_assuj=1;
|
||||
|
||||
$companymc=new Societe($db);
|
||||
$companymc->country_code='MC';
|
||||
$companymc->tva_assuj=1;
|
||||
$companymc->localtax1_assuj=0;
|
||||
$companymc->localtax2_assuj=0;
|
||||
$companymc=new Societe($db);
|
||||
$companymc->country_code='MC';
|
||||
$companymc->tva_assuj=1;
|
||||
$companymc->localtax1_assuj=0;
|
||||
$companymc->localtax2_assuj=0;
|
||||
|
||||
$companyit=new Societe($db);
|
||||
$companyit->country_code='IT';
|
||||
$companyit->tva_assuj=1;
|
||||
$companyit->tva_intra='IT99999';
|
||||
$companyit->localtax1_assuj=0;
|
||||
$companyit->localtax2_assuj=0;
|
||||
$companyit=new Societe($db);
|
||||
$companyit->country_code='IT';
|
||||
$companyit->tva_assuj=1;
|
||||
$companyit->tva_intra='IT99999';
|
||||
$companyit->localtax1_assuj=0;
|
||||
$companyit->localtax2_assuj=0;
|
||||
|
||||
$notcompanyit=new Societe($db);
|
||||
$notcompanyit->country_code='IT';
|
||||
$notcompanyit->tva_assuj=1;
|
||||
$notcompanyit->tva_intra='';
|
||||
$notcompanyit->typent_code='TE_PRIVATE';
|
||||
$notcompanyit->localtax1_assuj=0;
|
||||
$notcompanyit->localtax2_assuj=0;
|
||||
$notcompanyit=new Societe($db);
|
||||
$notcompanyit->country_code='IT';
|
||||
$notcompanyit->tva_assuj=1;
|
||||
$notcompanyit->tva_intra='';
|
||||
$notcompanyit->typent_code='TE_PRIVATE';
|
||||
$notcompanyit->localtax1_assuj=0;
|
||||
$notcompanyit->localtax2_assuj=0;
|
||||
|
||||
$companyus=new Societe($db);
|
||||
$companyus->country_code='US';
|
||||
$companyus->tva_assuj=1;
|
||||
$companyus->tva_intra='';
|
||||
$companyus->localtax1_assuj=0;
|
||||
$companyus->localtax2_assuj=0;
|
||||
$companyus=new Societe($db);
|
||||
$companyus->country_code='US';
|
||||
$companyus->tva_assuj=1;
|
||||
$companyus->tva_intra='';
|
||||
$companyus->localtax1_assuj=0;
|
||||
$companyus->localtax2_assuj=0;
|
||||
|
||||
// Test RULE FR-MC
|
||||
$vat1=get_default_localtax($companyfrnovat, $companymc, 1, 0);
|
||||
$vat2=get_default_localtax($companyfrnovat, $companymc, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
// Test RULE FR-MC
|
||||
$vat1=get_default_localtax($companyfrnovat, $companymc, 1, 0);
|
||||
$vat2=get_default_localtax($companyfrnovat, $companymc, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
|
||||
// Test RULE ES-ES
|
||||
$vat1=get_default_localtax($companyes, $companyes, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $companyes, 2, 0);
|
||||
$this->assertEquals($vat1, 5.2);
|
||||
$this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup)
|
||||
// Test RULE ES-ES
|
||||
$vat1=get_default_localtax($companyes, $companyes, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $companyes, 2, 0);
|
||||
$this->assertEquals($vat1, 5.2);
|
||||
$this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup)
|
||||
|
||||
// Test RULE ES-IT
|
||||
$vat1=get_default_localtax($companyes, $companyit, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $companyit, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
// Test RULE ES-IT
|
||||
$vat1=get_default_localtax($companyes, $companyit, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $companyit, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
|
||||
// Test RULE ES-IT
|
||||
$vat1=get_default_localtax($companyes, $notcompanyit, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $notcompanyit, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
// Test RULE ES-IT
|
||||
$vat1=get_default_localtax($companyes, $notcompanyit, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $notcompanyit, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
|
||||
// Test RULE FR-IT
|
||||
// Not tested
|
||||
// Test RULE FR-IT
|
||||
// Not tested
|
||||
|
||||
// Test RULE ES-US
|
||||
$vat1=get_default_localtax($companyes, $companyus, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $companyus, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
// Test RULE ES-US
|
||||
$vat1=get_default_localtax($companyes, $companyus, 1, 0);
|
||||
$vat2=get_default_localtax($companyes, $companyus, 2, 0);
|
||||
$this->assertEquals(0, $vat1);
|
||||
$this->assertEquals(0, $vat2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1156,108 +1156,108 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDolExplodeIntoArray()
|
||||
{
|
||||
$stringtoexplode='AA=B/B.CC=.EE=FF.HH=GG;.';
|
||||
$tmp=dolExplodeIntoArray($stringtoexplode, '.', '=');
|
||||
$stringtoexplode='AA=B/B.CC=.EE=FF.HH=GG;.';
|
||||
$tmp=dolExplodeIntoArray($stringtoexplode, '.', '=');
|
||||
|
||||
print __METHOD__." tmp=".json_encode($tmp)."\n";
|
||||
$this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG;"}', json_encode($tmp));
|
||||
}
|
||||
|
||||
/**
|
||||
* dol_nl2br
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* dol_nl2br
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolNl2Br()
|
||||
{
|
||||
|
||||
//String to encode
|
||||
$string = "a\na";
|
||||
//String to encode
|
||||
$string = "a\na";
|
||||
|
||||
$this->assertEquals(dol_nl2br($string), "a<br>\na");
|
||||
$this->assertEquals(dol_nl2br($string), "a<br>\na");
|
||||
|
||||
//With $forxml parameter
|
||||
$this->assertEquals(dol_nl2br($string, 0, 1), "a<br />\na");
|
||||
//With $forxml parameter
|
||||
$this->assertEquals(dol_nl2br($string, 0, 1), "a<br />\na");
|
||||
|
||||
//Replacing \n by br
|
||||
$this->assertEquals(dol_nl2br($string, 1), "a<br>a");
|
||||
//Replacing \n by br
|
||||
$this->assertEquals(dol_nl2br($string, 1), "a<br>a");
|
||||
|
||||
//With $forxml parameter
|
||||
$this->assertEquals(dol_nl2br($string, 1, 1), "a<br />a");
|
||||
}
|
||||
//With $forxml parameter
|
||||
$this->assertEquals(dol_nl2br($string, 1, 1), "a<br />a");
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolPrice2Num
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolPrice2Num()
|
||||
{
|
||||
$this->assertEquals(1000, price2num('1 000.0'));
|
||||
$this->assertEquals(1000, price2num('1 000', 'MT'));
|
||||
$this->assertEquals(1000, price2num('1 000', 'MU'));
|
||||
/**
|
||||
* testDolPrice2Num
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolPrice2Num()
|
||||
{
|
||||
$this->assertEquals(1000, price2num('1 000.0'));
|
||||
$this->assertEquals(1000, price2num('1 000', 'MT'));
|
||||
$this->assertEquals(1000, price2num('1 000', 'MU'));
|
||||
|
||||
$this->assertEquals(1000.123456, price2num('1 000.123456'));
|
||||
$this->assertEquals(1000.123456, price2num('1 000.123456'));
|
||||
|
||||
// Round down
|
||||
$this->assertEquals(1000.12, price2num('1 000.123452', 'MT'));
|
||||
$this->assertEquals(1000.12345, price2num('1 000.123452', 'MU'), "Test MU");
|
||||
// Round down
|
||||
$this->assertEquals(1000.12, price2num('1 000.123452', 'MT'));
|
||||
$this->assertEquals(1000.12345, price2num('1 000.123452', 'MU'), "Test MU");
|
||||
|
||||
// Round up
|
||||
$this->assertEquals(1000.13, price2num('1 000.125456', 'MT'));
|
||||
$this->assertEquals(1000.12546, price2num('1 000.125456', 'MU'), "Test MU");
|
||||
// Round up
|
||||
$this->assertEquals(1000.13, price2num('1 000.125456', 'MT'));
|
||||
$this->assertEquals(1000.12546, price2num('1 000.125456', 'MU'), "Test MU");
|
||||
|
||||
// Text can't be converted
|
||||
$this->assertEquals('12.4$', price2num('12.4$'));
|
||||
$this->assertEquals('12r.4$', price2num('12r.4$'));
|
||||
// Text can't be converted
|
||||
$this->assertEquals('12.4$', price2num('12.4$'));
|
||||
$this->assertEquals('12r.4$', price2num('12r.4$'));
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolGetDate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolGetDate()
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* testDolGetDate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolGetDate()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$conf->global->MAIN_START_WEEK = 0;
|
||||
$conf->global->MAIN_START_WEEK = 0;
|
||||
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
|
||||
$conf->global->MAIN_START_WEEK = 1;
|
||||
$conf->global->MAIN_START_WEEK = 1;
|
||||
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testDolGetDate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testMakeSubstitutions()
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load("main");
|
||||
/**
|
||||
* testDolGetDate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testMakeSubstitutions()
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load("main");
|
||||
|
||||
$substit=array("AAA"=>'Not used', "BBB"=>'Not used', "CCC"=>"C replaced");
|
||||
$chaine='This is a string with __[MAIN_THEME]__ and __(DIRECTION)__ and __CCC__';
|
||||
$newstring = make_substitutions($chaine, $substit);
|
||||
$this->assertEquals($newstring, 'This is a string with eldy and ltr and __C replaced__');
|
||||
$substit=array("AAA"=>'Not used', "BBB"=>'Not used', "CCC"=>"C replaced");
|
||||
$chaine='This is a string with __[MAIN_THEME]__ and __(DIRECTION)__ and __CCC__';
|
||||
$newstring = make_substitutions($chaine, $substit);
|
||||
$this->assertEquals($newstring, 'This is a string with eldy and ltr and __C replaced__');
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/geturl.lib.php';
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
@@ -48,123 +48,123 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
*/
|
||||
class GetUrlLibTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return FilesLibTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return FilesLibTest
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
parent::__construct();
|
||||
|
||||
print __METHOD__."\n";
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* testGetRootURLFromURL
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testGetRootURLFromURL()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$result=getRootURLFromURL('http://www.dolimed.com/screenshots/afile');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result, 'Test 1');
|
||||
$result=getRootURLFromURL('http://www.dolimed.com/screenshots/afile');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result, 'Test 1');
|
||||
|
||||
$result=getRootURLFromURL('https://www.dolimed.com/screenshots/afile');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result, 'Test 2');
|
||||
$result=getRootURLFromURL('https://www.dolimed.com/screenshots/afile');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result, 'Test 2');
|
||||
|
||||
$result=getRootURLFromURL('http://www.dolimed.com/screenshots');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result);
|
||||
$result=getRootURLFromURL('http://www.dolimed.com/screenshots');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result);
|
||||
|
||||
$result=getRootURLFromURL('https://www.dolimed.com/screenshots');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result);
|
||||
$result=getRootURLFromURL('https://www.dolimed.com/screenshots');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result);
|
||||
|
||||
$result=getRootURLFromURL('http://www.dolimed.com/');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result);
|
||||
$result=getRootURLFromURL('http://www.dolimed.com/');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result);
|
||||
|
||||
$result=getRootURLFromURL('https://www.dolimed.com/');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result);
|
||||
$result=getRootURLFromURL('https://www.dolimed.com/');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result);
|
||||
|
||||
$result=getRootURLFromURL('http://www.dolimed.com');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result);
|
||||
$result=getRootURLFromURL('http://www.dolimed.com');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('http://www.dolimed.com', $result);
|
||||
|
||||
$result=getRootURLFromURL('https://www.dolimed.com');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result);
|
||||
$result=getRootURLFromURL('https://www.dolimed.com');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('https://www.dolimed.com', $result);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,20 +175,20 @@ class GetUrlLibTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testRemoveHtmlComment()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$result=removeHtmlComment('abc<!--[if lt IE 8]>aaaa<![endif]-->def');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('abcdef', $result, 'Test 1');
|
||||
$result=removeHtmlComment('abc<!--[if lt IE 8]>aaaa<![endif]-->def');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('abcdef', $result, 'Test 1');
|
||||
|
||||
$result=removeHtmlComment('abc<!--[if lt IE 8]>aa-->bb<!--aa<![endif]-->def');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('abcbbdef', $result, 'Test 1');
|
||||
$result=removeHtmlComment('abc<!--[if lt IE 8]>aa-->bb<!--aa<![endif]-->def');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('abcbbdef', $result, 'Test 1');
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ $langs->load("dict");
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
@@ -49,75 +49,75 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
*/
|
||||
class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return HolidayTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return HolidayTest
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,20 +127,20 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHolidayCreate()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new Holiday($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
$localobject=new Holiday($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,19 +153,19 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHolidayFetch($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new Holiday($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$localobject=new Holiday($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
return $localobject;
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,55 +179,55 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHolidayUpdate($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject->oldcopy = clone $localobject;
|
||||
$localobject->oldcopy = clone $localobject;
|
||||
|
||||
$localobject->note_private='New private note after update';
|
||||
$localobject->note_public='New public note after update';
|
||||
$localobject->lastname='New name';
|
||||
$localobject->firstname='New firstname';
|
||||
$localobject->address='New address';
|
||||
$localobject->zip='New zip';
|
||||
$localobject->town='New town';
|
||||
$localobject->country_id=2;
|
||||
//$localobject->status=0;
|
||||
$localobject->phone_pro='New tel pro';
|
||||
$localobject->phone_perso='New tel perso';
|
||||
$localobject->phone_mobile='New tel mobile';
|
||||
$localobject->fax='New fax';
|
||||
$localobject->email='newemail@newemail.com';
|
||||
$localobject->jabberid='New im id';
|
||||
$localobject->default_lang='es_ES';
|
||||
$localobject->note_private='New private note after update';
|
||||
$localobject->note_public='New public note after update';
|
||||
$localobject->lastname='New name';
|
||||
$localobject->firstname='New firstname';
|
||||
$localobject->address='New address';
|
||||
$localobject->zip='New zip';
|
||||
$localobject->town='New town';
|
||||
$localobject->country_id=2;
|
||||
//$localobject->status=0;
|
||||
$localobject->phone_pro='New tel pro';
|
||||
$localobject->phone_perso='New tel perso';
|
||||
$localobject->phone_mobile='New tel mobile';
|
||||
$localobject->fax='New fax';
|
||||
$localobject->email='newemail@newemail.com';
|
||||
$localobject->jabberid='New im id';
|
||||
$localobject->default_lang='es_ES';
|
||||
|
||||
$result=$localobject->update($localobject->id, $user);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update error');
|
||||
|
||||
$result=$localobject->update_note($localobject->note_private, '_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
|
||||
|
||||
$result=$localobject->update_note($localobject->note_public, '_public');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
|
||||
|
||||
|
||||
$newobject=new Holiday($this->savdb);
|
||||
$result=$newobject->fetch($localobject->id);
|
||||
$result=$localobject->update($localobject->id, $user);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::fetch error');
|
||||
$this->assertLessThan($result, 0, 'Holiday::update error');
|
||||
|
||||
print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n";
|
||||
$this->assertEquals($localobject->note, $newobject->note, 'Holiday::update_note error compare note');
|
||||
//print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n";
|
||||
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
||||
$result=$localobject->update_note($localobject->note_private, '_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
|
||||
|
||||
return $localobject;
|
||||
$result=$localobject->update_note($localobject->note_public, '_public');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
|
||||
|
||||
|
||||
$newobject=new Holiday($this->savdb);
|
||||
$result=$newobject->fetch($localobject->id);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::fetch error');
|
||||
|
||||
print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n";
|
||||
$this->assertEquals($localobject->note, $newobject->note, 'Holiday::update_note error compare note');
|
||||
//print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n";
|
||||
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
||||
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,15 +241,15 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHolidayOther($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
//$localobject->fetch($localobject->id);
|
||||
//$localobject->fetch($localobject->id);
|
||||
|
||||
/*
|
||||
/*
|
||||
$result=$localobject->getNomUrl(1);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertNotEquals($result, '');
|
||||
@@ -261,7 +261,7 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
$localobject->info($localobject->id);
|
||||
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
||||
$this->assertNotEquals($localobject->date_creation, '');
|
||||
*/
|
||||
*/
|
||||
|
||||
return $localobject->id;
|
||||
}
|
||||
@@ -277,20 +277,20 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testHolidayDelete($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new Holiday($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
$localobject=new Holiday($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
$result=$localobject->delete(0);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
$result=$localobject->delete(0);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,55 +300,55 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testVerifDateHolidayCP()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
// Create a leave request the 1st morning only
|
||||
$localobjecta=new Holiday($this->savdb);
|
||||
$localobjecta->initAsSpecimen();
|
||||
$localobjecta->date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$localobjecta->date_fin = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$localobjecta->halfday = 1;
|
||||
$result=$localobjecta->create($user);
|
||||
// Create a leave request the 1st morning only
|
||||
$localobjecta=new Holiday($this->savdb);
|
||||
$localobjecta->initAsSpecimen();
|
||||
$localobjecta->date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$localobjecta->date_fin = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$localobjecta->halfday = 1;
|
||||
$result=$localobjecta->create($user);
|
||||
|
||||
// Create a leave request the 2 afternoon only
|
||||
$localobjectb=new Holiday($this->savdb);
|
||||
$localobjectb->initAsSpecimen();
|
||||
$localobjectb->date_debut = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$localobjectb->date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$localobjectb->halfday = -1;
|
||||
$result=$localobjectb->create($user);
|
||||
// Create a leave request the 2 afternoon only
|
||||
$localobjectb=new Holiday($this->savdb);
|
||||
$localobjectb->initAsSpecimen();
|
||||
$localobjectb->date_debut = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$localobjectb->date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$localobjectb->halfday = -1;
|
||||
$result=$localobjectb->create($user);
|
||||
|
||||
$date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
|
||||
$localobjectc=new Holiday($this->savdb);
|
||||
$localobjectc=new Holiday($this->savdb);
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1);
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1);
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1);
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1);
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ImagesLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -76,7 +76,7 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -60,7 +60,7 @@ class ImportTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ImportTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -77,7 +77,7 @@ class ImportTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
//$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -28,16 +28,16 @@ global $conf,$user,$langs,$db;
|
||||
//require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
|
||||
if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
/**
|
||||
@@ -60,11 +60,11 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CoreTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
@@ -94,11 +94,11 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
@@ -109,11 +109,11 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
@@ -135,39 +135,39 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// Do a test with an array starting with 0
|
||||
$arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
|
||||
$arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]';
|
||||
$arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]';
|
||||
|
||||
$encoded=json_encode($arraytotest);
|
||||
$this->assertEquals($arrayencodedexpected,$encoded);
|
||||
$decoded=json_decode($encoded,true);
|
||||
$this->assertEquals($arraytotest,$decoded,'test for json_xxx');
|
||||
$this->assertEquals($arrayencodedexpected, $encoded);
|
||||
$decoded=json_decode($encoded, true);
|
||||
$this->assertEquals($arraytotest, $decoded, 'test for json_xxx');
|
||||
|
||||
$encoded=dol_json_encode($arraytotest);
|
||||
$this->assertEquals($arrayencodedexpected,$encoded);
|
||||
$decoded=dol_json_decode($encoded,true);
|
||||
$this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx');
|
||||
$this->assertEquals($arrayencodedexpected, $encoded);
|
||||
$decoded=dol_json_decode($encoded, true);
|
||||
$this->assertEquals($arraytotest, $decoded, 'test for dol_json_xxx');
|
||||
|
||||
// Same test but array start with 2 instead of 0
|
||||
// Same test but array start with 2 instead of 0
|
||||
$arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
|
||||
$arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}';
|
||||
$arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}';
|
||||
|
||||
$encoded=json_encode($arraytotest);
|
||||
$this->assertEquals($arrayencodedexpected,$encoded);
|
||||
$decoded=json_decode($encoded,true);
|
||||
$this->assertEquals($arraytotest,$decoded,'test for json_xxx');
|
||||
$this->assertEquals($arrayencodedexpected, $encoded);
|
||||
$decoded=json_decode($encoded, true);
|
||||
$this->assertEquals($arraytotest, $decoded, 'test for json_xxx');
|
||||
|
||||
$encoded=dol_json_encode($arraytotest);
|
||||
$this->assertEquals($arrayencodedexpected,$encoded);
|
||||
$decoded=dol_json_decode($encoded,true);
|
||||
$this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx');
|
||||
$this->assertEquals($arrayencodedexpected, $encoded);
|
||||
$decoded=dol_json_decode($encoded, true);
|
||||
$this->assertEquals($arraytotest, $decoded, 'test for dol_json_xxx');
|
||||
|
||||
// Test with object
|
||||
$now=gmmktime(12,0,0,1,1,1970);
|
||||
$now=gmmktime(12, 0, 0, 1, 1, 1970);
|
||||
$objecttotest=new stdClass();
|
||||
$objecttotest->property1='abc';
|
||||
$objecttotest->property2=1234;
|
||||
$objecttotest->property3=$now;
|
||||
$encoded=dol_json_encode($objecttotest);
|
||||
$this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}',$encoded);
|
||||
$this->assertEquals('{"property1":"abc","property2":1234,"property3":43200}', $encoded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class LangTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -87,7 +87,7 @@ class LangTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -58,7 +58,7 @@ class LoanTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return LoanTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,7 +75,7 @@ class LoanTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -58,7 +58,7 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,13 +74,13 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -57,7 +57,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return BuildDocTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,7 +74,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -60,7 +60,7 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ContratTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -77,7 +77,7 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -57,7 +57,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return NumberingModulesTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,7 +74,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
@@ -113,7 +113,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class PaypalTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ProductTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,8 +75,8 @@ class PaypalTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return PdfDocTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -77,8 +77,8 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -60,7 +60,7 @@ class PgsqlTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ContactTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -76,8 +76,8 @@ class PgsqlTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
|
||||
@@ -65,11 +65,11 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return CoreTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
@@ -100,9 +100,9 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@@ -116,9 +116,9 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
@@ -134,68 +134,68 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCalculPriceTotal()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
global $mysoc;
|
||||
$mysoc=new Societe($db);
|
||||
global $mysoc;
|
||||
$mysoc=new Societe($db);
|
||||
|
||||
// To force status that say module multicompany is on
|
||||
//$conf->multicurrency=new stdClass();
|
||||
//$conf->multicurrency->enabled = 0;
|
||||
// To force status that say module multicompany is on
|
||||
//$conf->multicurrency=new stdClass();
|
||||
//$conf->multicurrency->enabled = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Country France
|
||||
*/
|
||||
/*
|
||||
* Country France
|
||||
*/
|
||||
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value)
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value)
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
|
||||
print __METHOD__." result1=".join(', ', $result1)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0, 0, 0, 0, 0, 0, 1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0), $result1, 'Test1 FR');
|
||||
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value)
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value)
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
|
||||
print __METHOD__." result1=".join(', ', $result1)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.57, 9.34795, 0.93479, 10.28274, 18.7, 1.87, 20.57, 0, 0), $result1, 'Test1b FR');
|
||||
|
||||
// qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20);
|
||||
// qty=2, unit_price=0, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value), pu_ht_devise=100
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
$result1=calcul_price_total(2, 0, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205, 20);
|
||||
print __METHOD__." result1=".join(', ', $result1)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(36.63, 3.66, 40.29, 18.31418, 1.83142, 20.1456, 36.63, 3.66, 40.29, 0, 0, 0, 0, 0, 0, 0, 40, 4, 44, 20, 2, 22, 40, 4, 44, 0, 0), $result1, 'Test1c FR');
|
||||
|
||||
/*
|
||||
* Country Spain
|
||||
*/
|
||||
* Country Spain
|
||||
*/
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0), $result2, 'Test1 ES');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (other method autodetect)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0), $result2, 'Test2 ES');
|
||||
@@ -203,76 +203,76 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
// --------------------------------------------------------
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, 1.4, 0, 0, 'HT', 0, 0);
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0), $result2, 'Test3 ES');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0), $result2, 'Test4 ES');
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 19% localtax2 type 5 (method we provide value), we provide a service and not a product
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, 0, -19, 0, 'HT', 0, 1);
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19), $result2, 'Test5 ES for service');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a service and not a product
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0), $result2, 'Test6 ES for product');
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0), $result2, 'Test6 ES for product');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a product and not a service
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 1);
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19), $result2, 'Test6 ES for service');
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19), $result2, 'Test6 ES for service');
|
||||
|
||||
// --------------------------------------------------------
|
||||
// --------------------------------------------------------
|
||||
|
||||
// Credit Note: 10 * -10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 19% localtax2 type 5 (method we provide value), we provide a product and not a service
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, -10, 0, 10, 0, 19, 0, 'HT', 0, 0);
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0), $result2, 'Test7 ES for product');
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0), $result2, 'Test7 ES for product');
|
||||
|
||||
// Credit Note: 10 * -10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect), we provide a service and not a product
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, -10, 0, 10, -1, -1, 0, 'HT', 0, 1);
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
$this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19), $result2, 'Test8 ES for service');
|
||||
print __METHOD__." result2=".join(', ', $result2)."\n";
|
||||
$this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19), $result2, 'Test8 ES for service');
|
||||
|
||||
|
||||
/*
|
||||
@@ -280,23 +280,23 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
|
||||
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (method we provide value)
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
//$localtaxes=getLocalTaxesFromRate(18, 0, null, $mysoc);
|
||||
//var_dump($locataxes);
|
||||
$result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
|
||||
$result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
|
||||
print __METHOD__." result3=".join(', ', $result3)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0), $result3, 'Test9 CI');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect)
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
$mysoc->localtax1_assuj=1;
|
||||
$mysoc->localtax2_assuj=0;
|
||||
$result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
|
||||
print __METHOD__." result3=".join(', ', $result3)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0), $result3, 'Test10 CI');
|
||||
@@ -313,17 +313,17 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdatePrice()
|
||||
{
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
|
||||
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
|
||||
|
||||
// Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode
|
||||
$localobject=new Facture($this->savdb);
|
||||
// Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode
|
||||
$localobject=new Facture($this->savdb);
|
||||
$localobject->initAsSpecimen('nolines');
|
||||
$invoiceid=$localobject->create($user);
|
||||
|
||||
|
||||
@@ -58,11 +58,11 @@ class ProductTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ProductTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
|
||||
@@ -59,7 +59,7 @@ class ProjectTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return ProjectTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -75,13 +75,13 @@ class ProjectTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -58,7 +58,7 @@ class PropalTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return PropalTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -74,13 +74,13 @@ class PropalTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -62,9 +62,9 @@ class RestAPIDocumentTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf = $conf;
|
||||
$this->savuser = $user;
|
||||
|
||||
@@ -62,7 +62,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class ScriptsTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -86,13 +86,13 @@ class ScriptsTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
// tear down after class
|
||||
|
||||
@@ -70,7 +70,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -86,8 +86,8 @@ class SecurityTest extends PHPUnit_Framework_TestCase
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -58,7 +58,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return SocieteTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return PropalTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
@@ -78,7 +78,7 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
@@ -57,7 +57,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return UserGroupTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class UserTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return UserTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ class UtilsTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return UserTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
@@ -67,7 +67,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
parent::__construct();
|
||||
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
@@ -61,7 +61,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return DateLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class XCalLibTest extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @return FilesLibTest
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user