2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Frédéric FRANCE
2019-02-25 22:27:04 +01:00
parent 1c07006015
commit c89e4d79b8
19 changed files with 376 additions and 373 deletions

View File

@@ -50,7 +50,7 @@ class autoTranslator
* @param string $_apikey Api key * @param string $_apikey Api key
* @return void * @return void
*/ */
function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey) public function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey)
{ {
// Set enviorment variables // Set enviorment variables

View File

@@ -32,15 +32,15 @@ abstract class ActionsContactCardCommon
*/ */
public $db; public $db;
var $dirmodule; public $dirmodule;
var $targetmodule; public $targetmodule;
var $canvas; public $canvas;
var $card; public $card;
//! Template container //! Template container
var $tpl = array(); public $tpl = array();
//! Object container //! Object container
var $object; public $object;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
@@ -60,7 +60,7 @@ abstract class ActionsContactCardCommon
* @param int $id Object id * @param int $id Object id
* @return object Object loaded * @return object Object loaded
*/ */
function getObject($id) public function getObject($id)
{ {
/*$ret = $this->getInstanceDao(); /*$ret = $this->getInstanceDao();
@@ -76,7 +76,7 @@ abstract class ActionsContactCardCommon
//} //}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
@@ -84,7 +84,7 @@ abstract class ActionsContactCardCommon
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;

View File

@@ -38,7 +38,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function __construct($db, $dirmodule, $targetmodule, $canvas, $card) public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $db; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
@@ -66,7 +66,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
@@ -74,7 +74,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* @param int $id Id * @param int $id Id
* @return void * @return void
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $limit, $offset, $sortfield, $sortorder; global $limit, $offset, $sortfield, $sortorder;
@@ -121,7 +121,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Fetch datas list and save into ->list_datas * Fetch datas list and save into ->list_datas
* *
@@ -131,7 +131,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
* @param string $sortorder Sort order ('ASC' or 'DESC') * @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void * @return void
*/ */
function LoadListDatas($limit, $offset, $sortfield, $sortorder) public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;

View File

@@ -588,7 +588,7 @@ class Contact extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update field alert birthday * Update field alert birthday
* *

View File

@@ -40,53 +40,53 @@ class CMailFile
public $sendmode; public $sendmode;
public $sendsetup; public $sendsetup;
var $subject; // Topic: Subject of email public $subject; // Topic: Subject of email
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to). public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
// Sender: Who send the email ("Sender" has sent emails on behalf of "From"). // Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain. // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
// Return-Path: Email where to send bounds. // Return-Path: Email where to send bounds.
var $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined) public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
var $errors_to; // Errors-To: Email where to send errors. public $errors_to; // Errors-To: Email where to send errors.
var $addr_to; public $addr_to;
var $addr_cc; public $addr_cc;
var $addr_bcc; public $addr_bcc;
var $trackid; public $trackid;
var $mixed_boundary; public $mixed_boundary;
var $related_boundary; public $related_boundary;
var $alternative_boundary; public $alternative_boundary;
var $deliveryreceipt; public $deliveryreceipt;
var $eol; public $eol;
var $eol2; public $eol2;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
*/ */
public $error=''; public $error='';
var $smtps; // Contains SMTPs object (if this method is used) public $smtps; // Contains SMTPs object (if this method is used)
var $phpmailer; // Contains PHPMailer object (if this method is used) public $phpmailer; // Contains PHPMailer object (if this method is used)
/** /**
* @var string CSS * @var string CSS
*/ */
public $css; public $css;
//! Defined css style for body background //! Defined css style for body background
var $styleCSS; public $styleCSS;
//! Defined background directly in body tag //! Defined background directly in body tag
var $bodyCSS; public $bodyCSS;
var $headers; public $headers;
var $message; public $message;
// Image // Image
var $html; public $html;
var $image_boundary; public $image_boundary;
var $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). public $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used).
var $html_images=array(); public $html_images=array();
var $images_encoded=array(); public $images_encoded=array();
var $image_types = array( public $image_types = array(
'gif' => 'image/gif', 'gif' => 'image/gif',
'jpg' => 'image/jpeg', 'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg', 'jpeg' => 'image/jpeg',
@@ -119,7 +119,7 @@ class CMailFile
* @param string $sendcontext 'standard', 'emailing', ... (used to define with sending mode and parameters to use) * @param string $sendcontext 'standard', 'emailing', ... (used to define with sending mode and parameters to use)
* @param string $replyto Reply-to email (will be set to same value than From by default if not provided) * @param string $replyto Reply-to email (will be set to same value than From by default if not provided)
*/ */
function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '') public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '')
{ {
global $conf, $dolibarr_main_data_root; global $conf, $dolibarr_main_data_root;
@@ -493,7 +493,7 @@ class CMailFile
* *
* @return boolean True if mail sent, false otherwise * @return boolean True if mail sent, false otherwise
*/ */
function sendfile() public function sendfile()
{ {
global $conf,$db,$langs; global $conf,$db,$langs;
@@ -844,20 +844,20 @@ class CMailFile
* @param string $stringtoencode String to encode * @param string $stringtoencode String to encode
* @return string string encoded * @return string string encoded
*/ */
static function encodetorfc2822($stringtoencode) public static function encodetorfc2822($stringtoencode)
{ {
global $conf; global $conf;
return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?='; return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?=';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Read a file on disk and return encoded content for emails (mode = 'mail') * Read a file on disk and return encoded content for emails (mode = 'mail')
* *
* @param string $sourcefile Path to file to encode * @param string $sourcefile Path to file to encode
* @return int <0 if KO, encoded string if OK * @return int <0 if KO, encoded string if OK
*/ */
function _encode_file($sourcefile) private function _encode_file($sourcefile)
{ {
// phpcs:enable // phpcs:enable
$newsourcefile=dol_osencode($sourcefile); $newsourcefile=dol_osencode($sourcefile);
@@ -877,7 +877,7 @@ class CMailFile
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write content of a SMTP request into a dump file (mode = all) * Write content of a SMTP request into a dump file (mode = all)
* Used for debugging. * Used for debugging.
@@ -885,7 +885,7 @@ class CMailFile
* *
* @return void * @return void
*/ */
function dump_mail() public function dump_mail()
{ {
// phpcs:enable // phpcs:enable
global $conf,$dolibarr_main_data_root; global $conf,$dolibarr_main_data_root;
@@ -923,7 +923,7 @@ class CMailFile
* @param string $msg String * @param string $msg String
* @return string Completed string * @return string Completed string
*/ */
function checkIfHTML($msg) public function checkIfHTML($msg)
{ {
if (!preg_match('/^[\s\t]*<html/i', $msg)) if (!preg_match('/^[\s\t]*<html/i', $msg))
{ {
@@ -948,7 +948,7 @@ class CMailFile
* *
* @return string * @return string
*/ */
function buildCSS() public function buildCSS()
{ {
if (! empty($this->css)) if (! empty($this->css))
{ {
@@ -972,13 +972,13 @@ class CMailFile
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create SMTP headers (mode = 'mail') * Create SMTP headers (mode = 'mail')
* *
* @return string headers * @return string headers
*/ */
function write_smtpheaders() public function write_smtpheaders()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1036,7 +1036,7 @@ class CMailFile
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create header MIME (mode = 'mail') * Create header MIME (mode = 'mail')
* *
@@ -1044,7 +1044,7 @@ class CMailFile
* @param array $mimefilename_list Array of mime types * @param array $mimefilename_list Array of mime types
* @return string mime headers * @return string mime headers
*/ */
function write_mimeheaders($filename_list, $mimefilename_list) public function write_mimeheaders($filename_list, $mimefilename_list)
{ {
// phpcs:enable // phpcs:enable
$mimedone=0; $mimedone=0;
@@ -1067,14 +1067,14 @@ class CMailFile
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return email content (mode = 'mail') * Return email content (mode = 'mail')
* *
* @param string $msgtext Message string * @param string $msgtext Message string
* @return string String content * @return string String content
*/ */
function write_body($msgtext) public function write_body($msgtext)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1169,7 +1169,7 @@ class CMailFile
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Attach file to email (mode = 'mail') * Attach file to email (mode = 'mail')
* *
@@ -1178,7 +1178,7 @@ class CMailFile
* @param array $mimefilename_list Tableau * @param array $mimefilename_list Tableau
* @return string Chaine fichiers encodes * @return string Chaine fichiers encodes
*/ */
function write_files($filename_list, $mimetype_list, $mimefilename_list) public function write_files($filename_list, $mimetype_list, $mimefilename_list)
{ {
// phpcs:enable // phpcs:enable
$out = ''; $out = '';
@@ -1218,14 +1218,14 @@ class CMailFile
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Attach an image to email (mode = 'mail') * Attach an image to email (mode = 'mail')
* *
* @param array $images_list Array of array image * @param array $images_list Array of array image
* @return string Chaine images encodees * @return string Chaine images encodees
*/ */
function write_images($images_list) public function write_images($images_list)
{ {
// phpcs:enable // phpcs:enable
$out = ''; $out = '';
@@ -1259,7 +1259,7 @@ class CMailFile
* @param int $port Example: 25, 465 * @param int $port Example: 25, 465
* @return int Socket id if ok, 0 if KO * @return int Socket id if ok, 0 if KO
*/ */
function check_server_port($host, $port) public function check_server_port($host, $port)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1315,7 +1315,7 @@ class CMailFile
return $_retVal; return $_retVal;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* This function has been modified as provided by SirSir to allow multiline responses when * This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions. * using SMTP Extensions.
@@ -1324,7 +1324,7 @@ class CMailFile
* @param string $response Response string * @param string $response Response string
* @return boolean true if success * @return boolean true if success
*/ */
function server_parse($socket, $response) public function server_parse($socket, $response)
{ {
// phpcs:enable // phpcs:enable
$_retVal = true; // Indicates if Object was created or not $_retVal = true; // Indicates if Object was created or not
@@ -1354,7 +1354,7 @@ class CMailFile
* @param string $images_dir Location of physical images files * @param string $images_dir Location of physical images files
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function findHtmlImages($images_dir) public function findHtmlImages($images_dir)
{ {
// Build the list of image extensions // Build the list of image extensions
$extensions = array_keys($this->image_types); $extensions = array_keys($this->image_types);
@@ -1456,7 +1456,7 @@ class CMailFile
* If format 3: '<john@doe.com>' or '"John Doe" <john@doe.com>' or '"=?UTF-8?B?Sm9obiBEb2U=?=" <john@doe.com>' * If format 3: '<john@doe.com>' or '"John Doe" <john@doe.com>' or '"=?UTF-8?B?Sm9obiBEb2U=?=" <john@doe.com>'
* If format 4: 'John Doe' or 'john@doe.com' if no label exists * If format 4: 'John Doe' or 'john@doe.com' if no label exists
*/ */
static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0) public static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0)
{ {
global $conf; global $conf;
@@ -1523,7 +1523,7 @@ class CMailFile
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com' * @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
* @return array array of email => name * @return array array of email => name
*/ */
function getArrayAddress($address) public function getArrayAddress($address)
{ {
global $conf; global $conf;

View File

@@ -55,12 +55,12 @@ class AntiVir
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db=$db; $this->db=$db;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Scan a file with antivirus. * Scan a file with antivirus.
* This function runs the command defined in setup. This antivirus command must return 0 if OK. * This function runs the command defined in setup. This antivirus command must return 0 if OK.
@@ -69,7 +69,7 @@ class AntiVir
* @param string $file File to scan * @param string $file File to scan
* @return int <0 if KO (-98 if error, -99 if virus), 0 if OK * @return int <0 if KO (-98 if error, -99 if virus), 0 if OK
*/ */
function dol_avscan_file($file) public function dol_avscan_file($file)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -153,7 +153,7 @@ class AntiVir
* @param string $file File to scan * @param string $file File to scan
* @return string Full command line to run * @return string Full command line to run
*/ */
function getCliCommand($file) public function getCliCommand($file)
{ {
global $conf; global $conf;

View File

@@ -60,7 +60,7 @@ class Canvas
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $actiontype Action type ('create', 'view', 'edit', 'list') * @param string $actiontype Action type ('create', 'view', 'edit', 'list')
*/ */
function __construct($db, $actiontype = 'view') public function __construct($db, $actiontype = 'view')
{ {
$this->db = $db; $this->db = $db;
@@ -91,7 +91,7 @@ class Canvas
* @param string $canvas Name of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule) * @param string $canvas Name of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule)
* @return void * @return void
*/ */
function getCanvas($module, $card, $canvas) public function getCanvas($module, $card, $canvas)
{ {
global $conf, $langs; global $conf, $langs;
@@ -133,7 +133,7 @@ class Canvas
//print ' => template_dir='.$this->template_dir.'<br>'; //print ' => template_dir='.$this->template_dir.'<br>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Shared method for canvas to assign values for templates * Shared method for canvas to assign values for templates
* *
@@ -142,7 +142,7 @@ class Canvas
* @param string $ref Object ref (if id not provided) * @param string $ref Object ref (if id not provided)
* @return void * @return void
*/ */
function assign_values(&$action = 'view', $id = 0, $ref = '') public function assign_values(&$action = 'view', $id = 0, $ref = '')
{ {
// phpcs:enable // phpcs:enable
if (method_exists($this->control, 'assign_values')) $this->control->assign_values($action, $id, $ref); if (method_exists($this->control, 'assign_values')) $this->control->assign_values($action, $id, $ref);
@@ -154,7 +154,7 @@ class Canvas
* @param string $action Action code * @param string $action Action code
* @return int 0=Canvas template file does not exist, 1=Canvas template file exists * @return int 0=Canvas template file does not exist, 1=Canvas template file exists
*/ */
function displayCanvasExists($action) public function displayCanvasExists($action)
{ {
if (empty($this->template_dir)) return 0; if (empty($this->template_dir)) return 0;
@@ -162,7 +162,7 @@ class Canvas
else return 0; else return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Display a canvas page. This will include the template for output. * Display a canvas page. This will include the template for output.
* Variables used by templates may have been defined or loaded before into the assign_values function. * Variables used by templates may have been defined or loaded before into the assign_values function.
@@ -170,7 +170,7 @@ class Canvas
* @param string $action Action code * @param string $action Action code
* @return void * @return void
*/ */
function display_canvas($action) public function display_canvas($action)
{ {
// phpcs:enable // phpcs:enable
global $db, $conf, $langs, $user, $canvas; global $db, $conf, $langs, $user, $canvas;
@@ -188,7 +188,7 @@ class Canvas
* *
* @return boolean Return if canvas contains actions (old feature. now actions should be inside hooks) * @return boolean Return if canvas contains actions (old feature. now actions should be inside hooks)
*/ */
function hasActions() public function hasActions()
{ {
return (is_object($this->control)); return (is_object($this->control));
} }
@@ -204,7 +204,7 @@ class Canvas
* @return mixed Return return code of doActions of canvas * @return mixed Return return code of doActions of canvas
* @see http://wiki.dolibarr.org/index.php/Canvas_development * @see http://wiki.dolibarr.org/index.php/Canvas_development
*/ */
function doActions(&$action = 'view', $id = 0) public function doActions(&$action = 'view', $id = 0)
{ {
if (method_exists($this->control, 'doActions')) if (method_exists($this->control, 'doActions'))
{ {

View File

@@ -73,7 +73,7 @@ class Ccountry // extends CommonObject
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@@ -86,7 +86,7 @@ class Ccountry // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@@ -165,7 +165,7 @@ class Ccountry // extends CommonObject
* @param string $code Code * @param string $code Code
* @return int >0 if OK, 0 if not found, <0 if KO * @return int >0 if OK, 0 if not found, <0 if KO
*/ */
function fetch($id, $code = '') public function fetch($id, $code = '')
{ {
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
@@ -214,7 +214,7 @@ class Ccountry // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user = null, $notrigger = 0) public function update($user = null, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@@ -285,7 +285,7 @@ class Ccountry // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;

View File

@@ -69,7 +69,7 @@ class Comment extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@@ -82,7 +82,7 @@ class Comment extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
@@ -155,7 +155,7 @@ class Comment extends CommonObject
* @param int $ref ref object * @param int $ref ref object
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
global $langs; global $langs;
@@ -213,7 +213,7 @@ class Comment extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@@ -278,7 +278,7 @@ class Comment extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';

View File

@@ -61,7 +61,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
@@ -69,7 +69,7 @@ abstract class CommonDocGenerator
* @param Translate $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
function get_substitutionarray_user($user, $outputlangs) public function get_substitutionarray_user($user, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -99,7 +99,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
@@ -107,7 +107,7 @@ abstract class CommonDocGenerator
* @param Translate $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
function get_substitutionarray_mysoc($mysoc, $outputlangs) public function get_substitutionarray_mysoc($mysoc, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -159,7 +159,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
@@ -167,7 +167,7 @@ abstract class CommonDocGenerator
* @param Translate $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
function get_substitutionarray_thirdparty($object, $outputlangs) public function get_substitutionarray_thirdparty($object, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -240,7 +240,7 @@ abstract class CommonDocGenerator
return $array_thirdparty; return $array_thirdparty;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
@@ -249,7 +249,7 @@ abstract class CommonDocGenerator
* @param array $array_key Name of the key for return array * @param array $array_key Name of the key for return array
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -314,14 +314,14 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
* @param Translate $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
function get_substitutionarray_other($outputlangs) public function get_substitutionarray_other($outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -352,7 +352,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *
@@ -361,7 +361,7 @@ abstract class CommonDocGenerator
* @param string $array_key Name of the key for return array * @param string $array_key Name of the key for return array
* @return array Array of substitution * @return array Array of substitution
*/ */
function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -518,7 +518,7 @@ abstract class CommonDocGenerator
return $resarray; return $resarray;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *
@@ -526,7 +526,7 @@ abstract class CommonDocGenerator
* @param Translate $outputlangs Lang object to use for output * @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array * @return array Return a substitution array
*/ */
function get_substitutionarray_lines($line, $outputlangs) public function get_substitutionarray_lines($line, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -599,7 +599,7 @@ abstract class CommonDocGenerator
return $resarray; return $resarray;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *
@@ -608,7 +608,7 @@ abstract class CommonDocGenerator
* @param array $array_key Name of the key for return array * @param array $array_key Name of the key for return array
* @return array Array of substitution * @return array Array of substitution
*/ */
function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -662,7 +662,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *
@@ -670,7 +670,7 @@ abstract class CommonDocGenerator
* @param Translate $outputlangs Lang object to use for output * @param Translate $outputlangs Lang object to use for output
* @return array Substitution array * @return array Substitution array
*/ */
function get_substitutionarray_shipment_lines($line, $outputlangs) public function get_substitutionarray_shipment_lines($line, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -711,7 +711,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
@@ -720,7 +720,7 @@ 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) public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true)
{ {
// phpcs:enable // phpcs:enable
$array_other = array(); $array_other = array();
@@ -740,7 +740,7 @@ abstract class CommonDocGenerator
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Fill array with couple extrafield key => extrafield value * Fill array with couple extrafield key => extrafield value
* *
@@ -751,7 +751,7 @@ abstract class CommonDocGenerator
* @param Translate $outputlangs Lang object to use for output * @param Translate $outputlangs Lang object to use for output
* @return array Substitution array * @return array Substitution array
*/ */
function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs) public function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -838,7 +838,7 @@ abstract class CommonDocGenerator
* @param int $hidebottom Hide bottom * @param int $hidebottom Hide bottom
* @return void * @return void
*/ */
function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) public 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);
@@ -854,7 +854,7 @@ abstract class CommonDocGenerator
* @param array $b PDF lines array fields configs * @param array $b PDF lines array fields configs
* @return int Return compare result * @return int Return compare result
*/ */
function columnSort($a, $b) public function columnSort($a, $b)
{ {
if(empty($a['rank'])){ $a['rank'] = 0; } if(empty($a['rank'])){ $a['rank'] = 0; }
if(empty($b['rank'])){ $b['rank'] = 0; } if(empty($b['rank'])){ $b['rank'] = 0; }
@@ -874,7 +874,7 @@ abstract class CommonDocGenerator
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return null * @return null
*/ */
function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) public function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{ {
global $conf; global $conf;
@@ -950,7 +950,7 @@ abstract class CommonDocGenerator
* @param string $colKey the column key * @param string $colKey the column key
* @return float width in mm * @return float width in mm
*/ */
function getColumnContentWidth($colKey) public function getColumnContentWidth($colKey)
{ {
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1]; return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1];
@@ -963,7 +963,7 @@ abstract class CommonDocGenerator
* @param string $colKey the column key * @param string $colKey the column key
* @return float X position in mm * @return float X position in mm
*/ */
function getColumnContentXStart($colKey) public function getColumnContentXStart($colKey)
{ {
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
return $colDef['xStartPos'] + $colDef['content']['padding'][3]; return $colDef['xStartPos'] + $colDef['content']['padding'][3];
@@ -975,7 +975,7 @@ abstract class CommonDocGenerator
* @param string $colKey the column key * @param string $colKey the column key
* @return int rank on success and -1 on error * @return int rank on success and -1 on error
*/ */
function getColumnRank($colKey) public function getColumnRank($colKey)
{ {
if(!isset($this->cols[$colKey]['rank'])) return -1; if(!isset($this->cols[$colKey]['rank'])) return -1;
return $this->cols[$colKey]['rank']; return $this->cols[$colKey]['rank'];
@@ -990,7 +990,7 @@ abstract class CommonDocGenerator
* @param bool $insertAfterTarget insert before or after target column ? * @param bool $insertAfterTarget insert before or after target column ?
* @return int new rank on success and -1 on error * @return int new rank on success and -1 on error
*/ */
function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false) public function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false)
{ {
// prepare wanted rank // prepare wanted rank
$rank = -1; $rank = -1;
@@ -1033,7 +1033,7 @@ abstract class CommonDocGenerator
* @param string $columnText column text * @param string $columnText column text
* @return int new rank on success and -1 on error * @return int new rank on success and -1 on error
*/ */
function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') public function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '')
{ {
global $hookmanager; global $hookmanager;
@@ -1060,7 +1060,7 @@ abstract class CommonDocGenerator
* @param string $colKey the column key * @param string $colKey the column key
* @return float width in mm * @return float width in mm
*/ */
function getColumnStatus($colKey) public function getColumnStatus($colKey)
{ {
if( !empty($this->cols[$colKey]['status'])){ if( !empty($this->cols[$colKey]['status'])){
return true; return true;

View File

@@ -97,7 +97,7 @@ abstract class CommonInvoice extends CommonObject
* @param int $multicurrency Return multicurrency_amount instead of amount * @param int $multicurrency Return multicurrency_amount instead of amount
* @return double Remain of amount to pay * @return double Remain of amount to pay
*/ */
function getRemainToPay($multicurrency = 0) public function getRemainToPay($multicurrency = 0)
{ {
$alreadypaid=0; $alreadypaid=0;
$alreadypaid+=$this->getSommePaiement($multicurrency); $alreadypaid+=$this->getSommePaiement($multicurrency);
@@ -112,7 +112,7 @@ abstract class CommonInvoice extends CommonObject
* @param int $multicurrency Return multicurrency_amount instead of amount * @param int $multicurrency Return multicurrency_amount instead of amount
* @return int Amount of payment already done, <0 if KO * @return int Amount of payment already done, <0 if KO
*/ */
function getSommePaiement($multicurrency = 0) public function getSommePaiement($multicurrency = 0)
{ {
$table='paiement_facture'; $table='paiement_facture';
$field='fk_facture'; $field='fk_facture';
@@ -149,7 +149,7 @@ abstract class CommonInvoice extends CommonObject
* @param int $multicurrency Return multicurrency_amount instead of amount * @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of deposits amount otherwise * @return int <0 if KO, Sum of deposits amount otherwise
*/ */
function getSumDepositsUsed($multicurrency = 0) public function getSumDepositsUsed($multicurrency = 0)
{ {
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{ {
@@ -178,7 +178,7 @@ abstract class CommonInvoice extends CommonObject
* @param int $multicurrency Return multicurrency_amount instead of amount * @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise * @return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/ */
function getSumCreditNotesUsed($multicurrency = 0) public function getSumCreditNotesUsed($multicurrency = 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
@@ -200,7 +200,7 @@ abstract class CommonInvoice extends CommonObject
* *
* @return array Tableau d'id de factures avoirs * @return array Tableau d'id de factures avoirs
*/ */
function getListIdAvoirFromInvoice() public function getListIdAvoirFromInvoice()
{ {
$idarray=array(); $idarray=array();
@@ -233,7 +233,7 @@ abstract class CommonInvoice extends CommonObject
* @param string $option filtre sur statut ('', 'validated', ...) * @param string $option filtre sur statut ('', 'validated', ...)
* @return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon * @return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon
*/ */
function getIdReplacingInvoice($option = '') public function getIdReplacingInvoice($option = '')
{ {
$sql = 'SELECT rowid'; $sql = 'SELECT rowid';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
@@ -274,7 +274,7 @@ abstract class CommonInvoice extends CommonObject
* @param string $filtertype 1 to filter on type of payment == 'PRE' * @param string $filtertype 1 to filter on type of payment == 'PRE'
* @return array Array with list of payments * @return array Array with list of payments
*/ */
function getListOfPayments($filtertype = '') public function getListOfPayments($filtertype = '')
{ {
$retarray=array(); $retarray=array();
@@ -325,7 +325,7 @@ abstract class CommonInvoice extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return if an invoice can be deleted * Return if an invoice can be deleted
* Rule is: * Rule is:
@@ -339,7 +339,7 @@ abstract class CommonInvoice extends CommonObject
* *
* @return int <=0 if no, >0 if yes * @return int <=0 if no, >0 if yes
*/ */
function is_erasable() public function is_erasable()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -428,7 +428,7 @@ abstract class CommonInvoice extends CommonObject
* *
* @return string Label of type of invoice * @return string Label of type of invoice
*/ */
function getLibType() public function getLibType()
{ {
global $langs; global $langs;
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
@@ -447,12 +447,12 @@ abstract class CommonInvoice extends CommonObject
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label of status * @return string Label of status
*/ */
function getLibStatut($mode = 0, $alreadypaid = -1) public function getLibStatut($mode = 0, $alreadypaid = -1)
{ {
return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type); return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return label of a status * Return label of a status
* *
@@ -463,18 +463,16 @@ abstract class CommonInvoice extends CommonObject
* @param int $type Type invoice * @param int $type Type invoice
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0) public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load('bills'); $langs->load('bills');
//print "$paye,$status,$mode,$alreadypaid,$type"; //print "$paye,$status,$mode,$alreadypaid,$type";
if ($mode == 0) if ($mode == 0) {
{
$prefix=''; $prefix='';
if (! $paye) if (! $paye) {
{
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
@@ -585,7 +583,7 @@ abstract class CommonInvoice extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi une date limite de reglement de facture en fonction des * Renvoi une date limite de reglement de facture en fonction des
* conditions de reglements de la facture et date de facturation. * conditions de reglements de la facture et date de facturation.
@@ -593,7 +591,7 @@ abstract class CommonInvoice extends CommonObject
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
* @return date Date limite de reglement si ok, <0 si ko * @return date Date limite de reglement si ok, <0 si ko
*/ */
function calculate_date_lim_reglement($cond_reglement = 0) public function calculate_date_lim_reglement($cond_reglement = 0)
{ {
// phpcs:enable // phpcs:enable
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code;

View File

@@ -423,7 +423,7 @@ abstract class CommonObject
* @param string $ref_ext Ref ext of object to check * @param string $ref_ext Ref ext of object to check
* @return int <0 if KO, 0 if OK but not found, >0 if OK and exists * @return int <0 if KO, 0 if OK but not found, >0 if OK and exists
*/ */
static function isExistingObject($element, $id, $ref = '', $ref_ext = '') public static function isExistingObject($element, $id, $ref = '', $ref_ext = '')
{ {
global $db,$conf; global $db,$conf;
@@ -457,7 +457,7 @@ abstract class CommonObject
* *
* @return string String with errors * @return string String with errors
*/ */
function errorsToString() public function errorsToString()
{ {
return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ', $this->errors)):''); return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ', $this->errors)):'');
} }
@@ -468,7 +468,7 @@ abstract class CommonObject
* @param string $objref Customer ref * @param string $objref Customer ref
* @return string Customer ref formated * @return string Customer ref formated
*/ */
function getFormatedCustomerRef($objref) public function getFormatedCustomerRef($objref)
{ {
global $hookmanager; global $hookmanager;
@@ -488,7 +488,7 @@ abstract class CommonObject
* @param string $objref Supplier ref * @param string $objref Supplier ref
* @return string Supplier ref formated * @return string Supplier ref formated
*/ */
function getFormatedSupplierRef($objref) public function getFormatedSupplierRef($objref)
{ {
global $hookmanager; global $hookmanager;
@@ -511,7 +511,7 @@ abstract class CommonObject
* @param int $maxlen Maximum length * @param int $maxlen Maximum length
* @return string String with full name * @return string String with full name
*/ */
function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
{ {
//print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."<br>\n"; //print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."<br>\n";
$lastname=$this->lastname; $lastname=$this->lastname;
@@ -538,7 +538,7 @@ abstract class CommonObject
* @param int $withregion 1=Add region into address string * @param int $withregion 1=Add region into address string
* @return string Full address string * @return string Full address string
*/ */
function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0) public function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0)
{ {
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country))) if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{ {
@@ -569,7 +569,7 @@ abstract class CommonObject
* @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member)
* @return string Full address string * @return string Full address string
*/ */
function getBannerAddress($htmlkey, $object) public function getBannerAddress($htmlkey, $object)
{ {
global $conf, $langs; global $conf, $langs;
@@ -688,7 +688,7 @@ abstract class CommonObject
* @param int $relativelink 0=Return full external link, 1=Return link relative to root of file * @param int $relativelink 0=Return full external link, 1=Return link relative to root of file
* @return string Link or empty string if there is no download link * @return string Link or empty string if there is no download link
*/ */
function getLastMainDocLink($modulepart, $initsharekey = 0, $relativelink = 0) public function getLastMainDocLink($modulepart, $initsharekey = 0, $relativelink = 0)
{ {
global $user, $dolibarr_main_url_root; global $user, $dolibarr_main_url_root;
@@ -775,7 +775,7 @@ abstract class CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add a link between element $this->element and a contact * Add a link between element $this->element and a contact
* *
@@ -785,7 +785,7 @@ abstract class CommonObject
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0) public function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $user,$langs; global $user,$langs;
@@ -899,7 +899,7 @@ abstract class CommonObject
} else return 0; } else return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Copy contact from one element to current * Copy contact from one element to current
* *
@@ -907,7 +907,7 @@ abstract class CommonObject
* @param string $source Nature of contact ('internal' or 'external') * @param string $source Nature of contact ('internal' or 'external')
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function copy_linked_contact($objFrom, $source = 'internal') public function copy_linked_contact($objFrom, $source = 'internal')
{ {
// phpcs:enable // phpcs:enable
$contacts = $objFrom->liste_contact(-1, $source); $contacts = $objFrom->liste_contact(-1, $source);
@@ -922,7 +922,7 @@ abstract class CommonObject
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update a link to contact line * Update a link to contact line
* *
@@ -932,7 +932,7 @@ abstract class CommonObject
* @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @param int $fk_socpeople Id of soc_people to update (not modified if 0)
* @return int <0 if KO, >= 0 if OK * @return int <0 if KO, >= 0 if OK
*/ */
function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeople = 0) public function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeople = 0)
{ {
// phpcs:enable // phpcs:enable
// Insert into database // Insert into database
@@ -953,7 +953,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete a link to contact line * Delete a link to contact line
* *
@@ -961,7 +961,7 @@ abstract class CommonObject
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function delete_contact($rowid, $notrigger = 0) public function delete_contact($rowid, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -992,7 +992,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete all links between an object $this and all its contacts * Delete all links between an object $this and all its contacts
* *
@@ -1000,7 +1000,7 @@ abstract class CommonObject
* @param string $code Type of contact (code or id) * @param string $code Type of contact (code or id)
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function delete_linked_contact($source = '', $code = '') public function delete_linked_contact($source = '', $code = '')
{ {
// phpcs:enable // phpcs:enable
$temp = array(); $temp = array();
@@ -1029,7 +1029,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Get array of all contacts for an object * Get array of all contacts for an object
* *
@@ -1039,7 +1039,7 @@ abstract class CommonObject
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @return array|int Array of contacts, -1 if error * @return array|int Array of contacts, -1 if error
*/ */
function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') public function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '')
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1109,7 +1109,7 @@ abstract class CommonObject
* @param int $rowid Id of link between object and contact * @param int $rowid Id of link between object and contact
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function swapContactStatus($rowid) public function swapContactStatus($rowid)
{ {
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,"; $sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
$sql.= " tc.code, tc.libelle"; $sql.= " tc.code, tc.libelle";
@@ -1138,7 +1138,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return array with list of possible values for type of contacts * Return array with list of possible values for type of contacts
* *
@@ -1149,7 +1149,7 @@ abstract class CommonObject
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1) * @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
*/ */
function liste_type_contact($source = 'internal', $order = 'position', $option = 0, $activeonly = 0, $code = '') public function liste_type_contact($source = 'internal', $order = 'position', $option = 0, $activeonly = 0, $code = '')
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -1203,7 +1203,7 @@ abstract class CommonObject
* @param int $status limited to a certain status * @param int $status limited to a certain status
* @return array List of id for such contacts * @return array List of id for such contacts
*/ */
function getIdContact($source, $code, $status = 0) public function getIdContact($source, $code, $status = 0)
{ {
global $conf; global $conf;
@@ -1256,14 +1256,14 @@ abstract class CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load object contact with id=$this->contactid into $this->contact * Load object contact with id=$this->contactid into $this->contact
* *
* @param int $contactid Id du contact. Use this->contactid if empty. * @param int $contactid Id du contact. Use this->contactid if empty.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_contact($contactid = null) public function fetch_contact($contactid = null)
{ {
// phpcs:enable // phpcs:enable
if (empty($contactid)) $contactid=$this->contactid; if (empty($contactid)) $contactid=$this->contactid;
@@ -1277,14 +1277,14 @@ abstract class CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty
* *
* @param int $force_thirdparty_id Force thirdparty id * @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_thirdparty($force_thirdparty_id = 0) public function fetch_thirdparty($force_thirdparty_id = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1340,7 +1340,7 @@ abstract class CommonObject
return $this->fetch($result->rowid); return $this->fetch($result->rowid);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load data for barcode into properties ->barcode_type* * Load data for barcode into properties ->barcode_type*
* Properties ->barcode_type that is id of barcode. Type is used to find other properties, but * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but
@@ -1348,7 +1348,7 @@ abstract class CommonObject
* *
* @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded)
*/ */
function fetch_barcode() public function fetch_barcode()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -1391,13 +1391,13 @@ abstract class CommonObject
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load the project with id $this->fk_project into this->project * Load the project with id $this->fk_project into this->project
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function fetch_projet() public function fetch_projet()
{ {
// phpcs:enable // phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@@ -1413,13 +1413,13 @@ abstract class CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load the product with id $this->fk_product into this->product * Load the product with id $this->fk_product into this->product
* *
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function fetch_product() public function fetch_product()
{ {
// phpcs:enable // phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -1433,14 +1433,14 @@ abstract class CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load the user with id $userid into this->user * Load the user with id $userid into this->user
* *
* @param int $userid Id du contact * @param int $userid Id du contact
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_user($userid) public function fetch_user($userid)
{ {
// phpcs:enable // phpcs:enable
$user = new User($this->db); $user = new User($this->db);
@@ -1449,13 +1449,13 @@ abstract class CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Read linked origin object * Read linked origin object
* *
* @return void * @return void
*/ */
function fetch_origin() public function fetch_origin()
{ {
// phpcs:enable // phpcs:enable
if ($this->origin == 'shipping') $this->origin = 'expedition'; if ($this->origin == 'shipping') $this->origin = 'expedition';
@@ -1478,7 +1478,7 @@ abstract class CommonObject
* @param string $element Element name * @param string $element Element name
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchObjectFrom($table, $field, $key, $element = null) public function fetchObjectFrom($table, $field, $key, $element = null)
{ {
global $conf; global $conf;
@@ -1514,7 +1514,7 @@ abstract class CommonObject
* @param string $field Field selected * @param string $field Field selected
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function getValueFrom($table, $id, $field) public function getValueFrom($table, $id, $field)
{ {
$result=false; $result=false;
if (!empty($id) && !empty($field) && !empty($table)) { if (!empty($id) && !empty($field) && !empty($table)) {
@@ -1548,7 +1548,7 @@ abstract class CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see updateExtraField() * @see updateExtraField()
*/ */
function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif') public function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif')
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@@ -1618,7 +1618,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load properties id_previous and id_next by comparing $fieldid with $this->ref * Load properties id_previous and id_next by comparing $fieldid with $this->ref
* *
@@ -1627,7 +1627,7 @@ abstract class CommonObject
* @param int $nodbprefix Do not include DB prefix to forge table name * @param int $nodbprefix Do not include DB prefix to forge table name
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_previous_next_ref($filter, $fieldid, $nodbprefix = 0) public function load_previous_next_ref($filter, $fieldid, $nodbprefix = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $user; global $conf, $user;
@@ -1751,7 +1751,7 @@ abstract class CommonObject
* @return array Array of id of contacts (if source=external or internal) * @return array Array of id of contacts (if source=external or internal)
* Array of id of third parties with at least one contact on object (if source=thirdparty) * Array of id of third parties with at least one contact on object (if source=thirdparty)
*/ */
function getListContactId($source = 'external') public function getListContactId($source = 'external')
{ {
$contactAlreadySelected = array(); $contactAlreadySelected = array();
$tab = $this->liste_contact(-1, $source); $tab = $this->liste_contact(-1, $source);
@@ -1773,7 +1773,7 @@ abstract class CommonObject
* @param int $projectid Project id to link element to * @param int $projectid Project id to link element to
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setProject($projectid) public function setProject($projectid)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@@ -1814,7 +1814,7 @@ abstract class CommonObject
* @param int $id Id of new payment method * @param int $id Id of new payment method
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function setPaymentMethods($id) public function setPaymentMethods($id)
{ {
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')'); dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe') if ($this->statut >= 0 || $this->element == 'societe')
@@ -1856,7 +1856,7 @@ abstract class CommonObject
* @param string $code multicurrency code * @param string $code multicurrency code
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function setMulticurrencyCode($code) public function setMulticurrencyCode($code)
{ {
dol_syslog(get_class($this).'::setMulticurrencyCode('.$id.')'); dol_syslog(get_class($this).'::setMulticurrencyCode('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe') if ($this->statut >= 0 || $this->element == 'societe')
@@ -1898,7 +1898,7 @@ abstract class CommonObject
* @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency * @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function setMulticurrencyRate($rate, $mode = 1) public function setMulticurrencyRate($rate, $mode = 1)
{ {
dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')'); dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe') if ($this->statut >= 0 || $this->element == 'societe')
@@ -1999,7 +1999,7 @@ abstract class CommonObject
* @param int $id Id of new payment terms * @param int $id Id of new payment terms
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function setPaymentTerms($id) public function setPaymentTerms($id)
{ {
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')'); dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
if ($this->statut >= 0 || $this->element == 'societe') if ($this->statut >= 0 || $this->element == 'societe')
@@ -2043,7 +2043,7 @@ abstract class CommonObject
* @param int $id Address id * @param int $id Address id
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function setDeliveryAddress($id) public function setDeliveryAddress($id)
{ {
$fieldname = 'fk_delivery_address'; $fieldname = 'fk_delivery_address';
if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address'; if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address';
@@ -2074,7 +2074,7 @@ abstract class CommonObject
* *
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */
function setShippingMethod($shipping_method_id, $notrigger = false, $userused = null) public function setShippingMethod($shipping_method_id, $notrigger = false, $userused = null)
{ {
global $user; global $user;
@@ -2128,7 +2128,7 @@ abstract class CommonObject
* @param int $warehouse_id Id of warehouse * @param int $warehouse_id Id of warehouse
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */
function setWarehouse($warehouse_id) public function setWarehouse($warehouse_id)
{ {
if (! $this->table_element) { if (! $this->table_element) {
dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined", LOG_ERR); dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined", LOG_ERR);
@@ -2159,7 +2159,7 @@ abstract class CommonObject
* @param string $modelpdf Modele name * @param string $modelpdf Modele name
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setDocModel($user, $modelpdf) public function setDocModel($user, $modelpdf)
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
@@ -2198,7 +2198,7 @@ abstract class CommonObject
* @param User $userused Object user * @param User $userused Object user
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */
function setBankAccount($fk_account, $notrigger = false, $userused = null) public function setBankAccount($fk_account, $notrigger = false, $userused = null)
{ {
global $user; global $user;
@@ -2253,7 +2253,7 @@ abstract class CommonObject
// TODO: Move line related operations to CommonObjectLine? // TODO: Move line related operations to CommonObjectLine?
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Save a new position (field rang) for details lines. * Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined. * You can choose to set position for lines with already a position or lines without any position defined.
@@ -2263,7 +2263,7 @@ abstract class CommonObject
* @param boolean $fk_parent_line Table with fk_parent_line field or not * @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function line_order($renum = false, $rowidorder = 'ASC', $fk_parent_line = true) public function line_order($renum = false, $rowidorder = 'ASC', $fk_parent_line = true)
{ {
// phpcs:enable // phpcs:enable
if (! $this->table_element_line) if (! $this->table_element_line)
@@ -2348,7 +2348,7 @@ abstract class CommonObject
* @param int $id Id of parent line * @param int $id Id of parent line
* @return array Array with list of children lines id * @return array Array with list of children lines id
*/ */
function getChildrenOfLine($id) public function getChildrenOfLine($id)
{ {
$rows=array(); $rows=array();
@@ -2374,7 +2374,7 @@ abstract class CommonObject
return $rows; return $rows;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update a line to have a lower rank * Update a line to have a lower rank
* *
@@ -2382,7 +2382,7 @@ abstract class CommonObject
* @param boolean $fk_parent_line Table with fk_parent_line field or not * @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void * @return void
*/ */
function line_up($rowid, $fk_parent_line = true) public function line_up($rowid, $fk_parent_line = true)
{ {
// phpcs:enable // phpcs:enable
$this->line_order(false, 'ASC', $fk_parent_line); $this->line_order(false, 'ASC', $fk_parent_line);
@@ -2394,7 +2394,7 @@ abstract class CommonObject
$this->updateLineUp($rowid, $rang); $this->updateLineUp($rowid, $rang);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update a line to have a higher rank * Update a line to have a higher rank
* *
@@ -2402,7 +2402,7 @@ abstract class CommonObject
* @param boolean $fk_parent_line Table with fk_parent_line field or not * @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void * @return void
*/ */
function line_down($rowid, $fk_parent_line = true) public function line_down($rowid, $fk_parent_line = true)
{ {
// phpcs:enable // phpcs:enable
$this->line_order(false, 'ASC', $fk_parent_line); $this->line_order(false, 'ASC', $fk_parent_line);
@@ -2424,7 +2424,7 @@ abstract class CommonObject
* @param int $rang Position * @param int $rang Position
* @return void * @return void
*/ */
function updateRangOfLine($rowid, $rang) public function updateRangOfLine($rowid, $rang)
{ {
$fieldposition = 'rang'; $fieldposition = 'rang';
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
@@ -2439,14 +2439,14 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update position of line with ajax (rang) * Update position of line with ajax (rang)
* *
* @param array $rows Array of rows * @param array $rows Array of rows
* @return void * @return void
*/ */
function line_ajaxorder($rows) public function line_ajaxorder($rows)
{ {
// phpcs:enable // phpcs:enable
$num = count($rows); $num = count($rows);
@@ -2463,7 +2463,7 @@ abstract class CommonObject
* @param int $rang Position * @param int $rang Position
* @return void * @return void
*/ */
function updateLineUp($rowid, $rang) public function updateLineUp($rowid, $rang)
{ {
if ($rang > 1) if ($rang > 1)
{ {
@@ -2497,7 +2497,7 @@ abstract class CommonObject
* @param int $max Max * @param int $max Max
* @return void * @return void
*/ */
function updateLineDown($rowid, $rang, $max) public function updateLineDown($rowid, $rang, $max)
{ {
if ($rang < $max) if ($rang < $max)
{ {
@@ -2529,7 +2529,7 @@ abstract class CommonObject
* @param int $rowid Id of line * @param int $rowid Id of line
* @return int Value of rang in table of lines * @return int Value of rang in table of lines
*/ */
function getRangOfLine($rowid) public function getRangOfLine($rowid)
{ {
$sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE rowid ='.$rowid; $sql.= ' WHERE rowid ='.$rowid;
@@ -2549,7 +2549,7 @@ abstract class CommonObject
* @param int $rang Rang value * @param int $rang Rang value
* @return int Rowid of the line * @return int Rowid of the line
*/ */
function getIdOfLine($rang) public function getIdOfLine($rang)
{ {
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
@@ -2562,14 +2562,14 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Get max value used for position of line (rang) * Get max value used for position of line (rang)
* *
* @param int $fk_parent_line Parent line id * @param int $fk_parent_line Parent line id
* @return int Max value of rang in table of lines * @return int Max value of rang in table of lines
*/ */
function line_max($fk_parent_line = 0) public function line_max($fk_parent_line = 0)
{ {
// phpcs:enable // phpcs:enable
// Search the last rang with fk_parent_line // Search the last rang with fk_parent_line
@@ -2610,14 +2610,14 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update external ref of element * Update external ref of element
* *
* @param string $ref_ext Update field ref_ext * @param string $ref_ext Update field ref_ext
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_ref_ext($ref_ext) public function update_ref_ext($ref_ext)
{ {
// phpcs:enable // phpcs:enable
if (! $this->table_element) if (! $this->table_element)
@@ -2643,7 +2643,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update note of element * Update note of element
* *
@@ -2651,7 +2651,7 @@ abstract class CommonObject
* @param string $suffix '', '_public' or '_private' * @param string $suffix '', '_public' or '_private'
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_note($note, $suffix = '') public function update_note($note, $suffix = '')
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -2696,7 +2696,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update public note (kept for backward compatibility) * Update public note (kept for backward compatibility)
* *
@@ -2705,13 +2705,13 @@ abstract class CommonObject
* @deprecated * @deprecated
* @see update_note() * @see update_note()
*/ */
function update_note_public($note) public function update_note_public($note)
{ {
// phpcs:enable // phpcs:enable
return $this->update_note($note, '_public'); return $this->update_note($note, '_public');
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines). * Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).
* Must be called at end of methods addline or updateline. * Must be called at end of methods addline or updateline.
@@ -2722,7 +2722,7 @@ abstract class CommonObject
* @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_price($exclspec = 0, $roundingadjust = 'none', $nodatabaseupdate = 0, $seller = null) public function update_price($exclspec = 0, $roundingadjust = 'none', $nodatabaseupdate = 0, $seller = null)
{ {
// phpcs:enable // phpcs:enable
global $conf, $hookmanager, $action; global $conf, $hookmanager, $action;
@@ -2950,7 +2950,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add objects linked in llx_element_element. * Add objects linked in llx_element_element.
* *
@@ -2959,7 +2959,7 @@ abstract class CommonObject
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
* @see fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked() * @see fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked()
*/ */
function add_object_linked($origin = null, $origin_id = null) public function add_object_linked($origin = null, $origin_id = null)
{ {
// phpcs:enable // phpcs:enable
$origin = (! empty($origin) ? $origin : $this->origin); $origin = (! empty($origin) ? $origin : $this->origin);
@@ -3020,7 +3020,7 @@ abstract class CommonObject
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see add_object_linked(), updateObjectLinked(), deleteObjectLinked() * @see add_object_linked(), updateObjectLinked(), deleteObjectLinked()
*/ */
function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1) public function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1)
{ {
global $conf; global $conf;
@@ -3224,7 +3224,7 @@ abstract class CommonObject
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @see add_object_linked(), fetObjectLinked(), deleteObjectLinked() * @see add_object_linked(), fetObjectLinked(), deleteObjectLinked()
*/ */
function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '') public function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '')
{ {
$updatesource=false; $updatesource=false;
$updatetarget=false; $updatetarget=false;
@@ -3271,7 +3271,7 @@ abstract class CommonObject
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @see add_object_linked, updateObjectLinked, fetchObjectLinked * @see add_object_linked, updateObjectLinked, fetchObjectLinked
*/ */
function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '') public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '')
{ {
$deletesource=false; $deletesource=false;
$deletetarget=false; $deletetarget=false;
@@ -3332,7 +3332,7 @@ abstract class CommonObject
* @param string $trigkey Trigger key to use for trigger * @param string $trigkey Trigger key to use for trigger
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setStatut($status, $elementId = null, $elementType = '', $trigkey = '') public function setStatut($status, $elementId = null, $elementType = '', $trigkey = '')
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@@ -3420,7 +3420,7 @@ abstract class CommonObject
* @param string $ref Record ref * @param string $ref Record ref
* @return int <0 if KO, 0 if nothing done, >0 if OK * @return int <0 if KO, 0 if nothing done, >0 if OK
*/ */
function getCanvas($id = 0, $ref = '') public function getCanvas($id = 0, $ref = '')
{ {
global $conf; global $conf;
@@ -3461,7 +3461,7 @@ abstract class CommonObject
* @param int $lineid Id of line * @param int $lineid Id of line
* @return int Special code * @return int Special code
*/ */
function getSpecialCode($lineid) public function getSpecialCode($lineid)
{ {
$sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE rowid = '.$lineid; $sql.= ' WHERE rowid = '.$lineid;
@@ -3480,7 +3480,7 @@ abstract class CommonObject
* @param int $id Force id of object * @param int $id Force id of object
* @return int <0 if KO, 0 if not used, >0 if already used * @return int <0 if KO, 0 if not used, >0 if already used
*/ */
function isObjectUsed($id = 0) public function isObjectUsed($id = 0)
{ {
global $langs; global $langs;
@@ -3549,7 +3549,7 @@ abstract class CommonObject
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service * @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service
* @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found * @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found
*/ */
function hasProductsOrServices($predefined = -1) public function hasProductsOrServices($predefined = -1)
{ {
$nb=0; $nb=0;
@@ -3572,7 +3572,7 @@ abstract class CommonObject
* *
* @return float * @return float
*/ */
function getTotalDiscount() public function getTotalDiscount()
{ {
$total_discount=0.00; $total_discount=0.00;
@@ -3612,7 +3612,7 @@ abstract class CommonObject
* *
* @return array array('weight'=>...,'volume'=>...) * @return array array('weight'=>...,'volume'=>...)
*/ */
function getTotalWeightVolume() public function getTotalWeightVolume()
{ {
$totalWeight = 0; $totalWeight = 0;
$totalVolume = 0; $totalVolume = 0;
@@ -3706,7 +3706,7 @@ abstract class CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setExtraParameters() public function setExtraParameters()
{ {
$this->db->begin(); $this->db->begin();
@@ -3739,7 +3739,7 @@ abstract class CommonObject
* *
* @return string incoterms info * @return string incoterms info
*/ */
function display_incoterms() public function display_incoterms()
{ {
// phpcs:enable // phpcs:enable
$out = ''; $out = '';
@@ -3765,7 +3765,7 @@ abstract class CommonObject
* *
* @return string incoterms info * @return string incoterms info
*/ */
function getIncotermsForPDF() public function getIncotermsForPDF()
{ {
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@@ -3796,7 +3796,7 @@ abstract class CommonObject
* @param string $location location of incoterm * @param string $location location of incoterm
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setIncoterms($id_incoterm, $location) public function setIncoterms($id_incoterm, $location)
{ {
if ($this->id && $this->table_element) if ($this->id && $this->table_element)
{ {
@@ -3844,7 +3844,7 @@ abstract class CommonObject
* @param Societe $buyer Object thirdparty who buy * @param Societe $buyer Object thirdparty who buy
* @return void * @return void
*/ */
function formAddObjectLine($dateSelector, $seller, $buyer) public function formAddObjectLine($dateSelector, $seller, $buyer)
{ {
global $conf,$user,$langs,$object,$hookmanager; global $conf,$user,$langs,$object,$hookmanager;
global $form,$bcnd,$var; global $form,$bcnd,$var;
@@ -3887,7 +3887,7 @@ abstract class CommonObject
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @return void * @return void
*/ */
function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0) public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0)
{ {
global $conf, $hookmanager, $langs, $user; global $conf, $hookmanager, $langs, $user;
// TODO We should not use global var for this ! // TODO We should not use global var for this !
@@ -4041,7 +4041,7 @@ abstract class CommonObject
* @param int $extrafieldsline Object of extrafield line attribute * @param int $extrafieldsline Object of extrafield line attribute
* @return void * @return void
*/ */
function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0) public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0)
{ {
global $conf,$langs,$user,$object,$hookmanager; global $conf,$langs,$user,$object,$hookmanager;
global $form,$bc,$bcdd; global $form,$bc,$bcdd;
@@ -4159,7 +4159,7 @@ abstract class CommonObject
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only * @param string $restrictlist ''=All lines, 'services'=Restrict to services only
* @return void * @return void
*/ */
function printOriginLinesList($restrictlist = '') public function printOriginLinesList($restrictlist = '')
{ {
global $langs, $hookmanager, $conf; global $langs, $hookmanager, $conf;
@@ -4213,7 +4213,7 @@ abstract class CommonObject
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not) * @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
* @return void * @return void
*/ */
function printOriginLine($line, $var, $restrictlist = '') public function printOriginLine($line, $var, $restrictlist = '')
{ {
global $langs, $conf; global $langs, $conf;
@@ -4348,7 +4348,7 @@ abstract class CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add resources to the current object : add entry into llx_element_resources * Add resources to the current object : add entry into llx_element_resources
* Need $this->element & $this->id * Need $this->element & $this->id
@@ -4359,7 +4359,7 @@ abstract class CommonObject
* @param int $mandatory Mandatory or not * @param int $mandatory Mandatory or not
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function add_element_resource($resource_id, $resource_type, $busy = 0, $mandatory = 0) public function add_element_resource($resource_id, $resource_type, $busy = 0, $mandatory = 0)
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
@@ -4394,7 +4394,7 @@ abstract class CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete a link to resource line * Delete a link to resource line
* *
@@ -4403,7 +4403,7 @@ abstract class CommonObject
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function delete_resource($rowid, $element, $notrigger = 0) public function delete_resource($rowid, $element, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@@ -4440,7 +4440,7 @@ abstract class CommonObject
* *
* @return void * @return void
*/ */
function __clone() public function __clone()
{ {
// Force a copy of this->lines, otherwise it will point to same object. // Force a copy of this->lines, otherwise it will point to same object.
if (isset($this->lines) && is_array($this->lines)) if (isset($this->lines) && is_array($this->lines))
@@ -4617,9 +4617,15 @@ abstract class CommonObject
if ($useonlinesignature) $setsharekey=true; if ($useonlinesignature) $setsharekey=true;
if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
} }
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; $setsharekey=true;
if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; }
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey=true;
}
if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey=true;
}
if ($setsharekey) if ($setsharekey)
{ {
@@ -4717,7 +4723,7 @@ abstract class CommonObject
* @param string $file Path file in UTF8 to original file to create thumbs from. * @param string $file Path file in UTF8 to original file to create thumbs from.
* @return void * @return void
*/ */
function addThumbs($file) public function addThumbs($file)
{ {
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality; global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
@@ -4753,7 +4759,7 @@ abstract class CommonObject
* @param string $alternatevalue Alternate value to use * @param string $alternatevalue Alternate value to use
* @return string|string[] Default value (can be an array if the GETPOST return an array) * @return string|string[] Default value (can be an array if the GETPOST return an array)
**/ **/
function getDefaultCreateValueFor($fieldname, $alternatevalue = null) public function getDefaultCreateValueFor($fieldname, $alternatevalue = null)
{ {
global $conf, $_POST; global $conf, $_POST;
@@ -4782,7 +4788,7 @@ abstract class CommonObject
/* For triggers */ /* For triggers */
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Call trigger based on this instance. * Call trigger based on this instance.
* Some context information may also be provided into array property this->context. * Some context information may also be provided into array property this->context.
@@ -4793,7 +4799,7 @@ abstract class CommonObject
* @param User $user Object user * @param User $user Object user
* @return int Result of run_triggers * @return int Result of run_triggers
*/ */
function call_trigger($trigger_name, $user) public function call_trigger($trigger_name, $user)
{ {
// phpcs:enable // phpcs:enable
global $langs,$conf; global $langs,$conf;
@@ -4820,7 +4826,7 @@ abstract class CommonObject
/* Functions for extrafields */ /* Functions for extrafields */
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to get extra fields of an object into $this->array_options * Function to get extra fields of an object into $this->array_options
* This method is in most cases called by method fetch of objects but you can call it separately. * This method is in most cases called by method fetch of objects but you can call it separately.
@@ -4829,7 +4835,7 @@ abstract class CommonObject
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
* @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
*/ */
function fetch_optionals($rowid = null, $optionsArray = null) public function fetch_optionals($rowid = null, $optionsArray = null)
{ {
// phpcs:enable // phpcs:enable
if (empty($rowid)) $rowid=$this->id; if (empty($rowid)) $rowid=$this->id;
@@ -4940,7 +4946,7 @@ abstract class CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function deleteExtraFields() public function deleteExtraFields()
{ {
$this->db->begin(); $this->db->begin();
@@ -4973,7 +4979,7 @@ abstract class CommonObject
* @return int -1=error, O=did nothing, 1=OK * @return int -1=error, O=did nothing, 1=OK
* @see updateExtraField(), setValueFrom() * @see updateExtraField(), setValueFrom()
*/ */
function insertExtraFields($trigger = '', $userused = null) public function insertExtraFields($trigger = '', $userused = null)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
@@ -5219,7 +5225,7 @@ abstract class CommonObject
* @return int -1=error, O=did nothing, 1=OK * @return int -1=error, O=did nothing, 1=OK
* @see setValueFrom(), insertExtraFields() * @see setValueFrom(), insertExtraFields()
*/ */
function updateExtraField($key, $trigger = null, $userused = null) public function updateExtraField($key, $trigger = null, $userused = null)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
@@ -5353,7 +5359,7 @@ abstract class CommonObject
* @param string|int $morecss Value for css to define style/length of field. May also be a numeric. * @param string|int $morecss Value for css to define style/length of field. May also be a numeric.
* @return string * @return string
*/ */
function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0) public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0)
{ {
global $conf,$langs,$form; global $conf,$langs,$form;
@@ -5963,7 +5969,7 @@ abstract class CommonObject
* @param mixed $showsize Value for css to define size. May also be a numeric. * @param mixed $showsize Value for css to define size. May also be a numeric.
* @return string * @return string
*/ */
function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $showsize = 0) public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $showsize = 0)
{ {
global $conf,$langs,$form; global $conf,$langs,$form;
@@ -6334,7 +6340,7 @@ abstract class CommonObject
* @param string $onetrtd All fields in same tr td * @param string $onetrtd All fields in same tr td
* @return string * @return string
*/ */
function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0) public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0)
{ {
global $db, $conf, $langs, $action, $form; global $db, $conf, $langs, $action, $form;
@@ -6642,7 +6648,7 @@ abstract class CommonObject
return $buyPrice; return $buyPrice;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show photos of an object (nbmax maximum), into several columns * Show photos of an object (nbmax maximum), into several columns
* *
@@ -6660,7 +6666,7 @@ abstract class CommonObject
* @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/ */
function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0) public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf,$user,$langs; global $conf,$user,$langs;

View File

@@ -69,23 +69,23 @@ abstract class CommonStickerGenerator
public $format; public $format;
// protected // protected
var $_Avery_Name = ''; // Nom du format de l'etiquette public $_Avery_Name = ''; // Nom du format de l'etiquette
var $_Margin_Left = 0; // Marge de gauche de l'etiquette public $_Margin_Left = 0; // Marge de gauche de l'etiquette
var $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette public $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette
var $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes public $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes
var $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes public $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes
var $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page public $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page
var $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page public $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page
var $_Width = 0; // Largeur de chaque etiquette public $_Width = 0; // Largeur de chaque etiquette
var $_Height = 0; // Hauteur de chaque etiquette public $_Height = 0; // Hauteur de chaque etiquette
var $_Char_Size = 10; // Hauteur des caracteres public $_Char_Size = 10; // Hauteur des caracteres
var $_Line_Height = 10; // Hauteur par defaut d'une ligne public $_Line_Height = 10; // Hauteur par defaut d'une ligne
var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values public $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
var $_Metric_Doc = 'mm'; // Type of metric for the doc.. public $_Metric_Doc = 'mm'; // Type of metric for the doc..
var $_COUNTX = 1; public $_COUNTX = 1;
var $_COUNTY = 1; public $_COUNTY = 1;
var $_First = 1; public $_First = 1;
var $Tformat; public $Tformat;
/** /**
* Constructor * Constructor

View File

@@ -34,7 +34,7 @@ class Conf
{ {
/** \public */ /** \public */
//! To store properties found in conf file //! To store properties found in conf file
var $file; public $file;
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
@@ -42,9 +42,9 @@ class Conf
public $db; public $db;
//! To store properties found into database //! To store properties found into database
var $global; public $global;
//! To store browser info //! To store browser info
var $browser; public $browser;
//! To store if javascript/ajax is enabked //! To store if javascript/ajax is enabked
public $use_javascript_ajax; public $use_javascript_ajax;
@@ -59,12 +59,12 @@ class Conf
public $modules = array(); // List of activated modules public $modules = array(); // List of activated modules
public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array(), 'syslog' =>array()); public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array(), 'syslog' =>array());
var $logbuffer = array(); public $logbuffer = array();
/** /**
* @var LogHandlerInterface[] * @var LogHandlerInterface[]
*/ */
var $loghandlers = array(); public $loghandlers = array();
//! To store properties of multi-company //! To store properties of multi-company
public $multicompany; public $multicompany;

View File

@@ -84,11 +84,11 @@ function dol_quoted_printable_encode($input, $line_max = 76)
*/ */
class vCard class vCard
{ {
var $properties; public $properties;
var $filename; public $filename;
//var $encoding="UTF-8"; //var $encoding="UTF-8";
var $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE"; public $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
/** /**

View File

@@ -49,7 +49,7 @@ class modPhpbarcode extends ModeleBarCode
* *
* @return boolean true if module can be used * @return boolean true if module can be used
*/ */
function isEnabled() public function isEnabled()
{ {
return true; return true;
} }
@@ -60,7 +60,7 @@ class modPhpbarcode extends ModeleBarCode
* *
* @return string Texte descripif * @return string Texte descripif
*/ */
function info() public function info()
{ {
global $langs; global $langs;
@@ -76,7 +76,7 @@ class modPhpbarcode extends ModeleBarCode
* *
* @return boolean false si conflit, true si ok * @return boolean false si conflit, true si ok
*/ */
function canBeActivated() public function canBeActivated()
{ {
global $langs; global $langs;
@@ -90,7 +90,7 @@ class modPhpbarcode extends ModeleBarCode
* @param string $encoding Encoding norm * @param string $encoding Encoding norm
* @return int >0 if supported, 0 if not * @return int >0 if supported, 0 if not
*/ */
function encodingIsSupported($encoding) public function encodingIsSupported($encoding)
{ {
global $genbarcode_loc; global $genbarcode_loc;
//print 'genbarcode_loc='.$genbarcode_loc.' encoding='.$encoding;exit; //print 'genbarcode_loc='.$genbarcode_loc.' encoding='.$encoding;exit;
@@ -100,8 +100,7 @@ class modPhpbarcode extends ModeleBarCode
if ($encoding == 'ISBN') $supported=1; if ($encoding == 'ISBN') $supported=1;
// Formats that hangs on Windows (when genbarcode.exe for Windows is called, so they are not // Formats that hangs on Windows (when genbarcode.exe for Windows is called, so they are not
// activated on Windows) // activated on Windows)
if (file_exists($genbarcode_loc) && empty($_SERVER["WINDIR"])) if (file_exists($genbarcode_loc) && empty($_SERVER["WINDIR"])) {
{
if ($encoding == 'EAN8') $supported=1; if ($encoding == 'EAN8') $supported=1;
if ($encoding == 'UPC') $supported=1; if ($encoding == 'UPC') $supported=1;
if ($encoding == 'C39') $supported=1; if ($encoding == 'C39') $supported=1;
@@ -120,7 +119,7 @@ class modPhpbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error * @param integer $nooutputiferror No output if error
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) public function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{ {
global $_GET,$_SERVER; global $_GET,$_SERVER;
global $conf; global $conf;
@@ -161,7 +160,7 @@ class modPhpbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error * @param integer $nooutputiferror No output if error
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{ {
global $conf,$filebarcode; global $conf,$filebarcode;

View File

@@ -49,7 +49,7 @@ class modTcpdfbarcode extends ModeleBarCode
* *
* @return string Text with description * @return string Text with description
*/ */
function info() public function info()
{ {
global $langs; global $langs;
@@ -61,7 +61,7 @@ class modTcpdfbarcode extends ModeleBarCode
* *
* @return boolean true if module can be used * @return boolean true if module can be used
*/ */
function isEnabled() public function isEnabled()
{ {
return true; return true;
} }
@@ -72,7 +72,7 @@ class modTcpdfbarcode extends ModeleBarCode
* *
* @return boolean false si conflit, true si ok * @return boolean false si conflit, true si ok
*/ */
function canBeActivated() public function canBeActivated()
{ {
global $langs; global $langs;
@@ -85,7 +85,7 @@ class modTcpdfbarcode extends ModeleBarCode
* @param string $encoding Encoding norm * @param string $encoding Encoding norm
* @return int >0 if supported, 0 if not * @return int >0 if supported, 0 if not
*/ */
function encodingIsSupported($encoding) public function encodingIsSupported($encoding)
{ {
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding); $tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) { if (empty($tcpdfEncoding)) {
@@ -105,7 +105,7 @@ class modTcpdfbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error (not used with this engine) * @param integer $nooutputiferror No output if error (not used with this engine)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) public function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{ {
global $_GET; global $_GET;
@@ -152,7 +152,7 @@ class modTcpdfbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error (not used with this engine) * @param integer $nooutputiferror No output if error (not used with this engine)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{ {
global $conf,$_GET; global $conf,$_GET;

View File

@@ -40,7 +40,7 @@ abstract class ModeleBarCode
* *
* @return boolean true if model can be used * @return boolean true if model can be used
*/ */
function isEnabled() public function isEnabled()
{ {
return true; return true;
} }
@@ -62,7 +62,7 @@ abstract class ModeleNumRefBarCode
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @return string Descriptive text * @return string Descriptive text
*/ */
function info($langs) public function info($langs)
{ {
$langs->load("bills"); $langs->load("bills");
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
@@ -73,7 +73,7 @@ abstract class ModeleNumRefBarCode
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @return string Model name * @return string Model name
*/ */
function getNom($langs) public function getNom($langs)
{ {
return empty($this->name)?$this->nom:$this->name; return empty($this->name)?$this->nom:$this->name;
} }
@@ -83,7 +83,7 @@ abstract class ModeleNumRefBarCode
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @return string Example * @return string Example
*/ */
function getExample($langs) public function getExample($langs)
{ {
$langs->load("bills"); $langs->load("bills");
return $langs->trans("NoExample"); return $langs->trans("NoExample");
@@ -96,7 +96,7 @@ abstract class ModeleNumRefBarCode
* @param string $type Type of barcode (EAN, ISBN, ...) * @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value * @return string Value
*/ */
function getNextValue($objproduct, $type = '') public function getNextValue($objproduct, $type = '')
{ {
global $langs; global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking"); return $langs->trans("Function_getNextValue_InModuleNotWorking");
@@ -106,7 +106,7 @@ abstract class ModeleNumRefBarCode
* *
* @return string Version * @return string Version
*/ */
function getVersion() public function getVersion()
{ {
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
@@ -126,7 +126,7 @@ abstract class ModeleNumRefBarCode
* @param int $type -1=Nothing, 0=Product, 1=Service * @param int $type -1=Nothing, 0=Product, 1=Service
* @return string HTML translated description * @return string HTML translated description
*/ */
function getToolTip($langs, $soc, $type) public function getToolTip($langs, $soc, $type)
{ {
global $conf; global $conf;

View File

@@ -1871,7 +1871,7 @@ class SupplierProposal extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@@ -1984,7 +1984,7 @@ class SupplierProposal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int 1 if ok, otherwise if error * @return int 1 if ok, otherwise if error
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';