add visibility
This commit is contained in:
parent
5016bc7188
commit
8b4e920d5e
@ -316,7 +316,7 @@ class BillOfMaterials extends CommonObject
|
||||
if ($key=='t.rowid') {
|
||||
$sqlwhere[] = $key . '='. $value;
|
||||
}
|
||||
elseif (strpos($key,'date') !== false) {
|
||||
elseif (strpos($key, 'date') !== false) {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||
}
|
||||
elseif ($key=='customsql') {
|
||||
|
||||
@ -91,7 +91,7 @@ class Menubase
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $menu_handler Menu handler
|
||||
*/
|
||||
function __construct($db, $menu_handler = '')
|
||||
public function __construct($db, $menu_handler = '')
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->menu_handler = $menu_handler;
|
||||
@ -105,7 +105,7 @@ class Menubase
|
||||
* @param User $user User that create
|
||||
* @return int <0 if KO, Id of record if OK
|
||||
*/
|
||||
function create($user = null)
|
||||
public function create($user = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -245,7 +245,7 @@ class Menubase
|
||||
* @param int $notrigger 0=no, 1=yes (no update trigger)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user = null, $notrigger = 0)
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -310,7 +310,7 @@ class Menubase
|
||||
* @param User $user User that load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $user = null)
|
||||
public function fetch($id, $user = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -384,7 +384,7 @@ class Menubase
|
||||
* @param User $user User that delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
public function delete($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -410,7 +410,7 @@ class Menubase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
|
||||
@ -443,7 +443,7 @@ class Menubase
|
||||
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @return array Return array with menu entries for top menu
|
||||
*/
|
||||
function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
public function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
@ -472,7 +472,7 @@ class Menubase
|
||||
* @param array $tabMenu Array with menu entries already loaded
|
||||
* @return Menu Menu array for particular mainmenu value or full tabArray
|
||||
*/
|
||||
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
public function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
@ -480,16 +480,16 @@ class Menubase
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
// Detect what is top mainmenu id
|
||||
// Detect what is top mainmenu id
|
||||
$menutopid='';
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
// Define menutopid of mainmenu
|
||||
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
|
||||
{
|
||||
$menutopid=$val['rowid'];
|
||||
break;
|
||||
}
|
||||
// Define menutopid of mainmenu
|
||||
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
|
||||
{
|
||||
$menutopid=$val['rowid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We initialize newmenu with first already found menu entries
|
||||
@ -561,7 +561,7 @@ class Menubase
|
||||
* @param array $tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
public function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu, $leftmenu; // To export to dol_eval function
|
||||
@ -577,10 +577,10 @@ class Menubase
|
||||
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
|
||||
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
|
||||
$sql.= " ORDER BY m.position, m.rowid";
|
||||
//print $sql;
|
||||
//print $sql;
|
||||
|
||||
//$tmp1=microtime(true);
|
||||
//print '>>> 1 0<br>';
|
||||
//$tmp1=microtime(true);
|
||||
//print '>>> 1 0<br>';
|
||||
dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -647,8 +647,8 @@ class Menubase
|
||||
$title = $langs->trans($menu['titre']);
|
||||
}
|
||||
}
|
||||
//$tmp4=microtime(true);
|
||||
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
|
||||
//$tmp4=microtime(true);
|
||||
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
|
||||
|
||||
// We complete tabMenu
|
||||
$tabMenu[$b]['rowid'] = $menu['rowid'];
|
||||
|
||||
@ -90,7 +90,7 @@ class Notify
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
@ -105,7 +105,7 @@ class Notify
|
||||
* @param Object $object Object the notification is about
|
||||
* @return string Message
|
||||
*/
|
||||
function confirmMessage($action, $socid, $object)
|
||||
public function confirmMessage($action, $socid, $object)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("mails");
|
||||
@ -146,7 +146,7 @@ class Notify
|
||||
* @param array $scope Scope where to search
|
||||
* @return array|int <0 if KO, array of notifications to send if OK
|
||||
*/
|
||||
function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global'))
|
||||
public function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global'))
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
@ -309,7 +309,7 @@ class Notify
|
||||
* @param array $mimefilename_list List of attached file name in message
|
||||
* @return int <0 if KO, or number of changes if OK
|
||||
*/
|
||||
function send($notifcode, $object, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
|
||||
public function send($notifcode, $object, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
global $hookmanager;
|
||||
@ -530,7 +530,7 @@ class Notify
|
||||
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
||||
}
|
||||
|
||||
$mailfile = new CMailFile(
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
$sendto,
|
||||
$replyto,
|
||||
@ -542,7 +542,7 @@ class Notify
|
||||
'',
|
||||
0,
|
||||
-1
|
||||
);
|
||||
);
|
||||
|
||||
if ($mailfile->sendfile())
|
||||
{
|
||||
@ -758,7 +758,7 @@ class Notify
|
||||
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
||||
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
||||
}
|
||||
$mailfile = new CMailFile(
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
$sendto,
|
||||
$replyto,
|
||||
|
||||
@ -26,18 +26,18 @@
|
||||
*/
|
||||
class SimpleOpenID
|
||||
{
|
||||
var $openid_url_identity;
|
||||
var $URLs = array();
|
||||
var $error = array();
|
||||
var $fields = array(
|
||||
'required' => array(),
|
||||
'optional' => array(),
|
||||
public $openid_url_identity;
|
||||
public $URLs = array();
|
||||
public $error = array();
|
||||
public $fields = array(
|
||||
'required' => array(),
|
||||
'optional' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
if (!function_exists('curl_exec'))
|
||||
{
|
||||
@ -45,66 +45,66 @@ class SimpleOpenID
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetOpenIDServer
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetOpenIDServer($a)
|
||||
public function SetOpenIDServer($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->URLs['openid_server'] = $a;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetOpenIDServer
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetTrustRoot($a)
|
||||
public function SetTrustRoot($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->URLs['trust_root'] = $a;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetOpenIDServer
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetCancelURL($a)
|
||||
public function SetCancelURL($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->URLs['cancel'] = $a;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetApprovedURL
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetApprovedURL($a)
|
||||
public function SetApprovedURL($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->URLs['approved'] = $a;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetRequiredFields
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetRequiredFields($a)
|
||||
public function SetRequiredFields($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (is_array($a)) {
|
||||
@ -114,14 +114,14 @@ class SimpleOpenID
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetOptionalFields
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetOptionalFields($a)
|
||||
public function SetOptionalFields($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (is_array($a)) {
|
||||
@ -131,14 +131,14 @@ class SimpleOpenID
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetIdentity
|
||||
*
|
||||
* @param string $a Server
|
||||
* @return void
|
||||
*/
|
||||
function SetIdentity($a)
|
||||
public function SetIdentity($a)
|
||||
{
|
||||
// phpcs:enable
|
||||
// Set Identity URL
|
||||
@ -162,33 +162,33 @@ class SimpleOpenID
|
||||
$this->openid_url_identity = $a;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* GetIdentity
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function GetIdentity()
|
||||
public function GetIdentity()
|
||||
{
|
||||
// phpcs:enable
|
||||
// Get Identity
|
||||
return $this->openid_url_identity;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* SetOpenIDServer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function GetError()
|
||||
public function GetError()
|
||||
{
|
||||
// phpcs:enable
|
||||
$e = $this->error;
|
||||
return array('code'=>$e[0],'description'=>$e[1]);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* ErrorStore
|
||||
*
|
||||
@ -196,7 +196,7 @@ class SimpleOpenID
|
||||
* @param string $desc Description
|
||||
* @return void
|
||||
*/
|
||||
function ErrorStore($code, $desc = null)
|
||||
public function ErrorStore($code, $desc = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
$errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.';
|
||||
@ -206,13 +206,13 @@ class SimpleOpenID
|
||||
$this->error = array($code,$desc);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* IsError
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function IsError()
|
||||
public function IsError()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (count($this->error) > 0)
|
||||
@ -231,7 +231,7 @@ class SimpleOpenID
|
||||
* @param string $response Server
|
||||
* @return void
|
||||
*/
|
||||
function splitResponse($response)
|
||||
public function splitResponse($response)
|
||||
{
|
||||
$r = array();
|
||||
$response = explode("\n", $response);
|
||||
@ -245,14 +245,14 @@ class SimpleOpenID
|
||||
return $r;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* OpenID_Standarize
|
||||
*
|
||||
* @param string $openid_identity Server
|
||||
* @return string
|
||||
*/
|
||||
function OpenID_Standarize($openid_identity = null)
|
||||
public function OpenID_Standarize($openid_identity = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($openid_identity === null)
|
||||
@ -279,7 +279,7 @@ class SimpleOpenID
|
||||
* @param array $arr An array
|
||||
* @return false|string false if KO, string of url if OK
|
||||
*/
|
||||
function array2url($arr)
|
||||
public function array2url($arr)
|
||||
{
|
||||
// converts associated array to URL Query String
|
||||
if (!is_array($arr)){
|
||||
@ -292,7 +292,7 @@ class SimpleOpenID
|
||||
return $query;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* FSOCK_Request
|
||||
*
|
||||
@ -301,7 +301,7 @@ class SimpleOpenID
|
||||
* @param string $params Params
|
||||
* @return boolean|unknown
|
||||
*/
|
||||
function FSOCK_Request($url, $method = "GET", $params = "")
|
||||
public function FSOCK_Request($url, $method = "GET", $params = "")
|
||||
{
|
||||
// phpcs:enable
|
||||
$fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds
|
||||
@ -326,7 +326,7 @@ class SimpleOpenID
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* CURL_Request
|
||||
*
|
||||
@ -335,7 +335,7 @@ class SimpleOpenID
|
||||
* @param string $params Params
|
||||
* @return string
|
||||
*/
|
||||
function CURL_Request($url, $method = "GET", $params = "")
|
||||
public function CURL_Request($url, $method = "GET", $params = "")
|
||||
{
|
||||
// phpcs:enable
|
||||
// Remember, SSL MUST BE SUPPORTED
|
||||
@ -359,14 +359,14 @@ class SimpleOpenID
|
||||
return $response;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* HTML2OpenIDServer
|
||||
*
|
||||
* @param string $content Content
|
||||
* @return array Array of servers
|
||||
*/
|
||||
function HTML2OpenIDServer($content)
|
||||
public function HTML2OpenIDServer($content)
|
||||
{
|
||||
// phpcs:enable
|
||||
$get = array();
|
||||
@ -387,20 +387,20 @@ class SimpleOpenID
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Get openid server
|
||||
*
|
||||
* @param string $url Url to found endpoint
|
||||
* @return string Endpoint
|
||||
*/
|
||||
function GetOpenIDServer($url = '')
|
||||
public function GetOpenIDServer($url = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
|
||||
$response = getURLContent($url);
|
||||
|
||||
@ -417,13 +417,13 @@ class SimpleOpenID
|
||||
return $servers[0];
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* GetRedirectURL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function GetRedirectURL()
|
||||
public function GetRedirectURL()
|
||||
{
|
||||
// phpcs:enable
|
||||
$params = array();
|
||||
@ -443,13 +443,13 @@ class SimpleOpenID
|
||||
return $this->URLs['openid_server'] . "?". $this->array2url($params);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Redirect
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function Redirect()
|
||||
public function Redirect()
|
||||
{
|
||||
// phpcs:enable
|
||||
$redirect_to = $this->GetRedirectURL();
|
||||
@ -465,19 +465,19 @@ class SimpleOpenID
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* ValidateWithServer
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function ValidateWithServer()
|
||||
public function ValidateWithServer()
|
||||
{
|
||||
// phpcs:enable
|
||||
$params = array(
|
||||
'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
|
||||
'openid.signed' => urlencode($_GET['openid_signed']),
|
||||
'openid.sig' => urlencode($_GET['openid_sig'])
|
||||
'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
|
||||
'openid.signed' => urlencode($_GET['openid_signed']),
|
||||
'openid.sig' => urlencode($_GET['openid_sig'])
|
||||
);
|
||||
// Send only required parameters to confirm validity
|
||||
$arr_signed = explode(",", str_replace('sreg.', 'sreg_', $_GET['openid_signed']));
|
||||
@ -518,36 +518,36 @@ class SimpleOpenID
|
||||
* @param string $url Url of endpoint to request
|
||||
* @return string First endpoint OpenID server found. False if it failed to found.
|
||||
*/
|
||||
function sendDiscoveryRequestToGetXRDS($url = '')
|
||||
public function sendDiscoveryRequestToGetXRDS($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;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
|
||||
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
|
||||
|
||||
$addheaders=array('Accept: application/xrds+xml');
|
||||
$addheaders=array('Accept: application/xrds+xml');
|
||||
$response = getURLContent($url, 'GET', '', 1, $addheaders);
|
||||
/* response should like this:
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
|
||||
<XRD>
|
||||
<Service priority="0">
|
||||
<Type>http://specs.openid.net/auth/2.0/server</Type>
|
||||
<Type>http://openid.net/srv/ax/1.0</Type>
|
||||
...
|
||||
<URI>https://www.google.com/accounts/o8/ud</URI>
|
||||
</Service>
|
||||
</XRD>
|
||||
</xrds:XRDS>
|
||||
*/
|
||||
$content=$response['content'];
|
||||
/* response should like this:
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
|
||||
<XRD>
|
||||
<Service priority="0">
|
||||
<Type>http://specs.openid.net/auth/2.0/server</Type>
|
||||
<Type>http://openid.net/srv/ax/1.0</Type>
|
||||
...
|
||||
<URI>https://www.google.com/accounts/o8/ud</URI>
|
||||
</Service>
|
||||
</XRD>
|
||||
</xrds:XRDS>
|
||||
*/
|
||||
$content=$response['content'];
|
||||
|
||||
$server='';
|
||||
if (preg_match('/'.preg_quote('<URI>', '/').'(.*)'.preg_quote('</URI>', '/').'/is', $content, $reg))
|
||||
{
|
||||
$server=$reg[1];
|
||||
$server=$reg[1];
|
||||
}
|
||||
|
||||
if (empty($server))
|
||||
@ -557,9 +557,9 @@ class SimpleOpenID
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
|
||||
$this->SetOpenIDServer($server);
|
||||
return $server;
|
||||
}
|
||||
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
|
||||
$this->SetOpenIDServer($server);
|
||||
return $server;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@ class RssParser
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
private $_format='';
|
||||
private $_urlRSS;
|
||||
@ -61,7 +61,7 @@ class RssParser
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,28 +252,28 @@ class RssParser
|
||||
|
||||
if ($str !== false)
|
||||
{
|
||||
// Convert $str into xml
|
||||
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
|
||||
{
|
||||
//print 'xx'.LIBXML_NOCDATA;
|
||||
libxml_use_internal_errors(false);
|
||||
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlparser=xml_parser_create('');
|
||||
if (!is_resource($xmlparser)) {
|
||||
$this->error="ErrorFailedToCreateParser"; return -1;
|
||||
}
|
||||
// Convert $str into xml
|
||||
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
|
||||
{
|
||||
//print 'xx'.LIBXML_NOCDATA;
|
||||
libxml_use_internal_errors(false);
|
||||
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlparser=xml_parser_create('');
|
||||
if (!is_resource($xmlparser)) {
|
||||
$this->error="ErrorFailedToCreateParser"; return -1;
|
||||
}
|
||||
|
||||
xml_set_object($xmlparser, $this);
|
||||
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
|
||||
xml_set_character_data_handler($xmlparser, 'feed_cdata');
|
||||
$status = xml_parse($xmlparser, $str);
|
||||
xml_parser_free($xmlparser);
|
||||
$rss=$this;
|
||||
//var_dump($rss->_format);exit;
|
||||
}
|
||||
xml_set_object($xmlparser, $this);
|
||||
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
|
||||
xml_set_character_data_handler($xmlparser, 'feed_cdata');
|
||||
$status = xml_parse($xmlparser, $str);
|
||||
xml_parser_free($xmlparser);
|
||||
$rss=$this;
|
||||
//var_dump($rss->_format);exit;
|
||||
}
|
||||
}
|
||||
|
||||
// If $rss loaded
|
||||
@ -287,16 +287,16 @@ class RssParser
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
if ($fp)
|
||||
{
|
||||
fwrite($fp, $str);
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
fwrite($fp, $str);
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
|
||||
$this->_lastfetchdate=$nowgmt;
|
||||
$this->_lastfetchdate=$nowgmt;
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'Error, failed to open file '.$newpathofdestfile.' for write';
|
||||
print 'Error, failed to open file '.$newpathofdestfile.' for write';
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,13 +435,13 @@ class RssParser
|
||||
|
||||
// Add record to result array
|
||||
$this->_rssarray[$i] = array(
|
||||
'link'=>$itemLink,
|
||||
'title'=>$itemTitle,
|
||||
'description'=>$itemDescription,
|
||||
'pubDate'=>$itemPubDate,
|
||||
'category'=>$itemCategory,
|
||||
'id'=>$itemId,
|
||||
'author'=>$itemAuthor);
|
||||
'link'=>$itemLink,
|
||||
'title'=>$itemTitle,
|
||||
'description'=>$itemDescription,
|
||||
'pubDate'=>$itemPubDate,
|
||||
'category'=>$itemCategory,
|
||||
'id'=>$itemId,
|
||||
'author'=>$itemAuthor);
|
||||
//var_dump($this->_rssarray);
|
||||
|
||||
$i++;
|
||||
@ -461,7 +461,7 @@ class RssParser
|
||||
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Triggered when opened tag is found
|
||||
*
|
||||
@ -470,7 +470,7 @@ class RssParser
|
||||
* @param array $attrs Attributes of tags
|
||||
* @return void
|
||||
*/
|
||||
function feed_start_element($p, $element, &$attrs)
|
||||
public function feed_start_element($p, $element, &$attrs)
|
||||
{
|
||||
// phpcs:enable
|
||||
$el = $element = strtolower($element);
|
||||
@ -581,7 +581,7 @@ class RssParser
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Triggered when CDATA is found
|
||||
*
|
||||
@ -589,7 +589,7 @@ class RssParser
|
||||
* @param string $text Tag
|
||||
* @return void
|
||||
*/
|
||||
function feed_cdata($p, $text)
|
||||
public function feed_cdata($p, $text)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($this->_format == 'atom' and $this->incontent)
|
||||
@ -603,7 +603,7 @@ class RssParser
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Triggered when closed tag is found
|
||||
*
|
||||
@ -611,7 +611,7 @@ class RssParser
|
||||
* @param string $el Tag
|
||||
* @return void
|
||||
*/
|
||||
function feed_end_element($p, $el)
|
||||
public function feed_end_element($p, $el)
|
||||
{
|
||||
// phpcs:enable
|
||||
$el = strtolower($el);
|
||||
@ -666,7 +666,7 @@ class RssParser
|
||||
* @param string $str2 Str2
|
||||
* @return string String cancatenated
|
||||
*/
|
||||
function concat(&$str1, $str2 = "")
|
||||
public function concat(&$str1, $str2 = "")
|
||||
{
|
||||
if (!isset($str1) ) {
|
||||
$str1="";
|
||||
@ -674,14 +674,14 @@ class RssParser
|
||||
$str1 .= $str2;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $text Text
|
||||
* @return void
|
||||
*/
|
||||
function append_content($text)
|
||||
public function append_content($text)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ( $this->initem ) {
|
||||
@ -699,7 +699,7 @@ class RssParser
|
||||
* @param string $text Text
|
||||
* @return void
|
||||
*/
|
||||
function append($el, $text)
|
||||
public function append($el, $text)
|
||||
{
|
||||
if (!$el) {
|
||||
return;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,7 @@ abstract class Stats
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
|
||||
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -136,7 +136,7 @@ abstract class Stats
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
|
||||
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -228,8 +228,8 @@ abstract class Stats
|
||||
* @param int $startyear End year
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAverageByMonthWithPrevYear($endyear, $startyear)
|
||||
{
|
||||
public function getAverageByMonthWithPrevYear($endyear, $startyear)
|
||||
{
|
||||
if ($startyear > $endyear) return -1;
|
||||
|
||||
$datay=array();
|
||||
@ -264,9 +264,9 @@ abstract class Stats
|
||||
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAllByProductEntry($year, $cachedelay = 0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
public function getAllByProductEntry($year, $cachedelay = 0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$datay=array();
|
||||
|
||||
@ -333,14 +333,16 @@ abstract class Stats
|
||||
// Here we have low level of shared code called by XxxStats.class.php
|
||||
|
||||
|
||||
/**
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Return nb of elements by year
|
||||
*
|
||||
* @param string $sql SQL request
|
||||
* @return array
|
||||
*/
|
||||
function _getNbByYear($sql)
|
||||
{
|
||||
protected function _getNbByYear($sql)
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
@ -363,14 +365,16 @@ abstract class Stats
|
||||
return $result;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Return nb of elements, total amount and avg amount each year
|
||||
*
|
||||
* @param string $sql SQL request
|
||||
* @return array Array with nb, total amount, average for each year
|
||||
*/
|
||||
function _getAllByYear($sql)
|
||||
protected function _getAllByYear($sql)
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
@ -405,6 +409,7 @@ abstract class Stats
|
||||
return $result;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Renvoie le nombre de proposition par mois pour une annee donnee
|
||||
*
|
||||
@ -412,9 +417,10 @@ abstract class Stats
|
||||
* @param string $sql SQL
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array Array of nb each month
|
||||
*/
|
||||
function _getNbByMonth($year, $sql, $format = 0)
|
||||
{
|
||||
*/
|
||||
protected function _getNbByMonth($year, $sql, $format = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
@ -462,6 +468,7 @@ abstract class Stats
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Renvoie le nombre d'element par mois pour une annee donnee
|
||||
*
|
||||
@ -470,8 +477,9 @@ abstract class Stats
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array
|
||||
*/
|
||||
function _getAmountByMonth($year, $sql, $format = 0)
|
||||
{
|
||||
protected function _getAmountByMonth($year, $sql, $format = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
@ -514,18 +522,20 @@ abstract class Stats
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie le montant moyen par mois pour une annee donnee
|
||||
*
|
||||
* @param int $year Year
|
||||
* @param string $sql SQL
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array
|
||||
*/
|
||||
function _getAverageByMonth($year, $sql, $format = 0)
|
||||
{
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Renvoie le montant moyen par mois pour une annee donnee
|
||||
*
|
||||
* @param int $year Year
|
||||
* @param string $sql SQL
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array
|
||||
*/
|
||||
protected function _getAverageByMonth($year, $sql, $format = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
@ -567,18 +577,20 @@ abstract class Stats
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return number or total of product refs
|
||||
*
|
||||
* @param string $sql SQL
|
||||
* @param int $limit Limit
|
||||
* @return array
|
||||
*/
|
||||
function _getAllByProduct($sql, $limit = 10)
|
||||
{
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Return number or total of product refs
|
||||
*
|
||||
* @param string $sql SQL
|
||||
* @param int $limit Limit
|
||||
* @return array
|
||||
*/
|
||||
protected function _getAllByProduct($sql, $limit = 10)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
@ -592,16 +604,16 @@ abstract class Stats
|
||||
$i = 0; $other=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$row = $this->db->fetch_row($resql);
|
||||
if ($i < $limit || $num == $limit) $result[$i] = array($row[0],$row[1]); // Ref of product, nb
|
||||
else $other += $row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if ($num > $limit) $result[$i] = array($langs->transnoentitiesnoconv("Other"),$other);
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ class Translate
|
||||
* @param string $dir Force directory that contains /langs subdirectory (value is sometimes '..' like into install/* pages or support/* pages). Use '' by default.
|
||||
* @param Conf $conf Object with Dolibarr configuration
|
||||
*/
|
||||
function __construct($dir, $conf)
|
||||
public function __construct($dir, $conf)
|
||||
{
|
||||
if (! empty($conf->file->character_set_client)) $this->charset_output=$conf->file->character_set_client; // If charset output is forced
|
||||
if ($dir) $this->dir=array($dir);
|
||||
@ -62,7 +62,7 @@ class Translate
|
||||
* @param string $srclang Language to use. If '' or 'auto', we use browser lang.
|
||||
* @return void
|
||||
*/
|
||||
function setDefaultLang($srclang = 'en_US')
|
||||
public function setDefaultLang($srclang = 'en_US')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -132,7 +132,7 @@ class Translate
|
||||
* @param int $mode 0=Long language code, 1=Short language code (en, fr, es, ...)
|
||||
* @return string Language code used (en_US, en_AU, fr_FR, ...)
|
||||
*/
|
||||
function getDefaultLang($mode = 0)
|
||||
public function getDefaultLang($mode = 0)
|
||||
{
|
||||
if (empty($mode)) return $this->defaultlang;
|
||||
else return substr($this->defaultlang, 0, 2);
|
||||
@ -145,7 +145,7 @@ class Translate
|
||||
* @param array $domains Array of lang files to load
|
||||
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
||||
*/
|
||||
function loadLangs($domains)
|
||||
public function loadLangs($domains)
|
||||
{
|
||||
foreach($domains as $domain)
|
||||
{
|
||||
@ -173,7 +173,7 @@ class Translate
|
||||
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
||||
* @see loadLangs
|
||||
*/
|
||||
function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0)
|
||||
public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0)
|
||||
{
|
||||
global $conf,$db;
|
||||
|
||||
@ -399,7 +399,7 @@ class Translate
|
||||
* @param Database $db Database handler
|
||||
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
||||
*/
|
||||
function loadFromDatabase($db)
|
||||
public function loadFromDatabase($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -537,8 +537,8 @@ class Translate
|
||||
* @param string $key Key to translate
|
||||
* @return string Translated string (translated with transnoentitiesnoconv)
|
||||
*/
|
||||
private function getTradFromKey($key)
|
||||
{
|
||||
private function getTradFromKey($key)
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
if (! is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
|
||||
@ -577,7 +577,7 @@ class Translate
|
||||
}*/
|
||||
|
||||
return $newstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -593,9 +593,9 @@ class Translate
|
||||
* @param string $param4 chaine de param4
|
||||
* @param int $maxsize Max length of text
|
||||
* @return string Translated string (encoded into HTML entities and UTF8)
|
||||
*/
|
||||
function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0)
|
||||
{
|
||||
*/
|
||||
public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($this->tab_translate[$key])) // Translation is available
|
||||
@ -638,7 +638,7 @@ class Translate
|
||||
//if ($key[0] == '$') { return dol_eval($key,1); }
|
||||
return $this->getTradFromKey($key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -655,7 +655,7 @@ class Translate
|
||||
* @param string $param5 chaine de param5
|
||||
* @return string Translated string (encoded into UTF8)
|
||||
*/
|
||||
function transnoentities($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
|
||||
public function transnoentities($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
|
||||
{
|
||||
return $this->convToOutputCharset($this->transnoentitiesnoconv($key, $param1, $param2, $param3, $param4, $param5));
|
||||
}
|
||||
@ -676,7 +676,7 @@ class Translate
|
||||
* @param string $param5 chaine de param5
|
||||
* @return string Translated string
|
||||
*/
|
||||
function transnoentitiesnoconv($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
|
||||
public function transnoentitiesnoconv($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -719,7 +719,7 @@ class Translate
|
||||
* @param string $countrycode country code (FR, ...)
|
||||
* @return string translated string
|
||||
*/
|
||||
function transcountry($str, $countrycode)
|
||||
public function transcountry($str, $countrycode)
|
||||
{
|
||||
if ($this->tab_translate["$str$countrycode"]) return $this->trans("$str$countrycode");
|
||||
else return $this->trans($str);
|
||||
@ -733,7 +733,7 @@ class Translate
|
||||
* @param string $countrycode country code (FR, ...)
|
||||
* @return string translated string
|
||||
*/
|
||||
function transcountrynoentities($str, $countrycode)
|
||||
public function transcountrynoentities($str, $countrycode)
|
||||
{
|
||||
if ($this->tab_translate["$str$countrycode"]) return $this->transnoentities("$str$countrycode");
|
||||
else return $this->transnoentities($str);
|
||||
@ -747,7 +747,7 @@ class Translate
|
||||
* @param string $pagecodefrom Page code of src string
|
||||
* @return string Converted string
|
||||
*/
|
||||
function convToOutputCharset($str, $pagecodefrom = 'UTF-8')
|
||||
public function convToOutputCharset($str, $pagecodefrom = 'UTF-8')
|
||||
{
|
||||
if ($pagecodefrom == 'ISO-8859-1' && $this->charset_output == 'UTF-8') $str=utf8_encode($str);
|
||||
if ($pagecodefrom == 'UTF-8' && $this->charset_output == 'ISO-8859-1') $str=utf8_decode(str_replace('€', chr(128), $str));
|
||||
@ -755,7 +755,7 @@ class Translate
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of all available languages
|
||||
*
|
||||
@ -764,8 +764,8 @@ class Translate
|
||||
* @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code
|
||||
* @return array List of languages
|
||||
*/
|
||||
function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0)
|
||||
{
|
||||
public function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
@ -793,10 +793,10 @@ class Translate
|
||||
}
|
||||
}
|
||||
return $langs_available;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return if a filename $filename exists for current language (or alternate language)
|
||||
*
|
||||
@ -804,8 +804,8 @@ class Translate
|
||||
* @param integer $searchalt Search also alernate language file
|
||||
* @return boolean true if exists and readable
|
||||
*/
|
||||
function file_exists($filename, $searchalt = 0)
|
||||
{
|
||||
public function file_exists($filename, $searchalt = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
// Test si fichier dans repertoire de la langue
|
||||
foreach($this->dir as $searchdir)
|
||||
@ -822,7 +822,7 @@ class Translate
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -836,8 +836,8 @@ class Translate
|
||||
* 10 if setDefaultLang was en_US => ten
|
||||
* 123 if setDefaultLang was fr_FR => cent vingt trois
|
||||
*/
|
||||
function getLabelFromNumber($number, $isamount = 0)
|
||||
{
|
||||
public function getLabelFromNumber($number, $isamount = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$newnumber=$number;
|
||||
@ -861,7 +861,7 @@ class Translate
|
||||
}
|
||||
|
||||
return $newnumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -879,8 +879,8 @@ class Translate
|
||||
* @return string Label in UTF8 (but without entities)
|
||||
* @see dol_getIdFromCode
|
||||
*/
|
||||
function getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect = '', $filteronentity = 0)
|
||||
{
|
||||
public function getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect = '', $filteronentity = 0)
|
||||
{
|
||||
// If key empty
|
||||
if ($key == '') return '';
|
||||
|
||||
@ -919,7 +919,7 @@ class Translate
|
||||
$this->error=$db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -931,7 +931,7 @@ class Translate
|
||||
* @deprecated Use method price to output a price
|
||||
* @see price()
|
||||
*/
|
||||
function getCurrencyAmount($currency_code, $amount)
|
||||
public function getCurrencyAmount($currency_code, $amount)
|
||||
{
|
||||
$symbol=$this->getCurrencySymbol($currency_code);
|
||||
|
||||
@ -947,8 +947,8 @@ class Translate
|
||||
* @param integer $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency.
|
||||
* @return string Currency symbol encoded into UTF8
|
||||
*/
|
||||
function getCurrencySymbol($currency_code, $forceloadall = 0)
|
||||
{
|
||||
public function getCurrencySymbol($currency_code, $forceloadall = 0)
|
||||
{
|
||||
$currency_sign = ''; // By default return iso code
|
||||
|
||||
if (function_exists("mb_convert_encoding"))
|
||||
@ -965,7 +965,7 @@ class Translate
|
||||
}
|
||||
|
||||
return ($currency_sign?$currency_sign:$currency_code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load into the cache this->cache_currencies, all currencies
|
||||
@ -1021,23 +1021,23 @@ class Translate
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return an array with content of all loaded translation keys (found into this->tab_translate) so
|
||||
* we get a substitution array we can use for substitutions (for mail or ODT generation for example)
|
||||
*
|
||||
* @return array Array of translation keys lang_key => string_translation_loaded
|
||||
*/
|
||||
function get_translations_for_substitutions()
|
||||
{
|
||||
public function get_translations_for_substitutions()
|
||||
{
|
||||
// phpcs:enable
|
||||
$substitutionarray = array();
|
||||
$substitutionarray = array();
|
||||
|
||||
foreach($this->tab_translate as $code => $label) {
|
||||
$substitutionarray['lang_'.$code] = $label;
|
||||
$substitutionarray['__('.$code.')__'] = $label;
|
||||
}
|
||||
foreach($this->tab_translate as $code => $label) {
|
||||
$substitutionarray['lang_'.$code] = $label;
|
||||
$substitutionarray['__('.$code.')__'] = $label;
|
||||
}
|
||||
|
||||
return $substitutionarray;
|
||||
}
|
||||
return $substitutionarray;
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,7 +843,7 @@ class Utils
|
||||
|
||||
$this->output = 'Archive log files (keeping last SYSLOG_FILE_SAVES='.$nbSaves.' files) done.';
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Backup the db OR just a table without mysqldump binary, with PHP only (does not require any exec permission)
|
||||
* Author: David Walsh (http://davidwalsh.name/backup-mysql-database-php)
|
||||
|
||||
@ -92,13 +92,13 @@ class vCard
|
||||
|
||||
|
||||
/**
|
||||
* mise en forme du numero de telephone
|
||||
* mise en forme du numero de telephone
|
||||
*
|
||||
* @param int $number numero de telephone
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
* @param int $number numero de telephone
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
*/
|
||||
function setPhoneNumber($number, $type = "")
|
||||
public function setPhoneNumber($number, $type = "")
|
||||
{
|
||||
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
|
||||
$key = "TEL";
|
||||
@ -115,7 +115,7 @@ class vCard
|
||||
* @param string $photo Photo
|
||||
* @return void
|
||||
*/
|
||||
function setPhoto($type, $photo)
|
||||
public function setPhoto($type, $photo)
|
||||
{
|
||||
// $type = "GIF" | "JPEG"
|
||||
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
|
||||
@ -127,7 +127,7 @@ class vCard
|
||||
* @param string $name Name
|
||||
* @return void
|
||||
*/
|
||||
function setFormattedName($name)
|
||||
public function setFormattedName($name)
|
||||
{
|
||||
$this->properties["FN;CHARSET=".$this->encoding] = encode($name);
|
||||
}
|
||||
@ -142,7 +142,7 @@ class vCard
|
||||
* @param string $suffix Suffix
|
||||
* @return void
|
||||
*/
|
||||
function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "")
|
||||
public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "")
|
||||
{
|
||||
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
|
||||
$this->filename = "$first%20$family.vcf";
|
||||
@ -155,7 +155,7 @@ class vCard
|
||||
* @param timestamp $date Date
|
||||
* @return void
|
||||
*/
|
||||
function setBirthday($date)
|
||||
public function setBirthday($date)
|
||||
{
|
||||
// $date format is YYYY-MM-DD - RFC 2425 and RFC 2426
|
||||
$this->properties["BDAY"] = dol_print_date($date, 'dayrfc');
|
||||
@ -174,7 +174,7 @@ class vCard
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
*/
|
||||
function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
|
||||
public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
|
||||
{
|
||||
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
|
||||
$key = "ADR";
|
||||
@ -189,19 +189,19 @@ class vCard
|
||||
}
|
||||
|
||||
/**
|
||||
* mise en forme du label
|
||||
* mise en forme du label
|
||||
*
|
||||
* @param string $postoffice Postoffice
|
||||
* @param string $extended Extended
|
||||
* @param string $street Street
|
||||
* @param string $city City
|
||||
* @param string $region Region
|
||||
* @param string $zip Zip
|
||||
* @param string $country Country
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
* @param string $postoffice Postoffice
|
||||
* @param string $extended Extended
|
||||
* @param string $street Street
|
||||
* @param string $city City
|
||||
* @param string $region Region
|
||||
* @param string $zip Zip
|
||||
* @param string $country Country
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
*/
|
||||
function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
|
||||
public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
|
||||
{
|
||||
$label = "";
|
||||
if ($postoffice!="") $label.= "$postoffice\r\n";
|
||||
@ -222,7 +222,7 @@ class vCard
|
||||
* @param string $type Vcard type
|
||||
* @return void
|
||||
*/
|
||||
function setEmail($address, $type = "internet,pref")
|
||||
public function setEmail($address, $type = "internet,pref")
|
||||
{
|
||||
$this->properties["EMAIL;TYPE=".$type] = $address;
|
||||
}
|
||||
@ -233,7 +233,7 @@ class vCard
|
||||
* @param string $note Note
|
||||
* @return void
|
||||
*/
|
||||
function setNote($note)
|
||||
public function setNote($note)
|
||||
{
|
||||
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
|
||||
}
|
||||
@ -244,19 +244,19 @@ class vCard
|
||||
* @param string $title Title
|
||||
* @return void
|
||||
*/
|
||||
function setTitle($title)
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mise en forme de la societe
|
||||
* mise en forme de la societe
|
||||
*
|
||||
* @param string $org Org
|
||||
* @return void
|
||||
* @param string $org Org
|
||||
* @return void
|
||||
*/
|
||||
function setOrg($org)
|
||||
public function setOrg($org)
|
||||
{
|
||||
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
|
||||
}
|
||||
@ -268,7 +268,7 @@ class vCard
|
||||
* @param string $prodid Prodid
|
||||
* @return void
|
||||
*/
|
||||
function setProdId($prodid)
|
||||
public function setProdId($prodid)
|
||||
{
|
||||
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
|
||||
}
|
||||
@ -280,7 +280,7 @@ class vCard
|
||||
* @param string $uid Uid
|
||||
* @return void
|
||||
*/
|
||||
function setUID($uid)
|
||||
public function setUID($uid)
|
||||
{
|
||||
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
|
||||
}
|
||||
@ -293,7 +293,7 @@ class vCard
|
||||
* @param string $type Type
|
||||
* @return void
|
||||
*/
|
||||
function setURL($url, $type = "")
|
||||
public function setURL($url, $type = "")
|
||||
{
|
||||
// $type may be WORK | HOME
|
||||
$key = "URL";
|
||||
@ -306,7 +306,7 @@ class vCard
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getVCard()
|
||||
public function getVCard()
|
||||
{
|
||||
$text = "BEGIN:VCARD\r\n";
|
||||
$text.= "VERSION:3.0\r\n";
|
||||
@ -326,7 +326,7 @@ class vCard
|
||||
*
|
||||
* @return string Filename
|
||||
*/
|
||||
function getFileName()
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
@ -101,12 +101,12 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
|
||||
|
||||
/**
|
||||
* Return description of a module
|
||||
* Return description of a module
|
||||
*
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
* @param Translate $langs Lang object to use for output
|
||||
* @return string Description
|
||||
*/
|
||||
function info($langs)
|
||||
public function info($langs)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -205,7 +205,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
return $texte;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
@ -217,7 +217,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $product,$langs,$conf,$mysoc,$hookmanager,$user;
|
||||
@ -320,8 +320,8 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
$contactobject=null;
|
||||
if (! empty($usecontact))
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$socobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
|
||||
@ -148,7 +148,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
@ -160,8 +160,8 @@ class pdf_standard extends ModelePDFProduct
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
*/
|
||||
function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
||||
|
||||
@ -204,7 +204,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Add pdfgeneration hook
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
@ -592,7 +592,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined", "PRODUCT_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -608,7 +608,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
* @param string $currency Currency code
|
||||
* @return void
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
|
||||
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -718,7 +718,7 @@ class pdf_standard extends ModelePDFProduct
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return void
|
||||
*/
|
||||
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
|
||||
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
|
||||
{
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
@ -855,22 +855,22 @@ class pdf_standard extends ModelePDFProduct
|
||||
*/
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
}
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
{
|
||||
global $conf;
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
||||
}
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
{
|
||||
global $conf;
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->code_null = 0;
|
||||
$this->code_modifiable = 1;
|
||||
@ -83,13 +83,14 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
}
|
||||
|
||||
|
||||
/** Return description of module
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
*/
|
||||
function info($langs)
|
||||
{
|
||||
/**
|
||||
* Return description of module
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
*/
|
||||
public function info($langs)
|
||||
{
|
||||
global $conf, $mc;
|
||||
global $form;
|
||||
|
||||
@ -127,7 +128,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
$texte.= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -138,7 +139,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
|
||||
* @return string Return string example
|
||||
*/
|
||||
function getExample($langs, $objproduct = 0, $type = -1)
|
||||
public function getExample($langs, $objproduct = 0, $type = -1)
|
||||
{
|
||||
if ($type == 0 || $type == -1)
|
||||
{
|
||||
@ -179,7 +180,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
* @param int $type Produit ou service (0:product, 1:service)
|
||||
* @return string Value if OK, '' if module not configured, <0 if KO
|
||||
*/
|
||||
function getNextValue($objproduct = 0, $type = -1)
|
||||
public function getNextValue($objproduct = 0, $type = -1)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
@ -219,13 +220,13 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Check if mask/numbering use prefix
|
||||
*
|
||||
* @return int 0 or 1
|
||||
*/
|
||||
function verif_prefixIsUsed()
|
||||
public function verif_prefixIsUsed()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@ -254,7 +255,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
* -4 ErrorPrefixRequired
|
||||
* -5 Other (see this->error)
|
||||
*/
|
||||
function verif($db, &$code, $product, $type)
|
||||
public function verif($db, &$code, $product, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -298,14 +299,14 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Renvoi si un code est pris ou non (par autre tiers)
|
||||
* Renvoi si un code est pris ou non (par autre tiers)
|
||||
*
|
||||
* @param DoliDB $db Handler acces base
|
||||
* @param string $code Code a verifier
|
||||
* @param Product $product Objet product
|
||||
* @return int 0 if available, <0 if KO
|
||||
* @param DoliDB $db Handler acces base
|
||||
* @param string $code Code a verifier
|
||||
* @param Product $product Objet product
|
||||
* @return int 0 if available, <0 if KO
|
||||
*/
|
||||
function verif_dispo($db, $code, $product)
|
||||
public function verif_dispo($db, $code, $product)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."product";
|
||||
|
||||
@ -71,7 +71,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->code_null = 1;
|
||||
$this->code_modifiable = 1;
|
||||
@ -81,12 +81,13 @@ class mod_codeproduct_leopard extends ModeleProductCode
|
||||
}
|
||||
|
||||
|
||||
/** Return description of module
|
||||
/**
|
||||
* Return description of module
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Description of module
|
||||
*/
|
||||
function info($langs)
|
||||
public function info($langs)
|
||||
{
|
||||
$langs->load("companies");
|
||||
return $langs->trans("LeopardNumRefModelDesc");
|
||||
@ -100,7 +101,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
|
||||
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
|
||||
* @return string Return next value
|
||||
*/
|
||||
function getNextValue($objproduct = 0, $type = -1)
|
||||
public function getNextValue($objproduct = 0, $type = -1)
|
||||
{
|
||||
global $langs;
|
||||
return '';
|
||||
@ -108,19 +109,19 @@ class mod_codeproduct_leopard extends ModeleProductCode
|
||||
|
||||
|
||||
/**
|
||||
* Check validity of code according to its rules
|
||||
* Check validity of code according to its rules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $code Code to check/correct
|
||||
* @param Product $product Object product
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $code Code to check/correct
|
||||
* @param Product $product Object product
|
||||
* @param int $type 0 = product , 1 = service
|
||||
* @return int 0 if OK
|
||||
* -1 ErrorBadProductCodeSyntax
|
||||
* -2 ErrorProductCodeRequired
|
||||
* -3 ErrorProductCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
* @return int 0 if OK
|
||||
* -1 ErrorBadProductCodeSyntax
|
||||
* -2 ErrorProductCodeRequired
|
||||
* -3 ErrorProductCodeAlreadyUsed
|
||||
* -4 ErrorPrefixRequired
|
||||
*/
|
||||
function verif($db, &$code, $product, $type)
|
||||
public function verif($db, &$code, $product, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -131,7 +132,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
|
||||
{
|
||||
$result=0;
|
||||
}
|
||||
elseif (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) )
|
||||
elseif (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)))
|
||||
{
|
||||
$result=-2;
|
||||
}
|
||||
|
||||
@ -33,10 +33,10 @@
|
||||
*/
|
||||
abstract class ModelePDFProduct extends CommonDocGenerator
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
@ -47,33 +47,33 @@ abstract class ModelePDFProduct extends CommonDocGenerator
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
$type='product';
|
||||
$liste=array();
|
||||
$type='product';
|
||||
$liste=array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$liste=getListOfModels($db, $type, $maxfilenamelength);
|
||||
return $liste;
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$liste=getListOfModels($db, $type, $maxfilenamelength);
|
||||
return $liste;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ModeleProductCode
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
/** Renvoi la description par defaut du modele de numerotation
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
function info($langs)
|
||||
public function info($langs)
|
||||
{
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoDescription");
|
||||
@ -84,7 +84,7 @@ abstract class ModeleProductCode
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Nom du module
|
||||
*/
|
||||
function getNom($langs)
|
||||
public function getNom($langs)
|
||||
{
|
||||
return empty($this->name)?$this->nom:$this->name;
|
||||
}
|
||||
@ -95,7 +95,7 @@ abstract class ModeleProductCode
|
||||
* @param Translate $langs Object langs
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample($langs)
|
||||
public function getExample($langs)
|
||||
{
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoExample");
|
||||
@ -106,7 +106,7 @@ abstract class ModeleProductCode
|
||||
*
|
||||
* @return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
public function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -118,7 +118,7 @@ abstract class ModeleProductCode
|
||||
* @param int $type Type
|
||||
* @return string Value
|
||||
*/
|
||||
function getNextValue($objproduct = 0, $type = -1)
|
||||
public function getNextValue($objproduct = 0, $type = -1)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("Function_getNextValue_InModuleNotWorking");
|
||||
@ -129,7 +129,7 @@ abstract class ModeleProductCode
|
||||
*
|
||||
* @return string Version
|
||||
*/
|
||||
function getVersion()
|
||||
public function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
@ -141,7 +141,7 @@ abstract class ModeleProductCode
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi la liste des modeles de numérotation
|
||||
*
|
||||
@ -149,7 +149,7 @@ abstract class ModeleProductCode
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of numbers
|
||||
*/
|
||||
static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$liste=array();
|
||||
@ -175,22 +175,24 @@ abstract class ModeleProductCode
|
||||
}
|
||||
|
||||
/**
|
||||
* Return description of module parameters
|
||||
* Return description of module parameters
|
||||
*
|
||||
* @param Translate $langs Output language
|
||||
* @param Product $product Product object
|
||||
* @param int $type -1=Nothing, 0=Customer, 1=Supplier
|
||||
* @return string HTML translated description
|
||||
* @param Translate $langs Output language
|
||||
* @param Product $product Product object
|
||||
* @param int $type -1=Nothing, 0=Customer, 1=Supplier
|
||||
* @return string HTML translated description
|
||||
*/
|
||||
function getToolTip($langs, $product, $type)
|
||||
public function getToolTip($langs, $product, $type)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
$s='';
|
||||
if ($type == -1) $s.=$langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
|
||||
if ($type == -1) $s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
|
||||
if ($type == -1) {
|
||||
$s.=$langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
|
||||
$s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
|
||||
}
|
||||
if ($type == 0) $s.=$langs->trans("ProductCodeDesc").'<br>';
|
||||
if ($type == 1) $s.=$langs->trans("ServiceCodeDesc").'<br>';
|
||||
if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
|
||||
@ -243,11 +245,11 @@ abstract class ModeleProductCode
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Check if mask/numbering use prefix
|
||||
*
|
||||
* @return int 0=no, 1=yes
|
||||
*/
|
||||
function verif_prefixIsUsed()
|
||||
* Check if mask/numbering use prefix
|
||||
*
|
||||
* @return int 0=no, 1=yes
|
||||
*/
|
||||
public function verif_prefixIsUsed()
|
||||
{
|
||||
// phpcs:enable
|
||||
return 0;
|
||||
|
||||
@ -38,30 +38,30 @@
|
||||
*/
|
||||
abstract class ModelePDFProductBatch extends CommonDocGenerator
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
$type='product_batch';
|
||||
$list = array();
|
||||
$type = 'product_batch';
|
||||
$list = array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$list = getListOfModels($db, $type, $maxfilenamelength);
|
||||
return $list;
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$list = getListOfModels($db, $type, $maxfilenamelength);
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user