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

@ -43,7 +43,8 @@ class AccountancySystem
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
function __construct($db) { function __construct($db)
{
$this->db = $db; $this->db = $db;
} }
@ -102,7 +103,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

@ -69,7 +69,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;
@ -146,7 +147,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();
@ -297,7 +299,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";
@ -330,7 +333,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();
@ -457,7 +461,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;
@ -494,7 +499,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) {
@ -526,7 +532,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

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

@ -609,7 +609,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;
@ -705,7 +706,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;
@ -722,7 +724,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;
@ -1055,4 +1058,3 @@ class BlockedLog
} }
} }

View File

@ -944,7 +944,8 @@ class Account extends CommonObject
* *
* @param int[]|int $categories Category or categories IDs * @param int[]|int $categories Category or categories IDs
*/ */
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);
@ -2282,4 +2283,3 @@ class AccountLine extends CommonObject
} }
} }

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

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

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

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

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

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

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

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

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

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