function declaration

This commit is contained in:
Frédéric FRANCE 2018-08-15 18:14:02 +02:00
parent 54a078149a
commit 69a7af88e7
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
26 changed files with 156 additions and 113 deletions

View File

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

View File

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

View File

@ -69,7 +69,8 @@ class AccountingAccount extends CommonObject
*
* @param DoliDB $db Database handle
*/
function __construct($db) {
function __construct($db)
{
global $conf;
$this->db = $db;
@ -146,7 +147,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger = 0) {
function create($user, $notrigger = 0)
{
global $conf;
$error = 0;
$now = dol_now();
@ -297,7 +299,8 @@ class AccountingAccount extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
function checkUsage() {
function checkUsage()
{
global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
@ -330,7 +333,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0) {
function delete($user, $notrigger = 0)
{
$error = 0;
$result = $this->checkUsage();
@ -457,7 +461,8 @@ class AccountingAccount extends CommonObject
* @param int $id of record
* @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 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
$sql .= ' WHERE a.rowid = ' . $id;
@ -494,7 +499,8 @@ class AccountingAccount extends CommonObject
* @param int $id Id
* @return int <0 if KO, >0 if OK
*/
function account_desactivate($id) {
function account_desactivate($id)
{
$result = $this->checkUsage();
if ($result > 0) {
@ -526,7 +532,8 @@ class AccountingAccount extends CommonObject
* @param int $id Id
* @return int <0 if KO, >0 if OK
*/
function account_activate($id) {
function account_activate($id)
{
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";

View File

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

View File

@ -34,7 +34,7 @@ class Subscriptions extends DolibarrApi
'fk_adherent',
'dateh',
'datef',
'amount'
'amount',
);
/**
@ -85,7 +85,8 @@ class Subscriptions extends DolibarrApi
*
* @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;
$obj_ret = array();

View File

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

View File

@ -944,7 +944,8 @@ class Account extends CommonObject
*
* @param int[]|int $categories Category or categories IDs
*/
public function setCategories($categories) {
public function setCategories($categories)
{
// Handle single category
if (! is_array($categories)) {
$categories = array($categories);
@ -2282,4 +2283,3 @@ class AccountLine extends CommonObject
}
}

View File

@ -42,9 +42,10 @@ abstract class CommonDocGenerator
*
* @param DoliDB $db Database handler
*/
public function __construct($db) {
$this->db = $db;
}
public function __construct($db)
{
$this->db = $db;
}
/**
@ -228,7 +229,8 @@ abstract class CommonDocGenerator
* @param array_key $array_key Name of the key for return array
* @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;
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
* @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();
if(!empty($object)) {
foreach($object as $key => $value) {
@ -769,10 +772,9 @@ abstract class CommonDocGenerator
*/
function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
{
if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
$pdf->line($x+$l, $y, $x+$l, $y+$h);
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
$pdf->line($x, $y+$h, $x, $y);
if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
$pdf->line($x+$l, $y, $x+$l, $y+$h);
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
$pdf->line($x, $y+$h, $x, $y);
}
}

View File

@ -93,7 +93,7 @@ abstract class CommonStickerGenerator
{
$this->db = $db;
}
/**
* Function to build PDF on disk, then output on HTTP strem.
*
@ -114,7 +114,7 @@ abstract class CommonStickerGenerator
* @return void
*/
abstract function addSticker(&$pdf,$outputlangs,$param);
/**
* Methode qui permet de modifier la taille des caracteres
* Cela modiera aussi l'espace entre chaque ligne
@ -130,7 +130,7 @@ abstract class CommonStickerGenerator
$this->_Line_Height = $this->_Get_Height_Chars($pt);
$pdf->SetFont('','',$pt);
}
}
}
/**
* protected Print dot line
@ -216,7 +216,7 @@ abstract class CommonStickerGenerator
* @param string $dest to
* @return float value value after conversion
*/
function _Convert_Metric ($value, $src, $dest)
function _Convert_Metric($value, $src, $dest)
{
if ($src != $dest) {
$tab['in'] = 39.37008;
@ -251,7 +251,7 @@ abstract class CommonStickerGenerator
* @param string $format Format
* @return void
*/
function _Set_Format(&$pdf, $format)
function _Set_Format(&$pdf, $format)
{
$this->_Metric = $format['metric'];
$this->_Avery_Name = $format['name'];

View File

@ -216,7 +216,8 @@ class FormAccounting extends Form
* @param string $selectedkey Value
* @return string HTML edit field
*/
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
{
$options = array();
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
@ -339,7 +340,8 @@ class FormAccounting extends Form
* @param string $morecss More css
* @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();
@ -428,4 +430,3 @@ class FormAccounting extends Form
}
}
}

View File

@ -30,8 +30,8 @@ class SimpleOpenID
var $URLs = array();
var $error = array();
var $fields = array(
'required' => array(),
'optional' => array(),
'required' => array(),
'optional' => array(),
);
/**
@ -126,7 +126,8 @@ class SimpleOpenID
* @return void
*/
function SetIdentity($a)
{ // Set Identity URL
{
// Set Identity URL
if ((stripos($a, 'http://') === false)
&& (stripos($a, 'https://') === false)){
$a = 'http://'.$a;
@ -153,7 +154,8 @@ class SimpleOpenID
* @return string
*/
function GetIdentity()
{ // Get Identity
{
// Get Identity
return $this->openid_url_identity;
}
@ -254,7 +256,8 @@ class SimpleOpenID
* @return false|string false if KO, string of url if OK
*/
function array2url($arr)
{ // converts associated array to URL Query String
{
// converts associated array to URL Query String
if (!is_array($arr)){
return false;
}
@ -306,7 +309,8 @@ class SimpleOpenID
* @return string
*/
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);
$curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : ""));
@ -361,7 +365,7 @@ class SimpleOpenID
*/
function GetOpenIDServer($url='')
{
global $conf;
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
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
* @return void
*/
function setPriority ( $_value = 3 )
function setPriority( $_value = 3 )
{
if ( ( is_numeric($_value) ) &&
( ( $_value >= 0 ) && ( $_value <= 5 ) ) )
@ -1814,12 +1814,14 @@ class SMTPs
* @param int $_errNum Error Code Number
* @param string $_errMsg Error Message
* @return void
*/
function _setErr ( $_errNum, $_errMsg )
{
$this->_smtpsErrors[] = array( 'num' => $_errNum,
'msg' => $_errMsg );
}
*/
function _setErr( $_errNum, $_errMsg )
{
$this->_smtpsErrors[] = array(
'num' => $_errNum,
'msg' => $_errMsg,
);
}
/**
* Returns errors codes and messages for Class
@ -2049,4 +2051,3 @@ class SMTPs
* - basic shell with some commets
*
*/

View File

@ -111,12 +111,13 @@ class vCard
* mise en forme de la photo
* warning NON TESTE !
*
* @param string $type Type
* @param string $photo Photo
* @return void
*/
* @param string $type Type
* @param string $photo Photo
* @return void
*/
function setPhoto($type, $photo)
{ // $type = "GIF" | "JPEG"
{
// $type = "GIF" | "JPEG"
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
}
@ -155,7 +156,7 @@ class vCard
* @return void
*/
function setBirthday($date)
{
{
// $date format is YYYY-MM-DD - RFC 2425 and RFC 2426
$this->properties["BDAY"] = dol_print_date($date, 'dayrfc');
}
@ -200,7 +201,8 @@ class vCard
* @param string $type Type
* @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 = "";
if ($postoffice!="") $label.= "$postoffice\r\n";
if ($extended!="") $label.= "$extended\r\n";

View File

@ -1138,7 +1138,8 @@ class DoliDBMssql extends DoliDB
* @param string $fieldname Field's name to escape
* @return string field's name escaped
*/
function EscapeFieldName($fieldname) {
function EscapeFieldName($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
* @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";
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
* @return int Formatted date
*/
private static function calc_daynr($year, $month, $day) {
private static function calc_daynr($year, $month, $day)
{
$y = $year;
if ($y == 0 && $month == 0) return 0;
$num = (365* $y + 31 * ($month - 1) + $day);
@ -1322,7 +1323,8 @@ class DoliDBSqlite3 extends DoliDB
* @param bool $sunday_first_day_of_week ???
* @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);
return $ret;
}
@ -1348,7 +1350,8 @@ class DoliDBSqlite3 extends DoliDB
* @param string $calc_year ???
* @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);
$first_daynr=self::calc_daynr($year,1,1);
$monday_first= ($week_behaviour & self::WEEK_MONDAY_FIRST) ? 1 : 0;
@ -1388,4 +1391,3 @@ class DoliDBSqlite3 extends DoliDB
}
}

View File

@ -67,7 +67,7 @@ function expensereport_prepare_head($object)
$head[$h][2] = 'note';
$h++;
}
$head[$h][0] = DOL_URL_ROOT . '/expensereport/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
@ -81,11 +81,12 @@ function expensereport_prepare_head($object)
/**
* Returns an array with the tabs for the "Expense report payment" section
* It loads tabs from modules looking for the entity payment
*
*
* @param Paiement $object Current payment object
* @return array Tabs for the payment section
*/
function payment_expensereport_prepare_head(PaymentExpenseReport $object) {
function payment_expensereport_prepare_head(PaymentExpenseReport $object)
{
global $langs, $conf;
@ -139,7 +140,7 @@ function expensereport_admin_prepare_head()
$head[$h][2] = 'expenseik';
$h++;
}
if (!empty($conf->global->MAIN_USE_EXPENSE_RULE))
{
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
@ -147,7 +148,7 @@ function expensereport_admin_prepare_head()
$head[$h][2] = 'expenserules';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
@ -168,5 +169,5 @@ function expensereport_admin_prepare_head()
complete_head_from_modules($conf,$langs,null,$head,$h,'expensereport_admin','remove');
return $head;
return $head;
}

View File

@ -42,7 +42,8 @@ class pdf_standard extends CommonStickerGenerator
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
function addSticker(&$pdf,$outputlangs,$param) {
function addSticker(&$pdf,$outputlangs,$param)
{
// use this method in future refactoring
}
@ -323,7 +324,7 @@ class pdf_standard extends CommonStickerGenerator
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
// Load traductions files requiredby by page
$outputlangs->loadLangs(array("main", "dict", "companies", "admin", "members"));

View File

@ -40,7 +40,7 @@ class modOauth extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
function __construct($db)
function __construct($db)
{
$this->db = $db ;
$this->numero = 66000;
@ -52,7 +52,7 @@ class modOauth extends DolibarrModules
$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)
$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->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.

View File

@ -40,7 +40,7 @@ class modPrinting extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
function __construct($db)
function __construct($db)
{
$this->db = $db ;
$this->numero = 64000;
@ -50,7 +50,7 @@ class modPrinting extends DolibarrModules
$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)
$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->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);

View File

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

View File

@ -72,7 +72,7 @@ class modGeneratePassPerso extends ModeleGenPassword
$this->langs=$langs;
$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.
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
* @return int 0 if KO, >0 if OK
*/
function consecutiveInterationSameCharacter($password){
function consecutiveInterationSameCharacter($password)
{
$last = "";
$count = 0;
$char = str_split($password);
@ -220,4 +221,3 @@ class modGeneratePassPerso extends ModeleGenPassword
return 1;
}
}

View File

@ -409,7 +409,7 @@ class doc_generic_user_odt extends ModelePDFUser
$odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
}
else
@ -422,7 +422,8 @@ class doc_generic_user_odt extends ModelePDFUser
return -1;
}
function get_substitutionarray_object($object,$outputlangs,$array_key='object') {
function get_substitutionarray_object($object,$outputlangs,$array_key='object')
{
$array_other=array();
foreach($object as $key => $value) {
if (!is_array($value) && !is_object($value)) {
@ -433,4 +434,3 @@ class doc_generic_user_odt extends ModelePDFUser
}
}

View File

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

View File

@ -35,7 +35,7 @@ class Interventions extends DolibarrApi
static $FIELDS = array(
'socid',
'fk_project',
'description'
'description',
);
/**
@ -44,7 +44,7 @@ class Interventions extends DolibarrApi
static $FIELDSLINE = array(
'description',
'date',
'duree'
'duree',
);
/**
@ -106,7 +106,8 @@ class Interventions extends DolibarrApi
*
* @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;
$obj_ret = array();
@ -217,7 +218,8 @@ class Interventions extends DolibarrApi
* @return int
*/
/* TODO
function getLines($id) {
function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->lire) {
throw new RestException(401);
}
@ -424,7 +426,8 @@ class Interventions extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
function _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
*/
static $FIELDS = array(
'socid'
'socid',
);
/**
@ -96,7 +96,8 @@ class SupplierInvoices extends DolibarrApi
*
* @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;
$obj_ret = array();
@ -152,8 +153,7 @@ class SupplierInvoices extends DolibarrApi
}
$result = $db->query($sql);
if ($result)
{
if ($result) {
$i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
@ -170,10 +170,10 @@ class SupplierInvoices extends DolibarrApi
else {
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');
}
return $obj_ret;
return $obj_ret;
}
/**
@ -332,7 +332,8 @@ class SupplierInvoices extends DolibarrApi
* @param Object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);

View File

@ -46,8 +46,8 @@ class SupplierOrders extends DolibarrApi
*/
function __construct()
{
global $db, $conf;
$this->db = $db;
global $db, $conf;
$this->db = $db;
$this->order = new CommandeFournisseur($this->db);
}
@ -68,11 +68,11 @@ class SupplierOrders extends DolibarrApi
}
$result = $this->order->fetch($id);
if( ! $result ) {
if ( ! $result ) {
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);
}
@ -96,7 +96,8 @@ class SupplierOrders extends DolibarrApi
*
* @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;
$obj_ret = array();
@ -336,7 +337,8 @@ class SupplierOrders extends DolibarrApi
* @param Object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);