function declaration

This commit is contained in:
Frédéric FRANCE 2018-08-15 17:34:35 +02:00
parent 7bb781eea8
commit 54a078149a
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
32 changed files with 315 additions and 234 deletions

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

@ -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);
@ -219,7 +220,8 @@ class DolibarrApi
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @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,18 +26,19 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
*/ */
class Status class Status
{ {
/** /**
* Get status (Dolibarr version) * Get status (Dolibarr version)
*/ */
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() );
@ -107,7 +111,8 @@ class BlockedLogAuthority
* *
* @param string $block new block to chain * @param string $block new block to chain
*/ */
public function addBlock($block) { public function addBlock($block)
{
$this->blockchain.=$block; $this->blockchain.=$block;
@ -119,7 +124,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;
@ -141,7 +147,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;
@ -198,7 +205,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;
@ -252,7 +260,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;
@ -289,7 +298,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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -590,10 +590,10 @@ class MultiCurrency extends CommonObject
/** /**
* 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

@ -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

@ -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

@ -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

@ -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";