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

This commit is contained in:
Laurent Destailleur 2018-08-21 14:15:22 +02:00
commit 21a9fd625f
100 changed files with 822 additions and 529 deletions

View File

@ -12,6 +12,7 @@
<exclude-pattern type="relative">*/nltechno*</exclude-pattern> <exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern> <exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*.min.css</exclude-pattern> <exclude-pattern type="relative">*.min.css</exclude-pattern>
<exclude-pattern type="relative">*.js</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->
@ -157,7 +158,7 @@
<!-- Disabled as this does not support tab --> <!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> --> <!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
<!-- Rules from PEAR Standard --> <!-- Rules from PEAR Standard -->

View File

@ -359,7 +359,8 @@ class AccountancyCategory // extends CommonObject
* @param int $id Id * @param int $id Id
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function display($id) { public function display($id)
{
global $conf; global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label"; $sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
@ -394,7 +395,8 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function getCptBK($id) { public function getCptBK($id)
{
global $conf; global $conf;
$sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref"; $sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref";
@ -442,8 +444,9 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function getAccountsWithNoCategory($id) { public function getAccountsWithNoCategory($id)
global $conf; {
global $conf;
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte"; $sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
@ -485,7 +488,8 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function updateAccAcc($id_cat, $cpts = array()) { public function updateAccAcc($id_cat, $cpts = array())
{
global $conf; global $conf;
$error = 0; $error = 0;
@ -548,7 +552,8 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function deleteCptCat($cpt_id) { public function deleteCptCat($cpt_id)
{
$error = 0; $error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";

View File

@ -78,7 +78,8 @@ class AccountancyExport
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
public function __construct(DoliDB &$db) { public function __construct(DoliDB &$db)
{
global $conf; global $conf;
$this->db = &$db; $this->db = &$db;
@ -91,7 +92,8 @@ class AccountancyExport
* *
* @return array of type * @return array of type
*/ */
public static function getType() { public static function getType()
{
global $langs; global $langs;
return array ( return array (
@ -113,7 +115,8 @@ class AccountancyExport
* *
* @return array of type * @return array of type
*/ */
public static function getTypeConfig() { public static function getTypeConfig()
{
global $conf, $langs; global $conf, $langs;
return array ( return array (
@ -175,7 +178,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public static function downloadFile() { public static function downloadFile()
{
global $conf; global $conf;
$filename = 'general_ledger'; $filename = 'general_ledger';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
@ -187,7 +191,8 @@ class AccountancyExport
* @param unknown $TData data * @param unknown $TData data
* @return void * @return void
*/ */
public function export(&$TData) { public function export(&$TData)
{
global $conf, $langs; global $conf, $langs;
self::downloadFile(); self::downloadFile();
@ -236,7 +241,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportNormal($objectLines) { public function exportNormal($objectLines)
{
global $conf; global $conf;
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
@ -260,7 +266,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportCegid($objectLines) { public function exportCegid($objectLines)
{
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
$separator = ";"; $separator = ";";
@ -285,7 +292,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportCogilog($objectLines) { public function exportCogilog($objectLines)
{
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
$separator = ";"; $separator = ";";
@ -318,7 +326,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportCoala($objectLines) { public function exportCoala($objectLines)
{
// Coala export // Coala export
$separator = ";"; $separator = ";";
$end_line = "\n"; $end_line = "\n";
@ -345,7 +354,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportBob50($objectLines) { public function exportBob50($objectLines)
{
// Bob50 // Bob50
$separator = ";"; $separator = ";";
@ -383,7 +393,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportCiel(&$TData) { public function exportCiel(&$TData)
{
global $conf; global $conf;
$end_line ="\r\n"; $end_line ="\r\n";
@ -423,7 +434,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportQuadratus(&$TData) { public function exportQuadratus(&$TData)
{
global $conf; global $conf;
$end_line ="\r\n"; $end_line ="\r\n";
@ -506,7 +518,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportEbp($objectLines) { public function exportEbp($objectLines)
{
$separator = ','; $separator = ',';
$end_line = "\n"; $end_line = "\n";
@ -538,7 +551,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportAgiris($objectLines) { public function exportAgiris($objectLines)
{
$separator = ';'; $separator = ';';
$end_line = "\n"; $end_line = "\n";
@ -575,7 +589,8 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportConfigurable($objectLines) { public function exportConfigurable($objectLines)
{
global $conf; global $conf;
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
@ -605,7 +620,8 @@ class AccountancyExport
* @param integer $size data * @param integer $size data
* @return string * @return string
*/ */
public static function trunc($str, $size) { public static function trunc($str, $size)
{
return dol_trunc($str, $size, 'right', 'UTF-8', 1); return dol_trunc($str, $size, 'right', 'UTF-8', 1);
} }
} }

View File

@ -47,7 +47,8 @@ class AccountancySystem
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
function __construct($db) { function __construct($db)
{
$this->db = $db; $this->db = $db;
} }
@ -106,7 +107,8 @@ class AccountancySystem
* @param User $user making insert * @param User $user making insert
* @return int if KO, Id of line if OK * @return int if KO, Id of line if OK
*/ */
function create($user) { function create($user)
{
$now = dol_now(); $now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system"; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";

View File

@ -79,7 +79,8 @@ class AccountingAccount extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) { function __construct($db)
{
global $conf; global $conf;
$this->db = $db; $this->db = $db;
@ -156,7 +157,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) { function create($user, $notrigger = 0)
{
global $conf; global $conf;
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();
@ -307,7 +309,8 @@ class AccountingAccount extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function checkUsage() { function checkUsage()
{
global $langs; global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
@ -340,7 +343,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers * @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) { function delete($user, $notrigger = 0)
{
$error = 0; $error = 0;
$result = $this->checkUsage(); $result = $this->checkUsage();
@ -467,7 +471,8 @@ class AccountingAccount extends CommonObject
* @param int $id of record * @param int $id of record
* @return void * @return void
*/ */
function info($id) { function info($id)
{
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
$sql .= ' WHERE a.rowid = ' . $id; $sql .= ' WHERE a.rowid = ' . $id;
@ -504,7 +509,8 @@ class AccountingAccount extends CommonObject
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_desactivate($id) { function account_desactivate($id)
{
$result = $this->checkUsage(); $result = $this->checkUsage();
if ($result > 0) { if ($result > 0) {
@ -536,7 +542,8 @@ class AccountingAccount extends CommonObject
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_activate($id) { function account_activate($id)
{
$this->db->begin(); $this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";

View File

@ -46,7 +46,8 @@ class AccountingJournal extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) { function __construct($db)
{
$this->db = $db; $this->db = $db;
} }
@ -117,7 +118,8 @@ class AccountingJournal extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
$sql = "SELECT rowid, code, label, nature, active"; $sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter

View File

@ -88,7 +88,8 @@ class BookKeeping extends CommonObject
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
public function __construct(DoliDB $db) { public function __construct(DoliDB $db)
{
$this->db = $db; $this->db = $db;
} }
@ -99,7 +100,8 @@ class BookKeeping extends CommonObject
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
public function create(User $user, $notrigger = false) { public function create(User $user, $notrigger = false)
{
global $conf, $langs; global $conf, $langs;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -420,7 +422,8 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
public function createStd(User $user, $notrigger = false, $mode='') { public function createStd(User $user, $notrigger = false, $mode='')
{
global $conf; global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -590,7 +593,8 @@ class BookKeeping extends CommonObject
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function fetch($id, $ref = null, $mode='') { public function fetch($id, $ref = null, $mode='')
{
global $conf; global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -687,7 +691,8 @@ class BookKeeping extends CommonObject
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
global $conf; global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -811,7 +816,8 @@ class BookKeeping extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public 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')
{
global $conf; global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -1016,7 +1022,8 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function update(User $user, $notrigger = false, $mode='') { public function update(User $user, $notrigger = false, $mode='')
{
$error = 0; $error = 0;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -1185,7 +1192,8 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function delete(User $user, $notrigger = false, $mode='') { public function delete(User $user, $notrigger = false, $mode='')
{
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0; $error = 0;
@ -1234,7 +1242,8 @@ class BookKeeping extends CommonObject
* @param string $importkey Import key * @param string $importkey Import key
* @return int Result * @return int Result
*/ */
function deleteByImportkey($importkey) { function deleteByImportkey($importkey)
{
$this->db->begin(); $this->db->begin();
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
@ -1263,7 +1272,8 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function deleteByYearAndJournal($delyear='', $journal='', $mode='') { function deleteByYearAndJournal($delyear='', $journal='', $mode='')
{
global $conf; global $conf;
if (empty($delyear) && empty($journal)) if (empty($delyear) && empty($journal))
@ -1302,7 +1312,8 @@ class BookKeeping extends CommonObject
* @param int $piecenum Piecenum to delete * @param int $piecenum Piecenum to delete
* @return int Result * @return int Result
*/ */
function deleteMvtNum($piecenum) { function deleteMvtNum($piecenum)
{
global $conf; global $conf;
$this->db->begin(); $this->db->begin();
@ -1336,7 +1347,8 @@ class BookKeeping extends CommonObject
* *
* @return int New id of clone * @return int New id of clone
*/ */
public function createFromClone($fromid) { public function createFromClone($fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
global $user; global $user;
@ -1381,7 +1393,8 @@ class BookKeeping extends CommonObject
* *
* @return void * @return void
*/ */
public function initAsSpecimen() { public function initAsSpecimen()
{
global $user; global $user;
$now=dol_now(); $now=dol_now();
@ -1417,7 +1430,8 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchPerMvt($piecenum, $mode='') { public function fetchPerMvt($piecenum, $mode='')
{
global $conf; global $conf;
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation"; $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
@ -1481,7 +1495,8 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAllPerMvt($piecenum, $mode='') { function fetchAllPerMvt($piecenum, $mode='')
{
global $conf; global $conf;
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
@ -1539,7 +1554,8 @@ class BookKeeping extends CommonObject
* @param string $model Model * @param string $model Model
* @return int Result * @return int Result
*/ */
function export_bookkeping($model = 'ebp') { function export_bookkeping($model = 'ebp')
{
global $conf; global $conf;
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
@ -1696,7 +1712,8 @@ class BookKeeping extends CommonObject
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{
global $conf; global $conf;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';

View File

@ -91,7 +91,8 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -293,7 +294,8 @@ class Members extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -31,7 +31,7 @@ class MembersTypes extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'label' 'label',
); );
/** /**
@ -86,7 +86,8 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -271,7 +272,8 @@ class MembersTypes extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -34,7 +34,7 @@ class Subscriptions extends DolibarrApi
'fk_adherent', 'fk_adherent',
'dateh', 'dateh',
'datef', 'datef',
'amount' 'amount',
); );
/** /**
@ -85,7 +85,8 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();

View File

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

View File

@ -94,7 +94,8 @@ class DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
// Remove $db object property for object // Remove $db object property for object
unset($object->db); unset($object->db);
@ -220,7 +221,8 @@ class DolibarrApi
* @return bool * @return bool
* @throws RestException * @throws RestException
*/ */
static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') { static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
{
// Features/modules to check // Features/modules to check
$featuresarray = array($resource); $featuresarray = array($resource);

View File

@ -26,7 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
class Login class Login
{ {
function __construct() { function __construct()
{
global $db; global $db;
$this->db = $db; $this->db = $db;
} }
@ -51,7 +52,8 @@ class Login
* @url GET / * @url GET /
* @url POST / * @url POST /
*/ */
public function index($login, $password, $entity='', $reset=0) { public function index($login, $password, $entity='', $reset=0)
{
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;

View File

@ -26,19 +26,21 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
*/ */
class Status class Status
{ {
/** /**
* Get status (Dolibarr version) * Get status (Dolibarr version)
*
* @return array * @return array
*/ */
function index() { function index()
global $conf; {
global $conf;
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'dolibarr_version' => DOL_VERSION, 'dolibarr_version' => DOL_VERSION,
'access_locked' => (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)?'0':$conf->global->MAIN_ONLY_LOGIN_ALLOWED) 'access_locked' => (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)?'0':$conf->global->MAIN_ONLY_LOGIN_ALLOWED),
) ),
); );
} }
} }

View File

@ -50,7 +50,8 @@ class BlockedLogAuthority
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct($db) { public function __construct($db)
{
$this->db = $db; $this->db = $db;
@ -61,7 +62,8 @@ class BlockedLogAuthority
* *
* @return string blockchain * @return string blockchain
*/ */
public function getLocalBlockChain() { public function getLocalBlockChain()
{
$block_static = new BlockedLog($this->db); $block_static = new BlockedLog($this->db);
@ -84,7 +86,8 @@ class BlockedLogAuthority
* *
* @return string hash md5 of blockchain * @return string hash md5 of blockchain
*/ */
public function getBlockchainHash() { public function getBlockchainHash()
{
return md5($this->signature.$this->blockchain); return md5($this->signature.$this->blockchain);
@ -96,7 +99,8 @@ class BlockedLogAuthority
* @param string $hash hash md5 of blockchain to test * @param string $hash hash md5 of blockchain to test
* @return boolean * @return boolean
*/ */
public function checkBlockchain($hash) { public function checkBlockchain($hash)
{
return ($hash === $this->getBlockchainHash() ); return ($hash === $this->getBlockchainHash() );
@ -108,7 +112,8 @@ class BlockedLogAuthority
* @param string $block new block to chain * @param string $block new block to chain
* @return void * @return void
*/ */
public function addBlock($block) { public function addBlock($block)
{
$this->blockchain.=$block; $this->blockchain.=$block;
@ -120,7 +125,8 @@ class BlockedLogAuthority
* @param string $block new block to chain * @param string $block new block to chain
* @return boolean * @return boolean
*/ */
public function checkBlock($block) { public function checkBlock($block)
{
if(strlen($block)!=64) return false; if(strlen($block)!=64) return false;
@ -142,7 +148,8 @@ class BlockedLogAuthority
* @param string $signature Signature of object to load * @param string $signature Signature of object to load
* @return int >0 if OK, <0 if KO, 0 if not found * @return int >0 if OK, <0 if KO, 0 if not found
*/ */
public function fetch($id, $signature='') { public function fetch($id, $signature='')
{
global $langs; global $langs;
@ -199,7 +206,8 @@ class BlockedLogAuthority
* @param User $user Object user that create * @param User $user Object user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function create($user) { public function create($user)
{
global $conf,$langs,$hookmanager; global $conf,$langs,$hookmanager;
@ -253,7 +261,8 @@ class BlockedLogAuthority
* @param User $user Object user that create * @param User $user Object user that create
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function update($user) { public function update($user)
{
global $conf,$langs,$hookmanager; global $conf,$langs,$hookmanager;
@ -290,7 +299,8 @@ class BlockedLogAuthority
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function syncSignatureWithAuthority() { public function syncSignatureWithAuthority()
{
global $conf, $langs; global $conf, $langs;
//TODO create cron task on activation //TODO create cron task on activation

View File

@ -608,7 +608,8 @@ class BlockedLog
* @param int $id Id of object to load * @param int $id Id of object to load
* @return int >0 if OK, <0 if KO, 0 if not found * @return int >0 if OK, <0 if KO, 0 if not found
*/ */
public function fetch($id) { public function fetch($id)
{
global $langs; global $langs;
@ -704,7 +705,8 @@ class BlockedLog
* *
* @return boolean * @return boolean
*/ */
public function setCertified() { public function setCertified()
{
$res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".$this->id); $res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".$this->id);
if($res===false) return false; if($res===false) return false;
@ -721,7 +723,8 @@ class BlockedLog
* @param int $forcesignature Force signature (for example '0000000000' when we disabled the module) * @param int $forcesignature Force signature (for example '0000000000' when we disabled the module)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function create($user, $forcesignature='') { public function create($user, $forcesignature='')
{
global $conf,$langs,$hookmanager; global $conf,$langs,$hookmanager;

View File

@ -310,7 +310,7 @@ class Facturation
* @return string Ref * @return string Ref
*/ */
public function ref($aRef=null) public function ref($aRef=null)
{ {
if (is_null($aRef)) if (is_null($aRef))
{ {
@ -652,7 +652,7 @@ class Facturation
{ {
return $this->prix_total_ttc; return $this->prix_total_ttc;
} }
else if ( $aTotalTtc == 'RESET' ) elseif ( $aTotalTtc == 'RESET' )
{ {
$this->prix_total_ttc = null; $this->prix_total_ttc = null;
} }
@ -663,4 +663,3 @@ class Facturation
} }
} }

View File

@ -103,7 +103,8 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -266,7 +267,8 @@ class Categories extends DolibarrApi
* @param Categorie $object Object to clean * @param Categorie $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -46,8 +46,8 @@ class AgendaEvents extends DolibarrApi
*/ */
function __construct() function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
$this->actioncomm = new ActionComm($this->db); $this->actioncomm = new ActionComm($this->db);
} }
@ -99,13 +99,14 @@ class AgendaEvents extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')"
* @return array Array of Agenda Events objects * @return array Array of Agenda Events objects
*/ */
function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') { function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
throw new RestException(401, "Insuffisant rights to read events"); throw new RestException(401, "Insuffisant rights to read events");
} }
// case of external user // case of external user
@ -226,7 +227,8 @@ class AgendaEvents extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event"); throw new RestException(401, "Insuffisant rights to create your Agenda Event");
} }
@ -319,7 +321,8 @@ class AgendaEvents extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -925,7 +925,8 @@ class AdvanceTargetingMailing extends CommonObject
* For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima * For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima
* @return string Sql to use for the where condition * @return string Sql to use for the where condition
*/ */
public function transformToSQL($column_to_test,$criteria) { public function transformToSQL($column_to_test,$criteria)
{
$return_sql_criteria = '('; $return_sql_criteria = '(';
//This is a multiple value test //This is a multiple value test

View File

@ -37,7 +37,8 @@ class FormAdvTargetEmailing extends Form
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
function __construct($db) { function __construct($db)
{
global $langs; global $langs;
$this->db = $db; $this->db = $db;
@ -50,7 +51,8 @@ class FormAdvTargetEmailing extends Form
* @param string $htmlname select field * @param string $htmlname select field
* @return string select field * @return string select field
*/ */
function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') { function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status')
{
global $conf, $langs; global $conf, $langs;
$options_array = array(); $options_array = array();
@ -86,7 +88,8 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array or Code or Label of preselected country * @param array $selected_array or Code or Label of preselected country
* @return string HTML string with select * @return string HTML string with select
*/ */
function multiselectCountry($htmlname = 'country_id', $selected_array=array()) { function multiselectCountry($htmlname = 'country_id', $selected_array=array())
{
global $conf, $langs; global $conf, $langs;
$langs->load("dict"); $langs->load("dict");
@ -146,7 +149,8 @@ class FormAdvTargetEmailing extends Form
* @param User $user User action * @param User $user User action
* @return string combo list code * @return string combo list code
*/ */
function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) { function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user)
{
global $conf; global $conf;
@ -187,7 +191,8 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array selected array * @param array $selected_array selected array
* @return string combo list code * @return string combo list code
*/ */
function multiselectselectLanguage($htmlname='', $selected_array=array()) { function multiselectselectLanguage($htmlname='', $selected_array=array())
{
global $conf,$langs; global $conf,$langs;
@ -333,7 +338,8 @@ class FormAdvTargetEmailing extends Form
* @param int $showempty show empty * @param int $showempty show empty
* @return string HTML combo * @return string HTML combo
*/ */
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) { function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0)
{
global $conf, $langs; global $conf, $langs;
$form=new Form($this->db); $form=new Form($this->db);
@ -420,7 +426,8 @@ class FormAdvTargetEmailing extends Form
* @param string $type_element Type element. Example: 'mailing' * @param string $type_element Type element. Example: 'mailing'
* @return string HTML combo * @return string HTML combo
*/ */
public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') { public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing')
{
global $conf, $user, $langs; global $conf, $user, $langs;
$out = ''; $out = '';

View File

@ -97,7 +97,8 @@ class Proposals extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects * @return array Array of order objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -215,7 +216,8 @@ class Proposals extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->propal->lire) { if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -381,7 +383,8 @@ class Proposals extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) { function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -415,7 +418,8 @@ class Proposals extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) { if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -703,23 +707,24 @@ class Proposals extends DolibarrApi
} }
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);
unset($object->name); unset($object->name);
unset($object->lastname); unset($object->lastname);
unset($object->firstname); unset($object->firstname);
unset($object->civility_id); unset($object->civility_id);
unset($object->address); unset($object->address);
return $object; return $object;
} }
} }

View File

@ -3144,7 +3144,7 @@ class Propal extends CommonObject
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin"; $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -3188,6 +3188,8 @@ class Propal extends CommonObject
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;
$response->total+=$obj->total_ht;
if ($mode == 'opened') if ($mode == 'opened')
{ {
$datelimit = $this->db->jdate($obj->datefin); $datelimit = $this->db->jdate($obj->datefin);

View File

@ -97,9 +97,10 @@ class Orders extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of order objects * @return array Array of order objects
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -218,7 +219,8 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -249,7 +251,8 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -311,7 +314,8 @@ class Orders extends DolibarrApi
* *
* @return object * @return object
*/ */
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -371,7 +375,8 @@ class Orders extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) { function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -403,7 +408,8 @@ class Orders extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->commande->creer) { if (! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -544,7 +550,8 @@ class Orders extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function reopen($id) { function reopen($id)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@ -581,7 +588,8 @@ class Orders extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function setinvoiced($id) { function setinvoiced($id)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
@ -706,21 +714,22 @@ class Orders extends DolibarrApi
} }
/** /**
* Create an order using an existing proposal. * Create an order using an existing proposal.
* *
* *
* @param int $proposalid Id of the proposal * @param int $proposalid Id of the proposal
* *
* @url POST /createfromproposal/{proposalid} * @url POST /createfromproposal/{proposalid}
* *
* @return int * @return int
* @throws 400 * @throws 400
* @throws 401 * @throws 401
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function createOrderFromProposal($proposalid) { function createOrderFromProposal($proposalid)
{
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
@ -756,7 +765,8 @@ class Orders extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -3243,7 +3243,7 @@ class Commande extends CommonOrder
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut"; $sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -3270,6 +3270,7 @@ class Commande extends CommonOrder
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;
$response->total+= $obj->total_ht;
$generic_commande->statut = $obj->fk_statut; $generic_commande->statut = $obj->fk_statut;
$generic_commande->date_commande = $this->db->jdate($obj->date_commande); $generic_commande->date_commande = $this->db->jdate($obj->date_commande);

View File

@ -945,7 +945,8 @@ class Account extends CommonObject
* @param int[]|int $categories Category or categories IDs * @param int[]|int $categories Category or categories IDs
* @return void * @return void
*/ */
public function setCategories($categories) { public function setCategories($categories)
{
// Handle single category // Handle single category
if (! is_array($categories)) { if (! is_array($categories)) {
$categories = array($categories); $categories = array($categories);

View File

@ -32,7 +32,7 @@ class Invoices extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'socid' 'socid',
); );
/** /**
@ -104,7 +104,8 @@ class Invoices extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -245,7 +246,8 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function createInvoiceFromOrder($orderid) { function createInvoiceFromOrder($orderid)
{
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
@ -282,7 +284,8 @@ class Invoices extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -319,7 +322,8 @@ class Invoices extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -383,7 +387,8 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function deleteLine($id, $lineid) { function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -511,7 +516,8 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 400 * @throws 400
*/ */
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -849,7 +855,8 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function useDiscount($id, $discountid) { function useDiscount($id, $discountid)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
@ -894,7 +901,8 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function useCreditNote($id, $discountid) { function useCreditNote($id, $discountid)
{
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
@ -938,7 +946,8 @@ class Invoices extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function getPayments($id) { function getPayments($id)
{
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
@ -985,8 +994,9 @@ class Invoices extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') { function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='')
global $conf; {
global $conf;
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
@ -1215,18 +1225,19 @@ class Invoices extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);
unset($object->address); unset($object->address);
unset($object->barcode_type); unset($object->barcode_type);
unset($object->barcode_type_code); unset($object->barcode_type_code);
unset($object->barcode_type_label); unset($object->barcode_type_label);
unset($object->barcode_type_coder); unset($object->barcode_type_coder);
return $object; return $object;
} }
/** /**
@ -1241,8 +1252,9 @@ class Invoices extends DolibarrApi
{ {
$invoice = array(); $invoice = array();
foreach (Invoices::$FIELDS as $field) { foreach (Invoices::$FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field])) {
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
}
$invoice[$field] = $data[$field]; $invoice[$field] = $data[$field];
} }
return $invoice; return $invoice;

View File

@ -3726,7 +3726,7 @@ class Facture extends CommonInvoice
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut"; $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -3759,6 +3759,7 @@ class Facture extends CommonInvoice
$generic_facture->statut = $obj->fk_statut; $generic_facture->statut = $obj->fk_statut;
$response->nbtodo++; $response->nbtodo++;
$response->total += $obj->total;
if ($generic_facture->hasDelay()) { if ($generic_facture->hasDelay()) {
$response->nbtodolate++; $response->nbtodolate++;

View File

@ -100,7 +100,8 @@ class Contracts extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -216,7 +217,8 @@ class Contracts extends DolibarrApi
* *
* @return int * @return int
*/ */
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->contrat->lire) { if(! DolibarrApiAccess::$user->rights->contrat->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -247,7 +249,8 @@ class Contracts extends DolibarrApi
* *
* @return int * @return int
*/ */
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -300,7 +303,8 @@ class Contracts extends DolibarrApi
* *
* @return object * @return object
*/ */
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -359,7 +363,8 @@ class Contracts extends DolibarrApi
* *
* @return object * @return object
*/ */
function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) { function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -396,7 +401,8 @@ class Contracts extends DolibarrApi
* *
* @return object * @return object
*/ */
function unactivateLine($id, $lineid, $datestart, $comment = null) { function unactivateLine($id, $lineid, $datestart, $comment = null)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -436,7 +442,8 @@ class Contracts extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) { function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -470,7 +477,8 @@ class Contracts extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) { if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -632,7 +640,8 @@ class Contracts extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -2350,7 +2350,8 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int New id of clone * @return int New id of clone
*/ */
function createFromClone($socid = 0, $notrigger=0) { function createFromClone($socid = 0, $notrigger=0)
{
global $db, $user, $langs, $conf, $hookmanager; global $db, $user, $langs, $conf, $hookmanager;
dol_include_once('/projet/class/project.class.php'); dol_include_once('/projet/class/project.class.php');

View File

@ -42,9 +42,10 @@ abstract class CommonDocGenerator
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct($db) { public function __construct($db)
$this->db = $db; {
} $this->db = $db;
}
/** /**
@ -228,7 +229,8 @@ abstract class CommonDocGenerator
* @param array_key $array_key Name of the key for return array * @param array_key $array_key Name of the key for return array
* @return array of substitution key->code * @return array of substitution key->code
*/ */
function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
{
global $conf; global $conf;
if(empty($object->country) && ! empty($object->country_code)) if(empty($object->country) && ! empty($object->country_code))
@ -652,7 +654,8 @@ abstract class CommonDocGenerator
* @param boolean $recursive Want to fetch child array or child object * @param boolean $recursive Want to fetch child array or child object
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) { function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true)
{
$array_other = array(); $array_other = array();
if(!empty($object)) { if(!empty($object)) {
foreach($object as $key => $value) { foreach($object as $key => $value) {
@ -769,10 +772,9 @@ abstract class CommonDocGenerator
*/ */
function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
{ {
if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
$pdf->line($x+$l, $y, $x+$l, $y+$h); $pdf->line($x+$l, $y, $x+$l, $y+$h);
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
$pdf->line($x, $y+$h, $x, $y); $pdf->line($x, $y+$h, $x, $y);
} }
} }

View File

@ -6874,7 +6874,8 @@ abstract class CommonObject
* @param array $fieldsentry Properties of field * @param array $fieldsentry Properties of field
* @return string * @return string
*/ */
protected function quote($value, $fieldsentry) { protected function quote($value, $fieldsentry)
{
if (is_null($value)) return 'NULL'; if (is_null($value)) return 'NULL';
else if (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); else if (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value");
else return "'".$this->db->escape($value)."'"; else return "'".$this->db->escape($value)."'";

View File

@ -216,7 +216,7 @@ abstract class CommonStickerGenerator
* @param string $dest to * @param string $dest to
* @return float value value after conversion * @return float value value after conversion
*/ */
function _Convert_Metric ($value, $src, $dest) function _Convert_Metric($value, $src, $dest)
{ {
if ($src != $dest) { if ($src != $dest) {
$tab['in'] = 39.37008; $tab['in'] = 39.37008;

View File

@ -216,7 +216,8 @@ class FormAccounting extends Form
* @param string $selectedkey Value * @param string $selectedkey Value
* @return string HTML edit field * @return string HTML edit field
*/ */
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
{
$options = array(); $options = array();
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
@ -339,7 +340,8 @@ class FormAccounting extends Form
* @param string $morecss More css * @param string $morecss More css
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') { function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200')
{
$aux_account = array(); $aux_account = array();
@ -428,4 +430,3 @@ class FormAccounting extends Form
} }
} }
} }

View File

@ -23,7 +23,7 @@
require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
/** /**
* Class to offer components to list and upload files * Class to offer components to list and upload files
*/ */
class FormMailing extends Form class FormMailing extends Form
{ {
@ -37,7 +37,8 @@ class FormMailing extends Form
* @param integer $show_empty Show empty option * @param integer $show_empty Show empty option
* @return string HTML select * @return string HTML select
*/ */
public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) { public function selectDestinariesStatus($selectedid='', $htmlname='dest_status', $show_empty=0)
{
global $langs; global $langs;
$langs->load("mails"); $langs->load("mails");
@ -54,5 +55,5 @@ class FormMailing extends Form
$options = $options + $mailing->statut_dest; $options = $options + $mailing->statut_dest;
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1); return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
} }
} }

View File

@ -370,7 +370,8 @@ class Ldap
* *
* @return boolean version * @return boolean version
*/ */
function setVersion() { function setVersion()
{
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17 // LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
$ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion); $ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
return $ldapsetversion; return $ldapsetversion;
@ -381,7 +382,8 @@ class Ldap
* *
* @return boolean referrals * @return boolean referrals
*/ */
function setReferrals() { function setReferrals()
{
// LDAP_OPT_REFERRALS est une constante qui vaut ? // LDAP_OPT_REFERRALS est une constante qui vaut ?
$ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0); $ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
return $ldapreferrals; return $ldapreferrals;

View File

@ -30,8 +30,8 @@ class SimpleOpenID
var $URLs = array(); var $URLs = array();
var $error = array(); var $error = array();
var $fields = array( var $fields = array(
'required' => array(), 'required' => array(),
'optional' => array(), 'optional' => array(),
); );
/** /**
@ -126,7 +126,8 @@ class SimpleOpenID
* @return void * @return void
*/ */
function SetIdentity($a) function SetIdentity($a)
{ // Set Identity URL {
// Set Identity URL
if ((stripos($a, 'http://') === false) if ((stripos($a, 'http://') === false)
&& (stripos($a, 'https://') === false)){ && (stripos($a, 'https://') === false)){
$a = 'http://'.$a; $a = 'http://'.$a;
@ -153,7 +154,8 @@ class SimpleOpenID
* @return string * @return string
*/ */
function GetIdentity() function GetIdentity()
{ // Get Identity {
// Get Identity
return $this->openid_url_identity; return $this->openid_url_identity;
} }
@ -254,7 +256,8 @@ class SimpleOpenID
* @return false|string false if KO, string of url if OK * @return false|string false if KO, string of url if OK
*/ */
function array2url($arr) function array2url($arr)
{ // converts associated array to URL Query String {
// converts associated array to URL Query String
if (!is_array($arr)){ if (!is_array($arr)){
return false; return false;
} }
@ -306,7 +309,8 @@ class SimpleOpenID
* @return string * @return string
*/ */
function CURL_Request($url, $method="GET", $params = "") function CURL_Request($url, $method="GET", $params = "")
{ // Remember, SSL MUST BE SUPPORTED {
// Remember, SSL MUST BE SUPPORTED
if (is_array($params)) $params = $this->array2url($params); if (is_array($params)) $params = $this->array2url($params);
$curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : "")); $curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : ""));
@ -361,7 +365,7 @@ class SimpleOpenID
*/ */
function GetOpenIDServer($url='') function GetOpenIDServer($url='')
{ {
global $conf; global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL; if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
@ -522,4 +526,3 @@ class SimpleOpenID
} }
} }

View File

@ -1650,7 +1650,7 @@ class SMTPs
* @param integer $_value Message Priority * @param integer $_value Message Priority
* @return void * @return void
*/ */
function setPriority ( $_value = 3 ) function setPriority( $_value = 3 )
{ {
if ( ( is_numeric($_value) ) && if ( ( is_numeric($_value) ) &&
( ( $_value >= 0 ) && ( $_value <= 5 ) ) ) ( ( $_value >= 0 ) && ( $_value <= 5 ) ) )
@ -1814,12 +1814,14 @@ class SMTPs
* @param int $_errNum Error Code Number * @param int $_errNum Error Code Number
* @param string $_errMsg Error Message * @param string $_errMsg Error Message
* @return void * @return void
*/ */
function _setErr ( $_errNum, $_errMsg ) function _setErr( $_errNum, $_errMsg )
{ {
$this->_smtpsErrors[] = array( 'num' => $_errNum, $this->_smtpsErrors[] = array(
'msg' => $_errMsg ); 'num' => $_errNum,
} 'msg' => $_errMsg,
);
}
/** /**
* Returns errors codes and messages for Class * Returns errors codes and messages for Class
@ -2049,4 +2051,3 @@ class SMTPs
* - basic shell with some commets * - basic shell with some commets
* *
*/ */

View File

@ -677,7 +677,8 @@ class Utils
* *
* @return int 0 if OK, < 0 if KO * @return int 0 if OK, < 0 if KO
*/ */
function compressSyslogs() { function compressSyslogs()
{
global $conf; global $conf;
if(empty($conf->loghandlers['mod_syslog_file'])) { // File Syslog disabled if(empty($conf->loghandlers['mod_syslog_file'])) { // File Syslog disabled

View File

@ -111,12 +111,13 @@ class vCard
* mise en forme de la photo * mise en forme de la photo
* warning NON TESTE ! * warning NON TESTE !
* *
* @param string $type Type * @param string $type Type
* @param string $photo Photo * @param string $photo Photo
* @return void * @return void
*/ */
function setPhoto($type, $photo) function setPhoto($type, $photo)
{ // $type = "GIF" | "JPEG" {
// $type = "GIF" | "JPEG"
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); $this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
} }
@ -200,7 +201,8 @@ class vCard
* @param string $type Type * @param string $type Type
* @return void * @return void
*/ */
function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") { function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL")
{
$label = ""; $label = "";
if ($postoffice!="") $label.= "$postoffice\r\n"; if ($postoffice!="") $label.= "$postoffice\r\n";
if ($extended!="") $label.= "$extended\r\n"; if ($extended!="") $label.= "$extended\r\n";

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> /* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -66,4 +67,10 @@ class WorkboardResponse
*/ */
public $nbtodolate = 0; public $nbtodolate = 0;
/**
* total price of items
* @var int
*/
public $total = 0;
} }

View File

@ -1138,7 +1138,8 @@ class DoliDBMssql extends DoliDB
* @param string $fieldname Field's name to escape * @param string $fieldname Field's name to escape
* @return string field's name escaped * @return string field's name escaped
*/ */
function EscapeFieldName($fieldname) { function EscapeFieldName($fieldname)
{
return "[".$fieldname."]"; return "[".$fieldname."]";
} }
@ -1150,7 +1151,8 @@ class DoliDBMssql extends DoliDB
* @param mixed $fields String for one field or array of string for multiple field * @param mixed $fields String for one field or array of string for multiple field
* @return false|object * @return false|object
*/ */
function GetFieldInformation($table,$fields) { function GetFieldInformation($table,$fields)
{
$sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME";
if (is_array($fields)) if (is_array($fields))
{ {
@ -1176,4 +1178,3 @@ class DoliDBMssql extends DoliDB
} }
} }

View File

@ -1302,7 +1302,8 @@ class DoliDBSqlite3 extends DoliDB
* @param int $day Day * @param int $day Day
* @return int Formatted date * @return int Formatted date
*/ */
private static function calc_daynr($year, $month, $day) { private static function calc_daynr($year, $month, $day)
{
$y = $year; $y = $year;
if ($y == 0 && $month == 0) return 0; if ($y == 0 && $month == 0) return 0;
$num = (365* $y + 31 * ($month - 1) + $day); $num = (365* $y + 31 * ($month - 1) + $day);
@ -1322,7 +1323,8 @@ class DoliDBSqlite3 extends DoliDB
* @param bool $sunday_first_day_of_week ??? * @param bool $sunday_first_day_of_week ???
* @return int * @return int
*/ */
private static function calc_weekday($daynr, $sunday_first_day_of_week) { private static function calc_weekday($daynr, $sunday_first_day_of_week)
{
$ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7);
return $ret; return $ret;
} }
@ -1348,7 +1350,8 @@ class DoliDBSqlite3 extends DoliDB
* @param string $calc_year ??? * @param string $calc_year ???
* @return string ??? * @return string ???
*/ */
private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) { private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year)
{
$daynr=self::calc_daynr($year,$month,$day); $daynr=self::calc_daynr($year,$month,$day);
$first_daynr=self::calc_daynr($year,1,1); $first_daynr=self::calc_daynr($year,1,1);
$monday_first= ($week_behaviour & self::WEEK_MONDAY_FIRST) ? 1 : 0; $monday_first= ($week_behaviour & self::WEEK_MONDAY_FIRST) ? 1 : 0;
@ -1388,4 +1391,3 @@ class DoliDBSqlite3 extends DoliDB
} }
} }

View File

@ -399,7 +399,7 @@ EOF;
* @param string $customMsg customMsg * @param string $customMsg customMsg
* @return void * @return void
*/ */
function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') function SendCKEditorResults($callback, $sFileUrl, $customMsg = '')
{ {
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
@ -409,5 +409,3 @@ function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '')
echo '</script>'; echo '</script>';
} }

View File

@ -161,7 +161,8 @@ function bank_admin_prepare_head($object)
* @param Object $object Object related to tabs * @param Object $object Object related to tabs
* @return array Array of tabs to shoc * @return array Array of tabs to shoc
*/ */
function various_payment_prepare_head($object) { function various_payment_prepare_head($object)
{
global $db, $langs, $conf; global $db, $langs, $conf;
@ -369,4 +370,3 @@ function checkES($IentOfi, $InumCta)
$keycontrol .= $key; $keycontrol .= $key;
return $keycontrol; return $keycontrol;
} }

View File

@ -85,7 +85,8 @@ function expensereport_prepare_head($object)
* @param Paiement $object Current payment object * @param Paiement $object Current payment object
* @return array Tabs for the payment section * @return array Tabs for the payment section
*/ */
function payment_expensereport_prepare_head(PaymentExpenseReport $object) { function payment_expensereport_prepare_head(PaymentExpenseReport $object)
{
global $langs, $conf; global $langs, $conf;
@ -168,5 +169,5 @@ function expensereport_admin_prepare_head()
complete_head_from_modules($conf,$langs,null,$head,$h,'expensereport_admin','remove'); complete_head_from_modules($conf,$langs,null,$head,$h,'expensereport_admin','remove');
return $head; return $head;
} }

View File

@ -163,7 +163,7 @@ function fichinter_admin_prepare_head()
return $head; return $head;
} }
function fichinter_rec_prepare_head ($object) function fichinter_rec_prepare_head($object)
{ {
global $langs, $conf; //, $user; global $langs, $conf; //, $user;
@ -182,4 +182,3 @@ function fichinter_rec_prepare_head ($object)
return $head; return $head;
} }

View File

@ -1167,7 +1167,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
return $numFinal; return $numFinal;
} }
function get_string_between($string, $start, $end){ function get_string_between($string, $start, $end)
{
$string = " ".$string; $string = " ".$string;
$ini = strpos($string,$start); $ini = strpos($string,$start);
if ($ini == 0) return ""; if ($ini == 0) return "";
@ -2197,7 +2198,8 @@ function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
* @param array $input Array of products * @param array $input Array of products
* @return array Array of combinations * @return array Array of combinations
*/ */
function cartesianArray(array $input) { function cartesianArray(array $input)
{
// filter out empty values // filter out empty values
$input = array_filter($input); $input = array_filter($input);
@ -2305,8 +2307,9 @@ function getModuleDirForApiClass($module)
* @param $max int Between 0 and 255 * @param $max int Between 0 and 255
* @return String * @return String
*/ */
function random_color_part($min=0,$max=255) { function random_color_part($min=0,$max=255)
return str_pad( dechex( mt_rand( $min, $max) ), 2, '0', STR_PAD_LEFT); {
return str_pad( dechex( mt_rand( $min, $max) ), 2, '0', STR_PAD_LEFT);
} }
/* /*
@ -2316,6 +2319,7 @@ function random_color_part($min=0,$max=255) {
* @param $max int Between 0 and 255 * @param $max int Between 0 and 255
* @return String * @return String
*/ */
function random_color($min=0, $max=255) { function random_color($min=0, $max=255)
return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); {
return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max);
} }

View File

@ -24,7 +24,8 @@
* @param Paiement $object Current payment object * @param Paiement $object Current payment object
* @return array Tabs for the payment section * @return array Tabs for the payment section
*/ */
function payment_prepare_head(Paiement $object) { function payment_prepare_head(Paiement $object)
{
global $langs, $conf; global $langs, $conf;
@ -59,7 +60,8 @@ function payment_prepare_head(Paiement $object) {
* @param Paiement $object Current payment object * @param Paiement $object Current payment object
* @return array Tabs for the payment section * @return array Tabs for the payment section
*/ */
function payment_supplier_prepare_head(Paiement $object) { function payment_supplier_prepare_head(Paiement $object)
{
global $langs, $conf; global $langs, $conf;

View File

@ -87,7 +87,8 @@ function resource_prepare_head($object)
return $head; return $head;
} }
function resource_admin_prepare_head() { function resource_admin_prepare_head()
{
global $langs, $conf, $user; global $langs, $conf, $user;

View File

@ -24,7 +24,8 @@
* @param Paiement $object Current salaries object * @param Paiement $object Current salaries object
* @return array Tabs for the salaries section * @return array Tabs for the salaries section
*/ */
function salaries_prepare_head($object) { function salaries_prepare_head($object)
{
global $db, $langs, $conf; global $db, $langs, $conf;

View File

@ -42,7 +42,8 @@ class pdf_standard extends CommonStickerGenerator
* @param array $param Associative array containing label content and optional parameters * @param array $param Associative array containing label content and optional parameters
* @return void * @return void
*/ */
function addSticker(&$pdf,$outputlangs,$param) { function addSticker(&$pdf,$outputlangs,$param)
{
// use this method in future refactoring // use this method in future refactoring
} }

View File

@ -51,7 +51,7 @@ class modBlockedLog extends DolibarrModules
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Enable a log on some business events into a non reversible log. This module may be mandatory for some countries."; $this->description = "Enable a log on some business events into a non reversible log. This module may be mandatory for some countries.";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
@ -145,7 +145,8 @@ class modBlockedLog extends DolibarrModules
* *
* @return boolean True if already used, otherwise False * @return boolean True if already used, otherwise False
*/ */
function alreadyUsed() { function alreadyUsed()
{
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$b=new BlockedLog($this->db); $b=new BlockedLog($this->db);
@ -204,7 +205,8 @@ class modBlockedLog extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes') * @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */
function remove($options = '') { function remove($options = '')
{
global $conf, $user; global $conf, $user;

View File

@ -40,7 +40,7 @@ class modOauth extends DolibarrModules
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {
$this->db = $db ; $this->db = $db ;
$this->numero = 66000; $this->numero = 66000;
@ -52,7 +52,7 @@ class modOauth extends DolibarrModules
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Enable OAuth authentication"; $this->description = "Enable OAuth authentication";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module. // Name of image file used for this module.

View File

@ -40,7 +40,7 @@ class modPrinting extends DolibarrModules
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {
$this->db = $db ; $this->db = $db ;
$this->numero = 64000; $this->numero = 64000;
@ -50,7 +50,7 @@ class modPrinting extends DolibarrModules
$this->module_position = 520; $this->module_position = 520;
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Enable Direct Printing System."; $this->description = "Enable Direct Printing System.";
$this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);

View File

@ -40,7 +40,7 @@ class modReceiptPrinter extends DolibarrModules
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {
$this->db = $db ; $this->db = $db ;
$this->numero = 67000; $this->numero = 67000;

View File

@ -41,7 +41,8 @@ class pdf_standardlabel extends CommonStickerGenerator
* @param array $param Associative array containing label content and optional parameters * @param array $param Associative array containing label content and optional parameters
* @return void * @return void
*/ */
function addSticker(&$pdf,$outputlangs,$param) { function addSticker(&$pdf,$outputlangs,$param)
{
// use this method in future refactoring // use this method in future refactoring
} }

View File

@ -72,7 +72,7 @@ class modGeneratePassPerso extends ModeleGenPassword
$this->langs=$langs; $this->langs=$langs;
$this->user=$user; $this->user=$user;
if(empty($conf->global->USER_PASSWORD_PATTERN)){ if (empty($conf->global->USER_PASSWORD_PATTERN)) {
// default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation. // default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation.
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity); dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity);
} }
@ -201,7 +201,8 @@ class modGeneratePassPerso extends ModeleGenPassword
* @param string $password Password to check * @param string $password Password to check
* @return int 0 if KO, >0 if OK * @return int 0 if KO, >0 if OK
*/ */
function consecutiveInterationSameCharacter($password){ function consecutiveInterationSameCharacter($password)
{
$last = ""; $last = "";
$count = 0; $count = 0;
$char = str_split($password); $char = str_split($password);
@ -220,4 +221,3 @@ class modGeneratePassPerso extends ModeleGenPassword
return 1; return 1;
} }
} }

View File

@ -422,7 +422,8 @@ class doc_generic_user_odt extends ModelePDFUser
return -1; return -1;
} }
function get_substitutionarray_object($object,$outputlangs,$array_key='object') { function get_substitutionarray_object($object,$outputlangs,$array_key='object')
{
$array_other=array(); $array_other=array();
foreach($object as $key => $value) { foreach($object as $key => $value) {
if (!is_array($value) && !is_object($value)) { if (!is_array($value) && !is_object($value)) {
@ -433,4 +434,3 @@ class doc_generic_user_odt extends ModelePDFUser
} }
} }

View File

@ -80,7 +80,8 @@ abstract class DolibarrTriggers
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct(DoliDB $db) { public function __construct(DoliDB $db)
{
$this->db = $db; $this->db = $db;

View File

@ -58,8 +58,7 @@ $tmpDir = $conf->dav->dir_temp;
//var_dump($tmpDir);exit; //var_dump($tmpDir);exit;
// Authentication callback function // Authentication callback function
$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) {
{
global $user; global $user;
global $conf; global $conf;
global $dolibarr_main_authentication; global $dolibarr_main_authentication;

View File

@ -64,13 +64,17 @@ if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
* *
* @return void * @return void
*/ */
function llxHeader() { } function llxHeader()
{
}
/** /**
* Footer empty * Footer empty
* *
* @return void * @return void
*/ */
function llxFooter() { } function llxFooter()
{
}
require 'main.inc.php'; // Load $user and permissions require 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -35,7 +35,7 @@ class Shipments extends DolibarrApi
static $FIELDS = array( static $FIELDS = array(
'socid', 'socid',
'origin_id', 'origin_id',
'origin_type' 'origin_type',
); );
/** /**
@ -99,7 +99,8 @@ class Shipments extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -217,7 +218,8 @@ class Shipments extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->lire) { if(! DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -250,7 +252,8 @@ class Shipments extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) { if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -312,7 +315,8 @@ class Shipments extends DolibarrApi
* @return object * @return object
*/ */
/* /*
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) { if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -372,7 +376,8 @@ class Shipments extends DolibarrApi
* @throws 401 * @throws 401
* @throws 404 * @throws 404
*/ */
function deleteLine($id, $lineid) { function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) { if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -407,7 +412,8 @@ class Shipments extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) { if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -537,7 +543,8 @@ class Shipments extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
/* function setinvoiced($id) { /* function setinvoiced($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) { if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401); throw new RestException(401);
@ -573,7 +580,8 @@ class Shipments extends DolibarrApi
* @throws 405 * @throws 405
*/ */
/* /*
function createShipmentFromOrder($orderid) { function createShipmentFromOrder($orderid)
{
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
@ -608,7 +616,8 @@ class Shipments extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -94,7 +94,8 @@ class ExpenseReports extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of Expense Report objects * @return array Array of Expense Report objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -195,7 +196,8 @@ class ExpenseReports extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expensereport->lire) { if(! DolibarrApiAccess::$user->rights->expensereport->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -228,7 +230,8 @@ class ExpenseReports extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) { if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -290,7 +293,8 @@ class ExpenseReports extends DolibarrApi
* @return object * @return object
*/ */
/* /*
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) { if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -348,7 +352,8 @@ class ExpenseReports extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function deleteLine($id, $lineid) { function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) { if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -380,7 +385,8 @@ class ExpenseReports extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) { if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -490,7 +496,8 @@ class ExpenseReports extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -35,7 +35,7 @@ class Interventions extends DolibarrApi
static $FIELDS = array( static $FIELDS = array(
'socid', 'socid',
'fk_project', 'fk_project',
'description' 'description',
); );
/** /**
@ -44,7 +44,7 @@ class Interventions extends DolibarrApi
static $FIELDSLINE = array( static $FIELDSLINE = array(
'description', 'description',
'date', 'date',
'duree' 'duree',
); );
/** /**
@ -106,7 +106,8 @@ class Interventions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -217,7 +218,8 @@ class Interventions extends DolibarrApi
* @return int * @return int
*/ */
/* TODO /* TODO
function getLines($id) { function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->lire) { if(! DolibarrApiAccess::$user->rights->ficheinter->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -424,7 +426,8 @@ class Interventions extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -33,7 +33,7 @@ class SupplierInvoices extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'socid' 'socid',
); );
/** /**
@ -96,7 +96,8 @@ class SupplierInvoices extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -152,8 +153,7 @@ class SupplierInvoices extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$i = 0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit)); $min = min($num, ($limit <= 0 ? $num : $limit));
@ -170,10 +170,10 @@ class SupplierInvoices extends DolibarrApi
else { else {
throw new RestException(503, 'Error when retrieve supplier invoice list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve supplier invoice list : '.$db->lasterror());
} }
if( ! count($obj_ret)) { if ( ! count($obj_ret)) {
throw new RestException(404, 'No supplier invoice found'); throw new RestException(404, 'No supplier invoice found');
} }
return $obj_ret; return $obj_ret;
} }
/** /**
@ -332,7 +332,8 @@ class SupplierInvoices extends DolibarrApi
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -46,8 +46,8 @@ class SupplierOrders extends DolibarrApi
*/ */
function __construct() function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
$this->order = new CommandeFournisseur($this->db); $this->order = new CommandeFournisseur($this->db);
} }
@ -68,11 +68,11 @@ class SupplierOrders extends DolibarrApi
} }
$result = $this->order->fetch($id); $result = $this->order->fetch($id);
if( ! $result ) { if ( ! $result ) {
throw new RestException(404, 'Supplier order not found'); throw new RestException(404, 'Supplier order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->order->id,'','commande')) { if ( ! DolibarrApi::_checkAccessToResource('fournisseur',$this->order->id,'','commande')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -96,7 +96,8 @@ class SupplierOrders extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -336,7 +337,8 @@ class SupplierOrders extends DolibarrApi
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -985,7 +985,8 @@ class Holiday extends CommonObject
* @param string $htmlname Name of HTML select field * @param string $htmlname Name of HTML select field
* @return string Show select of status * @return string Show select of status
*/ */
function selectStatutCP($selected='', $htmlname='select_statut') { function selectStatutCP($selected='', $htmlname='select_statut')
{
global $langs; global $langs;
@ -1019,7 +1020,8 @@ class Holiday extends CommonObject
* @param string $value vrai si mise à jour OK sinon faux * @param string $value vrai si mise à jour OK sinon faux
* @return boolean ok or ko * @return boolean ok or ko
*/ */
function updateConfCP($name,$value) { function updateConfCP($name,$value)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
$sql.= " value = '".$value."'"; $sql.= " value = '".$value."'";
@ -1247,7 +1249,8 @@ class Holiday extends CommonObject
* @param string $name name du paramètre de configuration * @param string $name name du paramètre de configuration
* @return string retourne checked si > 0 * @return string retourne checked si > 0
*/ */
function getCheckOption($name) { function getCheckOption($name)
{
$sql = "SELECT value"; $sql = "SELECT value";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_config"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
@ -1308,7 +1311,8 @@ class Holiday extends CommonObject
* @param int $user_id ID de l'utilisateur à supprimer * @param int $user_id ID de l'utilisateur à supprimer
* @return boolean Vrai si pas d'erreur, faut si Erreur * @return boolean Vrai si pas d'erreur, faut si Erreur
*/ */
function deleteCPuser($user_id) { function deleteCPuser($user_id)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday_users"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday_users";
$sql.= " WHERE fk_user = '".$user_id."'"; $sql.= " WHERE fk_user = '".$user_id."'";
@ -1632,7 +1636,8 @@ class Holiday extends CommonObject
* *
* @return int retourne le nombre d'utilisateur * @return int retourne le nombre d'utilisateur
*/ */
function countActiveUsersWithoutCP() { function countActiveUsersWithoutCP()
{
$sql = "SELECT count(u.rowid) as compteur"; $sql = "SELECT count(u.rowid) as compteur";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u LEFT OUTER JOIN ".MAIN_DB_PREFIX."holiday_users hu ON (hu.fk_user=u.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u LEFT OUTER JOIN ".MAIN_DB_PREFIX."holiday_users hu ON (hu.fk_user=u.rowid)";

View File

@ -22,9 +22,15 @@
*/ */
// This file is a wrapper, so empty header // This file is a wrapper, so empty header
function llxHeader() { print '<html><title>Build an import example file</title><body>'; } function llxHeader()
{
print '<html><title>Build an import example file</title><body>';
}
// This file is a wrapper, so empty footer // This file is a wrapper, so empty footer
function llxFooter() { print '</body></html>'; } function llxFooter()
{
print '</body></html>';
}
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -86,4 +92,3 @@ foreach($fieldstarget as $code=>$label)
//var_dump($contentlinevalues); //var_dump($contentlinevalues);
print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues,$datatoimport); print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues,$datatoimport);

View File

@ -565,6 +565,10 @@ if (! empty($valid_dashboardlines))
$sep=($conf->dol_use_jmobile?'<br>':' '); $sep=($conf->dol_use_jmobile?'<br>':' ');
$boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>'; $boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>';
$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0)?' dashboardlineok':'').'">'.$board->nbtodo.'</span></a>'; $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0)?' dashboardlineok':'').'">'.$board->nbtodo.'</span></a>';
if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX))
{
$boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0)?' dashboardlineok':'').'">'.price($board->total) .'</span></a>';
}
$boxwork .= '</div>'; $boxwork .= '</div>';
if ($board->nbtodolate > 0) if ($board->nbtodolate > 0)
{ {

View File

@ -41,7 +41,7 @@ class MyModuleApi extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'name' 'name',
); );
@ -109,7 +109,8 @@ class MyModuleApi extends DolibarrApi
* *
* @url GET /myobjects/ * @url GET /myobjects/
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -127,7 +128,7 @@ class MyModuleApi extends DolibarrApi
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
$sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " WHERE s.fk_stcomm = st.id";
// Example of use $mode // Example of use $mode
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
@ -195,8 +196,8 @@ class MyModuleApi extends DolibarrApi
function post($request_data = null) function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->myobject->create) { if(! DolibarrApiAccess::$user->rights->myobject->create) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
$result = $this->_validate($request_data); $result = $this->_validate($request_data);
@ -221,8 +222,8 @@ class MyModuleApi extends DolibarrApi
function put($id, $request_data = null) function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->myobject->create) { if(! DolibarrApiAccess::$user->rights->myobject->create) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->myobject->fetch($id); $result = $this->myobject->fetch($id);
if( ! $result ) { if( ! $result ) {
@ -261,9 +262,9 @@ class MyModuleApi extends DolibarrApi
throw new RestException(404, 'MyObject not found'); throw new RestException(404, 'MyObject not found');
} }
if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) { if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( !$this->myobject->delete($id)) if( !$this->myobject->delete($id))
{ {

View File

@ -412,16 +412,15 @@ class MultiCurrency extends CommonObject
$this->rate = null; $this->rate = null;
return -1; return -1;
} }
} }
/** /**
* Try get label of code in llx_currency then add rate * Try get label of code in llx_currency then add rate
* *
* @param string $code currency code * @param string $code currency code
* @param double $rate new rate * @param double $rate new rate
* * @return int -1 if KO, 1 if OK, 2 if label found and OK
* @return int -1 if KO, 1 if OK, 2 if label found and OK */
*/
function addRateFromDolibarr($code, $rate) function addRateFromDolibarr($code, $rate)
{ {
global $db, $user; global $db, $user;
@ -539,62 +538,62 @@ class MultiCurrency extends CommonObject
return array(0, 1); return array(0, 1);
} }
} }
/** /**
* Get the conversion of amount with invoice rate * Get the conversion of amount with invoice rate
* *
* @param int $fk_facture id of facture * @param int $fk_facture id of facture
* @param double $amount amount to convert * @param double $amount amount to convert
* @param string $way dolibarr mean the amount is in dolibarr currency * @param string $way dolibarr mean the amount is in dolibarr currency
* @param string $table facture or facture_fourn * @param string $table facture or facture_fourn
* * @return double amount converted
* @return double amount converted */
*/ public static function getAmountConversionFromInvoiceRate($fk_facture, $amount, $way='dolibarr', $table='facture')
public static function getAmountConversionFromInvoiceRate($fk_facture, $amount, $way='dolibarr', $table='facture') {
{ global $db;
global $db;
$multicurrency_tx = self::getInvoiceRate($fk_facture, $table); $multicurrency_tx = self::getInvoiceRate($fk_facture, $table);
if ($multicurrency_tx) if ($multicurrency_tx)
{ {
if ($way == 'dolibarr') return $amount * $multicurrency_tx; if ($way == 'dolibarr') return $amount * $multicurrency_tx;
else return $amount / $multicurrency_tx; else return $amount / $multicurrency_tx;
} }
else return $amount; else return $amount;
} }
/** /**
* Get current invoite rate * Get current invoite rate
* *
* @param int $fk_facture id of facture * @param int $fk_facture id of facture
* @param string $table facture or facture_fourn * @param string $table facture or facture_fourn
* @return bool * @return bool
*/ */
public static function getInvoiceRate($fk_facture, $table='facture') public static function getInvoiceRate($fk_facture, $table='facture')
{ {
global $db; global $db;
$sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture; $sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture;
dol_syslog(__METHOD__,LOG_DEBUG); dol_syslog(__METHOD__,LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql && ($line = $db->fetch_object($resql))) if ($resql && ($line = $db->fetch_object($resql)))
{ {
return $line->multicurrency_tx; return $line->multicurrency_tx;
} }
return false;
}
return false;
}
/** /**
* With free account we can't set source then recalcul all rates to force another source * With free account we can't set source then recalcul all rates to force another source
* *
* @param stdClass $TRate Object containing all currencies rates * @param stdClass $TRate Object containing all currencies rates
* @return -1 if KO, 0 if nothing, 1 if OK * @return -1 if KO, 0 if nothing, 1 if OK
*/ */
public static function recalculRates(&$TRate) public static function recalculRates(&$TRate)
{ {
global $conf; global $conf;

View File

@ -29,7 +29,8 @@
* @param Opensurveysondage $object Current viewing poll * @param Opensurveysondage $object Current viewing poll
* @return array Tabs for the opensurvey section * @return array Tabs for the opensurvey section
*/ */
function opensurvey_prepare_head(Opensurveysondage $object) { function opensurvey_prepare_head(Opensurveysondage $object)
{
global $langs, $conf; global $langs, $conf;

View File

@ -145,7 +145,7 @@ for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
$price_options[$i] = $langs->trans('SellingPrice').' '.$i; $price_options[$i] = $langs->trans('SellingPrice').' '.$i;
} }
$genPriceOptions = function($level) use ($price_options) { $genPriceOptions = function ($level) use ($price_options) {
$return = array(); $return = array();

View File

@ -102,7 +102,8 @@ class Products extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)"
* @return array Array of product objects * @return array Array of product objects
*/ */
function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $category=0, $sqlfilters = '') { function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $category=0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -467,7 +468,8 @@ class Products extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -167,7 +167,8 @@ class FormProduct
* @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call)
* @return String full label with all parents, separated by ' >> ' * @return String full label with all parents, separated by ' >> '
*/ */
private function get_parent_path($tab, $final_label='') { private function get_parent_path($tab, $final_label='')
{
if(empty($final_label)) $final_label = $tab['label']; if(empty($final_label)) $final_label = $tab['label'];

View File

@ -4506,7 +4506,8 @@ class Product extends CommonObject
* @param int[]|int $categories Category or categories IDs * @param int[]|int $categories Category or categories IDs
* @return void * @return void
*/ */
public function setCategories($categories) { public function setCategories($categories)
{
// Handle single category // Handle single category
if (! is_array($categories)) { if (! is_array($categories)) {
$categories = array($categories); $categories = array($categories);

View File

@ -54,7 +54,8 @@ class Productcustomerprice extends CommonObject
* *
* @param DoliDb $db handler * @param DoliDb $db handler
*/ */
function __construct($db) { function __construct($db)
{
$this->db = $db; $this->db = $db;
return 1; return 1;
@ -68,7 +69,8 @@ class Productcustomerprice extends CommonObject
* @param int $forceupdateaffiliate update price on each soc child * @param int $forceupdateaffiliate update price on each soc child
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger = 0, $forceupdateaffiliate = 0) { function create($user, $notrigger = 0, $forceupdateaffiliate = 0)
{
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;
@ -522,7 +524,8 @@ class Productcustomerprice extends CommonObject
* @param int $forceupdateaffiliate update price on each soc child * @param int $forceupdateaffiliate update price on each soc child
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0) { function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0)
{
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;
@ -719,7 +722,8 @@ class Productcustomerprice extends CommonObject
* @param int $forceupdateaffiliate update price on each soc child * @param int $forceupdateaffiliate update price on each soc child
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate) { function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate)
{
$error = 0; $error = 0;
@ -811,7 +815,8 @@ class Productcustomerprice extends CommonObject
* @param int $notrigger triggers after, 1=disable triggers * @param int $notrigger triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) { function delete($user, $notrigger = 0)
{
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;
@ -864,7 +869,8 @@ class Productcustomerprice extends CommonObject
* @param int $fromid of object to clone * @param int $fromid of object to clone
* @return int id of clone * @return int id of clone
*/ */
function createFromClone($fromid) { function createFromClone($fromid)
{
global $user, $langs; global $user, $langs;
@ -914,7 +920,8 @@ class Productcustomerprice extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() { function initAsSpecimen()
{
$this->id = 0; $this->id = 0;

View File

@ -647,7 +647,8 @@ class PropalmergepdfproductLine
var $tms=''; var $tms='';
var $import_key; var $import_key;
function __construct() { function __construct()
return 1; {
} return 1;
}
} }

View File

@ -93,7 +93,8 @@ class StockMovements extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -153,15 +154,15 @@ class StockMovements extends DolibarrApi
return $obj_ret; return $obj_ret;
} }
/* /*
* @param int $product_id Id product id {@min 1} * @param int $product_id Id product id {@min 1}
* @param int $warehouse_id Id warehouse {@min 1} * @param int $warehouse_id Id warehouse {@min 1}
* @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0} * @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0}
* @param string $lot Lot * @param string $lot Lot
* @param string $movementcode Movement code {@example INV123} * @param string $movementcode Movement code {@example INV123}
* @param string $movementlabel Movement label {@example Inventory number 123} * @param string $movementlabel Movement label {@example Inventory number 123}
* @param string $price To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0). * @param string $price To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0).
*/ */
/** /**
@ -279,7 +280,8 @@ class StockMovements extends DolibarrApi
* @param MouvementStock $object Object to clean * @param MouvementStock $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -92,7 +92,8 @@ class Warehouses extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -248,7 +249,8 @@ class Warehouses extends DolibarrApi
* @param Entrepot $object Object to clean * @param Entrepot $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -690,7 +690,8 @@ class Entrepot extends CommonObject
* @param array() $TChildWarehouses array which will contain all children (param by reference) * @param array() $TChildWarehouses array which will contain all children (param by reference)
* @return array() $TChildWarehouses array which will contain all children * @return array() $TChildWarehouses array which will contain all children
*/ */
function get_children_warehouses($id, &$TChildWarehouses) { function get_children_warehouses($id, &$TChildWarehouses)
{
$sql = 'SELECT rowid $sql = 'SELECT rowid
FROM '.MAIN_DB_PREFIX.'entrepot FROM '.MAIN_DB_PREFIX.'entrepot

View File

@ -98,7 +98,8 @@ class Projects extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of project objects * @return array Array of project objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -214,7 +215,8 @@ class Projects extends DolibarrApi
* *
* @url GET {id}/tasks * @url GET {id}/tasks
*/ */
function getLines($id, $includetimespent=0) { function getLines($id, $includetimespent=0)
{
if(! DolibarrApiAccess::$user->rights->projet->lire) { if(! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -256,7 +258,8 @@ class Projects extends DolibarrApi
* *
* @return int * @return int
*/ */
function getRoles($id, $userid=0) { function getRoles($id, $userid=0)
{
global $db; global $db;
if(! DolibarrApiAccess::$user->rights->projet->lire) { if(! DolibarrApiAccess::$user->rights->projet->lire) {
@ -300,7 +303,8 @@ class Projects extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) { if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -362,7 +366,8 @@ class Projects extends DolibarrApi
* @return object * @return object
*/ */
/* /*
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) { if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -418,7 +423,8 @@ class Projects extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) { if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -535,7 +541,8 @@ class Projects extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -106,7 +106,8 @@ class Tasks extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of project objects * @return array Array of project objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -221,7 +222,8 @@ class Tasks extends DolibarrApi
* @url GET {id}/tasks * @url GET {id}/tasks
*/ */
/* /*
function getLines($id, $includetimespent=0) { function getLines($id, $includetimespent=0)
{
if(! DolibarrApiAccess::$user->rights->projet->lire) { if(! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -263,7 +265,8 @@ class Tasks extends DolibarrApi
* *
* @return int * @return int
*/ */
function getRoles($id, $userid=0) { function getRoles($id, $userid=0)
{
global $db; global $db;
if(! DolibarrApiAccess::$user->rights->projet->lire) { if(! DolibarrApiAccess::$user->rights->projet->lire) {
@ -305,7 +308,8 @@ class Tasks extends DolibarrApi
* @return int * @return int
*/ */
/* /*
function postLine($id, $request_data = null) { function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) { if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -367,7 +371,8 @@ class Tasks extends DolibarrApi
* @return object * @return object
*/ */
/* /*
function putLine($id, $lineid, $request_data = null) { function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) { if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -422,7 +427,8 @@ class Tasks extends DolibarrApi
* *
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) { if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -550,7 +556,8 @@ class Tasks extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -42,13 +42,19 @@ if (! defined('NOCSRFCHECK')) define("NOCSRFCHECK",1); // We accept to go on
* *
* @return void * @return void
*/ */
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; } function llxHeaderVierge()
{
print '<html><title>Export agenda cal</title><body>';
}
/** /**
* Footer function * Footer function
* *
* @return void * @return void
*/ */
function llxFooterVierge() { print '</body></html>'; } function llxFooterVierge()
{
print '</body></html>';
}
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';

View File

@ -30,13 +30,19 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
* *
* @return void * @return void
*/ */
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; } function llxHeaderVierge()
{
print '<html><title>Export agenda cal</title><body>';
}
/** /**
* Header function * Header function
* *
* @return void * @return void
*/ */
function llxFooterVierge() { print '</body></html>'; } function llxFooterVierge()
{
print '</body></html>';
}
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php';

View File

@ -36,13 +36,17 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no
* *
* @return void * @return void
*/ */
function llxHeader() { } function llxHeader()
{
}
/** /**
* Footer empty * Footer empty
* *
* @return void * @return void
*/ */
function llxFooter() { } function llxFooter()
{
}
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -35,13 +35,17 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no
* *
* @return void * @return void
*/ */
function llxHeader() { } function llxHeader()
{
}
/** /**
* Footer empty * Footer empty
* *
* @return void * @return void
*/ */
function llxFooter() { } function llxFooter()
{
}
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -34,13 +34,17 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
* *
* @return void * @return void
*/ */
function llxHeader() { } function llxHeader()
{
}
/** /**
* Footer empty * Footer empty
* *
* @return void * @return void
*/ */
function llxFooter() { } function llxFooter()
{
}
require '../../master.inc.php'; require '../../master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -204,4 +208,3 @@ print '<!-- Page content '.$original_file.' rendered with DOLIBARR SERVER : Html
include_once $original_file_osencoded; // Note: The pageXXX.tpl.php showed here contains a formatage with dolWebsiteOutput() at end of page. include_once $original_file_osencoded; // Note: The pageXXX.tpl.php showed here contains a formatage with dolWebsiteOutput() at end of page.
if (is_object($db)) $db->close(); if (is_object($db)) $db->close();

View File

@ -33,13 +33,17 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
* *
* @return void * @return void
*/ */
function llxHeader() { } function llxHeader()
{
}
/** /**
* Footer empty * Footer empty
* *
* @return void * @return void
*/ */
function llxFooter() { } function llxFooter()
{
}
require '../../master.inc.php'; require '../../master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -145,4 +149,3 @@ require_once $original_file_osencoded;
if (is_object($db)) $db->close(); if (is_object($db)) $db->close();

View File

@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
/** /**
* DAO Resource object * DAO Resource object
*/ */
class Dolresource extends CommonObject class Dolresource extends CommonObject
{ {
@ -60,14 +60,14 @@ class Dolresource extends CommonObject
/** /**
* Create object into database * Create object into database
* *
* @param User $user User that creates * @param User $user User that creates
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -730,7 +730,8 @@ class Dolresource extends CommonObject
* @deprecated, remplaced by hook getElementResources * @deprecated, remplaced by hook getElementResources
* @see getElementResources() * @see getElementResources()
*/ */
function fetch_all_available() { function fetch_all_available()
{
global $conf; global $conf;
if (! empty($conf->modules_parts['resources'])) if (! empty($conf->modules_parts['resources']))

View File

@ -34,7 +34,7 @@ class Contacts extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'lastname' 'lastname',
); );
/** /**
@ -101,8 +101,9 @@ class Contacts extends DolibarrApi
* @return array Array of contact objects * @return array Array of contact objects
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -195,7 +196,8 @@ class Contacts extends DolibarrApi
* @param array $request_data Request datas * @param array $request_data Request datas
* @return int ID of contact * @return int ID of contact
*/ */
function post($request_data = null) { function post($request_data = null)
{
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) if (!DolibarrApiAccess::$user->rights->societe->contact->creer)
{ {
throw new RestException(401, 'No permission to create/update contacts'); throw new RestException(401, 'No permission to create/update contacts');
@ -220,7 +222,8 @@ class Contacts extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->rights->societe->contact->creer) if (!DolibarrApiAccess::$user->rights->societe->contact->creer)
{ {
throw new RestException(401, 'No permission to create/update contacts'); throw new RestException(401, 'No permission to create/update contacts');
@ -255,7 +258,8 @@ class Contacts extends DolibarrApi
* @param int $id Contact ID * @param int $id Contact ID
* @return integer * @return integer
*/ */
function delete($id) { function delete($id)
{
if (!DolibarrApiAccess::$user->rights->societe->contact->supprimer) if (!DolibarrApiAccess::$user->rights->societe->contact->supprimer)
{ {
throw new RestException(401, 'No permission to delete contacts'); throw new RestException(401, 'No permission to delete contacts');
@ -283,7 +287,8 @@ class Contacts extends DolibarrApi
* *
* @url POST {id}/createUser * @url POST {id}/createUser
*/ */
function createUser($id, $request_data = null) { function createUser($id, $request_data = null)
{
//if (!DolibarrApiAccess::$user->rights->user->user->creer) { //if (!DolibarrApiAccess::$user->rights->user->user->creer) {
//throw new RestException(401); //throw new RestException(401);
//} //}
@ -365,7 +370,8 @@ class Contacts extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
@ -389,7 +395,8 @@ class Contacts extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) { function _validate($data)
{
$contact = array(); $contact = array();
foreach (Contacts::$FIELDS as $field) foreach (Contacts::$FIELDS as $field)
{ {

View File

@ -32,7 +32,7 @@ class Thirdparties extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'name' 'name',
); );
/** /**
@ -114,7 +114,8 @@ class Thirdparties extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')"
* @return array Array of thirdparty objects * @return array Array of thirdparty objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -929,7 +930,8 @@ class Thirdparties extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function getInvoicesQualifiedForReplacement($id) { function getInvoicesQualifiedForReplacement($id)
{
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
@ -971,7 +973,8 @@ class Thirdparties extends DolibarrApi
* @throws 404 * @throws 404
* @throws 405 * @throws 405
*/ */
function getInvoicesQualifiedForCreditNote($id) { function getInvoicesQualifiedForCreditNote($id)
{
if(! DolibarrApiAccess::$user->rights->facture->lire) { if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
@ -1004,7 +1007,8 @@ class Thirdparties extends DolibarrApi
* *
* @return array * @return array
*/ */
function getCompanyBankAccount($socid){ function getCompanyBankAccount($socid)
{
global $db, $conf; global $db, $conf;
@ -1154,7 +1158,8 @@ class Thirdparties extends DolibarrApi
* *
* @url DELETE {socid}/CompanyBankAccount/{id} * @url DELETE {socid}/CompanyBankAccount/{id}
*/ */
function deleteCompanyBankAccount($id, $socid){ function deleteCompanyBankAccount($id, $socid)
{
if(! DolibarrApiAccess::$user->rights->societe->creer) { if(! DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401); throw new RestException(401);
@ -1177,7 +1182,8 @@ class Thirdparties extends DolibarrApi
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -94,7 +94,8 @@ class Supplierproposals extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects * @return array Array of order objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -190,24 +191,25 @@ class Supplierproposals extends DolibarrApi
} }
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) { function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->name); unset($object->name);
unset($object->lastname); unset($object->lastname);
unset($object->firstname); unset($object->firstname);
unset($object->civility_id); unset($object->civility_id);
unset($object->address); unset($object->address);
unset($object->datec); unset($object->datec);
unset($object->datev); unset($object->datev);
return $object; return $object;
} }
} }

View File

@ -1775,7 +1775,8 @@ class SupplierProposal extends CommonObject
* @param User $user Object user * @param User $user Object user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function updatePriceFournisseur($idProductFournPrice, $product, $user) { function updatePriceFournisseur($idProductFournPrice, $product, $user)
{
$price=price2num($product->subprice*$product->qty,'MU'); $price=price2num($product->subprice*$product->qty,'MU');
$unitPrice = price2num($product->subprice,'MU'); $unitPrice = price2num($product->subprice,'MU');
@ -1787,7 +1788,7 @@ class SupplierProposal extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Create ProductFournisseur * Create ProductFournisseur
@ -1796,7 +1797,8 @@ class SupplierProposal extends CommonObject
* @param User $user Object user * @param User $user Object user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function createPriceFournisseur($product, $user) { function createPriceFournisseur($product, $user)
{
$price=price2num($product->subprice*$product->qty,'MU'); $price=price2num($product->subprice*$product->qty,'MU');
$qty=price2num($product->qty); $qty=price2num($product->qty);
$unitPrice = price2num($product->subprice,'MU'); $unitPrice = price2num($product->subprice,'MU');
@ -1823,7 +1825,7 @@ class SupplierProposal extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Set draft status * Set draft status
@ -3180,4 +3182,3 @@ class SupplierProposalLine extends CommonObjectLine
} }
} }

View File

@ -32,7 +32,7 @@ class Users extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'login' 'login',
); );
/** /**
@ -43,7 +43,8 @@ class Users extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() { function __construct()
{
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
$this->useraccount = new User($this->db); $this->useraccount = new User($this->db);
@ -63,7 +64,8 @@ class Users extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of User objects * @return array Array of User objects
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') { function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
@ -136,7 +138,8 @@ class Users extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) { function get($id)
{
//if (!DolibarrApiAccess::$user->rights->user->user->lire) { //if (!DolibarrApiAccess::$user->rights->user->user->lire) {
//throw new RestException(401); //throw new RestException(401);
//} //}
@ -162,7 +165,8 @@ class Users extends DolibarrApi
* @param array $request_data New user data * @param array $request_data New user data
* @return int * @return int
*/ */
function post($request_data = null) { function post($request_data = null)
{
// check user authorization // check user authorization
//if(! DolibarrApiAccess::$user->rights->user->creer) { //if(! DolibarrApiAccess::$user->rights->user->creer) {
// throw new RestException(401, "User creation not allowed"); // throw new RestException(401, "User creation not allowed");
@ -194,7 +198,8 @@ class Users extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) { function put($id, $request_data = null)
{
//if (!DolibarrApiAccess::$user->rights->user->user->creer) { //if (!DolibarrApiAccess::$user->rights->user->user->creer) {
//throw new RestException(401); //throw new RestException(401);
//} //}
@ -236,7 +241,8 @@ class Users extends DolibarrApi
* *
* @url GET {id}/setGroup/{group} * @url GET {id}/setGroup/{group}
*/ */
function setGroup($id, $group, $entity = 1) { function setGroup($id, $group, $entity = 1)
{
global $conf; global $conf;
@ -280,7 +286,8 @@ class Users extends DolibarrApi
* @param int $id Account ID * @param int $id Account ID
* @return array * @return array
*/ */
function delete($id) { function delete($id)
{
//if (!DolibarrApiAccess::$user->rights->user->user->supprimer) { //if (!DolibarrApiAccess::$user->rights->user->user->supprimer) {
//throw new RestException(401); //throw new RestException(401);
//} //}
@ -363,7 +370,8 @@ class Users extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) { function _validate($data)
{
$account = array(); $account = array();
foreach (Users::$FIELDS as $field) foreach (Users::$FIELDS as $field)
{ {

View File

@ -66,13 +66,17 @@ if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
* *
* @return void * @return void
*/ */
function llxHeader() { } function llxHeader()
{
}
/** /**
* Footer empty * Footer empty
* *
* @return void * @return void
*/ */
function llxFooter() { } function llxFooter()
{
}
require 'main.inc.php'; // Load $user and permissions require 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -681,7 +681,8 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser)
* @param array $shortuser Array of login/password info * @param array $shortuser Array of login/password info
* @return mixed * @return mixed
*/ */
function setUserPassword($authentication,$shortuser) { function setUserPassword($authentication,$shortuser)
{
global $db,$conf,$langs; global $db,$conf,$langs;

View File

@ -1118,7 +1118,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
* *
* @return void * @return void
*/ */
public function testDolNl2Br() { public function testDolNl2Br()
{
//String to encode //String to encode
$string = "a\na"; $string = "a\na";

View File

@ -173,7 +173,8 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $object['statut']); $this->assertEquals(1, $object['statut']);
} }
public function testRestCreateUser() { public function testRestCreateUser()
{
// attemp to create without mandatory fields : // attemp to create without mandatory fields :
$url = $this->api_url.'/users?api_key='.$this->api_key; $url = $this->api_url.'/users?api_key='.$this->api_key;