';
- $ret = $this->InitPrinter($printerid);
+ $ret = $this->initPrinter($printerid);
if ($ret>0) {
setEventMessages($this->error, $this->errors, 'errors');
- }
- else
- {
+ } else {
$nboflines = count($vals);
- for ($line=0; $line < $nboflines; $line++)
- {
+ for ($line=0; $line < $nboflines; $line++) {
switch ($vals[$line]['tag']) {
case 'DOL_ALIGN_CENTER':
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
@@ -627,10 +612,10 @@ class dolReceiptPrinter extends Escpos
/**
* Function to load Template
*
- * @param int $templateid Template id
- * @return int 0 if OK; >0 if KO
+ * @param int $templateid Template id
+ * @return int 0 if OK; >0 if KO
*/
- function loadTemplate($templateid)
+ public function loadTemplate($templateid)
{
global $conf;
$error = 0;
@@ -656,16 +641,14 @@ class dolReceiptPrinter extends Escpos
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Function Init Printer
*
* @param int $printerid Printer id
* @return int 0 if OK; >0 if KO
*/
- function InitPrinter($printerid)
+ public function initPrinter($printerid)
{
- // phpcs:enable
global $conf;
$error=0;
$sql = 'SELECT rowid, name, fk_type, fk_profile, parameter';
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index 63172d17566..f9eeeabf4c6 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -277,7 +277,7 @@ class EmailSenderProfile extends CommonObject
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @return string String with URL
*/
- function getNomUrl($withpicto = 0)
+ public function getNomUrl($withpicto = 0)
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -286,16 +286,15 @@ class EmailSenderProfile extends CommonObject
$result = '';
$companylink = '';
- $label=$this->label;
+ $label=$this->label;
- $url='';
+ $url='';
//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
$linkstart = '';
$linkend='';
- if ($withpicto)
- {
+ if ($withpicto) {
$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
if ($withpicto != 2) $result.=' ';
}
@@ -309,12 +308,12 @@ class EmailSenderProfile extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
*
@@ -322,49 +321,49 @@ class EmailSenderProfile extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
- static function LibStatut($status, $mode = 0)
+ public static function LibStatut($status, $mode = 0)
{
global $langs;
if ($mode == 0 || $mode == 1)
{
if ($status == 1) return $langs->trans('Enabled');
- if ($status == 0) return $langs->trans('Disabled');
+ elseif ($status == 0) return $langs->trans('Disabled');
}
elseif ($mode == 2)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
- if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
+ elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
- if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
+ elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 4)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
- if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
+ elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
- if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
+ elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 6)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
- if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
+ elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
}
- /**
- * Charge les informations d'ordre info dans l'objet commande
+ /**
+ * Charge les informations d'ordre info dans l'objet commande
*
- * @param int $id Id of order
- * @return void
+ * @param int $id Id of order
+ * @return void
*/
- function info($id)
+ public function info($id)
{
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql.= ' fk_user_creat, fk_user_modif';
diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php
index 50b948a85be..50fc116611a 100644
--- a/htdocs/core/class/events.class.php
+++ b/htdocs/core/class/events.class.php
@@ -119,7 +119,7 @@ class Events // extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -129,9 +129,9 @@ class Events // extends CommonObject
* Create in database
*
* @param User $user User that create
- * @return int <0 if KO, >0 if OK
+ * @return int <0 if KO, >0 if OK
*/
- function create($user)
+ public function create($user)
{
global $conf, $langs;
@@ -183,7 +183,7 @@ class Events // extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
@@ -220,7 +220,7 @@ class Events // extends CommonObject
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
- function fetch($id, $user = null)
+ public function fetch($id, $user = null)
{
global $langs;
@@ -271,7 +271,7 @@ class Events // extends CommonObject
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
- function delete($user)
+ public function delete($user)
{
global $conf, $langs;
@@ -296,8 +296,8 @@ class Events // extends CommonObject
* id must be 0 if object instance is a specimen.
*
* @return void
- */
- function initAsSpecimen()
+ */
+ public function initAsSpecimen()
{
$this->id=0;
@@ -305,5 +305,5 @@ class Events // extends CommonObject
$this->type='';
$this->dateevent=time();
$this->description='This is a specimen event';
- }
+ }
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index c23f40a0283..ce8916c1871 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -182,7 +182,7 @@ class ExtraFields
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->error = '';
@@ -226,7 +226,7 @@ class ExtraFields
* @param string $enabled Condition to have the field enabled or not
* @return int <=0 if KO, >0 if OK
*/
- function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
+ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@@ -469,7 +469,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @return int < 0 if KO, 0 if nothing is done, 1 if OK
*/
- function delete($attrname, $elementtype = 'member')
+ public function delete($attrname, $elementtype = 'member')
{
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@@ -586,7 +586,7 @@ class ExtraFields
* @param int $totalizable Is extrafield totalizable on list
* @return int >0 if OK, <=0 if KO
*/
- function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
+ public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
{
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@@ -819,7 +819,7 @@ class ExtraFields
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
*
@@ -827,7 +827,7 @@ class ExtraFields
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required.
* @return array Array of attributes keys+label for all extra fields.
*/
- function fetch_name_optionals_label($elementtype, $forceload = false)
+ public function fetch_name_optionals_label($elementtype, $forceload = false)
{
// phpcs:enable
global $conf;
@@ -950,7 +950,7 @@ class ExtraFields
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
* @return string
*/
- function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '')
+ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '')
{
global $conf,$langs,$form;
@@ -1565,7 +1565,7 @@ class ExtraFields
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
* @return string Formated value
*/
- function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
+ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
{
global $conf,$langs;
@@ -1877,7 +1877,7 @@ class ExtraFields
* @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data
* @return string Formated value
*/
- function getAlignFlag($key, $extrafieldsobjectkey = '')
+ public function getAlignFlag($key, $extrafieldsobjectkey = '')
{
global $conf,$langs;
@@ -1929,7 +1929,7 @@ class ExtraFields
* @param string $object Object
* @return string HTML code with line for separator
*/
- function showSeparator($key, $object)
+ public function showSeparator($key, $object)
{
global $langs;
@@ -1947,7 +1947,7 @@ class ExtraFields
* @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset.
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
*/
- function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
+ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
{
global $_POST, $langs;
$nofillrequired='';// For error when required field left blank
@@ -2046,7 +2046,7 @@ class ExtraFields
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value
*/
- function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '')
+ public function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '')
{
global $_POST;
diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php
index d90707db4dd..bd36dba199b 100644
--- a/htdocs/core/class/fileupload.class.php
+++ b/htdocs/core/class/fileupload.class.php
@@ -41,7 +41,7 @@ class FileUpload
* @param int $fk_element fk_element
* @param string $element element
*/
- function __construct($options = null, $fk_element = null, $element = null)
+ public function __construct($options = null, $fk_element = null, $element = null)
{
global $db, $conf;
global $object;
diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php
index ddbe70303d2..014946434be 100644
--- a/htdocs/core/class/fiscalyear.class.php
+++ b/htdocs/core/class/fiscalyear.class.php
@@ -82,7 +82,7 @@ class Fiscalyear extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct(DoliDB $db)
+ public function __construct(DoliDB $db)
{
global $langs;
@@ -98,7 +98,7 @@ class Fiscalyear extends CommonObject
* @param User $user User making creation
* @return int <0 if KO, >0 if OK
*/
- function create($user)
+ public function create($user)
{
global $conf;
@@ -159,7 +159,7 @@ class Fiscalyear extends CommonObject
* @param User $user User making update
* @return int <0 if KO, >0 if OK
*/
- function update($user)
+ public function update($user)
{
global $langs;
@@ -203,7 +203,7 @@ class Fiscalyear extends CommonObject
* @param int $id Id of record to load
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
$sql = "SELECT rowid, label, date_start, date_end, statut";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear";
@@ -237,7 +237,7 @@ class Fiscalyear extends CommonObject
* @param int $id Id of record to delete
* @return int <0 if KO, >0 if OK
*/
- function delete($id)
+ public function delete($id)
{
$this->db->begin();
@@ -264,12 +264,12 @@ class Fiscalyear extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Give a label from a status
*
@@ -277,7 +277,7 @@ class Fiscalyear extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- function LibStatut($statut, $mode = 0)
+ public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -318,7 +318,7 @@ class Fiscalyear extends CommonObject
* @param int $id Id of record
* @return void
*/
- function info($id)
+ public function info($id)
{
$sql = 'SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,';
$sql.= ' fy.tms';
@@ -364,7 +364,7 @@ class Fiscalyear extends CommonObject
* @param int $dateend Date end to scan
* @return string Number of entries
*/
- function getAccountancyEntriesByFiscalYear($datestart, $dateend)
+ public function getAccountancyEntriesByFiscalYear($datestart, $dateend)
{
global $conf;
@@ -386,11 +386,11 @@ class Fiscalyear extends CommonObject
/**
* Return the number of movements by fiscal year
*
- * @param int $datestart Date start to scan
- * @param int $dateend Date end to scan
- * @return string Number of movements
+ * @param int $datestart Date start to scan
+ * @param int $dateend Date end to scan
+ * @return string Number of movements
*/
- function getAccountancyMovementsByFiscalYear($datestart, $dateend)
+ public function getAccountancyMovementsByFiscalYear($datestart, $dateend)
{
global $conf;
diff --git a/htdocs/core/class/genericobject.class.php b/htdocs/core/class/genericobject.class.php
index 993d884c88b..a8d837bbaba 100644
--- a/htdocs/core/class/genericobject.class.php
+++ b/htdocs/core/class/genericobject.class.php
@@ -34,7 +34,7 @@ class GenericObject extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
diff --git a/htdocs/core/class/google.class.php b/htdocs/core/class/google.class.php
index 797f0a14af1..a472e6dcf22 100644
--- a/htdocs/core/class/google.class.php
+++ b/htdocs/core/class/google.class.php
@@ -26,63 +26,63 @@
*/
class GoogleAPI
{
- /**
+ /**
* @var DoliDB Database handler.
*/
public $db;
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- public $key;
+ public $key;
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- * @param string $key Google key
- */
- function __construct($db, $key)
- {
- $this->db=$db;
- $this->key=$key;
- }
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $key Google key
+ */
+ public function __construct($db, $key)
+ {
+ $this->db=$db;
+ $this->key=$key;
+ }
- /**
- * Return geo coordinates of an address
- *
- * @param string $address Address
- * Example: 68 Grande rue Charles de Gaulle,+94130,+Nogent sur Marne,+France
- * Example: 188, rue de Fontenay,+94300,+Vincennes,+France
- * @return string Coordinates
- */
- function getGeoCoordinatesOfAddress($address)
- {
- global $conf;
+ /**
+ * Return geo coordinates of an address
+ *
+ * @param string $address Address
+ * Example: 68 Grande rue Charles de Gaulle,+94130,+Nogent sur Marne,+France
+ * Example: 188, rue de Fontenay,+94300,+Vincennes,+France
+ * @return string Coordinates
+ */
+ public function getGeoCoordinatesOfAddress($address)
+ {
+ global $conf;
- $i=0;
+ $i=0;
- // Desired address
- $urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".$this->key;
+ // Desired address
+ $urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".$this->key;
- // Retrieve the URL contents
- $page = file_get_contents($urladdress);
+ // Retrieve the URL contents
+ $page = file_get_contents($urladdress);
- $code = strstr($page, '');
- $code = strstr($code, '>');
- $val=strpos($code, "<");
- $code = substr($code, 1, $val-1);
- //print $code;
- //print " ";
- $latitude = substr($code, 0, strpos($code, ","));
- $longitude = substr($code, strpos($code, ",")+1, dol_strlen(strpos($code, ","))-3);
+ $code = strstr($page, '');
+ $code = strstr($code, '>');
+ $val=strpos($code, "<");
+ $code = substr($code, 1, $val-1);
+ //print $code;
+ //print " ";
+ $latitude = substr($code, 0, strpos($code, ","));
+ $longitude = substr($code, strpos($code, ",")+1, dol_strlen(strpos($code, ","))-3);
- // Output the coordinates
- //echo "Longitude: $longitude ',' Latitude: $latitude";
+ // Output the coordinates
+ //echo "Longitude: $longitude ',' Latitude: $latitude";
- $i++;
- }
+ $i++;
+ }
}
diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php
index 0db47d1ade0..f23aa1da5a3 100644
--- a/htdocs/core/class/hookmanager.class.php
+++ b/htdocs/core/class/hookmanager.class.php
@@ -45,24 +45,24 @@ class HookManager
public $errors = array();
// Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
- var $contextarray=array();
+ public $contextarray=array();
// Array with instantiated classes
- var $hooks=array();
+ public $hooks=array();
// Array result
- var $resArray=array();
+ public $resArray=array();
// Printable result
- var $resPrint='';
+ public $resPrint='';
// Nb of qualified hook ran
- var $resNbOfHooks=0;
+ public $resNbOfHooks=0;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -79,7 +79,7 @@ class HookManager
* @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ...
* @return int Always 1
*/
- function initHooks($arraycontext)
+ public function initHooks($arraycontext)
{
global $conf;
@@ -125,18 +125,18 @@ class HookManager
}
/**
- * Execute hooks (if they were initialized) for the given method
+ * Execute hooks (if they were initialized) for the given method
*
- * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
- * @param array $parameters Array of parameters
- * @param Object $object Object to use hooks on
- * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
- * @return mixed For 'addreplace' hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
- * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
- * All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
- * $this->error or this->errors are also defined by class called by this function if error.
+ * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
+ * @param array $parameters Array of parameters
+ * @param Object $object Object to use hooks on
+ * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
+ * @return mixed For 'addreplace' hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
+ * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
+ * All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
+ * $this->error or this->errors are also defined by class called by this function if error.
*/
- function executeHooks($method, $parameters = array(), &$object = '', &$action = '')
+ public function executeHooks($method, $parameters = array(), &$object = '', &$action = '')
{
if (! is_array($this->hooks) || empty($this->hooks)) return '';
@@ -145,7 +145,7 @@ class HookManager
// Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray).
$hooktype='output';
-if (in_array(
+ if (in_array(
$method,
array(
'addCalendarChoice',
@@ -204,10 +204,9 @@ if (in_array(
)
)) $hooktype='addreplace';
- if ($method == 'insertExtraFields')
- {
- $hooktype='returnvalue'; // @deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
- dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
+ if ($method == 'insertExtraFields') {
+ $hooktype='returnvalue'; // @deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
+ dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
}
// Init return properties
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index ce5c27f3b8c..a83ff1083e6 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -17,7 +17,7 @@
* Copyright (C) 2012-2015 Raphaël Doursenaud
* Copyright (C) 2014 Alexandre Spangaro
* Copyright (C) 2018 Ferran Marcet
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2019 Frédéric France
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2018 Christophe Battarel
* Copyright (C) 2018 Josep Lluis Amador
@@ -102,7 +102,7 @@ class Form
* @param string $paramid Key of parameter for id ('id', 'socid')
* @return string HTML edit field
*/
- function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id')
+ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id')
{
global $conf,$langs;
@@ -164,7 +164,7 @@ class Form
* @param string $paramid Key of parameter for id ('id', 'socid')
* @return string HTML edit field
*/
- function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id')
+ public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id')
{
global $conf,$langs,$db;
@@ -441,7 +441,7 @@ class Form
* @see Use function textwithpicto if you can.
* TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip
*/
- function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
+ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
{
global $conf;
@@ -526,7 +526,7 @@ class Form
* @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
* @return string HTML code of text, picto, tooltip
*/
- function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger = '', $forcenowrap = 0)
+ public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger = '', $forcenowrap = 0)
{
global $conf, $langs;
@@ -578,7 +578,7 @@ class Form
* @param int $alwaysvisible 1=select button always visible
* @return string Select list
*/
- function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0)
+ public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0)
{
global $conf,$langs,$hookmanager;
@@ -663,7 +663,7 @@ class Form
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return combo list of activated countries, into language of user
*
@@ -678,7 +678,7 @@ class Form
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
* @return string HTML string with select
*/
- function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0)
+ public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0)
{
// phpcs:enable
global $conf,$langs,$mysoc;
@@ -778,7 +778,7 @@ class Form
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of incoterms
*
@@ -791,7 +791,7 @@ class Form
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string HTML string with select and input
*/
- function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array())
+ public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array())
{
// phpcs:enable
global $conf,$langs;
@@ -872,7 +872,7 @@ class Form
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module)
@@ -884,7 +884,7 @@ class Form
* @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
* @return void
*/
- function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0)
+ public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0)
{
// phpcs:enable
global $db,$langs,$user,$conf;
@@ -929,13 +929,13 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load into cache cache_types_fees, array of types of fees
*
* @return int Nb of lines loaded, <0 if KO
*/
- function load_cache_types_fees()
+ public function load_cache_types_fees()
{
// phpcs:enable
global $langs;
@@ -978,7 +978,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of types of notes
*
@@ -987,7 +987,7 @@ class Form
* @param int $showempty Add an empty field
* @return void
*/
- function select_type_fees($selected = '', $htmlname = 'type', $showempty = 0)
+ public function select_type_fees($selected = '', $htmlname = 'type', $showempty = 0)
{
// phpcs:enable
global $user, $langs;
@@ -1018,7 +1018,7 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML code to select a company.
*
@@ -1031,13 +1031,13 @@ class Form
* @return string Return select box for thirdparty.
* @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0)
*/
- function select_thirdparty($selected = '', $htmlname = 'socid', $filter = '', $limit = 20, $ajaxoptions = array(), $forcecombo = 0)
+ public function select_thirdparty($selected = '', $htmlname = 'socid', $filter = '', $limit = 20, $ajaxoptions = array(), $forcecombo = 0)
{
// phpcs:enable
return $this->select_thirdparty_list($selected, $htmlname, $filter, 1, 0, $forcecombo, array(), '', 0, $limit);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output html form to select a third party
*
@@ -1057,7 +1057,7 @@ class Form
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
* @return string HTML string with select box for thirdparty.
*/
- function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false)
+ public function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false)
{
// phpcs:enable
global $conf,$user,$langs;
@@ -1101,7 +1101,7 @@ class Form
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output html form to select a third party.
* Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company.
@@ -1121,7 +1121,7 @@ class Form
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return string HTML string with
*/
- function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false)
+ public function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false)
{
// phpcs:enable
global $conf,$user,$langs;
@@ -1284,18 +1284,18 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Return HTML combo list of absolute discounts
+ * Return HTML combo list of absolute discounts
*
- * @param string $selected Id remise fixe pre-selectionnee
- * @param string $htmlname Nom champ formulaire
- * @param string $filter Criteres optionnels de filtre
- * @param int $socid Id of thirdparty
- * @param int $maxvalue Max value for lines that can be selected
- * @return int Return number of qualifed lines in list
+ * @param string $selected Id remise fixe pre-selectionnee
+ * @param string $htmlname Nom champ formulaire
+ * @param string $filter Criteres optionnels de filtre
+ * @param int $socid Id of thirdparty
+ * @param int $maxvalue Max value for lines that can be selected
+ * @return int Return number of qualifed lines in list
*/
- function select_remises($selected, $htmlname, $filter, $socid, $maxvalue = 0)
+ public function select_remises($selected, $htmlname, $filter, $socid, $maxvalue = 0)
{
// phpcs:enable
global $langs,$conf;
@@ -1361,33 +1361,33 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Return list of all contacts (for a third party or all)
+ * Return list of all contacts (for a third party or all)
*
- * @param int $socid Id ot third party or 0 for all
- * @param string $selected Id contact pre-selectionne
- * @param string $htmlname Name of HTML field ('none' for a not editable field)
- * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list
- * @param string $exclude List of contacts id to exclude
- * @param string $limitto Disable answers that are not id in this array list
- * @param integer $showfunction Add function into label
- * @param string $moreclass Add more class to class style
- * @param integer $showsoc Add company into label
- * @param int $forcecombo Force to use combo box
+ * @param int $socid Id ot third party or 0 for all
+ * @param string $selected Id contact pre-selectionne
+ * @param string $htmlname Name of HTML field ('none' for a not editable field)
+ * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list
+ * @param string $exclude List of contacts id to exclude
+ * @param string $limitto Disable answers that are not id in this array list
+ * @param integer $showfunction Add function into label
+ * @param string $moreclass Add more class to class style
+ * @param integer $showsoc Add company into label
+ * @param int $forcecombo Force to use combo box
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param bool $options_only Return options only (for ajax treatment)
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param string $htmlid Html id to use instead of htmlname
- * @return int <0 if KO, Nb of contact in list if OK
+ * @return int <0 if KO, Nb of contact in list if OK
* @deprected You can use selectcontacts directly (warning order of param was changed)
*/
- function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '')
- {
+ public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '')
+ {
// phpcs:enable
print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid);
return $this->num;
- }
+ }
/**
* Return HTML code of the SELECT of list of all contacts (for a third party or all).
@@ -1412,8 +1412,8 @@ class Form
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @return int <0 if KO, Nb of contact in list if OK
*/
- function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false)
- {
+ public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false)
+ {
global $conf,$langs,$hookmanager,$action;
$langs->load('companies');
@@ -1543,7 +1543,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users
*
@@ -1559,13 +1559,13 @@ class Form
* @deprecated Use select_dolusers instead
* @see select_dolusers()
*/
- function select_users($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0')
+ public function select_users($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0')
{
// phpcs:enable
print $this->select_dolusers($selected, $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users
*
@@ -1589,7 +1589,7 @@ class Form
* @return string HTML select string
* @see select_dolgroups
*/
- function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false)
+ public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false)
{
// phpcs:enable
global $conf,$user,$langs;
@@ -1774,7 +1774,7 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list of users. Selected users are stored into session.
* List of users are provided into $_SESSION['assignedtouser'].
@@ -1797,7 +1797,7 @@ class Form
* @return string HTML select string
* @see select_dolgroups
*/
- function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array())
+ public function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array())
{
// phpcs:enable
global $conf, $user, $langs;
@@ -1864,7 +1864,7 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
@@ -1890,7 +1890,7 @@ class Form
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @return void
*/
- function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array())
+ public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array())
{
// phpcs:enable
global $langs,$conf;
@@ -2008,7 +2008,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of products for a customer
*
@@ -2032,7 +2032,7 @@ class Form
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @return array Array of keys for json
*/
- function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
+ public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
{
// phpcs:enable
global $langs,$conf,$user,$db;
@@ -2561,7 +2561,7 @@ class Form
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)
*
@@ -2576,7 +2576,7 @@ class Form
* @param string $morecss More CSS
* @return void
*/
- function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '')
+ public function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '')
{
// phpcs:enable
global $langs,$conf;
@@ -2605,7 +2605,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of suppliers products
*
@@ -2622,7 +2622,7 @@ class Form
* @param string $morecss Add more CSS
* @return array Array of keys for json
*/
- function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '')
+ public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '')
{
// phpcs:enable
global $langs,$conf,$db;
@@ -2837,7 +2837,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of suppliers prices for a product
*
@@ -2846,7 +2846,7 @@ class Form
* @param int $selected_supplier Pre-selected supplier if more than 1 result
* @return void
*/
- function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '')
+ public function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '')
{
// phpcs:enable
global $langs,$conf;
@@ -2950,7 +2950,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of delivery address
*
@@ -2960,7 +2960,7 @@ class Form
* @param int $showempty Add an empty field
* @return integer|null
*/
- function select_address($selected, $socid, $htmlname = 'address_id', $showempty = 0)
+ public function select_address($selected, $socid, $htmlname = 'address_id', $showempty = 0)
{
// phpcs:enable
// looking for users
@@ -3004,13 +3004,13 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load into cache list of payment terms
*
* @return int Nb of lines loaded, <0 if KO
*/
- function load_cache_conditions_paiements()
+ public function load_cache_conditions_paiements()
{
// phpcs:enable
global $langs;
@@ -3053,13 +3053,13 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge dans cache la liste des délais de livraison possibles
*
* @return int Nb of lines loaded, <0 if KO
*/
- function load_cache_availability()
+ public function load_cache_availability()
{
// phpcs:enable
global $langs;
@@ -3111,7 +3111,7 @@ class Form
* @param int $addempty Add empty entry
* @return void
*/
- function selectAvailabilityDelay($selected = '', $htmlname = 'availid', $filtertype = '', $addempty = 0)
+ public function selectAvailabilityDelay($selected = '', $htmlname = 'availid', $filtertype = '', $addempty = 0)
{
global $langs,$user;
@@ -3143,7 +3143,7 @@ class Form
*
* @return int Nb of lines loaded, <0 if KO
*/
- function loadCacheInputReason()
+ public function loadCacheInputReason()
{
global $langs;
@@ -3197,7 +3197,7 @@ class Form
* @param int $addempty Add an empty entry
* @return void
*/
- function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0)
+ public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0)
{
global $langs,$user;
@@ -3225,13 +3225,13 @@ class Form
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge dans cache la liste des types de paiements possibles
*
* @return int Nb of lines loaded, <0 if KO
*/
- function load_cache_types_paiements()
+ public function load_cache_types_paiements()
{
// phpcs:enable
global $langs;
@@ -3279,7 +3279,7 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of payment modes.
* Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want.
@@ -3293,7 +3293,7 @@ class Form
* @param string $morecss Add more CSS on select tag
* @return void
*/
- function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '')
+ public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '')
{
// phpcs:enable
global $langs, $user, $conf;
@@ -3325,7 +3325,7 @@ class Form
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of payment methods
*
@@ -3340,7 +3340,7 @@ class Form
* @param string $morecss Add more CSS on select tag
* @return void
*/
- function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '')
+ public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '')
{
// phpcs:enable
global $langs,$user;
@@ -3394,7 +3394,7 @@ class Form
* @param string $htmlname Nom de la zone select
* @return string Code of HTML select to chose tax or not
*/
- function selectPriceBaseType($selected = '', $htmlname = 'price_base_type')
+ public function selectPriceBaseType($selected = '', $htmlname = 'price_base_type')
{
global $langs;
@@ -3432,7 +3432,7 @@ class Form
* @param string $moreattrib To add more attribute on select
* @return void
*/
- function selectShippingMethod($selected = '', $htmlname = 'shipping_method_id', $filtre = '', $useempty = 0, $moreattrib = '')
+ public function selectShippingMethod($selected = '', $htmlname = 'shipping_method_id', $filtre = '', $useempty = 0, $moreattrib = '')
{
global $langs, $conf, $user;
@@ -3485,7 +3485,7 @@ class Form
* @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @return void
*/
- function formSelectShippingMethod($page, $selected = '', $htmlname = 'shipping_method_id', $addempty = 0)
+ public function formSelectShippingMethod($page, $selected = '', $htmlname = 'shipping_method_id', $addempty = 0)
{
global $langs, $db;
@@ -3516,7 +3516,7 @@ class Form
*
* @return string HTML select
*/
- function selectSituationInvoices($selected = '', $socid = 0)
+ public function selectSituationInvoices($selected = '', $socid = 0)
{
global $langs;
@@ -3570,7 +3570,7 @@ class Form
* @param int $showempty Add a nempty line
* @return string HTML select
*/
- function selectUnits($selected = '', $htmlname = 'units', $showempty = 0)
+ public function selectUnits($selected = '', $htmlname = 'units', $showempty = 0)
{
global $langs;
@@ -3608,7 +3608,7 @@ class Form
return $return;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select list of bank accounts
*
@@ -3621,7 +3621,7 @@ class Form
* @param int $showcurrency Show currency in label
* @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...)
*/
- function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0)
+ public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0)
{
// phpcs:enable
global $langs, $conf;
@@ -3693,7 +3693,7 @@ class Form
* @param string $moreattrib To add more attribute on select
* @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...)
*/
- function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '')
+ public function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '')
{
// phpcs:enable
global $langs, $conf;
@@ -3760,7 +3760,7 @@ class Form
* @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @return void
*/
- function formSelectAccount($page, $selected = '', $htmlname = 'fk_account', $addempty = 0)
+ public function formSelectAccount($page, $selected = '', $htmlname = 'fk_account', $addempty = 0)
{
global $langs;
if ($htmlname != "none") {
@@ -3785,7 +3785,7 @@ class Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of categories having choosed type
*
@@ -3798,7 +3798,7 @@ class Form
* @return string
* @see select_categories
*/
- function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $excludeafterid = 0, $outputmode = 0)
+ public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $excludeafterid = 0, $outputmode = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -3872,7 +3872,7 @@ class Form
return $output;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show a confirmation HTML form or AJAX popup
*
@@ -3889,7 +3889,7 @@ class Form
* @deprecated
* @see formconfirm()
*/
- function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
+ public function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
{
// phpcs:enable
dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
@@ -3920,7 +3920,7 @@ class Form
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a ';
@@ -113,7 +113,7 @@ class FormBarCode
return $select_encoder;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Print form to select type of barcode
*
@@ -123,7 +123,7 @@ class FormBarCode
* @return void
* @deprecated
*/
- function select_barcode_type($selected = '', $htmlname = 'barcodetype_id', $useempty = 0)
+ public function select_barcode_type($selected = '', $htmlname = 'barcodetype_id', $useempty = 0)
{
// phpcs:enable
print $this->selectBarcodeType($selected, $htmlname, $useempty);
@@ -137,7 +137,7 @@ class FormBarCode
* @param int $useempty Display empty value in select
* @return string
*/
- function selectBarcodeType($selected = '', $htmlname = 'barcodetype_id', $useempty = 0)
+ public function selectBarcodeType($selected = '', $htmlname = 'barcodetype_id', $useempty = 0)
{
global $langs, $conf;
@@ -183,7 +183,7 @@ class FormBarCode
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show form to select type of barcode
*
@@ -193,7 +193,7 @@ class FormBarCode
* @return void
* @deprecated
*/
- function form_barcode_type($page, $selected = '', $htmlname = 'barcodetype_id')
+ public function form_barcode_type($page, $selected = '', $htmlname = 'barcodetype_id')
{
// phpcs:enable
print $this->formBarcodeType($page, $selected, $htmlname);
@@ -207,7 +207,7 @@ class FormBarCode
* @param string $htmlname Nom du formulaire select
* @return string
*/
- function formBarcodeType($page, $selected = '', $htmlname = 'barcodetype_id')
+ public function formBarcodeType($page, $selected = '', $htmlname = 'barcodetype_id')
{
global $langs, $conf;
$out = '';
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index f92bee4519f..65f92c86948 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -46,13 +46,13 @@ class FormCompany
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of labels (translated) of third parties type
*
@@ -60,7 +60,7 @@ class FormCompany
* @param string $filter Add a SQL filter to select
* @return array Array of types
*/
- function typent_array($mode = 0, $filter = '')
+ public function typent_array($mode = 0, $filter = '')
{
// phpcs:enable
global $langs,$mysoc;
@@ -95,7 +95,7 @@ class FormCompany
return $effs;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre)
*
@@ -103,7 +103,7 @@ class FormCompany
* @param string $filter Add a SQL filter to select
* @return array Array of types d'effectifs
*/
- function effectif_array($mode = 0, $filter = '')
+ public function effectif_array($mode = 0, $filter = '')
{
// phpcs:enable
$effs = array();
@@ -135,7 +135,7 @@ class FormCompany
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Affiche formulaire de selection des modes de reglement
*
@@ -145,7 +145,7 @@ class FormCompany
* @param int $empty Add empty value in list
* @return void
*/
- function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0)
+ public function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0)
{
// phpcs:enable
global $user, $langs;
@@ -186,7 +186,7 @@ class FormCompany
print '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
* In the case of an all-country list, the display breaks on the country.
@@ -198,13 +198,13 @@ class FormCompany
* @param string $htmlname Id of department
* @return void
*/
- function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id')
+ public function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id')
{
// phpcs:enable
print $this->select_state($selected, $country_codeid, $htmlname);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
* In the case of an all-country list, the display breaks on the country.
@@ -217,7 +217,7 @@ class FormCompany
* @return string String with HTML select
* @see select_country
*/
- function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id')
+ public function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id')
{
// phpcs:enable
global $conf,$langs,$user;
@@ -319,7 +319,7 @@ class FormCompany
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des regions actives dont le pays est actif
* La cle de la liste est le code (il peut y avoir plusieurs entree pour
@@ -330,7 +330,7 @@ class FormCompany
* @param string $htmlname Name of HTML select field
* @return void
*/
- function select_region($selected = '', $htmlname = 'region_id')
+ public function select_region($selected = '', $htmlname = 'region_id')
{
// phpcs:enable
global $conf,$langs;
@@ -387,7 +387,7 @@ class FormCompany
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return combo list with people title
*
@@ -396,7 +396,7 @@ class FormCompany
* @param string $morecss Add more css on SELECT element
* @return string String with HTML select
*/
- function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth100')
+ public function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth100')
{
// phpcs:enable
global $conf,$langs,$user;
@@ -445,7 +445,7 @@ class FormCompany
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays.
@@ -457,13 +457,13 @@ class FormCompany
* @deprecated Use print xxx->select_juridicalstatus instead
* @see select_juridicalstatus()
*/
- function select_forme_juridique($selected = '', $country_codeid = 0, $filter = '')
+ public function select_forme_juridique($selected = '', $country_codeid = 0, $filter = '')
{
// phpcs:enable
print $this->select_juridicalstatus($selected, $country_codeid, $filter);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
@@ -474,7 +474,7 @@ class FormCompany
* @param string $htmlname HTML name of select
* @return string String with HTML select
*/
- function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
+ public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
{
// phpcs:enable
global $conf,$langs,$user;
@@ -579,7 +579,7 @@ class FormCompany
* @param string $morecss More CSS on select component
* @return int The selected third party ID
*/
- function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '')
+ public function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '')
{
global $conf, $langs;
@@ -738,7 +738,7 @@ class FormCompany
* @param string $morecss Add more css to select component
* @return void
*/
- function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
+ public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
{
global $user, $langs;
@@ -762,7 +762,7 @@ class FormCompany
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a select list with zip codes and their town
*
@@ -775,7 +775,7 @@ class FormCompany
* @param string $morecss More css
* @return string
*/
- function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
+ public function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
{
// phpcs:enable
global $conf;
@@ -795,7 +795,7 @@ class FormCompany
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...)
*
@@ -806,7 +806,7 @@ class FormCompany
* @param string $morecss More css
* @return string HTML string with prof id
*/
- function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent')
+ public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent')
{
// phpcs:enable
global $conf,$langs;
@@ -847,7 +847,7 @@ class FormCompany
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select with localtax values for thirdparties
*
@@ -856,7 +856,7 @@ class FormCompany
* @param string $htmlname HTML select name
* @return void
*/
- function select_localtax($local, $selected, $htmlname)
+ public function select_localtax($local, $selected, $htmlname)
{
// phpcs:enable
$tax=get_localtax_by_third($local);
@@ -900,7 +900,7 @@ class FormCompany
* @param string $morecss More css
* @return string HTML string
*/
- function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
+ public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
{
global $conf,$langs;
diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php
index d7cf1cd62d9..195f09663b3 100644
--- a/htdocs/core/class/html.formcontract.class.php
+++ b/htdocs/core/class/html.formcontract.class.php
@@ -49,7 +49,7 @@ class FormContract
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show a combo list with contracts qualified for a third party
*
@@ -60,8 +60,8 @@ class FormContract
* @param int $showempty Show empty line
* @return int Nbr of project if OK, <0 if KO
*/
- function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
- {
+ public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
+ {
// phpcs:enable
global $db,$user,$conf,$langs;
@@ -164,21 +164,21 @@ class FormContract
dol_print_error($db);
return -1;
}
- }
+ }
- /**
- * Show a form to select a contract
- *
- * @param int $page Page
- * @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
- * @param int $selected Id contract preselected
- * @param string $htmlname Nom de la zone html
- * @param int $maxlength Maximum length of label
- * @param int $showempty Show empty line
- * @return int Nbr of project if OK, <0 if KO
- */
- function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
- {
+ /**
+ * Show a form to select a contract
+ *
+ * @param int $page Page
+ * @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
+ * @param int $selected Id contract preselected
+ * @param string $htmlname Nom de la zone html
+ * @param int $maxlength Maximum length of label
+ * @param int $showempty Show empty line
+ * @return int Nbr of project if OK, <0 if KO
+ */
+ public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
+ {
global $langs;
print "\n";
diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php
index 13cf88e9aa2..0611d553af1 100644
--- a/htdocs/core/class/html.formcron.class.php
+++ b/htdocs/core/class/html.formcron.class.php
@@ -18,7 +18,7 @@
*/
/**
- * \file core/class/html.formcron.class.php
+ * \file htdocs/core/class/html.formcron.class.php
* \brief Fichier de la classe des fonctions predefinie de composants html cron
*/
@@ -28,75 +28,75 @@
*/
class FormCron extends Form
{
- /**
+ /**
* @var DoliDB Database handler.
*/
public $db;
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- function __construct($db)
- {
- $this->db = $db;
- }
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db = $db;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Display On Off selector
- *
- * @param string $htmlname Html control name
- * @param integer $selected selected value
- * @param integer $readonly Select is read only or not
- * @return string HTML select field
- */
- function select_typejob($htmlname, $selected = 0, $readonly = 0)
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Display On Off selector
+ *
+ * @param string $htmlname Html control name
+ * @param integer $selected selected value
+ * @param integer $readonly Select is read only or not
+ * @return string HTML select field
+ */
+ public function select_typejob($htmlname, $selected = 0, $readonly = 0)
+ {
// phpcs:enable
- global $langs;
+ global $langs;
- $langs->load('cron@cron');
- if (!empty($readonly)) {
- if ($selected=='command') {
- $out= $langs->trans('CronType_command');
- $out.=' ';
- $out.= ''.$langs->trans('CronType_command').' ';
- $out.='';
- } elseif ($selected=='method') {
- $out= $langs->trans('CronType_method');
- $out.=' ';
- $out.= ''.$langs->trans('CronType_method').' ';
- $out.='';
- }
- }else {
+ $langs->load('cron@cron');
+ if (!empty($readonly)) {
+ if ($selected=='command') {
+ $out= $langs->trans('CronType_command');
+ $out.=' ';
+ $out.= ''.$langs->trans('CronType_command').' ';
+ $out.='';
+ } elseif ($selected=='method') {
+ $out= $langs->trans('CronType_method');
+ $out.=' ';
+ $out.= ''.$langs->trans('CronType_method').' ';
+ $out.='';
+ }
+ } else {
- $out=' ';
+ $out=' ';
- if ($selected=='command') {
- $selected_attr=' selected ';
- } else {
- $selected_attr='';
- }
- $out.= ''.$langs->trans('CronType_command').' ';
+ if ($selected=='command') {
+ $selected_attr=' selected ';
+ } else {
+ $selected_attr='';
+ }
+ $out.= ''.$langs->trans('CronType_command').' ';
- if ($selected=='method') {
- $selected_attr=' selected ';
- } else {
- $selected_attr='';
- }
- $out.= ''.$langs->trans('CronType_method').' ';
+ if ($selected=='method') {
+ $selected_attr=' selected ';
+ } else {
+ $selected_attr='';
+ }
+ $out.= ''.$langs->trans('CronType_method').' ';
- $out.='';
- }
+ $out.='';
+ }
- return $out;
- }
+ return $out;
+ }
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 2243b4e06c1..5e875be176d 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -51,14 +51,14 @@ class FormFile
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numoffiles=0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show form to upload a new file.
*
@@ -70,7 +70,7 @@ class FormFile
* @param int $size Length of input file area. Deprecated.
* @param Object $object Object to use (when attachment is done on an element)
* @param string $options Add an option column
- * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
+ * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
* Deprecated 2 should never be used and if 1 is used, option should no be enabled.
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
@@ -79,7 +79,7 @@ class FormFile
* @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be)
* @return int <0 if KO, >0 if OK
*/
- function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '')
+ public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '')
{
// phpcs:enable
global $conf,$langs, $hookmanager;
@@ -183,11 +183,11 @@ class FormFile
else {
$rename='checked';
}
-
+
$out .= '';
if (! empty($options)) $out .= ''.$options.' ';
$out .= '';
- $out .= ' '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
+ $out .= ' '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
$out .= ' ';
$out .= ' ';
}
@@ -247,7 +247,7 @@ class FormFile
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show the box with list of available documents for object
*
@@ -270,7 +270,7 @@ class FormFile
* @return int <0 if KO, number of shown files if OK
* @deprecated Use print xxx->showdocuments() instead.
*/
- function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '')
+ public function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '')
{
// phpcs:enable
$this->numoffiles=0;
@@ -303,7 +303,7 @@ class FormFile
* @param int $hideifempty Hide section of generated files if there is no file
* @return string Output string with HTML array of documents (might be empty string)
*/
- function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0)
+ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0)
{
// Deprecation warning
if (! empty($iconPDF)) {
@@ -902,7 +902,7 @@ class FormFile
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/
- function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '')
+ public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '')
{
global $conf, $langs;
@@ -1005,7 +1005,7 @@ class FormFile
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of documents in $filearray (may be they are all in same directory but may not)
* This also sync database if $upload_dir is defined.
@@ -1037,7 +1037,7 @@ class FormFile
* @return int <0 if KO, nb of files shown if OK
* @see list_of_autoecmfiles
*/
- function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
+ public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
{
// phpcs:enable
global $user, $conf, $langs, $hookmanager;
@@ -1147,10 +1147,10 @@ class FormFile
print '';
//print $url.' sortfield='.$sortfield.' sortorder='.$sortorder;
- print_liste_field_titre('Documents2', $url, "name", "", $param, 'class="left"', $sortfield, $sortorder);
- print_liste_field_titre('Size', $url, "size", "", $param, 'class="right"', $sortfield, $sortorder);
- print_liste_field_titre('Date', $url, "date", "", $param, 'class="center"', $sortfield, $sortorder);
- if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, 'class="center"'); // Preview
+ print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, ' left');
+ print_liste_field_titre('Size', $url, "size", "", $param, '', $sortfield, $sortorder, ' right');
+ print_liste_field_titre('Date', $url, "date", "", $param, '', $sortfield, $sortorder, ' center');
+ if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, '', $sortfield, $sortorder, ' center'); // Preview
print_liste_field_titre('');
print_liste_field_titre('');
if (! $disablemove) print_liste_field_titre('');
@@ -1406,7 +1406,7 @@ class FormFile
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of documents in a directory
*
@@ -1425,7 +1425,7 @@ class FormFile
* @return int <0 if KO, nb of files shown if OK
* @see list_of_documents
*/
- function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
+ public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
{
// phpcs:enable
global $user, $conf, $langs, $form;
@@ -1571,7 +1571,7 @@ class FormFile
{
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');
}
-
+
if (! $id && ! $ref) continue;
$found=0;
if (! empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref]))
diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php
index 3d0a84b074c..83405f9725b 100644
--- a/htdocs/core/class/html.formintervention.class.php
+++ b/htdocs/core/class/html.formintervention.class.php
@@ -49,7 +49,7 @@ class FormIntervention
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show a combo list with contracts qualified for a third party
*
@@ -60,7 +60,7 @@ class FormIntervention
* @param int $showempty Show empty line
* @return int Nbre of project if OK, <0 if KO
*/
- function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1)
+ public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1)
{
// phpcs:enable
global $db,$user,$conf,$langs;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 1159c74dc8d..b643f1dfcb9 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -121,7 +121,7 @@ class FormMail extends Form
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
@@ -151,13 +151,13 @@ class FormMail extends Form
$this->withfckeditor=-1; // -1 = Auto
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Clear list of attached files in send mail form (also stored in session)
*
* @return void
*/
- function clear_attached_files()
+ public function clear_attached_files()
{
// phpcs:enable
global $conf,$user;
@@ -174,7 +174,7 @@ class FormMail extends Form
unset($_SESSION["listofmimes".$keytoavoidconflict]);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a file into the list of attached files (stored in SECTION array)
*
@@ -183,7 +183,7 @@ class FormMail extends Form
* @param string $type Mime type (can be dol_mimetype($file))
* @return void
*/
- function add_attached_files($path, $file = '', $type = '')
+ public function add_attached_files($path, $file = '', $type = '')
{
// phpcs:enable
$listofpaths=array();
@@ -208,14 +208,14 @@ class FormMail extends Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Remove a file from the list of attached files (stored in SECTION array)
*
* @param string $keytodelete Key in file array (0, 1, 2, ...)
* @return void
*/
- function remove_attached_files($keytodelete)
+ public function remove_attached_files($keytodelete)
{
// phpcs:enable
$listofpaths=array();
@@ -238,13 +238,13 @@ class FormMail extends Form
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of attached files (stored in SECTION array)
*
* @return array array('paths'=> ,'names'=>, 'mimes'=> )
*/
- function get_attached_files()
+ public function get_attached_files()
{
// phpcs:enable
$listofpaths=array();
@@ -258,7 +258,7 @@ class FormMail extends Form
return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
@@ -268,13 +268,13 @@ class FormMail extends Form
* @param string $removefileaction Name of action when removing file attachments
* @return void
*/
- function show_form($addfileaction = 'addfile', $removefileaction = 'removefile')
+ public function show_form($addfileaction = 'addfile', $removefileaction = 'removefile')
{
// phpcs:enable
print $this->get_form($addfileaction, $removefileaction);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
@@ -285,7 +285,7 @@ class FormMail extends Form
* @param string $removefileaction Name of action when removing file attachments
* @return string Form to show
*/
- function get_form($addfileaction = 'addfile', $removefileaction = 'removefile')
+ public function get_form($addfileaction = 'addfile', $removefileaction = 'removefile')
{
// phpcs:enable
global $conf, $langs, $user, $hookmanager, $form;
@@ -1130,24 +1130,23 @@ class FormMail extends Form
}
/**
- * Return templates of email with type = $type_template or type = 'all'.
- * This search into table c_email_templates. Used by the get_form function.
+ * Return templates of email with type = $type_template or type = 'all'.
+ * This search into table c_email_templates. Used by the get_form function.
*
- * @param DoliDB $db Database handler
- * @param string $type_template Get message for model/type=$type_template, type='all' also included.
- * @param string $user Get template public or limited to this user
- * @param Translate $outputlangs Output lang object
- * @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
- * @param int $active 1=Only active template, 0=Only disabled, -1=All
- * @param string $label Label of template
- * @return ModelMail|integer One instance of ModelMail or -1 if error
+ * @param DoliDB $db Database handler
+ * @param string $type_template Get message for model/type=$type_template, type='all' also included.
+ * @param string $user Get template public or limited to this user
+ * @param Translate $outputlangs Output lang object
+ * @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
+ * @param int $active 1=Only active template, 0=Only disabled, -1=All
+ * @param string $label Label of template
+ * @return ModelMail|integer One instance of ModelMail or -1 if error
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{
- $ret = new ModelMail();
+ $ret = new ModelMail();
- if ($id == -2 && empty($label))
- {
+ if ($id == -2 && empty($label)) {
$this->error = 'LabelIsMandatoryWhenIdIs-2';
return -1;
}
@@ -1320,7 +1319,7 @@ class FormMail extends Form
* @return void
* @see getCommonSubstitutionArray
*/
- function setSubstitFromObject($object, $outputlangs)
+ public function setSubstitFromObject($object, $outputlangs)
{
global $conf, $user;
@@ -1377,7 +1376,7 @@ class FormMail extends Form
* @param Object $object Object if applicable
* @return array Array of substitution values for emails.
*/
- static function getAvailableSubstitKey($mode = 'formemail', $object = null)
+ public static function getAvailableSubstitKey($mode = 'formemail', $object = null)
{
global $conf, $langs;
diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php
index 95c2c057b40..caf4bf8a504 100644
--- a/htdocs/core/class/html.formmailing.class.php
+++ b/htdocs/core/class/html.formmailing.class.php
@@ -27,33 +27,33 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
*/
class FormMailing extends Form
{
- /**
- * @var string[] Error codes (or messages)
- */
- public $errors = array();
+ /**
+ * @var string[] Error codes (or messages)
+ */
+ public $errors = array();
- /**
- * Output a select with destinaries status
- *
- * @param string $selectedid The selected id
- * @param string $htmlname Name of controm
- * @param integer $show_empty Show empty option
- * @return string HTML select
- */
+ /**
+ * Output a select with destinaries status
+ *
+ * @param string $selectedid The selected id
+ * @param string $htmlname Name of controm
+ * @param integer $show_empty Show empty option
+ * @return string HTML select
+ */
public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0)
{
- global $langs;
- $langs->load("mails");
+ global $langs;
+ $langs->load("mails");
- require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
- $mailing = new Mailing($this->db);
+ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
+ $mailing = new Mailing($this->db);
- $options = array();
+ $options = array();
- if ($show_empty) {
- $options[-2] = ''; // Note -1 is used for error
- }
+ if ($show_empty) {
+ $options[-2] = ''; // Note -1 is used for error
+ }
$options = $options + $mailing->statut_dest;
diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php
index 5aecb6efc71..f022d2c3791 100644
--- a/htdocs/core/class/html.formmargin.class.php
+++ b/htdocs/core/class/html.formmargin.class.php
@@ -44,7 +44,7 @@ class FormMargin
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -59,7 +59,7 @@ class FormMargin
* @param boolean $force_price True of not
* @return array Array with info
*/
- function getMarginInfosArray($object, $force_price = false)
+ public function getMarginInfosArray($object, $force_price = false)
{
global $conf, $db;
@@ -191,7 +191,7 @@ class FormMargin
* @param boolean $force_price Force price
* @return void
*/
- function displayMarginInfos($object, $force_price = false)
+ public function displayMarginInfos($object, $force_price = false)
{
global $langs, $conf, $user;
diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php
index 9783d6f50a8..9c1d847f16e 100644
--- a/htdocs/core/class/html.formorder.class.php
+++ b/htdocs/core/class/html.formorder.class.php
@@ -31,13 +31,13 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
class FormOrder extends Form
{
- /**
- * Return combo list of differents status of a orders
+ /**
+ * Return combo list of differents status of a orders
*
- * @param string $selected Preselected value
- * @param int $short Use short labels
- * @param string $hmlname Name of HTML select element
- * @return void
+ * @param string $selected Preselected value
+ * @param int $short Use short labels
+ * @param string $hmlname Name of HTML select element
+ * @return void
*/
public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
{
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 97beb2464ad..1bb59077bec 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -50,13 +50,13 @@ class FormOther
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML select list of export models
*
@@ -67,7 +67,7 @@ class FormOther
* @param int $fk_user Utilisateur créant le modèle
* @return void
*/
- function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
+ public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
{
// phpcs:enable
$sql = "SELECT rowid, label";
@@ -109,7 +109,7 @@ class FormOther
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of export models
*
@@ -119,7 +119,7 @@ class FormOther
* @param int $useempty Affiche valeur vide dans liste
* @return void
*/
- function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0)
+ public function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0)
{
// phpcs:enable
$sql = "SELECT rowid, label";
@@ -160,7 +160,7 @@ class FormOther
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of ecotaxes with label
*
@@ -168,7 +168,7 @@ class FormOther
* @param string $htmlname Name of combo list
* @return integer
*/
- function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id')
+ public function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id')
{
// phpcs:enable
global $langs;
@@ -218,7 +218,7 @@ class FormOther
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of revenue stamp for country
*
@@ -227,7 +227,7 @@ class FormOther
* @param string $country_code Country Code
* @return string HTML select list
*/
- function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '')
+ public function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '')
{
// phpcs:enable
global $langs;
@@ -277,7 +277,7 @@ class FormOther
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select list to select a percent
*
@@ -290,7 +290,7 @@ class FormOther
* @param int $showempty Add also an empty line
* @return string HTML select string
*/
- function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)
+ public function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)
{
// phpcs:enable
$return = '';
@@ -315,7 +315,7 @@ class FormOther
return $return;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list for categories (to use in form search selectors)
*
@@ -328,7 +328,7 @@ class FormOther
* @return string Html combo list code
* @see select_all_categories
*/
- function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
+ public function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
{
// phpcs:enable
global $conf, $langs;
@@ -377,7 +377,7 @@ class FormOther
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return select list for categories (to use in form search selectors)
*
@@ -389,7 +389,7 @@ class FormOther
* @param string $morecss More CSS
* @return string Html combo list code
*/
- function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '')
+ public function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '')
{
// phpcs:enable
global $conf,$langs;
@@ -490,7 +490,7 @@ class FormOther
* @param string $morecss More css
* @return void
*/
- function selectProjectTasks($selectedtask = '', $projectid = 0, $htmlname = 'task_parent', $modeproject = 0, $modetask = 0, $mode = 0, $useempty = 0, $disablechildoftaskid = 0, $filteronprojstatus = '', $morecss = '')
+ public function selectProjectTasks($selectedtask = '', $projectid = 0, $htmlname = 'task_parent', $modeproject = 0, $modetask = 0, $mode = 0, $useempty = 0, $disablechildoftaskid = 0, $filteronprojstatus = '', $morecss = '')
{
global $user, $langs;
@@ -535,13 +535,11 @@ class FormOther
$lastprojectid=0;
$numlines=count($lines);
- for ($i = 0 ; $i < $numlines ; $i++)
- {
- if ($lines[$i]->fk_parent == $parent)
- {
+ for ($i = 0 ; $i < $numlines ; $i++) {
+ if ($lines[$i]->fk_parent == $parent) {
$var = !$var;
- //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
+ //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
// Break on a new project
if ($parent == 0) // We are on a task at first level
@@ -614,14 +612,14 @@ class FormOther
/**
- * Output a HTML thumb of color or a text if not defined.
+ * Output a HTML thumb of color or a text if not defined.
*
- * @param string $color String with hex (FFFFFF) or comma RGB ('255,255,255')
- * @param string $textifnotdefined Text to show if color not defined
- * @return string HTML code for color thumb
- * @see selectColor
+ * @param string $color String with hex (FFFFFF) or comma RGB ('255,255,255')
+ * @param string $textifnotdefined Text to show if color not defined
+ * @return string HTML code for color thumb
+ * @see selectColor
*/
- static function showColor($color, $textifnotdefined = '')
+ public static function showColor($color, $textifnotdefined = '')
{
$textcolor='FFF';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@@ -633,43 +631,43 @@ class FormOther
else print $textifnotdefined;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Output a HTML code to select a color
+ * Output a HTML code to select a color
*
- * @param string $set_color Pre-selected color
- * @param string $prefix Name of HTML field
- * @param string $form_name Deprecated. Not used.
- * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
- * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
- * @return void
- * @deprecated Use instead selectColor
- * @see selectColor()
+ * @param string $set_color Pre-selected color
+ * @param string $prefix Name of HTML field
+ * @param string $form_name Deprecated. Not used.
+ * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
+ * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
+ * @return void
+ * @deprecated Use instead selectColor
+ * @see selectColor()
*/
- function select_color($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '')
+ public function select_color($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '')
{
// phpcs:enable
print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors);
}
/**
- * Output a HTML code to select a color. Field will return an hexa color like '334455'.
+ * Output a HTML code to select a color. Field will return an hexa color like '334455'.
*
- * @param string $set_color Pre-selected color
- * @param string $prefix Name of HTML field
- * @param string $form_name Deprecated. Not used.
- * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
- * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
- * @param string $morecss Add css style into input field
- * @return string
- * @see showColor
+ * @param string $set_color Pre-selected color
+ * @param string $prefix Name of HTML field
+ * @param string $form_name Deprecated. Not used.
+ * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
+ * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
+ * @param string $morecss Add css style into input field
+ * @return string
+ * @see showColor
*/
- static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '')
+ public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '')
{
- // Deprecation warning
- if ($form_name) {
- dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING);
- }
+ // Deprecation warning
+ if ($form_name) {
+ dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING);
+ }
global $langs,$conf;
@@ -752,7 +750,7 @@ class FormOther
return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Creation d'un icone de couleur
*
@@ -763,7 +761,7 @@ class FormOther
* @param int $y Hauteur de l'image en pixels
* @return void
*/
- function CreateColorIcon($color, $module, $name, $x = '12', $y = '12')
+ public function CreateColorIcon($color, $module, $name, $x = '12', $y = '12')
{
// phpcs:enable
global $conf;
@@ -793,7 +791,7 @@ class FormOther
ImageDestroy($image);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML combo list of week
*
@@ -802,7 +800,7 @@ class FormOther
* @param int $useempty Affiche valeur vide dans liste
* @return string
*/
- function select_dayofweek($selected = '', $htmlname = 'weekid', $useempty = 0)
+ public function select_dayofweek($selected = '', $htmlname = 'weekid', $useempty = 0)
{
// phpcs:enable
global $langs;
@@ -839,7 +837,7 @@ class FormOther
return $select_week;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML combo list of month
*
@@ -850,7 +848,7 @@ class FormOther
* @param string $morecss More Css
* @return string
*/
- function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = '')
+ public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = '')
{
// phpcs:enable
global $langs;
@@ -882,7 +880,7 @@ class FormOther
return $select_month;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML combo list of years
*
@@ -897,7 +895,7 @@ class FormOther
* @param string $morecss More CSS
* @return string
*/
- function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
+ public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
{
// phpcs:enable
print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss);
@@ -917,7 +915,7 @@ class FormOther
* @param string $morecss More css
* @return string
*/
- function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
+ public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
{
$out='';
@@ -965,7 +963,7 @@ class FormOther
* @param String $areacode Code of area for pages ('0'=value for Home page)
* @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>)
*/
- static function getBoxesArea($user, $areacode)
+ public static function getBoxesArea($user, $areacode)
{
global $conf,$langs,$db;
@@ -1172,7 +1170,7 @@ class FormOther
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select list of a dictionary
*
@@ -1185,7 +1183,7 @@ class FormOther
* @param string $moreattrib More attributes on HTML select tag
* @return void
*/
- function select_dictionary($htmlname, $dictionarytable, $keyfield = 'code', $labelfield = 'label', $selected = '', $useempty = 0, $moreattrib = '')
+ public function select_dictionary($htmlname, $dictionarytable, $keyfield = 'code', $labelfield = 'label', $selected = '', $useempty = 0, $moreattrib = '')
{
// phpcs:enable
global $langs, $conf;
@@ -1226,9 +1224,7 @@ class FormOther
$i++;
}
print " ";
- }
- else
- {
+ } else {
print $langs->trans("DictionaryEmpty");
}
}
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 765f7d00d79..9ef1098901c 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -45,12 +45,12 @@ class FormProjets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output a combo list with projects qualified for a third party / user
*
@@ -71,8 +71,8 @@ class FormProjets
* @param int $htmlid Html id to use instead of htmlname
* @return string Return html content
*/
- function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
- {
+ public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
+ {
// phpcs:enable
global $langs,$conf,$form;
@@ -90,13 +90,13 @@ class FormProjets
$selected_input_value=$project->ref;
}
$urloption='socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed;
-$out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
-// 'update' => array(
-// 'projectid' => 'id'
-// )
- ));
+ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
+ // 'update' => array(
+ // 'projectid' => 'id'
+ // )
+ ));
- $out.=' ';
+ $out.=' ';
}
else
{
@@ -119,7 +119,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
else return $out;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an array with projects qualified for a third party
*
@@ -140,8 +140,8 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
* @param string $morecss More CSS
* @return int Nb of project if OK, <0 if KO
*/
- function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
- {
+ public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
+ {
// phpcs:enable
global $user,$conf,$langs;
@@ -303,11 +303,11 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
}
/**
- * Output a combo list with tasks qualified for a third party
+ * Output a combo list with tasks qualified for a third party
*
- * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
- * @param int $selected Id task preselected
- * @param string $htmlname Name of HTML select
+ * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
+ * @param int $selected Id task preselected
+ * @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
@@ -320,7 +320,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
* @param User $usertofilter User object to use for filtering
* @return int Nbr of project if OK, <0 if KO
*/
- function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
+ public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
{
global $user,$conf,$langs;
@@ -477,7 +477,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build a HTML select list of element of same thirdparty to suggest to link them to project
*
@@ -488,7 +488,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
* @param string $projectkey Equivalent key to fk_projet for actual table_element
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
*/
- function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
+ public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
{
// phpcs:enable
global $conf, $langs;
@@ -618,7 +618,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
* @param string $morecss Add more css
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
*/
- function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '')
+ public function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '')
{
global $conf, $langs;
diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php
index 1f4fad0829c..e9f78638742 100644
--- a/htdocs/core/class/html.formpropal.class.php
+++ b/htdocs/core/class/html.formpropal.class.php
@@ -27,26 +27,26 @@
*/
class FormPropal
{
- /**
+ /**
* @var DoliDB Database handler.
*/
public $db;
-
- /**
- * @var string Error code (or message)
- */
- public $error='';
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- public function __construct($db)
- {
- $this->db = $db;
- }
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db = $db;
+ }
/**
* Return combo list of differents status of a proposal
@@ -60,14 +60,13 @@ class FormPropal
* @param string $htmlname Name of select field
* @return void
*/
- function selectProposalStatus($selected = '', $short = 0, $excludedraft = 0, $showempty = 1, $mode = 'customer', $htmlname = 'propal_statut')
+ public function selectProposalStatus($selected = '', $short = 0, $excludedraft = 0, $showempty = 1, $mode = 'customer', $htmlname = 'propal_statut')
{
global $langs;
$prefix='';
$listofstatus=array();
- if ($mode == 'supplier')
- {
+ if ($mode == 'supplier') {
$prefix='SupplierProposalStatus';
$langs->load("supplier_proposal");
@@ -78,9 +77,7 @@ class FormPropal
3=>array('id'=>3, 'code'=>'PR_NOTSIGNED'),
4=>array('id'=>4, 'code'=>'PR_CLOSED')
);
- }
- else
- {
+ } else {
$prefix="PropalStatus";
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
@@ -114,11 +111,11 @@ class FormPropal
{
if ($excludedraft)
{
- if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT')
- {
- $i++;
- continue;
- }
+ if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT')
+ {
+ $i++;
+ continue;
+ }
}
if ($selected != '' && $selected == $obj['id'])
{
@@ -134,7 +131,7 @@ class FormPropal
print $langs->trans($prefix.$key.($short?'Short':''));
}
else
- {
+ {
$conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Validated','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Billed');
if (! empty($conv_to_new_code[$obj['code']])) $key=$conv_to_new_code[$obj['code']];
diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php
index df6e09da59e..5269f4fdcad 100644
--- a/htdocs/core/class/html.formsms.class.php
+++ b/htdocs/core/class/html.formsms.class.php
@@ -76,7 +76,7 @@ class FormSms
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
@@ -92,7 +92,7 @@ class FormSms
$this->withbodyreadonly=0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show the form to input an sms.
*
@@ -100,7 +100,7 @@ class FormSms
* @param int $showform Show form tags and submit button (recommanded is to use with value 0)
* @return void
*/
- function show_form($morecss = 'titlefield', $showform = 1)
+ public function show_form($morecss = 'titlefield', $showform = 1)
{
// phpcs:enable
global $conf, $langs, $user, $form;
diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php
index c797fb77dbb..74a511ebdd5 100644
--- a/htdocs/core/class/html.formsocialcontrib.class.php
+++ b/htdocs/core/class/html.formsocialcontrib.class.php
@@ -48,7 +48,7 @@ class FormSocialContrib
$this->db = $db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of social contributions.
* Use mysoc->country_id or mysoc->country_code so they must be defined.
@@ -61,7 +61,7 @@ class FormSocialContrib
* @param string $morecss Add more CSS on select
* @return void
*/
- function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300')
+ public function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300')
{
// phpcs:enable
global $conf,$db,$langs,$user,$mysoc;
diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php
index 9ab430733e0..3cefeaef99c 100644
--- a/htdocs/core/class/html.formwebsite.class.php
+++ b/htdocs/core/class/html.formwebsite.class.php
@@ -40,7 +40,7 @@ class FormWebsite
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -54,9 +54,9 @@ class FormWebsite
* @param int $useempty Show empty value or not
* @return string Html component
*/
- function selectWebsite($selected = '', $htmlname = 'exportmodelid', $useempty = 0)
+ public function selectWebsite($selected = '', $htmlname = 'exportmodelid', $useempty = 0)
{
- $out='';
+ $out='';
$sql = "SELECT rowid, ref";
$sql.= " FROM ".MAIN_DB_PREFIX."website";
@@ -107,16 +107,16 @@ class FormWebsite
* @param string $moreattrib More attributes on HTML select tag
* @return void
*/
- function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
+ public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
{
- global $langs, $conf, $user;
+ global $langs, $conf, $user;
- $langs->load("admin");
+ $langs->load("admin");
- $sql = "SELECT rowid, code, label, entity";
- $sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
- $sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
- $sql.= " ORDER BY label";
+ $sql = "SELECT rowid, code, label, entity";
+ $sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
+ $sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
+ $sql.= " ORDER BY label";
dol_syslog(get_class($this)."::selectTypeOfContainer", LOG_DEBUG);
$result = $this->db->query($sql);
@@ -170,7 +170,7 @@ class FormWebsite
* @param string $moreattrib More attributes on HTML select tag
* @return void
*/
- function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
+ public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
{
global $langs, $conf, $user;
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index ddee9453e08..1138e3a69ad 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -27,15 +27,15 @@
*/
class InfoBox
{
- /**
- * Name of positions 0=Home, 1=...
- *
- * @return string[] Array with list of zones
- */
- static function getListOfPagesForBoxes()
- {
- return array(0=>'Home');
- }
+ /**
+ * Name of positions 0=Home, 1=...
+ *
+ * @return string[] Array with list of zones
+ */
+ public static function getListOfPagesForBoxes()
+ {
+ return array(0=>'Home');
+ }
/**
* Return array of boxes qualified for area and user
@@ -48,7 +48,7 @@ class InfoBox
* @param int $includehidden Include also hidden boxes
* @return array Array of boxes
*/
- static function listBoxes($db, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
+ public static function listBoxes($db, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
{
global $conf;
@@ -68,10 +68,10 @@ class InfoBox
$sql.= " ORDER BY b.box_order";
}
else // available
- {
+ {
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
- $sql.= " WHERE d.entity IN (0,".$conf->entity.")";
+ $sql.= " WHERE d.entity IN (0,".$conf->entity.")";
}
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG);
@@ -97,17 +97,17 @@ class InfoBox
{
$boxname=preg_replace('/\.php$/i', '', $obj->file);
$relsourcefile = "/core/boxes/".$boxname.".php";
- }
+ }
- //print $obj->box_id.'-'.$boxname.'-'.$relsourcefile.' ';
+ //print $obj->box_id.'-'.$boxname.'-'.$relsourcefile.' ';
- // TODO PERF Do not make "dol_include_once" here, nor "new" later. This means, we must store a 'depends' field to store modules list, then
+ // TODO PERF Do not make "dol_include_once" here, nor "new" later. This means, we must store a 'depends' field to store modules list, then
// the "enabled" condition for modules forbidden for external users and the depends condition can be done.
// Goal is to avoid making a "new" done for each boxes returned by select.
dol_include_once($relsourcefile);
if (class_exists($boxname))
{
- $box=new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
+ $box=new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
//$box=new stdClass();
// box properties
@@ -117,9 +117,9 @@ class InfoBox
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile= $relsourcefile;
- $box->class = $boxname;
+ $box->class = $boxname;
- if ($mode == 'activated' && ! is_object($user)) // List of activated box was not yet personalized into database
+ if ($mode == 'activated' && ! is_object($user)) // List of activated box was not yet personalized into database
{
if (is_numeric($box->box_order))
{
@@ -138,19 +138,19 @@ class InfoBox
{
foreach($box->depends as $moduleelem)
{
- $arrayelem=explode('|', $moduleelem);
- $tmpenabled=0; // $tmpenabled is used for the '|' test (OR)
- foreach($arrayelem as $module)
- {
- $tmpmodule=preg_replace('/@[^@]+/', '', $module);
- if (! empty($conf->$tmpmodule->enabled)) $tmpenabled=1;
- //print $boxname.'-'.$module.'-module enabled='.(empty($conf->$tmpmodule->enabled)?0:1).' ';
- }
- if (empty($tmpenabled)) // We found at least one module required that is disabled
- {
- $enabled=0;
- break;
- }
+ $arrayelem=explode('|', $moduleelem);
+ $tmpenabled=0; // $tmpenabled is used for the '|' test (OR)
+ foreach($arrayelem as $module)
+ {
+ $tmpmodule=preg_replace('/@[^@]+/', '', $module);
+ if (! empty($conf->$tmpmodule->enabled)) $tmpenabled=1;
+ //print $boxname.'-'.$module.'-module enabled='.(empty($conf->$tmpmodule->enabled)?0:1).' ';
+ }
+ if (empty($tmpenabled)) // We found at least one module required that is disabled
+ {
+ $enabled=0;
+ break;
+ }
}
}
//print '=>'.$boxname.'-enabled='.$enabled.' ';
@@ -160,16 +160,16 @@ class InfoBox
else unset($box);
}
else
- {
- dol_syslog("Failed to load box '".$boxname."' into file '".$relsourcefile."'", LOG_WARNING);
- }
+ {
+ dol_syslog("Failed to load box '".$boxname."' into file '".$relsourcefile."'", LOG_WARNING);
+ }
}
$j++;
}
}
else
- {
- dol_syslog($db->lasterror(), LOG_ERR);
+ {
+ dol_syslog($db->lasterror(), LOG_ERR);
return array('error'=>$db->lasterror());
}
@@ -186,7 +186,7 @@ class InfoBox
* @param int $userid Id of user
* @return int <0 if KO, 0=Nothing done, > 0 if OK
*/
- static function saveboxorder($db, $zone, $boxorder, $userid = 0)
+ public static function saveboxorder($db, $zone, $boxorder, $userid = 0)
{
global $conf;
diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php
index 82b146489e9..ec0c2571ec8 100644
--- a/htdocs/core/class/interfaces.class.php
+++ b/htdocs/core/class/interfaces.class.php
@@ -36,24 +36,24 @@ class Interfaces
*/
public $db;
- var $dir; // Directory with all core and external triggers files
+ public $dir; // Directory with all core and external triggers files
/**
- * @var string[] Error codes (or messages)
- */
- public $errors = array();
+ * @var string[] Error codes (or messages)
+ */
+ public $errors = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function called when a Dolibarr business event occurs
* This function call all qualified triggers.
@@ -65,15 +65,15 @@ class Interfaces
* @param Conf $conf Objet conf
* @return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise.
*/
- function run_triggers($action, $object, $user, $langs, $conf)
+ public function run_triggers($action, $object, $user, $langs, $conf)
{
// phpcs:enable
// Check parameters
if (! is_object($object) || ! is_object($conf)) // Error
{
- $this->error='function run_triggers called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf);
+ $this->error='function run_triggers called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf);
dol_syslog(get_class($this).'::run_triggers '.$this->error, LOG_ERR);
- $this->errors[]=$this->error;
+ $this->errors[]=$this->error;
return -1;
}
if (! is_object($langs)) // Warning
@@ -93,10 +93,10 @@ class Interfaces
$files = array();
$modules = array();
$orders = array();
- $i=0;
+ $i=0;
- $dirtriggers=array_merge(array('/core/triggers'), $conf->modules_parts['triggers']);
+ $dirtriggers=array_merge(array('/core/triggers'), $conf->modules_parts['triggers']);
foreach($dirtriggers as $reldir)
{
$dir=dol_buildpath($reldir, 0);
@@ -113,9 +113,9 @@ class Interfaces
{
if (is_readable($newdir."/".$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php$/i', $file, $reg))
{
- $part1=$reg[1];
- $part2=$reg[2];
- $part3=$reg[3];
+ $part1=$reg[1];
+ $part2=$reg[2];
+ $part3=$reg[3];
$nbfile++;
@@ -177,22 +177,22 @@ class Interfaces
$objMod = new $modName($this->db);
if ($objMod)
{
- $result=0;
+ $result=0;
- if (method_exists($objMod, 'runTrigger')) // New method to implement
- {
- //dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_DEBUG);
- $result=$objMod->runTrigger($action, $object, $user, $langs, $conf);
- }
- elseif (method_exists($objMod, 'run_trigger')) // Deprecated method
- {
- dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING);
- $result=$objMod->run_trigger($action, $object, $user, $langs, $conf);
- }
- else
- {
- dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
- }
+ if (method_exists($objMod, 'runTrigger')) // New method to implement
+ {
+ //dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_DEBUG);
+ $result=$objMod->runTrigger($action, $object, $user, $langs, $conf);
+ }
+ elseif (method_exists($objMod, 'run_trigger')) // Deprecated method
+ {
+ dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING);
+ $result=$objMod->run_trigger($action, $object, $user, $langs, $conf);
+ }
+ else
+ {
+ dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
+ }
if ($result > 0)
{
@@ -217,7 +217,7 @@ class Interfaces
}
}
else
- {
+ {
dol_syslog(get_class($this)."::run_triggers action=".$action." Failed to instantiate trigger for file '".$files[$key]."'", LOG_ERR);
}
}
@@ -238,10 +238,10 @@ class Interfaces
* Return list of triggers. Function used by admin page htdoc/admin/triggers.
* List is sorted by trigger filename so by priority to run.
*
- * @param array $forcedirtriggers null=All default directories. This parameter is used by modulebuilder module only.
+ * @param array $forcedirtriggers null=All default directories. This parameter is used by modulebuilder module only.
* @return array Array list of triggers
*/
- function getTriggersList($forcedirtriggers = null)
+ public function getTriggersList($forcedirtriggers = null)
{
global $conf, $langs, $db;
@@ -256,7 +256,7 @@ class Interfaces
$dirtriggers=array_merge(array('/core/triggers/'), $conf->modules_parts['triggers']);
if (is_array($forcedirtriggers))
{
- $dirtriggers=$forcedirtriggers;
+ $dirtriggers=$forcedirtriggers;
}
foreach($dirtriggers as $reldir)
@@ -276,9 +276,9 @@ class Interfaces
{
if (preg_match('/\.back$/', $file)) continue;
- $part1=$reg[1];
- $part2=$reg[2];
- $part3=$reg[3];
+ $part1=$reg[1];
+ $part2=$reg[2];
+ $part3=$reg[3];
$modName = 'Interface'.ucfirst($reg[3]);
//print "file=$file"; print "modName=$modName"; exit;
@@ -319,8 +319,8 @@ class Interfaces
if (! class_exists($modName))
{
- print 'Error: A trigger file was found but its class "'.$modName.'" was not found.'." \n";
- continue;
+ print 'Error: A trigger file was found but its class "'.$modName.'" was not found.'." \n";
+ continue;
}
$objMod = new $modName($db);
@@ -342,7 +342,7 @@ class Interfaces
$triggers[$j]['module']=strtolower($module);
}
- // We set info of modules
+ // We set info of modules
$triggers[$j]['picto'] = $objMod->picto?img_object('', $objMod->picto):img_object('', 'generic');
$triggers[$j]['file'] = $files[$key];
$triggers[$j]['fullpath'] = $fullpath[$key];
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 1e23d2a071c..c00f4003d5d 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -42,78 +42,78 @@ class Ldap
/**
* Tableau des serveurs (IP addresses ou nom d'hotes)
*/
- var $server=array();
+ public $server=array();
/**
* Base DN (e.g. "dc=foo,dc=com")
*/
- var $dn;
+ public $dn;
/**
* type de serveur, actuellement OpenLdap et Active Directory
*/
- var $serverType;
+ public $serverType;
/**
* Version du protocole ldap
*/
- var $domain;
+ public $domain;
/**
* User administrateur Ldap
* Active Directory ne supporte pas les connexions anonymes
*/
- var $searchUser;
+ public $searchUser;
/**
* Mot de passe de l'administrateur
* Active Directory ne supporte pas les connexions anonymes
*/
- var $searchPassword;
+ public $searchPassword;
/**
* DN des utilisateurs
*/
- var $people;
+ public $people;
/**
* DN des groupes
*/
- var $groups;
+ public $groups;
/**
* Code erreur retourne par le serveur Ldap
*/
- var $ldapErrorCode;
+ public $ldapErrorCode;
/**
* Message texte de l'erreur
*/
- var $ldapErrorText;
+ public $ldapErrorText;
//Fetch user
- var $name;
- var $firstname;
- var $login;
- var $phone;
- var $skype;
- var $fax;
- var $mail;
- var $mobile;
+ public $name;
+ public $firstname;
+ public $login;
+ public $phone;
+ public $skype;
+ public $fax;
+ public $mail;
+ public $mobile;
- var $uacf;
- var $pwdlastset;
+ public $uacf;
+ public $pwdlastset;
- var $ldapcharset='UTF-8'; // LDAP should be UTF-8 encoded
+ public $ldapcharset='UTF-8'; // LDAP should be UTF-8 encoded
/**
* The internal LDAP connection handle
*/
- var $connection;
+ public $connection;
/**
* Result of any connections etc.
*/
- var $result;
+ public $result;
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $conf;
@@ -149,7 +149,7 @@ class Ldap
// Connection handling methods -------------------------------------------
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Connect and bind
* Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword
@@ -157,7 +157,7 @@ class Ldap
*
* @return int <0 if KO, 1 if bind anonymous, 2 if bind auth
*/
- function connect_bind()
+ public function connect_bind()
{
// phpcs:enable
global $langs, $conf;
@@ -290,7 +290,7 @@ class Ldap
*
* @return boolean true or false
*/
- function close()
+ public function close()
{
if ($this->connection && ! @ldap_close($this->connection))
{
@@ -308,7 +308,7 @@ class Ldap
*
* @return boolean true or false
*/
- function bind()
+ public function bind()
{
if (! $this->result=@ldap_bind($this->connection))
{
@@ -333,7 +333,7 @@ class Ldap
* @param string $pass Password
* @return boolean true or false
*/
- function bindauth($bindDn, $pass)
+ public function bindauth($bindDn, $pass)
{
if (! $this->result = @ldap_bind($this->connection, $bindDn, $pass))
{
@@ -353,7 +353,7 @@ class Ldap
*
* @return boolean true or false
*/
- function unbind()
+ public function unbind()
{
if (!$this->result=@ldap_unbind($this->connection))
{
@@ -369,7 +369,7 @@ class Ldap
*
* @return string version
*/
- function getVersion()
+ public function getVersion()
{
$version = 0;
$version = @ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
@@ -379,9 +379,9 @@ class Ldap
/**
* Change ldap protocol version to use.
*
- * @return boolean version
+ * @return boolean version
*/
- function setVersion()
+ public function setVersion()
{
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
$ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
@@ -391,9 +391,9 @@ class Ldap
/**
* changement du referrals.
*
- * @return boolean referrals
+ * @return boolean referrals
*/
- function setReferrals()
+ public function setReferrals()
{
// LDAP_OPT_REFERRALS est une constante qui vaut ?
$ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
@@ -410,7 +410,7 @@ class Ldap
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
- function add($dn, $info, $user)
+ public function add($dn, $info, $user)
{
global $conf;
@@ -464,7 +464,7 @@ class Ldap
* @param User $user Objet user that modify
* @return int <0 if KO, >0 if OK
*/
- function modify($dn, $info, $user)
+ public function modify($dn, $info, $user)
{
global $conf;
@@ -518,7 +518,7 @@ class Ldap
* @param bool $deleteoldrdn If true the old RDN value(s) is removed, else the old RDN value(s) is retained as non-distinguished values of the entry.
* @return int <0 if KO, >0 if OK
*/
- function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
+ public function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
{
global $conf;
@@ -559,7 +559,7 @@ class Ldap
/**
* Modify a LDAP entry (to use if dn != olddn)
- * Ldap object connect and bind must have been done
+ * Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
@@ -569,7 +569,7 @@ class Ldap
* @param string $newparent New parent (ou=xxx,dc=aaa,dc=bbb) (for ldap_rename)
* @return int <0 if KO, >0 if OK
*/
- function update($dn, $info, $user, $olddn, $newrdn = false, $newparent = false)
+ public function update($dn, $info, $user, $olddn, $newrdn = false, $newparent = false)
{
global $conf;
@@ -629,7 +629,7 @@ class Ldap
* @param string $dn DN entry key
* @return int <0 if KO, >0 if OK
*/
- function delete($dn)
+ public function delete($dn)
{
global $conf;
@@ -656,7 +656,7 @@ class Ldap
return -1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build a LDAP message
*
@@ -664,7 +664,7 @@ class Ldap
* @param array $info Attributes array
* @return string Content of file
*/
- function dump_content($dn, $info)
+ public function dump_content($dn, $info)
{
// phpcs:enable
$content='';
@@ -707,7 +707,7 @@ class Ldap
* @param array $info Attributes array
* @return int <0 if KO, >0 if OK
*/
- function dump($dn, $info)
+ public function dump($dn, $info)
{
global $conf;
@@ -741,7 +741,7 @@ class Ldap
* @param int $timeout Timeout in second (default 1s)
* @return boolean true or false
*/
- function serverPing($host, $port = 389, $timeout = 1)
+ public function serverPing($host, $port = 389, $timeout = 1)
{
// Replace ldaps:// by ssl://
if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) {
@@ -771,7 +771,7 @@ class Ldap
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
- function addAttribute($dn, $info, $user)
+ public function addAttribute($dn, $info, $user)
{
global $conf;
@@ -823,7 +823,7 @@ class Ldap
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
- function updateAttribute($dn, $info, $user)
+ public function updateAttribute($dn, $info, $user)
{
global $conf;
@@ -875,7 +875,7 @@ class Ldap
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
- function deleteAttribute($dn, $info, $user)
+ public function deleteAttribute($dn, $info, $user)
{
global $conf;
@@ -925,7 +925,7 @@ class Ldap
* @param string $filter Filter
* @return int|array <0 or false if KO, array if OK
*/
- function getAttribute($dn, $filter)
+ public function getAttribute($dn, $filter)
{
// Check parameters
if (! $this->connection)
@@ -970,7 +970,7 @@ class Ldap
* @param string $attribute Attributes
* @return void
*/
- function getAttributeValues($filterrecord, $attribute)
+ public function getAttributeValues($filterrecord, $attribute)
{
$attributes=array();
$attributes[0] = $attribute;
@@ -1015,7 +1015,7 @@ class Ldap
* @param array $attributeAsArray Array of fields wanted as an array not a string
* @return array Array of [id_record][ldap_field]=value
*/
- function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
+ public function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
{
$fulllist=array();
@@ -1123,7 +1123,7 @@ class Ldap
* @param string $hex Hex value
* @return string Little endian
*/
- function littleEndian($hex)
+ public function littleEndian($hex)
{
for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) {
$result .= substr($hex, $x, 2);
@@ -1139,7 +1139,7 @@ class Ldap
* @param string $ldapUser Login de l'utilisateur
* @return string Sid
*/
- function getObjectSid($ldapUser)
+ public function getObjectSid($ldapUser)
{
$criteria = '('.$this->getUserIdentifier().'='.$ldapUser.')';
$justthese = array("objectsid");
@@ -1198,7 +1198,7 @@ class Ldap
* @param string $binsid Binary SID
* @return string Textual SID
*/
- function binSIDtoText($binsid)
+ public function binSIDtoText($binsid)
{
$hex_sid=bin2hex($binsid);
$rev = hexdec(substr($hex_sid, 0, 2)); // Get revision-part of SID
@@ -1224,7 +1224,7 @@ class Ldap
* @param string $filter Search filter (ex: (sn=nom_personne) )
* @return array|int Array with answers (key lowercased - value)
*/
- function search($checkDn, $filter)
+ public function search($checkDn, $filter)
{
dol_syslog(get_class($this)."::search checkDn=".$checkDn." filter=".$filter);
@@ -1260,7 +1260,7 @@ class Ldap
* Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
* @return int >0 if OK, <0 if KO
*/
- function fetch($user, $filter)
+ public function fetch($user, $filter)
{
// Perform the search and get the entry handles
@@ -1353,7 +1353,7 @@ class Ldap
*
* @return string Login
*/
- function getUserIdentifier()
+ public function getUserIdentifier()
{
if ($this->serverType == "activedirectory") {
return $this->attr_sambalogin;
@@ -1368,7 +1368,7 @@ class Ldap
* @param string $uacf UACF
* @return void
*/
- function parseUACF($uacf)
+ public function parseUACF($uacf)
{
//All flags array
$flags = array(
@@ -1414,7 +1414,7 @@ class Ldap
* @param string $samtype SamType
* @return string Sam string
*/
- function parseSAT($samtype)
+ public function parseSAT($samtype)
{
$stypes = array(
805306368 => "NORMAL_ACCOUNT",
@@ -1438,14 +1438,14 @@ class Ldap
return($retval);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Convertit le temps ActiveDirectory en Unix timestamp
*
* @param string $value AD time to convert
* @return integer Unix timestamp
*/
- function convert_time($value)
+ public function convert_time($value)
{
// phpcs:enable
$dateLargeInt=$value; // nano secondes depuis 1601 !!!!
@@ -1478,7 +1478,7 @@ class Ldap
* @param string $pagecodeto Page code for result string
* @return string Converted string
*/
- function convFromOutputCharset($str, $pagecodeto = 'UTF-8')
+ public function convFromOutputCharset($str, $pagecodeto = 'UTF-8')
{
global $conf;
if ($pagecodeto == 'ISO-8859-1' && $conf->file->character_set_client == 'UTF-8') $str=utf8_decode($str);
@@ -1493,7 +1493,7 @@ class Ldap
* @param string $keygroup Key of group
* @return int gid number
*/
- function getNextGroupGid($keygroup = 'LDAP_KEY_GROUPS')
+ public function getNextGroupGid($keygroup = 'LDAP_KEY_GROUPS')
{
global $conf;
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index d796891e632..283b296b3e3 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -150,11 +150,11 @@ class Link extends CommonObject
}
/**
- * Update parameters of third party
+ * Update parameters of third party
*
- * @param User $user User executing update
- * @param int $call_trigger 0=no, 1=yes
- * @return int <0 if KO, >=0 if OK
+ * @param User $user User executing update
+ * @param int $call_trigger 0=no, 1=yes
+ * @return int <0 if KO, >=0 if OK
*/
public function update($user = '', $call_trigger = 1)
{
diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php
index 07fab4e74ea..204efbf0ae7 100644
--- a/htdocs/core/class/menu.class.php
+++ b/htdocs/core/class/menu.class.php
@@ -28,14 +28,14 @@
*/
class Menu
{
- var $liste;
+ public $liste;
/**
- * Constructor
+ * Constructor
*/
- function __construct()
+ public function __construct()
{
- $this->liste = array();
+ $this->liste = array();
}
/**
@@ -43,7 +43,7 @@ class Menu
*
* @return void
*/
- function clear()
+ public function clear()
{
$this->liste = array();
}
@@ -65,15 +65,15 @@ class Menu
* @param string $prefix Prefix to title (image or picto)
* @return void
*/
- function add($url, $titre, $level = 0, $enabled = 1, $target = '', $mainmenu = '', $leftmenu = '', $position = 0, $id = '', $idsel = '', $classname = '', $prefix = '')
+ public function add($url, $titre, $level = 0, $enabled = 1, $target = '', $mainmenu = '', $leftmenu = '', $position = 0, $id = '', $idsel = '', $classname = '', $prefix = '')
{
- $this->liste[]=array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu, 'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname, 'prefix'=>$prefix);
+ $this->liste[]=array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu, 'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname, 'prefix'=>$prefix);
}
/**
* Insert a menu entry into this->liste
*
- * @param int $idafter Array key after which inserting new entry
+ * @param int $idafter Array key after which inserting new entry
* @param string $url Url to follow on click
* @param string $titre Label of menu to add
* @param integer $level Level of menu to add
@@ -88,7 +88,7 @@ class Menu
* @param string $prefix Prefix to title (image or picto)
* @return void
*/
- function insert($idafter, $url, $titre, $level = 0, $enabled = 1, $target = '', $mainmenu = '', $leftmenu = '', $position = 0, $id = '', $idsel = '', $classname = '', $prefix = '')
+ public function insert($idafter, $url, $titre, $level = 0, $enabled = 1, $target = '', $mainmenu = '', $leftmenu = '', $position = 0, $id = '', $idsel = '', $classname = '', $prefix = '')
{
$array_start = array_slice($this->liste, 0, ($idafter+1));
$array_new = array(0=>array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu,'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname, 'prefix'=>$prefix));
@@ -96,13 +96,13 @@ class Menu
$this->liste=array_merge($array_start, $array_new, $array_end);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Remove a menu entry from this->liste
*
* @return void
*/
- function remove_last()
+ public function remove_last()
{
// phpcs:enable
if (count($this->liste) > 1) {
@@ -115,7 +115,7 @@ class Menu
*
* @return int Number of visible (gray or not) menu entries
*/
- function getNbOfVisibleMenuEntries()
+ public function getNbOfVisibleMenuEntries()
{
$nb=0;
foreach($this->liste as $val)
diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php
index 16c1f54ee31..d1d7534af23 100644
--- a/htdocs/core/class/menubase.class.php
+++ b/htdocs/core/class/menubase.class.php
@@ -91,7 +91,7 @@ class Menubase
* @param DoliDB $db Database handler
* @param string $menu_handler Menu handler
*/
- function __construct($db, $menu_handler = '')
+ public function __construct($db, $menu_handler = '')
{
$this->db = $db;
$this->menu_handler = $menu_handler;
@@ -105,7 +105,7 @@ class Menubase
* @param User $user User that create
* @return int <0 if KO, Id of record if OK
*/
- function create($user = null)
+ public function create($user = null)
{
global $conf, $langs;
@@ -245,7 +245,7 @@ class Menubase
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
@@ -310,7 +310,7 @@ class Menubase
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
- function fetch($id, $user = null)
+ public function fetch($id, $user = null)
{
global $langs;
@@ -384,7 +384,7 @@ class Menubase
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
- function delete($user)
+ public function delete($user)
{
global $conf, $langs;
@@ -410,7 +410,7 @@ class Menubase
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -443,7 +443,7 @@ class Menubase
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Return array with menu entries for top menu
*/
- function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
+ public function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{
global $langs, $user, $conf; // To export to dol_eval function
global $mainmenu,$leftmenu; // To export to dol_eval function
@@ -472,7 +472,7 @@ class Menubase
* @param array $tabMenu Array with menu entries already loaded
* @return Menu Menu array for particular mainmenu value or full tabArray
*/
- function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
+ public function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{
global $langs, $user, $conf; // To export to dol_eval function
global $mainmenu,$leftmenu; // To export to dol_eval function
@@ -480,16 +480,16 @@ class Menubase
$mainmenu=$mymainmenu; // To export to dol_eval function
$leftmenu=$myleftmenu; // To export to dol_eval function
- // Detect what is top mainmenu id
+ // Detect what is top mainmenu id
$menutopid='';
foreach($tabMenu as $key => $val)
{
- // Define menutopid of mainmenu
- if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
- {
- $menutopid=$val['rowid'];
- break;
- }
+ // Define menutopid of mainmenu
+ if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
+ {
+ $menutopid=$val['rowid'];
+ break;
+ }
}
// We initialize newmenu with first already found menu entries
@@ -561,7 +561,7 @@ class Menubase
* @param array $tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
* @return int >0 if OK, <0 if KO
*/
- function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
+ public function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{
global $langs, $user, $conf; // To export to dol_eval function
global $mainmenu, $leftmenu; // To export to dol_eval function
@@ -577,10 +577,10 @@ class Menubase
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
$sql.= " ORDER BY m.position, m.rowid";
- //print $sql;
+ //print $sql;
- //$tmp1=microtime(true);
- //print '>>> 1 0 ';
+ //$tmp1=microtime(true);
+ //print '>>> 1 0 ';
dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
@@ -647,8 +647,8 @@ class Menubase
$title = $langs->trans($menu['titre']);
}
}
- //$tmp4=microtime(true);
- //print '>>> 3 '.($tmp4 - $tmp3).' ';
+ //$tmp4=microtime(true);
+ //print '>>> 3 '.($tmp4 - $tmp3).' ';
// We complete tabMenu
$tabMenu[$b]['rowid'] = $menu['rowid'];
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 772b3db29e3..a599137109d 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -90,7 +90,7 @@ class Notify
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -105,7 +105,7 @@ class Notify
* @param Object $object Object the notification is about
* @return string Message
*/
- function confirmMessage($action, $socid, $object)
+ public function confirmMessage($action, $socid, $object)
{
global $langs;
$langs->load("mails");
@@ -146,7 +146,7 @@ class Notify
* @param array $scope Scope where to search
* @return array|int <0 if KO, array of notifications to send if OK
*/
- function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global'))
+ public function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global'))
{
global $conf, $user;
@@ -309,7 +309,7 @@ class Notify
* @param array $mimefilename_list List of attached file name in message
* @return int <0 if KO, or number of changes if OK
*/
- function send($notifcode, $object, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
+ public function send($notifcode, $object, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
{
global $user,$conf,$langs,$mysoc;
global $hookmanager;
@@ -530,7 +530,7 @@ class Notify
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
}
- $mailfile = new CMailFile(
+ $mailfile = new CMailFile(
$subject,
$sendto,
$replyto,
@@ -542,7 +542,7 @@ class Notify
'',
0,
-1
- );
+ );
if ($mailfile->sendfile())
{
@@ -758,7 +758,7 @@ class Notify
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
}
- $mailfile = new CMailFile(
+ $mailfile = new CMailFile(
$subject,
$sendto,
$replyto,
diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php
index 32838f0deb2..2612aa5057b 100644
--- a/htdocs/core/class/openid.class.php
+++ b/htdocs/core/class/openid.class.php
@@ -26,18 +26,18 @@
*/
class SimpleOpenID
{
- var $openid_url_identity;
- var $URLs = array();
- var $error = array();
- var $fields = array(
- 'required' => array(),
- 'optional' => array(),
+ public $openid_url_identity;
+ public $URLs = array();
+ public $error = array();
+ public $fields = array(
+ 'required' => array(),
+ 'optional' => array(),
);
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
if (!function_exists('curl_exec'))
{
@@ -45,66 +45,66 @@ class SimpleOpenID
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetOpenIDServer
*
* @param string $a Server
* @return void
*/
- function SetOpenIDServer($a)
+ public function SetOpenIDServer($a)
{
// phpcs:enable
$this->URLs['openid_server'] = $a;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetOpenIDServer
*
* @param string $a Server
* @return void
*/
- function SetTrustRoot($a)
+ public function SetTrustRoot($a)
{
// phpcs:enable
$this->URLs['trust_root'] = $a;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetOpenIDServer
*
* @param string $a Server
* @return void
*/
- function SetCancelURL($a)
+ public function SetCancelURL($a)
{
// phpcs:enable
$this->URLs['cancel'] = $a;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetApprovedURL
*
* @param string $a Server
* @return void
*/
- function SetApprovedURL($a)
+ public function SetApprovedURL($a)
{
// phpcs:enable
$this->URLs['approved'] = $a;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetRequiredFields
*
* @param string $a Server
* @return void
*/
- function SetRequiredFields($a)
+ public function SetRequiredFields($a)
{
// phpcs:enable
if (is_array($a)) {
@@ -114,14 +114,14 @@ class SimpleOpenID
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetOptionalFields
*
* @param string $a Server
* @return void
*/
- function SetOptionalFields($a)
+ public function SetOptionalFields($a)
{
// phpcs:enable
if (is_array($a)) {
@@ -131,14 +131,14 @@ class SimpleOpenID
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetIdentity
*
* @param string $a Server
* @return void
*/
- function SetIdentity($a)
+ public function SetIdentity($a)
{
// phpcs:enable
// Set Identity URL
@@ -162,33 +162,33 @@ class SimpleOpenID
$this->openid_url_identity = $a;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* GetIdentity
*
* @return string
*/
- function GetIdentity()
+ public function GetIdentity()
{
// phpcs:enable
// Get Identity
return $this->openid_url_identity;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* SetOpenIDServer
*
* @return void
*/
- function GetError()
+ public function GetError()
{
// phpcs:enable
$e = $this->error;
return array('code'=>$e[0],'description'=>$e[1]);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* ErrorStore
*
@@ -196,7 +196,7 @@ class SimpleOpenID
* @param string $desc Description
* @return void
*/
- function ErrorStore($code, $desc = null)
+ public function ErrorStore($code, $desc = null)
{
// phpcs:enable
$errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.';
@@ -206,13 +206,13 @@ class SimpleOpenID
$this->error = array($code,$desc);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* IsError
*
* @return boolean
*/
- function IsError()
+ public function IsError()
{
// phpcs:enable
if (count($this->error) > 0)
@@ -231,7 +231,7 @@ class SimpleOpenID
* @param string $response Server
* @return void
*/
- function splitResponse($response)
+ public function splitResponse($response)
{
$r = array();
$response = explode("\n", $response);
@@ -245,14 +245,14 @@ class SimpleOpenID
return $r;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* OpenID_Standarize
*
* @param string $openid_identity Server
* @return string
*/
- function OpenID_Standarize($openid_identity = null)
+ public function OpenID_Standarize($openid_identity = null)
{
// phpcs:enable
if ($openid_identity === null)
@@ -279,7 +279,7 @@ class SimpleOpenID
* @param array $arr An array
* @return false|string false if KO, string of url if OK
*/
- function array2url($arr)
+ public function array2url($arr)
{
// converts associated array to URL Query String
if (!is_array($arr)){
@@ -292,7 +292,7 @@ class SimpleOpenID
return $query;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* FSOCK_Request
*
@@ -301,7 +301,7 @@ class SimpleOpenID
* @param string $params Params
* @return boolean|unknown
*/
- function FSOCK_Request($url, $method = "GET", $params = "")
+ public function FSOCK_Request($url, $method = "GET", $params = "")
{
// phpcs:enable
$fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds
@@ -326,7 +326,7 @@ class SimpleOpenID
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* CURL_Request
*
@@ -335,7 +335,7 @@ class SimpleOpenID
* @param string $params Params
* @return string
*/
- function CURL_Request($url, $method = "GET", $params = "")
+ public function CURL_Request($url, $method = "GET", $params = "")
{
// phpcs:enable
// Remember, SSL MUST BE SUPPORTED
@@ -359,14 +359,14 @@ class SimpleOpenID
return $response;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* HTML2OpenIDServer
*
* @param string $content Content
* @return array Array of servers
*/
- function HTML2OpenIDServer($content)
+ public function HTML2OpenIDServer($content)
{
// phpcs:enable
$get = array();
@@ -387,20 +387,20 @@ class SimpleOpenID
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get openid server
*
* @param string $url Url to found endpoint
* @return string Endpoint
*/
- function GetOpenIDServer($url = '')
+ public function GetOpenIDServer($url = '')
{
// phpcs:enable
global $conf;
- include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
- if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
+ if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
$response = getURLContent($url);
@@ -417,13 +417,13 @@ class SimpleOpenID
return $servers[0];
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* GetRedirectURL
*
* @return string
*/
- function GetRedirectURL()
+ public function GetRedirectURL()
{
// phpcs:enable
$params = array();
@@ -443,13 +443,13 @@ class SimpleOpenID
return $this->URLs['openid_server'] . "?". $this->array2url($params);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Redirect
*
* @return void
*/
- function Redirect()
+ public function Redirect()
{
// phpcs:enable
$redirect_to = $this->GetRedirectURL();
@@ -465,19 +465,19 @@ class SimpleOpenID
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* ValidateWithServer
*
* @return boolean
*/
- function ValidateWithServer()
+ public function ValidateWithServer()
{
// phpcs:enable
$params = array(
- 'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
- 'openid.signed' => urlencode($_GET['openid_signed']),
- 'openid.sig' => urlencode($_GET['openid_sig'])
+ 'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
+ 'openid.signed' => urlencode($_GET['openid_signed']),
+ 'openid.sig' => urlencode($_GET['openid_sig'])
);
// Send only required parameters to confirm validity
$arr_signed = explode(",", str_replace('sreg.', 'sreg_', $_GET['openid_signed']));
@@ -518,36 +518,36 @@ class SimpleOpenID
* @param string $url Url of endpoint to request
* @return string First endpoint OpenID server found. False if it failed to found.
*/
- function sendDiscoveryRequestToGetXRDS($url = '')
+ public function sendDiscoveryRequestToGetXRDS($url = '')
{
- global $conf;
+ global $conf;
- include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
- if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
+ if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
- dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
+ dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
- $addheaders=array('Accept: application/xrds+xml');
+ $addheaders=array('Accept: application/xrds+xml');
$response = getURLContent($url, 'GET', '', 1, $addheaders);
- /* response should like this:
-
-
-
-
- http://specs.openid.net/auth/2.0/server
- http://openid.net/srv/ax/1.0
- ...
- https://www.google.com/accounts/o8/ud
-
-
-
- */
- $content=$response['content'];
+ /* response should like this:
+
+
+
+
+ http://specs.openid.net/auth/2.0/server
+ http://openid.net/srv/ax/1.0
+ ...
+ https://www.google.com/accounts/o8/ud
+
+
+
+ */
+ $content=$response['content'];
$server='';
if (preg_match('/'.preg_quote('', '/').'(.*)'.preg_quote(' ', '/').'/is', $content, $reg))
{
- $server=$reg[1];
+ $server=$reg[1];
}
if (empty($server))
@@ -557,9 +557,9 @@ class SimpleOpenID
}
else
{
- dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
- $this->SetOpenIDServer($server);
- return $server;
- }
+ dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
+ $this->SetOpenIDServer($server);
+ return $server;
+ }
}
}
diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php
index 7683137767b..1dcd7ef64e5 100644
--- a/htdocs/core/class/rssparser.class.php
+++ b/htdocs/core/class/rssparser.class.php
@@ -32,9 +32,9 @@ class RssParser
public $db;
/**
- * @var string Error code (or message)
- */
- public $error='';
+ * @var string Error code (or message)
+ */
+ public $error='';
private $_format='';
private $_urlRSS;
@@ -61,7 +61,7 @@ class RssParser
*/
public function __construct($db)
{
- $this->db = $db;
+ $this->db = $db;
}
/**
@@ -252,28 +252,28 @@ class RssParser
if ($str !== false)
{
- // Convert $str into xml
- if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
- {
- //print 'xx'.LIBXML_NOCDATA;
- libxml_use_internal_errors(false);
- $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
- }
- else
- {
- $xmlparser=xml_parser_create('');
- if (!is_resource($xmlparser)) {
- $this->error="ErrorFailedToCreateParser"; return -1;
- }
+ // Convert $str into xml
+ if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
+ {
+ //print 'xx'.LIBXML_NOCDATA;
+ libxml_use_internal_errors(false);
+ $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
+ }
+ else
+ {
+ $xmlparser=xml_parser_create('');
+ if (!is_resource($xmlparser)) {
+ $this->error="ErrorFailedToCreateParser"; return -1;
+ }
- xml_set_object($xmlparser, $this);
- xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
- xml_set_character_data_handler($xmlparser, 'feed_cdata');
- $status = xml_parse($xmlparser, $str);
- xml_parser_free($xmlparser);
- $rss=$this;
- //var_dump($rss->_format);exit;
- }
+ xml_set_object($xmlparser, $this);
+ xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
+ xml_set_character_data_handler($xmlparser, 'feed_cdata');
+ $status = xml_parse($xmlparser, $str);
+ xml_parser_free($xmlparser);
+ $rss=$this;
+ //var_dump($rss->_format);exit;
+ }
}
// If $rss loaded
@@ -287,16 +287,16 @@ class RssParser
$fp = fopen($newpathofdestfile, 'w');
if ($fp)
{
- fwrite($fp, $str);
- fclose($fp);
- if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
- @chmod($newpathofdestfile, octdec($newmask));
+ fwrite($fp, $str);
+ fclose($fp);
+ if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
+ @chmod($newpathofdestfile, octdec($newmask));
- $this->_lastfetchdate=$nowgmt;
+ $this->_lastfetchdate=$nowgmt;
}
else
{
- print 'Error, failed to open file '.$newpathofdestfile.' for write';
+ print 'Error, failed to open file '.$newpathofdestfile.' for write';
}
}
@@ -435,13 +435,13 @@ class RssParser
// Add record to result array
$this->_rssarray[$i] = array(
- 'link'=>$itemLink,
- 'title'=>$itemTitle,
- 'description'=>$itemDescription,
- 'pubDate'=>$itemPubDate,
- 'category'=>$itemCategory,
- 'id'=>$itemId,
- 'author'=>$itemAuthor);
+ 'link'=>$itemLink,
+ 'title'=>$itemTitle,
+ 'description'=>$itemDescription,
+ 'pubDate'=>$itemPubDate,
+ 'category'=>$itemCategory,
+ 'id'=>$itemId,
+ 'author'=>$itemAuthor);
//var_dump($this->_rssarray);
$i++;
@@ -461,7 +461,7 @@ class RssParser
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Triggered when opened tag is found
*
@@ -470,7 +470,7 @@ class RssParser
* @param array $attrs Attributes of tags
* @return void
*/
- function feed_start_element($p, $element, &$attrs)
+ public function feed_start_element($p, $element, &$attrs)
{
// phpcs:enable
$el = $element = strtolower($element);
@@ -581,7 +581,7 @@ class RssParser
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Triggered when CDATA is found
*
@@ -589,7 +589,7 @@ class RssParser
* @param string $text Tag
* @return void
*/
- function feed_cdata($p, $text)
+ public function feed_cdata($p, $text)
{
// phpcs:enable
if ($this->_format == 'atom' and $this->incontent)
@@ -603,7 +603,7 @@ class RssParser
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Triggered when closed tag is found
*
@@ -611,7 +611,7 @@ class RssParser
* @param string $el Tag
* @return void
*/
- function feed_end_element($p, $el)
+ public function feed_end_element($p, $el)
{
// phpcs:enable
$el = strtolower($el);
@@ -666,7 +666,7 @@ class RssParser
* @param string $str2 Str2
* @return string String cancatenated
*/
- function concat(&$str1, $str2 = "")
+ public function concat(&$str1, $str2 = "")
{
if (!isset($str1) ) {
$str1="";
@@ -674,14 +674,14 @@ class RssParser
$str1 .= $str2;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Enter description here ...
*
* @param string $text Text
* @return void
*/
- function append_content($text)
+ public function append_content($text)
{
// phpcs:enable
if ( $this->initem ) {
@@ -699,7 +699,7 @@ class RssParser
* @param string $text Text
* @return void
*/
- function append($el, $text)
+ public function append($el, $text)
{
if (!$el) {
return;
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 695464f536f..24e7b2acc59 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -45,109 +45,109 @@
*/
class SMTPs
{
- /**
- * Host Name or IP of SMTP Server to use
- */
- var $_smtpsHost = 'localhost';
+ /**
+ * Host Name or IP of SMTP Server to use
+ */
+ private $_smtpsHost = 'localhost';
- /**
- * SMTP Server Port definition. 25 is default value
- * This can be defined via a INI file or via a setter method
- */
- var $_smtpsPort = '25';
+ /**
+ * SMTP Server Port definition. 25 is default value
+ * This can be defined via a INI file or via a setter method
+ */
+ private $_smtpsPort = '25';
- /**
- * Secure SMTP Server access ID
- * This can be defined via a INI file or via a setter method
- */
- var $_smtpsID = null;
+ /**
+ * Secure SMTP Server access ID
+ * This can be defined via a INI file or via a setter method
+ */
+ private $_smtpsID = null;
- /**
- * Secure SMTP Server access Password
- * This can be defined via a INI file or via a setter method
- */
- var $_smtpsPW = null;
+ /**
+ * Secure SMTP Server access Password
+ * This can be defined via a INI file or via a setter method
+ */
+ private $_smtpsPW = null;
- /**
- * Who sent the Message
- * This can be defined via a INI file or via a setter method
- */
- var $_msgFrom = null;
+ /**
+ * Who sent the Message
+ * This can be defined via a INI file or via a setter method
+ */
+ private $_msgFrom = null;
- /**
- * Where are replies and errors to be sent to
- * This can be defined via a INI file or via a setter method
- */
- var $_msgReplyTo = null;
+ /**
+ * Where are replies and errors to be sent to
+ * This can be defined via a INI file or via a setter method
+ */
+ private $_msgReplyTo = null;
- /**
- * Who will the Message be sent to; TO, CC, BCC
- * Multi-diminsional array containg addresses the message will
- * be sent TO, CC or BCC
- */
- var $_msgRecipients = null;
+ /**
+ * Who will the Message be sent to; TO, CC, BCC
+ * Multi-diminsional array containg addresses the message will
+ * be sent TO, CC or BCC
+ */
+ private $_msgRecipients = null;
- /**
- * Message Subject
- */
- var $_msgSubject = null;
+ /**
+ * Message Subject
+ */
+ private $_msgSubject = null;
- /**
- * Message Content
- */
- var $_msgContent = null;
+ /**
+ * Message Content
+ */
+ private $_msgContent = null;
- /**
- * Custom X-Headers
- */
- var $_msgXheader = null;
+ /**
+ * Custom X-Headers
+ */
+ private $_msgXheader = null;
- /**
- * Character set
- * Defaulted to 'iso-8859-1'
- */
- var $_smtpsCharSet = 'iso-8859-1';
+ /**
+ * Character set
+ * Defaulted to 'iso-8859-1'
+ */
+ private $_smtpsCharSet = 'iso-8859-1';
- /**
- * Message Sensitivity
- * Defaults to ZERO - None
- */
- var $_msgSensitivity = 0;
+ /**
+ * Message Sensitivity
+ * Defaults to ZERO - None
+ */
+ private $_msgSensitivity = 0;
- /**
- * Message Sensitivity
- */
- var $_arySensitivity = array ( false,
+ /**
+ * Message Sensitivity
+ */
+ private $_arySensitivity = array ( false,
'Personal',
'Private',
'Company Confidential' );
- /**
- * Message Sensitivity
- * Defaults to 3 - Normal
- */
- var $_msgPriority = 3;
+ /**
+ * Message Sensitivity
+ * Defaults to 3 - Normal
+ */
+ private $_msgPriority = 3;
- /**
- * Message Priority
- */
- var $_aryPriority = array ( 'Bulk',
+ /**
+ * Message Priority
+ */
+ private $_aryPriority = array ( 'Bulk',
'Highest',
'High',
'Normal',
'Low',
'Lowest' );
- /**
- * Content-Transfer-Encoding
- * Defaulted to 0 - 7bit
- */
- var $_smtpsTransEncodeType = 0;
+ /**
+ * Content-Transfer-Encoding
+ * Defaulted to 0 - 7bit
+ */
+ private $_smtpsTransEncodeType = 0;
- /**
- * Content-Transfer-Encoding
- */
- var $_smtpsTransEncodeTypes = array( '7bit', // Simple 7-bit ASCII
+ /**
+ * Content-Transfer-Encoding
+ */
+ private $_smtpsTransEncodeTypes = array( '7bit', // Simple 7-bit ASCII
'8bit', // 8-bit coding with line termination characters
'base64', // 3 octets encoded into 4 sextets with offset
'binary', // Arbitrary binary stream
@@ -155,78 +155,78 @@ class SMTPs
'quoted-printable', // Mostly 7-bit, with 8-bit characters encoded as "=HH"
'uuencode' ); // UUENCODE encoding
- /**
- * Content-Transfer-Encoding
- * Defaulted to '7bit'
- */
- var $_smtpsTransEncode = '7bit';
+ /**
+ * Content-Transfer-Encoding
+ * Defaulted to '7bit'
+ */
+ private $_smtpsTransEncode = '7bit';
- /**
- * Boundary String for MIME seperation
- */
- var $_smtpsBoundary = null;
+ /**
+ * Boundary String for MIME seperation
+ */
+ private $_smtpsBoundary = null;
- /**
- * Related Boundary
- */
- var $_smtpsRelatedBoundary = null;
+ /**
+ * Related Boundary
+ */
+ private $_smtpsRelatedBoundary = null;
- /**
- * Alternative Boundary
- */
- var $_smtpsAlternativeBoundary = null;
+ /**
+ * Alternative Boundary
+ */
+ private $_smtpsAlternativeBoundary = null;
- /**
- * Determines the method inwhich the message are to be sent.
- * - 'sockets' [0] - conect via network to SMTP server - default
- * - 'pipe [1] - use UNIX path to EXE
- * - 'phpmail [2] - use the PHP built-in mail function
- * NOTE: Only 'sockets' is implemented
- */
- var $_transportType = 0;
+ /**
+ * Determines the method inwhich the message are to be sent.
+ * - 'sockets' [0] - conect via network to SMTP server - default
+ * - 'pipe [1] - use UNIX path to EXE
+ * - 'phpmail [2] - use the PHP built-in mail function
+ * NOTE: Only 'sockets' is implemented
+ */
+ private $_transportType = 0;
- /**
- * If '$_transportType' is set to '1', then this variable is used
- * to define the UNIX file system path to the sendmail execuable
- */
- var $_mailPath = '/usr/lib/sendmail';
+ /**
+ * If '$_transportType' is set to '1', then this variable is used
+ * to define the UNIX file system path to the sendmail execuable
+ */
+ private $_mailPath = '/usr/lib/sendmail';
- /**
- * Sets the SMTP server timeout in seconds.
- */
- var $_smtpTimeout = 10;
+ /**
+ * Sets the SMTP server timeout in seconds.
+ */
+ private $_smtpTimeout = 10;
- /**
- * Determines whether to calculate message MD5 checksum.
- */
- var $_smtpMD5 = false;
+ /**
+ * Determines whether to calculate message MD5 checksum.
+ */
+ private $_smtpMD5 = false;
- /**
- * Class error codes and messages
- */
- var $_smtpsErrors = null;
+ /**
+ * Class error codes and messages
+ */
+ private $_smtpsErrors = null;
- /**
- * Defines log level
- * 0 - no logging
- * 1 - connectivity logging
- * 2 - message generation logging
- * 3 - detail logging
- */
- var $_log_level = 0;
+ /**
+ * Defines log level
+ * 0 - no logging
+ * 1 - connectivity logging
+ * 2 - message generation logging
+ * 3 - detail logging
+ */
+ private $_log_level = 0;
- /**
- * Place Class in" debug" mode
- */
- var $_debug = false;
+ /**
+ * Place Class in" debug" mode
+ */
+ private $_debug = false;
- // @CHANGE LDR
- var $log = '';
- var $_errorsTo = '';
- var $_deliveryReceipt = 0;
- var $_trackId = '';
- var $_moreInHeader = '';
+ // @CHANGE LDR
+ private $log = '';
+ private $_errorsTo = '';
+ private $_deliveryReceipt = 0;
+ private $_trackId = '';
+ private $_moreInHeader = '';
/**
@@ -235,20 +235,20 @@ class SMTPs
* @param int $_val Value
* @return void
*/
- function setDeliveryReceipt($_val = 0)
- {
- $this->_deliveryReceipt = $_val;
- }
+ public function setDeliveryReceipt($_val = 0)
+ {
+ $this->_deliveryReceipt = $_val;
+ }
/**
* get delivery receipt
*
* @return int Delivery receipt
*/
- function getDeliveryReceipt()
- {
- return $this->_deliveryReceipt;
- }
+ public function getDeliveryReceipt()
+ {
+ return $this->_deliveryReceipt;
+ }
/**
* Set trackid
@@ -256,10 +256,10 @@ class SMTPs
* @param string $_val Value
* @return void
*/
- function setTrackId($_val = '')
- {
- $this->_trackId = $_val;
- }
+ public function setTrackId($_val = '')
+ {
+ $this->_trackId = $_val;
+ }
/**
* Set moreInHeader
@@ -267,30 +267,30 @@ class SMTPs
* @param string $_val Value
* @return void
*/
- function setMoreInHeader($_val = '')
- {
- $this->_moreinheader = $_val;
- }
+ public function setMoreInHeader($_val = '')
+ {
+ $this->_moreinheader = $_val;
+ }
- /**
+ /**
* get trackid
*
* @return string Track id
*/
- function getTrackId()
- {
- return $this->_trackId;
- }
+ public function getTrackId()
+ {
+ return $this->_trackId;
+ }
- /**
- * get moreInHeader
- *
- * @return string moreInHeader
- */
- function getMoreInHeader()
- {
- return $this->_moreinheader;
- }
+ /**
+ * get moreInHeader
+ *
+ * @return string moreInHeader
+ */
+ public function getMoreInHeader()
+ {
+ return $this->_moreinheader;
+ }
/**
* Set errors to
@@ -298,11 +298,11 @@ class SMTPs
* @param string $_strErrorsTo Errors to
* @return void
*/
- function setErrorsTo($_strErrorsTo)
- {
- if ( $_strErrorsTo )
- $this->_errorsTo = $this->_strip_email($_strErrorsTo);
- }
+ public function setErrorsTo($_strErrorsTo)
+ {
+ if ( $_strErrorsTo )
+ $this->_errorsTo = $this->_strip_email($_strErrorsTo);
+ }
/**
* Get errors to
@@ -310,1524 +310,1524 @@ class SMTPs
* @param boolean $_part Variant
* @return string Errors to
*/
- function getErrorsTo($_part = true)
- {
- $_retValue = '';
+ public function getErrorsTo($_part = true)
+ {
+ $_retValue = '';
- if ( $_part === true )
- $_retValue = $this->_errorsTo;
- else
- $_retValue = $this->_errorsTo[$_part];
+ if ( $_part === true )
+ $_retValue = $this->_errorsTo;
+ else
+ $_retValue = $this->_errorsTo[$_part];
- return $_retValue;
- }
+ return $_retValue;
+ }
- /**
- * Set debug
- *
- * @param boolean $_vDebug Value for debug
- * @return void
- */
- function setDebug($_vDebug = false)
- {
- $this->_debug = $_vDebug;
- }
+ /**
+ * Set debug
+ *
+ * @param boolean $_vDebug Value for debug
+ * @return void
+ */
+ public function setDebug($_vDebug = false)
+ {
+ $this->_debug = $_vDebug;
+ }
- /**
- * build RECIPIENT List, all addresses who will recieve this message
- *
- * @return void
- */
- function buildRCPTlist()
- {
- // Pull TO list
- $_aryToList = $this->getTO();
- }
+ /**
+ * build RECIPIENT List, all addresses who will recieve this message
+ *
+ * @return void
+ */
+ public function buildRCPTlist()
+ {
+ // Pull TO list
+ $_aryToList = $this->getTO();
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Attempt a connection to mail server
- *
- * @return mixed $_retVal Boolean indicating success or failure on connection
- */
- function _server_connect()
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Attempt a connection to mail server
+ *
+ * @return mixed $_retVal Boolean indicating success or failure on connection
+ */
+ private function _server_connect()
+ {
// phpcs:enable
- // Default return value
- $_retVal = true;
+ // Default return value
+ $_retVal = true;
- // We have to make sure the HOST given is valid
- // This is done here because '@fsockopen' will not give me this
- // information if it failes to connect because it can't find the HOST
- $host=$this->getHost();
- $usetls = preg_match('@tls://@i', $host);
+ // We have to make sure the HOST given is valid
+ // This is done here because '@fsockopen' will not give me this
+ // information if it failes to connect because it can't find the HOST
+ $host=$this->getHost();
+ $usetls = preg_match('@tls://@i', $host);
- $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
- $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
- $host=preg_replace('@tls://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
+ $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tls://@i', '', $host); // Remove prefix
- // @CHANGE LDR
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ // @CHANGE LDR
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- if ( (! is_ip($host)) && ((gethostbyname($host)) == $host))
- {
- $this->_setErr(99, $host . ' is either offline or is an invalid host name.');
- $_retVal = false;
- }
- else
- {
- //See if we can connect to the SMTP server
+ if ( (! is_ip($host)) && ((gethostbyname($host)) == $host))
+ {
+ $this->_setErr(99, $host . ' is either offline or is an invalid host name.');
+ $_retVal = false;
+ }
+ else
+ {
+ //See if we can connect to the SMTP server
if ($this->socket = @fsockopen(
- preg_replace('@tls://@i', '', $this->getHost()), // Host to 'hit', IP or domain
- $this->getPort(), // which Port number to use
- $this->errno, // actual system level error
- $this->errstr, // and any text that goes with the error
- $this->_smtpTimeout // timeout for reading/writing data over the socket
- )) {
- // Fix from PHP SMTP class by 'Chris Ryan'
- // Sometimes the SMTP server takes a little longer to respond
- // so we will give it a longer timeout for the first read
- // Windows still does not have support for this timeout function
- if (function_exists('stream_set_timeout')) stream_set_timeout($this->socket, $this->_smtpTimeout, 0);
+ preg_replace('@tls://@i', '', $this->getHost()), // Host to 'hit', IP or domain
+ $this->getPort(), // which Port number to use
+ $this->errno, // actual system level error
+ $this->errstr, // and any text that goes with the error
+ $this->_smtpTimeout // timeout for reading/writing data over the socket
+ )) {
+ // Fix from PHP SMTP class by 'Chris Ryan'
+ // Sometimes the SMTP server takes a little longer to respond
+ // so we will give it a longer timeout for the first read
+ // Windows still does not have support for this timeout function
+ if (function_exists('stream_set_timeout')) stream_set_timeout($this->socket, $this->_smtpTimeout, 0);
- // Check response from Server
- if ( $_retVal = $this->server_parse($this->socket, "220") )
- $_retVal = $this->socket;
- }
- // This connection attempt failed.
- else
- {
- // @CHANGE LDR
- if (empty($this->errstr)) $this->errstr='Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort();
- $this->_setErr($this->errno, $this->errstr);
- $_retVal = false;
- }
- }
+ // Check response from Server
+ if ( $_retVal = $this->server_parse($this->socket, "220") )
+ $_retVal = $this->socket;
+ }
+ // This connection attempt failed.
+ else
+ {
+ // @CHANGE LDR
+ if (empty($this->errstr)) $this->errstr='Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort();
+ $this->_setErr($this->errno, $this->errstr);
+ $_retVal = false;
+ }
+ }
- return $_retVal;
- }
+ return $_retVal;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Attempt mail server authentication for a secure connection
- *
- * @return boolean|null $_retVal Boolean indicating success or failure of authentication
- */
- function _server_authenticate()
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Attempt mail server authentication for a secure connection
+ *
+ * @return boolean|null $_retVal Boolean indicating success or failure of authentication
+ */
+ private function _server_authenticate()
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- // Send the RFC2554 specified EHLO.
- // This improvment as provided by 'SirSir' to
- // accomodate both SMTP AND ESMTP capable servers
- $host=$this->getHost();
- $usetls = preg_match('@tls://@i', $host);
+ // Send the RFC2554 specified EHLO.
+ // This improvment as provided by 'SirSir' to
+ // accomodate both SMTP AND ESMTP capable servers
+ $host=$this->getHost();
+ $usetls = preg_match('@tls://@i', $host);
- $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
- $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
- $host=preg_replace('@tls://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
+ $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tls://@i', '', $host); // Remove prefix
- if ($usetls) $host='tls://'.$host;
+ if ($usetls) $host='tls://'.$host;
- $hosth = $host;
+ $hosth = $host;
- if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
- {
- // If the from to is 'aaa ', we will keep 'ccc.com'
- $hosth = $this->getFrom('addr');
- $hosth = preg_replace('/^.*', '', $hosth);
- $hosth = preg_replace('/>.*$/', '', $hosth);
- $hosth = preg_replace('/.*@/', '', $hosth);
- }
+ if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
+ {
+ // If the from to is 'aaa ', we will keep 'ccc.com'
+ $hosth = $this->getFrom('addr');
+ $hosth = preg_replace('/^.*', '', $hosth);
+ $hosth = preg_replace('/>.*$/', '', $hosth);
+ $hosth = preg_replace('/.*@/', '', $hosth);
+ }
- if ( $_retVal = $this->socket_send_str('EHLO ' . $hosth, '250') )
- {
- if ($usetls)
- {
- /*
- The following dialog illustrates how a client and server can start a TLS STARTTLS session
- S:
- C:
- S: 220 mail.imc.org SMTP service ready
- C: EHLO mail.ietf.org
- S: 250-mail.imc.org offers a warm hug of welcome
- S: 250 STARTTLS
- C: STARTTLS
- S: 220 Go ahead
- C:
- C & S:
- C & S:
+ if ( $_retVal = $this->socket_send_str('EHLO ' . $hosth, '250') )
+ {
+ if ($usetls)
+ {
+ /*
+ The following dialog illustrates how a client and server can start a TLS STARTTLS session
+ S:
+ C:
+ S: 220 mail.imc.org SMTP service ready
+ C: EHLO mail.ietf.org
+ S: 250-mail.imc.org offers a warm hug of welcome
+ S: 250 STARTTLS
+ C: STARTTLS
+ S: 220 Go ahead
+ C:
+ C & S:
+ C & S:
// Second pass EHLO
C: EHLO client-domain.com
S: 250-server-domain.com
S: 250 AUTH LOGIN
- C: socket_send_str('STARTTLS', 220))
- {
- $this->_setErr(131, 'STARTTLS connection is not supported.');
- return $_retVal;
- }
+ C: socket_send_str('STARTTLS', 220))
+ {
+ $this->_setErr(131, 'STARTTLS connection is not supported.');
+ return $_retVal;
+ }
- // Before 5.6.7:
- // STREAM_CRYPTO_METHOD_SSLv23_CLIENT = STREAM_CRYPTO_METHOD_SSLv2_CLIENT|STREAM_CRYPTO_METHOD_SSLv3_CLIENT
- // STREAM_CRYPTO_METHOD_TLS_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
- // PHP >= 5.6.7:
- // STREAM_CRYPTO_METHOD_SSLv23_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
- // STREAM_CRYPTO_METHOD_TLS_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
+ // Before 5.6.7:
+ // STREAM_CRYPTO_METHOD_SSLv23_CLIENT = STREAM_CRYPTO_METHOD_SSLv2_CLIENT|STREAM_CRYPTO_METHOD_SSLv3_CLIENT
+ // STREAM_CRYPTO_METHOD_TLS_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
+ // PHP >= 5.6.7:
+ // STREAM_CRYPTO_METHOD_SSLv23_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
+ // STREAM_CRYPTO_METHOD_TLS_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
- $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
- if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
- $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
- $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
- }
+ $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
+ if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
+ $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
+ $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
+ }
- if (!stream_socket_enable_crypto($this->socket, true, $crypto_method))
- {
- $this->_setErr(132, 'STARTTLS connection failed.');
- return $_retVal;
- }
- // Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
- // the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
- if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250'))
- {
- $this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
- return $_retVal;
- }
- }
- // Send Authentication to Server
- // Check for errors along the way
- $this->socket_send_str('AUTH LOGIN', '334');
+ if (!stream_socket_enable_crypto($this->socket, true, $crypto_method))
+ {
+ $this->_setErr(132, 'STARTTLS connection failed.');
+ return $_retVal;
+ }
+ // Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
+ // the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
+ if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250'))
+ {
+ $this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
+ return $_retVal;
+ }
+ }
+ // Send Authentication to Server
+ // Check for errors along the way
+ $this->socket_send_str('AUTH LOGIN', '334');
- // User name will not return any error, server will take anything we give it.
- $this->socket_send_str(base64_encode($this->_smtpsID), '334');
+ // User name will not return any error, server will take anything we give it.
+ $this->socket_send_str(base64_encode($this->_smtpsID), '334');
- // The error here just means the ID/password combo doesn't work.
- // There is not a method to determine which is the problem, ID or password
- if ( ! $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235') )
- $this->_setErr(130, 'Invalid Authentication Credentials.');
- }
- else
- {
- $this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
- }
+ // The error here just means the ID/password combo doesn't work.
+ // There is not a method to determine which is the problem, ID or password
+ if ( ! $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235') )
+ $this->_setErr(130, 'Invalid Authentication Credentials.');
+ }
+ else
+ {
+ $this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
+ }
- return $_retVal;
- }
+ return $_retVal;
+ }
- /**
- * Now send the message
- *
- * @param boolean $_bolTestMsg whether to run this method in 'Test' mode.
- * @param boolean $_bolDebug whether to log all communication between this Class and the Mail Server.
- * @return boolean|null void
- * $_strMsg If this is run in 'Test' mode, the actual message structure will be returned
- */
- function sendMsg($_bolTestMsg = false, $_bolDebug = false)
- {
- global $conf;
+ /**
+ * Now send the message
+ *
+ * @param boolean $_bolTestMsg whether to run this method in 'Test' mode.
+ * @param boolean $_bolDebug whether to log all communication between this Class and the Mail Server.
+ * @return boolean|null void
+ * $_strMsg If this is run in 'Test' mode, the actual message structure will be returned
+ */
+ public function sendMsg($_bolTestMsg = false, $_bolDebug = false)
+ {
+ global $conf;
- /**
- * Default return value
- */
- $_retVal = false;
+ /**
+ * Default return value
+ */
+ $_retVal = false;
- // Connect to Server
- if ( $this->socket = $this->_server_connect() )
- {
- // If a User ID *and* a password is given, assume Authentication is desired
- if( !empty($this->_smtpsID) && !empty($this->_smtpsPW) )
- {
- // Send the RFC2554 specified EHLO.
- $_retVal = $this->_server_authenticate();
- }
+ // Connect to Server
+ if ( $this->socket = $this->_server_connect() )
+ {
+ // If a User ID *and* a password is given, assume Authentication is desired
+ if( !empty($this->_smtpsID) && !empty($this->_smtpsPW) )
+ {
+ // Send the RFC2554 specified EHLO.
+ $_retVal = $this->_server_authenticate();
+ }
- // This is a "normal" SMTP Server "handshack"
- else
- {
- // Send the RFC821 specified HELO.
- $host=$this->getHost();
- $usetls = preg_match('@tls://@i', $host);
+ // This is a "normal" SMTP Server "handshack"
+ else
+ {
+ // Send the RFC821 specified HELO.
+ $host=$this->getHost();
+ $usetls = preg_match('@tls://@i', $host);
- $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
- $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
- $host=preg_replace('@tls://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
+ $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tls://@i', '', $host); // Remove prefix
- $hosth = $host;
+ $hosth = $host;
- if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
- {
- // If the from to is 'aaa ', we will keep 'ccc.com'
- $hosth = $this->getFrom('addr');
- $hosth = preg_replace('/^.*', '', $hosth);
- $hosth = preg_replace('/>.*$/', '', $hosth);
- $hosth = preg_replace('/.*@/', '', $hosth);
- }
+ if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
+ {
+ // If the from to is 'aaa ', we will keep 'ccc.com'
+ $hosth = $this->getFrom('addr');
+ $hosth = preg_replace('/^.*', '', $hosth);
+ $hosth = preg_replace('/>.*$/', '', $hosth);
+ $hosth = preg_replace('/.*@/', '', $hosth);
+ }
- $_retVal = $this->socket_send_str('HELO ' . $hosth, '250');
- }
+ $_retVal = $this->socket_send_str('HELO ' . $hosth, '250');
+ }
- // Well, did we get to the server?
- if ( $_retVal )
- {
- // From this point onward most server response codes should be 250
- // Specify who the mail is from....
- // This has to be the raw email address, strip the "name" off
- $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
+ // Well, did we get to the server?
+ if ( $_retVal )
+ {
+ // From this point onward most server response codes should be 250
+ // Specify who the mail is from....
+ // This has to be the raw email address, strip the "name" off
+ $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
- // 'RCPT TO:' must be given a single address, so this has to loop
- // through the list of addresses, regardless of TO, CC or BCC
- // and send it out "single file"
- foreach ($this->get_RCPT_list() as $_address)
- {
- /* Note:
- * BCC email addresses must be listed in the RCPT TO command list,
+ // 'RCPT TO:' must be given a single address, so this has to loop
+ // through the list of addresses, regardless of TO, CC or BCC
+ // and send it out "single file"
+ foreach ($this->get_RCPT_list() as $_address)
+ {
+ /* Note:
+ * BCC email addresses must be listed in the RCPT TO command list,
* but the BCC header should not be printed under the DATA command.
- * http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server
- */
+ * http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server
+ */
- /*
- * TODO
- * After each 'RCPT TO:' is sent, we need to make sure it was kosher,
- * if not, the whole message will fail
- * If any email address fails, we will need to RESET the connection,
- * mark the last address as "bad" and start the address loop over again.
- * If any address fails, the entire message fails.
- */
- $this->socket_send_str('RCPT TO: <' . $_address . '>', '250');
- }
+ /*
+ * TODO
+ * After each 'RCPT TO:' is sent, we need to make sure it was kosher,
+ * if not, the whole message will fail
+ * If any email address fails, we will need to RESET the connection,
+ * mark the last address as "bad" and start the address loop over again.
+ * If any address fails, the entire message fails.
+ */
+ $this->socket_send_str('RCPT TO: <' . $_address . '>', '250');
+ }
- // Tell the server we are ready to start sending data
- // with any custom headers...
- // This is the last response code we look for until the end of the message.
- $this->socket_send_str('DATA', '354');
+ // Tell the server we are ready to start sending data
+ // with any custom headers...
+ // This is the last response code we look for until the end of the message.
+ $this->socket_send_str('DATA', '354');
- // Now we are ready for the message...
- // Ok, all the ingredients are mixed in let's cook this puppy...
- $this->socket_send_str($this->getHeader().$this->getBodyContent() . "\r\n" . '.', '250');
+ // Now we are ready for the message...
+ // Ok, all the ingredients are mixed in let's cook this puppy...
+ $this->socket_send_str($this->getHeader().$this->getBodyContent() . "\r\n" . '.', '250');
- // Now tell the server we are done and close the socket...
- fputs($this->socket, 'QUIT');
- fclose($this->socket);
- }
- }
+ // Now tell the server we are done and close the socket...
+ fputs($this->socket, 'QUIT');
+ fclose($this->socket);
+ }
+ }
- return $_retVal;
- }
+ return $_retVal;
+ }
- // =============================================================
- // ** Setter & Getter methods
+ // =============================================================
+ // ** Setter & Getter methods
- // ** Basic System configuration
+ // ** Basic System configuration
- /**
- * setConfig() is used to populate select class properties from either
- * a user defined INI file or the systems 'php.ini' file
- *
- * If a user defined INI is to be used, the files complete path is passed
- * as the method single parameter. The INI can define any class and/or
- * user properties. Only properties defined within this file will be setter
- * and/or orverwritten
- *
- * If the systems 'php.ini' file is to be used, the method is called without
- * parameters. In this case, only HOST, PORT and FROM properties will be set
- * as they are the only properties that are defined within the 'php.ini'.
- *
- * If secure SMTP is to be used, the user ID and Password can be defined with
- * the user INI file, but the properties are not defined with the systems
- * 'php.ini'file, they must be defined via their setter methods
- *
- * This method can be called twice, if desired. Once without a parameter to
- * load the properties as defined within the systems 'php.ini' file, and a
- * second time, with a path to a user INI file for other properties to be
- * defined.
- *
- * @param mixed $_strConfigPath path to config file or VOID
- * @return boolean
- */
- function setConfig($_strConfigPath = null)
- {
- /**
- * Returns constructed SELECT Object string or boolean upon failure
- * Default value is set at true
- */
- $_retVal = true;
+ /**
+ * setConfig() is used to populate select class properties from either
+ * a user defined INI file or the systems 'php.ini' file
+ *
+ * If a user defined INI is to be used, the files complete path is passed
+ * as the method single parameter. The INI can define any class and/or
+ * user properties. Only properties defined within this file will be setter
+ * and/or orverwritten
+ *
+ * If the systems 'php.ini' file is to be used, the method is called without
+ * parameters. In this case, only HOST, PORT and FROM properties will be set
+ * as they are the only properties that are defined within the 'php.ini'.
+ *
+ * If secure SMTP is to be used, the user ID and Password can be defined with
+ * the user INI file, but the properties are not defined with the systems
+ * 'php.ini'file, they must be defined via their setter methods
+ *
+ * This method can be called twice, if desired. Once without a parameter to
+ * load the properties as defined within the systems 'php.ini' file, and a
+ * second time, with a path to a user INI file for other properties to be
+ * defined.
+ *
+ * @param mixed $_strConfigPath path to config file or VOID
+ * @return boolean
+ */
+ public function setConfig($_strConfigPath = null)
+ {
+ /**
+ * Returns constructed SELECT Object string or boolean upon failure
+ * Default value is set at true
+ */
+ $_retVal = true;
- // if we have a path...
- if ( ! empty($_strConfigPath) )
- {
- // If the path is not valid, this will NOT generate an error,
- // it will simply return false.
- if ( ! @include $_strConfigPath)
- {
- $this->_setErr(110, '"' . $_strConfigPath . '" is not a valid path.');
- $_retVal = false;
- }
- }
+ // if we have a path...
+ if ( ! empty($_strConfigPath) )
+ {
+ // If the path is not valid, this will NOT generate an error,
+ // it will simply return false.
+ if ( ! @include $_strConfigPath)
+ {
+ $this->_setErr(110, '"' . $_strConfigPath . '" is not a valid path.');
+ $_retVal = false;
+ }
+ }
- // Read the Systems php.ini file
- else
- {
- // Set these properties ONLY if they are set in the php.ini file.
- // Otherwise the default values will be used.
- if ( $_host = ini_get('SMTPs') )
- $this->setHost($_host);
+ // Read the Systems php.ini file
+ else
+ {
+ // Set these properties ONLY if they are set in the php.ini file.
+ // Otherwise the default values will be used.
+ if ( $_host = ini_get('SMTPs') )
+ $this->setHost($_host);
- if ( $_port = ini_get('smtp_port') )
- $this->setPort($_port);
+ if ( $_port = ini_get('smtp_port') )
+ $this->setPort($_port);
- if ( $_from = ini_get('sendmail_from') )
- $this->setFrom($_from);
- }
+ if ( $_from = ini_get('sendmail_from') )
+ $this->setFrom($_from);
+ }
- // Send back what we have
- return $_retVal;
- }
+ // Send back what we have
+ return $_retVal;
+ }
- /**
- * Determines the method inwhich the messages are to be sent.
- * - 'sockets' [0] - conect via network to SMTP server
- * - 'pipe [1] - use UNIX path to EXE
- * - 'phpmail [2] - use the PHP built-in mail function
- *
- * @param int $_type Interger value representing Mail Transport Type
- * @return void
- */
- function setTransportType($_type = 0)
- {
- if ( ( is_numeric($_type) ) &&
- ( ( $_type >= 0 ) && ( $_type <= 3 ) ) )
- $this->_transportType = $_type;
- }
+ /**
+ * Determines the method inwhich the messages are to be sent.
+ * - 'sockets' [0] - conect via network to SMTP server
+ * - 'pipe [1] - use UNIX path to EXE
+ * - 'phpmail [2] - use the PHP built-in mail function
+ *
+ * @param int $_type Interger value representing Mail Transport Type
+ * @return void
+ */
+ public function setTransportType($_type = 0)
+ {
+ if ((is_numeric($_type)) && (($_type >= 0) && ($_type <= 3))) {
+ $this->_transportType = $_type;
+ }
+ }
- /**
- * Return the method inwhich the message is to be sent.
- * - 'sockets' [0] - conect via network to SMTP server
- * - 'pipe [1] - use UNIX path to EXE
- * - 'phpmail [2] - use the PHP built-in mail function
- *
- * @return int $_strHost Host Name or IP of the Mail Server to use
- */
- function getTransportType()
- {
- return $this->_transportType;
- }
+ /**
+ * Return the method inwhich the message is to be sent.
+ * - 'sockets' [0] - conect via network to SMTP server
+ * - 'pipe [1] - use UNIX path to EXE
+ * - 'phpmail [2] - use the PHP built-in mail function
+ *
+ * @return int $_strHost Host Name or IP of the Mail Server to use
+ */
+ public function getTransportType()
+ {
+ return $this->_transportType;
+ }
- /**
- * Path to the sendmail execuable
- *
- * @param string $_path Path to the sendmail execuable
- * @return boolean
- *
- */
- function setMailPath($_path)
- {
- // This feature is not yet implemented
- return true;
+ /**
+ * Path to the sendmail execuable
+ *
+ * @param string $_path Path to the sendmail execuable
+ * @return boolean
+ *
+ */
+ public function setMailPath($_path)
+ {
+ // This feature is not yet implemented
+ return true;
- //if ( $_path ) $this->_mailPath = $_path;
- }
+ //if ( $_path ) $this->_mailPath = $_path;
+ }
- /**
- * Defines the Host Name or IP of the Mail Server to use.
- * This is defaulted to 'localhost'
- * This is used only with 'socket' based mail transmission
- *
- * @param string $_strHost Host Name or IP of the Mail Server to use
- * @return void
- */
- function setHost($_strHost)
- {
- if ( $_strHost )
- $this->_smtpsHost = $_strHost;
- }
+ /**
+ * Defines the Host Name or IP of the Mail Server to use.
+ * This is defaulted to 'localhost'
+ * This is used only with 'socket' based mail transmission
+ *
+ * @param string $_strHost Host Name or IP of the Mail Server to use
+ * @return void
+ */
+ public function setHost($_strHost)
+ {
+ if ( $_strHost )
+ $this->_smtpsHost = $_strHost;
+ }
- /**
- * Retrieves the Host Name or IP of the Mail Server to use
- * This is used only with 'socket' based mail transmission
- *
- * @return string $_strHost Host Name or IP of the Mail Server to use
- */
- function getHost()
- {
- return $this->_smtpsHost;
- }
+ /**
+ * Retrieves the Host Name or IP of the Mail Server to use
+ * This is used only with 'socket' based mail transmission
+ *
+ * @return string $_strHost Host Name or IP of the Mail Server to use
+ */
+ public function getHost()
+ {
+ return $this->_smtpsHost;
+ }
- /**
- * Defines the Port Number of the Mail Server to use
- * This is defaulted to '25'
- * This is used only with 'socket' based mail transmission
- *
- * @param int $_intPort Port Number of the Mail Server to use
- * @return void
- */
- function setPort($_intPort)
- {
- if ( ( is_numeric($_intPort) ) &&
- ( ( $_intPort >= 1 ) && ( $_intPort <= 65536 ) ) )
- $this->_smtpsPort = $_intPort;
- }
+ /**
+ * Defines the Port Number of the Mail Server to use
+ * This is defaulted to '25'
+ * This is used only with 'socket' based mail transmission
+ *
+ * @param int $_intPort Port Number of the Mail Server to use
+ * @return void
+ */
+ public function setPort($_intPort)
+ {
+ if ( ( is_numeric($_intPort) ) &&
+ ( ( $_intPort >= 1 ) && ( $_intPort <= 65536 ) ) )
+ $this->_smtpsPort = $_intPort;
+ }
- /**
- * Retrieves the Port Number of the Mail Server to use
- * This is used only with 'socket' based mail transmission
- *
- * @return string Port Number of the Mail Server to use
- */
- function getPort()
- {
- return $this->_smtpsPort;
- }
+ /**
+ * Retrieves the Port Number of the Mail Server to use
+ * This is used only with 'socket' based mail transmission
+ *
+ * @return string Port Number of the Mail Server to use
+ */
+ public function getPort()
+ {
+ return $this->_smtpsPort;
+ }
- /**
- * User Name for authentication on Mail Server
- *
- * @param string $_strID User Name for authentication on Mail Server
- * @return void
- */
- function setID($_strID)
- {
- $this->_smtpsID = $_strID;
- }
+ /**
+ * User Name for authentication on Mail Server
+ *
+ * @param string $_strID User Name for authentication on Mail Server
+ * @return void
+ */
+ public function setID($_strID)
+ {
+ $this->_smtpsID = $_strID;
+ }
- /**
- * Retrieves the User Name for authentication on Mail Server
- *
- * @return string User Name for authentication on Mail Server
- */
- function getID()
- {
- return $this->_smtpsID;
- }
+ /**
+ * Retrieves the User Name for authentication on Mail Server
+ *
+ * @return string User Name for authentication on Mail Server
+ */
+ public function getID()
+ {
+ return $this->_smtpsID;
+ }
- /**
- * User Password for authentication on Mail Server
- *
- * @param string $_strPW User Password for authentication on Mail Server
- * @return void
- */
- function setPW($_strPW)
- {
- $this->_smtpsPW = $_strPW;
- }
+ /**
+ * User Password for authentication on Mail Server
+ *
+ * @param string $_strPW User Password for authentication on Mail Server
+ * @return void
+ */
+ public function setPW($_strPW)
+ {
+ $this->_smtpsPW = $_strPW;
+ }
- /**
- * Retrieves the User Password for authentication on Mail Server
- *
- * @return string User Password for authentication on Mail Server
- */
- function getPW()
- {
- return $this->_smtpsPW;
- }
+ /**
+ * Retrieves the User Password for authentication on Mail Server
+ *
+ * @return string User Password for authentication on Mail Server
+ */
+ public function getPW()
+ {
+ return $this->_smtpsPW;
+ }
- /**
- * Character set used for current message
- * Character set is defaulted to 'iso-8859-1';
- *
- * @param string $_strCharSet Character set used for current message
- * @return void
- */
- function setCharSet($_strCharSet)
- {
- if ( $_strCharSet )
- $this->_smtpsCharSet = $_strCharSet;
- }
+ /**
+ * Character set used for current message
+ * Character set is defaulted to 'iso-8859-1';
+ *
+ * @param string $_strCharSet Character set used for current message
+ * @return void
+ */
+ public function setCharSet($_strCharSet)
+ {
+ if ( $_strCharSet )
+ $this->_smtpsCharSet = $_strCharSet;
+ }
- /**
- * Retrieves the Character set used for current message
- *
- * @return string $_smtpsCharSet Character set used for current message
- */
- function getCharSet()
- {
- return $this->_smtpsCharSet;
- }
+ /**
+ * Retrieves the Character set used for current message
+ *
+ * @return string $_smtpsCharSet Character set used for current message
+ */
+ public function getCharSet()
+ {
+ return $this->_smtpsCharSet;
+ }
- /**
- * Content-Transfer-Encoding, Defaulted to '7bit'
- * This can be changed for 2byte characers sets
- * Known Encode Types
- * - 7bit Simple 7-bit ASCII
- * - 8bit 8-bit coding with line termination characters
- * - base64 3 octets encoded into 4 sextets with offset
- * - binary Arbitrary binary stream
- * - mac-binhex40 Macintosh binary to hex encoding
- * - quoted-printable Mostly 7-bit, with 8-bit characters encoded as "=HH"
- * - uuencode UUENCODE encoding
- *
- * @param string $_strTransEncode Content-Transfer-Encoding
- * @return void
- */
- function setTransEncode($_strTransEncode)
- {
- if (array_search($_strTransEncode, $this->_smtpsTransEncodeTypes))
- $this->_smtpsTransEncode = $_strTransEncode;
- }
+ /**
+ * Content-Transfer-Encoding, Defaulted to '7bit'
+ * This can be changed for 2byte characers sets
+ * Known Encode Types
+ * - 7bit Simple 7-bit ASCII
+ * - 8bit 8-bit coding with line termination characters
+ * - base64 3 octets encoded into 4 sextets with offset
+ * - binary Arbitrary binary stream
+ * - mac-binhex40 Macintosh binary to hex encoding
+ * - quoted-printable Mostly 7-bit, with 8-bit characters encoded as "=HH"
+ * - uuencode UUENCODE encoding
+ *
+ * @param string $_strTransEncode Content-Transfer-Encoding
+ * @return void
+ */
+ public function setTransEncode($_strTransEncode)
+ {
+ if (array_search($_strTransEncode, $this->_smtpsTransEncodeTypes))
+ $this->_smtpsTransEncode = $_strTransEncode;
+ }
- /**
- * Retrieves the Content-Transfer-Encoding
- *
- * @return string $_smtpsTransEncode Content-Transfer-Encoding
- */
- function getTransEncode()
- {
- return $this->_smtpsTransEncode;
- }
+ /**
+ * Retrieves the Content-Transfer-Encoding
+ *
+ * @return string $_smtpsTransEncode Content-Transfer-Encoding
+ */
+ public function getTransEncode()
+ {
+ return $this->_smtpsTransEncode;
+ }
- /**
- * Content-Transfer-Encoding, Defaulted to '0' [ZERO]
- * This can be changed for 2byte characers sets
- * Known Encode Types
- * - [0] 7bit Simple 7-bit ASCII
- * - [1] 8bit 8-bit coding with line termination characters
- * - [2] base64 3 octets encoded into 4 sextets with offset
- * - [3] binary Arbitrary binary stream
- * - [4] mac-binhex40 Macintosh binary to hex encoding
- * - [5] quoted-printable Mostly 7-bit, with 8-bit characters encoded as "=HH"
- * - [6] uuencode UUENCODE encoding
- *
- * @param string $_strTransEncodeType Content-Transfer-Encoding
- * @return void
- *
- */
- function setTransEncodeType($_strTransEncodeType)
- {
- if (array_search($_strTransEncodeType, $this->_smtpsTransEncodeTypes))
- $this->_smtpsTransEncodeType = $_strTransEncodeType;
- }
+ /**
+ * Content-Transfer-Encoding, Defaulted to '0' [ZERO]
+ * This can be changed for 2byte characers sets
+ * Known Encode Types
+ * - [0] 7bit Simple 7-bit ASCII
+ * - [1] 8bit 8-bit coding with line termination characters
+ * - [2] base64 3 octets encoded into 4 sextets with offset
+ * - [3] binary Arbitrary binary stream
+ * - [4] mac-binhex40 Macintosh binary to hex encoding
+ * - [5] quoted-printable Mostly 7-bit, with 8-bit characters encoded as "=HH"
+ * - [6] uuencode UUENCODE encoding
+ *
+ * @param string $_strTransEncodeType Content-Transfer-Encoding
+ * @return void
+ *
+ */
+ public function setTransEncodeType($_strTransEncodeType)
+ {
+ if (array_search($_strTransEncodeType, $this->_smtpsTransEncodeTypes))
+ $this->_smtpsTransEncodeType = $_strTransEncodeType;
+ }
- /**
- * Retrieves the Content-Transfer-Encoding
- *
- * @return string Content-Transfer-Encoding
- */
- function getTransEncodeType()
- {
- return $this->_smtpsTransEncodeTypes[$this->_smtpsTransEncodeType];
- }
+ /**
+ * Retrieves the Content-Transfer-Encoding
+ *
+ * @return string Content-Transfer-Encoding
+ */
+ public function getTransEncodeType()
+ {
+ return $this->_smtpsTransEncodeTypes[$this->_smtpsTransEncodeType];
+ }
- // ** Message Construction
+ // ** Message Construction
- /**
- * FROM Address from which mail will be sent
- *
- * @param string $_strFrom Address from which mail will be sent
- * @return void
- */
- function setFrom($_strFrom)
- {
- if ( $_strFrom )
- $this->_msgFrom = $this->_strip_email($_strFrom);
- }
+ /**
+ * FROM Address from which mail will be sent
+ *
+ * @param string $_strFrom Address from which mail will be sent
+ * @return void
+ */
+ public function setFrom($_strFrom)
+ {
+ if ( $_strFrom )
+ $this->_msgFrom = $this->_strip_email($_strFrom);
+ }
- /**
- * Retrieves the Address from which mail will be sent
- *
- * @param boolean $_part To "strip" 'Real name' from address
- * @return string Address from which mail will be sent
- */
- function getFrom($_part = true)
- {
- $_retValue = '';
+ /**
+ * Retrieves the Address from which mail will be sent
+ *
+ * @param boolean $_part To "strip" 'Real name' from address
+ * @return string Address from which mail will be sent
+ */
+ public function getFrom($_part = true)
+ {
+ $_retValue = '';
- if ( $_part === true )
- $_retValue = $this->_msgFrom;
- else
- $_retValue = $this->_msgFrom[$_part];
+ if ( $_part === true )
+ $_retValue = $this->_msgFrom;
+ else
+ $_retValue = $this->_msgFrom[$_part];
- return $_retValue;
- }
+ return $_retValue;
+ }
- /**
- * Reply-To Address from which mail will be the reply-to
- *
- * @param string $_strReplyTo Address from which mail will be the reply-to
- * @return void
- */
- function setReplyTo($_strReplyTo)
- {
- if ( $_strReplyTo )
- $this->_msgReplyTo = $this->_strip_email($_strReplyTo);
- }
+ /**
+ * Reply-To Address from which mail will be the reply-to
+ *
+ * @param string $_strReplyTo Address from which mail will be the reply-to
+ * @return void
+ */
+ public function setReplyTo($_strReplyTo)
+ {
+ if ( $_strReplyTo )
+ $this->_msgReplyTo = $this->_strip_email($_strReplyTo);
+ }
- /**
- * Retrieves the Address from which mail will be the reply-to
- *
- * @param boolean $_part To "strip" 'Real name' from address
- * @return string Address from which mail will be the reply-to
- */
- function getReplyTo($_part = true)
- {
- $_retValue = '';
+ /**
+ * Retrieves the Address from which mail will be the reply-to
+ *
+ * @param boolean $_part To "strip" 'Real name' from address
+ * @return string Address from which mail will be the reply-to
+ */
+ public function getReplyTo($_part = true)
+ {
+ $_retValue = '';
- if ( $_part === true )
- $_retValue = $this->_msgReplyTo;
- else
- $_retValue = $this->_msgReplyTo[$_part];
+ if ( $_part === true )
+ $_retValue = $this->_msgReplyTo;
+ else
+ $_retValue = $this->_msgReplyTo[$_part];
- return $_retValue;
- }
+ return $_retValue;
+ }
- /**
- * Inserts given addresses into structured format.
- * This method takes a list of given addresses, via an array
- * or a COMMA delimted string, and inserts them into a highly
- * structured array. This array is designed to remove duplicate
- * addresses and to sort them by Domain.
- *
- * @param string $_type TO, CC, or BCC lists to add addrresses into
- * @param mixed $_addrList Array or COMMA delimited string of addresses
- * @return void
- *
- */
- function _buildAddrList($_type, $_addrList)
- {
- // Pull existing list
- $aryHost = $this->_msgRecipients;
+ /**
+ * Inserts given addresses into structured format.
+ * This method takes a list of given addresses, via an array
+ * or a COMMA delimted string, and inserts them into a highly
+ * structured array. This array is designed to remove duplicate
+ * addresses and to sort them by Domain.
+ *
+ * @param string $_type TO, CC, or BCC lists to add addrresses into
+ * @param mixed $_addrList Array or COMMA delimited string of addresses
+ * @return void
+ *
+ */
+ private function _buildAddrList($_type, $_addrList)
+ {
+ // Pull existing list
+ $aryHost = $this->_msgRecipients;
- // Only run this if we have something
- if ( !empty($_addrList))
- {
- // $_addrList can be a STRING or an array
- if ( is_string($_addrList) )
- {
- // This could be a COMMA delimited string
- if ( strstr($_addrList, ',') )
- // "explode "list" into an array
- $_addrList = explode(',', $_addrList);
+ // Only run this if we have something
+ if ( !empty($_addrList))
+ {
+ // $_addrList can be a STRING or an array
+ if ( is_string($_addrList) )
+ {
+ // This could be a COMMA delimited string
+ if ( strstr($_addrList, ',') )
+ // "explode "list" into an array
+ $_addrList = explode(',', $_addrList);
- // Stick it in an array
- else
- $_addrList = array($_addrList);
- }
+ // Stick it in an array
+ else
+ $_addrList = array($_addrList);
+ }
- // take the array of addresses and split them further
- foreach ($_addrList as $_strAddr)
- {
- // Strip off the end '>'
- $_strAddr = str_replace('>', '', $_strAddr);
+ // take the array of addresses and split them further
+ foreach ($_addrList as $_strAddr)
+ {
+ // Strip off the end '>'
+ $_strAddr = str_replace('>', '', $_strAddr);
- // Seperate "Real Name" from eMail address
- $_tmpaddr = null;
- $_tmpaddr = explode('<', $_strAddr);
+ // Seperate "Real Name" from eMail address
+ $_tmpaddr = null;
+ $_tmpaddr = explode('<', $_strAddr);
- // We have a "Real Name" and eMail address
- if ( count($_tmpaddr) == 2 )
- {
- $_tmpHost = explode('@', $_tmpaddr[1]);
- $_tmpaddr[0] = trim($_tmpaddr[0], ' ">');
- $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = $_tmpaddr[0];
- }
- // We only have an eMail address
- else
- {
- // Strip off the beggining '<'
- $_strAddr = str_replace('<', '', $_strAddr);
+ // We have a "Real Name" and eMail address
+ if ( count($_tmpaddr) == 2 )
+ {
+ $_tmpHost = explode('@', $_tmpaddr[1]);
+ $_tmpaddr[0] = trim($_tmpaddr[0], ' ">');
+ $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = $_tmpaddr[0];
+ }
+ // We only have an eMail address
+ else
+ {
+ // Strip off the beggining '<'
+ $_strAddr = str_replace('<', '', $_strAddr);
- $_tmpHost = explode('@', $_strAddr);
- $_tmpHost[0] = trim($_tmpHost[0]);
- $_tmpHost[1] = trim($_tmpHost[1]);
+ $_tmpHost = explode('@', $_strAddr);
+ $_tmpHost[0] = trim($_tmpHost[0]);
+ $_tmpHost[1] = trim($_tmpHost[1]);
- $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = '';
- }
- }
- }
- // replace list
- $this->_msgRecipients = $aryHost;
- }
+ $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = '';
+ }
+ }
+ }
+ // replace list
+ $this->_msgRecipients = $aryHost;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Returns an array of the various parts of an email address
- * This assumes a well formed address:
- * - "Real name"
- * - "Real Name" is optional
- * - if "Real Name" does not exist, the angle brackets are optional
- * This will split an email address into 4 or 5 parts.
- * - $_aryEmail[org] = orignal string
- * - $_aryEmail[real] = "real name" - if there is one
- * - $_aryEmail[addr] = address part "username@domain.tld"
- * - $_aryEmail[host] = "domain.tld"
- * - $_aryEmail[user] = "userName"
- *
- * @param string $_strAddr Email address
- * @return array An array of the various parts of an email address
- */
- function _strip_email($_strAddr)
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Returns an array of the various parts of an email address
+ * This assumes a well formed address:
+ * - "Real name"
+ * - "Real Name" is optional
+ * - if "Real Name" does not exist, the angle brackets are optional
+ * This will split an email address into 4 or 5 parts.
+ * - $_aryEmail[org] = orignal string
+ * - $_aryEmail[real] = "real name" - if there is one
+ * - $_aryEmail[addr] = address part "username@domain.tld"
+ * - $_aryEmail[host] = "domain.tld"
+ * - $_aryEmail[user] = "userName"
+ *
+ * @param string $_strAddr Email address
+ * @return array An array of the various parts of an email address
+ */
+ private function _strip_email($_strAddr)
+ {
// phpcs:enable
- // Keep the orginal
- $_aryEmail['org'] = $_strAddr;
+ // Keep the orginal
+ $_aryEmail['org'] = $_strAddr;
- // Set entire string to Lower Case
- $_strAddr = strtolower($_strAddr);
+ // Set entire string to Lower Case
+ $_strAddr = strtolower($_strAddr);
- // Drop "stuff' off the end
- $_strAddr = trim($_strAddr, ' ">');
+ // Drop "stuff' off the end
+ $_strAddr = trim($_strAddr, ' ">');
- // Seperate "Real Name" from eMail address, if we have one
- $_tmpAry = explode('<', $_strAddr);
+ // Seperate "Real Name" from eMail address, if we have one
+ $_tmpAry = explode('<', $_strAddr);
- // Do we have a "Real name"
- if ( count($_tmpAry) == 2 )
- {
- // We may not really have a "Real Name"
- if ( $_tmpAry[0])
- $_aryEmail['real'] = trim($_tmpAry[0], ' ">');
+ // Do we have a "Real name"
+ if ( count($_tmpAry) == 2 )
+ {
+ // We may not really have a "Real Name"
+ if ( $_tmpAry[0])
+ $_aryEmail['real'] = trim($_tmpAry[0], ' ">');
- $_aryEmail['addr'] = $_tmpAry[1];
- }
- else
- $_aryEmail['addr'] = $_tmpAry[0];
+ $_aryEmail['addr'] = $_tmpAry[1];
+ }
+ else
+ $_aryEmail['addr'] = $_tmpAry[0];
- // Pull User Name and Host.tld apart
- list($_aryEmail['user'], $_aryEmail['host'] ) = explode('@', $_aryEmail['addr']);
+ // Pull User Name and Host.tld apart
+ list($_aryEmail['user'], $_aryEmail['host'] ) = explode('@', $_aryEmail['addr']);
- // Put the brackets back around the address
- $_aryEmail['addr'] = '<' . $_aryEmail['addr'] . '>';
+ // Put the brackets back around the address
+ $_aryEmail['addr'] = '<' . $_aryEmail['addr'] . '>';
- return $_aryEmail;
- }
+ return $_aryEmail;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Returns an array of bares addresses for use with 'RCPT TO:'
- * This is a "build as you go" method. Each time this method is called
- * the underlaying array is destroyed and reconstructed.
- *
- * @return array Returns an array of bares addresses
- */
- function get_RCPT_list()
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Returns an array of bares addresses for use with 'RCPT TO:'
+ * This is a "build as you go" method. Each time this method is called
+ * the underlaying array is destroyed and reconstructed.
+ *
+ * @return array Returns an array of bares addresses
+ */
+ public function get_RCPT_list()
+ {
// phpcs:enable
- /**
- * An array of bares addresses for use with 'RCPT TO:'
- */
- $_RCPT_list=array();
+ /**
+ * An array of bares addresses for use with 'RCPT TO:'
+ */
+ $_RCPT_list=array();
- // walk down Recipients array and pull just email addresses
- foreach ($this->_msgRecipients as $_host => $_list)
- {
- foreach ($_list as $_subList)
- {
- foreach ($_subList as $_name => $_addr)
- {
- // build RCPT list
- $_RCPT_list[] = $_name . '@' . $_host;
- }
- }
- }
+ // walk down Recipients array and pull just email addresses
+ foreach ($this->_msgRecipients as $_host => $_list)
+ {
+ foreach ($_list as $_subList)
+ {
+ foreach ($_subList as $_name => $_addr)
+ {
+ // build RCPT list
+ $_RCPT_list[] = $_name . '@' . $_host;
+ }
+ }
+ }
- return $_RCPT_list;
- }
+ return $_RCPT_list;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Returns an array of addresses for a specific type; TO, CC or BCC
- *
- * @param string $_which Which collection of addresses to return ('to', 'cc', 'bcc')
- * @return string|false Array of emaill address
- */
- function get_email_list($_which = null)
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Returns an array of addresses for a specific type; TO, CC or BCC
+ *
+ * @param string $_which Which collection of addresses to return ('to', 'cc', 'bcc')
+ * @return string|false Array of emaill address
+ */
+ public function get_email_list($_which = null)
+ {
// phpcs:enable
- // We need to know which address segment to pull
- if ( $_which )
- {
- // Make sure we have addresses to process
- if ( $this->_msgRecipients )
- {
- $_RCPT_list=array();
- // walk down Recipients array and pull just email addresses
- foreach ($this->_msgRecipients as $_host => $_list)
- {
- if ( $this->_msgRecipients[$_host][$_which] )
- {
- foreach ($this->_msgRecipients[$_host][$_which] as $_addr => $_realName)
- {
- if ( $_realName ) // @CHANGE LDR
- {
- $_realName = '"' . $_realName . '"';
- $_RCPT_list[] = $_realName . ' <' . $_addr . '@' . $_host . '>';
- }
- else
- {
- $_RCPT_list[] = $_addr . '@' . $_host;
- }
- }
- }
- }
+ // We need to know which address segment to pull
+ if ( $_which )
+ {
+ // Make sure we have addresses to process
+ if ( $this->_msgRecipients )
+ {
+ $_RCPT_list=array();
+ // walk down Recipients array and pull just email addresses
+ foreach ($this->_msgRecipients as $_host => $_list)
+ {
+ if ( $this->_msgRecipients[$_host][$_which] )
+ {
+ foreach ($this->_msgRecipients[$_host][$_which] as $_addr => $_realName)
+ {
+ if ( $_realName ) // @CHANGE LDR
+ {
+ $_realName = '"' . $_realName . '"';
+ $_RCPT_list[] = $_realName . ' <' . $_addr . '@' . $_host . '>';
+ }
+ else
+ {
+ $_RCPT_list[] = $_addr . '@' . $_host;
+ }
+ }
+ }
+ }
- return implode(', ', $_RCPT_list);
- }
- else
- {
- $this->_setErr(101, 'No eMail Address for message to be sent to.');
- return false;
- }
- }
- else
- {
- $this->_setErr(102, 'eMail type not defined.');
- return false;
- }
- }
+ return implode(', ', $_RCPT_list);
+ }
+ else
+ {
+ $this->_setErr(101, 'No eMail Address for message to be sent to.');
+ return false;
+ }
+ }
+ else
+ {
+ $this->_setErr(102, 'eMail type not defined.');
+ return false;
+ }
+ }
- /**
- * TO Address[es] inwhich to send mail to
- *
- * @param string $_addrTo TO Address[es] inwhich to send mail to
- * @return void
- */
- function setTO($_addrTo)
- {
- if ( $_addrTo )
- $this->_buildAddrList('to', $_addrTo);
- }
+ /**
+ * TO Address[es] inwhich to send mail to
+ *
+ * @param string $_addrTo TO Address[es] inwhich to send mail to
+ * @return void
+ */
+ public function setTO($_addrTo)
+ {
+ if ( $_addrTo )
+ $this->_buildAddrList('to', $_addrTo);
+ }
- /**
- * Retrieves the TO Address[es] inwhich to send mail to
- *
- * @return string TO Address[es] inwhich to send mail to
- */
- function getTo()
- {
- return $this->get_email_list('to');
- }
+ /**
+ * Retrieves the TO Address[es] inwhich to send mail to
+ *
+ * @return string TO Address[es] inwhich to send mail to
+ */
+ public function getTo()
+ {
+ return $this->get_email_list('to');
+ }
- /**
- * CC Address[es] inwhich to send mail to
- *
- * @param string $_strCC CC Address[es] inwhich to send mail to
- * @return void
- */
- function setCC($_strCC)
- {
- if ( $_strCC )
- $this->_buildAddrList('cc', $_strCC);
- }
+ /**
+ * CC Address[es] inwhich to send mail to
+ *
+ * @param string $_strCC CC Address[es] inwhich to send mail to
+ * @return void
+ */
+ public function setCC($_strCC)
+ {
+ if ( $_strCC )
+ $this->_buildAddrList('cc', $_strCC);
+ }
- /**
- * Retrieves the CC Address[es] inwhich to send mail to
- *
- * @return string CC Address[es] inwhich to send mail to
- */
- function getCC()
- {
- return $this->get_email_list('cc');
- }
+ /**
+ * Retrieves the CC Address[es] inwhich to send mail to
+ *
+ * @return string CC Address[es] inwhich to send mail to
+ */
+ public function getCC()
+ {
+ return $this->get_email_list('cc');
+ }
- /**
- * BCC Address[es] inwhich to send mail to
- *
- * @param string $_strBCC Recipients BCC Address[es] inwhich to send mail to
- * @return void
- */
- function setBCC($_strBCC)
- {
- if ( $_strBCC )
- $this->_buildAddrList('bcc', $_strBCC);
- }
+ /**
+ * BCC Address[es] inwhich to send mail to
+ *
+ * @param string $_strBCC Recipients BCC Address[es] inwhich to send mail to
+ * @return void
+ */
+ public function setBCC($_strBCC)
+ {
+ if ( $_strBCC )
+ $this->_buildAddrList('bcc', $_strBCC);
+ }
- /**
- * Retrieves the BCC Address[es] inwhich to send mail to
- *
- * @return string BCC Address[es] inwhich to send mail to
- */
- function getBCC()
- {
- return $this->get_email_list('bcc');
- }
+ /**
+ * Retrieves the BCC Address[es] inwhich to send mail to
+ *
+ * @return string BCC Address[es] inwhich to send mail to
+ */
+ public function getBCC()
+ {
+ return $this->get_email_list('bcc');
+ }
- /**
- * Message Subject
- *
- * @param string $_strSubject Message Subject
- * @return void
- */
- function setSubject($_strSubject = '')
- {
- if ( $_strSubject )
- $this->_msgSubject = $_strSubject;
- }
+ /**
+ * Message Subject
+ *
+ * @param string $_strSubject Message Subject
+ * @return void
+ */
+ public function setSubject($_strSubject = '')
+ {
+ if ( $_strSubject )
+ $this->_msgSubject = $_strSubject;
+ }
- /**
- * Retrieves the Message Subject
- *
- * @return string Message Subject
- */
- function getSubject()
- {
- return $this->_msgSubject;
- }
+ /**
+ * Retrieves the Message Subject
+ *
+ * @return string Message Subject
+ */
+ public function getSubject()
+ {
+ return $this->_msgSubject;
+ }
- /**
- * Constructes and returns message header
- *
- * @return string Complete message header
- */
- function getHeader()
- {
- global $conf;
+ /**
+ * Constructes and returns message header
+ *
+ * @return string Complete message header
+ */
+ public function getHeader()
+ {
+ global $conf;
- $_header = 'From: ' . $this->getFrom('org') . "\r\n"
- . 'To: ' . $this->getTO() . "\r\n";
+ $_header = 'From: ' . $this->getFrom('org') . "\r\n"
+ . 'To: ' . $this->getTO() . "\r\n";
- if ( $this->getCC() )
- $_header .= 'Cc: ' . $this->getCC() . "\r\n";
+ if ( $this->getCC() )
+ $_header .= 'Cc: ' . $this->getCC() . "\r\n";
- /* Note:
- * BCC email addresses must be listed in the RCPT TO command list,
- * but the BCC header should not be printed under the DATA command.
- * So it is included into the function sendMsg() but not here.
- * http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server
- */
- /*
- if ( $this->getBCC() )
- $_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
+ /* Note:
+ * BCC email addresses must be listed in the RCPT TO command list,
+ * but the BCC header should not be printed under the DATA command.
+ * So it is included into the function sendMsg() but not here.
+ * http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server
+ */
+ /*
+ if ( $this->getBCC() )
+ $_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
*/
- $host=$this->getHost();
- $usetls = preg_match('@tls://@i', $host);
-
- $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
- $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
- $host=preg_replace('@tls://@i', '', $host); // Remove prefix
-
- $host=dol_getprefix('email');
-
- //NOTE: Message-ID should probably contain the username of the user who sent the msg
- $_header .= 'Subject: ' . $this->getSubject() . "\r\n";
- $_header .= 'Date: ' . date("r") . "\r\n";
-
- $trackid = $this->getTrackId();
- if ($trackid)
- {
- // References is kept in response and Message-ID is returned into In-Reply-To:
- $_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
- $_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
- $_header .= 'X-Dolibarr-TRACKID: ' . $trackid . '@' . $host . "\r\n";
- }
- else
- {
- $_header .= 'Message-ID: <' . time() . '.SMTPs@' . $host . ">\r\n";
- }
- if (! empty($_SERVER['REMOTE_ADDR'])) $_header .= "X-RemoteAddr: " . $_SERVER['REMOTE_ADDR']. "\r\n";
- if ( $this->getMoreInHeader() )
- $_header .= $this->getMoreInHeader(); // Value must include the "\r\n";
-
- //$_header .=
- // 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"
- // 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n";
-
- if ( $this->getSensitivity() )
- $_header .= 'Sensitivity: ' . $this->getSensitivity() . "\r\n";
-
- if ( $this->_msgPriority != 3 )
- $_header .= $this->getPriority();
-
-
- // @CHANGE LDR
- if ( $this->getDeliveryReceipt() )
- $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
- if ( $this->getErrorsTo() )
- $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
- if ( $this->getReplyTo() )
- $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
-
- $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n";
- $_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART?'MAIN_MAIL_USE_MULTI_PART':'No MAIN_MAIL_USE_MULTI_PART') . "\r\n";
- $_header .= 'Mime-Version: 1.0' . "\r\n";
-
-
- return $_header;
- }
-
- /**
- * Message Content
- *
- * @param string $strContent Message Content
- * @param string $strType Type
- * @return void
- */
- function setBodyContent($strContent, $strType = 'plain')
- {
- //if ( $strContent )
- //{
- if ( $strType == 'html' )
- $strMimeType = 'text/html';
- else
- $strMimeType = 'text/plain';
-
- // Make RFC821 Compliant, replace bare linefeeds
- $strContent = preg_replace("/(?]*>/", " ", $strContent);
- $strContentAltText = html_entity_decode(strip_tags($strContentAltText));
- $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
- }
-
- // Make RFC2045 Compliant
- //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
- $strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content.
-
- $this->_msgContent[$strType] = array();
-
- $this->_msgContent[$strType]['mimeType'] = $strMimeType;
- $this->_msgContent[$strType]['data'] = $strContent;
- $this->_msgContent[$strType]['dataText'] = $strContentAltText;
-
- if ( $this->getMD5flag() )
- $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3);
- //}
- }
-
- /**
- * Retrieves the Message Content
- *
- * @return string Message Content
- */
- function getBodyContent()
- {
- global $conf;
-
- // Generate a new Boundary string
- $this->_setBoundary();
-
- // What type[s] of content do we have
- $_types = array_keys($this->_msgContent);
-
- // How many content types do we have
- $keyCount = count($_types);
-
- // If we have ZERO, we have a problem
- if( $keyCount === 0 )
- die("Sorry, no content");
-
- // If we have ONE, we can use the simple format
- elseif( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART))
- {
- $_msgData = $this->_msgContent;
- $_msgData = $_msgData[$_types[0]];
-
- $content = 'Content-Type: ' . $_msgData['mimeType'] . '; charset="' . $this->getCharSet() . '"' . "\r\n"
- . 'Content-Transfer-Encoding: ' . $this->getTransEncodeType() . "\r\n"
- . 'Content-Disposition: inline' . "\r\n"
- . 'Content-Description: Message' . "\r\n";
-
- if ( $this->getMD5flag() )
- $content .= 'Content-MD5: ' . $_msgData['md5'] . "\r\n";
-
- $content .= "\r\n"
- . $_msgData['data'] . "\r\n";
- }
-
- // If we have more than ONE, we use the multi-part format
- elseif( $keyCount >= 1 || ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))
- {
- // Since this is an actual multi-part message
- // We need to define a content message Boundary
- // NOTE: This was 'multipart/alternative', but Windows based mail servers have issues with this.
-
- //$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
- $content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary('mixed') . '"' . "\r\n";
-
- // . "\r\n"
- // . 'This is a multi-part message in MIME format.' . "\r\n";
- $content .= "Content-Transfer-Encoding: 8bit\r\n";
- $content .= "\r\n";
-
- $content .= "--" . $this->_getBoundary('mixed') . "\r\n";
-
- if (key_exists('image', $this->_msgContent)) // If inline image found
- {
- $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
- $content .= "\r\n";
- $content .= "--" . $this->_getBoundary('alternative') . "\r\n";
- }
-
-
- // $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment'
-
-
- // Loop through message content array
- foreach ($this->_msgContent as $type => $_content)
- {
- if ( $type == 'attachment' )
- {
- // loop through all attachments
- foreach ($_content as $_file => $_data)
- {
- $content .= "--" . $this->_getBoundary('mixed') . "\r\n"
- . 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n"
- . 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n"
- . 'Content-Transfer-Encoding: base64' . "\r\n"
- . 'Content-Description: ' . $_data['fileName'] ."\r\n";
-
- if ( $this->getMD5flag() )
- $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n";
-
- $content .= "\r\n" . $_data['data'] . "\r\n\r\n";
- }
- }
- // @CHANGE LDR
- elseif ( $type == 'image' )
- {
- // loop through all images
- foreach ($_content as $_image => $_data)
- {
- $content .= "--" . $this->_getBoundary('related') . "\r\n"; // always related for an inline image
-
- $content .= 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['imageName'] . '"' . "\r\n"
- . 'Content-Transfer-Encoding: base64' . "\r\n"
- . 'Content-Disposition: inline; filename="' . $_data['imageName'] . '"' . "\r\n"
- . 'Content-ID: <' . $_data['cid'] . '> ' . "\r\n";
-
- if ( $this->getMD5flag() )
- $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n";
-
- $content .= "\r\n"
- . $_data['data'] . "\r\n";
- }
-
- // always end related and end alternative after inline images
- $content.= "--" . $this->_getBoundary('related') . "--" . "\r\n";
- $content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n";
- $content.= "\r\n";
- }
- else
- {
- if (key_exists('image', $this->_msgContent))
- {
- $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
- $content.= "\r\n" . ($_content['dataText']?$_content['dataText']:strip_tags($_content['data'])) . "\r\n"; // Add plain text message
- $content.= "--" . $this->_getBoundary('alternative') . "\r\n";
- $content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
- $content.= "\r\n";
- $content.= "--" . $this->_getBoundary('related') . "\r\n";
- }
-
- if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
- {
- $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
- $content .= "\r\n";
- $content .= "--" . $this->_getBoundary('alternative') . "\r\n";
-
- $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
- $content.= "\r\n". $_content['dataText'] . "\r\n";
- $content.= "--" . $this->_getBoundary('alternative') . "\r\n";
- }
-
- $content .= 'Content-Type: ' . $_content['mimeType'] . '; '
- // . 'charset="' . $this->getCharSet() . '"';
- . 'charset=' . $this->getCharSet() . '';
-
- // $content .= ( $type == 'html') ? '; name="HTML Part"' : '';
- $content .= "\r\n";
- // $content .= 'Content-Transfer-Encoding: ';
- // $content .= ($type == 'html') ? 'quoted-printable' : $this->getTransEncodeType();
- // $content .= "\r\n"
- // . 'Content-Disposition: inline' . "\r\n"
- // . 'Content-Description: ' . $type . ' message' . "\r\n";
-
- if ( $this->getMD5flag() )
- $content .= 'Content-MD5: ' . $_content['md5'] . "\r\n";
-
- $content .= "\r\n" . $_content['data'] . "\r\n";
-
- if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
- {
- $content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n";
- }
-
- $content .= "\r\n";
- }
- }
-
- // Close message boundries
- // $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ;
- $content .= "--" . $this->_getBoundary('mixed') . '--' . "\r\n" ;
- }
-
- return $content;
- }
-
- /**
- * File attachments are added to the content array as sub-arrays,
- * allowing for multiple attachments for each outbound email
- *
- * @param string $strContent File data to attach to message
- * @param string $strFileName File Name to give to attachment
- * @param string $strMimeType File Mime Type of attachment
- * @return void
- */
- function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown')
- {
- if ( $strContent )
- {
- $strContent = rtrim(chunk_split(base64_encode($strContent), 76, "\r\n")); // 76 max is defined into http://tools.ietf.org/html/rfc2047
-
- $this->_msgContent['attachment'][$strFileName]['mimeType'] = $strMimeType;
- $this->_msgContent['attachment'][$strFileName]['fileName'] = $strFileName;
- $this->_msgContent['attachment'][$strFileName]['data'] = $strContent;
-
- if ( $this->getMD5flag() )
- $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3);
- }
- }
-
-
- // @CHANGE LDR
-
- /**
- * Image attachments are added to the content array as sub-arrays,
- * allowing for multiple images for each outbound email
- *
- * @param string $strContent Image data to attach to message
- * @param string $strImageName Image Name to give to attachment
- * @param string $strMimeType Image Mime Type of attachment
- * @param string $strImageCid CID
- * @return void
- */
- function setImageInline($strContent, $strImageName = 'unknown', $strMimeType = 'unknown', $strImageCid = 'unknown')
- {
- if ($strContent)
- {
- $this->_msgContent['image'][$strImageName]['mimeType'] = $strMimeType;
- $this->_msgContent['image'][$strImageName]['imageName'] = $strImageName;
- $this->_msgContent['image'][$strImageName]['cid'] = $strImageCid;
- $this->_msgContent['image'][$strImageName]['data'] = $strContent;
-
- if ( $this->getMD5flag() )
- $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3);
- }
- }
- // END @CHANGE LDR
-
-
- /**
- * Message Content Sensitivity
- * Message Sensitivity values:
- * - [0] None - default
- * - [1] Personal
- * - [2] Private
- * - [3] Company Confidential
- *
- * @param integer $_value Message Sensitivity
- * @return void
- */
- function setSensitivity($_value = 0)
- {
- if ( ( is_numeric($_value) ) &&
- ( ( $_value >= 0 ) && ( $_value <= 3 ) ) )
- $this->_msgSensitivity = $_value;
- }
-
- /**
- * Returns Message Content Sensitivity string
- * Message Sensitivity values:
- * - [0] None - default
- * - [1] Personal
- * - [2] Private
- * - [3] Company Confidential
- *
- * @return void
- */
- function getSensitivity()
- {
- return $this->_arySensitivity[$this->_msgSensitivity];
- }
-
- /**
- * Message Content Priority
- * Message Priority values:
- * - [0] 'Bulk'
- * - [1] 'Highest'
- * - [2] 'High'
- * - [3] 'Normal' - default
- * - [4] 'Low'
- * - [5] 'Lowest'
- *
- * @param integer $_value Message Priority
- * @return void
- */
- function setPriority($_value = 3)
- {
- if ( ( is_numeric($_value) ) &&
- ( ( $_value >= 0 ) && ( $_value <= 5 ) ) )
- $this->_msgPriority = $_value;
- }
-
- /**
- * Message Content Priority
- * Message Priority values:
- * - [0] 'Bulk'
- * - [1] 'Highest'
- * - [2] 'High'
- * - [3] 'Normal' - default
- * - [4] 'Low'
- * - [5] 'Lowest'
- *
- * @return string
- */
- function getPriority()
- {
- return 'Importance: ' . $this->_aryPriority[$this->_msgPriority] . "\r\n"
- . 'Priority: ' . $this->_aryPriority[$this->_msgPriority] . "\r\n"
- . 'X-Priority: ' . $this->_msgPriority . ' (' . $this->_aryPriority[$this->_msgPriority] . ')' . "\r\n";
- }
-
- /**
- * Set flag which determines whether to calculate message MD5 checksum.
- *
- * @param string $_flag Message Priority
- * @return void
- */
- function setMD5flag($_flag = false)
- {
- $this->_smtpMD5 = $_flag;
- }
-
- /**
- * Gets flag which determines whether to calculate message MD5 checksum.
- *
- * @return boolean Message Priority
- */
- function getMD5flag()
- {
- return $this->_smtpMD5;
- }
-
- /**
- * Message X-Header Content
- * This is a simple "insert". Whatever is given will be placed
- * "as is" into the Xheader array.
- *
- * @param string $strXdata Message X-Header Content
- * @return void
- */
- function setXheader($strXdata)
- {
- if ( $strXdata )
- $this->_msgXheader[] = $strXdata;
- }
-
- /**
- * Retrieves the Message X-Header Content
- *
- * @return string[] $_msgContent Message X-Header Content
- */
- function getXheader()
- {
- return $this->_msgXheader;
- }
-
- /**
- * Generates Random string for MIME message Boundary
- *
- * @return void
- */
- function _setBoundary()
- {
- $this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary";
- $this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3);
- $this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3);
- }
-
- /**
- * Retrieves the MIME message Boundary
- *
- * @param string $type Type of boundary
- * @return string $_smtpsBoundary MIME message Boundary
- */
- function _getBoundary($type = 'mixed')
- {
- if ($type == 'mixed') return $this->_smtpsBoundary;
- elseif ($type == 'related') return $this->_smtpsRelatedBoundary;
- elseif ($type == 'alternative') return $this->_smtpsAlternativeBoundary;
- }
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * This function has been modified as provided by SirSir to allow multiline responses when
- * using SMTP Extensions
- *
- * @param Handler $socket Socket handler
- * @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
- * @return boolean True or false
- */
- function server_parse($socket, $response)
- {
+ $host=$this->getHost();
+ $usetls = preg_match('@tls://@i', $host);
+
+ $host=preg_replace('@tcp://@i', '', $host); // Remove prefix
+ $host=preg_replace('@ssl://@i', '', $host); // Remove prefix
+ $host=preg_replace('@tls://@i', '', $host); // Remove prefix
+
+ $host=dol_getprefix('email');
+
+ //NOTE: Message-ID should probably contain the username of the user who sent the msg
+ $_header .= 'Subject: ' . $this->getSubject() . "\r\n";
+ $_header .= 'Date: ' . date("r") . "\r\n";
+
+ $trackid = $this->getTrackId();
+ if ($trackid)
+ {
+ // References is kept in response and Message-ID is returned into In-Reply-To:
+ $_header .= 'Message-ID: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
+ $_header .= 'References: <' . time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host . ">\r\n";
+ $_header .= 'X-Dolibarr-TRACKID: ' . $trackid . '@' . $host . "\r\n";
+ }
+ else
+ {
+ $_header .= 'Message-ID: <' . time() . '.SMTPs@' . $host . ">\r\n";
+ }
+ if (! empty($_SERVER['REMOTE_ADDR'])) $_header .= "X-RemoteAddr: " . $_SERVER['REMOTE_ADDR']. "\r\n";
+ if ( $this->getMoreInHeader() )
+ $_header .= $this->getMoreInHeader(); // Value must include the "\r\n";
+
+ //$_header .=
+ // 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"
+ // 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n";
+
+ if ( $this->getSensitivity() )
+ $_header .= 'Sensitivity: ' . $this->getSensitivity() . "\r\n";
+
+ if ( $this->_msgPriority != 3 )
+ $_header .= $this->getPriority();
+
+
+ // @CHANGE LDR
+ if ( $this->getDeliveryReceipt() )
+ $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n";
+ if ( $this->getErrorsTo() )
+ $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n";
+ if ( $this->getReplyTo() )
+ $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
+
+ $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n";
+ $_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART?'MAIN_MAIL_USE_MULTI_PART':'No MAIN_MAIL_USE_MULTI_PART') . "\r\n";
+ $_header .= 'Mime-Version: 1.0' . "\r\n";
+
+
+ return $_header;
+ }
+
+ /**
+ * Message Content
+ *
+ * @param string $strContent Message Content
+ * @param string $strType Type
+ * @return void
+ */
+ public function setBodyContent($strContent, $strType = 'plain')
+ {
+ //if ( $strContent )
+ //{
+ if ( $strType == 'html' )
+ $strMimeType = 'text/html';
+ else
+ $strMimeType = 'text/plain';
+
+ // Make RFC821 Compliant, replace bare linefeeds
+ $strContent = preg_replace("/(?]*>/", " ", $strContent);
+ $strContentAltText = html_entity_decode(strip_tags($strContentAltText));
+ $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
+ }
+
+ // Make RFC2045 Compliant
+ //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
+ $strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content.
+
+ $this->_msgContent[$strType] = array();
+
+ $this->_msgContent[$strType]['mimeType'] = $strMimeType;
+ $this->_msgContent[$strType]['data'] = $strContent;
+ $this->_msgContent[$strType]['dataText'] = $strContentAltText;
+
+ if ( $this->getMD5flag() )
+ $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3);
+ //}
+ }
+
+ /**
+ * Retrieves the Message Content
+ *
+ * @return string Message Content
+ */
+ public function getBodyContent()
+ {
+ global $conf;
+
+ // Generate a new Boundary string
+ $this->_setBoundary();
+
+ // What type[s] of content do we have
+ $_types = array_keys($this->_msgContent);
+
+ // How many content types do we have
+ $keyCount = count($_types);
+
+ // If we have ZERO, we have a problem
+ if( $keyCount === 0 )
+ die("Sorry, no content");
+
+ // If we have ONE, we can use the simple format
+ elseif( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART))
+ {
+ $_msgData = $this->_msgContent;
+ $_msgData = $_msgData[$_types[0]];
+
+ $content = 'Content-Type: ' . $_msgData['mimeType'] . '; charset="' . $this->getCharSet() . '"' . "\r\n"
+ . 'Content-Transfer-Encoding: ' . $this->getTransEncodeType() . "\r\n"
+ . 'Content-Disposition: inline' . "\r\n"
+ . 'Content-Description: Message' . "\r\n";
+
+ if ( $this->getMD5flag() )
+ $content .= 'Content-MD5: ' . $_msgData['md5'] . "\r\n";
+
+ $content .= "\r\n"
+ . $_msgData['data'] . "\r\n";
+ }
+
+ // If we have more than ONE, we use the multi-part format
+ elseif( $keyCount >= 1 || ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))
+ {
+ // Since this is an actual multi-part message
+ // We need to define a content message Boundary
+ // NOTE: This was 'multipart/alternative', but Windows based mail servers have issues with this.
+
+ //$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
+ $content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary('mixed') . '"' . "\r\n";
+
+ // . "\r\n"
+ // . 'This is a multi-part message in MIME format.' . "\r\n";
+ $content .= "Content-Transfer-Encoding: 8bit\r\n";
+ $content .= "\r\n";
+
+ $content .= "--" . $this->_getBoundary('mixed') . "\r\n";
+
+ if (key_exists('image', $this->_msgContent)) // If inline image found
+ {
+ $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
+ $content .= "\r\n";
+ $content .= "--" . $this->_getBoundary('alternative') . "\r\n";
+ }
+
+
+ // $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment'
+
+
+ // Loop through message content array
+ foreach ($this->_msgContent as $type => $_content)
+ {
+ if ( $type == 'attachment' )
+ {
+ // loop through all attachments
+ foreach ($_content as $_file => $_data)
+ {
+ $content .= "--" . $this->_getBoundary('mixed') . "\r\n"
+ . 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n"
+ . 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n"
+ . 'Content-Transfer-Encoding: base64' . "\r\n"
+ . 'Content-Description: ' . $_data['fileName'] ."\r\n";
+
+ if ( $this->getMD5flag() )
+ $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n";
+
+ $content .= "\r\n" . $_data['data'] . "\r\n\r\n";
+ }
+ }
+ // @CHANGE LDR
+ elseif ( $type == 'image' )
+ {
+ // loop through all images
+ foreach ($_content as $_image => $_data)
+ {
+ $content .= "--" . $this->_getBoundary('related') . "\r\n"; // always related for an inline image
+
+ $content .= 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['imageName'] . '"' . "\r\n"
+ . 'Content-Transfer-Encoding: base64' . "\r\n"
+ . 'Content-Disposition: inline; filename="' . $_data['imageName'] . '"' . "\r\n"
+ . 'Content-ID: <' . $_data['cid'] . '> ' . "\r\n";
+
+ if ( $this->getMD5flag() )
+ $content .= 'Content-MD5: ' . $_data['md5'] . "\r\n";
+
+ $content .= "\r\n"
+ . $_data['data'] . "\r\n";
+ }
+
+ // always end related and end alternative after inline images
+ $content.= "--" . $this->_getBoundary('related') . "--" . "\r\n";
+ $content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n";
+ $content.= "\r\n";
+ }
+ else
+ {
+ if (key_exists('image', $this->_msgContent))
+ {
+ $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
+ $content.= "\r\n" . ($_content['dataText']?$_content['dataText']:strip_tags($_content['data'])) . "\r\n"; // Add plain text message
+ $content.= "--" . $this->_getBoundary('alternative') . "\r\n";
+ $content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
+ $content.= "\r\n";
+ $content.= "--" . $this->_getBoundary('related') . "\r\n";
+ }
+
+ if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
+ {
+ $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
+ $content .= "\r\n";
+ $content .= "--" . $this->_getBoundary('alternative') . "\r\n";
+
+ $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
+ $content.= "\r\n". $_content['dataText'] . "\r\n";
+ $content.= "--" . $this->_getBoundary('alternative') . "\r\n";
+ }
+
+ $content .= 'Content-Type: ' . $_content['mimeType'] . '; '
+ // . 'charset="' . $this->getCharSet() . '"';
+ . 'charset=' . $this->getCharSet() . '';
+
+ // $content .= ( $type == 'html') ? '; name="HTML Part"' : '';
+ $content .= "\r\n";
+ // $content .= 'Content-Transfer-Encoding: ';
+ // $content .= ($type == 'html') ? 'quoted-printable' : $this->getTransEncodeType();
+ // $content .= "\r\n"
+ // . 'Content-Disposition: inline' . "\r\n"
+ // . 'Content-Description: ' . $type . ' message' . "\r\n";
+
+ if ( $this->getMD5flag() )
+ $content .= 'Content-MD5: ' . $_content['md5'] . "\r\n";
+
+ $content .= "\r\n" . $_content['data'] . "\r\n";
+
+ if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
+ {
+ $content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n";
+ }
+
+ $content .= "\r\n";
+ }
+ }
+
+ // Close message boundries
+ // $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ;
+ $content .= "--" . $this->_getBoundary('mixed') . '--' . "\r\n" ;
+ }
+
+ return $content;
+ }
+
+ /**
+ * File attachments are added to the content array as sub-arrays,
+ * allowing for multiple attachments for each outbound email
+ *
+ * @param string $strContent File data to attach to message
+ * @param string $strFileName File Name to give to attachment
+ * @param string $strMimeType File Mime Type of attachment
+ * @return void
+ */
+ public function setAttachment($strContent, $strFileName = 'unknown', $strMimeType = 'unknown')
+ {
+ if ( $strContent )
+ {
+ $strContent = rtrim(chunk_split(base64_encode($strContent), 76, "\r\n")); // 76 max is defined into http://tools.ietf.org/html/rfc2047
+
+ $this->_msgContent['attachment'][$strFileName]['mimeType'] = $strMimeType;
+ $this->_msgContent['attachment'][$strFileName]['fileName'] = $strFileName;
+ $this->_msgContent['attachment'][$strFileName]['data'] = $strContent;
+
+ if ( $this->getMD5flag() )
+ $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3);
+ }
+ }
+
+
+ // @CHANGE LDR
+
+ /**
+ * Image attachments are added to the content array as sub-arrays,
+ * allowing for multiple images for each outbound email
+ *
+ * @param string $strContent Image data to attach to message
+ * @param string $strImageName Image Name to give to attachment
+ * @param string $strMimeType Image Mime Type of attachment
+ * @param string $strImageCid CID
+ * @return void
+ */
+ public function setImageInline($strContent, $strImageName = 'unknown', $strMimeType = 'unknown', $strImageCid = 'unknown')
+ {
+ if ($strContent)
+ {
+ $this->_msgContent['image'][$strImageName]['mimeType'] = $strMimeType;
+ $this->_msgContent['image'][$strImageName]['imageName'] = $strImageName;
+ $this->_msgContent['image'][$strImageName]['cid'] = $strImageCid;
+ $this->_msgContent['image'][$strImageName]['data'] = $strContent;
+
+ if ( $this->getMD5flag() )
+ $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3);
+ }
+ }
+ // END @CHANGE LDR
+
+
+ /**
+ * Message Content Sensitivity
+ * Message Sensitivity values:
+ * - [0] None - default
+ * - [1] Personal
+ * - [2] Private
+ * - [3] Company Confidential
+ *
+ * @param integer $_value Message Sensitivity
+ * @return void
+ */
+ public function setSensitivity($_value = 0)
+ {
+ if ( ( is_numeric($_value) ) &&
+ ( ( $_value >= 0 ) && ( $_value <= 3 ) ) )
+ $this->_msgSensitivity = $_value;
+ }
+
+ /**
+ * Returns Message Content Sensitivity string
+ * Message Sensitivity values:
+ * - [0] None - default
+ * - [1] Personal
+ * - [2] Private
+ * - [3] Company Confidential
+ *
+ * @return void
+ */
+ public function getSensitivity()
+ {
+ return $this->_arySensitivity[$this->_msgSensitivity];
+ }
+
+ /**
+ * Message Content Priority
+ * Message Priority values:
+ * - [0] 'Bulk'
+ * - [1] 'Highest'
+ * - [2] 'High'
+ * - [3] 'Normal' - default
+ * - [4] 'Low'
+ * - [5] 'Lowest'
+ *
+ * @param integer $_value Message Priority
+ * @return void
+ */
+ public function setPriority($_value = 3)
+ {
+ if ( ( is_numeric($_value) ) &&
+ ( ( $_value >= 0 ) && ( $_value <= 5 ) ) )
+ $this->_msgPriority = $_value;
+ }
+
+ /**
+ * Message Content Priority
+ * Message Priority values:
+ * - [0] 'Bulk'
+ * - [1] 'Highest'
+ * - [2] 'High'
+ * - [3] 'Normal' - default
+ * - [4] 'Low'
+ * - [5] 'Lowest'
+ *
+ * @return string
+ */
+ public function getPriority()
+ {
+ return 'Importance: ' . $this->_aryPriority[$this->_msgPriority] . "\r\n"
+ . 'Priority: ' . $this->_aryPriority[$this->_msgPriority] . "\r\n"
+ . 'X-Priority: ' . $this->_msgPriority . ' (' . $this->_aryPriority[$this->_msgPriority] . ')' . "\r\n";
+ }
+
+ /**
+ * Set flag which determines whether to calculate message MD5 checksum.
+ *
+ * @param string $_flag Message Priority
+ * @return void
+ */
+ public function setMD5flag($_flag = false)
+ {
+ $this->_smtpMD5 = $_flag;
+ }
+
+ /**
+ * Gets flag which determines whether to calculate message MD5 checksum.
+ *
+ * @return boolean Message Priority
+ */
+ public function getMD5flag()
+ {
+ return $this->_smtpMD5;
+ }
+
+ /**
+ * Message X-Header Content
+ * This is a simple "insert". Whatever is given will be placed
+ * "as is" into the Xheader array.
+ *
+ * @param string $strXdata Message X-Header Content
+ * @return void
+ */
+ public function setXheader($strXdata)
+ {
+ if ( $strXdata )
+ $this->_msgXheader[] = $strXdata;
+ }
+
+ /**
+ * Retrieves the Message X-Header Content
+ *
+ * @return string[] $_msgContent Message X-Header Content
+ */
+ public function getXheader()
+ {
+ return $this->_msgXheader;
+ }
+
+ /**
+ * Generates Random string for MIME message Boundary
+ *
+ * @return void
+ */
+ private function _setBoundary()
+ {
+ $this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary";
+ $this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3);
+ $this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3);
+ }
+
+ /**
+ * Retrieves the MIME message Boundary
+ *
+ * @param string $type Type of boundary
+ * @return string $_smtpsBoundary MIME message Boundary
+ */
+ private function _getBoundary($type = 'mixed')
+ {
+ if ($type == 'mixed') return $this->_smtpsBoundary;
+ elseif ($type == 'related') return $this->_smtpsRelatedBoundary;
+ elseif ($type == 'alternative') return $this->_smtpsAlternativeBoundary;
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * This function has been modified as provided by SirSir to allow multiline responses when
+ * using SMTP Extensions
+ *
+ * @param Handler $socket Socket handler
+ * @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
+ * @return boolean True or false
+ */
+ public function server_parse($socket, $response)
+ {
// phpcs:enable
- /**
- * Returns constructed SELECT Object string or boolean upon failure
- * Default value is set at true
- */
- $_retVal = true;
+ /**
+ * Returns constructed SELECT Object string or boolean upon failure
+ * Default value is set at true
+ */
+ $_retVal = true;
- $server_response = '';
+ $server_response = '';
// avoid infinite loop
$limit=0;
- while (substr($server_response, 3, 1) != ' ' && $limit<100)
- {
- if (! ($server_response = fgets($socket, 256)))
- {
- $this->_setErr(121, "Couldn't get mail server response codes");
- $_retVal = false;
- break;
- }
+ while (substr($server_response, 3, 1) != ' ' && $limit<100)
+ {
+ if (! ($server_response = fgets($socket, 256)))
+ {
+ $this->_setErr(121, "Couldn't get mail server response codes");
+ $_retVal = false;
+ break;
+ }
$limit++;
- }
+ }
- if (! (substr($server_response, 0, 3) == $response))
- {
- $this->_setErr(120, "Ran into problems sending Mail.\r\nResponse: $server_response");
- $_retVal = false;
- }
+ if (! (substr($server_response, 0, 3) == $response))
+ {
+ $this->_setErr(120, "Ran into problems sending Mail.\r\nResponse: $server_response");
+ $_retVal = false;
+ }
- return $_retVal;
- }
+ return $_retVal;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Send str
- *
- * @param string $_strSend String to send
- * @param string $_returnCode Return code
- * @param string $CRLF CRLF
- * @return boolean|null True or false
- */
- function socket_send_str($_strSend, $_returnCode = null, $CRLF = "\r\n")
- {
- // phpcs:enable
- if ($this->_debug) $this->log.=$_strSend; // @CHANGE LDR for log
- fputs($this->socket, $_strSend . $CRLF);
- if ($this->_debug) $this->log.=' ('.$_returnCode.')' . $CRLF;
-
- if ( $_returnCode )
- return $this->server_parse($this->socket, $_returnCode);
- }
-
- // =============================================================
- // ** Error handling methods
-
- /**
- * Defines errors codes and messages for Class
- *
- * @param int $_errNum Error Code Number
- * @param string $_errMsg Error Message
- * @return void
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Send str
+ *
+ * @param string $_strSend String to send
+ * @param string $_returnCode Return code
+ * @param string $CRLF CRLF
+ * @return boolean|null True or false
*/
- function _setErr($_errNum, $_errMsg)
+ public function socket_send_str($_strSend, $_returnCode = null, $CRLF = "\r\n")
+ {
+ // phpcs:enable
+ if ($this->_debug) $this->log.=$_strSend; // @CHANGE LDR for log
+ fputs($this->socket, $_strSend . $CRLF);
+ if ($this->_debug) $this->log.=' ('.$_returnCode.')' . $CRLF;
+
+ if ( $_returnCode )
+ return $this->server_parse($this->socket, $_returnCode);
+ }
+
+ // =============================================================
+ // ** Error handling methods
+
+ /**
+ * Defines errors codes and messages for Class
+ *
+ * @param int $_errNum Error Code Number
+ * @param string $_errMsg Error Message
+ * @return void
+ */
+ private function _setErr($_errNum, $_errMsg)
{
$this->_smtpsErrors[] = array(
'num' => $_errNum,
@@ -1835,25 +1835,25 @@ class SMTPs
);
}
- /**
- * Returns errors codes and messages for Class
- *
- * @return string $_errMsg Error Message
- */
- function getErrors()
- {
- $_errMsg = array();
+ /**
+ * Returns errors codes and messages for Class
+ *
+ * @return string $_errMsg Error Message
+ */
+ public function getErrors()
+ {
+ $_errMsg = array();
- if (is_array($this->_smtpsErrors))
- {
- foreach ($this->_smtpsErrors as $_err => $_info)
- {
- $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg'];
- }
- }
+ if (is_array($this->_smtpsErrors))
+ {
+ foreach ($this->_smtpsErrors as $_err => $_info)
+ {
+ $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg'];
+ }
+ }
- return implode("\n", $_errMsg);
- }
+ return implode("\n", $_errMsg);
+ }
}
diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php
index bbdebab81b0..b35e9947644 100644
--- a/htdocs/core/class/stats.class.php
+++ b/htdocs/core/class/stats.class.php
@@ -42,7 +42,7 @@ abstract class Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
- function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
+ public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
{
global $conf,$user,$langs;
@@ -136,7 +136,7 @@ abstract class Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
- function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
+ public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
{
global $conf,$user,$langs;
@@ -228,8 +228,8 @@ abstract class Stats
* @param int $startyear End year
* @return array Array of values
*/
- function getAverageByMonthWithPrevYear($endyear, $startyear)
- {
+ public function getAverageByMonthWithPrevYear($endyear, $startyear)
+ {
if ($startyear > $endyear) return -1;
$datay=array();
@@ -264,9 +264,9 @@ abstract class Stats
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
* @return array Array of values
*/
- function getAllByProductEntry($year, $cachedelay = 0)
- {
- global $conf,$user,$langs;
+ public function getAllByProductEntry($year, $cachedelay = 0)
+ {
+ global $conf,$user,$langs;
$datay=array();
@@ -333,14 +333,16 @@ abstract class Stats
// Here we have low level of shared code called by XxxStats.class.php
- /**
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
* Return nb of elements by year
*
* @param string $sql SQL request
* @return array
*/
- function _getNbByYear($sql)
- {
+ protected function _getNbByYear($sql)
+ {
+ // phpcs:enable
$result = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
@@ -363,14 +365,16 @@ abstract class Stats
return $result;
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Return nb of elements, total amount and avg amount each year
*
* @param string $sql SQL request
* @return array Array with nb, total amount, average for each year
*/
- function _getAllByYear($sql)
+ protected function _getAllByYear($sql)
{
+ // phpcs:enable
$result = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
@@ -405,6 +409,7 @@ abstract class Stats
return $result;
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Renvoie le nombre de proposition par mois pour une annee donnee
*
@@ -412,9 +417,10 @@ abstract class Stats
* @param string $sql SQL
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of nb each month
- */
- function _getNbByMonth($year, $sql, $format = 0)
- {
+ */
+ protected function _getNbByMonth($year, $sql, $format = 0)
+ {
+ // phpcs:enable
global $langs;
$result=array();
@@ -462,6 +468,7 @@ abstract class Stats
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Renvoie le nombre d'element par mois pour une annee donnee
*
@@ -470,8 +477,9 @@ abstract class Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array
*/
- function _getAmountByMonth($year, $sql, $format = 0)
- {
+ protected function _getAmountByMonth($year, $sql, $format = 0)
+ {
+ // phpcs:enable
global $langs;
$result=array();
@@ -514,18 +522,20 @@ abstract class Stats
}
return $data;
- }
+ }
- /**
- * Renvoie le montant moyen par mois pour une annee donnee
- *
- * @param int $year Year
- * @param string $sql SQL
- * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
- * @return array
- */
- function _getAverageByMonth($year, $sql, $format = 0)
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
+ * Renvoie le montant moyen par mois pour une annee donnee
+ *
+ * @param int $year Year
+ * @param string $sql SQL
+ * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
+ * @return array
+ */
+ protected function _getAverageByMonth($year, $sql, $format = 0)
+ {
+ // phpcs:enable
global $langs;
$result=array();
@@ -567,18 +577,20 @@ abstract class Stats
}
return $data;
- }
+ }
- /**
- * Return number or total of product refs
- *
- * @param string $sql SQL
- * @param int $limit Limit
- * @return array
- */
- function _getAllByProduct($sql, $limit = 10)
- {
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+ /**
+ * Return number or total of product refs
+ *
+ * @param string $sql SQL
+ * @param int $limit Limit
+ * @return array
+ */
+ protected function _getAllByProduct($sql, $limit = 10)
+ {
+ // phpcs:enable
global $langs;
$result=array();
@@ -592,16 +604,16 @@ abstract class Stats
$i = 0; $other=0;
while ($i < $num)
{
- $row = $this->db->fetch_row($resql);
+ $row = $this->db->fetch_row($resql);
if ($i < $limit || $num == $limit) $result[$i] = array($row[0],$row[1]); // Ref of product, nb
else $other += $row[1];
$i++;
- }
+ }
if ($num > $limit) $result[$i] = array($langs->transnoentitiesnoconv("Other"),$other);
$this->db->free($resql);
}
else dol_print_error($this->db);
return $result;
- }
+ }
}
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index bc104bb2b79..e0865a640e4 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -48,7 +48,7 @@ class Translate
* @param string $dir Force directory that contains /langs subdirectory (value is sometimes '..' like into install/* pages or support/* pages). Use '' by default.
* @param Conf $conf Object with Dolibarr configuration
*/
- function __construct($dir, $conf)
+ public function __construct($dir, $conf)
{
if (! empty($conf->file->character_set_client)) $this->charset_output=$conf->file->character_set_client; // If charset output is forced
if ($dir) $this->dir=array($dir);
@@ -62,7 +62,7 @@ class Translate
* @param string $srclang Language to use. If '' or 'auto', we use browser lang.
* @return void
*/
- function setDefaultLang($srclang = 'en_US')
+ public function setDefaultLang($srclang = 'en_US')
{
global $conf;
@@ -132,7 +132,7 @@ class Translate
* @param int $mode 0=Long language code, 1=Short language code (en, fr, es, ...)
* @return string Language code used (en_US, en_AU, fr_FR, ...)
*/
- function getDefaultLang($mode = 0)
+ public function getDefaultLang($mode = 0)
{
if (empty($mode)) return $this->defaultlang;
else return substr($this->defaultlang, 0, 2);
@@ -145,7 +145,7 @@ class Translate
* @param array $domains Array of lang files to load
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
*/
- function loadLangs($domains)
+ public function loadLangs($domains)
{
foreach($domains as $domain)
{
@@ -173,7 +173,7 @@ class Translate
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
* @see loadLangs
*/
- function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0)
+ public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0)
{
global $conf,$db;
@@ -399,7 +399,7 @@ class Translate
* @param Database $db Database handler
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
*/
- function loadFromDatabase($db)
+ public function loadFromDatabase($db)
{
global $conf;
@@ -537,8 +537,8 @@ class Translate
* @param string $key Key to translate
* @return string Translated string (translated with transnoentitiesnoconv)
*/
- private function getTradFromKey($key)
- {
+ private function getTradFromKey($key)
+ {
global $conf, $db;
if (! is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
@@ -577,7 +577,7 @@ class Translate
}*/
return $newstr;
- }
+ }
/**
@@ -593,9 +593,9 @@ class Translate
* @param string $param4 chaine de param4
* @param int $maxsize Max length of text
* @return string Translated string (encoded into HTML entities and UTF8)
- */
- function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0)
- {
+ */
+ public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0)
+ {
global $conf;
if (! empty($this->tab_translate[$key])) // Translation is available
@@ -638,7 +638,7 @@ class Translate
//if ($key[0] == '$') { return dol_eval($key,1); }
return $this->getTradFromKey($key);
}
- }
+ }
/**
@@ -655,7 +655,7 @@ class Translate
* @param string $param5 chaine de param5
* @return string Translated string (encoded into UTF8)
*/
- function transnoentities($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
+ public function transnoentities($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
{
return $this->convToOutputCharset($this->transnoentitiesnoconv($key, $param1, $param2, $param3, $param4, $param5));
}
@@ -676,7 +676,7 @@ class Translate
* @param string $param5 chaine de param5
* @return string Translated string
*/
- function transnoentitiesnoconv($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
+ public function transnoentitiesnoconv($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $param5 = '')
{
global $conf;
@@ -719,7 +719,7 @@ class Translate
* @param string $countrycode country code (FR, ...)
* @return string translated string
*/
- function transcountry($str, $countrycode)
+ public function transcountry($str, $countrycode)
{
if ($this->tab_translate["$str$countrycode"]) return $this->trans("$str$countrycode");
else return $this->trans($str);
@@ -733,7 +733,7 @@ class Translate
* @param string $countrycode country code (FR, ...)
* @return string translated string
*/
- function transcountrynoentities($str, $countrycode)
+ public function transcountrynoentities($str, $countrycode)
{
if ($this->tab_translate["$str$countrycode"]) return $this->transnoentities("$str$countrycode");
else return $this->transnoentities($str);
@@ -747,7 +747,7 @@ class Translate
* @param string $pagecodefrom Page code of src string
* @return string Converted string
*/
- function convToOutputCharset($str, $pagecodefrom = 'UTF-8')
+ public function convToOutputCharset($str, $pagecodefrom = 'UTF-8')
{
if ($pagecodefrom == 'ISO-8859-1' && $this->charset_output == 'UTF-8') $str=utf8_encode($str);
if ($pagecodefrom == 'UTF-8' && $this->charset_output == 'ISO-8859-1') $str=utf8_decode(str_replace('€', chr(128), $str));
@@ -755,7 +755,7 @@ class Translate
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of all available languages
*
@@ -764,8 +764,8 @@ class Translate
* @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code
* @return array List of languages
*/
- function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0)
- {
+ public function get_available_languages($langdir = DOL_DOCUMENT_ROOT, $maxlength = 0, $usecode = 0)
+ {
// phpcs:enable
global $conf;
@@ -793,10 +793,10 @@ class Translate
}
}
return $langs_available;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return if a filename $filename exists for current language (or alternate language)
*
@@ -804,8 +804,8 @@ class Translate
* @param integer $searchalt Search also alernate language file
* @return boolean true if exists and readable
*/
- function file_exists($filename, $searchalt = 0)
- {
+ public function file_exists($filename, $searchalt = 0)
+ {
// phpcs:enable
// Test si fichier dans repertoire de la langue
foreach($this->dir as $searchdir)
@@ -822,7 +822,7 @@ class Translate
}
return false;
- }
+ }
/**
@@ -836,8 +836,8 @@ class Translate
* 10 if setDefaultLang was en_US => ten
* 123 if setDefaultLang was fr_FR => cent vingt trois
*/
- function getLabelFromNumber($number, $isamount = 0)
- {
+ public function getLabelFromNumber($number, $isamount = 0)
+ {
global $conf;
$newnumber=$number;
@@ -861,7 +861,7 @@ class Translate
}
return $newnumber;
- }
+ }
/**
@@ -879,8 +879,8 @@ class Translate
* @return string Label in UTF8 (but without entities)
* @see dol_getIdFromCode
*/
- function getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect = '', $filteronentity = 0)
- {
+ public function getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect = '', $filteronentity = 0)
+ {
// If key empty
if ($key == '') return '';
@@ -919,7 +919,7 @@ class Translate
$this->error=$db->lasterror();
return -1;
}
- }
+ }
/**
@@ -931,7 +931,7 @@ class Translate
* @deprecated Use method price to output a price
* @see price()
*/
- function getCurrencyAmount($currency_code, $amount)
+ public function getCurrencyAmount($currency_code, $amount)
{
$symbol=$this->getCurrencySymbol($currency_code);
@@ -947,8 +947,8 @@ class Translate
* @param integer $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency.
* @return string Currency symbol encoded into UTF8
*/
- function getCurrencySymbol($currency_code, $forceloadall = 0)
- {
+ public function getCurrencySymbol($currency_code, $forceloadall = 0)
+ {
$currency_sign = ''; // By default return iso code
if (function_exists("mb_convert_encoding"))
@@ -965,7 +965,7 @@ class Translate
}
return ($currency_sign?$currency_sign:$currency_code);
- }
+ }
/**
* Load into the cache this->cache_currencies, all currencies
@@ -1021,23 +1021,23 @@ class Translate
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return an array with content of all loaded translation keys (found into this->tab_translate) so
* we get a substitution array we can use for substitutions (for mail or ODT generation for example)
*
* @return array Array of translation keys lang_key => string_translation_loaded
*/
- function get_translations_for_substitutions()
- {
+ public function get_translations_for_substitutions()
+ {
// phpcs:enable
- $substitutionarray = array();
+ $substitutionarray = array();
- foreach($this->tab_translate as $code => $label) {
- $substitutionarray['lang_'.$code] = $label;
- $substitutionarray['__('.$code.')__'] = $label;
- }
+ foreach($this->tab_translate as $code => $label) {
+ $substitutionarray['lang_'.$code] = $label;
+ $substitutionarray['__('.$code.')__'] = $label;
+ }
- return $substitutionarray;
- }
+ return $substitutionarray;
+ }
}
diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php
index 6cacf353ca1..a5a3bd8aca9 100644
--- a/htdocs/core/class/utils.class.php
+++ b/htdocs/core/class/utils.class.php
@@ -32,15 +32,15 @@ class Utils
*/
public $db;
- var $output; // Used by Cron method to return message
- var $result; // Used by Cron method to return data
+ public $output; // Used by Cron method to return message
+ public $result; // Used by Cron method to return data
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -53,7 +53,7 @@ class Utils
* @param string $choice Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile')
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
- function purgeFiles($choice = 'tempfilesold')
+ public function purgeFiles($choice = 'tempfilesold')
{
global $conf, $langs, $dolibarr_main_data_root;
@@ -182,7 +182,7 @@ class Utils
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
- function dumpDatabase($compression = 'none', $type = 'auto', $usedefault = 1, $file = 'auto', $keeplastnfiles = 0, $execmethod = 0)
+ public function dumpDatabase($compression = 'none', $type = 'auto', $usedefault = 1, $file = 'auto', $keeplastnfiles = 0, $execmethod = 0)
{
global $db, $conf, $langs, $dolibarr_main_data_root;
global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass;
@@ -501,7 +501,7 @@ class Utils
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
* @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK.
*/
- function executeCLI($command, $outputfile, $execmethod = 0)
+ public function executeCLI($command, $outputfile, $execmethod = 0)
{
global $conf, $langs;
@@ -570,7 +570,7 @@ class Utils
* @param string $module Module name
* @return int <0 if KO, >0 if OK
*/
- function generateDoc($module)
+ public function generateDoc($module)
{
global $conf, $langs;
global $dirins;
@@ -737,7 +737,7 @@ class Utils
*
* @return int 0 if OK, < 0 if KO
*/
- function compressSyslogs()
+ public function compressSyslogs()
{
global $conf;
@@ -843,7 +843,7 @@ class Utils
$this->output = 'Archive log files (keeping last SYSLOG_FILE_SAVES='.$nbSaves.' files) done.';
return 0;
- }
+ }
/** Backup the db OR just a table without mysqldump binary, with PHP only (does not require any exec permission)
* Author: David Walsh (http://davidwalsh.name/backup-mysql-database-php)
@@ -855,7 +855,7 @@ class Utils
* @param string $tables Table name or '*' for all
* @return int <0 if KO, >0 if OK
*/
- function backupTables($outputfile, $tables = '*')
+ public function backupTables($outputfile, $tables = '*')
{
global $db, $langs;
global $errormsg;
diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php
index cf19b43145d..fc240a88dcc 100644
--- a/htdocs/core/class/vcard.class.php
+++ b/htdocs/core/class/vcard.class.php
@@ -84,21 +84,21 @@ function dol_quoted_printable_encode($input, $line_max = 76)
*/
class vCard
{
- var $properties;
- var $filename;
+ public $properties;
+ public $filename;
//var $encoding="UTF-8";
- var $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
+ public $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
/**
- * mise en forme du numero de telephone
+ * mise en forme du numero de telephone
*
- * @param int $number numero de telephone
- * @param string $type Type
- * @return void
+ * @param int $number numero de telephone
+ * @param string $type Type
+ * @return void
*/
- function setPhoneNumber($number, $type = "")
+ public function setPhoneNumber($number, $type = "")
{
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
$key = "TEL";
@@ -115,7 +115,7 @@ class vCard
* @param string $photo Photo
* @return void
*/
- function setPhoto($type, $photo)
+ public function setPhoto($type, $photo)
{
// $type = "GIF" | "JPEG"
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
@@ -127,7 +127,7 @@ class vCard
* @param string $name Name
* @return void
*/
- function setFormattedName($name)
+ public function setFormattedName($name)
{
$this->properties["FN;CHARSET=".$this->encoding] = encode($name);
}
@@ -142,7 +142,7 @@ class vCard
* @param string $suffix Suffix
* @return void
*/
- function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "")
+ public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "")
{
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->filename = "$first%20$family.vcf";
@@ -155,7 +155,7 @@ class vCard
* @param timestamp $date Date
* @return void
*/
- function setBirthday($date)
+ public function setBirthday($date)
{
// $date format is YYYY-MM-DD - RFC 2425 and RFC 2426
$this->properties["BDAY"] = dol_print_date($date, 'dayrfc');
@@ -174,7 +174,7 @@ class vCard
* @param string $type Type
* @return void
*/
- function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
+ public function setAddress($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
{
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key = "ADR";
@@ -189,19 +189,19 @@ class vCard
}
/**
- * mise en forme du label
+ * mise en forme du label
*
- * @param string $postoffice Postoffice
- * @param string $extended Extended
- * @param string $street Street
- * @param string $city City
- * @param string $region Region
- * @param string $zip Zip
- * @param string $country Country
- * @param string $type Type
- * @return void
+ * @param string $postoffice Postoffice
+ * @param string $extended Extended
+ * @param string $street Street
+ * @param string $city City
+ * @param string $region Region
+ * @param string $zip Zip
+ * @param string $country Country
+ * @param string $type Type
+ * @return void
*/
- function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
+ public function setLabel($postoffice = "", $extended = "", $street = "", $city = "", $region = "", $zip = "", $country = "", $type = "HOME;POSTAL")
{
$label = "";
if ($postoffice!="") $label.= "$postoffice\r\n";
@@ -222,7 +222,7 @@ class vCard
* @param string $type Vcard type
* @return void
*/
- function setEmail($address, $type = "internet,pref")
+ public function setEmail($address, $type = "internet,pref")
{
$this->properties["EMAIL;TYPE=".$type] = $address;
}
@@ -233,7 +233,7 @@ class vCard
* @param string $note Note
* @return void
*/
- function setNote($note)
+ public function setNote($note)
{
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
}
@@ -244,19 +244,19 @@ class vCard
* @param string $title Title
* @return void
*/
- function setTitle($title)
+ public function setTitle($title)
{
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
}
/**
- * mise en forme de la societe
+ * mise en forme de la societe
*
- * @param string $org Org
- * @return void
+ * @param string $org Org
+ * @return void
*/
- function setOrg($org)
+ public function setOrg($org)
{
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
}
@@ -268,7 +268,7 @@ class vCard
* @param string $prodid Prodid
* @return void
*/
- function setProdId($prodid)
+ public function setProdId($prodid)
{
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
}
@@ -280,7 +280,7 @@ class vCard
* @param string $uid Uid
* @return void
*/
- function setUID($uid)
+ public function setUID($uid)
{
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
}
@@ -293,7 +293,7 @@ class vCard
* @param string $type Type
* @return void
*/
- function setURL($url, $type = "")
+ public function setURL($url, $type = "")
{
// $type may be WORK | HOME
$key = "URL";
@@ -306,7 +306,7 @@ class vCard
*
* @return string
*/
- function getVCard()
+ public function getVCard()
{
$text = "BEGIN:VCARD\r\n";
$text.= "VERSION:3.0\r\n";
@@ -326,7 +326,7 @@ class vCard
*
* @return string Filename
*/
- function getFileName()
+ public function getFileName()
{
return $this->filename;
}
diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php
index e62692b233a..75a6fa14ec1 100644
--- a/htdocs/core/db/Database.interface.php
+++ b/htdocs/core/db/Database.interface.php
@@ -33,16 +33,16 @@ interface Database
* @param string $resko resultat si test non egal
* @return string SQL string
*/
- function ifsql($test, $resok, $resko);
+ public function ifsql($test, $resok, $resko);
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
*/
- function fetch_row($resultset);
+ public function fetch_row($resultset);
// phpcs:enable
/**
@@ -52,23 +52,23 @@ interface Database
* @param int $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
- function idate($param);
+ public function idate($param);
/**
* Return last error code
*
* @return string lasterrno
*/
- function lasterrno();
+ public function lasterrno();
/**
* Start transaction
*
* @return int 1 if transaction successfuly opened or already opened, 0 if error
*/
- function begin();
+ public function begin();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -80,7 +80,7 @@ interface Database
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '');
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '');
// phpcs:enable
/**
@@ -88,7 +88,7 @@ interface Database
*
* @return array Version array
*/
- function getVersionArray();
+ public function getVersionArray();
/**
* Convert a SQL request in Mysql syntax to native syntax
@@ -97,9 +97,9 @@ interface Database
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'ddl');
+ public static function convertSQLFromMysql($line, $type = 'ddl');
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -107,7 +107,7 @@ interface Database
* @return int Nombre de lignes
* @see num_rows
*/
- function affected_rows($resultset);
+ public function affected_rows($resultset);
// phpcs:enable
/**
@@ -115,9 +115,9 @@ interface Database
*
* @return string Error text
*/
- function error();
+ public function error();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -125,7 +125,7 @@ interface Database
* @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '');
+ public function DDLListTables($database, $table = '');
// phpcs:enable
/**
@@ -133,7 +133,7 @@ interface Database
*
* @return string Last query
*/
- function lastquery();
+ public function lastquery();
/**
* Define sort criteria of request
@@ -142,7 +142,7 @@ interface Database
* @param string $sortorder Sort order
* @return string String to provide syntax of a sort sql string
*/
- function order($sortfield = null, $sortorder = null);
+ public function order($sortfield = null, $sortorder = null);
/**
* Decrypt sensitive data in database
@@ -150,16 +150,16 @@ interface Database
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value);
+ public function decrypt($value);
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
*/
- function fetch_array($resultset);
+ public function fetch_array($resultset);
// phpcs:enable
/**
@@ -167,7 +167,7 @@ interface Database
*
* @return string lasterror
*/
- function lasterror();
+ public function lasterror();
/**
* Escape a string to insert data
@@ -175,9 +175,9 @@ interface Database
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode);
+ public function escape($stringtoencode);
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -185,7 +185,7 @@ interface Database
* @param string $fieldid Field name
* @return int Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid');
+ public function last_insert_id($tab, $fieldid = 'rowid');
// phpcs:enable
/**
@@ -193,7 +193,7 @@ interface Database
*
* @return string Full path of restore program
*/
- function getPathOfRestore();
+ public function getPathOfRestore();
/**
* Annulation d'une transaction et retour aux anciennes valeurs
@@ -201,7 +201,7 @@ interface Database
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
- function rollback($log = '');
+ public function rollback($log = '');
/**
* Execute a SQL request and return the resultset
@@ -212,7 +212,7 @@ interface Database
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto');
+ public function query($query, $usesavepoint = 0, $type = 'auto');
/**
* Connexion to server
@@ -225,7 +225,7 @@ interface Database
* @return resource Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0);
+ public function connect($host, $login, $passwd, $name, $port = 0);
/**
* Define limits and offset of request
@@ -234,7 +234,7 @@ interface Database
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
- function plimit($limit = 0, $offset = 0);
+ public function plimit($limit = 0, $offset = 0);
/**
* Return value of server parameters
@@ -242,7 +242,7 @@ interface Database
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '');
+ public function getServerParametersValues($filter = '');
/**
* Return value of server status
@@ -250,16 +250,16 @@ interface Database
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '');
+ public function getServerStatusValues($filter = '');
/**
* Return collation used in database
*
* @return string Collation value
*/
- function getDefaultCollationDatabase();
+ public function getDefaultCollationDatabase();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -267,7 +267,7 @@ interface Database
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset);
+ public function num_rows($resultset);
// phpcs:enable
/**
@@ -275,23 +275,23 @@ interface Database
*
* @return string Full path of dump program
*/
- function getPathOfDump();
+ public function getPathOfDump();
/**
* Return version of database client driver
*
* @return string Version string
*/
- function getDriverInfo();
+ public function getDriverInfo();
/**
* Return generic error code of last operation.
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno();
+ public function errno();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -304,17 +304,17 @@ interface Database
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null);
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null);
// phpcs:enable
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table);
+ public function DDLDropTable($table);
// phpcs:enable
/**
@@ -322,9 +322,9 @@ interface Database
*
* @return array List of Charset
*/
- function getListOfCharacterSet();
+ public function getListOfCharacterSet();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -334,10 +334,10 @@ interface Database
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "");
+ public function DDLAddField($table, $field_name, $field_desc, $field_position = "");
// phpcs:enable
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -345,10 +345,10 @@ interface Database
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name);
+ public function DDLDropField($table, $field_name);
// phpcs:enable
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -357,7 +357,7 @@ interface Database
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc);
+ public function DDLUpdateField($table, $field_name, $field_desc);
// phpcs:enable
/**
@@ -365,9 +365,9 @@ interface Database
*
* @return array List of Collation
*/
- function getListOfCollation();
+ public function getListOfCollation();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -375,7 +375,7 @@ interface Database
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resource
*/
- function DDLDescTable($table, $field = "");
+ public function DDLDescTable($table, $field = "");
// phpcs:enable
/**
@@ -383,16 +383,16 @@ interface Database
*
* @return string Version string
*/
- function getVersion();
+ public function getVersion();
/**
* Return charset used to store data in database
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase();
+ public function getDefaultCharacterSetDatabase();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -400,13 +400,13 @@ interface Database
* @param string $dolibarr_main_db_user Nom user a creer
* @param string $dolibarr_main_db_pass Mot de passe user a creer
* @param string $dolibarr_main_db_name Database name where user must be granted
- * @return int <0 if KO, >=0 if OK
- */
- function DDLCreateUser(
- $dolibarr_main_db_host,
- $dolibarr_main_db_user,
- $dolibarr_main_db_pass,
- $dolibarr_main_db_name
+ * @return int <0 if KO, >=0 if OK
+ */
+ public function DDLCreateUser(
+ $dolibarr_main_db_host,
+ $dolibarr_main_db_user,
+ $dolibarr_main_db_pass,
+ $dolibarr_main_db_name
);
// phpcs:enable
@@ -419,7 +419,7 @@ interface Database
* @param bool $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return int|string Date TMS or ''
*/
- function jdate($string, $gm = false);
+ public function jdate($string, $gm = false);
/**
* Encrypt sensitive data in database
@@ -429,7 +429,7 @@ interface Database
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0);
+ public function encrypt($fieldorvalue, $withQuotes = 0);
/**
* Validate a database transaction
@@ -437,25 +437,25 @@ interface Database
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
- function commit($log = '');
+ public function commit($log = '');
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
* @param string $table Name of table
- * @return array Array with inforation on table
- */
- function DDLInfoTable($table);
+ * @return array Array with inforation on table
+ */
+ public function DDLInfoTable($table);
// phpcs:enable
- /**
+ /**
* Free last resultset used.
*
* @param resource $resultset Fre cursor
* @return void
*/
- function free($resultset = null);
+ public function free($resultset = null);
/**
* Close database connexion
@@ -463,41 +463,41 @@ interface Database
* @return boolean True if disconnect successfull, false otherwise
* @see connect
*/
- function close();
+ public function close();
/**
* Return last query in error
*
* @return string lastqueryerror
*/
- function lastqueryerror();
+ public function lastqueryerror();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId();
+ public function DDLGetConnectId();
// phpcs:enable
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param resource $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
*/
- function fetch_object($resultset);
+ public function fetch_object($resultset);
// phpcs:enable
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database);
+ public function select_db($database);
// phpcs:enable
}
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index ae61e35489d..575cf2256ef 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -75,7 +75,7 @@ abstract class DoliDB implements Database
* @param string $resko resultat si test non egal
* @return string SQL string
*/
- function ifsql($test, $resok, $resko)
+ public function ifsql($test, $resok, $resko)
{
return 'IF('.$test.','.$resok.','.$resko.')';
}
@@ -87,7 +87,7 @@ abstract class DoliDB implements Database
* @param int $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/
- function idate($param)
+ public function idate($param)
{
// TODO GMT $param should be gmt, so we should add tzouptut to 'gmt'
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
@@ -98,7 +98,7 @@ abstract class DoliDB implements Database
*
* @return string lasterrno
*/
- function lasterrno()
+ public function lasterrno()
{
return $this->lasterrno;
}
@@ -108,7 +108,7 @@ abstract class DoliDB implements Database
*
* @return int 1 if transaction successfuly opened or already opened, 0 if error
*/
- function begin()
+ public function begin()
{
if (! $this->transaction_opened)
{
@@ -135,7 +135,7 @@ abstract class DoliDB implements Database
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
*/
- function commit($log = '')
+ public function commit($log = '')
{
dol_syslog('', 0, -1);
if ($this->transaction_opened<=1)
@@ -165,7 +165,7 @@ abstract class DoliDB implements Database
* @param string $log Add more log to default log line
* @return resource|int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/
- function rollback($log = '')
+ public function rollback($log = '')
{
dol_syslog('', 0, -1);
if ($this->transaction_opened<=1)
@@ -189,7 +189,7 @@ abstract class DoliDB implements Database
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
- function plimit($limit = 0, $offset = 0)
+ public function plimit($limit = 0, $offset = 0)
{
global $conf;
if (empty($limit)) return "";
@@ -203,7 +203,7 @@ abstract class DoliDB implements Database
*
* @return array Version array
*/
- function getVersionArray()
+ public function getVersionArray()
{
return preg_split("/[\.,-]/", $this->getVersion());
}
@@ -213,7 +213,7 @@ abstract class DoliDB implements Database
*
* @return string Last query
*/
- function lastquery()
+ public function lastquery()
{
return $this->lastquery;
}
@@ -225,7 +225,7 @@ abstract class DoliDB implements Database
* @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC';
* @return string String to provide syntax of a sort sql string
*/
- function order($sortfield = null, $sortorder = null)
+ public function order($sortfield = null, $sortorder = null)
{
if (! empty($sortfield))
{
@@ -264,7 +264,7 @@ abstract class DoliDB implements Database
*
* @return string Last error
*/
- function lasterror()
+ public function lasterror()
{
return $this->lasterror;
}
@@ -278,7 +278,7 @@ abstract class DoliDB implements Database
* @param bool $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return int|string Date TMS or ''
*/
- function jdate($string, $gm = false)
+ public function jdate($string, $gm = false)
{
// TODO GMT must set param gm to true by default
if ($string==0 || $string=="0000-00-00 00:00:00") return '';
@@ -293,7 +293,7 @@ abstract class DoliDB implements Database
*
* @return string lastqueryerror
*/
- function lastqueryerror()
+ public function lastqueryerror()
{
return $this->lastqueryerror;
}
diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php
index a49ef7f6294..4c95098813d 100644
--- a/htdocs/core/db/mssql.class.php
+++ b/htdocs/core/db/mssql.class.php
@@ -36,9 +36,9 @@ class DoliDBMssql extends DoliDB
//! Database label
const LABEL='MSSQL';
//! Charset used to force charset when creating database
- var $forcecharset='latin1'; // Can't be static as it may be forced with a dynamic value
+ public $forcecharset='latin1'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
- var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
+ public $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN='2000';
/** @var resource Resultset of last query */
@@ -55,7 +55,7 @@ class DoliDBMssql extends DoliDB
* @param string $name Nom de la database
* @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $langs;
@@ -134,19 +134,19 @@ class DoliDBMssql extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'ddl')
+ public static function convertSQLFromMysql($line, $type = 'ddl')
{
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
return @mssql_select_db($database, $this->db);
@@ -163,7 +163,7 @@ class DoliDBMssql extends DoliDB
* @return false|resource|true Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name");
$newhost=$host;
@@ -191,7 +191,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
$resql=$this->query("SELECT @@VERSION");
if ($resql)
@@ -207,7 +207,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return 'php mssql driver';
}
@@ -218,7 +218,7 @@ class DoliDBMssql extends DoliDB
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -235,7 +235,7 @@ class DoliDBMssql extends DoliDB
*
* @return bool true if transaction successfuly opened or already opened, false if error
*/
- function begin()
+ public function begin()
{
$res=mssql_query('select @@TRANCOUNT');
@@ -263,7 +263,7 @@ class DoliDBMssql extends DoliDB
* @param string $log Add more log to default log line
* @return bool true if validation is OK or transaction level no started, false if ERROR
*/
- function commit($log = '')
+ public function commit($log = '')
{
$res=mssql_query('select @@TRANCOUNT');
$this->transaction_opened=mssql_result($res, 0, 0);
@@ -296,7 +296,7 @@ class DoliDBMssql extends DoliDB
* @param string $log Add more log to default log line
* @return bool true si annulation ok ou transaction non ouverte, false en cas d'erreur
*/
- function rollback($log = '')
+ public function rollback($log = '')
{
$res=mssql_query('select @@TRANCOUNT');
$this->transaction_opened=mssql_result($res, 0, 0);
@@ -324,7 +324,7 @@ class DoliDBMssql extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return false|resource|true Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
$query = trim($query);
@@ -368,11 +368,11 @@ class DoliDBMssql extends DoliDB
}
else
{
- if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches))
- {
+ if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches))
+ {
$original_query=$query;
$query="ALTER TABLE [".$matches[1]."] ADD CONSTRAINT [".$matches[2]."] PRIMARY KEY CLUSTERED (".$matches[3].")";
- }
+ }
}
}
@@ -459,14 +459,14 @@ class DoliDBMssql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param resource $resultset Curseur de la requete voulue
* @return object|false Object result line or false if KO or end of cursor
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -474,14 +474,14 @@ class DoliDBMssql extends DoliDB
return mssql_fetch_object($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -490,14 +490,14 @@ class DoliDBMssql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -505,7 +505,7 @@ class DoliDBMssql extends DoliDB
return @mssql_fetch_row($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -513,7 +513,7 @@ class DoliDBMssql extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -521,7 +521,7 @@ class DoliDBMssql extends DoliDB
return mssql_num_rows($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -529,7 +529,7 @@ class DoliDBMssql extends DoliDB
* @return int Nombre de lignes
* @see num_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -548,7 +548,7 @@ class DoliDBMssql extends DoliDB
* @param resource $resultset Curseur de la requete voulue
* @return bool
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@@ -562,7 +562,7 @@ class DoliDBMssql extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return addslashes($stringtoencode);
}
@@ -575,7 +575,7 @@ class DoliDBMssql extends DoliDB
* @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/
- function idate($param)
+ public function idate($param)
{
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
}
@@ -585,7 +585,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected)
{
@@ -638,7 +638,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour mssql_get_last_message.
@@ -649,7 +649,7 @@ class DoliDBMssql extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -657,7 +657,7 @@ class DoliDBMssql extends DoliDB
* @param string $fieldid Field name
* @return int Id of row or -1 on error
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
$res = $this->query("SELECT @@IDENTITY as id");
@@ -679,7 +679,7 @@ class DoliDBMssql extends DoliDB
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -699,7 +699,7 @@ class DoliDBMssql extends DoliDB
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -714,13 +714,13 @@ class DoliDBMssql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
$resql=$this->query('SELECT CONNECTION_ID()');
@@ -732,7 +732,7 @@ class DoliDBMssql extends DoliDB
else return '?';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -744,7 +744,7 @@ class DoliDBMssql extends DoliDB
* @param string $owner Username of database owner
* @return false|resource|true resource defined if OK, false if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
/*if (empty($charset)) $charset=$this->forcecharset;
@@ -770,7 +770,7 @@ class DoliDBMssql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -778,21 +778,21 @@ class DoliDBMssql extends DoliDB
* @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$this->_results = mssql_list_tables($database, $this->db);
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
* @param string $table Name of table
* @return array Tableau des informations des champs de la table
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
@@ -804,7 +804,7 @@ class DoliDBMssql extends DoliDB
return $infotables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -817,7 +817,7 @@ class DoliDBMssql extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -885,14 +885,14 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -903,7 +903,7 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -911,7 +911,7 @@ class DoliDBMssql extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return false|resource|true Resource
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql="DESC ".$table." ".$field;
@@ -921,7 +921,7 @@ class DoliDBMssql extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -931,7 +931,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public function DDLAddField($table, $field_name, $field_desc, $field_position = "")
{
// phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
@@ -959,7 +959,7 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -968,7 +968,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -984,7 +984,7 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -992,7 +992,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@@ -1005,7 +1005,7 @@ class DoliDBMssql extends DoliDB
else return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -1015,7 +1015,7 @@ class DoliDBMssql extends DoliDB
* @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
{
// phpcs:enable
$sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'";
@@ -1059,7 +1059,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1072,7 +1072,7 @@ class DoliDBMssql extends DoliDB
*
* @return array List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1085,7 +1085,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Collation value
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
$resql=$this->query("SELECT SERVERPROPERTY('collation')");
if (!$resql)
@@ -1101,7 +1101,7 @@ class DoliDBMssql extends DoliDB
*
* @return array Liste of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1114,7 +1114,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1127,7 +1127,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1141,7 +1141,7 @@ class DoliDBMssql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
// FIXME: Dummy method
// TODO: Implement
@@ -1157,7 +1157,7 @@ class DoliDBMssql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
// FIXME: Dummy method
// TODO: Implement
@@ -1166,21 +1166,21 @@ class DoliDBMssql extends DoliDB
return array();
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Escape a field name according to escape's syntax
*
* @param string $fieldname Field's name to escape
* @return string field's name escaped
*/
- function EscapeFieldName($fieldname)
+ public function EscapeFieldName($fieldname)
{
// phpcs:enable
return "[".$fieldname."]";
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get information on field
*
@@ -1188,7 +1188,7 @@ class DoliDBMssql extends DoliDB
* @param mixed $fields String for one field or array of string for multiple field
* @return false|object
*/
- function GetFieldInformation($table, $fields)
+ public function GetFieldInformation($table, $fields)
{
// phpcs:enable
$sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME";
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 48a768bd365..6c3bfd2362f 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -54,7 +54,7 @@ class DoliDBMysqli extends DoliDB
* @param string $name Nom de la database
* @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $conf,$langs;
@@ -162,19 +162,19 @@ class DoliDBMysqli extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'ddl')
+ public static function convertSQLFromMysql($line, $type = 'ddl')
{
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
@@ -193,22 +193,22 @@ class DoliDBMysqli extends DoliDB
* @return mysqli Database access object
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
- {
+ public function connect($host, $login, $passwd, $name, $port = 0)
+ {
dol_syslog(get_class($this) . "::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name", LOG_DEBUG);
// Can also be
// mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
// return mysqli::real_connect($host, $user, $pass, $db, $port);
return new mysqli($host, $login, $passwd, $name, $port);
- }
+ }
/**
* Return version of database server
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
return $this->db->server_info;
}
@@ -218,10 +218,10 @@ class DoliDBMysqli extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
- {
- return $this->db->client_info;
- }
+ public function getDriverInfo()
+ {
+ return $this->db->client_info;
+ }
/**
@@ -230,7 +230,7 @@ class DoliDBMysqli extends DoliDB
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -250,7 +250,7 @@ class DoliDBMysqli extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return bool|mysqli_result Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
global $conf;
@@ -287,14 +287,14 @@ class DoliDBMysqli extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param mysqli_result $resultset Curseur de la requete voulue
* @return object|null Object result line or null if KO or end of cursor
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -303,14 +303,14 @@ class DoliDBMysqli extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param mysqli_result $resultset Resultset of request
* @return array|null Array or null if KO or end of cursor
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -318,14 +318,14 @@ class DoliDBMysqli extends DoliDB
return $resultset->fetch_array();
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param mysqli_result $resultset Resultset of request
* @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -341,7 +341,7 @@ class DoliDBMysqli extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -349,7 +349,7 @@ class DoliDBMysqli extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -357,7 +357,7 @@ class DoliDBMysqli extends DoliDB
return $resultset->num_rows;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -365,7 +365,7 @@ class DoliDBMysqli extends DoliDB
* @return int Nombre de lignes
* @see num_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -382,7 +382,7 @@ class DoliDBMysqli extends DoliDB
* @param mysqli_result $resultset Curseur de la requete voulue
* @return void
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@@ -396,7 +396,7 @@ class DoliDBMysqli extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return $this->db->real_escape_string($stringtoencode);
}
@@ -406,7 +406,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
@@ -457,7 +457,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour mysqli_error.
@@ -468,7 +468,7 @@ class DoliDBMysqli extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -476,7 +476,7 @@ class DoliDBMysqli extends DoliDB
* @param string $fieldid Field name
* @return int|string Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
return $this->db->insert_id;
@@ -491,7 +491,7 @@ class DoliDBMysqli extends DoliDB
* @return string XXX(field) or XXX('value') or field or 'value'
*
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -524,7 +524,7 @@ class DoliDBMysqli extends DoliDB
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -552,13 +552,13 @@ class DoliDBMysqli extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
$resql=$this->query('SELECT CONNECTION_ID()');
@@ -570,7 +570,7 @@ class DoliDBMysqli extends DoliDB
else return '?';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -582,7 +582,7 @@ class DoliDBMysqli extends DoliDB
* @param string $owner Username of database owner
* @return bool|mysqli_result resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
if (empty($charset)) $charset=$this->forcecharset;
@@ -604,7 +604,7 @@ class DoliDBMysqli extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -612,7 +612,7 @@ class DoliDBMysqli extends DoliDB
* @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$listtables=array();
@@ -632,14 +632,14 @@ class DoliDBMysqli extends DoliDB
return $listtables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
* @param string $table Name of table
* @return array Tableau des informations des champs de la table
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
$infotables=array();
@@ -658,7 +658,7 @@ class DoliDBMysqli extends DoliDB
return $infotables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -671,7 +671,7 @@ class DoliDBMysqli extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -742,14 +742,14 @@ class DoliDBMysqli extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -760,7 +760,7 @@ class DoliDBMysqli extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -768,7 +768,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return bool|mysqli_result Resultset x (x->Field, x->Type, ...)
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql="DESC ".$table." ".$field;
@@ -778,7 +778,7 @@ class DoliDBMysqli extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -788,7 +788,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public function DDLAddField($table, $field_name, $field_desc, $field_position = "")
{
// phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
@@ -830,7 +830,7 @@ class DoliDBMysqli extends DoliDB
return -1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -839,7 +839,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -877,7 +877,7 @@ class DoliDBMysqli extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -885,7 +885,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@@ -898,7 +898,7 @@ class DoliDBMysqli extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -908,7 +908,7 @@ class DoliDBMysqli extends DoliDB
* @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
{
// phpcs:enable
$sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'";
@@ -953,7 +953,7 @@ class DoliDBMysqli extends DoliDB
* @return string Charset
* @see getDefaultCollationDatabase
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
$resql=$this->query('SHOW VARIABLES LIKE \'character_set_database\'');
if (!$resql)
@@ -972,7 +972,7 @@ class DoliDBMysqli extends DoliDB
*
* @return array|null List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
$resql=$this->query('SHOW CHARSET');
$liste = array();
@@ -999,7 +999,7 @@ class DoliDBMysqli extends DoliDB
* @return string Collation value
* @see getDefaultCharacterSetDatabase
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
$resql=$this->query('SHOW VARIABLES LIKE \'collation_database\'');
if (!$resql)
@@ -1018,7 +1018,7 @@ class DoliDBMysqli extends DoliDB
*
* @return array|null Liste of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
$resql=$this->query('SHOW COLLATION');
$liste = array();
@@ -1043,7 +1043,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
$fullpathofdump='/pathtomysqldump/mysqldump';
@@ -1062,7 +1062,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
$fullpathofimport='/pathtomysql/mysql';
@@ -1082,7 +1082,7 @@ class DoliDBMysqli extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
$result=array();
@@ -1103,7 +1103,7 @@ class DoliDBMysqli extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
$result=array();
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 1145be1849b..6e72d9c435a 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -40,9 +40,9 @@ class DoliDBPgsql extends DoliDB
//! Database label
const LABEL='PostgreSQL'; // Label of manager
//! Charset
- var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
+ public $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
- var $forcecollate=''; // Can't be static as it may be forced with a dynamic value
+ public $forcecollate=''; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN='9.0.0'; // Version min database
/** @var resource Resultset of last query */
@@ -62,7 +62,7 @@ class DoliDBPgsql extends DoliDB
* @param string $name Nom de la database
* @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $conf,$langs;
@@ -150,7 +150,7 @@ class DoliDBPgsql extends DoliDB
* @param bool $unescapeslashquot Unescape slash quote with quote quote
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'auto', $unescapeslashquot = false)
+ public static function convertSQLFromMysql($line, $type = 'auto', $unescapeslashquot = false)
{
global $conf;
@@ -368,7 +368,7 @@ class DoliDBPgsql extends DoliDB
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
* Ici postgresql n'a aucune fonction equivalente de mysql_select_db
@@ -377,7 +377,7 @@ class DoliDBPgsql extends DoliDB
* @param string $database Name of database
* @return bool true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
if ($database == $this->database_name) {
@@ -398,7 +398,7 @@ class DoliDBPgsql extends DoliDB
* @return false|resource Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
// use pg_pconnect() instead of pg_connect() if you want to use persistent connection costing 1ms, instead of 30ms for non persistent
@@ -446,7 +446,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
$resql=$this->query('SHOW server_version');
if ($resql)
@@ -462,7 +462,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return 'pgsql php driver';
}
@@ -473,7 +473,7 @@ class DoliDBPgsql extends DoliDB
* @return boolean True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -492,7 +492,7 @@ class DoliDBPgsql extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return false|resource Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
global $conf;
@@ -554,14 +554,14 @@ class DoliDBPgsql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param resource $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -569,14 +569,14 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_object($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return false|array Array
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -584,14 +584,14 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_array($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return false|array Array
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -599,7 +599,7 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_row($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -607,7 +607,7 @@ class DoliDBPgsql extends DoliDB
* @return int Nb of lines, -1 on error
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -615,7 +615,7 @@ class DoliDBPgsql extends DoliDB
return pg_num_rows($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -623,7 +623,7 @@ class DoliDBPgsql extends DoliDB
* @return int Nb of lines
* @see num_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -640,7 +640,7 @@ class DoliDBPgsql extends DoliDB
* @param resource $resultset Result set of request
* @return void
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// If resultset not provided, we take the last used by connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@@ -656,7 +656,7 @@ class DoliDBPgsql extends DoliDB
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
- function plimit($limit = 0, $offset = 0)
+ public function plimit($limit = 0, $offset = 0)
{
global $conf;
if (empty($limit)) return "";
@@ -672,7 +672,7 @@ class DoliDBPgsql extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return pg_escape_string($stringtoencode);
}
@@ -684,7 +684,7 @@ class DoliDBPgsql extends DoliDB
* @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/
- function idate($param)
+ public function idate($param)
{
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
}
@@ -697,7 +697,7 @@ class DoliDBPgsql extends DoliDB
* @param string $resko resultat si test non egal
* @return string chaine formate SQL
*/
- function ifsql($test, $resok, $resko)
+ public function ifsql($test, $resok, $resko)
{
return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
}
@@ -707,7 +707,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
@@ -773,12 +773,12 @@ class DoliDBPgsql extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
return pg_last_error($this->db);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -786,7 +786,7 @@ class DoliDBPgsql extends DoliDB
* @param string $fieldid Field name
* @return string Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
//$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab);
@@ -809,7 +809,7 @@ class DoliDBPgsql extends DoliDB
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -830,7 +830,7 @@ class DoliDBPgsql extends DoliDB
* @param int $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -845,13 +845,13 @@ class DoliDBPgsql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
return '?';
@@ -859,7 +859,7 @@ class DoliDBPgsql extends DoliDB
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -871,7 +871,7 @@ class DoliDBPgsql extends DoliDB
* @param string $owner Username of database owner
* @return false|resource resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
if (empty($charset)) $charset=$this->forcecharset;
@@ -886,7 +886,7 @@ class DoliDBPgsql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -894,7 +894,7 @@ class DoliDBPgsql extends DoliDB
* @param string $table Name of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$listtables=array();
@@ -912,7 +912,7 @@ class DoliDBPgsql extends DoliDB
return $listtables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
@@ -920,7 +920,7 @@ class DoliDBPgsql extends DoliDB
* @return array Tableau des informations des champs de la table
*
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
$infotables=array();
@@ -954,7 +954,7 @@ class DoliDBPgsql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -967,7 +967,7 @@ class DoliDBPgsql extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -1035,14 +1035,14 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -1053,7 +1053,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user to connect to database
*
@@ -1063,7 +1063,7 @@ class DoliDBPgsql extends DoliDB
* @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
{
// phpcs:enable
// Note: using ' on user does not works with pgsql
@@ -1079,7 +1079,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -1087,7 +1087,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return false|resource Resultset x (x->attname)
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql ="SELECT attname FROM pg_attribute, pg_type WHERE typname = '".$table."' AND attrelid = typrelid";
@@ -1099,7 +1099,7 @@ class DoliDBPgsql extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -1109,7 +1109,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public function DDLAddField($table, $field_name, $field_desc, $field_position = "")
{
// phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
@@ -1140,7 +1140,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -1149,7 +1149,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -1185,7 +1185,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -1193,7 +1193,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
@@ -1211,7 +1211,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
$resql=$this->query('SHOW SERVER_ENCODING');
if ($resql)
@@ -1227,7 +1227,7 @@ class DoliDBPgsql extends DoliDB
*
* @return array List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
$resql=$this->query('SHOW SERVER_ENCODING');
$liste = array();
@@ -1252,7 +1252,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Collation value
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
$resql=$this->query('SHOW LC_COLLATE');
if ($resql)
@@ -1268,7 +1268,7 @@ class DoliDBPgsql extends DoliDB
*
* @return array Liste of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
$resql=$this->query('SHOW LC_COLLATE');
$liste = array();
@@ -1292,7 +1292,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
$fullpathofdump='/pathtopgdump/pg_dump';
@@ -1320,7 +1320,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
//$tool='pg_restore';
$tool='psql';
@@ -1352,7 +1352,7 @@ class DoliDBPgsql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
$result=array();
@@ -1373,7 +1373,7 @@ class DoliDBPgsql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
/* This is to return current running requests.
$sql='SELECT datname,procpid,current_query FROM pg_stat_activity ORDER BY procpid';
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index 1ff024d6c6f..5ed0a05ee2a 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -38,8 +38,8 @@ class DoliDBSqlite3 extends DoliDB
const LABEL='Sqlite3';
//! Version min database
const VERSIONMIN='3.0.0';
- /** @var SQLite3Result Resultset of last query */
- private $_results;
+ /** @var SQLite3Result Resultset of last query */
+ private $_results;
const WEEK_MONDAY_FIRST=1;
const WEEK_YEAR = 2;
@@ -47,17 +47,17 @@ class DoliDBSqlite3 extends DoliDB
/**
- * Constructor.
- * This create an opened connexion to a database server and eventually to a database
+ * Constructor.
+ * This create an opened connexion to a database server and eventually to a database
*
- * @param string $type Type of database (mysql, pgsql...)
- * @param string $host Address of database server
- * @param string $user Nom de l'utilisateur autorise
- * @param string $pass Mot de passe
- * @param string $name Nom de la database
- * @param int $port Port of database server
+ * @param string $type Type of database (mysql, pgsql...)
+ * @param string $host Address of database server
+ * @param string $user Nom de l'utilisateur autorise
+ * @param string $pass Mot de passe
+ * @param string $name Nom de la database
+ * @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $conf;
@@ -134,7 +134,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'ddl')
+ public static function convertSQLFromMysql($line, $type = 'ddl')
{
// Removed empty line if this is a comment line for SVN tagging
if (preg_match('/^--\s\$Id/i', $line)) {
@@ -295,14 +295,14 @@ class DoliDBSqlite3 extends DoliDB
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
@@ -323,7 +323,7 @@ class DoliDBSqlite3 extends DoliDB
* @return SQLite3 Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
global $main_data_dir;
@@ -356,7 +356,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
$tmp=$this->db->version();
return $tmp['versionString'];
@@ -367,7 +367,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return 'sqlite3 php driver';
}
@@ -379,7 +379,7 @@ class DoliDBSqlite3 extends DoliDB
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -401,7 +401,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return SQLite3Result Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
$ret=null;
$query = trim($query);
@@ -490,14 +490,14 @@ class DoliDBSqlite3 extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param SQLite3Result $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -511,14 +511,14 @@ class DoliDBSqlite3 extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -528,14 +528,14 @@ class DoliDBSqlite3 extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -551,7 +551,7 @@ class DoliDBSqlite3 extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -559,7 +559,7 @@ class DoliDBSqlite3 extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// FIXME: SQLite3Result does not have a queryString member
@@ -572,7 +572,7 @@ class DoliDBSqlite3 extends DoliDB
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -580,7 +580,7 @@ class DoliDBSqlite3 extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// FIXME: SQLite3Result does not have a queryString member
@@ -602,7 +602,7 @@ class DoliDBSqlite3 extends DoliDB
* @param SQLite3Result $resultset Curseur de la requete voulue
* @return void
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@@ -616,7 +616,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return Sqlite3::escapeString($stringtoencode);
}
@@ -626,7 +626,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
@@ -691,7 +691,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour sqlite_error.
@@ -702,7 +702,7 @@ class DoliDBSqlite3 extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -710,7 +710,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $fieldid Field name
* @return int Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
return $this->db->lastInsertRowId();
@@ -724,7 +724,7 @@ class DoliDBSqlite3 extends DoliDB
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -757,7 +757,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -785,20 +785,20 @@ class DoliDBSqlite3 extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
return '?';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -810,7 +810,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $owner Username of database owner
* @return SQLite3Result resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
if (empty($charset)) $charset=$this->forcecharset;
@@ -832,7 +832,7 @@ class DoliDBSqlite3 extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -840,7 +840,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $table Name of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$listtables=array();
@@ -860,7 +860,7 @@ class DoliDBSqlite3 extends DoliDB
return $listtables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
@@ -868,7 +868,7 @@ class DoliDBSqlite3 extends DoliDB
* @return array Tableau des informations des champs de la table
* TODO modify for sqlite
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
$infotables=array();
@@ -887,7 +887,7 @@ class DoliDBSqlite3 extends DoliDB
return $infotables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -900,7 +900,7 @@ class DoliDBSqlite3 extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -967,14 +967,14 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -985,7 +985,7 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -993,7 +993,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return SQLite3Result Resource
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql="DESC ".$table." ".$field;
@@ -1003,7 +1003,7 @@ class DoliDBSqlite3 extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -1013,7 +1013,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public function DDLAddField($table, $field_name, $field_desc, $field_position = "")
{
// phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra
@@ -1048,7 +1048,7 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -1057,7 +1057,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -1072,7 +1072,7 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -1080,7 +1080,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@@ -1094,7 +1094,7 @@ class DoliDBSqlite3 extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -1104,7 +1104,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
{
// phpcs:enable
$sql = "INSERT INTO user ";
@@ -1147,7 +1147,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
return 'UTF-8';
}
@@ -1157,7 +1157,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return array List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
$liste = array();
$i=0;
@@ -1171,7 +1171,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Collation value
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
return 'UTF-8';
}
@@ -1181,7 +1181,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return array List of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
$liste = array();
$i=0;
@@ -1195,7 +1195,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
// FIXME: not for SQLite
$fullpathofdump='/pathtomysqldump/mysqldump';
@@ -1215,7 +1215,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
// FIXME: not for SQLite
$fullpathofimport='/pathtomysql/mysql';
@@ -1236,7 +1236,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
$result=array();
static $pragmas;
@@ -1247,7 +1247,7 @@ class DoliDBSqlite3 extends DoliDB
$pragmas = array(
'application_id', 'auto_vacuum', 'automatic_index', 'busy_timeout', 'cache_size',
'cache_spill', 'case_sensitive_like', 'checkpoint_fullsync', 'collation_list',
- 'compile_options', 'data_version', /*'database_list',*/
+ 'compile_options', 'data_version', /*'database_list',*/
'defer_foreign_keys', 'encoding', 'foreign_key_check', 'freelist_count',
'full_column_names', 'fullsync', 'ingore_check_constraints', 'integrity_check',
'journal_mode', 'journal_size_limit', 'legacy_file_format', 'locking_mode',
@@ -1285,7 +1285,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
$result=array();
/*
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index cfa05289f4b..fd13eb2fd26 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -21,13 +21,13 @@
* \brief File that include javascript functions (included if option use_javascript activated)
*/
-if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
-if (! defined('NOLOGIN')) define('NOLOGIN',1);
-if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
-if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
-if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
+if (! defined('NOLOGIN')) define('NOLOGIN', 1);
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public');
@@ -159,4 +159,3 @@ print '
}
});
});'."\n";
-
diff --git a/htdocs/core/js/lib_gravatar.js.php b/htdocs/core/js/lib_gravatar.js.php
index dad6482460a..e1e900b6d00 100644
--- a/htdocs/core/js/lib_gravatar.js.php
+++ b/htdocs/core/js/lib_gravatar.js.php
@@ -22,16 +22,16 @@
* JQuery (providing object $) library must be loaded before this file.
*/
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
-if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
-if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
-if (! defined('NOLOGIN')) define('NOLOGIN',1);
-if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
-if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
-if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Not disabled cause need to do translations
+if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
+if (! defined('NOLOGIN')) define('NOLOGIN', 1);
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public');
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 5b909c6e148..07a47090792 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -24,13 +24,13 @@
* JQuery (providing object $) and JQuery-UI (providing $datepicker) libraries must be loaded before this file.
*/
-if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
-if (! defined('NOLOGIN')) define('NOLOGIN',1);
-if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
-if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
-if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
+if (! defined('NOLOGIN')) define('NOLOGIN', 1);
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public');
diff --git a/htdocs/core/js/timepicker.js.php b/htdocs/core/js/timepicker.js.php
index 38c450b8e23..6acabbaf421 100644
--- a/htdocs/core/js/timepicker.js.php
+++ b/htdocs/core/js/timepicker.js.php
@@ -21,13 +21,13 @@
* \brief File that include javascript functions for timepicker
*/
-if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
-if (! defined('NOLOGIN')) define('NOLOGIN',1);
-if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
-if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
-if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
+if (! defined('NOLOGIN')) define('NOLOGIN', 1);
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public');
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index d7d8ee5a5ee..690eb8ec7b9 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -377,7 +377,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
// select2 disabled for smartphones with standard browser.
// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
- if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone') return '';
+ if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone' && ! empty($conf->global->MAIN_DISALLOW_SELECT2_WITH_SMARTPHONE)) return '';
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
if (empty($conf->use_javascript_ajax)) return '';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index ae103839c90..2fee1782953 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1065,7 +1065,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
* @param array $links Array of tabs. Currently initialized by calling a function xxx_admin_prepare_head
* @param string $active Active tab name (document', 'info', 'ldap', ....)
* @param string $title Title
- * @param int $notab -1 or 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
+ * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
@@ -1083,7 +1083,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0
* @param array $links Array of tabs
* @param string $active Active tab name
* @param string $title Title
- * @param int $notab -1 or 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
+ * @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using dol_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
@@ -1232,7 +1232,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out.="\n";
- if (! $notab || $notab == -1) $out.="\n".''."\n";
+ if (! $notab || $notab == -1 || $notab == -2) $out.="\n".'
'."\n";
$parameters=array('tabname' => $active, 'out' => $out);
$reshook=$hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
@@ -2980,7 +2980,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithoutext, array(
'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
- 'note', 'sign-out', 'split', 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow',
+ 'note', 'sign-out', 'split', 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow',
'jabber','skype','twitter','facebook','linkedin'
)
)) {
@@ -3053,12 +3053,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-mail-forward';
$facolor = '#555';
}
- elseif ($pictowithoutext == '1uparrow') {
- $fakey = 'fa-caret-up';
- $marginleftonlyshort = 1;
- }
- elseif ($pictowithoutext == '1downarrow') {
- $fakey = 'fa-caret-down';
+ elseif (in_array($pictowithoutext, array('1uparrow', '1downarrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected'))) {
+ $convertarray=array('1uparrow'=>'caret-up', '1downarrow'=>'caret-down', '1leftarrow'=>'caret-left', '1rightarrow'=>'caret-right', '1uparrow_selected'=>'caret-up', '1downarrow_selected'=>'caret-down', '1leftarrow_selected'=>'caret-left', '1rightarrow_selected'=>'caret-right');
+ $fakey = 'fa-'.$convertarray[$pictowithoutext];
+ if (preg_match('/selected/', $pictowithoutext)) $facolor = '#888';
$marginleftonlyshort = 1;
}
elseif ($pictowithoutext == 'sign-out') {
@@ -6833,7 +6831,8 @@ function picto_from_langcode($codelang, $moreatt = '')
}
/**
- * Return default language from country code
+ * Return default language from country code.
+ * Return null if not found.
*
* @param string $countrycode Country code like 'US', 'FR', 'CA', ...
* @return string Value of locale like 'en_US', 'fr_FR', ...
@@ -6842,6 +6841,8 @@ function getLanguageCodeFromCountryCode($countrycode)
{
global $mysoc;
+ if (empty($countrycode)) return null;
+
if (strtoupper($countrycode) == 'MQ') return 'fr_CA';
if (strtoupper($countrycode) == 'SE') return 'sv_SE'; // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country
if (strtoupper($countrycode) == 'CH')
diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php
index f58d1b44dbf..4a8f61915b5 100644
--- a/htdocs/core/lib/json.lib.php
+++ b/htdocs/core/lib/json.lib.php
@@ -214,7 +214,7 @@ if (! function_exists('json_decode'))
* @param bool $assoc False return an object, true return an array
* @return mixed Object or Array
*/
- function json_decode($json, $assoc=false)
+ function json_decode($json, $assoc = false)
{
return dol_json_decode($json, $assoc);
}
@@ -229,7 +229,7 @@ if (! function_exists('json_decode'))
* @return mixed Object or Array or false on error
* @see json_decode()
*/
-function dol_json_decode($json, $assoc=false)
+function dol_json_decode($json, $assoc = false)
{
dol_syslog("For better performance, enable the native json in your PHP", LOG_WARNING);
@@ -242,8 +242,8 @@ function dol_json_decode($json, $assoc=false)
if (! $comment)
{
if (($json[$i] == '{') || ($json[$i] == '[')) $out.= 'array(';
- else if (($json[$i] == '}') || ($json[$i] == ']')) $out.= ')';
- else if ($json[$i] == ':') $out.= ' => ';
+ elseif (($json[$i] == '}') || ($json[$i] == ']')) $out.= ')';
+ elseif ($json[$i] == ':') $out.= ' => ';
else $out.=$json[$i];
}
else $out.= $json[$i];
@@ -282,8 +282,8 @@ function dol_json_decode($json, $assoc=false)
/**
* Return text according to type
*
- * @param string $val Value to decode
- * @return string Formated value
+ * @param string $val Value to decode
+ * @return string Formated value
*/
function _unval($val)
{
@@ -292,7 +292,7 @@ function _unval($val)
// single, escaped unicode character
$utf16 = chr(hexdec($reg[1])) . chr(hexdec($reg[2]));
$utf8 = utf162utf8($utf16);
- $val=preg_replace('/\\\u'.$reg[1].$reg[2].'/i',$utf8,$val);
+ $val=preg_replace('/\\\u'.$reg[1].$reg[2].'/i', $utf8, $val);
}
return $val;
}
@@ -310,7 +310,7 @@ function _unval($val)
function utf162utf8($utf16)
{
// oh please oh please oh please oh please oh please
- if(function_exists('mb_convert_encoding')) {
+ if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php
index 6495aced16d..74ecba32db5 100644
--- a/htdocs/core/menus/standard/auguria_menu.php
+++ b/htdocs/core/menus/standard/auguria_menu.php
@@ -32,15 +32,15 @@ class MenuManager
* @var DoliDB Database handler.
*/
public $db;
-
- var $type_user; // Put 0 for internal users, 1 for external users
- var $atarget=""; // To store default target to use onto links
- var $name="auguria";
- var $menu_array;
- var $menu_array_after;
+ public $type_user; // Put 0 for internal users, 1 for external users
+ public $atarget=""; // To store default target to use onto links
+ public $name="auguria";
- var $tabMenu;
+ public $menu_array;
+ public $menu_array_after;
+
+ public $tabMenu;
/**
@@ -49,7 +49,7 @@ class MenuManager
* @param DoliDB $db Database handler
* @param int $type_user Type of user
*/
- function __construct($db, $type_user)
+ public function __construct($db, $type_user)
{
$this->type_user=$type_user;
$this->db=$db;
@@ -63,7 +63,7 @@ class MenuManager
* @param string $forceleftmenu To force leftmenu to load
* @return void
*/
- function loadMenu($forcemainmenu = '', $forceleftmenu = '')
+ public function loadMenu($forcemainmenu = '', $forceleftmenu = '')
{
global $conf, $user, $langs;
@@ -123,7 +123,7 @@ class MenuManager
* @param array $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
*/
- function showmenu($mode, $moredata = null)
+ public function showmenu($mode, $moredata = null)
{
global $conf, $langs, $user;
diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php
index 61394df6126..2dea6a53c5d 100644
--- a/htdocs/core/menus/standard/eldy_menu.php
+++ b/htdocs/core/menus/standard/eldy_menu.php
@@ -32,14 +32,14 @@ class MenuManager
*/
public $db;
- var $type_user; // Put 0 for internal users, 1 for external users
- var $atarget=""; // To store default target to use onto links
- var $name="eldy";
+ public $type_user; // Put 0 for internal users, 1 for external users
+ public $atarget=""; // To store default target to use onto links
+ public $name="eldy";
- var $menu_array;
- var $menu_array_after;
+ public $menu_array;
+ public $menu_array_after;
- var $tabMenu;
+ public $tabMenu;
/**
@@ -48,7 +48,7 @@ class MenuManager
* @param DoliDB $db Database handler
* @param int $type_user Type of user
*/
- function __construct($db, $type_user)
+ public function __construct($db, $type_user)
{
$this->type_user=$type_user;
$this->db=$db;
@@ -62,7 +62,7 @@ class MenuManager
* @param string $forceleftmenu To force leftmenu to load
* @return void
*/
- function loadMenu($forcemainmenu = '', $forceleftmenu = '')
+ public function loadMenu($forcemainmenu = '', $forceleftmenu = '')
{
// On sauve en session le menu principal choisi
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
@@ -123,7 +123,7 @@ class MenuManager
* @param array $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
*/
- function showmenu($mode, $moredata = null)
+ public function showmenu($mode, $moredata = null)
{
global $conf, $langs, $user;
diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php
index 643de2ebd71..c0ddb924a31 100644
--- a/htdocs/core/menus/standard/empty.php
+++ b/htdocs/core/menus/standard/empty.php
@@ -30,11 +30,11 @@ class MenuManager
*/
public $db;
- var $type_user=0; // Put 0 for internal users, 1 for external users
- var $atarget=""; // To store default target to use onto links
+ public $type_user=0; // Put 0 for internal users, 1 for external users
+ public $atarget=""; // To store default target to use onto links
- var $menu;
- var $menu_array_after;
+ public $menu;
+ public $menu_array_after;
/**
@@ -43,7 +43,7 @@ class MenuManager
* @param DoliDB $db Database handler
* @param int $type_user Type of user
*/
- function __construct($db, $type_user)
+ public function __construct($db, $type_user)
{
$this->type_user=$type_user;
$this->db=$db;
@@ -55,7 +55,7 @@ class MenuManager
*
* @return void
*/
- function loadMenu()
+ public function loadMenu()
{
}
@@ -67,7 +67,7 @@ class MenuManager
* @param array $moredata An array with more data to output
* @return int 0 or nb of top menu entries if $mode = 'topnb'
*/
- function showmenu($mode, $moredata = null)
+ public function showmenu($mode, $moredata = null)
{
global $user,$conf,$langs,$dolibarr_main_db_name;
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index 76033d4c0cb..2e9af363d08 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -7,6 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2014 Raphaël Doursenaud
* Copyright (C) 2018 Josep Lluís Amador
+ * Copyright (C) 2019 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -334,7 +335,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin;
@@ -369,6 +370,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// We need constructor into function unActivateModule into admin.lib.php
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Enables a module.
* Inserts all informations into database
@@ -381,47 +383,57 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int 1 if OK, 0 if KO
*/
- function _init($array_sql, $options = '')
+ protected function _init($array_sql, $options = '')
{
+ // phpcs:enable
global $conf;
$err=0;
$this->db->begin();
// Insert activation module constant
- if (! $err) { $err+=$this->_active();
+ if (! $err) {
+ $err+=$this->_active();
}
// Insert new pages for tabs (into llx_const)
- if (! $err) { $err+=$this->insert_tabs();
+ if (! $err) {
+ $err+=$this->insert_tabs();
}
// Insert activation of module's parts
- if (! $err) { $err+=$this->insert_module_parts();
+ if (! $err) {
+ $err+=$this->insert_module_parts();
}
// Insert constant defined by modules (into llx_const)
- if (! $err && ! preg_match('/newboxdefonly/', $options)) { $err+=$this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
+ if (! $err && ! preg_match('/newboxdefonly/', $options)) {
+ $err+=$this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
}
// Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes)
- if (! $err && ! preg_match('/noboxes/', $options)) { $err+=$this->insert_boxes($options);
+ if (! $err && ! preg_match('/noboxes/', $options)) {
+ $err+=$this->insert_boxes($options);
}
// Insert cron job entries (entry in llx_cronjobs)
- if (! $err) { $err+=$this->insert_cronjobs();
+ if (! $err) {
+ $err+=$this->insert_cronjobs();
}
// Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user.
- if (! $err) { $err+=$this->insert_permissions(1, null, 1);
+ if (! $err) {
+ $err+=$this->insert_permissions(1, null, 1);
}
// Insert specific menus entries into database
- if (! $err) { $err+=$this->insert_menus();
+ if (! $err) {
+ $err+=$this->insert_menus();
}
// Create module's directories
- if (! $err) { $err+=$this->create_dirs();
+ if (! $err) {
+ $err+=$this->create_dirs();
}
// Execute addons requests
@@ -466,6 +478,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Disable function. Deletes the module constants and boxes from the database.
*
@@ -474,46 +487,56 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int 1 if OK, 0 if KO
*/
- function _remove($array_sql, $options = '')
+ protected function _remove($array_sql, $options = '')
{
+ // phpcs:enable
$err=0;
$this->db->begin();
// Remove activation module line (constant MAIN_MODULE_MYMODULE in llx_const)
- if (! $err) { $err+=$this->_unactive();
+ if (! $err) {
+ $err+=$this->_unactive();
}
// Remove activation of module's new tabs (MAIN_MODULE_MYMODULE_TABS_XXX in llx_const)
- if (! $err) { $err+=$this->delete_tabs();
+ if (! $err) {
+ $err+=$this->delete_tabs();
}
// Remove activation of module's parts (MAIN_MODULE_MYMODULE_XXX in llx_const)
- if (! $err) { $err+=$this->delete_module_parts();
+ if (! $err) {
+ $err+=$this->delete_module_parts();
}
// Remove constants defined by modules
- if (! $err) { $err+=$this->delete_const();
+ if (! $err) {
+ $err+=$this->delete_const();
}
// Remove list of module's available boxes (entry in llx_boxes)
- if (! $err && ! preg_match('/(newboxdefonly|noboxes)/', $options)) { $err+=$this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
+ if (! $err && ! preg_match('/(newboxdefonly|noboxes)/', $options)) {
+ $err+=$this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
}
// Remove list of module's cron job entries (entry in llx_cronjobs)
- if (! $err) { $err+=$this->delete_cronjobs();
+ if (! $err) {
+ $err+=$this->delete_cronjobs();
}
// Remove module's permissions from list of available permissions (entries in llx_rights_def)
- if (! $err) { $err+=$this->delete_permissions();
+ if (! $err) {
+ $err+=$this->delete_permissions();
}
// Remove module's menus (entries in llx_menu)
- if (! $err) { $err+=$this->delete_menus();
+ if (! $err) {
+ $err+=$this->delete_menus();
}
// Remove module's directories
- if (! $err) { $err+=$this->delete_dirs();
+ if (! $err) {
+ $err+=$this->delete_dirs();
}
// Run complementary sql requests
@@ -549,7 +572,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated module name
*/
- function getName()
+ public function getName()
{
global $langs;
$langs->load("admin");
@@ -585,7 +608,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated module description
*/
- function getDesc()
+ public function getDesc()
{
global $langs;
$langs->load("admin");
@@ -621,7 +644,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Long description of a module from README.md of from property.
*/
- function getDescLong()
+ public function getDescLong()
{
global $langs;
$langs->load("admin");
@@ -639,11 +662,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
$content = dolMd2Html(
- $content, 'parsedown',
+ $content,
+ 'parsedown',
array(
- 'doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1),
- 'img/'=>dol_buildpath(strtolower($this->name).'/img/', 1),
- 'images/'=>dol_buildpath(strtolower($this->name).'/imgages/', 1),
+ 'doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1),
+ 'img/' => dol_buildpath(strtolower($this->name).'/img/', 1),
+ 'images/' => dol_buildpath(strtolower($this->name).'/imgages/', 1),
)
);
}
@@ -652,8 +676,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$content = nl2br($content);
}
}
- else // Mostly for internal modules
+ else
{
+ // Mostly for internal modules
if (! empty($this->descriptionlong)) {
if (is_array($this->langfiles)) {
foreach($this->langfiles as $val)
@@ -675,7 +700,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Path of file if a README file was found.
*/
- function getDescLongReadmeFound()
+ public function getDescLongReadmeFound()
{
global $langs;
@@ -710,7 +735,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Content of ChangeLog
*/
- function getChangeLog()
+ public function getChangeLog()
{
global $langs;
$langs->load("admin");
@@ -755,7 +780,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Publisher name
*/
- function getPublisher()
+ public function getPublisher()
{
return $this->editor_name;
}
@@ -765,7 +790,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Publisher url
*/
- function getPublisherUrl()
+ public function getPublisherUrl()
{
return $this->editor_url;
}
@@ -778,7 +803,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated
* @return string Module version
*/
- function getVersion($translated = 1)
+ public function getVersion($translated = 1)
{
global $langs;
$langs->load("admin");
@@ -786,14 +811,20 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$ret='';
$newversion=preg_replace('/_deprecated/', '', $this->version);
- if ($newversion == 'experimental') { $ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
- } elseif ($newversion == 'development') { $ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
- } elseif ($newversion == 'dolibarr') { $ret=DOL_VERSION;
- } elseif ($newversion) { $ret=$newversion;
- } else { $ret=($translated?$langs->transnoentitiesnoconv("VersionUnknown"):'unknown');
+ if ($newversion == 'experimental') {
+ $ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
+ } elseif ($newversion == 'development') {
+ $ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
+ } elseif ($newversion == 'dolibarr') {
+ $ret=DOL_VERSION;
+ } elseif ($newversion) {
+ $ret=$newversion;
+ } else {
+ $ret=($translated?$langs->transnoentitiesnoconv("VersionUnknown"):'unknown');
}
- if (preg_match('/_deprecated/', $this->version)) { $ret.=($translated?' ('.$langs->transnoentitiesnoconv("Deprecated").')':$this->version);
+ if (preg_match('/_deprecated/', $this->version)) {
+ $ret.=($translated?' ('.$langs->transnoentitiesnoconv("Deprecated").')':$this->version);
}
return $ret;
}
@@ -804,15 +835,19 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string 'core', 'external' or 'unknown'
*/
- function isCoreOrExternalModule()
+ public function isCoreOrExternalModule()
{
- if ($this->version == 'dolibarr' || $this->version == 'dolibarr_deprecated') { return 'core';
+ if ($this->version == 'dolibarr' || $this->version == 'dolibarr_deprecated') {
+ return 'core';
}
- if (! empty($this->version) && ! in_array($this->version, array('experimental','development'))) { return 'external';
+ if (! empty($this->version) && ! in_array($this->version, array('experimental','development'))) {
+ return 'external';
}
- if (! empty($this->editor_name) || ! empty($this->editor_url)) { return 'external';
+ if (! empty($this->editor_name) || ! empty($this->editor_url)) {
+ return 'external';
}
- if ($this->numero >= 100000) { return 'external';
+ if ($this->numero >= 100000) {
+ return 'external';
}
return 'unknown';
}
@@ -823,7 +858,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string[] Language files list
*/
- function getLangFilesArray()
+ public function getLangFilesArray()
{
return $this->langfiles;
}
@@ -835,7 +870,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated databaset label
*/
- function getExportDatasetLabel($r)
+ public function getExportDatasetLabel($r)
{
global $langs;
@@ -859,7 +894,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated dataset label
*/
- function getImportDatasetLabel($r)
+ public function getImportDatasetLabel($r)
{
global $langs;
@@ -882,7 +917,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return timestamp Date of last activation
*/
- function getLastActivationDate()
+ public function getLastActivationDate()
{
global $conf;
@@ -892,11 +927,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql);
- if (! $resql) { $err++;
- } else
- {
+ if (! $resql) {
+ $err++;
+ } else {
$obj=$this->db->fetch_object($resql);
- if ($obj) { return $this->db->jdate($obj->tms);
+ if ($obj) {
+ return $this->db->jdate($obj->tms);
}
}
@@ -909,7 +945,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return array Array array('authorid'=>Id of last activation user, 'lastactivationdate'=>Date of last activation)
*/
- function getLastActivationInfo()
+ public function getLastActivationInfo()
{
global $conf;
@@ -919,15 +955,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql);
- if (! $resql) { $err++;
- } else
- {
+ if (! $resql) {
+ $err++;
+ } else {
$obj=$this->db->fetch_object($resql);
$tmp=array();
if ($obj->note) {
$tmp=json_decode($obj->note, true);
}
- if ($obj) { return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
+ if ($obj) {
+ return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
}
}
@@ -940,7 +977,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
- function _active()
+ private function _active()
{
global $conf, $user;
@@ -955,7 +992,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
dol_syslog(get_class($this)."::_active delete activation constant", LOG_DEBUG);
$resql=$this->db->query($sql);
- if (! $resql) { $err++;
+ if (! $resql) {
+ $err++;
}
$note=json_encode(array('authorid'=>(is_object($user)?$user->id:0), 'ip'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])));
@@ -980,7 +1018,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
- function _unactive()
+ private function _unactive()
{
global $conf;
@@ -1000,7 +1038,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create tables and keys required by module.
* Files module.sql and module.key.sql with create table and create keys
@@ -1010,7 +1048,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* @param string $reldir Relative directory where to scan files
* @return int <=0 if KO, >0 if OK
*/
- function _load_tables($reldir)
+ private function _load_tables($reldir)
{
// phpcs:enable
global $conf;
@@ -1018,7 +1056,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$error=0;
$dirfound=0;
- if (empty($reldir)) { return 1;
+ if (empty($reldir)) {
+ return 1;
}
include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
@@ -1119,7 +1158,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds boxes
*
@@ -1127,7 +1166,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
- function insert_boxes($option = '')
+ public function insert_boxes($option = '')
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
@@ -1219,13 +1258,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes boxes
*
* @return int Error count (0 if OK)
*/
- function delete_boxes()
+ public function delete_boxes()
{
// phpcs:enable
global $conf;
@@ -1292,13 +1331,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds cronjobs
*
* @return int Error count (0 if OK)
*/
- function insert_cronjobs()
+ public function insert_cronjobs()
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
@@ -1332,13 +1371,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// Search if cron entry already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
- if ($class) { $sql.= " AND classesname = '".$this->db->escape($class)."'";
+ if ($class) {
+ $sql.= " AND classesname = '".$this->db->escape($class)."'";
}
- if ($objectname) { $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
+ if ($objectname) {
+ $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
}
- if ($method) { $sql.= " AND methodename = '".$this->db->escape($method)."'";
+ if ($method) {
+ $sql.= " AND methodename = '".$this->db->escape($method)."'";
}
- if ($command) { $sql.= " AND command = '".$this->db->escape($command)."'";
+ if ($command) {
+ $sql.= " AND command = '".$this->db->escape($command)."'";
}
$sql.= " AND entity = ".$entity; // Must be exact entity
@@ -1410,13 +1453,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes boxes
*
* @return int Error count (0 if OK)
*/
- function delete_cronjobs()
+ public function delete_cronjobs()
{
// phpcs:enable
global $conf;
@@ -1441,13 +1484,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes tabs
*
* @return int Error count (0 if OK)
*/
- function delete_tabs()
+ public function delete_tabs()
{
// phpcs:enable
global $conf;
@@ -1467,13 +1510,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds tabs
*
* @return int Error count (0 if ok)
*/
- function insert_tabs()
+ public function insert_tabs()
{
// phpcs:enable
global $conf;
@@ -1533,13 +1576,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds constants
*
* @return int Error count (0 if OK)
*/
- function insert_const()
+ public function insert_const()
{
// phpcs:enable
global $conf;
@@ -1605,13 +1648,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes constants tagged 'deleteonunactive'
*
* @return int <0 if KO, 0 if OK
*/
- function delete_const()
+ public function delete_const()
{
// phpcs:enable
global $conf;
@@ -1641,7 +1684,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds access rights
*
@@ -1650,7 +1693,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int Error count (0 if OK)
*/
- function insert_permissions($reinitadminperms = 0, $force_entity = null, $notrigger = 0)
+ public function insert_permissions($reinitadminperms = 0, $force_entity = null, $notrigger = 0)
{
// phpcs:enable
global $conf,$user;
@@ -1680,7 +1723,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$r_def = $this->rights[$key][3];
$r_perms = $this->rights[$key][4];
$r_subperms = isset($this->rights[$key][5])?$this->rights[$key][5]:'';
- $r_modul = empty($this->rights_class)?strtolower($this->name):$this->rights_class;
+ $r_modul = empty($this->rights_class)?strtolower($this->name):$this->rights_class;
if (empty($r_type)) { $r_type='w';
}
@@ -1788,13 +1831,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes access rights
*
* @return int Error count (0 if OK)
*/
- function delete_permissions()
+ public function delete_permissions()
{
// phpcs:enable
global $conf;
@@ -1814,13 +1857,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds menu entries
*
* @return int Error count (0 if OK)
*/
- function insert_menus()
+ public function insert_menus()
{
// phpcs:enable
global $user;
@@ -1918,13 +1961,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes menu entries
*
* @return int Error count (0 if OK)
*/
- function delete_menus()
+ public function delete_menus()
{
// phpcs:enable
global $conf;
@@ -1948,13 +1991,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Creates directories
*
* @return int Error count (0 if OK)
*/
- function create_dirs()
+ public function create_dirs()
{
// phpcs:enable
global $langs, $conf;
@@ -2008,7 +2051,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds directories definitions
*
@@ -2017,7 +2060,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
- function insert_dirs($name, $dir)
+ public function insert_dirs($name, $dir)
{
// phpcs:enable
global $conf;
@@ -2052,13 +2095,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes directories
*
* @return int Error count (0 if OK)
*/
- function delete_dirs()
+ public function delete_dirs()
{
// phpcs:enable
global $conf;
@@ -2078,13 +2121,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds generic parts
*
* @return int Error count (0 if OK)
*/
- function insert_module_parts()
+ public function insert_module_parts()
{
// phpcs:enable
global $conf;
@@ -2155,13 +2198,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $error;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes generic parts
*
* @return int Error count (0 if OK)
*/
- function delete_module_parts()
+ public function delete_module_parts()
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php
index 4b090b9b56f..104e1e37ae9 100644
--- a/htdocs/core/modules/action/modules_action.php
+++ b/htdocs/core/modules/action/modules_action.php
@@ -33,7 +33,7 @@ abstract class ModeleAction extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -41,7 +41,7 @@ abstract class ModeleAction extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php
index eaf71d9f8af..52b70caf47f 100644
--- a/htdocs/core/modules/action/rapport.pdf.php
+++ b/htdocs/core/modules/action/rapport.pdf.php
@@ -71,7 +71,7 @@ class CommActionRapport
* @param int $month Month
* @param int $year Year
*/
- function __construct($db, $month, $year)
+ public function __construct($db, $month, $year)
{
global $conf, $langs;
@@ -99,16 +99,16 @@ class CommActionRapport
$this->subject=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
* Write the object to document file to disk
*
* @param int $socid Thirdparty id
* @param int $catid Cat id
* @param Translate $outputlangs Lang object for output language
* @return int 1=OK, 0=KO
- */
- function write_file($socid = 0, $catid = 0, $outputlangs = '')
+ */
+ public function write_file($socid = 0, $catid = 0, $outputlangs = '')
{
// phpcs:enable
global $user,$conf,$langs,$hookmanager;
@@ -210,7 +210,7 @@ class CommActionRapport
* @param Translate $outputlangs Object langs
* @return int 1
*/
- function _pages(&$pdf, $outputlangs)
+ private function _pages(&$pdf, $outputlangs)
{
global $conf;
@@ -335,7 +335,7 @@ class CommActionRapport
* @param int $pagenb Page nb
* @return integer
*/
- function _pagehead(&$pdf, $outputlangs, $pagenb)
+ private function _pagehead(&$pdf, $outputlangs, $pagenb)
{
global $conf,$langs;
diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php
index 98f86e9a596..53a38eb70ed 100644
--- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php
+++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php
@@ -50,7 +50,7 @@ class pdf_ban extends ModeleBankAccountDoc
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -90,7 +90,7 @@ class pdf_ban extends ModeleBankAccountDoc
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
*
@@ -98,7 +98,7 @@ class pdf_ban extends ModeleBankAccountDoc
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs)
+ public function write_file($object, $outputlangs)
{
// phpcs:enable
global $conf, $hookmanager, $langs, $user;
@@ -288,7 +288,7 @@ class pdf_ban extends ModeleBankAccountDoc
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@@ -304,7 +304,7 @@ class pdf_ban extends ModeleBankAccountDoc
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@@ -390,7 +390,7 @@ class pdf_ban extends ModeleBankAccountDoc
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
index f61758abf92..bbd5858192c 100644
--- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
+++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
@@ -52,7 +52,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -92,7 +92,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
*
@@ -105,7 +105,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
* @param null|array $moreparams More parameters
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
// phpcs:enable
global $conf, $hookmanager, $langs, $user, $mysoc;
@@ -435,7 +435,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@@ -443,7 +443,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -453,7 +453,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
* @param Translate $outputlangs Langs object
* @return void
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf, $mysoc;
@@ -480,7 +480,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show area for the customer to sign
*
@@ -490,7 +490,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _signature_area(&$pdf, $object, $posy, $outputlangs)
+ private function _signature_area(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -531,7 +531,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@@ -623,7 +623,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php
index 8cdf2ba7ebe..f965e29ccce 100644
--- a/htdocs/core/modules/bank/modules_bank.php
+++ b/htdocs/core/modules/bank/modules_bank.php
@@ -37,7 +37,7 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -45,7 +45,7 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php
index cfbe51b0579..19744177e40 100644
--- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php
+++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php
@@ -49,7 +49,7 @@ class modPhpbarcode extends ModeleBarCode
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -60,7 +60,7 @@ class modPhpbarcode extends ModeleBarCode
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
@@ -76,7 +76,7 @@ class modPhpbarcode extends ModeleBarCode
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $langs;
@@ -90,7 +90,7 @@ class modPhpbarcode extends ModeleBarCode
* @param string $encoding Encoding norm
* @return int >0 if supported, 0 if not
*/
- function encodingIsSupported($encoding)
+ public function encodingIsSupported($encoding)
{
global $genbarcode_loc;
//print 'genbarcode_loc='.$genbarcode_loc.' encoding='.$encoding;exit;
@@ -100,8 +100,7 @@ class modPhpbarcode extends ModeleBarCode
if ($encoding == 'ISBN') $supported=1;
// Formats that hangs on Windows (when genbarcode.exe for Windows is called, so they are not
// 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 == 'UPC') $supported=1;
if ($encoding == 'C39') $supported=1;
@@ -120,7 +119,7 @@ class modPhpbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error
* @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 $conf;
@@ -161,7 +160,7 @@ class modPhpbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error
* @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;
diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
index f6eff1e2c5d..17793a5dfd4 100644
--- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
+++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
@@ -49,7 +49,7 @@ class modTcpdfbarcode extends ModeleBarCode
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
@@ -61,7 +61,7 @@ class modTcpdfbarcode extends ModeleBarCode
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -72,7 +72,7 @@ class modTcpdfbarcode extends ModeleBarCode
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $langs;
@@ -85,7 +85,7 @@ class modTcpdfbarcode extends ModeleBarCode
* @param string $encoding Encoding norm
* @return int >0 if supported, 0 if not
*/
- function encodingIsSupported($encoding)
+ public function encodingIsSupported($encoding)
{
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) {
@@ -105,7 +105,7 @@ class modTcpdfbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error (not used with this engine)
* @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;
@@ -152,7 +152,7 @@ class modTcpdfbarcode extends ModeleBarCode
* @param integer $nooutputiferror No output if error (not used with this engine)
* @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;
diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php
index 239a1683fad..936e7b87be4 100644
--- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php
+++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php
@@ -61,7 +61,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$this->code_null = 0;
$this->code_modifiable = 1;
@@ -77,7 +77,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param Translate $langs Object langs
* @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
global $conf, $mc;
global $form;
@@ -119,7 +119,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param Product $objproduct Object product
* @return string Return string example
*/
- function getExample($langs, $objproduct = 0)
+ public function getExample($langs, $objproduct = 0)
{
$examplebarcode = $this->getNextValue($objproduct, '');
if (! $examplebarcode)
@@ -142,7 +142,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
- function getNextValue($objproduct = null, $type = '')
+ public function getNextValue($objproduct = null, $type = '')
{
global $db,$conf;
@@ -184,7 +184,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
*/
- function verif($db, &$code, $product, $thirdparty_type, $type)
+ public function verif($db, &$code, $product, $thirdparty_type, $type)
{
global $conf;
@@ -235,7 +235,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return if a code is used (by other element)
*
@@ -244,7 +244,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param Product $product Objet product
* @return int 0 if available, <0 if KO
*/
- function verif_dispo($db, $code, $product)
+ public function verif_dispo($db, $code, $product)
{
// phpcs:enable
$sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product";
@@ -269,7 +269,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return if a barcode value match syntax
*
@@ -277,7 +277,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param string $typefortest Type of barcode (ISBN, EAN, ...)
* @return int 0 if OK, <0 if KO
*/
- function verif_syntax($codefortest, $typefortest)
+ public function verif_syntax($codefortest, $typefortest)
{
// phpcs:enable
global $conf;
@@ -296,15 +296,15 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
$newcodefortest=$codefortest;
- // Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
- if (in_array($typefortest, array('EAN13','ISBN'))) // We remove the CRC char not included into mask
- {
- if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg))
- {
- if (strlen($reg[1]) == 12) $newcodefortest=substr($newcodefortest, 0, 12);
- dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest);
- }
- }
+ // Special case, if mask is on 12 digits instead of 13, we remove last char into code to test
+ if (in_array($typefortest, array('EAN13','ISBN'))) // We remove the CRC char not included into mask
+ {
+ if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg))
+ {
+ if (strlen($reg[1]) == 12) $newcodefortest=substr($newcodefortest, 0, 12);
+ dol_syslog(get_class($this).'::verif_syntax newcodefortest='.$newcodefortest);
+ }
+ }
$result=check_value($mask, $newcodefortest);
if (is_string($result))
diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php
index 7e0eba53571..6a205b57d8c 100644
--- a/htdocs/core/modules/barcode/modules_barcode.class.php
+++ b/htdocs/core/modules/barcode/modules_barcode.class.php
@@ -29,21 +29,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
*/
abstract class ModeleBarCode
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- /**
- * Return if a model can be used or not
- *
- * @return boolean true if model can be used
- */
- function isEnabled()
- {
- return true;
- }
+ /**
+ * Return if a model can be used or not
+ *
+ * @return boolean true if model can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
}
@@ -52,17 +52,17 @@ abstract class ModeleBarCode
*/
abstract class ModeleNumRefBarCode
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
/** Return default description of numbering model
*
* @param Translate $langs Object langs
* @return string Descriptive text
*/
- function info($langs)
+ public function info($langs)
{
$langs->load("bills");
return $langs->trans("NoDescription");
@@ -73,7 +73,7 @@ abstract class ModeleNumRefBarCode
* @param Translate $langs Object langs
* @return string Model name
*/
- function getNom($langs)
+ public function getNom($langs)
{
return empty($this->name)?$this->nom:$this->name;
}
@@ -83,7 +83,7 @@ abstract class ModeleNumRefBarCode
* @param Translate $langs Object langs
* @return string Example
*/
- function getExample($langs)
+ public function getExample($langs)
{
$langs->load("bills");
return $langs->trans("NoExample");
@@ -96,17 +96,17 @@ abstract class ModeleNumRefBarCode
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value
*/
- function getNextValue($objproduct, $type = '')
+ public function getNextValue($objproduct, $type = '')
{
global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking");
}
- /** Return version of module
+ /** Return version of module
*
* @return string Version
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
@@ -126,7 +126,7 @@ abstract class ModeleNumRefBarCode
* @param int $type -1=Nothing, 0=Product, 1=Service
* @return string HTML translated description
*/
- function getToolTip($langs, $soc, $type)
+ public function getToolTip($langs, $soc, $type)
{
global $conf;
diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
index 999494ea6c3..80876747d59 100644
--- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
+++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
@@ -45,7 +45,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -78,7 +78,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$this->tab_height = 200; //$this->line_height * $this->line_per_page;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction to generate document on disk
*
@@ -88,7 +88,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko
*/
- function write_file($object, $_dir, $number, $outputlangs)
+ public function write_file($object, $_dir, $number, $outputlangs)
{
// phpcs:enable
global $user,$conf,$langs,$hookmanager;
@@ -209,7 +209,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Generate Header
*
@@ -219,7 +219,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* @param Translate $outputlangs Object language for output
* @return void
*/
- function Header(&$pdf, $page, $pages, $outputlangs)
+ public function Header(&$pdf, $page, $pages, $outputlangs)
{
// phpcs:enable
global $langs;
@@ -317,7 +317,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output array
*
@@ -327,7 +327,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* @param Translate $outputlangs Object lang
* @return void
*/
- function Body(&$pdf, $pagenb, $pages, $outputlangs)
+ public function Body(&$pdf, $pagenb, $pages, $outputlangs)
{
// phpcs:enable
// x=10 - Num
@@ -378,15 +378,15 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return void
+ * @param PDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return void
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php
index 0bdf6f0fc91..0183300c4ad 100644
--- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php
+++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php
@@ -25,7 +25,7 @@
require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php';
/**
- * Class to manage cheque receipts numbering rules Mint
+ * Class to manage cheque receipts numbering rules Mint
*/
class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
{
@@ -50,7 +50,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -62,7 +62,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -74,7 +74,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -109,7 +109,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -145,7 +145,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -153,7 +153,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function chequereceipt_get_num($objsoc, $objforref)
+ public function chequereceipt_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
index c978dbaa0f3..da1ec40620c 100644
--- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
+++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
@@ -49,7 +49,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -89,7 +89,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -112,7 +112,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -133,7 +133,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -141,7 +141,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function chequereceipt_get_num($objsoc, $objforref)
+ public function chequereceipt_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php
index d13384805d5..29fd071200a 100644
--- a/htdocs/core/modules/cheque/modules_chequereceipts.php
+++ b/htdocs/core/modules/cheque/modules_chequereceipts.php
@@ -46,7 +46,7 @@ abstract class ModeleNumRefChequeReceipts
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -56,7 +56,7 @@ abstract class ModeleNumRefChequeReceipts
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -68,7 +68,7 @@ abstract class ModeleNumRefChequeReceipts
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("bills");
@@ -80,7 +80,7 @@ abstract class ModeleNumRefChequeReceipts
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -92,7 +92,7 @@ abstract class ModeleNumRefChequeReceipts
* @param Object $object Object we need next value for
* @return string Valeur
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -103,7 +103,7 @@ abstract class ModeleNumRefChequeReceipts
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
@@ -127,7 +127,7 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -135,7 +135,7 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -154,7 +154,7 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
/**
- * Cree un bordereau remise de cheque
+ * Cree un bordereau remise de cheque
*
* @param DoliDB $db Database handler
* @param int $id Object invoice (or id of invoice)
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index 14f3c1fc862..d2f2ba9af07 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -63,7 +63,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -108,7 +108,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -191,9 +191,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Function to build a document on disk using the generic odt module.
+ * Function to build a document on disk using the generic odt module.
*
* @param Commande $object Object source to build document
* @param Translate $outputlangs Lang output object
@@ -203,7 +203,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -338,7 +338,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->commande->dir_temp,
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 5354e6bc2c7..ec8aa3978d9 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -68,7 +68,7 @@ class pdf_einstein extends ModelePDFCommandes
public $type;
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@@ -203,7 +203,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->atleastonediscount=0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -215,7 +215,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes;
@@ -652,7 +652,7 @@ class pdf_einstein extends ModelePDFCommandes
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
*
@@ -662,13 +662,13 @@ class pdf_einstein extends ModelePDFCommandes
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
- function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -678,7 +678,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param Translate $outputlangs Langs object
* @return void
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -855,18 +855,18 @@ class pdf_einstein extends ModelePDFCommandes
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
- * @param TCPDF $pdf Object PDF
+ * @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -1129,7 +1129,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1239,7 +1239,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param string $titlekey Translation key to show as title of document
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
{
global $conf,$langs,$hookmanager;
@@ -1450,7 +1450,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index 75db1887e4d..f7ce304b380 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -643,7 +643,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($pagenb == $pageposafter)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
- }
+ }
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
@@ -816,7 +816,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy=$pdf->GetY()+1;
- }
+ }
elseif ($object->availability_code || $object->availability) // Show availability conditions
{
$pdf->SetFont('', 'B', $default_font_size - 2);
@@ -831,7 +831,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
$posy=$pdf->GetY()+1;
- }
+ }
// Show payment mode
if ($object->mode_reglement_code
@@ -889,8 +889,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$posy=$pdf->GetY()+2;
}
}
- }
- }
+ }
+ }
// If payment mode not forced or forced to VIR, show payment with BAN
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
@@ -1672,5 +1672,5 @@ class pdf_eratosthene extends ModelePDFCommandes
{
$this->cols = $hookmanager->resArray;
}
- }
+ }
}
diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
index 66a5307cbfa..f10f858544f 100644
--- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
@@ -46,7 +46,7 @@ class pdf_proforma extends pdf_einstein
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -67,7 +67,7 @@ class pdf_proforma extends pdf_einstein
* @param string $titlekey Translation key to show as title of document
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
{
global $conf,$langs,$hookmanager;
diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php
index e888905b3be..b0b462e96dc 100644
--- a/htdocs/core/modules/commande/mod_commande_marbre.php
+++ b/htdocs/core/modules/commande/mod_commande_marbre.php
@@ -60,7 +60,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -72,7 +72,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -84,7 +84,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -119,7 +119,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -155,7 +155,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -163,7 +163,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function commande_get_num($objsoc, $objforref)
+ public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php
index bfe853996ce..373f1e01200 100644
--- a/htdocs/core/modules/commande/mod_commande_saphir.php
+++ b/htdocs/core/modules/commande/mod_commande_saphir.php
@@ -62,7 +62,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -102,7 +102,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -128,7 +128,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -151,7 +151,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -159,7 +159,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function commande_get_num($objsoc, $objforref)
+ public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php
index 6090ad35028..e0a0e454861 100644
--- a/htdocs/core/modules/commande/modules_commande.php
+++ b/htdocs/core/modules/commande/modules_commande.php
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
abstract class ModelePDFCommandes extends CommonDocGenerator
{
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -48,7 +48,7 @@ abstract class ModelePDFCommandes extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -82,7 +82,7 @@ abstract class ModeleNumRefCommandes
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -92,7 +92,7 @@ abstract class ModeleNumRefCommandes
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("orders");
@@ -104,7 +104,7 @@ abstract class ModeleNumRefCommandes
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("orders");
@@ -116,7 +116,7 @@ abstract class ModeleNumRefCommandes
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -128,7 +128,7 @@ abstract class ModeleNumRefCommandes
* @param Object $object Object we need next value for
* @return string Valeur
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -139,7 +139,7 @@ abstract class ModeleNumRefCommandes
*
* @return string Valeur
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index 1f77537ceb5..8319bff919b 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -58,11 +58,11 @@ class doc_generic_contract_odt extends ModelePDFContract
/**
- * Constructor
+ * Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -107,7 +107,7 @@ class doc_generic_contract_odt extends ModelePDFContract
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -181,19 +181,19 @@ class doc_generic_contract_odt extends ModelePDFContract
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Function to build a document on disk using the generic odt module.
+ * Function to build a document on disk using the generic odt module.
*
- * @param Contract $object Object source to build document
- * @param Translate $outputlangs Lang output object
- * @param string $srctemplatepath Full path of source filename for generator using a template file
+ * @param Contract $object Object source to build document
+ * @param Translate $outputlangs Lang output object
+ * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
- * @return int 1 if OK, <=0 if KO
+ * @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -291,10 +291,9 @@ class doc_generic_contract_odt extends ModelePDFContract
// Recipient name
$contactobject=null;
- if (! empty($usecontact))
- {
- // On peut utiliser le nom de la societe du contact
- if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
+ if (! empty($usecontact)) {
+ // On peut utiliser le nom de la societe du contact
+ if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index 84f363af74c..fd0f5cd38a0 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -61,7 +61,7 @@ class pdf_strato extends ModelePDFContract
public $type;
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@@ -124,7 +124,7 @@ class pdf_strato extends ModelePDFContract
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -160,7 +160,7 @@ class pdf_strato extends ModelePDFContract
$this->posxdesc=$this->marge_gauche+1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -171,9 +171,9 @@ class pdf_strato extends ModelePDFContract
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
- */
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ */
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$hookmanager,$mysoc;
@@ -513,7 +513,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@@ -522,7 +522,7 @@ class pdf_strato extends ModelePDFContract
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
-/*
+ /*
$pdf->SetXY($this->marge_gauche, $tab_top);
$pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0);
$pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8);
@@ -546,7 +546,7 @@ class pdf_strato extends ModelePDFContract
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY);
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
-*/
+ */
// Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3); // Rect prend une longueur en 3eme param et 4eme param
@@ -560,7 +560,7 @@ class pdf_strato extends ModelePDFContract
* @param Translate $outputlangs Object language for output
* @return void
*/
- private function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
+ private function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
{
$pdf->SetDrawColor(128, 128, 128);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
@@ -577,19 +577,19 @@ class pdf_strato extends ModelePDFContract
$pdf->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
- }
+ }
- /**
- * Show top header of page.
- *
- * @param PDF $pdf Object PDF
- * @param CommonObject $object Object to show
- * @param int $showaddress 0=no, 1=yes
- * @param Translate $outputlangs Object lang for output
- * @return void
- */
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
- {
+ /**
+ * Show top header of page.
+ *
+ * @param PDF $pdf Object PDF
+ * @param CommonObject $object Object to show
+ * @param int $showaddress 0=no, 1=yes
+ * @param Translate $outputlangs Object lang for output
+ * @return void
+ */
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ {
global $conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -767,7 +767,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php
index db7689d7855..3dfa0533cbe 100644
--- a/htdocs/core/modules/contract/mod_contract_magre.php
+++ b/htdocs/core/modules/contract/mod_contract_magre.php
@@ -59,7 +59,7 @@ class mod_contract_magre extends ModelNumRefContracts
*
* @return string text description
*/
- function info()
+ public function info()
{
global $conf,$langs;
@@ -95,7 +95,7 @@ class mod_contract_magre extends ModelNumRefContracts
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -118,7 +118,7 @@ class mod_contract_magre extends ModelNumRefContracts
* @param Object $contract contract object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $contract)
+ public function getNextValue($objsoc, $contract)
{
global $db,$conf;
@@ -137,15 +137,15 @@ class mod_contract_magre extends ModelNumRefContracts
return $numFinal;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
- * @param Societe $objsoc third party object
- * @param Object $objforref contract object
- * @return string Value if OK, 0 if KO
- */
- function contract_get_num($objsoc, $objforref)
+ * @param Societe $objsoc third party object
+ * @param Object $objforref contract object
+ * @return string Value if OK, 0 if KO
+ */
+ public function contract_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php
index 799bd297633..c1a395c4439 100644
--- a/htdocs/core/modules/contract/mod_contract_olive.php
+++ b/htdocs/core/modules/contract/mod_contract_olive.php
@@ -66,7 +66,7 @@ class mod_contract_olive extends ModelNumRefContracts
*
* @return string Description of module
*/
- function info()
+ public function info()
{
global $langs;
@@ -81,7 +81,7 @@ class mod_contract_olive extends ModelNumRefContracts
* @param Contrat $contract Object contract
* @return string Return next value
*/
- function getNextValue($objsoc, $contract)
+ public function getNextValue($objsoc, $contract)
{
global $langs;
return '';
@@ -101,7 +101,7 @@ class mod_contract_olive extends ModelNumRefContracts
* -3 ErrorProductCodeAlreadyUsed
* -4 ErrorPrefixRequired
*/
- function verif($db, &$code, $product, $type)
+ public function verif($db, &$code, $product, $type)
{
global $conf;
diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php
index 2106463107e..2f644f2762f 100644
--- a/htdocs/core/modules/contract/mod_contract_serpis.php
+++ b/htdocs/core/modules/contract/mod_contract_serpis.php
@@ -61,7 +61,7 @@ class mod_contract_serpis extends ModelNumRefContracts
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -73,7 +73,7 @@ class mod_contract_serpis extends ModelNumRefContracts
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -84,7 +84,7 @@ class mod_contract_serpis extends ModelNumRefContracts
*
* @return boolean false if conflit, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -119,7 +119,7 @@ class mod_contract_serpis extends ModelNumRefContracts
* @param Object $contract contract object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $contract)
+ public function getNextValue($objsoc, $contract)
{
global $db,$conf;
@@ -153,7 +153,7 @@ class mod_contract_serpis extends ModelNumRefContracts
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
@@ -161,7 +161,7 @@ class mod_contract_serpis extends ModelNumRefContracts
* @param Object $objforref contract object
* @return string Value if OK, 0 if KO
*/
- function contract_get_num($objsoc, $objforref)
+ public function contract_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php
index 0c126459436..9cbc2092979 100644
--- a/htdocs/core/modules/contract/modules_contract.php
+++ b/htdocs/core/modules/contract/modules_contract.php
@@ -43,7 +43,7 @@ abstract class ModelePDFContract extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -51,7 +51,7 @@ abstract class ModelePDFContract extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -82,7 +82,7 @@ class ModelNumRefContracts
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -92,7 +92,7 @@ class ModelNumRefContracts
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("contracts");
@@ -104,7 +104,7 @@ class ModelNumRefContracts
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("contracts");
@@ -116,7 +116,7 @@ class ModelNumRefContracts
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -128,7 +128,7 @@ class ModelNumRefContracts
* @param Object $contract contract object
* @return string Value
*/
- function getNextValue($objsoc, $contract)
+ public function getNextValue($objsoc, $contract)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -139,7 +139,7 @@ class ModelNumRefContracts
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php
index cbb6f3807cc..6ef76d21b78 100644
--- a/htdocs/core/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/core/modules/dons/html_cerfafr.modules.php
@@ -40,7 +40,7 @@ class html_cerfafr extends ModeleDon
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs;
@@ -58,13 +58,13 @@ class html_cerfafr extends ModeleDon
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write the object to document file to disk
*
@@ -73,7 +73,7 @@ class html_cerfafr extends ModeleDon
* @param string $currency Currency code
* @return int >0 if OK, <0 if KO
*/
- function write_file($don, $outputlangs, $currency = '')
+ public function write_file($don, $outputlangs, $currency = '')
{
// phpcs:enable
global $user,$conf,$langs,$mysoc;
@@ -306,22 +306,22 @@ class html_cerfafr extends ModeleDon
$dix[3]=intval($valeur_entiere%100000000/10000000);
$cent[3]=intval($valeur_entiere%1000000000/100000000);
$chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf');
- $secon_c='';
- $trio_c='';
- for($i=1; $i<=3; $i++){
+ $secon_c='';
+ $trio_c='';
+ for($i=1; $i<=3; $i++) {
$prim[$i]='';
$secon[$i]='';
$trio[$i]='';
- if($dix[$i]==0){
+ if ($dix[$i]==0) {
$secon[$i]='';
$prim[$i]=$chif[$unite[$i]];
}
- elseif($dix[$i]==1){
+ elseif ($dix[$i]==1) {
$secon[$i]='';
$prim[$i]=$chif[($unite[$i]+10)];
}
- elseif($dix[$i]==2){
- if($unite[$i]==1){
+ elseif ($dix[$i]==2) {
+ if ($unite[$i]==1) {
$secon[$i]='vingt et';
$prim[$i]=$chif[$unite[$i]];
}
@@ -330,8 +330,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]];
}
}
- elseif($dix[$i]==3){
- if($unite[$i]==1){
+ elseif ($dix[$i]==3) {
+ if ($unite[$i]==1) {
$secon[$i]='trente et';
$prim[$i]=$chif[$unite[$i]];
}
@@ -340,8 +340,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]];
}
}
- elseif($dix[$i]==4){
- if($unite[$i]==1){
+ elseif ($dix[$i]==4) {
+ if ($unite[$i]==1) {
$secon[$i]='quarante et';
$prim[$i]=$chif[$unite[$i]];
}
@@ -350,8 +350,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]];
}
}
- elseif($dix[$i]==5){
- if($unite[$i]==1){
+ elseif ($dix[$i]==5) {
+ if ($unite[$i]==1) {
$secon[$i]='cinquante et';
$prim[$i]=$chif[$unite[$i]];
}
@@ -360,8 +360,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]];
}
}
- elseif($dix[$i]==6){
- if($unite[$i]==1){
+ elseif ($dix[$i]==6) {
+ if ($unite[$i]==1) {
$secon[$i]='soixante et';
$prim[$i]=$chif[$unite[$i]];
}
@@ -370,8 +370,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]];
}
}
- elseif($dix[$i]==7){
- if($unite[$i]==1){
+ elseif ($dix[$i]==7) {
+ if ($unite[$i]==1) {
$secon[$i]='soixante et';
$prim[$i]=$chif[$unite[$i]+10];
}
@@ -380,8 +380,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]+10];
}
}
- elseif($dix[$i]==8){
- if($unite[$i]==1){
+ elseif ($dix[$i]==8) {
+ if ($unite[$i]==1) {
$secon[$i]='quatre-vingts et';
$prim[$i]=$chif[$unite[$i]];
}
@@ -390,8 +390,8 @@ class html_cerfafr extends ModeleDon
$prim[$i]=$chif[$unite[$i]];
}
}
- elseif($dix[$i]==9){
- if($unite[$i]==1){
+ elseif ($dix[$i]==9) {
+ if ($unite[$i]==1) {
$secon[$i]='quatre-vingts et';
$prim[$i]=$chif[$unite[$i]+10];
}
@@ -407,19 +407,19 @@ class html_cerfafr extends ModeleDon
$chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
$secon_c=$chif2[$dix_c];
- if($cent_c==1) $trio_c='cent';
- elseif($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
+ if ($cent_c==1) $trio_c='cent';
+ elseif ($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
- if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
+ if (($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million ';
- elseif(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
+ elseif (($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
else
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
- if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
+ if (($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
$somme = $somme.' mille ';
- elseif(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
+ elseif (($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
else
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
@@ -428,7 +428,7 @@ class html_cerfafr extends ModeleDon
$somme = $somme. ' '. $dev1 .' ' ;
- if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
+ if (($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
return $somme. ' et zéro '. $dev2;
else
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php
index adda4dce750..9957bf4f326 100644
--- a/htdocs/core/modules/dons/modules_don.php
+++ b/htdocs/core/modules/dons/modules_don.php
@@ -39,7 +39,7 @@ abstract class ModeleDon extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -47,7 +47,7 @@ abstract class ModeleDon extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -78,7 +78,7 @@ abstract class ModeleNumRefDons
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -88,7 +88,7 @@ abstract class ModeleNumRefDons
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -100,7 +100,7 @@ abstract class ModeleNumRefDons
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("bills");
@@ -113,7 +113,7 @@ abstract class ModeleNumRefDons
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -123,7 +123,7 @@ abstract class ModeleNumRefDons
*
* @return string Valeur
*/
- function getNextValue()
+ public function getNextValue()
{
global $langs;
return $langs->trans("NotAvailable");
@@ -134,7 +134,7 @@ abstract class ModeleNumRefDons
*
* @return string Valeur
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index 558ffe44e0a..53891a1c340 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -64,7 +64,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -109,7 +109,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -191,7 +191,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -203,7 +203,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -337,7 +337,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->expedition->dir_temp,
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index 628d9102e96..649d20154e4 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -58,7 +58,7 @@ class pdf_merou extends ModelePdfExpedition
public $type;
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@@ -116,7 +116,7 @@ class pdf_merou extends ModelePdfExpedition
*
* @param DoliDB $db Database handler
*/
- function __construct($db = 0)
+ public function __construct($db = 0)
{
global $conf,$langs,$mysoc;
@@ -142,7 +142,7 @@ class pdf_merou extends ModelePdfExpedition
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -154,7 +154,7 @@ class pdf_merou extends ModelePdfExpedition
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$conf,$langs,$mysoc,$hookmanager;
@@ -460,7 +460,7 @@ class pdf_merou extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -498,7 +498,7 @@ class pdf_merou extends ModelePdfExpedition
* @param int $hidefreetext 1=Hide free text
* @return void
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 2);
@@ -527,7 +527,7 @@ class pdf_merou extends ModelePdfExpedition
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs,$hookmanager;
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index 116fae7c354..e0de76bb7b7 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -57,7 +57,7 @@ class pdf_rouget extends ModelePdfExpedition
public $type;
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@@ -115,7 +115,7 @@ class pdf_rouget extends ModelePdfExpedition
*
* @param DoliDB $db Database handler
*/
- function __construct($db = 0)
+ public function __construct($db = 0)
{
global $conf,$langs,$mysoc;
@@ -156,23 +156,22 @@ class pdf_rouget extends ModelePdfExpedition
$this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
- if ($this->page_largeur < 210) // To work with US executive format
- {
- $this->posxweightvol-=20;
- $this->posxpicture-=20;
- $this->posxqtyordered-=20;
- $this->posxqtytoship-=20;
- }
+ // To work with US executive format
+ if ($this->page_largeur < 210) {
+ $this->posxweightvol-=20;
+ $this->posxpicture-=20;
+ $this->posxqtyordered-=20;
+ $this->posxqtytoship-=20;
+ }
- if (! empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
- {
+ if (! empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) {
$this->posxweightvol += ($this->posxqtytoship - $this->posxqtyordered);
$this->posxpicture += ($this->posxqtytoship - $this->posxqtyordered);
$this->posxqtyordered = $this->posxqtytoship;
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -184,7 +183,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$conf,$langs,$hookmanager;
@@ -664,7 +663,7 @@ class pdf_rouget extends ModelePdfExpedition
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -675,7 +674,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -783,7 +782,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@@ -868,7 +867,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$mysoc;
@@ -1108,15 +1107,15 @@ class pdf_rouget extends ModelePdfExpedition
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
+ * @param PDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php
index ac0c286d389..7b20d1df4d8 100644
--- a/htdocs/core/modules/expedition/mod_expedition_ribera.php
+++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php
@@ -57,7 +57,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
*
* @return string text description
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -93,7 +93,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -119,7 +119,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
* @param Object $shipment Shipment object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $shipment)
{
global $db,$conf;
@@ -140,7 +140,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
return $numFinal;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -148,7 +148,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
* @param Object $objforref Shipment object
* @return string Next free value
*/
- function expedition_get_num($objsoc, $objforref)
+ public function expedition_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php
index 3bf655c6f23..40033df65f7 100644
--- a/htdocs/core/modules/expedition/mod_expedition_safor.php
+++ b/htdocs/core/modules/expedition/mod_expedition_safor.php
@@ -59,7 +59,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -71,7 +71,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -82,7 +82,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
*
* @return boolean false if conflit, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -117,7 +117,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
* @param Object $shipment Shipment object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $shipment)
{
global $db,$conf;
@@ -150,7 +150,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
return $this->prefix.$yymm."-".$num;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -158,7 +158,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
* @param Object $objforref Shipment object
* @return string Next free value
*/
- function expedition_get_num($objsoc, $objforref)
+ public function expedition_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php
index 7b88a83392e..3a2d7774e33 100644
--- a/htdocs/core/modules/expedition/modules_expedition.php
+++ b/htdocs/core/modules/expedition/modules_expedition.php
@@ -42,7 +42,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
*
@@ -50,7 +50,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -80,7 +80,7 @@ abstract class ModelNumRefExpedition
*
* @return boolean true if model can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -90,7 +90,7 @@ abstract class ModelNumRefExpedition
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("sendings");
@@ -102,7 +102,7 @@ abstract class ModelNumRefExpedition
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("sendings");
@@ -114,7 +114,7 @@ abstract class ModelNumRefExpedition
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -126,7 +126,7 @@ abstract class ModelNumRefExpedition
* @param Object $shipment Shipment object
* @return string Value
*/
- function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $shipment)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -137,7 +137,7 @@ abstract class ModelNumRefExpedition
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index 03ebe71e88d..2563028ee93 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -114,13 +114,13 @@ class pdf_standard extends ModeleExpenseReport
public $emetteur;
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- function __construct($db)
- {
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
global $conf, $langs, $mysoc;
// Translations
@@ -192,7 +192,7 @@ class pdf_standard extends ModeleExpenseReport
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -204,7 +204,7 @@ class pdf_standard extends ModeleExpenseReport
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
@@ -450,8 +450,7 @@ class pdf_standard extends ModeleExpenseReport
}
// Show square
- if ($pagenb == 1)
- {
+ if ($pagenb == 1) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
@@ -625,7 +624,7 @@ class pdf_standard extends ModeleExpenseReport
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs, $hookmanager;
@@ -770,8 +769,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell(96, 4, $outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create, "day", false, $outputlangs), 0, 'L');
}
- if ($object->fk_statut==99)
- {
+ if ($object->fk_statut==99) {
if ($object->fk_user_refuse > 0) {
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_refuse); $posy+=6;
@@ -840,7 +838,7 @@ class pdf_standard extends ModeleExpenseReport
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1054,15 +1052,15 @@ class pdf_standard extends ModeleExpenseReport
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
+ * @param PDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
index b4d1b7b2b6e..a878fb1325c 100644
--- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php
+++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php
@@ -59,10 +59,10 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
*
* @return string Text with description
*/
- function info()
+ public function info()
{
- global $langs;
- return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
}
@@ -71,7 +71,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -83,7 +83,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -117,7 +117,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($object)
+ public function getNextValue($object)
{
global $db,$conf;
diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php
index e9c5eb06dd5..2311de4841a 100644
--- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php
+++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php
@@ -59,7 +59,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $db, $conf, $langs;
@@ -99,7 +99,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $db, $conf,$langs,$user;
@@ -116,15 +116,15 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
return $numExample;
}
- /**
- * Return next free value
- *
- * @param Object $object Object we need next value for
- * @return string Value if KO, <0 if KO
- */
- function getNextValue($object)
+ /**
+ * Return next free value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Value if KO, <0 if KO
+ */
+ public function getNextValue($object)
{
- global $db,$conf;
+ global $db,$conf;
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
@@ -154,5 +154,5 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
$numFinal=get_next_value($db, $mask, 'expensereport', 'ref', '', null, $date, 'next', true, $fuser);
return $numFinal;
- }
+ }
}
diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php
index a31a61f67e1..fde96e56af5 100644
--- a/htdocs/core/modules/expensereport/modules_expensereport.php
+++ b/htdocs/core/modules/expensereport/modules_expensereport.php
@@ -29,7 +29,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active models generation
*
@@ -37,7 +37,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -52,7 +52,6 @@ abstract class ModeleExpenseReport extends CommonDocGenerator
}
}
-// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* expensereport_pdf_create
*
@@ -68,8 +67,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator
*/
function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
- // phpcs:enable
- return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
/**
@@ -89,7 +87,7 @@ abstract class ModeleNumRefExpenseReport
*
* @return boolean true if model can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -99,7 +97,7 @@ abstract class ModeleNumRefExpenseReport
*
* @return string Descriptive text
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("orders");
@@ -111,7 +109,7 @@ abstract class ModeleNumRefExpenseReport
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("trips");
@@ -123,7 +121,7 @@ abstract class ModeleNumRefExpenseReport
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -134,26 +132,26 @@ abstract class ModeleNumRefExpenseReport
* @param Object $object Object we need next value for
* @return string Value
*/
- function getNextValue($object)
+ public function getNextValue($object)
{
global $langs;
return $langs->trans("NotAvailable");
}
- /**
- * Returns the version of the numbering module
- *
- * @return string Value
- */
- function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Returns the version of the numbering module
+ *
+ * @return string Value
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
+ }
}
diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php
index a90e550c3da..249d1563988 100644
--- a/htdocs/core/modules/export/export_csv.modules.php
+++ b/htdocs/core/modules/export/export_csv.modules.php
@@ -62,7 +62,7 @@ class ExportCsv extends ModeleExports
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
@@ -89,7 +89,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
- function getDriverId()
+ public function getDriverId()
{
return $this->id;
}
@@ -99,7 +99,7 @@ class ExportCsv extends ModeleExports
*
* @return string Return driver label
*/
- function getDriverLabel()
+ public function getDriverLabel()
{
return $this->label;
}
@@ -109,7 +109,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
- function getDriverDesc()
+ public function getDriverDesc()
{
return $this->desc;
}
@@ -119,7 +119,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
- function getDriverExtension()
+ public function getDriverExtension()
{
return $this->extension;
}
@@ -129,7 +129,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
- function getDriverVersion()
+ public function getDriverVersion()
{
return $this->version;
}
@@ -139,7 +139,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
- function getLibLabel()
+ public function getLibLabel()
{
return $this->label_lib;
}
@@ -149,13 +149,13 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
- function getLibVersion()
+ public function getLibVersion()
{
return $this->version_lib;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Open output file
*
@@ -163,7 +163,7 @@ class ExportCsv extends ModeleExports
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK
*/
- function open_file($file, $outputlangs)
+ public function open_file($file, $outputlangs)
{
// phpcs:enable
global $langs;
@@ -184,21 +184,21 @@ class ExportCsv extends ModeleExports
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output header into file
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
- function write_header($outputlangs)
+ public function write_header($outputlangs)
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output title line into file
*
@@ -208,7 +208,7 @@ class ExportCsv extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
+ public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -234,7 +234,7 @@ class ExportCsv extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output record line into file
*
@@ -244,7 +244,7 @@ class ExportCsv extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
+ public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -288,26 +288,26 @@ class ExportCsv extends ModeleExports
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output footer into file
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
- function write_footer($outputlangs)
+ public function write_footer($outputlangs)
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close file handle
*
* @return int <0 if KO, >0 if OK
*/
- function close_file()
+ public function close_file()
{
// phpcs:enable
fclose($this->handle);
diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php
index 7b12651cfa0..28357c0a09a 100644
--- a/htdocs/core/modules/export/export_excel.modules.php
+++ b/htdocs/core/modules/export/export_excel.modules.php
@@ -70,17 +70,17 @@ class ExportExcel extends ModeleExports
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
$this->id='excel'; // Same value then xxx in file name export_xxx.modules.php
- $this->label='Excel 95'; // Label of driver
+ $this->label='Excel 95'; // Label of driver
$this->desc = $langs->trans('Excel95FormatDesc');
$this->extension='xls'; // Extension for generated file by this driver
- $this->picto='mime/xls'; // Picto
- $this->version='1.30'; // Driver version
+ $this->picto='mime/xls'; // Picto
+ $this->version='1.30'; // Driver version
$this->disabled = (in_array(constant('PHPEXCEL_PATH'), array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
@@ -112,7 +112,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
- function getDriverId()
+ public function getDriverId()
{
return $this->id;
}
@@ -122,7 +122,7 @@ class ExportExcel extends ModeleExports
*
* @return string Return driver label
*/
- function getDriverLabel()
+ public function getDriverLabel()
{
return $this->label;
}
@@ -132,7 +132,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
- function getDriverDesc()
+ public function getDriverDesc()
{
return $this->desc;
}
@@ -142,7 +142,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
- function getDriverExtension()
+ public function getDriverExtension()
{
return $this->extension;
}
@@ -152,7 +152,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
- function getDriverVersion()
+ public function getDriverVersion()
{
return $this->version;
}
@@ -162,7 +162,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
- function getLibLabel()
+ public function getLibLabel()
{
return $this->label_lib;
}
@@ -172,13 +172,13 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
- function getLibVersion()
+ public function getLibVersion()
{
return $this->version_lib;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Open output file
*
@@ -186,7 +186,7 @@ class ExportExcel extends ModeleExports
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK
*/
- function open_file($file, $outputlangs)
+ public function open_file($file, $outputlangs)
{
// phpcs:enable
global $user,$conf,$langs;
@@ -202,8 +202,7 @@ class ExportExcel extends ModeleExports
$ret=1;
$outputlangs->load("exports");
- if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
- {
+ if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) {
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
@@ -249,14 +248,14 @@ class ExportExcel extends ModeleExports
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write header
*
* @param Translate $outputlangs Object lang to translate values
* @return int <0 if KO, >0 if OK
*/
- function write_header($outputlangs)
+ public function write_header($outputlangs)
{
// phpcs:enable
//$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
@@ -265,7 +264,7 @@ class ExportExcel extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output title line into file
*
@@ -275,7 +274,7 @@ class ExportExcel extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
+ public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -322,7 +321,7 @@ class ExportExcel extends ModeleExports
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output record line into file
*
@@ -332,7 +331,7 @@ class ExportExcel extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
+ public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -442,27 +441,27 @@ class ExportExcel extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write footer
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
- function write_footer($outputlangs)
+ public function write_footer($outputlangs)
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close Excel file
*
* @return int <0 if KO, >0 if OK
*/
- function close_file()
+ public function close_file()
{
// phpcs:enable
global $conf;
@@ -483,42 +482,43 @@ class ExportExcel extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Clean a cell to respect rules of Excel file cells
+ * Clean a cell to respect rules of Excel file cells
*
- * @param string $newvalue String to clean
- * @return string Value cleaned
+ * @param string $newvalue String to clean
+ * @return string Value cleaned
*/
- function excel_clean($newvalue)
+ public function excel_clean($newvalue)
{
// phpcs:enable
- // Rule Dolibarr: No HTML
- $newvalue=dol_string_nohtmltag($newvalue);
+ // Rule Dolibarr: No HTML
+ $newvalue=dol_string_nohtmltag($newvalue);
- return $newvalue;
+ return $newvalue;
}
/**
- * Convert a column to letter (1->A, 0->B, 27->AA, ...)
+ * Convert a column to letter (1->A, 0->B, 27->AA, ...)
*
- * @param int $c Column position
- * @return string Letter
+ * @param int $c Column position
+ * @return string Letter
*/
- function column2Letter($c)
+ public function column2Letter($c)
{
- $c = intval($c);
- if ($c <= 0) return '';
+ $c = intval($c);
+ if ($c <= 0) {
+ return '';
+ }
- while ($c != 0)
- {
- $p = ($c - 1) % 26;
- $c = intval(($c - $p) / 26);
- $letter = chr(65 + $p) . $letter;
- }
+ while ($c != 0) {
+ $p = ($c - 1) % 26;
+ $c = intval(($c - $p) / 26);
+ $letter = chr(65 + $p) . $letter;
+ }
- return $letter;
+ return $letter;
}
}
diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php
index 28dae8ed6fd..1b6b973632a 100644
--- a/htdocs/core/modules/export/export_excel2007.modules.php
+++ b/htdocs/core/modules/export/export_excel2007.modules.php
@@ -70,7 +70,7 @@ class ExportExcel2007 extends ExportExcel
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
@@ -108,29 +108,29 @@ class ExportExcel2007 extends ExportExcel
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close Excel file
*
* @return int <0 if KO, >0 if OK
*/
- function close_file()
- {
+ public function close_file()
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
- {
- $this->workbook->close();
- }
- else
- {
+ if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
+ {
+ $this->workbook->close();
+ }
+ else
+ {
require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php';
- $objWriter = new PHPExcel_Writer_Excel2007($this->workbook);
+ $objWriter = new PHPExcel_Writer_Excel2007($this->workbook);
$objWriter->save($this->file);
$this->workbook->disconnectWorksheets();
unset($this->workbook);
- }
- return 1;
- }
+ }
+ return 1;
+ }
}
diff --git a/htdocs/core/modules/export/export_excelnew.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php
similarity index 75%
rename from htdocs/core/modules/export/export_excelnew.modules.php
rename to htdocs/core/modules/export/export_excel2007new.modules.php
index f6a54b040d3..10dbb2fa28c 100644
--- a/htdocs/core/modules/export/export_excelnew.modules.php
+++ b/htdocs/core/modules/export/export_excel2007new.modules.php
@@ -32,7 +32,7 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
/**
* Class to build export files with Excel format
*/
-class ExportExcelnew extends ModeleExports
+class ExportExcel2007new extends ModeleExports
{
/**
* @var int ID
@@ -72,7 +72,7 @@ class ExportExcelnew extends ModeleExports
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
@@ -105,7 +105,7 @@ class ExportExcelnew extends ModeleExports
*
* @return string
*/
- function getDriverId()
+ public function getDriverId()
{
return $this->id;
}
@@ -115,7 +115,7 @@ class ExportExcelnew extends ModeleExports
*
* @return string Return driver label
*/
- function getDriverLabel()
+ public function getDriverLabel()
{
return $this->label;
}
@@ -125,7 +125,7 @@ class ExportExcelnew extends ModeleExports
*
* @return string
*/
- function getDriverDesc()
+ public function getDriverDesc()
{
return $this->desc;
}
@@ -135,7 +135,7 @@ class ExportExcelnew extends ModeleExports
*
* @return string
*/
- function getDriverExtension()
+ public function getDriverExtension()
{
return $this->extension;
}
@@ -145,7 +145,7 @@ class ExportExcelnew extends ModeleExports
*
* @return string
*/
- function getDriverVersion()
+ public function getDriverVersion()
{
return $this->version;
}
@@ -155,7 +155,7 @@ class ExportExcelnew extends ModeleExports
*
* @return string
*/
- function getLibLabel()
+ public function getLibLabel()
{
return $this->label_lib;
}
@@ -165,13 +165,13 @@ class ExportExcelnew extends ModeleExports
*
* @return string
*/
- function getLibVersion()
+ public function getLibVersion()
{
return $this->version_lib;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Open output file
*
@@ -179,7 +179,7 @@ class ExportExcelnew extends ModeleExports
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK
*/
- function open_file($file, $outputlangs)
+ public function open_file($file, $outputlangs)
{
// phpcs:enable
global $user,$conf,$langs;
@@ -227,14 +227,14 @@ class ExportExcelnew extends ModeleExports
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write header
*
* @param Translate $outputlangs Object lang to translate values
* @return int <0 if KO, >0 if OK
*/
- function write_header($outputlangs)
+ public function write_header($outputlangs)
{
// phpcs:enable
//$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
@@ -243,7 +243,7 @@ class ExportExcelnew extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output title line into file
*
@@ -253,7 +253,7 @@ class ExportExcelnew extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
+ public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -286,7 +286,7 @@ class ExportExcelnew extends ModeleExports
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output record line into file
*
@@ -296,7 +296,7 @@ class ExportExcelnew extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
+ public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -333,32 +333,32 @@ class ExportExcelnew extends ModeleExports
if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i', $newvalue))
{
- $newvalue=dol_stringtotime($newvalue);
- $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($newvalue));
- $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
- $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd');
+ $newvalue=dol_stringtotime($newvalue);
+ $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($newvalue));
+ $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
+ $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd');
}
elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i', $newvalue))
{
- $newvalue=dol_stringtotime($newvalue);
- $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($newvalue));
- $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
- $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
+ $newvalue=dol_stringtotime($newvalue);
+ $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($newvalue));
+ $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
+ $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
}
else
{
- if ($typefield == 'Text' || $typefield == 'TextAuto')
- {
- //$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
- $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue);
- $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
- $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
- $this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
- }
- else
- {
- $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
- }
+ if ($typefield == 'Text' || $typefield == 'TextAuto')
+ {
+ //$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
+ $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue);
+ $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
+ $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
+ $this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
+ }
+ else
+ {
+ $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
+ }
}
$this->col++;
}
@@ -367,48 +367,48 @@ class ExportExcelnew extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write footer
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
- function write_footer($outputlangs)
+ public function write_footer($outputlangs)
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close Excel file
*
* @return int <0 if KO, >0 if OK
*/
- function close_file()
+ public function close_file()
{
// phpcs:enable
- global $conf;
+ global $conf;
- $objWriter = new Xlsx($this->workbook);
- $objWriter->save($this->file);
- $this->workbook->disconnectWorksheets();
- unset($this->workbook);
+ $objWriter = new Xlsx($this->workbook);
+ $objWriter->save($this->file);
+ $this->workbook->disconnectWorksheets();
+ unset($this->workbook);
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Clean a cell to respect rules of Excel file cells
*
* @param string $newvalue String to clean
* @return string Value cleaned
*/
- function excel_clean($newvalue)
+ public function excel_clean($newvalue)
{
// phpcs:enable
// Rule Dolibarr: No HTML
@@ -424,14 +424,13 @@ class ExportExcelnew extends ModeleExports
* @param int $c Column position
* @return string Letter
*/
- function column2Letter($c)
+ public function column2Letter($c)
{
$c = intval($c);
if ($c <= 0) return '';
- while ($c != 0)
- {
+ while ($c != 0) {
$p = ($c - 1) % 26;
$c = intval(($c - $p) / 26);
$letter = chr(65 + $p) . $letter;
diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php
index e3855e5f17e..33d7d860368 100644
--- a/htdocs/core/modules/export/export_tsv.modules.php
+++ b/htdocs/core/modules/export/export_tsv.modules.php
@@ -59,11 +59,11 @@ class ExportTsv extends ModeleExports
/**
- * Constructor
- *
- * @param DoliDB $db Database handler
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
@@ -85,7 +85,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
- function getDriverId()
+ public function getDriverId()
{
return $this->id;
}
@@ -95,7 +95,7 @@ class ExportTsv extends ModeleExports
*
* @return string Return driver label
*/
- function getDriverLabel()
+ public function getDriverLabel()
{
return $this->label;
}
@@ -105,7 +105,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
- function getDriverDesc()
+ public function getDriverDesc()
{
return $this->desc;
}
@@ -115,7 +115,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
- function getDriverExtension()
+ public function getDriverExtension()
{
return $this->extension;
}
@@ -125,7 +125,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
- function getDriverVersion()
+ public function getDriverVersion()
{
return $this->version;
}
@@ -135,7 +135,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
- function getLibLabel()
+ public function getLibLabel()
{
return $this->label_lib;
}
@@ -145,21 +145,21 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
- function getLibVersion()
+ public function getLibVersion()
{
return $this->version_lib;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Open output file
- *
- * @param string $file Path of filename to generate
- * @param Translate $outputlangs Output language object
- * @return int <0 if KO, >=0 if OK
- */
- function open_file($file, $outputlangs)
+ * Open output file
+ *
+ * @param string $file Path of filename to generate
+ * @param Translate $outputlangs Output language object
+ * @return int <0 if KO, >=0 if OK
+ */
+ public function open_file($file, $outputlangs)
{
// phpcs:enable
global $langs;
@@ -180,21 +180,21 @@ class ExportTsv extends ModeleExports
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output header into file
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
- function write_header($outputlangs)
+ public function write_header($outputlangs)
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output title line into file
*
@@ -203,8 +203,8 @@ class ExportTsv extends ModeleExports
* @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
- */
- function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
+ */
+ public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
{
// phpcs:enable
foreach($array_selected_sorted as $code => $value)
@@ -219,7 +219,7 @@ class ExportTsv extends ModeleExports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output record line into file
*
@@ -229,7 +229,7 @@ class ExportTsv extends ModeleExports
* @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK
*/
- function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
+ public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
{
// phpcs:enable
global $conf;
@@ -263,33 +263,33 @@ class ExportTsv extends ModeleExports
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output footer into file
*
* @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK
*/
- function write_footer($outputlangs)
+ public function write_footer($outputlangs)
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close file handle
*
* @return int <0 if KO, >0 if OK
*/
- function close_file()
+ public function close_file()
{
// phpcs:enable
fclose($this->handle);
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Clean a cell to respect rules of TSV file cells
*
@@ -297,21 +297,20 @@ class ExportTsv extends ModeleExports
* @param string $charset Input AND Output character set
* @return string Value cleaned
*/
- function tsv_clean($newvalue, $charset)
+ public function tsv_clean($newvalue, $charset)
{
// phpcs:enable
- // Rule Dolibarr: No HTML
- $newvalue=dol_string_nohtmltag($newvalue, 1, $charset);
+ // Rule Dolibarr: No HTML
+ $newvalue=dol_string_nohtmltag($newvalue, 1, $charset);
- // Rule 1 TSV: No CR, LF in cells
- $newvalue=str_replace("\r", '', $newvalue);
+ // Rule 1 TSV: No CR, LF in cells
+ $newvalue=str_replace("\r", '', $newvalue);
$newvalue=str_replace("\n", '\n', $newvalue);
// Rule 2 TSV: If value contains tab, we must replace by space
- if (preg_match('/'.$this->separator.'/', $newvalue))
- {
- $newvalue=str_replace("\t", " ", $newvalue);
- }
+ if (preg_match('/'.$this->separator.'/', $newvalue)) {
+ $newvalue=str_replace("\t", " ", $newvalue);
+ }
return $newvalue;
}
diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php
index 9ab3a45533d..17318e058ab 100644
--- a/htdocs/core/modules/export/modules_export.php
+++ b/htdocs/core/modules/export/modules_export.php
@@ -44,7 +44,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
public $libversion=array();
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load into memory list of available export format
*
@@ -52,7 +52,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates (same content than array this->driverlabel)
*/
- function liste_modeles($db, $maxfilenamelength = 0)
+ public function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
dol_syslog(get_class($this)."::liste_modeles");
@@ -107,7 +107,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param string $key Key of driver
* @return string Picto string
*/
- function getPictoForKey($key)
+ public function getPictoForKey($key)
{
return $this->picto[$key];
}
@@ -118,7 +118,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param string $key Key of driver
* @return string Label
*/
- function getDriverLabelForKey($key)
+ public function getDriverLabelForKey($key)
{
return $this->driverlabel[$key];
}
@@ -129,7 +129,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param string $key Key of driver
* @return string Description
*/
- function getDriverDescForKey($key)
+ public function getDriverDescForKey($key)
{
return $this->driverdesc[$key];
}
@@ -140,7 +140,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param string $key Key of driver
* @return string Driver version
*/
- function getDriverVersionForKey($key)
+ public function getDriverVersionForKey($key)
{
return $this->driverversion[$key];
}
@@ -151,7 +151,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param string $key Key of driver
* @return string Label of library
*/
- function getLibLabelForKey($key)
+ public function getLibLabelForKey($key)
{
return $this->liblabel[$key];
}
@@ -162,7 +162,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
* @param string $key Key of driver
* @return string Version of library
*/
- function getLibVersionForKey($key)
+ public function getLibVersionForKey($key)
{
return $this->libversion[$key];
}
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index c5405d9c3a9..77a779d8ce0 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -63,8 +63,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
+ public function __construct($db)
+ {
global $conf, $langs, $mysoc;
// Load translation files required by the page
@@ -99,7 +99,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Recupere emetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini
- }
+ }
/**
@@ -108,8 +108,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
- {
+ public function info($langs)
+ {
global $conf, $langs;
// Load translation files required by the page
@@ -188,11 +188,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte.= '';
return $texte;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Function to build a document on disk using the generic odt module.
+ * Function to build a document on disk using the generic odt module.
*
* @param Facture $object Object source to build document
* @param Translate $outputlangs Lang output object
@@ -202,8 +202,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -521,5 +521,5 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
return -1;
- }
+ }
}
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 3eb5905ccd2..1ba60bf9b41 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -137,7 +137,7 @@ class pdf_crabe extends ModelePDFFactures
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -218,7 +218,7 @@ class pdf_crabe extends ModelePDFFactures
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -230,7 +230,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
@@ -782,7 +782,7 @@ class pdf_crabe extends ModelePDFFactures
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
*
@@ -793,7 +793,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $heightforfooter height for footer
* @return int <0 if KO, >0 if OK
*/
- function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
+ private function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
{
// phpcs:enable
global $conf;
@@ -928,7 +928,7 @@ class pdf_crabe extends ModelePDFFactures
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function _tableau_versements_header
*
@@ -942,7 +942,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $tab3_height height
* @return void
*/
- function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height)
+ private function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height)
{
// phpcs:enable
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
@@ -967,7 +967,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -977,7 +977,7 @@ class pdf_crabe extends ModelePDFFactures
* @param Translate $outputlangs Langs object
* @return void
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -1126,7 +1126,7 @@ class pdf_crabe extends ModelePDFFactures
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -1137,7 +1137,7 @@ class pdf_crabe extends ModelePDFFactures
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -1455,7 +1455,7 @@ class pdf_crabe extends ModelePDFFactures
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1611,7 +1611,7 @@ class pdf_crabe extends ModelePDFFactures
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
@@ -1886,7 +1886,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 174f34bfb4b..da45babde4f 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -1,13 +1,13 @@
- * Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2008 Raphael Bertrand
- * Copyright (C) 2010-2014 Juanjo Menent
- * Copyright (C) 2012 Christophe Battarel
- * Copyright (C) 2012 Cédric Salvador
- * Copyright (C) 2012-2014 Raphaël Doursenaud
- * Copyright (C) 2015 Marcos García
- * Copyright (C) 2017 Ferran Marcet
+/* Copyright (C) 2004-2014 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2008 Raphael Bertrand
+ * Copyright (C) 2010-2014 Juanjo Menent
+ * Copyright (C) 2012 Christophe Battarel
+ * Copyright (C) 2012 Cédric Salvador
+ * Copyright (C) 2012-2014 Raphaël Doursenaud
+ * Copyright (C) 2015 Marcos García
+ * Copyright (C) 2017 Ferran Marcet
* Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -26,9 +26,9 @@
*/
/**
- * \file htdocs/core/modules/facture/doc/pdf_sponge.modules.php
- * \ingroup facture
- * \brief File of class to generate customers invoices from sponge model
+ * \file htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+ * \ingroup facture
+ * \brief File of class to generate customers invoices from sponge model
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
@@ -59,7 +59,7 @@ class pdf_sponge extends ModelePDFFactures
public $description;
/**
- * @var int Save the name of generated file as the main doc when generating a doc with this template
+ * @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
@@ -106,7 +106,7 @@ class pdf_sponge extends ModelePDFFactures
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -860,7 +860,7 @@ class pdf_sponge extends ModelePDFFactures
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
- function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
+ public function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
@@ -1148,9 +1148,9 @@ class pdf_sponge extends ModelePDFFactures
/**
- * Show total to pay
+ * Show total to pay
*
- * @param PDF $pdf Object PDF
+ * @param PDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
@@ -1478,7 +1478,7 @@ class pdf_sponge extends ModelePDFFactures
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1545,7 +1545,7 @@ class pdf_sponge extends ModelePDFFactures
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
@@ -1818,7 +1818,7 @@ class pdf_sponge extends ModelePDFFactures
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
@@ -1826,16 +1826,16 @@ class pdf_sponge extends ModelePDFFactures
}
/**
- * Define Array Column Field
+ * Define Array Column Field
*
- * @param object $object common object
- * @param outputlangs $outputlangs langs
- * @param int $hidedetails Do not show line details
- * @param int $hidedesc Do not show desc
- * @param int $hideref Do not show ref
- * @return null
- */
- function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ * @param object $object common object
+ * @param outputlangs $outputlangs langs
+ * @param int $hidedetails Do not show line details
+ * @param int $hidedesc Do not show desc
+ * @param int $hideref Do not show ref
+ * @return null
+ */
+ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php
index 18bf4383200..0933d38306c 100644
--- a/htdocs/core/modules/facture/mod_facture_mars.php
+++ b/htdocs/core/modules/facture/mod_facture_mars.php
@@ -53,7 +53,7 @@ class mod_facture_mars extends ModeleNumRefFactures
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
if (! empty($conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX))
{
@@ -66,7 +66,7 @@ class mod_facture_mars extends ModeleNumRefFactures
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -78,7 +78,7 @@ class mod_facture_mars extends ModeleNumRefFactures
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefixinvoice."0501-0001";
}
@@ -89,7 +89,7 @@ class mod_facture_mars extends ModeleNumRefFactures
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $langs,$conf,$db;
@@ -149,7 +149,7 @@ class mod_facture_mars extends ModeleNumRefFactures
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value
*/
- function getNextValue($objsoc, $invoice, $mode = 'next')
+ public function getNextValue($objsoc, $invoice, $mode = 'next')
{
global $db;
$prefix=$this->prefixinvoice;
@@ -216,16 +216,16 @@ class mod_facture_mars extends ModeleNumRefFactures
else dol_print_error('', 'Bad parameter for getNextValue');
}
- /**
- * Return next free value
- *
- * @param Societe $objsoc Object third party
- * @param string $objforref Object for number to search
- * @param string $mode 'next' for next value or 'last' for last value
- * @return string Next free value
- */
- function getNumRef($objsoc, $objforref, $mode = 'next')
- {
- return $this->getNextValue($objsoc, $objforref, $mode);
- }
+ /**
+ * Return next free value
+ *
+ * @param Societe $objsoc Object third party
+ * @param string $objforref Object for number to search
+ * @param string $mode 'next' for next value or 'last' for last value
+ * @return string Next free value
+ */
+ public function getNumRef($objsoc, $objforref, $mode = 'next')
+ {
+ return $this->getNextValue($objsoc, $objforref, $mode);
+ }
}
diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php
index 1cb86fdfdff..2ef492660b2 100644
--- a/htdocs/core/modules/facture/mod_facture_mercure.php
+++ b/htdocs/core/modules/facture/mod_facture_mercure.php
@@ -50,7 +50,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $db, $conf, $langs;
@@ -108,7 +108,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -135,7 +135,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $invoice, $mode = 'next')
+ public function getNextValue($objsoc, $invoice, $mode = 'next')
{
global $db,$conf;
@@ -182,7 +182,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref, $mode = 'next')
+ public function getNumRef($objsoc, $objforref, $mode = 'next')
{
return $this->getNextValue($objsoc, $objforref, $mode);
}
diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php
index 5aa8f8e83b3..6e588aed098 100644
--- a/htdocs/core/modules/facture/mod_facture_terre.php
+++ b/htdocs/core/modules/facture/mod_facture_terre.php
@@ -50,7 +50,7 @@ class mod_facture_terre extends ModeleNumRefFactures
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
if (! empty($conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX))
{
@@ -63,7 +63,7 @@ class mod_facture_terre extends ModeleNumRefFactures
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -75,7 +75,7 @@ class mod_facture_terre extends ModeleNumRefFactures
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefixinvoice."0501-0001";
}
@@ -86,7 +86,7 @@ class mod_facture_terre extends ModeleNumRefFactures
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $langs,$conf,$db;
@@ -167,7 +167,7 @@ class mod_facture_terre extends ModeleNumRefFactures
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value
*/
- function getNextValue($objsoc, $invoice, $mode = 'next')
+ public function getNextValue($objsoc, $invoice, $mode = 'next')
{
global $db;
@@ -231,16 +231,16 @@ class mod_facture_terre extends ModeleNumRefFactures
else dol_print_error('', 'Bad parameter for getNextValue');
}
- /**
- * Return next free value
- *
- * @param Societe $objsoc Object third party
- * @param string $objforref Object for number to search
- * @param string $mode 'next' for next value or 'last' for last value
- * @return string Next free value
- */
- function getNumRef($objsoc, $objforref, $mode = 'next')
- {
- return $this->getNextValue($objsoc, $objforref, $mode);
- }
+ /**
+ * Return next free value
+ *
+ * @param Societe $objsoc Object third party
+ * @param string $objforref Object for number to search
+ * @param string $mode 'next' for next value or 'last' for last value
+ * @return string Next free value
+ */
+ public function getNumRef($objsoc, $objforref, $mode = 'next')
+ {
+ return $this->getNextValue($objsoc, $objforref, $mode);
+ }
}
diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php
index 7232853b4d8..7ed9eb7e94a 100644
--- a/htdocs/core/modules/facture/modules_facture.php
+++ b/htdocs/core/modules/facture/modules_facture.php
@@ -42,7 +42,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -50,7 +50,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -80,7 +80,7 @@ abstract class ModeleNumRefFactures
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -90,7 +90,7 @@ abstract class ModeleNumRefFactures
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -102,7 +102,7 @@ abstract class ModeleNumRefFactures
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("bills");
@@ -115,7 +115,7 @@ abstract class ModeleNumRefFactures
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -127,7 +127,7 @@ abstract class ModeleNumRefFactures
* @param Facture $facture Objet facture
* @return string Value
*/
- function getNextValue($objsoc, $facture)
+ public function getNextValue($objsoc, $facture)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -138,15 +138,15 @@ abstract class ModeleNumRefFactures
*
* @return string Valeur
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
}
}
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index 91a4ff6d332..559b4cd6d5e 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -116,7 +116,7 @@ class pdf_soleil extends ModelePDFFicheinter
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -151,7 +151,7 @@ class pdf_soleil extends ModelePDFFicheinter
$this->posxdesc=$this->marge_gauche+1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -163,7 +163,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
@@ -338,15 +338,12 @@ class pdf_soleil extends ModelePDFFicheinter
// Description of product line
$curX = $this->posxdesc-1;
- // Description of product line
- if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR))
- {
- $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'dayhour', false, $outputlangs, true);
- }
- else
- {
- $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'day', false, $outputlangs, true);
- }
+ // Description of product line
+ if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
+ $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'dayhour', false, $outputlangs, true);
+ } else {
+ $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'day', false, $outputlangs, true);
+ }
if ($objectligne->duration > 0)
{
@@ -496,7 +493,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@@ -556,7 +553,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -732,7 +729,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php
index 08f3449d940..25b98473238 100644
--- a/htdocs/core/modules/fichinter/mod_arctic.php
+++ b/htdocs/core/modules/fichinter/mod_arctic.php
@@ -61,7 +61,7 @@ class mod_arctic extends ModeleNumRefFicheinter
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -101,7 +101,7 @@ class mod_arctic extends ModeleNumRefFicheinter
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -124,7 +124,7 @@ class mod_arctic extends ModeleNumRefFicheinter
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc = 0, $object = '')
+ public function getNextValue($objsoc = 0, $object = '')
{
global $db,$conf;
@@ -152,7 +152,7 @@ class mod_arctic extends ModeleNumRefFicheinter
* @param Object $objforref Object for number to search
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref)
+ public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php
index 472ffface10..4f66d6940f1 100644
--- a/htdocs/core/modules/fichinter/mod_pacific.php
+++ b/htdocs/core/modules/fichinter/mod_pacific.php
@@ -61,7 +61,7 @@ class mod_pacific extends ModeleNumRefFicheinter
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -72,7 +72,7 @@ class mod_pacific extends ModeleNumRefFicheinter
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -83,7 +83,7 @@ class mod_pacific extends ModeleNumRefFicheinter
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $langs,$conf,$db;
@@ -122,7 +122,7 @@ class mod_pacific extends ModeleNumRefFicheinter
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc = 0, $object = '')
+ public function getNextValue($objsoc = 0, $object = '')
{
global $db,$conf;
@@ -158,7 +158,7 @@ class mod_pacific extends ModeleNumRefFicheinter
* @param Object $objforref Object for number to search
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref)
+ public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php
index 0c88cd88d56..f5056bf45bb 100644
--- a/htdocs/core/modules/fichinter/modules_fichinter.php
+++ b/htdocs/core/modules/fichinter/modules_fichinter.php
@@ -40,7 +40,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -48,7 +48,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -79,7 +79,7 @@ abstract class ModeleNumRefFicheinter
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -89,7 +89,7 @@ abstract class ModeleNumRefFicheinter
*
* @return string Descriptive text
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("ficheinter");
@@ -101,7 +101,7 @@ abstract class ModeleNumRefFicheinter
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("ficheinter");
@@ -114,7 +114,7 @@ abstract class ModeleNumRefFicheinter
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -124,7 +124,7 @@ abstract class ModeleNumRefFicheinter
*
* @return string Value
*/
- function getNextValue()
+ public function getNextValue()
{
global $langs;
return $langs->trans("NotAvailable");
@@ -135,21 +135,21 @@ abstract class ModeleNumRefFicheinter
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
}
}
-// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF
*
diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
index 3174208e85b..8c6fd9ebe97 100644
--- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php
+++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
@@ -60,9 +60,9 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
*
* @return string text description
*/
- function info()
+ public function info()
{
- global $db, $conf, $langs;
+ global $db, $conf, $langs;
$langs->load("bills");
@@ -96,7 +96,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$user;
@@ -119,7 +119,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
* @param Object $holiday holiday object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($user, $holiday)
+ public function getNextValue($user, $holiday)
{
global $db,$conf;
@@ -138,7 +138,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
return $numFinal;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
@@ -146,7 +146,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
* @param Object $objforref Holiday object
* @return string Value if OK, 0 if KO
*/
- function holiday_get_num($fuser, $objforref)
+ public function holiday_get_num($fuser, $objforref)
{
// phpcs:enable
return $this->getNextValue($fuser, $objforref);
diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php
index 3e118d8aff9..187eb19d80d 100644
--- a/htdocs/core/modules/holiday/mod_holiday_madonna.php
+++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php
@@ -62,7 +62,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -74,7 +74,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -85,7 +85,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
*
* @return boolean false if conflit, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -120,7 +120,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
* @param Object $holiday Holiday object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $holiday)
+ public function getNextValue($objsoc, $holiday)
{
global $db,$conf;
@@ -154,7 +154,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
@@ -162,7 +162,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
* @param Object $objforref Holiday object
* @return string Value if OK, 0 if KO
*/
- function holiday_get_num($fuser, $objforref)
+ public function holiday_get_num($fuser, $objforref)
{
// phpcs:enable
return $this->getNextValue($fuser, $objforref);
diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php
index 8076451b883..9bd0a448ebc 100644
--- a/htdocs/core/modules/holiday/modules_holiday.php
+++ b/htdocs/core/modules/holiday/modules_holiday.php
@@ -44,7 +44,7 @@ abstract class ModelePDFHoliday extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -52,7 +52,7 @@ abstract class ModelePDFHoliday extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -83,7 +83,7 @@ class ModelNumRefHolidays
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -93,7 +93,7 @@ class ModelNumRefHolidays
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("holidays");
@@ -105,7 +105,7 @@ class ModelNumRefHolidays
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("holidays");
@@ -117,7 +117,7 @@ class ModelNumRefHolidays
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -129,7 +129,7 @@ class ModelNumRefHolidays
* @param Object $contract contract object
* @return string Value
*/
- function getNextValue($objsoc, $contract)
+ public function getNextValue($objsoc, $contract)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -140,7 +140,7 @@ class ModelNumRefHolidays
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
@@ -149,6 +149,6 @@ class ModelNumRefHolidays
elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
+ else return $langs->trans("NotAvailable");
}
}
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 17b6e556908..dbb8fadfe12 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -93,7 +93,7 @@ class ImportCsv extends ModeleImports
* @param DoliDB $db Database handler
* @param string $datatoimport String code describing import set (ex: 'societe_1')
*/
- function __construct($db, $datatoimport)
+ public function __construct($db, $datatoimport)
{
global $conf, $langs;
$this->db = $db;
@@ -118,20 +118,20 @@ class ImportCsv extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output header of an example file for this format
*
* @param Translate $outputlangs Output language
* @return string
*/
- function write_header_example($outputlangs)
+ public function write_header_example($outputlangs)
{
// phpcs:enable
return '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output title line of an example file for this format
*
@@ -139,14 +139,14 @@ class ImportCsv extends ModeleImports
* @param array $headerlinefields Array of fields name
* @return string
*/
- function write_title_example($outputlangs, $headerlinefields)
+ public function write_title_example($outputlangs, $headerlinefields)
{
// phpcs:enable
$s=join($this->separator, array_map('cleansep', $headerlinefields));
return $s."\n";
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output record of an example file for this format
*
@@ -154,21 +154,21 @@ class ImportCsv extends ModeleImports
* @param array $contentlinevalues Array of lines
* @return string
*/
- function write_record_example($outputlangs, $contentlinevalues)
+ public function write_record_example($outputlangs, $contentlinevalues)
{
// phpcs:enable
$s=join($this->separator, array_map('cleansep', $contentlinevalues));
return $s."\n";
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output footer of an example file for this format
*
* @param Translate $outputlangs Output language
* @return string
*/
- function write_footer_example($outputlangs)
+ public function write_footer_example($outputlangs)
{
// phpcs:enable
return '';
@@ -176,14 +176,14 @@ class ImportCsv extends ModeleImports
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Open input file
*
* @param string $file Path of filename
* @return int <0 if KO, >=0 if OK
*/
- function import_open_file($file)
+ public function import_open_file($file)
{
// phpcs:enable
global $langs;
@@ -209,40 +209,40 @@ class ImportCsv extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of records. File must be closed.
*
* @param string $file Path of filename
* @return int <0 if KO, >=0 if OK
*/
- function import_get_nb_of_lines($file)
+ public function import_get_nb_of_lines($file)
{
// phpcs:enable
return dol_count_nb_of_line($file);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Input header line from file
*
* @return int <0 if KO, >=0 if OK
*/
- function import_read_header()
+ public function import_read_header()
{
// phpcs:enable
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return array of next record in input file.
*
* @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string)
*/
- function import_read_record()
+ public function import_read_record()
{
// phpcs:enable
global $conf;
@@ -293,13 +293,13 @@ class ImportCsv extends ModeleImports
return $newarrayres;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close file handle
*
* @return integer
*/
- function import_close_file()
+ public function import_close_file()
{
// phpcs:enable
fclose($this->handle);
@@ -307,7 +307,7 @@ class ImportCsv extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Insert a record into database
*
@@ -319,7 +319,7 @@ class ImportCsv extends ModeleImports
* @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor.
* @return int <0 if KO, >0 if OK
*/
- function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
+ public function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
{
// phpcs:enable
global $langs,$conf,$user;
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index 3cdd100068e..44134281fb4 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -95,7 +95,7 @@ class ImportXlsx extends ModeleImports
* @param DoliDB $db Database handler
* @param string $datatoimport String code describing import set (ex: 'societe_1')
*/
- function __construct($db, $datatoimport)
+ public function __construct($db, $datatoimport)
{
global $conf,$langs;
$this->db = $db;
@@ -125,14 +125,14 @@ class ImportXlsx extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output header of an example file for this format
*
* @param Translate $outputlangs Output language
* @return string
*/
- function write_header_example($outputlangs)
+ public function write_header_example($outputlangs)
{
// phpcs:enable
global $user,$conf,$langs;
@@ -158,7 +158,7 @@ class ImportXlsx extends ModeleImports
return '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output title line of an example file for this format
*
@@ -166,7 +166,7 @@ class ImportXlsx extends ModeleImports
* @param array $headerlinefields Array of fields name
* @return string
*/
- function write_title_example($outputlangs, $headerlinefields)
+ public function write_title_example($outputlangs, $headerlinefields)
{
// phpcs:enable
global $conf;
@@ -184,7 +184,7 @@ class ImportXlsx extends ModeleImports
return ''; // final output will be generated in footer
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output record of an example file for this format
*
@@ -192,7 +192,7 @@ class ImportXlsx extends ModeleImports
* @param array $contentlinevalues Array of lines
* @return string
*/
- function write_record_example($outputlangs, $contentlinevalues)
+ public function write_record_example($outputlangs, $contentlinevalues)
{
// phpcs:enable
$col = 0;
@@ -205,14 +205,14 @@ class ImportXlsx extends ModeleImports
return ''; // final output will be generated in footer
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output footer of an example file for this format
*
* @param Translate $outputlangs Output language
* @return string
*/
- function write_footer_example($outputlangs)
+ public function write_footer_example($outputlangs)
{
// phpcs:enable
// return the file content as a string
@@ -229,14 +229,14 @@ class ImportXlsx extends ModeleImports
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Open input file
*
* @param string $file Path of filename
* @return int <0 if KO, >=0 if OK
*/
- function import_open_file($file)
+ public function import_open_file($file)
{
// phpcs:enable
global $langs;
@@ -253,14 +253,14 @@ class ImportXlsx extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of records. File must be closed.
*
* @param string $file Path of filename
* @return int <0 if KO, >=0 if OK
*/
- function import_get_nb_of_lines($file)
+ public function import_get_nb_of_lines($file)
{
// phpcs:enable
$reader = new PHPExcel_Reader_Excel2007();
@@ -275,13 +275,13 @@ class ImportXlsx extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Input header line from file
*
* @return int <0 if KO, >=0 if OK
*/
- function import_read_header()
+ public function import_read_header()
{
// phpcs:enable
// This is not called by the import code !!!
@@ -294,13 +294,13 @@ class ImportXlsx extends ModeleImports
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return array of next record in input file.
*
* @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string)
*/
- function import_read_record()
+ public function import_read_record()
{
// phpcs:enable
global $conf;
@@ -319,13 +319,13 @@ class ImportXlsx extends ModeleImports
return $array;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close file handle
*
* @return integer
*/
- function import_close_file()
+ public function import_close_file()
{
// phpcs:enable
$this->workbook->disconnectWorksheets();
@@ -334,7 +334,7 @@ class ImportXlsx extends ModeleImports
// What is this doing here ? it is common to all imports, is should be in the parent class
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Insert a record into database
*
@@ -346,7 +346,7 @@ class ImportXlsx extends ModeleImports
* @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor.
* @return int <0 if KO, >0 if OK
*/
- function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
+ public function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
{
// phpcs:enable
global $langs,$conf,$user;
diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php
index 1c885bda1b4..7595c3c6c52 100644
--- a/htdocs/core/modules/import/modules_import.php
+++ b/htdocs/core/modules/import/modules_import.php
@@ -79,7 +79,7 @@ class ModeleImports
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
}
@@ -89,7 +89,7 @@ class ModeleImports
*
* @return string Id
*/
- function getDriverId()
+ public function getDriverId()
{
return $this->id;
}
@@ -99,7 +99,7 @@ class ModeleImports
*
* @return string Label
*/
- function getDriverLabel()
+ public function getDriverLabel()
{
return $this->label;
}
@@ -109,7 +109,7 @@ class ModeleImports
*
* @return string Description
*/
- function getDriverDesc()
+ public function getDriverDesc()
{
return $this->desc;
}
@@ -119,7 +119,7 @@ class ModeleImports
*
* @return string Driver suffix
*/
- function getDriverExtension()
+ public function getDriverExtension()
{
return $this->extension;
}
@@ -129,7 +129,7 @@ class ModeleImports
*
* @return string Driver version
*/
- function getDriverVersion()
+ public function getDriverVersion()
{
return $this->version;
}
@@ -139,7 +139,7 @@ class ModeleImports
*
* @return string Label of external lib
*/
- function getLibLabel()
+ public function getLibLabel()
{
return $this->label_lib;
}
@@ -149,13 +149,13 @@ class ModeleImports
*
* @return string Version of external lib
*/
- function getLibVersion()
+ public function getLibVersion()
{
return $this->version_lib;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge en memoire et renvoie la liste des modeles actifs
*
@@ -163,7 +163,7 @@ class ModeleImports
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- function liste_modeles($db, $maxfilenamelength = 0)
+ public function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
dol_syslog(get_class($this)."::liste_modeles");
@@ -213,7 +213,7 @@ class ModeleImports
* @param string $key Key
* @return string
*/
- function getPictoForKey($key)
+ public function getPictoForKey($key)
{
return $this->picto[$key];
}
@@ -224,7 +224,7 @@ class ModeleImports
* @param string $key Key
* @return string
*/
- function getDriverLabelForKey($key)
+ public function getDriverLabelForKey($key)
{
return $this->driverlabel[$key];
}
@@ -235,7 +235,7 @@ class ModeleImports
* @param string $key Key
* @return string
*/
- function getDriverDescForKey($key)
+ public function getDriverDescForKey($key)
{
return $this->driverdesc[$key];
}
@@ -246,7 +246,7 @@ class ModeleImports
* @param string $key Key
* @return string
*/
- function getDriverVersionForKey($key)
+ public function getDriverVersionForKey($key)
{
return $this->driverversion[$key];
}
@@ -257,7 +257,7 @@ class ModeleImports
* @param string $key Key
* @return string
*/
- function getLibLabelForKey($key)
+ public function getLibLabelForKey($key)
{
return $this->liblabel[$key];
}
@@ -268,7 +268,7 @@ class ModeleImports
* @param string $key Key
* @return string
*/
- function getLibVersionForKey($key)
+ public function getLibVersionForKey($key)
{
return $this->libversion[$key];
}
diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
index e8e5a6f9205..e84a05dd227 100644
--- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
+++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
@@ -117,7 +117,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -174,20 +174,20 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
- * @param Object $object Object to generate
- * @param Translate $outputlangs Lang output object
- * @param string $srctemplatepath Full path of source filename for generator using a template file
- * @param int $hidedetails Do not show line details
- * @param int $hidedesc Do not show desc
- * @param int $hideref Do not show ref
+ * @param Object $object Object to generate
+ * @param Translate $outputlangs Lang output object
+ * @param string $srctemplatepath Full path of source filename for generator using a template file
+ * @param int $hidedetails Do not show line details
+ * @param int $hidedesc Do not show desc
+ * @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -637,7 +637,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -647,7 +647,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param Translate $outputlangs Langs object
* @return void
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -678,7 +678,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@@ -740,7 +740,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$hookmanager;
@@ -910,18 +910,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
+ * @param PDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
- {
- global $conf;
- $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
- return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
- }
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ {
+ global $conf;
+ $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
+ return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
+ }
}
diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php
index 89cb2794be3..fe94bf839c1 100644
--- a/htdocs/core/modules/livraison/mod_livraison_jade.php
+++ b/htdocs/core/modules/livraison/mod_livraison_jade.php
@@ -65,7 +65,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -76,7 +76,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -87,7 +87,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $langs,$conf,$db;
@@ -125,7 +125,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -138,8 +138,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
$resql=$db->query($sql);
dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG);
- if ($resql)
- {
+ if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) $max = intval($obj->max);
else $max=0;
@@ -161,15 +160,15 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Return next free ref
- *
- * @param Societe $objsoc Object thirdparty
- * @param Object $object Object livraison
- * @return string Texte descriptif
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return next free ref
+ *
+ * @param Societe $objsoc Object thirdparty
+ * @param Object $object Object livraison
+ * @return string Texte descriptif
*/
- function livraison_get_num($objsoc = 0, $object = '')
+ public function livraison_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php
index 4f8a0640816..2fc2e16d7fd 100644
--- a/htdocs/core/modules/livraison/mod_livraison_saphir.php
+++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php
@@ -60,8 +60,8 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
*
* @return string Texte descripif
*/
- function info()
- {
+ public function info()
+ {
global $conf, $langs;
$langs->load("bills");
@@ -100,7 +100,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -124,7 +124,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
* @param Object $object Object delivery
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -152,13 +152,13 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref)
+ public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free ref
*
@@ -166,7 +166,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
* @param Object $object Objet livraison
* @return string Texte descripif
*/
- function livraison_get_num($objsoc = 0, $object = '')
+ public function livraison_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php
index 8ed70b102fd..ce9d9b77f77 100644
--- a/htdocs/core/modules/livraison/modules_livraison.php
+++ b/htdocs/core/modules/livraison/modules_livraison.php
@@ -36,119 +36,119 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
- * Return list of active generation modules
- *
- * @param DoliDB $db Database handler
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
- */
- static function liste_modeles($db, $maxfilenamelength = 0)
- {
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- $type='delivery';
- $liste=array();
+ $type='delivery';
+ $liste=array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $liste=getListOfModels($db, $type, $maxfilenamelength);
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $liste=getListOfModels($db, $type, $maxfilenamelength);
- return $liste;
- }
+ return $liste;
+ }
}
/**
- * \class ModeleNumRefDeliveryOrder
- * \brief Classe mere des modeles de numerotation des references de bon de livraison
+ * \class ModeleNumRefDeliveryOrder
+ * \brief Classe mere des modeles de numerotation des references de bon de livraison
*/
abstract class ModeleNumRefDeliveryOrder
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- /**
- * Return if a module can be used or not
- *
- * @return boolean true if module can be used
- */
- function isEnabled()
- {
- return true;
- }
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
- /**
- * Renvoi la description par defaut du modele de numerotation
- *
- * @return string Texte descripif
- */
- function info()
- {
- global $langs;
- $langs->load("deliveries");
- return $langs->trans("NoDescription");
- }
+ /**
+ * Renvoi la description par defaut du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("deliveries");
+ return $langs->trans("NoDescription");
+ }
- /**
- * Renvoi un exemple de numerotation
- *
- * @return string Example
- */
- function getExample()
- {
- global $langs;
- $langs->load("deliveries");
- return $langs->trans("NoExample");
- }
+ /**
+ * Renvoi un exemple de numerotation
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("deliveries");
+ return $langs->trans("NoExample");
+ }
- /**
- * Test si les numeros deja en vigueur dans la base ne provoquent pas d
- * de conflits qui empechera cette numerotation de fonctionner.
- *
- * @return boolean false si conflit, true si ok
- */
- function canBeActivated()
- {
- return true;
- }
+ /**
+ * Test si les numeros deja en vigueur dans la base ne provoquent pas d
+ * de conflits qui empechera cette numerotation de fonctionner.
+ *
+ * @return boolean false si conflit, true si ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
- /**
- * Renvoi prochaine valeur attribuee
- *
- * @param Societe $objsoc Object third party
- * @param Object $object Object delivery
- * @return string Valeur
- */
- function getNextValue($objsoc, $object)
- {
- global $langs;
- return $langs->trans("NotAvailable");
- }
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @param Societe $objsoc Object third party
+ * @param Object $object Object delivery
+ * @return string Valeur
+ */
+ public function getNextValue($objsoc, $object)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
- /**
- * Renvoi version du module numerotation
- *
- * @return string Valeur
- */
- function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Renvoi version du module numerotation
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
+ }
}
diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php
index 180feec8699..a29fdd119bf 100644
--- a/htdocs/core/modules/mailings/advthirdparties.modules.php
+++ b/htdocs/core/modules/mailings/advthirdparties.modules.php
@@ -25,13 +25,13 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
*/
class mailing_advthirdparties extends MailingTargets
{
- var $name='ThirdPartyAdvancedTargeting';
+ public $name='ThirdPartyAdvancedTargeting';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc="Third parties";
- var $require_admin=0;
+ public $desc="Third parties";
+ public $require_admin=0;
- var $require_module=array("none"); // This module should not be displayed as Selector in mailling
- var $picto='company';
+ public $require_module=array("none"); // This module should not be displayed as Selector in mailling
+ public $picto='company';
/**
* @var DoliDB Database handler.
@@ -44,13 +44,13 @@ class mailing_advthirdparties extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* This is the main function that returns the array of emails
*
@@ -60,7 +60,7 @@ class mailing_advthirdparties extends MailingTargets
* @param array $contactid Array of contact id to add
* @return int <0 if error, number of emails added if ok
*/
- function add_to_target_spec($mailing_id, $socid, $type_of_target, $contactid)
+ public function add_to_target_spec($mailing_id, $socid, $type_of_target, $contactid)
{
// phpcs:enable
global $conf, $langs;
@@ -190,7 +190,7 @@ class mailing_advthirdparties extends MailingTargets
*
* @return array Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
// CHANGE THIS: Optionnal
@@ -208,7 +208,7 @@ class mailing_advthirdparties extends MailingTargets
* @param string $sql Not use here
* @return int Nb of recipients
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
global $conf;
@@ -228,7 +228,7 @@ class mailing_advthirdparties extends MailingTargets
*
* @return string A html select zone
*/
- function formFilter()
+ public function formFilter()
{
global $conf, $langs;
@@ -287,7 +287,7 @@ class mailing_advthirdparties extends MailingTargets
* @param string $type type
* @return string Url link
*/
- function url($id, $type)
+ public function url($id, $type)
{
if ($type=='thirdparty') {
$companystatic=new Societe($this->db);
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 77d1cc10d72..79c58b1c7ce 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -32,12 +32,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
*/
class mailing_contacts1 extends MailingTargets
{
- var $name='ContactCompanies'; // Identifiant du module mailing
+ public $name='ContactCompanies'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc='Contacts of thirdparties (prospects, customers, suppliers...)';
- var $require_module=array("societe"); // Module mailing actif si modules require_module actifs
- var $require_admin=0; // Module mailing actif pour user admin ou non
- var $picto='contact';
+ public $desc='Contacts of thirdparties (prospects, customers, suppliers...)';
+ public $require_module=array("societe"); // Module mailing actif si modules require_module actifs
+ public $require_admin=0; // Module mailing actif pour user admin ou non
+ public $picto='contact';
/**
* @var DoliDB Database handler.
@@ -45,15 +45,15 @@ class mailing_contacts1 extends MailingTargets
public $db;
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- function __construct($db)
- {
- $this->db=$db;
- }
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db=$db;
+ }
/**
@@ -64,8 +64,8 @@ class mailing_contacts1 extends MailingTargets
*
* @return string[] Array with SQL requests
*/
- function getSqlArrayForStats()
- {
+ public function getSqlArrayForStats()
+ {
global $conf, $langs;
$langs->load("commercial");
@@ -80,7 +80,7 @@ class mailing_contacts1 extends MailingTargets
$statssql[0].= " AND c.statut = 1";
return $statssql;
- }
+ }
/**
@@ -91,8 +91,8 @@ class mailing_contacts1 extends MailingTargets
* @param string $sql Requete sql de comptage
* @return int
*/
- function getNbOfRecipients($sql = '')
- {
+ public function getNbOfRecipients($sql = '')
+ {
global $conf;
$sql = "SELECT count(distinct(c.email)) as nb";
@@ -105,7 +105,7 @@ class mailing_contacts1 extends MailingTargets
// The request must return a field called "nb" to be understandable by parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
- }
+ }
/**
@@ -113,8 +113,8 @@ class mailing_contacts1 extends MailingTargets
*
* @return string Retourne zone select
*/
- function formFilter()
- {
+ public function formFilter()
+ {
global $langs;
// Load translation files required by the page
@@ -311,7 +311,7 @@ class mailing_contacts1 extends MailingTargets
$s.='';
return $s;
- }
+ }
/**
@@ -320,21 +320,21 @@ class mailing_contacts1 extends MailingTargets
* @param int $id ID
* @return string Url lien
*/
- function url($id)
- {
- return ''.img_object('', "contact").' ';
- }
+ public function url($id)
+ {
+ return ''.img_object('', "contact").' ';
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
*
* @param int $mailing_id Id of emailing
* @return int <0 si erreur, nb ajout si ok
*/
- function add_to_target($mailing_id)
- {
+ public function add_to_target($mailing_id)
+ {
// phpcs:enable
global $conf, $langs;
@@ -448,5 +448,5 @@ class mailing_contacts1 extends MailingTargets
}
return parent::add_to_target($mailing_id, $cibles);
- }
+ }
}
diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php
index 8feadc6b6e2..45af3dd5b4d 100644
--- a/htdocs/core/modules/mailings/example.modules.php
+++ b/htdocs/core/modules/mailings/example.modules.php
@@ -26,17 +26,17 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
class mailing_example extends MailingTargets
{
// CHANGE THIS: Put here a name not already used
- var $name='example';
+ public $name='example';
// CHANGE THIS: Put here a description of your selector module.
// This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found
- var $desc='Put here a description';
- // CHANGE THIS: Set to 1 if selector is available for admin users only
- var $require_admin=0;
+ public $desc='Put here a description';
+ // CHANGE THIS: Set to 1 if selector is available for admin users only
+ public $require_admin=0;
// CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector
- var $tooltip='MyTooltipLangKey';
+ public $tooltip='MyTooltipLangKey';
- var $require_module=array();
- var $picto='';
+ public $require_module=array();
+ public $picto='';
/**
* @var DoliDB Database handler.
@@ -50,20 +50,20 @@ class mailing_example extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* This is the main function that returns the array of emails
*
* @param int $mailing_id Id of mailing. No need to use it.
* @return int <0 if error, number of emails added if ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
$target = array();
@@ -92,7 +92,7 @@ class mailing_example extends MailingTargets
*
* @return array Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
// CHANGE THIS: Optionnal
@@ -103,14 +103,14 @@ class mailing_example extends MailingTargets
/**
- * Return here number of distinct emails returned by your selector.
- * For example if this selector is used to extract 500 different
- * emails from a text file, this function must return 500.
+ * Return here number of distinct emails returned by your selector.
+ * For example if this selector is used to extract 500 different
+ * emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
- * @return int|string Number of recipient or '?'
+ * @return int|string Number of recipient or '?'
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
// CHANGE THIS: Optionnal
@@ -121,11 +121,11 @@ class mailing_example extends MailingTargets
/**
* This is to add a form filter to provide variant of selector
- * If used, the HTML select must be called "filter"
+ * If used, the HTML select must be called "filter"
*
* @return string A html select zone
*/
- function formFilter()
+ public function formFilter()
{
// CHANGE THIS: Optionnal
@@ -141,7 +141,7 @@ class mailing_example extends MailingTargets
* @param int $id ID
* @return string Url link
*/
- function url($id)
+ public function url($id)
{
// CHANGE THIS: Optionnal
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index d417bdc8bef..2ea4ba8e3b5 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -33,14 +33,14 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
*/
class mailing_fraise extends MailingTargets
{
- var $name='FundationMembers'; // Identifiant du module mailing
+ public $name='FundationMembers'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc='Foundation members with emails';
+ public $desc='Foundation members with emails';
// Set to 1 if selector is available for admin users only
- var $require_admin=0;
+ public $require_admin=0;
- var $require_module=array('adherent');
- var $picto='user';
+ public $require_module=array('adherent');
+ public $picto='user';
/**
* @var DoliDB Database handler.
@@ -52,7 +52,7 @@ class mailing_fraise extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -66,7 +66,7 @@ class mailing_fraise extends MailingTargets
*
* @return string[] Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
global $langs;
@@ -90,7 +90,7 @@ class mailing_fraise extends MailingTargets
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
$sql = "SELECT count(distinct(a.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
@@ -107,7 +107,7 @@ class mailing_fraise extends MailingTargets
*
* @return string Retourne zone select
*/
- function formFilter()
+ public function formFilter()
{
global $conf, $langs;
@@ -214,20 +214,20 @@ class mailing_fraise extends MailingTargets
* @param int $id ID
* @return string Url lien
*/
- function url($id)
+ public function url($id)
{
return ''.img_object('', "user").' ';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
*
* @param int $mailing_id Id of emailing
* @return int < 0 si erreur, nb ajout si ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
global $langs,$_POST;
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index 0e28b156e09..6c97e165199 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -49,7 +49,7 @@ class MailingTargets // This can't be abstract as it is used for some method
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -59,7 +59,7 @@ class MailingTargets // This can't be abstract as it is used for some method
*
* @return string Return translation of module label. Try translation of $this->name then translation of 'MailingModuleDesc'.$this->name, or $this->desc if not found
*/
- function getDesc()
+ public function getDesc()
{
global $langs, $form;
@@ -80,7 +80,7 @@ class MailingTargets // This can't be abstract as it is used for some method
*
* @return integer Example
*/
- function getNbOfRecords()
+ public function getNbOfRecords()
{
return 0;
}
@@ -91,7 +91,7 @@ class MailingTargets // This can't be abstract as it is used for some method
* @param string $sql Sql request to count
* @return int Nb of recipient, or <0 if error
*/
- function getNbOfRecipients($sql)
+ public function getNbOfRecipients($sql)
{
$result=$this->db->query($sql);
if ($result)
@@ -112,19 +112,19 @@ class MailingTargets // This can't be abstract as it is used for some method
*
* @return string Retourne zone select
*/
- function formFilter()
+ public function formFilter()
{
return '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Met a jour nombre de destinataires
*
* @param int $mailing_id Id of emailing
* @return int < 0 si erreur, nb destinataires si ok
*/
- function update_nb($mailing_id)
+ public function update_nb($mailing_id)
{
// phpcs:enable
// Mise a jour nombre de destinataire dans table des mailings
@@ -151,7 +151,7 @@ class MailingTargets // This can't be abstract as it is used for some method
return $nb;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
*
@@ -159,7 +159,7 @@ class MailingTargets // This can't be abstract as it is used for some method
* @param array $cibles Array with targets
* @return int < 0 si erreur, nb ajout si ok
*/
- function add_to_target($mailing_id, $cibles)
+ public function add_to_target($mailing_id, $cibles)
{
// phpcs:enable
global $conf;
@@ -200,8 +200,8 @@ class MailingTargets // This can't be abstract as it is used for some method
if ($this->db->errno() != 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
// Si erreur autre que doublon
- dol_syslog($this->db->error());
- $this->error=$this->db->error();
+ dol_syslog($this->db->error().' : '.$targetarray['email']);
+ $this->error=$this->db->error().' : '.$targetarray['email'];
$this->db->rollback();
return -1;
}
@@ -247,14 +247,14 @@ class MailingTargets // This can't be abstract as it is used for some method
return $j;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Supprime tous les destinataires de la table des cibles
*
- * @param int $mailing_id Id of emailing
- * @return void
+ * @param int $mailing_id Id of emailing
+ * @return void
*/
- function clear_target($mailing_id)
+ public function clear_target($mailing_id)
{
// phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php
index a0815aac9ec..74dc86c1d9a 100644
--- a/htdocs/core/modules/mailings/pomme.modules.php
+++ b/htdocs/core/modules/mailings/pomme.modules.php
@@ -30,12 +30,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
*/
class mailing_pomme extends MailingTargets
{
- var $name='DolibarrUsers'; // Identifiant du module mailing
+ public $name='DolibarrUsers'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
- var $require_module=array(); // Module mailing actif si modules require_module actifs
- var $require_admin=1; // Module mailing actif pour user admin ou non
- var $picto='user';
+ public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
+ public $require_module=array(); // Module mailing actif si modules require_module actifs
+ public $require_admin=1; // Module mailing actif pour user admin ou non
+ public $picto='user';
/**
* @var DoliDB Database handler.
@@ -48,7 +48,7 @@ class mailing_pomme extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
@@ -62,7 +62,7 @@ class mailing_pomme extends MailingTargets
*
* @return string[] Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
global $conf, $langs;
@@ -88,7 +88,7 @@ class mailing_pomme extends MailingTargets
* @param string $sql SQL request to use to count
* @return int Number of recipients
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
global $conf;
@@ -108,7 +108,7 @@ class mailing_pomme extends MailingTargets
*
* @return string Retourne zone select
*/
- function formFilter()
+ public function formFilter()
{
global $langs;
@@ -140,20 +140,20 @@ class mailing_pomme extends MailingTargets
* @param int $id ID
* @return string Url lien
*/
- function url($id)
+ public function url($id)
{
return ''.img_object('', "user").' ';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
*
* @param int $mailing_id Id of emailing
* @return int < 0 si erreur, nb ajout si ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
global $conf, $langs;
@@ -191,17 +191,17 @@ class mailing_pomme extends MailingTargets
if ($old <> $obj->email)
{
$cibles[$j] = array(
- 'email' => $obj->email,
- 'fk_contact' => $obj->fk_contact,
- 'lastname' => $obj->lastname,
- 'firstname' => $obj->firstname,
- 'other' =>
- ($langs->transnoentities("Login").'='.$obj->login).';'.
- ($langs->transnoentities("UserTitle").'='.$obj->civility_id).';'.
- ($langs->transnoentities("PhonePro").'='.$obj->office_phone),
- 'source_url' => $this->url($obj->id),
- 'source_id' => $obj->id,
- 'source_type' => 'user'
+ 'email' => $obj->email,
+ 'fk_contact' => $obj->fk_contact,
+ 'lastname' => $obj->lastname,
+ 'firstname' => $obj->firstname,
+ 'other' =>
+ ($langs->transnoentities("Login").'='.$obj->login).';'.
+ ($langs->transnoentities("UserTitle").'='.$obj->civility_id).';'.
+ ($langs->transnoentities("PhonePro").'='.$obj->office_phone),
+ 'source_url' => $this->url($obj->id),
+ 'source_id' => $obj->id,
+ 'source_type' => 'user'
);
$old = $obj->email;
$j++;
@@ -218,5 +218,5 @@ class mailing_pomme extends MailingTargets
}
return parent::add_to_target($mailing_id, $cibles);
- }
+ }
}
diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php
index 4835fe5123d..9a30a063ad3 100644
--- a/htdocs/core/modules/mailings/thirdparties.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties.modules.php
@@ -24,13 +24,13 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
*/
class mailing_thirdparties extends MailingTargets
{
- var $name='ThirdPartiesByCategories';
+ public $name='ThirdPartiesByCategories';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc="Third parties (by categories)";
- var $require_admin=0;
+ public $desc="Third parties (by categories)";
+ public $require_admin=0;
- var $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated
- var $picto='company';
+ public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated
+ public $picto='company';
/**
* @var DoliDB Database handler.
@@ -43,7 +43,7 @@ class mailing_thirdparties extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
$langs->load("companies");
@@ -52,14 +52,14 @@ class mailing_thirdparties extends MailingTargets
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* This is the main function that returns the array of emails
*
* @param int $mailing_id Id of mailing. No need to use it.
* @return int <0 if error, number of emails added if ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
global $conf, $langs;
@@ -200,7 +200,7 @@ class mailing_thirdparties extends MailingTargets
*
* @return array Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
// CHANGE THIS: Optionnal
@@ -218,7 +218,7 @@ class mailing_thirdparties extends MailingTargets
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
global $conf;
@@ -238,7 +238,7 @@ class mailing_thirdparties extends MailingTargets
*
* @return string A html select zone
*/
- function formFilter()
+ public function formFilter()
{
global $conf, $langs;
@@ -319,7 +319,7 @@ class mailing_thirdparties extends MailingTargets
* @param int $id ID
* @return string Url link
*/
- function url($id)
+ public function url($id)
{
return ''.img_object('', "company").' ';
}
diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
index 5c6438b469f..a19c5480722 100644
--- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
@@ -22,20 +22,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
*/
class mailing_thirdparties_services_expired extends MailingTargets
{
- var $name='DolibarrContractsLinesExpired';
+ public $name='DolibarrContractsLinesExpired';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc='Third parties with expired contract\'s lines';
- var $require_admin=0;
+ public $desc='Third parties with expired contract\'s lines';
+ public $require_admin=0;
- var $require_module=array('contrat');
- var $picto='company';
+ public $require_module=array('contrat');
+ public $picto='company';
/**
* @var DoliDB Database handler.
*/
public $db;
- var $arrayofproducts=array();
+ public $arrayofproducts=array();
/**
@@ -43,7 +43,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -77,14 +77,14 @@ class mailing_thirdparties_services_expired extends MailingTargets
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* This is the main function that returns the array of emails
*
* @param int $mailing_id Id of mailing. No need to use it.
* @return int <0 if error, number of emails added if ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
$key=GETPOST('filter', 'int');
@@ -171,7 +171,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
*
* @return array Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
//var $statssql=array();
@@ -189,7 +189,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
* @param string $sql SQL request to use to count
* @return int Number of recipients
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
$now=dol_now();
@@ -215,7 +215,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
*
* @return string A html select zone
*/
- function formFilter()
+ public function formFilter()
{
global $langs;
@@ -238,7 +238,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
* @param int $id ID
* @return string Url link
*/
- function url($id)
+ public function url($id)
{
return ''.img_object('', "company").' ';
}
diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php
index 92f4bb3f059..f4eac646db6 100644
--- a/htdocs/core/modules/mailings/xinputfile.modules.php
+++ b/htdocs/core/modules/mailings/xinputfile.modules.php
@@ -30,24 +30,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
*/
class mailing_xinputfile extends MailingTargets
{
- var $name='EmailsFromFile'; // Identifiant du module mailing
- // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
- var $require_module=array(); // Module mailing actif si modules require_module actifs
- var $require_admin=0; // Module mailing actif pour user admin ou non
- var $picto='generic';
- var $tooltip='UseFormatFileEmailToTarget';
+ public $name='EmailsFromFile'; // Identifiant du module mailing
+ // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
+ public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
+ public $require_module=array(); // Module mailing actif si modules require_module actifs
+ public $require_admin=0; // Module mailing actif pour user admin ou non
+ public $picto='generic';
+ public $tooltip='UseFormatFileEmailToTarget';
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- function __construct($db)
- {
- $this->db=$db;
- }
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db=$db;
+ }
/**
@@ -58,7 +58,7 @@ class mailing_xinputfile extends MailingTargets
*
* @return array Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
global $langs;
$langs->load("users");
@@ -76,7 +76,7 @@ class mailing_xinputfile extends MailingTargets
* @param string $sql Sql request to count
* @return string '' means NA
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
return '';
}
@@ -88,7 +88,7 @@ class mailing_xinputfile extends MailingTargets
* @param int $id ID
* @return string Url lien
*/
- function url($id)
+ public function url($id)
{
global $langs;
return $langs->trans('LineInFile', $id);
@@ -101,7 +101,7 @@ class mailing_xinputfile extends MailingTargets
*
* @return string Retourne zone select
*/
- function formFilter()
+ public function formFilter()
{
global $langs;
@@ -110,14 +110,14 @@ class mailing_xinputfile extends MailingTargets
return $s;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
*
* @param int $mailing_id Id of emailing
* @return int < 0 si erreur, nb ajout si ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
global $conf,$langs,$_FILES;
@@ -180,7 +180,9 @@ class mailing_xinputfile extends MailingTargets
{
$i++;
$langs->load("errors");
- $this->error = $langs->trans("ErrorFoundBadEmailInFile", $i, $cpt, $email);
+ $msg = $langs->trans("ErrorFoundBadEmailInFile", $i, $cpt, $email);
+ if (! empty($msg)) $this->error = $msg;
+ else $this->error = 'ErrorFoundBadEmailInFile '.$i.' '.$cpt.' '.$email; // We experience case where $langs->trans return an empty string.
}
}
}
diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php
index 96177483542..62990ec6f90 100644
--- a/htdocs/core/modules/mailings/xinputuser.modules.php
+++ b/htdocs/core/modules/mailings/xinputuser.modules.php
@@ -30,13 +30,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
*/
class mailing_xinputuser extends MailingTargets
{
- var $name='EmailsFromUser'; // Identifiant du module mailing
+ public $name='EmailsFromUser'; // Identifiant du module mailing
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
- var $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
- var $require_module=array(); // Module mailing actif si modules require_module actifs
- var $require_admin=0; // Module mailing actif pour user admin ou non
- var $picto='generic';
- var $tooltip='UseFormatInputEmailToTarget';
+ public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e
+ public $require_module=array(); // Module mailing actif si modules require_module actifs
+ public $require_admin=0; // Module mailing actif pour user admin ou non
+ public $picto='generic';
+ public $tooltip='UseFormatInputEmailToTarget';
/**
@@ -44,7 +44,7 @@ class mailing_xinputuser extends MailingTargets
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
@@ -58,7 +58,7 @@ class mailing_xinputuser extends MailingTargets
*
* @return array Array with SQL requests
*/
- function getSqlArrayForStats()
+ public function getSqlArrayForStats()
{
global $langs;
$langs->load("users");
@@ -76,7 +76,7 @@ class mailing_xinputuser extends MailingTargets
* @param string $sql Sql request to count
* @return string '' means NA
*/
- function getNbOfRecipients($sql = '')
+ public function getNbOfRecipients($sql = '')
{
return '';
}
@@ -88,7 +88,7 @@ class mailing_xinputuser extends MailingTargets
* @param int $id ID
* @return string Url lien
*/
- function url($id)
+ public function url($id)
{
return '';
}
@@ -99,7 +99,7 @@ class mailing_xinputuser extends MailingTargets
*
* @return string Retourne zone select
*/
- function formFilter()
+ public function formFilter()
{
global $langs;
@@ -108,14 +108,14 @@ class mailing_xinputuser extends MailingTargets
return $s;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
*
* @param int $mailing_id Id of emailing
* @return int < 0 si erreur, nb ajout si ok
*/
- function add_to_target($mailing_id)
+ public function add_to_target($mailing_id)
{
// phpcs:enable
global $conf,$langs,$_FILES;
diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php
index 40b591aed3a..f3a105f99f1 100644
--- a/htdocs/core/modules/member/doc/pdf_standard.class.php
+++ b/htdocs/core/modules/member/doc/pdf_standard.class.php
@@ -42,12 +42,12 @@ class pdf_standard extends CommonStickerGenerator
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
- function addSticker(&$pdf, $outputlangs, $param)
+ public function addSticker(&$pdf, $outputlangs, $param)
{
// use this method in future refactoring
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
* - __LOGO__ is replace with company logo
@@ -63,7 +63,7 @@ class pdf_standard extends CommonStickerGenerator
* @param string $photo Photo (full path to image file used as replacement for key __PHOTOS__ into left, right, header or footer text)
* @return void
*/
- function Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '', $idmember = 0, $photo = '')
+ public function Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '', $idmember = 0, $photo = '')
{
// phpcs:enable
global $db,$mysoc,$conf,$langs;
@@ -237,7 +237,7 @@ class pdf_standard extends CommonStickerGenerator
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build PDF on disk, then output on HTTP stream.
*
@@ -248,7 +248,7 @@ class pdf_standard extends CommonStickerGenerator
* @param int $nooutput 1=Generate only file on disk and do not return it on response
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0)
{
// phpcs:enable
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php
index 4d70e984d69..cf665b45759 100644
--- a/htdocs/core/modules/member/modules_cards.php
+++ b/htdocs/core/modules/member/modules_cards.php
@@ -40,7 +40,7 @@ class ModelePDFCards
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -48,7 +48,7 @@ class ModelePDFCards
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- function liste_modeles($db, $maxfilenamelength = 0)
+ public function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 2a4ff0fc42e..ea247d3b5f9 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -37,7 +37,7 @@ class modAccounting extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php
index 6cf5e45c7f2..c0d5e8f4116 100644
--- a/htdocs/core/modules/modAdherent.class.php
+++ b/htdocs/core/modules/modAdherent.class.php
@@ -38,23 +38,23 @@ class modAdherent extends DolibarrModules
{
/**
- * Constructor. Define names, constants, directories, boxes, permissions
- *
- * @param DoliDB $db Database handler
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
- global $conf;
+ global $conf;
$this->db = $db;
$this->numero = 310;
$this->family = "hr";
$this->module_position = '55';
- // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
- $this->name = preg_replace('/^mod/i', '', get_class($this));
+ // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
+ $this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Management of members of a foundation or association";
- // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
+ // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto='user';
@@ -67,9 +67,9 @@ class modAdherent extends DolibarrModules
// Dependencies
$this->hidden = false; // A condition to hide module
- $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
- $this->requiredby = array(); // List of module ids to disable if this one is disabled
- $this->conflictwith = array('modMailmanSpip'); // List of module class names as string this module is in conflict with
+ $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
+ $this->requiredby = array(); // List of module ids to disable if this one is disabled
+ $this->conflictwith = array('modMailmanSpip'); // List of module class names as string this module is in conflict with
$this->langfiles = array("members","companies");
$this->phpmin = array(5,4); // Minimum version of PHP required by module
@@ -248,9 +248,9 @@ class modAdherent extends DolibarrModules
$this->rights[$r][5] = 'creer';
- // Menus
- //-------
- $this->menu = 1; // This module add menu entries. They are coded into menu manager.
+ // Menus
+ //-------
+ $this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
@@ -269,36 +269,36 @@ class modAdherent extends DolibarrModules
$this->export_label[$r]='MembersAndSubscriptions';
$this->export_permission[$r]=array(array("adherent","export"));
$this->export_fields_array[$r]=array(
- 'a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.gender'=>"Gender",'a.morphy'=>'Nature',
- 'a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",
- 'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",
- 'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation',
- 'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel',
- 'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount'
- );
+ 'a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.gender'=>"Gender",'a.morphy'=>'Nature',
+ 'a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",
+ 'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",
+ 'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation',
+ 'a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel',
+ 'c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount'
+ );
$this->export_TypeFields_array[$r]=array(
- 'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.gender'=>'Text','a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",
- 'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",
- 'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date',
- 'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle::member_type','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
- );
+ 'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.gender'=>'Text','a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",
+ 'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",
+ 'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date',
+ 'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle::member_type','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
+ );
$this->export_entities_array[$r]=array(
- 'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.gender'=>'member','a.morphy'=>'member',
- 'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",
- 'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",
- 'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member',
- 'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription'
- );
+ 'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.gender'=>'member','a.morphy'=>'member',
+ 'a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",
+ 'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",
+ 'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member',
+ 'a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription'
+ );
// Add extra fields
$keyforselect='adherent'; $keyforelement='member'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- // End add axtra fields
+ // End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent_type as ta, '.MAIN_DB_PREFIX.'adherent as a)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON a.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'subscription as c ON c.fk_adherent = a.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid';
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity('member_type').') ';
$this->export_dependencies_array[$r]=array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@@ -317,54 +317,54 @@ class modAdherent extends DolibarrModules
$this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent','extra'=>MAIN_DB_PREFIX.'adherent_extrafields');
$this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array(
- 'a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.gender'=>"Gender",'a.login'=>"Login*","a.pass"=>"Password",
- "a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",
- 'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",
- 'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",
- 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'
- );
- // Add extra fields
- $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
- $resql=$this->db->query($sql);
- if ($resql) // This can fail when class is used on old database (during migration for example)
- {
- while ($obj=$this->db->fetch_object($resql))
- {
- $fieldname='extra.'.$obj->name;
- $fieldlabel=ucfirst($obj->label);
- $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
- }
- }
- // End add extra fields
- $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
- $this->import_regex_array[$r]=array(
- 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)',
- 'a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
+ 'a.civility'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.gender'=>"Gender",'a.login'=>"Login*","a.pass"=>"Password",
+ "a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",
+ 'a.state_id'=>'StateId','a.country'=>"CountryId",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",
+ 'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",
+ 'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'
+ );
+ // Add extra fields
+ $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
+ $resql=$this->db->query($sql);
+ if ($resql) // This can fail when class is used on old database (during migration for example)
+ {
+ while ($obj=$this->db->fetch_object($resql))
+ {
+ $fieldname='extra.'.$obj->name;
+ $fieldlabel=ucfirst($obj->label);
+ $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
+ }
+ }
+ // End add extra fields
+ $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
+ $this->import_regex_array[$r]=array(
+ 'a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)',
+ 'a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array(
- 'a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1',
- 'a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1',
- 'a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",
- 'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now, '%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'), '%Y-%m-%d')
- );
+ 'a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1',
+ 'a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1',
+ 'a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",
+ 'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now, '%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'), '%Y-%m-%d')
+ );
// Cronjobs
$arraydate=dol_getdate(dol_now());
$datestart=dol_mktime(22, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
$this->cronjobs = array(
- 0=>array(
- 'label'=>'SendReminderForExpiredSubscriptionTitle',
- 'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php',
- 'objectname'=>'Adherent',
- 'method'=>'sendReminderForExpiredSubscription',
- 'parameters'=>'10;0',
- 'comment'=>'SendReminderForExpiredSubscription',
- 'frequency'=>1,
- 'unitfrequency'=> 3600 * 24,
- 'priority'=>50,
- 'status'=>1,
- 'test'=>'$conf->adherent->enabled',
- 'datestart'=>$datestart
- ),
+ 0=>array(
+ 'label'=>'SendReminderForExpiredSubscriptionTitle',
+ 'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php',
+ 'objectname'=>'Adherent',
+ 'method'=>'sendReminderForExpiredSubscription',
+ 'parameters'=>'10;0',
+ 'comment'=>'SendReminderForExpiredSubscription',
+ 'frequency'=>1,
+ 'unitfrequency'=> 3600 * 24,
+ 'priority'=>50,
+ 'status'=>1,
+ 'test'=>'$conf->adherent->enabled',
+ 'datestart'=>$datestart
+ ),
);
}
@@ -377,7 +377,7 @@ class modAdherent extends DolibarrModules
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index fc2c173d90c..95278005fb1 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -43,7 +43,7 @@ class modAgenda extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -204,18 +204,20 @@ class modAgenda extends DolibarrModules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
- $this->menu[$r]=array('fk_menu'=>0,
- 'type'=>'top',
- 'titre'=>'TMenuAgenda',
- 'mainmenu'=>'agenda',
- 'url'=>'/comm/action/index.php',
- 'langs'=>'agenda',
- 'position'=>86,
- 'perms'=>'$user->rights->agenda->myactions->read',
- 'enabled'=>'$conf->agenda->enabled',
- 'target'=>'',
- 'user'=>2);
- $r++;
+ $this->menu[$r]=array(
+ 'fk_menu'=>0,
+ 'type'=>'top',
+ 'titre'=>'TMenuAgenda',
+ 'mainmenu'=>'agenda',
+ 'url'=>'/comm/action/index.php',
+ 'langs'=>'agenda',
+ 'position'=>86,
+ 'perms'=>'$user->rights->agenda->myactions->read',
+ 'enabled'=>'$conf->agenda->enabled',
+ 'target'=>'',
+ 'user'=>2,
+ );
+ $r++;
$this->menu[$r]=array('fk_menu'=>'r=0',
'type'=>'left',
@@ -396,7 +398,7 @@ class modAgenda extends DolibarrModules
$this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date",
'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric",
'ac.durationp'=>"Duree",
- 'cac.libelle'=>"List:c_actioncomm:libelle:id",
+ 'cac.libelle'=>"List:c_actioncomm:libelle:libelle",
's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text',
'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text',
's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text');
diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php
index 8bfec6a1734..b860bf5b9bc 100644
--- a/htdocs/core/modules/modApi.class.php
+++ b/htdocs/core/modules/modApi.class.php
@@ -38,7 +38,7 @@ class modApi extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
@@ -224,14 +224,14 @@ class modApi extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
- $sql = array();
+ public function init($options = '')
+ {
+ $sql = array();
- $result=$this->_load_tables('/api/sql/');
+ $result = $this->_load_tables('/api/sql/');
- return $this->_init($sql, $options);
- }
+ return $this->_init($sql, $options);
+ }
/**
* Function called when module is disabled.
@@ -241,7 +241,7 @@ class modApi extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function remove($options = '')
+ public function remove($options = '')
{
// Remove old constants with entity fields different of 0
$sql = array(
diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php
index d7464c8ac0e..b162fabc559 100644
--- a/htdocs/core/modules/modAsset.class.php
+++ b/htdocs/core/modules/modAsset.class.php
@@ -313,22 +313,22 @@ class modAsset extends DolibarrModules
}
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
- global $conf;
+ public function init($options = '')
+ {
+ global $conf;
- // Permissions
- $this->remove($options);
+ // Permissions
+ $this->remove($options);
- $sql = array();
+ $sql = array();
- return $this->_init($sql, $options);
- }
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php
index 08dcd61351d..fb2c818043e 100644
--- a/htdocs/core/modules/modBanque.class.php
+++ b/htdocs/core/modules/modBanque.class.php
@@ -41,7 +41,7 @@ class modBanque extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -210,7 +210,7 @@ class modBanque extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php
index 7c4fcd78bf1..d3efcd1dbdd 100644
--- a/htdocs/core/modules/modBarcode.class.php
+++ b/htdocs/core/modules/modBarcode.class.php
@@ -39,7 +39,7 @@ class modBarcode extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 55;
@@ -129,7 +129,7 @@ class modBarcode extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php
index 0ed248f00ab..d9833e2978e 100644
--- a/htdocs/core/modules/modBlockedLog.class.php
+++ b/htdocs/core/modules/modBlockedLog.class.php
@@ -30,21 +30,21 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modBlockedLog extends DolibarrModules
{
/**
- * Constructor. Define names, constants, directories, boxes, permissions
- *
- * @param DoliDB $db Database handler
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
- global $langs, $conf, $mysoc;
+ global $langs, $conf, $mysoc;
$this->db = $db;
$this->numero = 3200;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'blockedlog';
- // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
- // It is used to group modules in module setup page
+ // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
+ // It is used to group modules in module setup page
$this->family = "base";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '75';
@@ -67,10 +67,10 @@ class modBlockedLog extends DolibarrModules
// Dependancies
//-------------
- $this->hidden = false; // A condition to disable module
- $this->depends = array('always'=>'modFacture'); // List of modules id that must be enabled if this module is enabled
+ $this->hidden = false; // A condition to disable module
+ $this->depends = array('always'=>'modFacture'); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
- $this->conflictwith = array(); // List of modules id this module is in conflict with
+ $this->conflictwith = array(); // List of modules id this module is in conflict with
$this->langfiles = array('blockedlog');
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
@@ -81,24 +81,24 @@ class modBlockedLog extends DolibarrModules
// enable this module.
/*if (! empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
{
- $tmp=explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY);
- $this->automatic_activation = array();
- foreach($tmp as $key)
- {
- $this->automatic_activation[$key]='BlockedLogActivatedBecauseRequiredByYourCountryLegislation';
- }
+ $tmp=explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY);
+ $this->automatic_activation = array();
+ foreach($tmp as $key)
+ {
+ $this->automatic_activation[$key]='BlockedLogActivatedBecauseRequiredByYourCountryLegislation';
+ }
}*/
//var_dump($this->automatic_activation);
$this->always_enabled = (!empty($conf->blockedlog->enabled)
- && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY)
- && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
- && $this->alreadyUsed(1));
+ && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY)
+ && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
+ && $this->alreadyUsed(1));
// Constants
//-----------
$this->const = array(
- 1=>array('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', 'chaine', 'FR', 'This is list of country code where the module may be mandatory', 0, 'current', 0)
+ 1=>array('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', 'chaine', 'FR', 'This is list of country code where the module may be mandatory', 0, 'current', 0)
);
// New pages on tabs
@@ -145,12 +145,11 @@ class modBlockedLog extends DolibarrModules
*
* @return boolean True if already used, otherwise False
*/
- function alreadyUsed()
+ public function alreadyUsed()
{
-
- require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
- $b=new BlockedLog($this->db);
- return $b->alreadyUsed(1);
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+ $b=new BlockedLog($this->db);
+ return $b->alreadyUsed(1);
}
@@ -162,89 +161,89 @@ class modBlockedLog extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
- global $conf, $user;
+ global $conf, $user;
- $sql = array();
+ $sql = array();
- // If already used, we add an entry to show we enable module
- require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+ // If already used, we add an entry to show we enable module
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
- $object=new stdClass();
- $object->id = 1;
- $object->element = 'module';
- $object->ref = 'systemevent';
- $object->entity = $conf->entity;
- $object->date = dol_now();
+ $object=new stdClass();
+ $object->id = 1;
+ $object->element = 'module';
+ $object->ref = 'systemevent';
+ $object->entity = $conf->entity;
+ $object->date = dol_now();
- $b=new BlockedLog($this->db);
- $result = $b->setObjectData($object, 'MODULE_SET', 0);
- if ($result < 0)
- {
- $this->error = $b->error;
- $this->errors = $b->erros;
- return 0;
- }
+ $b=new BlockedLog($this->db);
+ $result = $b->setObjectData($object, 'MODULE_SET', 0);
+ if ($result < 0)
+ {
+ $this->error = $b->error;
+ $this->errors = $b->erros;
+ return 0;
+ }
- $res = $b->create($user);
- if ($res<=0) {
- $this->error = $b->error;
- $this->errors = $b->errors;
- return $res;
- }
+ $res = $b->create($user);
+ if ($res<=0) {
+ $this->error = $b->error;
+ $this->errors = $b->errors;
+ return $res;
+ }
- return $this->_init($sql, $options);
+ return $this->_init($sql, $options);
}
/**
- * Function called when module is disabled.
- * The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database.
- * Data directories are not deleted
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options = '')
+ * Function called when module is disabled.
+ * The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database.
+ * Data directories are not deleted
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function remove($options = '')
{
- global $conf, $user;
+ global $conf, $user;
- $sql = array();
+ $sql = array();
- // If already used, we add an entry to show we enable module
- require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
+ // If already used, we add an entry to show we enable module
+ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
- $object=new stdClass();
- $object->id = 1;
- $object->element = 'module';
- $object->ref = 'systemevent';
- $object->entity = $conf->entity;
- $object->date = dol_now();
+ $object=new stdClass();
+ $object->id = 1;
+ $object->element = 'module';
+ $object->ref = 'systemevent';
+ $object->entity = $conf->entity;
+ $object->date = dol_now();
- $b=new BlockedLog($this->db);
- $result = $b->setObjectData($object, 'MODULE_RESET', 0);
- if ($result < 0)
- {
- $this->error = $b->error;
- $this->errors = $b->erros;
- return 0;
- }
+ $b=new BlockedLog($this->db);
+ $result = $b->setObjectData($object, 'MODULE_RESET', 0);
+ if ($result < 0)
+ {
+ $this->error = $b->error;
+ $this->errors = $b->erros;
+ return 0;
+ }
- if ($b->alreadyUsed(1))
- {
- $res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
- }
- else
- {
- $res = $b->create($user);
- }
- if ($res<=0) {
- $this->error = $b->error;
- $this->errors = $b->errors;
- return $res;
- }
+ if ($b->alreadyUsed(1))
+ {
+ $res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
+ }
+ else
+ {
+ $res = $b->create($user);
+ }
+ if ($res<=0) {
+ $this->error = $b->error;
+ $this->errors = $b->errors;
+ return $res;
+ }
- return $this->_remove($sql, $options);
+ return $this->_remove($sql, $options);
}
}
diff --git a/htdocs/core/modules/modBookmark.class.php b/htdocs/core/modules/modBookmark.class.php
index 38da9a62059..0717236a1bb 100644
--- a/htdocs/core/modules/modBookmark.class.php
+++ b/htdocs/core/modules/modBookmark.class.php
@@ -38,7 +38,7 @@ class modBookmark extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 330;
diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php
index ed1a4485152..68dda5a94f2 100644
--- a/htdocs/core/modules/modCashDesk.class.php
+++ b/htdocs/core/modules/modCashDesk.class.php
@@ -35,7 +35,7 @@ class modCashDesk extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
@@ -121,24 +121,24 @@ class modCashDesk extends DolibarrModules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
- }
+ }
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
- $sql = array();
+ public function init($options = '')
+ {
+ $sql = array();
- // Remove permissions and default values
- $this->remove($options);
+ // Remove permissions and default values
+ $this->remove($options);
- return $this->_init($sql, $options);
- }
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php
index 82d0d9d8289..d8f8b6915f3 100644
--- a/htdocs/core/modules/modCategorie.class.php
+++ b/htdocs/core/modules/modCategorie.class.php
@@ -37,7 +37,7 @@ class modCategorie extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -483,7 +483,7 @@ class modCategorie extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modClickToDial.class.php b/htdocs/core/modules/modClickToDial.class.php
index 6e8ad1d3041..a25b0fd4571 100644
--- a/htdocs/core/modules/modClickToDial.class.php
+++ b/htdocs/core/modules/modClickToDial.class.php
@@ -38,7 +38,7 @@ class modClickToDial extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 58;
diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php
index 1e1db01f616..62de6a62b0c 100644
--- a/htdocs/core/modules/modCollab.class.php
+++ b/htdocs/core/modules/modCollab.class.php
@@ -32,33 +32,33 @@ class modCollab extends DolibarrModules
{
/**
- * Constructor. Define names, constants, directories, boxes, permissions
- *
- * @param DoliDB $db Database handler
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
- global $langs,$conf;
+ global $langs,$conf;
$this->db = $db;
$this->numero = 30000;
- // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
- // It is used to group modules in module setup page
+ // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
+ // It is used to group modules in module setup page
$this->family = "portal";
$this->module_position = '51';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc...";
- // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
+ // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.
$this->picto='globe';
- // Data directories to create when module is enabled
- $this->dirs = array("/collab/temp");
+ // Data directories to create when module is enabled
+ $this->dirs = array("/collab/temp");
// Config pages
//-------------
@@ -66,15 +66,15 @@ class modCollab extends DolibarrModules
// Dependancies
//-------------
- $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module
- $this->depends = array(); // List of modules id that must be enabled if this module is enabled
+ $this->hidden = ! empty($conf->global->MODULE_COLLAB_DISABLED); // A condition to disable module
+ $this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
- $this->conflictwith = array(); // List of modules id this module is in conflict with
+ $this->conflictwith = array(); // List of modules id this module is in conflict with
$this->langfiles = array("collab");
// Constants
//-----------
- $this->const = array();
+ $this->const = array();
// New pages on tabs
// -----------------
@@ -84,42 +84,42 @@ class modCollab extends DolibarrModules
//------
$this->boxes = array();
- // Permissions
- $this->rights = array(); // Permission array used by this module
- $this->rights_class = 'collab';
- $r=0;
+ // Permissions
+ $this->rights = array(); // Permission array used by this module
+ $this->rights_class = 'collab';
+ $r=0;
- /*$this->rights[$r][0] = 30001;
- $this->rights[$r][1] = 'Read website content';
- $this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'read';
- $r++;
+ /*$this->rights[$r][0] = 30001;
+ $this->rights[$r][1] = 'Read website content';
+ $this->rights[$r][3] = 0;
+ $this->rights[$r][4] = 'read';
+ $r++;
- $this->rights[$r][0] = 30002;
- $this->rights[$r][1] = 'Create/modify website content';
- $this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'write';
- $r++;
+ $this->rights[$r][0] = 30002;
+ $this->rights[$r][1] = 'Create/modify website content';
+ $this->rights[$r][3] = 0;
+ $this->rights[$r][4] = 'write';
+ $r++;
- $this->rights[$r][0] = 30003;
- $this->rights[$r][1] = 'Delete website content';
- $this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'delete';
- $r++;*/
+ $this->rights[$r][0] = 30003;
+ $this->rights[$r][1] = 'Delete website content';
+ $this->rights[$r][3] = 0;
+ $this->rights[$r][4] = 'delete';
+ $r++;*/
// Main menu entries
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'type'=>'top', // This is a Left menu entry
- 'titre'=>'Collab',
+ 'type'=>'top', // This is a Left menu entry
+ 'titre'=>'Collab',
'mainmenu'=>'collab',
- 'url'=>'/collab/index.php',
- 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
- 'position'=>100,
- 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
- 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
- 'target'=>'',
- 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
+ 'url'=>'/collab/index.php',
+ 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'position'=>100,
+ 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+ 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
+ 'target'=>'',
+ 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
}
diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php
index 63e2fe4bf88..025bbf0a50c 100644
--- a/htdocs/core/modules/modCommande.class.php
+++ b/htdocs/core/modules/modCommande.class.php
@@ -43,7 +43,7 @@ class modCommande extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -269,7 +269,7 @@ class modCommande extends DolibarrModules
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
@@ -299,6 +299,6 @@ class modCommande extends DolibarrModules
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order',".$conf->entity.")"
);
- return $this->_init($sql, $options);
+ return $this->_init($sql, $options);
}
}
diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php
index 226292537f5..01692979c13 100644
--- a/htdocs/core/modules/modComptabilite.class.php
+++ b/htdocs/core/modules/modComptabilite.class.php
@@ -40,7 +40,7 @@ class modComptabilite extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -101,16 +101,16 @@ class modComptabilite extends DolibarrModules
}
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
+ public function init($options = '')
+ {
global $conf;
// Nettoyage avant activation
diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php
index 8bcc645d3ba..b3053cceae0 100644
--- a/htdocs/core/modules/modContrat.class.php
+++ b/htdocs/core/modules/modContrat.class.php
@@ -39,7 +39,7 @@ class modContrat extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
@@ -212,7 +212,7 @@ class modContrat extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php
index 31d27abac0b..f07ddeaeaae 100644
--- a/htdocs/core/modules/modCron.class.php
+++ b/htdocs/core/modules/modCron.class.php
@@ -37,7 +37,7 @@ class modCron extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs, $conf;
diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php
index 5dfc0fb83dd..be88c709090 100644
--- a/htdocs/core/modules/modDataPolicy.class.php
+++ b/htdocs/core/modules/modDataPolicy.class.php
@@ -210,15 +210,15 @@ class modDataPolicy extends DolibarrModules {
*/
public function init($options = '')
{
- global $langs;
+ global $langs;
- $this->_load_tables('/datapolicy/sql/');
+ $this->_load_tables('/datapolicy/sql/');
// Create extrafields
include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
- /*
+ /*
// Extrafield contact
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
@@ -239,7 +239,7 @@ class modDataPolicy extends DolibarrModules {
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
$result1 = $extrafields->addExtraField('datapolicy_date', $langs->trans("DATAPOLICY_date"), 'date', 104, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0);
$result1 = $extrafields->addExtraField('datapolicy_send', $langs->trans("DATAPOLICY_send"), 'date', 105, 3, 'adherent', 0, 0, '', '', 0, '', '0', 0);
- */
+ */
$sql = array();
diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php
index ce2a8056e48..61b725f1d8e 100644
--- a/htdocs/core/modules/modDeplacement.class.php
+++ b/htdocs/core/modules/modDeplacement.class.php
@@ -37,7 +37,7 @@ class modDeplacement extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -152,7 +152,7 @@ class modDeplacement extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php
index 455c28914da..8b1ad690efe 100644
--- a/htdocs/core/modules/modDocumentGeneration.class.php
+++ b/htdocs/core/modules/modDocumentGeneration.class.php
@@ -39,7 +39,7 @@ class modDocumentGeneration extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 1520;
@@ -96,15 +96,15 @@ class modDocumentGeneration extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options = '')
- {
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
global $conf;
// Permissions
diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php
index bb27b309c1d..d196cdb1c0e 100644
--- a/htdocs/core/modules/modDon.class.php
+++ b/htdocs/core/modules/modDon.class.php
@@ -40,7 +40,7 @@ class modDon extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 700;
@@ -151,7 +151,7 @@ class modDon extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php
index 6e915afc6f8..708f0fb86a7 100644
--- a/htdocs/core/modules/modDynamicPrices.class.php
+++ b/htdocs/core/modules/modDynamicPrices.class.php
@@ -36,7 +36,7 @@ class modDynamicPrices extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 2200;
diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php
index 602bc37a03c..0208541d2e2 100644
--- a/htdocs/core/modules/modECM.class.php
+++ b/htdocs/core/modules/modECM.class.php
@@ -37,7 +37,7 @@ class modECM extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php
index 443146d13a4..e096d840864 100644
--- a/htdocs/core/modules/modExpedition.class.php
+++ b/htdocs/core/modules/modExpedition.class.php
@@ -41,7 +41,7 @@ class modExpedition extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -308,14 +308,14 @@ class modExpedition extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php
index d715cb119ca..d6ef55fe646 100644
--- a/htdocs/core/modules/modExpenseReport.class.php
+++ b/htdocs/core/modules/modExpenseReport.class.php
@@ -36,7 +36,7 @@ class modExpenseReport extends DolibarrModules
*
* @param Database $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -203,14 +203,14 @@ class modExpenseReport extends DolibarrModules
}
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories.
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories.
*
- * @param string $options Options
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php
index b0d95137316..d636772caff 100644
--- a/htdocs/core/modules/modExport.class.php
+++ b/htdocs/core/modules/modExport.class.php
@@ -38,7 +38,7 @@ class modExport extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 240;
diff --git a/htdocs/core/modules/modExternalRss.class.php b/htdocs/core/modules/modExternalRss.class.php
index e384bccbcba..4e271b4573f 100644
--- a/htdocs/core/modules/modExternalRss.class.php
+++ b/htdocs/core/modules/modExternalRss.class.php
@@ -38,7 +38,7 @@ class modExternalRss extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -86,7 +86,7 @@ class modExternalRss extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
@@ -126,7 +126,7 @@ class modExternalRss extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function remove($options = '')
+ public function remove($options = '')
{
$sql = array();
diff --git a/htdocs/core/modules/modExternalSite.class.php b/htdocs/core/modules/modExternalSite.class.php
index 0a720579eda..6cbd7141af8 100644
--- a/htdocs/core/modules/modExternalSite.class.php
+++ b/htdocs/core/modules/modExternalSite.class.php
@@ -39,7 +39,7 @@ class modExternalSite extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modFTP.class.php b/htdocs/core/modules/modFTP.class.php
index a54cbc24963..699617cd99e 100644
--- a/htdocs/core/modules/modFTP.class.php
+++ b/htdocs/core/modules/modFTP.class.php
@@ -33,12 +33,12 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modFTP extends DolibarrModules
{
- /**
- * Constructor. Define names, constants, directories, boxes, permissions
- *
- * @param DoliDB $db Database handler
+ /**
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index c8e29205306..106de48e96d 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -40,7 +40,7 @@ class modFacture extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -347,14 +347,14 @@ class modFacture extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf, $langs;
diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php
index 873aba7eb30..7085fbef000 100644
--- a/htdocs/core/modules/modFckeditor.class.php
+++ b/htdocs/core/modules/modFckeditor.class.php
@@ -39,7 +39,7 @@ class modFckeditor extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 2000;
diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php
index de2d40490c0..8267000297b 100644
--- a/htdocs/core/modules/modFicheinter.class.php
+++ b/htdocs/core/modules/modFicheinter.class.php
@@ -42,7 +42,7 @@ class modFicheinter extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -201,14 +201,14 @@ class modFicheinter extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php
index 3510834a836..12193b630c8 100644
--- a/htdocs/core/modules/modFournisseur.class.php
+++ b/htdocs/core/modules/modFournisseur.class.php
@@ -39,7 +39,7 @@ class modFournisseur extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -61,12 +61,13 @@ class modFournisseur extends DolibarrModules
$this->picto='company';
// Data directories to create when module is enabled
- $this->dirs = array("/fournisseur/temp",
- "/fournisseur/commande",
- "/fournisseur/commande/temp",
- "/fournisseur/facture",
- "/fournisseur/facture/temp"
- );
+ $this->dirs = array(
+ "/fournisseur/temp",
+ "/fournisseur/commande",
+ "/fournisseur/commande/temp",
+ "/fournisseur/facture",
+ "/fournisseur/facture/temp"
+ );
// Dependencies
$this->depends = array("modSociete");
@@ -622,7 +623,7 @@ class modFournisseur extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modGeoIPMaxmind.class.php b/htdocs/core/modules/modGeoIPMaxmind.class.php
index 0b090abfa80..91c82e713db 100644
--- a/htdocs/core/modules/modGeoIPMaxmind.class.php
+++ b/htdocs/core/modules/modGeoIPMaxmind.class.php
@@ -37,7 +37,7 @@ class modGeoIPMaxmind extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 2900;
diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php
index 9dbf4ee124f..bfff235bdae 100644
--- a/htdocs/core/modules/modGravatar.class.php
+++ b/htdocs/core/modules/modGravatar.class.php
@@ -36,7 +36,7 @@ class modGravatar extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php
index 68aad4e3533..ea4ff52f473 100644
--- a/htdocs/core/modules/modHRM.class.php
+++ b/htdocs/core/modules/modHRM.class.php
@@ -131,7 +131,7 @@ class modHRM extends DolibarrModules
* @param string $options Enabling module ('', 'noboxes')
* @return int if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php
index 01a70a429ad..09a30e16914 100644
--- a/htdocs/core/modules/modHoliday.class.php
+++ b/htdocs/core/modules/modHoliday.class.php
@@ -41,7 +41,7 @@ class modHoliday extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modIFTTT.class.php b/htdocs/core/modules/modIFTTT.class.php
index 55739978715..c3bab06ed93 100644
--- a/htdocs/core/modules/modIFTTT.class.php
+++ b/htdocs/core/modules/modIFTTT.class.php
@@ -31,12 +31,12 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modIFTTT extends DolibarrModules
{
/**
- * Constructor. Define names, constants, directories, boxes, permissions
+ * Constructor. Define names, constants, directories, boxes, permissions
*
- * @param DoliDB $db Database handler
- */
- function __construct($db)
- {
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
global $langs,$conf;
$this->db = $db;
@@ -116,12 +116,12 @@ class modIFTTT extends DolibarrModules
$this->tabs = array();
// Dictionaries
- if (! isset($conf->ifttt->enabled))
+ if (! isset($conf->ifttt->enabled))
{
$conf->ifttt=new stdClass();
$conf->ifttt->enabled=0;
}
- $this->dictionaries=array();
+ $this->dictionaries=array();
// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
@@ -214,14 +214,14 @@ class modIFTTT extends DolibarrModules
}
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
$sql = array();
@@ -230,22 +230,22 @@ class modIFTTT extends DolibarrModules
return $this->_init($sql, $options);
}
- /**
- * Function called when module is disabled.
- * Remove from database constants, boxes and permissions from Dolibarr database.
- * Data directories are not deleted.
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function remove($options = '')
- {
- // Remove old constants with entity fields different of 0
- $sql = array(
- "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('MAIN_MODULE_IFTTT', 1),
- "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('IFTTT_PRODUCTION_MODE', 1)
- );
+ /**
+ * Function called when module is disabled.
+ * Remove from database constants, boxes and permissions from Dolibarr database.
+ * Data directories are not deleted.
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function remove($options = '')
+ {
+ // Remove old constants with entity fields different of 0
+ $sql = array(
+ "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('MAIN_MODULE_IFTTT', 1),
+ "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('IFTTT_PRODUCTION_MODE', 1)
+ );
- return $this->_remove($sql, $options);
- }
+ return $this->_remove($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php
index e7d47763013..2f5c8c77db8 100644
--- a/htdocs/core/modules/modImport.class.php
+++ b/htdocs/core/modules/modImport.class.php
@@ -38,7 +38,7 @@ class modImport extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 250;
diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php
index 9d07028c5dd..8cae0980ff7 100644
--- a/htdocs/core/modules/modIncoterm.class.php
+++ b/htdocs/core/modules/modIncoterm.class.php
@@ -38,8 +38,8 @@ class modIncoterm extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
+ public function __construct($db)
+ {
global $langs,$conf;
$this->db = $db;
diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php
index c0f02229f2b..fefc7117b10 100644
--- a/htdocs/core/modules/modLabel.class.php
+++ b/htdocs/core/modules/modLabel.class.php
@@ -38,7 +38,7 @@ class modLabel extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 60;
@@ -100,13 +100,13 @@ class modLabel extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
+ public function init($options = '')
+ {
// Permissions
$this->remove($options);
$sql = array();
return $this->_init($sql, $options);
- }
+ }
}
diff --git a/htdocs/core/modules/modLdap.class.php b/htdocs/core/modules/modLdap.class.php
index a2a355060d1..b2a290fe46a 100644
--- a/htdocs/core/modules/modLdap.class.php
+++ b/htdocs/core/modules/modLdap.class.php
@@ -37,7 +37,7 @@ class modLdap extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 200;
diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php
index 43a2876ef79..e4d1a048c6f 100644
--- a/htdocs/core/modules/modLoan.class.php
+++ b/htdocs/core/modules/modLoan.class.php
@@ -37,7 +37,7 @@ class modLoan extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -149,14 +149,14 @@ class modLoan extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php
index bbcd651d453..36893ddfa13 100644
--- a/htdocs/core/modules/modMailing.class.php
+++ b/htdocs/core/modules/modMailing.class.php
@@ -39,7 +39,7 @@ class modMailing extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 22;
@@ -142,14 +142,14 @@ class modMailing extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modMailmanSpip.class.php b/htdocs/core/modules/modMailmanSpip.class.php
index 2c4123fc3fa..ecae27155b5 100644
--- a/htdocs/core/modules/modMailmanSpip.class.php
+++ b/htdocs/core/modules/modMailmanSpip.class.php
@@ -38,7 +38,7 @@ class modMailmanSpip extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 105;
diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php
index 22124404673..f5b79570c1a 100644
--- a/htdocs/core/modules/modMargin.class.php
+++ b/htdocs/core/modules/modMargin.class.php
@@ -35,7 +35,7 @@ class modMargin extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php
index 94d307ae522..59b3dcde2ce 100644
--- a/htdocs/core/modules/modModuleBuilder.class.php
+++ b/htdocs/core/modules/modModuleBuilder.class.php
@@ -35,7 +35,7 @@ class modModuleBuilder extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php
index 32bd1bd5980..e3f37c5f284 100644
--- a/htdocs/core/modules/modMultiCurrency.class.php
+++ b/htdocs/core/modules/modMultiCurrency.class.php
@@ -38,8 +38,8 @@ class modMultiCurrency extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
- {
+ public function __construct($db)
+ {
global $langs, $conf;
$this->db = $db;
diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php
index 54698dca703..c73c8210072 100644
--- a/htdocs/core/modules/modNotification.class.php
+++ b/htdocs/core/modules/modNotification.class.php
@@ -36,7 +36,7 @@ class modNotification extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 600;
@@ -89,7 +89,7 @@ class modNotification extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php
index 27310e9c84e..f4f52eae80a 100644
--- a/htdocs/core/modules/modOauth.class.php
+++ b/htdocs/core/modules/modOauth.class.php
@@ -40,7 +40,7 @@ class modOauth extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db ;
$this->numero = 66000;
@@ -130,7 +130,7 @@ class modOauth extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php
index a47a2791b60..be2e9b6e449 100644
--- a/htdocs/core/modules/modOpenSurvey.class.php
+++ b/htdocs/core/modules/modOpenSurvey.class.php
@@ -37,8 +37,8 @@ class modOpenSurvey extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
+ public function __construct($db)
+ {
global $langs,$conf;
$this->db = $db;
@@ -119,51 +119,57 @@ class modOpenSurvey extends DolibarrModules
$r++;
- // Menus
- //-------
+ // Menus
+ //-------
$r=0;
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'type'=>'left',
- 'titre'=>'Survey',
- 'mainmenu'=>'tools',
- 'leftmenu'=>'opensurvey',
- 'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
- 'langs'=>'opensurvey',
- 'position'=>200,
- 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
- 'perms'=>'$user->rights->opensurvey->read',
- 'target'=>'',
- 'user'=>0);
- $r++;
+ $this->menu[$r]=array(
+ 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'type'=>'left',
+ 'titre'=>'Survey',
+ 'mainmenu'=>'tools',
+ 'leftmenu'=>'opensurvey',
+ 'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
+ 'langs'=>'opensurvey',
+ 'position'=>200,
+ 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
+ 'perms'=>'$user->rights->opensurvey->read',
+ 'target'=>'',
+ 'user'=>0,
+ );
+ $r++;
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'type'=>'left',
- 'titre'=>'NewSurvey',
- 'mainmenu'=>'tools',
- 'leftmenu'=>'opensurvey_new',
- 'url'=>'/opensurvey/wizard/index.php',
- 'langs'=>'opensurvey',
- 'position'=>210,
- 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
- 'perms'=>'$user->rights->opensurvey->write',
- 'target'=>'',
- 'user'=>0);
- $r++;
+ $this->menu[$r]=array(
+ 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'type'=>'left',
+ 'titre'=>'NewSurvey',
+ 'mainmenu'=>'tools',
+ 'leftmenu'=>'opensurvey_new',
+ 'url'=>'/opensurvey/wizard/index.php',
+ 'langs'=>'opensurvey',
+ 'position'=>210,
+ 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
+ 'perms'=>'$user->rights->opensurvey->write',
+ 'target'=>'',
+ 'user'=>0,
+ );
+ $r++;
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'type'=>'left',
- 'titre'=>'List',
- 'mainmenu'=>'tools',
- 'leftmenu'=>'opensurvey_list',
- 'url'=>'/opensurvey/list.php',
- 'langs'=>'opensurvey',
- 'position'=>220,
- 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
- 'perms'=>'$user->rights->opensurvey->read',
- 'target'=>'',
- 'user'=>0);
- $r++;
- }
+ $this->menu[$r]=array(
+ 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'type'=>'left',
+ 'titre'=>'List',
+ 'mainmenu'=>'tools',
+ 'leftmenu'=>'opensurvey_list',
+ 'url'=>'/opensurvey/list.php',
+ 'langs'=>'opensurvey',
+ 'position'=>220,
+ 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
+ 'perms'=>'$user->rights->opensurvey->read',
+ 'target'=>'',
+ 'user'=>0,
+ );
+ $r++;
+ }
/**
* Function called when module is enabled.
@@ -173,13 +179,13 @@ class modOpenSurvey extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
- // Permissions
- $this->remove($options);
+ public function init($options = '')
+ {
+ // Permissions
+ $this->remove($options);
- $sql = array();
+ $sql = array();
- return $this->_init($sql, $options);
- }
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php
index 6349d5474b3..635c428f3fa 100644
--- a/htdocs/core/modules/modPaybox.class.php
+++ b/htdocs/core/modules/modPaybox.class.php
@@ -36,7 +36,7 @@ class modPayBox extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modPaypal.class.php b/htdocs/core/modules/modPaypal.class.php
index a4aa8fcc6b0..99ef4dd45de 100644
--- a/htdocs/core/modules/modPaypal.class.php
+++ b/htdocs/core/modules/modPaypal.class.php
@@ -37,7 +37,7 @@ class modPaypal extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php
index f18bf1bf03c..ec4c4ca3a46 100644
--- a/htdocs/core/modules/modPrelevement.class.php
+++ b/htdocs/core/modules/modPrelevement.class.php
@@ -40,7 +40,7 @@ class modPrelevement extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -124,40 +124,41 @@ class modPrelevement extends DolibarrModules
$this->rights[$r][4] = 'bons';
$this->rights[$r][5] = 'credit';
-/* $this->rights[2][0] = 154;
+ /*
+ $this->rights[2][0] = 154;
$this->rights[2][1] = 'Setup withdraw account';
$this->rights[2][2] = 'w';
$this->rights[2][3] = 0;
$this->rights[2][4] = 'bons';
$this->rights[2][5] = 'configurer';
-*/
+ */
- // Menus
- //-------
- $this->menu = 1; // This module add menu entries. They are coded into menu manager.
- }
+ // Menus
+ //-------
+ $this->menu = 1; // This module add menu entries. They are coded into menu manager.
+ }
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options = '')
- {
- global $conf;
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
+ global $conf;
- // Permissions
- $this->remove($options);
+ // Permissions
+ $this->remove($options);
- $sql = array(
- "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity,
- "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")",
- );
+ $sql = array(
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")",
+ );
- return $this->_init($sql, $options);
- }
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modPrinting.class.php b/htdocs/core/modules/modPrinting.class.php
index bb8a2be6120..09992bd176d 100644
--- a/htdocs/core/modules/modPrinting.class.php
+++ b/htdocs/core/modules/modPrinting.class.php
@@ -40,7 +40,7 @@ class modPrinting extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db ;
$this->numero = 64000;
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 4c6c420aa50..368a41a6fac 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -42,7 +42,7 @@ class modProduct extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $mysoc;
@@ -521,7 +521,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.recuperableonly'=>'VATNPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type'));
-$this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array(
+ $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array(
'sp.price'=>"PriceQtyMinHT*",
'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty
'sp.remise_percent'=>'DiscountQtyMin'
@@ -625,20 +625,20 @@ $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array
}
- /**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
- *
- * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
- * @return int 1 if OK, 0 if KO
- */
- function init($options = '')
- {
- $this->remove($options);
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
+ $this->remove($options);
- $sql = array();
+ $sql = array();
- return $this->_init($sql, $options);
- }
+ return $this->_init($sql, $options);
+ }
}
diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php
index f5e8fc6324c..65cefa6676a 100644
--- a/htdocs/core/modules/modProductBatch.class.php
+++ b/htdocs/core/modules/modProductBatch.class.php
@@ -38,7 +38,7 @@ class modProductBatch extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
@@ -114,7 +114,7 @@ class modProductBatch extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $db,$conf;
diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php
index eeca1e8883f..f100e8629e7 100644
--- a/htdocs/core/modules/modProjet.class.php
+++ b/htdocs/core/modules/modProjet.class.php
@@ -41,7 +41,7 @@ class modProjet extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -310,7 +310,7 @@ class modProjet extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php
index a2a32241065..b28477f3719 100644
--- a/htdocs/core/modules/modPropale.class.php
+++ b/htdocs/core/modules/modPropale.class.php
@@ -41,7 +41,7 @@ class modPropale extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -265,7 +265,7 @@ class modPropale extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php
index 6d00acb2d16..2694b852b7a 100644
--- a/htdocs/core/modules/modReceiptPrinter.class.php
+++ b/htdocs/core/modules/modReceiptPrinter.class.php
@@ -40,7 +40,7 @@ class modReceiptPrinter extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db ;
$this->numero = 67000;
@@ -130,7 +130,7 @@ class modReceiptPrinter extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
// Clean before activation
diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php
index 663a854f7a5..9fc82dc9ad6 100644
--- a/htdocs/core/modules/modReception.class.php
+++ b/htdocs/core/modules/modReception.class.php
@@ -36,7 +36,7 @@ class modReception extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -243,7 +243,7 @@ class modReception extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php
index 4756f2a1a41..e111e81ef6b 100644
--- a/htdocs/core/modules/modSalaries.class.php
+++ b/htdocs/core/modules/modSalaries.class.php
@@ -43,7 +43,7 @@ class modSalaries extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -159,14 +159,14 @@ class modSalaries extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php
index 2e3ed91bf06..9fa79683a7f 100644
--- a/htdocs/core/modules/modService.class.php
+++ b/htdocs/core/modules/modService.class.php
@@ -40,7 +40,7 @@ class modService extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $mysoc;
@@ -71,7 +71,7 @@ class modService extends DolibarrModules
// Config pages
$this->config_page_url = array("product.php@product");
- $this->langfiles = array("products","companies","bills");
+ $this->langfiles = array("products","companies","stocks","bills");
// Constants
$this->const = array();
@@ -115,27 +115,23 @@ class modService extends DolibarrModules
$this->rights[$r][4] = 'export';
$r++;
-
- /* We can't enable this here because it must be enabled in both product and service module and this create duplicate insert
- $r=0;
- $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'type'=>'left', // This is a Left menu entry
- 'titre'=>'ProductVatMassChange',
- 'url'=>'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools',
- 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
- 'position'=>300,
- 'enabled'=>'$conf->product->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
- 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
- 'target'=>'',
- 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
- $r++;
- */
-
-
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
-
+ /* We can't enable this here because it must be enabled in both product and service module and this creates duplicate inserts
+ $r=0;
+ $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'type'=>'left', // This is a Left menu entry
+ 'titre'=>'ProductVatMassChange',
+ 'url'=>'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools',
+ 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'position'=>300,
+ 'enabled'=>'$conf->product->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+ 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
+ 'target'=>'',
+ 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
+ $r++;
+ */
// Exports
//--------
@@ -148,57 +144,36 @@ class modService extends DolibarrModules
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
- //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
- $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
- if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric'));
+ $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
+ if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
+ if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
+ $this->export_TypeFields_array[$r]=array(
+ 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'
+ );
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
+ if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
+ if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
$this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.tobuy'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service");
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'service'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'service'));
- // Add extra fields
- $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
- $resql=$this->db->query($sql);
- if ($resql) // This can fail when class is used on old database (during migration for example)
- {
- while ($obj=$this->db->fetch_object($resql))
- {
- $fieldname='extra.'.$obj->name;
- $fieldlabel=ucfirst($obj->label);
- $typeFilter="Text";
- switch($obj->type)
- {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter="Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter="Date";
- break;
- case 'boolean':
- $typeFilter="Boolean";
- break;
- case 'sellist':
- $tmp='';
- $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options']));
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
- break;
- }
- $this->export_fields_array[$r][$fieldname]=$fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
- $this->export_entities_array[$r][$fieldname]='product';
- }
- }
- // End add extra fields
-
+ if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
+ if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
+ if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
-
+ if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
{
@@ -215,6 +190,7 @@ class modService extends DolibarrModules
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation');
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
//$this->export_TypeFields_array[$r]=array(
// 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
// 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
@@ -226,12 +202,61 @@ class modService extends DolibarrModules
'pr.price_ttc'=>"product",
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
- 'pr.date_price'=>"product");
+ 'pr.recuperableonly'=>'product',
+ 'pr.date_price'=>"product");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
}
+
+ if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
+ {
+ // Exports virtual products
+ $r++;
+ $this->export_code[$r]=$this->rights_class.'_'.$r;
+ $this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r]=array(array("service","export"));
+ $this->export_fields_array[$r]=array(
+ 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
+ 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",
+ 'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode',
+ 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
+ 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
+ );
+ if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
+ if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
+ $this->export_TypeFields_array[$r]=array(
+ 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
+ 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
+ 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
+ 'p.datec'=>'Date','p.tms'=>'Date'
+ );
+ if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
+ if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
+ $this->export_entities_array[$r]=array(
+ 'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
+ 'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
+ 'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
+ 'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
+ 'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
+ );
+ if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
+ if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
+ $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
+ $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
+ $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
+ $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
+ $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
+ $this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
+ }
}
@@ -239,11 +264,13 @@ class modService extends DolibarrModules
//--------
$r=0;
+ // Import list of services
+
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Products"; // Translation key
$this->import_icon[$r]=$this->picto;
- $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
+ $this->import_entities_array[$r]=array(); // We define here only fields that use a different icon from the one defined in import_icon
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array(
@@ -252,9 +279,14 @@ class modService extends DolibarrModules
'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",
'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation'
);
- if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
+ if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
+ if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
+ if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
+ if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
// Add extra fields
+ $import_extrafield_sample=array();
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
@@ -268,15 +300,25 @@ class modService extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
- $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
+ $this->import_regex_array[$r]=array(
+ 'p.ref' => '[^ ]',
+ 'p.price_base_type' => '\AHT\z|\ATTC\z',
+ 'p.tosell' => '^[0|1]$',
+ 'p.tobuy' => '^[0|1]$',
+ 'p.fk_product_type' => '^[0|1]$',
+ 'p.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
+ 'p.recuperableonly' => '^[0|1]$',
+ 'p.finished' => '^[0|1]$'
+ );
$this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
-
-
+ $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
+ if (! empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r]=array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode'));//only show/allow barcode as update key if Barcode module enabled
+
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
{
if (! empty($conf->fournisseur->enabled))
{
- // Import suppliers prices (note: this code is duplicated into module product)
+ // Import suppliers prices (note: this code is duplicated in module Service)
$r++;
$this->import_code[$r]=$this->rights_class.'_supplierprices';
$this->import_label[$r]="SuppliersPricesOfProductsOrServices"; // Translation key
@@ -284,9 +326,15 @@ class modService extends DolibarrModules
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price');
$this->import_tables_creator_array[$r]=array('sp'=>'fk_user');
- $this->import_fields_array[$r]=array(
- 'sp.fk_product'=>"ProductOrService*",
- 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate', 'sp.default_vat_code'=>'VATCode'
+ $this->import_fields_array[$r]=array(//field order as per structure of table llx_product_fournisseur_price, without optional fields
+ 'sp.fk_product'=>"ProductOrService*",
+ 'sp.fk_soc' => "Supplier*",
+ 'sp.ref_fourn' => 'SupplierRef',
+ 'sp.quantity' => "QtyMin*",
+ 'sp.tva_tx' => 'VATRate',
+ 'sp.default_vat_code' => 'VATCode',
+ 'sp.delivery_time_days' => 'DeliveryDelay',
+ 'sp.supplier_reputation' => 'SupplierReputation'
);
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.recuperableonly'=>'VATNPR'));
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
@@ -297,11 +345,23 @@ class modService extends DolibarrModules
'sp.remise_percent'=>'DiscountQtyMin'
));
+ if ($conf->multicurrency->enabled)
+ {
+ $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array(
+ 'sp.fk_multicurrency'=>'CurrencyCodeId',//ideally this should be automatically obtained from the CurrencyCode on the next line
+ 'sp.multicurrency_code'=>'CurrencyCode',
+ 'sp.multicurrency_tx'=>'CurrencyRate',
+ 'sp.multicurrency_unitprice'=>'CurrencyUnitPrice',
+ 'sp.multicurrency_price'=>'CurrencyPrice',
+ ));
+ }
+
$this->import_convertvalue_array[$r]=array(
'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product')
);
- $this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PREF123456",
+ $this->import_examplevalues_array[$r]=array(
+ 'sp.fk_product'=>"PREF123456",
'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21',
'sp.price'=>"50",
'sp.unitprice'=>'50',
@@ -311,7 +371,7 @@ class modService extends DolibarrModules
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
- // Import product multiprice
+ // Import products multiprices
$r++;
$this->import_code[$r]=$this->rights_class.'_multiprice';
$this->import_label[$r]="ProductsOrServiceMultiPrice"; // Translation key
@@ -325,17 +385,20 @@ class modService extends DolibarrModules
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation*');
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
'pr.price'=>"100",'pr.price_ttc'=>"110",
'pr.price_min'=>"100",'pr.price_min_ttc'=>"110",
- 'pr.tva_tx'=>'19.6',
- 'pr.date_price'=>'2013-04-10');
+ 'pr.tva_tx'=>'20',
+ 'pr.recuperableonly'=>'0',
+ 'pr.date_price'=>'2013-04-10');
}
if (! empty($conf->global->MAIN_MULTILANGS))
{
+ // Import translations of product names and descriptions
$r++;
$this->import_code[$r]=$this->rights_class.'_languages';
$this->import_label[$r]="ProductsOrServicesTranslations";
@@ -363,7 +426,7 @@ class modService extends DolibarrModules
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
$this->remove($options);
diff --git a/htdocs/core/modules/modSocialNetworks.class.php b/htdocs/core/modules/modSocialNetworks.class.php
index b7e1bfd44a3..d8d8d8fb76e 100644
--- a/htdocs/core/modules/modSocialNetworks.class.php
+++ b/htdocs/core/modules/modSocialNetworks.class.php
@@ -36,7 +36,7 @@ class modSocialNetworks extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index b879959946d..32b3b4b97fc 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -41,7 +41,7 @@ class modSociete extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $user;
@@ -720,15 +720,15 @@ class modSociete extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
+ public function init($options = '')
+ {
global $conf, $langs;
// We disable this to prevent pb of modules not correctly disabled
diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php
index fa283c58137..230d9dd5fbe 100644
--- a/htdocs/core/modules/modStock.class.php
+++ b/htdocs/core/modules/modStock.class.php
@@ -40,7 +40,7 @@ class modStock extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs;
@@ -351,14 +351,14 @@ class modStock extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php
index a2b2a68127a..ae15e763fd8 100644
--- a/htdocs/core/modules/modStripe.class.php
+++ b/htdocs/core/modules/modStripe.class.php
@@ -36,7 +36,7 @@ class modStripe extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php
index 3d580fa439c..882b02b5fb4 100644
--- a/htdocs/core/modules/modSupplierProposal.class.php
+++ b/htdocs/core/modules/modSupplierProposal.class.php
@@ -42,7 +42,7 @@ class modSupplierProposal extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -57,10 +57,10 @@ class modSupplierProposal extends DolibarrModules
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto='supplier_proposal';
-
+
// Data directories to create when module is enabled.
$this->dirs = array();
-
+
// Config pages. Put here list of php page names stored in admin directory used to setup module.
$this->config_page_url = array("supplier_proposal.php");
@@ -206,7 +206,7 @@ class modSupplierProposal extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php
index a291b7977ee..1ac6ead1087 100644
--- a/htdocs/core/modules/modSyslog.class.php
+++ b/htdocs/core/modules/modSyslog.class.php
@@ -37,7 +37,7 @@ class modSyslog extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 42;
diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php
index a2f51ef0cc1..c113f9a339a 100644
--- a/htdocs/core/modules/modTax.class.php
+++ b/htdocs/core/modules/modTax.class.php
@@ -41,7 +41,7 @@ class modTax extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -185,7 +185,7 @@ class modTax extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf;
diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php
index bef84b3a157..baf7f94d0f4 100644
--- a/htdocs/core/modules/modUser.class.php
+++ b/htdocs/core/modules/modUser.class.php
@@ -38,7 +38,7 @@ class modUser extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -331,8 +331,8 @@ class modUser extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
- function init($options = '')
- {
+ public function init($options = '')
+ {
global $conf;
// Permissions
@@ -341,5 +341,5 @@ class modUser extends DolibarrModules
$sql = array();
return $this->_init($sql, $options);
- }
+ }
}
diff --git a/htdocs/core/modules/modWebServices.class.php b/htdocs/core/modules/modWebServices.class.php
index 9d32b03df79..2aa98e80679 100644
--- a/htdocs/core/modules/modWebServices.class.php
+++ b/htdocs/core/modules/modWebServices.class.php
@@ -35,7 +35,7 @@ class modWebServices extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 2600;
diff --git a/htdocs/core/modules/modWebServicesClient.class.php b/htdocs/core/modules/modWebServicesClient.class.php
index 6ec7bb5aae9..33c7bae997a 100644
--- a/htdocs/core/modules/modWebServicesClient.class.php
+++ b/htdocs/core/modules/modWebServicesClient.class.php
@@ -35,7 +35,7 @@ class modWebServicesClient extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->numero = 2660;
diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php
index 4fd6cd2976f..6f882f082ad 100644
--- a/htdocs/core/modules/modWebsite.class.php
+++ b/htdocs/core/modules/modWebsite.class.php
@@ -36,7 +36,7 @@ class modWebsite extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
@@ -138,14 +138,14 @@ class modWebsite extends DolibarrModules
/**
- * Function called when module is enabled.
- * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
- * It also creates data directories
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
*
- * @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
global $conf,$langs;
diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php
index 955165ffd80..7d2e833a4fc 100644
--- a/htdocs/core/modules/modWorkflow.class.php
+++ b/htdocs/core/modules/modWorkflow.class.php
@@ -37,7 +37,7 @@ class modWorkflow extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
@@ -137,9 +137,9 @@ class modWorkflow extends DolibarrModules
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
- * @return int 1 if OK, 0 if KO
+ * @return int 1 if OK, 0 if KO
*/
- function init($options = '')
+ public function init($options = '')
{
// Permissions
$this->remove($options);
diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php
index 42f7b0c8be0..19e74cf3c19 100644
--- a/htdocs/core/modules/payment/mod_payment_ant.php
+++ b/htdocs/core/modules/payment/mod_payment_ant.php
@@ -59,7 +59,7 @@ class mod_payment_ant extends ModeleNumRefPayments
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $db, $conf, $langs;
@@ -99,7 +99,7 @@ class mod_payment_ant extends ModeleNumRefPayments
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -122,7 +122,7 @@ class mod_payment_ant extends ModeleNumRefPayments
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -143,7 +143,7 @@ class mod_payment_ant extends ModeleNumRefPayments
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -151,7 +151,7 @@ class mod_payment_ant extends ModeleNumRefPayments
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function commande_get_num($objsoc, $objforref)
+ public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php
index c8c850affda..a6cfca7e1df 100644
--- a/htdocs/core/modules/payment/mod_payment_cicada.php
+++ b/htdocs/core/modules/payment/mod_payment_cicada.php
@@ -60,7 +60,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -72,7 +72,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -84,7 +84,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -119,7 +119,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -155,7 +155,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -163,7 +163,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function payment_get_num($objsoc, $objforref)
+ public function payment_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/payment/modules_payment.php b/htdocs/core/modules/payment/modules_payment.php
index 0773204a1c8..b85c97008e3 100644
--- a/htdocs/core/modules/payment/modules_payment.php
+++ b/htdocs/core/modules/payment/modules_payment.php
@@ -33,7 +33,7 @@ abstract class ModeleNumRefPayments
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -43,7 +43,7 @@ abstract class ModeleNumRefPayments
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -55,7 +55,7 @@ abstract class ModeleNumRefPayments
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("bills");
@@ -67,7 +67,7 @@ abstract class ModeleNumRefPayments
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -79,7 +79,7 @@ abstract class ModeleNumRefPayments
* @param Object $object Object we need next value for
* @return string Valeur
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -90,15 +90,15 @@ abstract class ModeleNumRefPayments
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
}
}
diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php
index f4c10aa5952..3bbf1c879ea 100644
--- a/htdocs/core/modules/printing/modules_printing.php
+++ b/htdocs/core/modules/printing/modules_printing.php
@@ -47,7 +47,7 @@ class PrintingDriver
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -59,7 +59,7 @@ class PrintingDriver
* @param integer $maxfilenamelength Max length of value to show
* @return array List of drivers
*/
- static function listDrivers($db, $maxfilenamelength = 0)
+ public static function listDrivers($db, $maxfilenamelength = 0)
{
global $conf;
@@ -80,7 +80,7 @@ class PrintingDriver
*
* @return string Return translation of key PrintingModuleDescXXX where XXX is module name, or $this->desc if not exists
*/
- function getDesc()
+ public function getDesc()
{
global $langs;
$langs->load("printing");
diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php
index d061fc33b7d..b8bccf0280b 100644
--- a/htdocs/core/modules/printing/printgcp.modules.php
+++ b/htdocs/core/modules/printing/printgcp.modules.php
@@ -70,7 +70,7 @@ class printing_printgcp extends PrintingDriver
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $dolibarr_main_url_root;
@@ -89,47 +89,47 @@ class printing_printgcp extends PrintingDriver
);
} else {
- $this->google_id = $conf->global->OAUTH_GOOGLE_ID;
- $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
- // Token storage
- $storage = new DoliStorage($this->db, $this->conf);
- //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
- // Setup the credentials for the requests
+ $this->google_id = $conf->global->OAUTH_GOOGLE_ID;
+ $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
+ // Token storage
+ $storage = new DoliStorage($this->db, $this->conf);
+ //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
+ // Setup the credentials for the requests
$credentials = new Credentials(
- $this->google_id,
- $this->google_secret,
- $urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
- );
- $access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?'HasAccessToken':'NoAccessToken');
- $serviceFactory = new \OAuth\ServiceFactory();
- $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
- $token_ok=true;
- try {
- $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
- } catch (Exception $e) {
- $this->errors[] = $e->getMessage();
- $token_ok = false;
- }
- //var_dump($this->errors);exit;
+ $this->google_id,
+ $this->google_secret,
+ $urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
+ );
+ $access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?'HasAccessToken':'NoAccessToken');
+ $serviceFactory = new \OAuth\ServiceFactory();
+ $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
+ $token_ok=true;
+ try {
+ $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
+ } catch (Exception $e) {
+ $this->errors[] = $e->getMessage();
+ $token_ok = false;
+ }
+ //var_dump($this->errors);exit;
- $expire = false;
- // Is token expired or will token expire in the next 30 seconds
- if ($token_ok) {
- $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
- }
+ $expire = false;
+ // Is token expired or will token expire in the next 30 seconds
+ if ($token_ok) {
+ $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
+ }
- // Token expired so we refresh it
- if ($token_ok && $expire) {
- try {
- // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
- $refreshtoken = $token->getRefreshToken();
- $token = $apiService->refreshAccessToken($token);
- $token->setRefreshToken($refreshtoken);
- $storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
- } catch (Exception $e) {
- $this->errors[] = $e->getMessage();
- }
- }
+ // Token expired so we refresh it
+ if ($token_ok && $expire) {
+ try {
+ // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
+ $refreshtoken = $token->getRefreshToken();
+ $token = $apiService->refreshAccessToken($token);
+ $token->setRefreshToken($refreshtoken);
+ $storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
+ } catch (Exception $e) {
+ $this->errors[] = $e->getMessage();
+ }
+ }
if ($this->google_id != '' && $this->google_secret != '') {
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
$this->conf[] = array(
diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php
index af650b1695e..f5ebbdd53de 100644
--- a/htdocs/core/modules/printing/printipp.modules.php
+++ b/htdocs/core/modules/printing/printipp.modules.php
@@ -62,7 +62,7 @@ class printing_printipp extends PrintingDriver
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -152,7 +152,7 @@ class printing_printipp extends PrintingDriver
*
* @return int 0 if OK, >0 if KO
*/
- function listAvailablePrinters()
+ public function listAvailablePrinters()
{
global $conf, $langs;
$error = 0;
diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
index fab88a91bfd..e178d16d5bc 100644
--- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
+++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
@@ -41,12 +41,12 @@ class pdf_standardlabel extends CommonStickerGenerator
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
- function addSticker(&$pdf, $outputlangs, $param)
+ public function addSticker(&$pdf, $outputlangs, $param)
{
// use this method in future refactoring
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
* - %LOGO% is replace with company logo
@@ -61,7 +61,7 @@ class pdf_standardlabel extends CommonStickerGenerator
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
* @return void
*/
- function Add_PDF_label(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '', $photo = '')
+ public function Add_PDF_label(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '', $photo = '')
{
// phpcs:enable
global $mysoc, $conf, $langs;
@@ -227,7 +227,7 @@ class pdf_standardlabel extends CommonStickerGenerator
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build PDF on disk, then output on HTTP strem.
*
@@ -238,7 +238,7 @@ class pdf_standardlabel extends CommonStickerGenerator
* @param string $filename Short file name of PDF output file
* @return int 1=OK, 0=KO
*/
- function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf')
+ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf')
{
// phpcs:enable
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php
index f6641d1365d..7670a623c49 100644
--- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php
+++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php
@@ -96,7 +96,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
- function addSticker(&$pdf, $outputlangs, $param)
+ public function addSticker(&$pdf, $outputlangs, $param)
{
global $mysoc,$conf;
@@ -266,7 +266,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build PDF on disk, then output on HTTP strem.
*
@@ -277,7 +277,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
* @param string $filename Short file name of PDF output file
* @return int 1=OK, 0=KO
*/
- function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf')
+ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf')
{
// phpcs:enable
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php
index b64d2a4dfe3..7377c56aa3b 100644
--- a/htdocs/core/modules/printsheet/modules_labels.php
+++ b/htdocs/core/modules/printsheet/modules_labels.php
@@ -40,7 +40,7 @@ class ModelePDFLabels
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -48,7 +48,7 @@ class ModelePDFLabels
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- function liste_modeles($db, $maxfilenamelength = 0)
+ public function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
index 048c0e06846..edb54b13ace 100644
--- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
+++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
@@ -61,7 +61,7 @@ class doc_generic_product_odt extends ModelePDFProduct
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -101,12 +101,12 @@ class doc_generic_product_odt extends ModelePDFProduct
/**
- * Return description of a module
+ * Return description of a module
*
- * @param Translate $langs Lang object to use for output
- * @return string Description
+ * @param Translate $langs Lang object to use for output
+ * @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf, $langs;
@@ -205,7 +205,7 @@ class doc_generic_product_odt extends ModelePDFProduct
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -217,7 +217,7 @@ class doc_generic_product_odt extends ModelePDFProduct
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $product,$langs,$conf,$mysoc,$hookmanager,$user;
@@ -320,8 +320,8 @@ class doc_generic_product_odt extends ModelePDFProduct
$contactobject=null;
if (! empty($usecontact))
{
- // On peut utiliser le nom de la societe du contact
- if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
+ // On peut utiliser le nom de la societe du contact
+ if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php
index d5bfd453322..b8b05410fb1 100644
--- a/htdocs/core/modules/product/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php
@@ -148,7 +148,7 @@ class pdf_standard extends ModelePDFProduct
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -160,8 +160,8 @@ class pdf_standard extends ModelePDFProduct
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
@@ -204,7 +204,7 @@ class pdf_standard extends ModelePDFProduct
if (file_exists($dir))
{
- // Add pdfgeneration hook
+ // Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
@@ -592,7 +592,7 @@ class pdf_standard extends ModelePDFProduct
$this->error=$langs->trans("ErrorConstantNotDefined", "PRODUCT_OUTPUTDIR");
return 0;
}
- }
+ }
/**
@@ -608,7 +608,7 @@ class pdf_standard extends ModelePDFProduct
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -718,7 +718,7 @@ class pdf_standard extends ModelePDFProduct
* @param string $titlekey Translation key to show as title of document
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
{
global $conf,$langs,$hookmanager;
@@ -853,24 +853,24 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/
- }
+ }
- $pdf->SetTextColor(0, 0, 0);
- }
+ $pdf->SetTextColor(0, 0, 0);
+ }
- /**
- * Show footer of page. Need this->emetteur object
- *
- * @param TCPDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
- */
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
- {
- global $conf;
- $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
- return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
- }
+ /**
+ * Show footer of page. Need this->emetteur object
+ *
+ * @param TCPDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
+ */
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ {
+ global $conf;
+ $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
+ return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
+ }
}
diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php
index 8d48d4aa85e..97a00a14575 100644
--- a/htdocs/core/modules/product/mod_codeproduct_elephant.php
+++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php
@@ -72,7 +72,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$this->code_null = 0;
$this->code_modifiable = 1;
@@ -83,13 +83,14 @@ class mod_codeproduct_elephant extends ModeleProductCode
}
- /** Return description of module
- *
- * @param Translate $langs Object langs
- * @return string Description of module
- */
- function info($langs)
- {
+ /**
+ * Return description of module
+ *
+ * @param Translate $langs Object langs
+ * @return string Description of module
+ */
+ public function info($langs)
+ {
global $conf, $mc;
global $form;
@@ -127,7 +128,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
$texte.= '';
return $texte;
- }
+ }
/**
@@ -138,7 +139,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/
- function getExample($langs, $objproduct = 0, $type = -1)
+ public function getExample($langs, $objproduct = 0, $type = -1)
{
if ($type == 0 || $type == -1)
{
@@ -179,7 +180,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
* @param int $type Produit ou service (0:product, 1:service)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
- function getNextValue($objproduct = 0, $type = -1)
+ public function getNextValue($objproduct = 0, $type = -1)
{
global $db,$conf;
@@ -219,13 +220,13 @@ class mod_codeproduct_elephant extends ModeleProductCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if mask/numbering use prefix
*
* @return int 0 or 1
*/
- function verif_prefixIsUsed()
+ public function verif_prefixIsUsed()
{
// phpcs:enable
global $conf;
@@ -254,7 +255,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
* -4 ErrorPrefixRequired
* -5 Other (see this->error)
*/
- function verif($db, &$code, $product, $type)
+ public function verif($db, &$code, $product, $type)
{
global $conf;
@@ -296,16 +297,16 @@ class mod_codeproduct_elephant extends ModeleProductCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi si un code est pris ou non (par autre tiers)
+ * Renvoi si un code est pris ou non (par autre tiers)
*
- * @param DoliDB $db Handler acces base
- * @param string $code Code a verifier
- * @param Product $product Objet product
- * @return int 0 if available, <0 if KO
+ * @param DoliDB $db Handler acces base
+ * @param string $code Code a verifier
+ * @param Product $product Objet product
+ * @return int 0 if available, <0 if KO
*/
- function verif_dispo($db, $code, $product)
+ public function verif_dispo($db, $code, $product)
{
// phpcs:enable
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."product";
diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php
index 1cf17fef6e7..a7b03eed2f0 100644
--- a/htdocs/core/modules/product/mod_codeproduct_leopard.php
+++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php
@@ -71,7 +71,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$this->code_null = 1;
$this->code_modifiable = 1;
@@ -81,12 +81,13 @@ class mod_codeproduct_leopard extends ModeleProductCode
}
- /** Return description of module
+ /**
+ * Return description of module
*
- * @param Translate $langs Object langs
- * @return string Description of module
+ * @param Translate $langs Object langs
+ * @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
$langs->load("companies");
return $langs->trans("LeopardNumRefModelDesc");
@@ -100,7 +101,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return next value
*/
- function getNextValue($objproduct = 0, $type = -1)
+ public function getNextValue($objproduct = 0, $type = -1)
{
global $langs;
return '';
@@ -108,19 +109,19 @@ class mod_codeproduct_leopard extends ModeleProductCode
/**
- * Check validity of code according to its rules
+ * Check validity of code according to its rules
*
- * @param DoliDB $db Database handler
- * @param string $code Code to check/correct
- * @param Product $product Object product
+ * @param DoliDB $db Database handler
+ * @param string $code Code to check/correct
+ * @param Product $product Object product
* @param int $type 0 = product , 1 = service
- * @return int 0 if OK
- * -1 ErrorBadProductCodeSyntax
- * -2 ErrorProductCodeRequired
- * -3 ErrorProductCodeAlreadyUsed
- * -4 ErrorPrefixRequired
+ * @return int 0 if OK
+ * -1 ErrorBadProductCodeSyntax
+ * -2 ErrorProductCodeRequired
+ * -3 ErrorProductCodeAlreadyUsed
+ * -4 ErrorPrefixRequired
*/
- function verif($db, &$code, $product, $type)
+ public function verif($db, &$code, $product, $type)
{
global $conf;
@@ -131,7 +132,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
{
$result=0;
}
- elseif (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) )
+ elseif (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)))
{
$result=-2;
}
diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php
index c0f83c1eace..30350d9378f 100644
--- a/htdocs/core/modules/product/modules_product.class.php
+++ b/htdocs/core/modules/product/modules_product.class.php
@@ -33,13 +33,13 @@
*/
abstract class ModelePDFProduct extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -47,33 +47,33 @@ abstract class ModelePDFProduct extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
- {
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- $type='product';
- $liste=array();
+ $type='product';
+ $liste=array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $liste=getListOfModels($db, $type, $maxfilenamelength);
- return $liste;
- }
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $liste=getListOfModels($db, $type, $maxfilenamelength);
+ return $liste;
+ }
}
abstract class ModeleProductCode
{
/**
- * @var string Error code (or message)
- */
- public $error='';
+ * @var string Error code (or message)
+ */
+ public $error='';
/** Renvoi la description par defaut du modele de numerotation
*
* @param Translate $langs Object langs
* @return string Texte descripif
*/
- function info($langs)
+ public function info($langs)
{
$langs->load("bills");
return $langs->trans("NoDescription");
@@ -84,7 +84,7 @@ abstract class ModeleProductCode
* @param Translate $langs Object langs
* @return string Nom du module
*/
- function getNom($langs)
+ public function getNom($langs)
{
return empty($this->name)?$this->nom:$this->name;
}
@@ -95,7 +95,7 @@ abstract class ModeleProductCode
* @param Translate $langs Object langs
* @return string Example
*/
- function getExample($langs)
+ public function getExample($langs)
{
$langs->load("bills");
return $langs->trans("NoExample");
@@ -106,7 +106,7 @@ abstract class ModeleProductCode
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -118,7 +118,7 @@ abstract class ModeleProductCode
* @param int $type Type
* @return string Value
*/
- function getNextValue($objproduct = 0, $type = -1)
+ public function getNextValue($objproduct = 0, $type = -1)
{
global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking");
@@ -129,7 +129,7 @@ abstract class ModeleProductCode
*
* @return string Version
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
@@ -141,7 +141,7 @@ abstract class ModeleProductCode
return $langs->trans("NotAvailable");
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi la liste des modeles de numérotation
*
@@ -149,7 +149,7 @@ abstract class ModeleProductCode
* @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
$liste=array();
@@ -175,22 +175,24 @@ abstract class ModeleProductCode
}
/**
- * Return description of module parameters
+ * Return description of module parameters
*
- * @param Translate $langs Output language
- * @param Product $product Product object
- * @param int $type -1=Nothing, 0=Customer, 1=Supplier
- * @return string HTML translated description
+ * @param Translate $langs Output language
+ * @param Product $product Product object
+ * @param int $type -1=Nothing, 0=Customer, 1=Supplier
+ * @return string HTML translated description
*/
- function getToolTip($langs, $product, $type)
+ public function getToolTip($langs, $product, $type)
{
global $conf;
$langs->load("admin");
$s='';
- if ($type == -1) $s.=$langs->trans("Name").': '.$this->getNom($langs).' ';
- if ($type == -1) $s.=$langs->trans("Version").': '.$this->getVersion().' ';
+ if ($type == -1) {
+ $s.=$langs->trans("Name").': '.$this->getNom($langs).' ';
+ $s.=$langs->trans("Version").': '.$this->getVersion().' ';
+ }
if ($type == 0) $s.=$langs->trans("ProductCodeDesc").' ';
if ($type == 1) $s.=$langs->trans("ServiceCodeDesc").' ';
if ($type != -1) $s.=$langs->trans("ValidityControledByModule").': '.$this->getNom($langs).' ';
@@ -241,13 +243,13 @@ abstract class ModeleProductCode
return $s;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Check if mask/numbering use prefix
- *
- * @return int 0=no, 1=yes
- */
- function verif_prefixIsUsed()
+ * Check if mask/numbering use prefix
+ *
+ * @return int 0=no, 1=yes
+ */
+ public function verif_prefixIsUsed()
{
// phpcs:enable
return 0;
diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php
index 5708033a8ea..38cd9dda385 100644
--- a/htdocs/core/modules/product_batch/modules_product_batch.class.php
+++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php
@@ -38,30 +38,30 @@
*/
abstract class ModelePDFProductBatch extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
-
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
- * Return list of active generation modules
- *
+ * @var string Error code (or message)
+ */
+ public $error='';
+
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
- {
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- $type='product_batch';
- $list = array();
+ $type = 'product_batch';
+ $list = array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $list = getListOfModels($db, $type, $maxfilenamelength);
- return $list;
- }
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $list = getListOfModels($db, $type, $maxfilenamelength);
+ return $list;
+ }
}
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index e1c54a13a35..b925a29327c 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -78,7 +78,7 @@ class doc_generic_project_odt extends ModelePDFProjects
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -117,7 +117,7 @@ class doc_generic_project_odt extends ModelePDFProjects
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -126,7 +126,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param string $array_key Name of the key for return array
* @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
global $conf;
@@ -156,7 +156,7 @@ class doc_generic_project_odt extends ModelePDFProjects
return $resarray;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -164,7 +164,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_tasks(Task $task, $outputlangs)
+ public function get_substitutionarray_tasks(Task $task, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -197,7 +197,7 @@ class doc_generic_project_odt extends ModelePDFProjects
return $resarray;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -205,7 +205,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_project_contacts($contact, $outputlangs)
+ public function get_substitutionarray_project_contacts($contact, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -255,7 +255,7 @@ class doc_generic_project_odt extends ModelePDFProjects
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -263,19 +263,19 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_project_file($file, $outputlangs)
- {
+ public function get_substitutionarray_project_file($file, $outputlangs)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- return array(
- 'projfile_name'=>$file['name'],
- 'projfile_date'=>dol_print_date($file['date'], 'day'),
- 'projfile_size'=>$file['size']
- );
- }
+ return array(
+ 'projfile_name'=>$file['name'],
+ 'projfile_date'=>dol_print_date($file['date'], 'day'),
+ 'projfile_size'=>$file['size']
+ );
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -283,23 +283,23 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_project_reference($refdetail, $outputlangs)
- {
+ public function get_substitutionarray_project_reference($refdetail, $outputlangs)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- return array(
- 'projref_type'=>$refdetail['type'],
- 'projref_ref'=>$refdetail['ref'],
- 'projref_date'=>dol_print_date($refdetail['date'], 'day'),
- 'projref_socname'=>$refdetail['socname'],
- 'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs),
- 'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs),
- 'projref_status'=>$refdetail['status']
- );
- }
+ return array(
+ 'projref_type'=>$refdetail['type'],
+ 'projref_ref'=>$refdetail['ref'],
+ 'projref_date'=>dol_print_date($refdetail['date'], 'day'),
+ 'projref_socname'=>$refdetail['socname'],
+ 'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs),
+ 'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs),
+ 'projref_status'=>$refdetail['status']
+ );
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -307,7 +307,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_tasksressource($taskressource, $outputlangs)
+ public function get_substitutionarray_tasksressource($taskressource, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -323,7 +323,7 @@ class doc_generic_project_odt extends ModelePDFProjects
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -331,7 +331,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_taskstime($tasktime, $outputlangs)
+ public function get_substitutionarray_taskstime($tasktime, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -352,7 +352,7 @@ class doc_generic_project_odt extends ModelePDFProjects
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -360,7 +360,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_task_file($file, $outputlangs)
+ public function get_substitutionarray_task_file($file, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -379,7 +379,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -462,7 +462,7 @@ class doc_generic_project_odt extends ModelePDFProjects
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -471,7 +471,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath)
+ public function write_file($object, $outputlangs, $srctemplatepath)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -588,7 +588,7 @@ class doc_generic_project_odt extends ModelePDFProjects
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->projet->dir_temp,
diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
index 8b05da32e37..e5f5e9a9654 100644
--- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
@@ -116,7 +116,7 @@ class pdf_baleine extends ModelePDFProjects
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -165,7 +165,7 @@ class pdf_baleine extends ModelePDFProjects
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
*
@@ -173,7 +173,7 @@ class pdf_baleine extends ModelePDFProjects
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs)
+ public function write_file($object, $outputlangs)
{
// phpcs:enable
global $conf, $hookmanager, $langs, $user;
@@ -533,7 +533,7 @@ class pdf_baleine extends ModelePDFProjects
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@@ -580,7 +580,7 @@ class pdf_baleine extends ModelePDFProjects
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@@ -665,15 +665,15 @@ class pdf_baleine extends ModelePDFProjects
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Project $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return integer
+ * @param PDF $pdf PDF
+ * @param Project $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
index 8f9c9932389..f24f400f2af 100644
--- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
@@ -1,7 +1,7 @@
- * Copyright (C) 2015-2018 Charlene Benke
- * Copyright (C) 2018 Laurent Destailleur
+/* Copyright (C) 2010-2012 Regis Houssin
+ * Copyright (C) 2015-2018 Charlene Benke
+ * Copyright (C) 2018 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -65,7 +65,7 @@ class pdf_beluga extends ModelePDFProjects
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -114,7 +114,7 @@ class pdf_beluga extends ModelePDFProjects
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
*
@@ -122,7 +122,7 @@ class pdf_beluga extends ModelePDFProjects
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs)
+ public function write_file($object, $outputlangs)
{
// phpcs:enable
global $conf, $hookmanager, $langs, $user;
@@ -685,7 +685,7 @@ class pdf_beluga extends ModelePDFProjects
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@@ -732,7 +732,7 @@ class pdf_beluga extends ModelePDFProjects
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@@ -793,15 +793,15 @@ class pdf_beluga extends ModelePDFProjects
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Project $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return integer
+ * @param PDF $pdf PDF
+ * @param Project $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
index 047f1cf946f..1846e556b1e 100644
--- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
@@ -48,7 +48,7 @@ class pdf_timespent extends ModelePDFProjects
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -97,7 +97,7 @@ class pdf_timespent extends ModelePDFProjects
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
*
@@ -105,7 +105,7 @@ class pdf_timespent extends ModelePDFProjects
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs)
+ public function write_file($object, $outputlangs)
{
// phpcs:enable
global $conf, $hookmanager, $langs, $user;
@@ -464,7 +464,7 @@ class pdf_timespent extends ModelePDFProjects
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@@ -511,7 +511,7 @@ class pdf_timespent extends ModelePDFProjects
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@@ -595,19 +595,19 @@ class pdf_timespent extends ModelePDFProjects
*/
}
- /**
- * Show footer of page. Need this->emetteur object
+ /**
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Project $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return integer
- */
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
- {
- global $conf;
- $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
- return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
- }
+ * @param PDF $pdf PDF
+ * @param Project $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return integer
+ */
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ {
+ global $conf;
+ $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
+ return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
+ }
}
diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php
index 68d0feaf2dc..25553fb19c9 100644
--- a/htdocs/core/modules/project/mod_project_simple.php
+++ b/htdocs/core/modules/project/mod_project_simple.php
@@ -62,7 +62,7 @@ class mod_project_simple extends ModeleNumRefProjects
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -74,7 +74,7 @@ class mod_project_simple extends ModeleNumRefProjects
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -85,7 +85,7 @@ class mod_project_simple extends ModeleNumRefProjects
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -122,7 +122,7 @@ class mod_project_simple extends ModeleNumRefProjects
* @param Project $project Object project
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $project)
+ public function getNextValue($objsoc, $project)
{
global $db,$conf;
@@ -159,7 +159,7 @@ class mod_project_simple extends ModeleNumRefProjects
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next reference not yet used as a reference
*
@@ -167,7 +167,7 @@ class mod_project_simple extends ModeleNumRefProjects
* @param Project $project Object project
* @return string Next not used reference
*/
- function project_get_num($objsoc = 0, $project = '')
+ public function project_get_num($objsoc = 0, $project = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $project);
diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php
index 7d2d3665582..f987d4d3b32 100644
--- a/htdocs/core/modules/project/mod_project_universal.php
+++ b/htdocs/core/modules/project/mod_project_universal.php
@@ -59,7 +59,7 @@ class mod_project_universal extends ModeleNumRefProjects
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -100,7 +100,7 @@ class mod_project_universal extends ModeleNumRefProjects
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -123,7 +123,7 @@ class mod_project_universal extends ModeleNumRefProjects
* @param Project $project Object project
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $project)
+ public function getNextValue($objsoc, $project)
{
global $db,$conf;
@@ -145,7 +145,7 @@ class mod_project_universal extends ModeleNumRefProjects
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next reference not yet used as a reference
*
@@ -153,7 +153,7 @@ class mod_project_universal extends ModeleNumRefProjects
* @param Project $project Object project
* @return string Next not used reference
*/
- function project_get_num($objsoc = 0, $project = '')
+ public function project_get_num($objsoc = 0, $project = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $project);
diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php
index 65a424941b8..f77111bade3 100644
--- a/htdocs/core/modules/project/modules_project.php
+++ b/htdocs/core/modules/project/modules_project.php
@@ -37,7 +37,7 @@ abstract class ModelePDFProjects extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -45,7 +45,7 @@ abstract class ModelePDFProjects extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -77,7 +77,7 @@ abstract class ModeleNumRefProjects
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -87,7 +87,7 @@ abstract class ModeleNumRefProjects
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("projects");
@@ -99,7 +99,7 @@ abstract class ModeleNumRefProjects
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("projects");
@@ -112,7 +112,7 @@ abstract class ModeleNumRefProjects
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -124,7 +124,7 @@ abstract class ModeleNumRefProjects
* @param Project $project Object project
* @return string Valeur
*/
- function getNextValue($objsoc, $project)
+ public function getNextValue($objsoc, $project)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -135,15 +135,15 @@ abstract class ModeleNumRefProjects
*
* @return string Valeur
*/
- function getVersion()
- {
+ public function getVersion()
+ {
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
- return $langs->trans("NotAvailable");
- }
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
+ else return $langs->trans("NotAvailable");
+ }
}
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index fefaefc426c..151d800f04d 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -62,7 +62,7 @@ class doc_generic_task_odt extends ModelePDFTask
public $emetteur;
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@@ -79,7 +79,7 @@ class doc_generic_task_odt extends ModelePDFTask
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -118,7 +118,7 @@ class doc_generic_task_odt extends ModelePDFTask
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -127,7 +127,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param string $array_key Name of the key for return array
* @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
global $conf;
@@ -163,7 +163,7 @@ class doc_generic_task_odt extends ModelePDFTask
return $resarray;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -171,30 +171,30 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_tasks($task, $outputlangs)
- {
+ public function get_substitutionarray_tasks($task, $outputlangs)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- return array(
- 'task_ref'=>$task->ref,
- 'task_fk_project'=>$task->fk_project,
- 'task_projectref'=>$task->projectref,
- 'task_projectlabel'=>$task->projectlabel,
- 'task_label'=>$task->label,
- 'task_description'=>$task->description,
- 'task_fk_parent'=>$task->fk_parent,
- 'task_duration'=>$task->duration,
- 'task_progress'=>$task->progress,
- 'task_public'=>$task->public,
- 'task_date_start'=>dol_print_date($task->date_start, 'day'),
- 'task_date_end'=>dol_print_date($task->date_end, 'day'),
- 'task_note_private'=>$task->note_private,
- 'task_note_public'=>$task->note_public
- );
- }
+ return array(
+ 'task_ref'=>$task->ref,
+ 'task_fk_project'=>$task->fk_project,
+ 'task_projectref'=>$task->projectref,
+ 'task_projectlabel'=>$task->projectlabel,
+ 'task_label'=>$task->label,
+ 'task_description'=>$task->description,
+ 'task_fk_parent'=>$task->fk_parent,
+ 'task_duration'=>$task->duration,
+ 'task_progress'=>$task->progress,
+ 'task_public'=>$task->public,
+ 'task_date_start'=>dol_print_date($task->date_start, 'day'),
+ 'task_date_end'=>dol_print_date($task->date_end, 'day'),
+ 'task_note_private'=>$task->note_private,
+ 'task_note_public'=>$task->note_public
+ );
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -202,7 +202,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_project_contacts($contact, $outputlangs)
+ public function get_substitutionarray_project_contacts($contact, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -219,7 +219,7 @@ class doc_generic_task_odt extends ModelePDFTask
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -227,7 +227,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_project_file($file, $outputlangs)
+ public function get_substitutionarray_project_file($file, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -239,7 +239,7 @@ class doc_generic_task_odt extends ModelePDFTask
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -247,7 +247,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_project_reference($refdetail, $outputlangs)
+ public function get_substitutionarray_project_reference($refdetail, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -263,7 +263,7 @@ class doc_generic_task_odt extends ModelePDFTask
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -271,7 +271,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_tasksressource($taskressource, $outputlangs)
+ public function get_substitutionarray_tasksressource($taskressource, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -287,7 +287,7 @@ class doc_generic_task_odt extends ModelePDFTask
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -295,7 +295,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_taskstime($tasktime, $outputlangs)
+ public function get_substitutionarray_taskstime($tasktime, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -312,7 +312,7 @@ class doc_generic_task_odt extends ModelePDFTask
);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
*
@@ -320,7 +320,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $outputlangs Lang object to use for output
* @return array Return a substitution array
*/
- function get_substitutionarray_task_file($file, $outputlangs)
+ public function get_substitutionarray_task_file($file, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -339,7 +339,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -422,7 +422,7 @@ class doc_generic_task_odt extends ModelePDFTask
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -431,7 +431,7 @@ class doc_generic_task_odt extends ModelePDFTask
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath)
+ public function write_file($object, $outputlangs, $srctemplatepath)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -515,7 +515,7 @@ class doc_generic_task_odt extends ModelePDFTask
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->projet->dir_temp,
diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php
index 47baf9e7d4c..4632fedec4a 100644
--- a/htdocs/core/modules/project/task/mod_task_simple.php
+++ b/htdocs/core/modules/project/task/mod_task_simple.php
@@ -62,7 +62,7 @@ class mod_task_simple extends ModeleNumRefTask
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -74,7 +74,7 @@ class mod_task_simple extends ModeleNumRefTask
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -85,7 +85,7 @@ class mod_task_simple extends ModeleNumRefTask
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -123,7 +123,7 @@ class mod_task_simple extends ModeleNumRefTask
* @param Task $object Object Task
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -159,7 +159,7 @@ class mod_task_simple extends ModeleNumRefTask
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next reference not yet used as a reference
*
@@ -167,7 +167,7 @@ class mod_task_simple extends ModeleNumRefTask
* @param Task $object Object task
* @return string Next not used reference
*/
- function task_get_num($objsoc = 0, $object = '')
+ public function task_get_num($objsoc = 0, $object = '')
{
return $this->getNextValue($objsoc, $object);
}
diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php
index b92fe03ae3f..f1d295802a9 100644
--- a/htdocs/core/modules/project/task/mod_task_universal.php
+++ b/htdocs/core/modules/project/task/mod_task_universal.php
@@ -59,7 +59,7 @@ class mod_task_universal extends ModeleNumRefTask
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf,$langs;
@@ -100,7 +100,7 @@ class mod_task_universal extends ModeleNumRefTask
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -123,7 +123,7 @@ class mod_task_universal extends ModeleNumRefTask
* @param Task $object Object task
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -145,7 +145,7 @@ class mod_task_universal extends ModeleNumRefTask
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next reference not yet used as a reference
*
@@ -153,7 +153,7 @@ class mod_task_universal extends ModeleNumRefTask
* @param Task $object Object task
* @return string Next not used reference
*/
- function project_get_num($objsoc = 0, $object = '')
+ public function project_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php
index 3e1b00fcf47..e37c4b1dabb 100644
--- a/htdocs/core/modules/project/task/modules_task.php
+++ b/htdocs/core/modules/project/task/modules_task.php
@@ -38,7 +38,7 @@ abstract class ModelePDFTask extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -46,7 +46,7 @@ abstract class ModelePDFTask extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -78,7 +78,7 @@ abstract class ModeleNumRefTask
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -88,7 +88,7 @@ abstract class ModeleNumRefTask
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("projects");
@@ -100,7 +100,7 @@ abstract class ModeleNumRefTask
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("projects");
@@ -113,7 +113,7 @@ abstract class ModeleNumRefTask
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -125,7 +125,7 @@ abstract class ModeleNumRefTask
* @param Project $project Object project
* @return string Valeur
*/
- function getNextValue($objsoc, $project)
+ public function getNextValue($objsoc, $project)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -136,7 +136,7 @@ abstract class ModeleNumRefTask
*
* @return string Valeur
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index 4af8e8d1e32..d303e52d734 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -60,7 +60,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -105,7 +105,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -219,7 +219,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -231,7 +231,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index fd254490ec1..24fe36b3213 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -125,7 +125,7 @@ class pdf_azur extends ModelePDFPropales
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -202,7 +202,7 @@ class pdf_azur extends ModelePDFPropales
$this->atleastonediscount=0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -214,7 +214,7 @@ class pdf_azur extends ModelePDFPropales
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
@@ -837,7 +837,7 @@ class pdf_azur extends ModelePDFPropales
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
*
@@ -847,13 +847,13 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
- function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -863,7 +863,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Langs object
* @return void
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -1034,7 +1034,7 @@ class pdf_azur extends ModelePDFPropales
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -1045,7 +1045,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -1323,7 +1323,7 @@ class pdf_azur extends ModelePDFPropales
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1442,7 +1442,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@@ -1665,14 +1665,14 @@ class pdf_azur extends ModelePDFPropales
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show area for the customer to sign
*
@@ -1682,7 +1682,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _signature_area(&$pdf, $object, $posy, $outputlangs)
+ private function _signature_area(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
index 936309fb6d8..668693e67cc 100644
--- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
@@ -903,7 +903,7 @@ class pdf_cyan extends ModelePDFPropales
* @param Translate $outputlangs Langs object
* @return void
*/
- function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
+ public function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1360,7 +1360,7 @@ class pdf_cyan extends ModelePDFPropales
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1427,7 +1427,7 @@ class pdf_cyan extends ModelePDFPropales
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@@ -1652,7 +1652,7 @@ class pdf_cyan extends ModelePDFPropales
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
@@ -1705,7 +1705,7 @@ class pdf_cyan extends ModelePDFPropales
* @param int $hideref Do not show ref
* @return null
*/
- function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php
index abbc4df42b6..0e03574a3d4 100644
--- a/htdocs/core/modules/propale/mod_propale_marbre.php
+++ b/htdocs/core/modules/propale/mod_propale_marbre.php
@@ -62,7 +62,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -74,7 +74,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -86,7 +86,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -124,7 +124,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
* @param Propal $propal Object commercial proposal
* @return string Next value
*/
- function getNextValue($objsoc, $propal)
+ public function getNextValue($objsoc, $propal)
{
global $db,$conf;
@@ -165,7 +165,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
* @param Object $objforref Object for number to search
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref)
+ public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php
index f30ef4e48d1..972bb94cb64 100644
--- a/htdocs/core/modules/propale/mod_propale_saphir.php
+++ b/htdocs/core/modules/propale/mod_propale_saphir.php
@@ -62,7 +62,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -102,7 +102,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -128,7 +128,7 @@ class mod_propale_saphir extends ModeleNumRefPropales
* @param Propal $propal Object commercial proposal
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $propal)
+ public function getNextValue($objsoc, $propal)
{
global $db,$conf;
diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php
index cb4e253fc09..dc01941ece4 100644
--- a/htdocs/core/modules/propale/modules_propale.php
+++ b/htdocs/core/modules/propale/modules_propale.php
@@ -42,7 +42,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -50,7 +50,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -81,7 +81,7 @@ abstract class ModeleNumRefPropales
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -91,7 +91,7 @@ abstract class ModeleNumRefPropales
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("propale");
@@ -103,7 +103,7 @@ abstract class ModeleNumRefPropales
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("propale");
@@ -116,7 +116,7 @@ abstract class ModeleNumRefPropales
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -128,7 +128,7 @@ abstract class ModeleNumRefPropales
* @param Propal $propal Object commercial proposal
* @return string Valeur
*/
- function getNextValue($objsoc, $propal)
+ public function getNextValue($objsoc, $propal)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -139,7 +139,7 @@ abstract class ModeleNumRefPropales
*
* @return string Valeur
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php
index 15682551670..127c7a92352 100644
--- a/htdocs/core/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement.class.php
@@ -37,7 +37,7 @@ class pdf_paiement
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $langs,$conf;
@@ -83,7 +83,7 @@ class pdf_paiement
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant la rapport sur le disque
*
@@ -93,7 +93,7 @@ class pdf_paiement
* @param string $outputlangs Lang output object
* @return int <0 if KO, >0 if OK
*/
- function write_file($_dir, $month, $year, $outputlangs)
+ public function write_file($_dir, $month, $year, $outputlangs)
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -125,7 +125,7 @@ class pdf_paiement
$year = sprintf("%04d", $year);
$file = $dir . "/payments-".$year."-".$month.".pdf";
- switch ($this->doc_type) {
+ switch ($this->doc_type) {
case "client":
$file = $dir . "/payments-".$year."-".$month.".pdf";
break;
@@ -159,9 +159,9 @@ class pdf_paiement
$num=0;
$lines=array();
- // count number of lines of payment
- $sql = "SELECT p.rowid as prowid";
- switch ($this->doc_type) {
+ // count number of lines of payment
+ $sql = "SELECT p.rowid as prowid";
+ switch ($this->doc_type) {
case "client":
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
break;
@@ -340,6 +340,7 @@ class pdf_paiement
return 1;
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@@ -349,8 +350,9 @@ class pdf_paiement
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $page, $showaddress, $outputlangs)
+ protected function _pagehead(&$pdf, $page, $showaddress, $outputlangs)
{
+ // phpcs:enable
global $langs, $conf;
// Do not add the BACKGROUND as this is a report
@@ -359,7 +361,7 @@ class pdf_paiement
$default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$conf->global->MAIN_INFO_SOCIETE_NOM;
- switch($this->doc_type) {
+ switch($this->doc_type) {
case "client":
$title.=' - '.$outputlangs->transnoentities("ListOfCustomerPayments");
break;
@@ -412,7 +414,7 @@ class pdf_paiement
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output body
*
@@ -422,7 +424,7 @@ class pdf_paiement
* @param Translate $outputlangs Object langs
* @return void
*/
- function Body(&$pdf, $page, $lines, $outputlangs)
+ public function Body(&$pdf, $page, $lines, $outputlangs)
{
// phpcs:enable
global $langs;
diff --git a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
index 0b823e0419e..b25b979783e 100644
--- a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
@@ -35,7 +35,7 @@ class pdf_paiement_fourn extends pdf_paiement
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
parent::__construct($db);
$this->doc_type = "fourn";
diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
index fdd2a92d15b..4854af7bfac 100644
--- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
+++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
@@ -58,8 +58,8 @@ class doc_generic_reception_odt extends ModelePdfReception
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
+ public function __construct($db)
+ {
global $conf,$langs,$mysoc;
$langs->load("main");
@@ -94,18 +94,18 @@ class doc_generic_reception_odt extends ModelePdfReception
// Recupere emetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
- }
+ }
- /**
- * Return description of a module
- *
- * @param Translate $langs Lang object to use for output
- * @return string Description
- */
- function info($langs)
- {
- global $conf,$langs;
+ /**
+ * Return description of a module
+ *
+ * @param Translate $langs Lang object to use for output
+ * @return string Description
+ */
+ public function info($langs)
+ {
+ global $conf,$langs;
$langs->load("companies");
$langs->load("errors");
@@ -183,22 +183,22 @@ class doc_generic_reception_odt extends ModelePdfReception
$texte.= '';
return $texte;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Function to build a document on disk using the generic odt module.
+ * Function to build a document on disk using the generic odt module.
*
- * @param Reception $object Object source to build document
- * @param Translate $outputlangs Lang output object
+ * @param Reception $object Object source to build document
+ * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
index 9a4c3b2010d..dec1f35e7b0 100644
--- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php
+++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_squille extends ModelePdfReception
{
- var $emetteur; // Objet societe qui emet
+ public $emetteur; // Objet societe qui emet
/**
@@ -40,7 +40,7 @@ class pdf_squille extends ModelePdfReception
*
* @param DoliDB $db Database handler
*/
- function __construct($db = 0)
+ public function __construct($db = 0)
{
global $conf,$langs,$mysoc;
@@ -98,7 +98,7 @@ class pdf_squille extends ModelePdfReception
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -110,7 +110,7 @@ class pdf_squille extends ModelePdfReception
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$conf,$langs,$hookmanager;
@@ -592,7 +592,7 @@ class pdf_squille extends ModelePdfReception
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -604,7 +604,7 @@ class pdf_squille extends ModelePdfReception
* @param int $totalOrdered Total ordered
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered)
{
// phpcs:enable
global $conf,$mysoc;
@@ -707,7 +707,7 @@ class pdf_squille extends ModelePdfReception
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@@ -786,7 +786,7 @@ class pdf_squille extends ModelePdfReception
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$mysoc;
@@ -1037,7 +1037,7 @@ class pdf_squille extends ModelePdfReception
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php
index 7624ec5cec0..09b3fbfb1f5 100644
--- a/htdocs/core/modules/reception/mod_reception_beryl.php
+++ b/htdocs/core/modules/reception/mod_reception_beryl.php
@@ -28,10 +28,10 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/reception/modules_reception.php';
*/
class mod_reception_beryl extends ModelNumRefReception
{
- var $version='dolibarr';
- var $prefix='RCP';
- var $error='';
- var $nom='Beryl';
+ public $version='dolibarr';
+ public $prefix='RCP';
+ public $error='';
+ public $nom='Beryl';
/**
@@ -39,7 +39,7 @@ class mod_reception_beryl extends ModelNumRefReception
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -51,7 +51,7 @@ class mod_reception_beryl extends ModelNumRefReception
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -62,7 +62,7 @@ class mod_reception_beryl extends ModelNumRefReception
*
* @return boolean false if conflit, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -97,7 +97,7 @@ class mod_reception_beryl extends ModelNumRefReception
* @param Object $shipment Shipment object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $shipment)
{
global $db,$conf;
@@ -130,7 +130,7 @@ class mod_reception_beryl extends ModelNumRefReception
return $this->prefix.$yymm."-".$num;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -138,7 +138,7 @@ class mod_reception_beryl extends ModelNumRefReception
* @param Object $objforref Shipment object
* @return string Next free value
*/
- function reception_get_num($objsoc, $objforref)
+ public function reception_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php
index bbf5443255a..6f7d66f8ef3 100644
--- a/htdocs/core/modules/reception/mod_reception_moonstone.php
+++ b/htdocs/core/modules/reception/mod_reception_moonstone.php
@@ -29,16 +29,16 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/reception/modules_reception.php';
*/
class mod_reception_moonstone extends ModelNumRefReception
{
- var $version='dolibarr';
- var $error = '';
- var $nom = 'Moonstone';
+ public $version='dolibarr';
+ public $error = '';
+ public $nom = 'Moonstone';
- /**
- * Return default description of numbering model
- *
- * @return string text description
- */
- function info()
+ /**
+ * Return default description of numbering model
+ *
+ * @return string text description
+ */
+ public function info()
{
global $conf,$langs;
@@ -74,7 +74,7 @@ class mod_reception_moonstone extends ModelNumRefReception
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -100,7 +100,7 @@ class mod_reception_moonstone extends ModelNumRefReception
* @param Object $reception Reception object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $reception)
+ public function getNextValue($objsoc, $reception)
{
global $db,$conf;
@@ -119,9 +119,9 @@ class mod_reception_moonstone extends ModelNumRefReception
$numFinal=get_next_value($db, $mask, 'reception', 'ref', '', $objsoc, $date);
return $numFinal;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -129,7 +129,7 @@ class mod_reception_moonstone extends ModelNumRefReception
* @param Object $objforref Reception object
* @return string Next free value
*/
- function reception_get_num($objsoc, $objforref)
+ public function reception_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php
index 62e2434d9ac..f258ce04d5c 100644
--- a/htdocs/core/modules/reception/modules_reception.php
+++ b/htdocs/core/modules/reception/modules_reception.php
@@ -32,7 +32,7 @@ abstract class ModelePdfReception extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -40,7 +40,7 @@ abstract class ModelePdfReception extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -61,13 +61,13 @@ abstract class ModelePdfReception extends CommonDocGenerator
*/
abstract class ModelNumRefReception
{
- var $error='';
+ public $error='';
/** Return if a model can be used or not
*
* @return boolean true if model can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -77,7 +77,7 @@ abstract class ModelNumRefReception
*
* @return string text description
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("reception");
@@ -89,7 +89,7 @@ abstract class ModelNumRefReception
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("reception");
@@ -101,7 +101,7 @@ abstract class ModelNumRefReception
*
* @return boolean false if conflit, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -113,7 +113,7 @@ abstract class ModelNumRefReception
* @param Object $shipment Shipment object
* @return string Value
*/
- function getNextValue($objsoc, $shipment)
+ public function getNextValue($objsoc, $shipment)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -124,15 +124,15 @@ abstract class ModelNumRefReception
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
return $langs->trans("NotAvailable");
}
}
diff --git a/htdocs/core/modules/security/generate/modGeneratePassNone.class.php b/htdocs/core/modules/security/generate/modGeneratePassNone.class.php
index b0caa7d0b15..c9bdff46ece 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassNone.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassNone.class.php
@@ -56,7 +56,7 @@ class modGeneratePassNone extends ModeleGenPassword
* @param Translate $langs Handler de langue
* @param User $user Handler du user connecte
*/
- function __construct($db, $conf, $langs, $user)
+ public function __construct($db, $conf, $langs, $user)
{
$this->id = "none";
$this->length = 0;
@@ -72,7 +72,7 @@ class modGeneratePassNone extends ModeleGenPassword
*
* @return string Description of text
*/
- function getDescription()
+ public function getDescription()
{
global $langs;
return $langs->trans("PasswordGenerationNone");
@@ -83,7 +83,7 @@ class modGeneratePassNone extends ModeleGenPassword
*
* @return string Example of password
*/
- function getExample()
+ public function getExample()
{
return $this->langs->trans("None");
}
@@ -93,7 +93,7 @@ class modGeneratePassNone extends ModeleGenPassword
*
* @return string Return a new generated password
*/
- function getNewGeneratedPassword()
+ public function getNewGeneratedPassword()
{
return "";
}
@@ -104,7 +104,7 @@ class modGeneratePassNone extends ModeleGenPassword
* @param string $password Password to check
* @return int 0 if KO, >0 if OK
*/
- function validatePassword($password)
+ public function validatePassword($password)
{
return 1;
}
diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
index 3e4ee4326d3..bccb1353087 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
@@ -70,7 +70,7 @@ class modGeneratePassPerso extends ModeleGenPassword
* @param Translate $langs Handler de langue
* @param User $user Handler du user connecte
*/
- function __construct($db, $conf, $langs, $user)
+ public function __construct($db, $conf, $langs, $user)
{
$this->id = "Perso";
$this->length = $langs->trans("SetupPerso");
@@ -120,7 +120,7 @@ class modGeneratePassPerso extends ModeleGenPassword
*
* @return string Description of text
*/
- function getDescription()
+ public function getDescription()
{
global $langs;
return $langs->trans("PasswordGenerationPerso");
@@ -131,39 +131,42 @@ class modGeneratePassPerso extends ModeleGenPassword
*
* @return string Example of password
*/
- function getExample()
+ public function getExample()
{
return $this->getNewGeneratedPassword();
}
/**
- * Build new password
+ * Build new password
*
- * @return string Return a new generated password
+ * @return string Return a new generated password
*/
- function getNewGeneratedPassword()
+ public function getNewGeneratedPassword()
{
$pass = "";
- for($i=0; $i<$this->NbMaj; $i++){ // Y
+ for ($i=0; $i<$this->NbMaj; $i++) {
+ // Y
$pass .= $this->Maj[mt_rand(0, strlen($this->Maj) - 1)];
}
- for($i=0; $i<$this->NbNum; $i++){ // X
+ for ($i=0; $i<$this->NbNum; $i++) {
+ // X
$pass .= $this->Nb[mt_rand(0, strlen($this->Nb) - 1)];
}
- for($i=0; $i<$this->NbSpe; $i++){ // @
+ for ($i=0; $i<$this->NbSpe; $i++) {
+ // @
$pass .= $this->Spe[mt_rand(0, strlen($this->Spe) - 1)];
}
- for($i=strlen($pass);$i<$this->length2; $i++){ // y
+ for ($i=strlen($pass);$i<$this->length2; $i++) {
+ // y
$pass .= $this->All[mt_rand(0, strlen($this->All) -1)];
}
$pass = str_shuffle($pass);
- if ($this->validatePassword($pass))
- {
+ if ($this->validatePassword($pass)) {
return $pass;
}
@@ -171,31 +174,31 @@ class modGeneratePassPerso extends ModeleGenPassword
}
/**
- * Validate a password
+ * Validate a password
*
- * @param string $password Password to check
- * @return int 0 if KO, >0 if OK
+ * @param string $password Password to check
+ * @return int 0 if KO, >0 if OK
*/
- function validatePassword($password)
+ public function validatePassword($password)
{
$password_a = str_split($password);
$maj = str_split($this->Maj);
$num = str_split($this->Nb);
$spe = str_split($this->Spe);
- if(count(array_intersect($password_a, $maj)) < $this->NbMaj){
+ if (count(array_intersect($password_a, $maj)) < $this->NbMaj) {
return 0;
}
- if(count(array_intersect($password_a, $num)) < $this->NbNum){
+ if (count(array_intersect($password_a, $num)) < $this->NbNum) {
return 0;
}
- if(count(array_intersect($password_a, $spe)) < $this->NbSpe){
+ if (count(array_intersect($password_a, $spe)) < $this->NbSpe) {
return 0;
}
- if(!$this->consecutiveInterationSameCharacter($password)){
+ if (!$this->consecutiveInterationSameCharacter($password)) {
return 0;
}
@@ -203,25 +206,25 @@ class modGeneratePassPerso extends ModeleGenPassword
}
/**
- * consecutive iterations of the same character
+ * consecutive iterations of the same character
*
- * @param string $password Password to check
- * @return int 0 if KO, >0 if OK
+ * @param string $password Password to check
+ * @return int 0 if KO, >0 if OK
*/
- function consecutiveInterationSameCharacter($password)
+ public function consecutiveInterationSameCharacter($password)
{
$last = "";
$count = 0;
$char = str_split($password);
- foreach($char as $c){
- if($c != $last){
+ foreach($char as $c) {
+ if($c != $last) {
$last = $c;
$count = 0;
- }else{
+ } else {
$count++;
}
- if($count >= $this->NbRepeat) {
+ if ($count >= $this->NbRepeat) {
return 0;
}
}
diff --git a/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php b/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
index 124ecf32321..88dc53e7e32 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
@@ -56,7 +56,7 @@ class modGeneratePassStandard extends ModeleGenPassword
* @param Translate $langs Handler de langue
* @param User $user Handler du user connecte
*/
- function __construct($db, $conf, $langs, $user)
+ public function __construct($db, $conf, $langs, $user)
{
$this->id = "standard";
$this->length = 8;
@@ -72,7 +72,7 @@ class modGeneratePassStandard extends ModeleGenPassword
*
* @return string Description of module
*/
- function getDescription()
+ public function getDescription()
{
global $langs;
return $langs->trans("PasswordGenerationStandard");
@@ -83,7 +83,7 @@ class modGeneratePassStandard extends ModeleGenPassword
*
* @return string Example of password
*/
- function getExample()
+ public function getExample()
{
return $this->getNewGeneratedPassword();
}
@@ -93,7 +93,7 @@ class modGeneratePassStandard extends ModeleGenPassword
*
* @return string Return a new generated password
*/
- function getNewGeneratedPassword()
+ public function getNewGeneratedPassword()
{
// start with a blank password
$password = "";
@@ -123,15 +123,15 @@ class modGeneratePassStandard extends ModeleGenPassword
return $password;
}
- /**
- * Validate a password
- *
- * @param string $password Password to check
- * @return int 0 if KO, >0 if OK
- */
- function validatePassword($password)
- {
- if (dol_strlen($password) < $this->length) return 0;
- return 1;
- }
+ /**
+ * Validate a password
+ *
+ * @param string $password Password to check
+ * @return int 0 if KO, >0 if OK
+ */
+ public function validatePassword($password)
+ {
+ if (dol_strlen($password) < $this->length) return 0;
+ return 1;
+ }
}
diff --git a/htdocs/core/modules/security/generate/modules_genpassword.php b/htdocs/core/modules/security/generate/modules_genpassword.php
index a22d19e0845..5515a298379 100644
--- a/htdocs/core/modules/security/generate/modules_genpassword.php
+++ b/htdocs/core/modules/security/generate/modules_genpassword.php
@@ -40,7 +40,7 @@ abstract class ModeleGenPassword
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -50,18 +50,18 @@ abstract class ModeleGenPassword
*
* @return string Description of text
*/
- function getDescription()
+ public function getDescription()
{
global $langs;
return $langs->trans("NoDescription");
}
/**
- * Return an example of password generated by this module
+ * Return an example of password generated by this module
*
- * @return string Example of password
+ * @return string Example of password
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("bills");
@@ -69,11 +69,11 @@ abstract class ModeleGenPassword
}
/**
- * Build new password
+ * Build new password
*
- * @return string Return a new generated password
+ * @return string Return a new generated password
*/
- function getNewGeneratedPassword()
+ public function getNewGeneratedPassword()
{
global $langs;
return $langs->trans("NotAvailable");
@@ -85,7 +85,7 @@ abstract class ModeleGenPassword
* @param string $password Password to check
* @return int 0 if KO, >0 if OK
*/
- function validatePassword($password)
+ public function validatePassword($password)
{
return 1;
}
diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
index 1b5707330da..0043f14990d 100644
--- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
+++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
@@ -54,7 +54,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -90,7 +90,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
* @param Translate $langs Object language
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -174,7 +174,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -186,10 +186,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
- global $user,$langs,$conf,$mysoc,$hookmanager;
+ global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
@@ -265,7 +265,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->societe->multidir_temp[$object->entity],
@@ -419,7 +419,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
$odfHandler->saveToDisk($file);
- }catch (Exception $e){
+ } catch (Exception $e){
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php
index 75cc33df4bd..f8d4f137048 100644
--- a/htdocs/core/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php
@@ -72,7 +72,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$this->code_null = 0;
$this->code_modifiable = 1;
@@ -83,12 +83,13 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
}
- /** Return description of module
+ /**
+ * Return description of module
*
- * @param Translate $langs Object langs
- * @return string Description of module
+ * @param Translate $langs Object langs
+ * @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
global $conf, $mc;
global $form;
@@ -139,7 +140,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/
- function getExample($langs, $objsoc = 0, $type = -1)
+ public function getExample($langs, $objsoc = 0, $type = -1)
{
if ($type == 0 || $type == -1)
{
@@ -200,7 +201,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* @param int $type Client ou fournisseur (0:customer, 1:supplier)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
- function getNextValue($objsoc = 0, $type = -1)
+ public function getNextValue($objsoc = 0, $type = -1)
{
global $db,$conf;
@@ -237,13 +238,13 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if mask/numbering use prefix
*
* @return int 0 or 1
*/
- function verif_prefixIsUsed()
+ public function verif_prefixIsUsed()
{
// phpcs:enable
global $conf;
@@ -272,7 +273,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* -4 ErrorPrefixRequired
* -5 Other (see this->error)
*/
- function verif($db, &$code, $soc, $type)
+ public function verif($db, &$code, $soc, $type)
{
global $conf;
@@ -314,7 +315,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi si un code est pris ou non (par autre tiers)
*
@@ -324,7 +325,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* @param int $type 0 = customer/prospect , 1 = supplier
* @return int 0 if available, <0 if KO
*/
- function verif_dispo($db, $code, $soc, $type = 0)
+ public function verif_dispo($db, $code, $soc, $type = 0)
{
// phpcs:enable
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe";
diff --git a/htdocs/core/modules/societe/mod_codeclient_leopard.php b/htdocs/core/modules/societe/mod_codeclient_leopard.php
index 77be301464c..c7d204a5010 100644
--- a/htdocs/core/modules/societe/mod_codeclient_leopard.php
+++ b/htdocs/core/modules/societe/mod_codeclient_leopard.php
@@ -70,7 +70,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$this->code_null = 1;
$this->code_modifiable = 1;
@@ -80,12 +80,13 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
}
- /** Return description of module
+ /**
+ * Return description of module
*
- * @param Translate $langs Object langs
- * @return string Description of module
+ * @param Translate $langs Object langs
+ * @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
$langs->load("companies");
return $langs->trans("LeopardNumRefModelDesc");
@@ -99,7 +100,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return next value
*/
- function getNextValue($objsoc = 0, $type = -1)
+ public function getNextValue($objsoc = 0, $type = -1)
{
global $langs;
return '';
@@ -119,7 +120,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
*/
- function verif($db, &$code, $soc, $type)
+ public function verif($db, &$code, $soc, $type)
{
global $conf;
diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php
index 97acb109b97..69ee75911a6 100644
--- a/htdocs/core/modules/societe/mod_codeclient_monkey.php
+++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php
@@ -70,7 +70,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$this->nom = "Monkey";
$this->name = "Monkey";
@@ -84,12 +84,13 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
}
- /** Return description of module
+ /**
+ * Return description of module
*
- * @param Translate $langs Object langs
- * @return string Description of module
+ * @param Translate $langs Object langs
+ * @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
return $langs->trans("MonkeyNumRefModelDesc", $this->prefixcustomer, $this->prefixsupplier);
}
@@ -103,7 +104,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/
- function getExample($langs, $objsoc = 0, $type = -1)
+ public function getExample($langs, $objsoc = 0, $type = -1)
{
return $this->prefixcustomer.'0901-00001 '.$this->prefixsupplier.'0901-00001';
}
@@ -112,11 +113,11 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
/**
* Return next value
*
- * @param Societe $objsoc Object third party
- * @param int $type Client ou fournisseur (1:client, 2:fournisseur)
+ * @param Societe $objsoc Object third party
+ * @param int $type Client ou fournisseur (1:client, 2:fournisseur)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
- function getNextValue($objsoc = 0, $type = -1)
+ public function getNextValue($objsoc = 0, $type = -1)
{
global $db, $conf, $mc;
@@ -177,7 +178,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
*/
- function verif($db, &$code, $soc, $type)
+ public function verif($db, &$code, $soc, $type)
{
global $conf;
@@ -224,7 +225,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi si un code est pris ou non (par autre tiers)
*
@@ -234,7 +235,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
* @param int $type 0 = customer/prospect , 1 = supplier
* @return int 0 if available, <0 if KO
*/
- function verif_dispo($db, $code, $soc, $type = 0)
+ public function verif_dispo($db, $code, $soc, $type = 0)
{
// phpcs:enable
global $conf, $mc;
@@ -265,14 +266,14 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi si un code respecte la syntaxe
+ * Renvoi si un code respecte la syntaxe
*
- * @param string $code Code a verifier
- * @return int 0 si OK, <0 si KO
+ * @param string $code Code a verifier
+ * @return int 0 si OK, <0 si KO
*/
- function verif_syntax($code)
+ public function verif_syntax($code)
{
// phpcs:enable
$res = 0;
diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php
index 835213a7402..1472bd982c7 100644
--- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php
+++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php
@@ -57,7 +57,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $conf;
if (! isset($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) || trim($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) == '') $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
@@ -73,7 +73,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
* @param Translate $langs Object langs
* @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
global $conf;
global $form;
@@ -112,7 +112,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/
- function getExample($langs, $objsoc = 0, $type = -1)
+ public function getExample($langs, $objsoc = 0, $type = -1)
{
$s='';
$s.=$this->prefixcustomeraccountancycode.'CUSTCODE';
@@ -122,7 +122,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set accountancy account code for a third party into this->code
*
@@ -131,7 +131,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
* @param string $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO
*/
- function get_code($db, $societe, $type = '')
+ public function get_code($db, $societe, $type = '')
{
// phpcs:enable
global $conf;
@@ -196,7 +196,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
* @param string $type 'supplier' or 'customer'
* @return int 0 if OK but not available, >0 if OK and available, <0 if KO
*/
- function verif($db, $code, $societe, $type)
+ public function verif($db, $code, $societe, $type)
{
$sql = "SELECT ";
if ($type == 'customer') $sql.= "code_compta";
diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php
index 65cbba944b1..373e20b8eb6 100644
--- a/htdocs/core/modules/societe/mod_codecompta_panicum.php
+++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php
@@ -52,7 +52,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
}
@@ -63,7 +63,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
* @param Translate $langs Object langs
* @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
return $langs->trans("ModuleCompanyCode".$this->name);
}
@@ -76,12 +76,12 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Example
*/
- function getExample($langs, $objsoc = 0, $type = -1)
+ public function getExample($langs, $objsoc = 0, $type = -1)
{
return '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set accountancy account code for a third party into this->code
*
@@ -90,7 +90,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
* @param int $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO
*/
- function get_code($db, $societe, $type = '')
+ public function get_code($db, $societe, $type = '')
{
// phpcs:enable
$this->code='';
diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php
index fe2b3d4feb3..d185b4cfcf7 100644
--- a/htdocs/core/modules/societe/modules_societe.class.php
+++ b/htdocs/core/modules/societe/modules_societe.class.php
@@ -38,7 +38,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -46,7 +46,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -77,7 +77,7 @@ abstract class ModeleThirdPartyCode
* @param Translate $langs Object langs
* @return string Texte descripif
*/
- function info($langs)
+ public function info($langs)
{
$langs->load("bills");
return $langs->trans("NoDescription");
@@ -88,7 +88,7 @@ abstract class ModeleThirdPartyCode
* @param Translate $langs Object langs
* @return string Nom du module
*/
- function getNom($langs)
+ public function getNom($langs)
{
return $this->nom;
}
@@ -99,7 +99,7 @@ abstract class ModeleThirdPartyCode
* @param Translate $langs Object langs
* @return string Example
*/
- function getExample($langs)
+ public function getExample($langs)
{
$langs->load("bills");
return $langs->trans("NoExample");
@@ -110,7 +110,7 @@ abstract class ModeleThirdPartyCode
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -122,18 +122,19 @@ abstract class ModeleThirdPartyCode
* @param int $type Type
* @return string Value
*/
- function getNextValue($objsoc = 0, $type = -1)
+ public function getNextValue($objsoc = 0, $type = -1)
{
global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking");
}
- /** Return version of module
+ /**
+ * Return version of module
*
- * @return string Version
+ * @return string Version
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
@@ -145,7 +146,7 @@ abstract class ModeleThirdPartyCode
return $langs->trans("NotAvailable");
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la liste des modeles de numérotation
*
@@ -153,7 +154,7 @@ abstract class ModeleThirdPartyCode
* @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
$liste=array();
@@ -186,7 +187,7 @@ abstract class ModeleThirdPartyCode
* @param int $type -1=Nothing, 0=Customer, 1=Supplier
* @return string HTML translated description
*/
- function getToolTip($langs, $soc, $type)
+ public function getToolTip($langs, $soc, $type)
{
global $conf;
@@ -245,13 +246,13 @@ abstract class ModeleThirdPartyCode
return $s;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if mask/numbering use prefix
*
* @return int 0=no, 1=yes
*/
- function verif_prefixIsUsed()
+ public function verif_prefixIsUsed()
{
// phpcs:enable
return 0;
@@ -271,25 +272,27 @@ abstract class ModeleAccountancyCode
public $error='';
- /** Return description of module
+ /**
+ * Return description of module
*
- * @param Translate $langs Object langs
- * @return string Description of module
+ * @param Translate $langs Object langs
+ * @return string Description of module
*/
- function info($langs)
+ public function info($langs)
{
$langs->load("bills");
return $langs->trans("NoDescription");
}
- /** Return an example of result returned by getNextValue
+ /**
+ * Return an example of result returned by getNextValue
*
- * @param Translate $langs Object langs
- * @param societe $objsoc Object thirdparty
- * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
- * @return string Example
+ * @param Translate $langs Object langs
+ * @param societe $objsoc Object thirdparty
+ * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
+ * @return string Example
*/
- function getExample($langs, $objsoc = 0, $type = -1)
+ public function getExample($langs, $objsoc = 0, $type = -1)
{
$langs->load("bills");
return $langs->trans("NoExample");
@@ -300,16 +303,17 @@ abstract class ModeleAccountancyCode
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
- /** Return version of module
+ /**
+ * Return version of module
*
- * @return string Version
+ * @return string Version
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
@@ -322,14 +326,14 @@ abstract class ModeleAccountancyCode
}
/**
- * Return description of module parameters
+ * Return description of module parameters
*
- * @param Translate $langs Output language
- * @param Societe $soc Third party object
- * @param int $type -1=Nothing, 0=Customer, 1=Supplier
- * @return string HTML translated description
+ * @param Translate $langs Output language
+ * @param Societe $soc Third party object
+ * @param int $type -1=Nothing, 0=Customer, 1=Supplier
+ * @return string HTML translated description
*/
- function getToolTip($langs, $soc, $type)
+ public function getToolTip($langs, $soc, $type)
{
global $conf,$db;
@@ -358,7 +362,7 @@ abstract class ModeleAccountancyCode
return $s;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set accountancy account code for a third party into this->code
*
@@ -367,7 +371,7 @@ abstract class ModeleAccountancyCode
* @param int $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO
*/
- function get_code($db, $societe, $type = '')
+ public function get_code($db, $societe, $type = '')
{
// phpcs:enable
global $langs;
@@ -377,8 +381,6 @@ abstract class ModeleAccountancyCode
}
-
-// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Create a document onto disk according to template module.
*
@@ -396,8 +398,7 @@ abstract class ModeleAccountancyCode
*/
function thirdparty_doc_create(DoliDB $db, Societe $object, $message, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
- // phpcs:enable
- dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+ dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
- return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
index c5bc5f53c8e..4c8f33b3506 100644
--- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
+++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
@@ -61,7 +61,7 @@ class doc_generic_stock_odt extends ModelePDFStock
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -106,7 +106,7 @@ class doc_generic_stock_odt extends ModelePDFStock
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf, $langs;
@@ -205,7 +205,7 @@ class doc_generic_stock_odt extends ModelePDFStock
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -217,7 +217,7 @@ class doc_generic_stock_odt extends ModelePDFStock
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $stock,$langs,$conf,$mysoc,$hookmanager,$user;
@@ -357,13 +357,13 @@ class doc_generic_stock_odt extends ModelePDFStock
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
- $srctemplatepath,
- array(
- 'PATH_TO_TMP' => $conf->produit->dir_temp,
- 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
- 'DELIMITER_LEFT' => '{',
- 'DELIMITER_RIGHT' => '}'
+ $odfHandler = new odf(
+ $srctemplatepath,
+ array(
+ 'PATH_TO_TMP' => $conf->produit->dir_temp,
+ 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
+ 'DELIMITER_LEFT' => '{',
+ 'DELIMITER_RIGHT' => '}'
)
);
}
diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
index c46799b6e41..7f174149e09 100644
--- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
@@ -51,7 +51,7 @@ class pdf_standard extends ModelePDFStock
*/
public $description;
- /**
+ /**
* @var string document type
*/
public $type;
@@ -177,7 +177,7 @@ class pdf_standard extends ModelePDFStock
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -189,7 +189,7 @@ class pdf_standard extends ModelePDFStock
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
@@ -834,17 +834,17 @@ class pdf_standard extends ModelePDFStock
/**
* Show table for lines
*
- * @param TCPDF $pdf Object PDF
- * @param string $tab_top Top position of table
- * @param string $tab_height Height of table (rectangle)
- * @param int $nexY Y (not used)
- * @param Translate $outputlangs Langs object
- * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
- * @param int $hidebottom Hide bottom bar of array
- * @param string $currency Currency code
- * @return void
+ * @param TCPDF $pdf Object PDF
+ * @param string $tab_top Top position of table
+ * @param string $tab_height Height of table (rectangle)
+ * @param int $nexY Y (not used)
+ * @param Translate $outputlangs Langs object
+ * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
+ * @param int $hidebottom Hide bottom bar of array
+ * @param string $currency Currency code
+ * @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -914,8 +914,7 @@ class pdf_standard extends ModelePDFStock
if (empty($hidetop))
{
$pdf->SetXY($this->posxunit - 1, $tab_top + 1);
-$pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("EstimatedStockValueShort"), '',
- 'C');
+ $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("EstimatedStockValueShort"), '', 'C');
}
//$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
@@ -948,7 +947,7 @@ $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->tran
* @param string $titlekey Translation key to show as title of document
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
{
global $conf,$langs,$db,$hookmanager;
@@ -1176,7 +1175,7 @@ $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->tran
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
index 495dd3a6ef8..563c2ea1011 100644
--- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
@@ -179,7 +179,7 @@ class pdf_stdmovement extends ModelePDFMovement
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -191,7 +191,7 @@ class pdf_stdmovement extends ModelePDFMovement
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
@@ -203,9 +203,9 @@ class pdf_stdmovement extends ModelePDFMovement
// Load traductions files requiredby by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries"));
- /**
- * TODO: get from object
- */
+ /**
+ * TODO: get from object
+ */
$id=GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@@ -327,9 +327,9 @@ class pdf_stdmovement extends ModelePDFMovement
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
- /*
- * END TODO
- **/
+ /*
+ * END TODO
+ **/
//$nblignes = count($object->lines);
@@ -822,7 +822,7 @@ class pdf_stdmovement extends ModelePDFMovement
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -948,7 +948,7 @@ class pdf_stdmovement extends ModelePDFMovement
* @param string $titlekey Translation key to show as title of document
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
{
global $conf,$langs,$db,$hookmanager;
@@ -1168,15 +1168,15 @@ class pdf_stdmovement extends ModelePDFMovement
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param TCPDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
+ * @param TCPDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/stock/modules_movement.php b/htdocs/core/modules/stock/modules_movement.php
index b6298fa6cc9..76548664524 100644
--- a/htdocs/core/modules/stock/modules_movement.php
+++ b/htdocs/core/modules/stock/modules_movement.php
@@ -36,7 +36,7 @@ abstract class ModelePDFMovement extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -44,7 +44,7 @@ abstract class ModelePDFMovement extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php
index c7d564ef082..a60437cd38a 100644
--- a/htdocs/core/modules/stock/modules_stock.php
+++ b/htdocs/core/modules/stock/modules_stock.php
@@ -19,25 +19,25 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/**
- * Parent class for stock models of doc generators
+ * Parent class for stock models of doc generators
*/
abstract class ModelePDFStock extends CommonDocGenerator
{
/**
- * @var string Error code (or message)
- */
- public $error='';
+ * @var string Error code (or message)
+ */
+ public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
index 46707dfaa14..8302db4ab31 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
@@ -33,11 +33,11 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturef
*/
class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
{
- /**
+ /**
* Dolibarr version of the loaded document
* @public string
*/
- public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* @var string Error code (or message)
@@ -64,24 +64,24 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
- * Return description of numbering model
+ * Return description of numbering model
*
* @return string Text with description
*/
- function info()
+ public function info()
{
- global $langs;
- $langs->load("bills");
- return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);
+ global $langs;
+ $langs->load("bills");
+ return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);
}
/**
- * Returns a numbering example
+ * Returns a numbering example
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefixinvoice."1301-0001";
}
@@ -92,7 +92,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -164,13 +164,13 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Return next value
- *
- * @param Societe $objsoc Object third party
- * @param Object $object Object invoice
+ *
+ * @param Societe $objsoc Object third party
+ * @param Object $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value
- * @return string Value if OK, 0 if KO
+ * @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object, $mode = 'next')
+ public function getNextValue($objsoc, $object, $mode = 'next')
{
global $db,$conf;
@@ -236,14 +236,14 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
- * Return next free value
- *
+ * Return next free value
+ *
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref, $mode = 'next')
+ public function getNumRef($objsoc, $objforref, $mode = 'next')
{
return $this->getNextValue($objsoc, $objforref, $mode);
}
diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
index 4e2b84edcc8..7f85cbe5bb6 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
@@ -65,9 +65,9 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
*
* @return string Description Text
*/
- function info()
+ public function info()
{
- global $conf, $langs;
+ global $conf, $langs;
// Load translation files required by the page
$langs->loadLangs(array("bills","admin"));
@@ -98,7 +98,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$texte.= ' ';
$texte.= ' ';
-
+
// Parametrage du prefix des avoirs
$texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'): ';
$texte.= ''.$form->textwithpicto(' ', $tooltip, 1, 1).' ';
@@ -129,7 +129,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -153,7 +153,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object, $mode = 'next')
+ public function getNextValue($objsoc, $object, $mode = 'next')
{
global $db,$conf;
@@ -182,18 +182,18 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$numFinal=get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date);
return $numFinal;
- }
+ }
/**
- * Return next free value
- *
- * @param Societe $objsoc Object third party
- * @param string $objforref Object for number to search
- * @param string $mode 'next' for next value or 'last' for last value
- * @return string Next free value
+ * Return next free value
+ *
+ * @param Societe $objsoc Object third party
+ * @param string $objforref Object for number to search
+ * @param string $mode 'next' for next value or 'last' for last value
+ * @return string Next free value
*/
- function getNumRef($objsoc, $objforref, $mode = 'next')
- {
- return $this->getNextValue($objsoc, $objforref, $mode);
- }
+ public function getNumRef($objsoc, $objforref, $mode = 'next')
+ {
+ return $this->getNextValue($objsoc, $objforref, $mode);
+ }
}
diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
index 593d4f9d51a..6949ae3924f 100644
--- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
+++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php
@@ -40,7 +40,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
*
@@ -48,7 +48,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -77,7 +77,7 @@ abstract class ModeleNumRefSuppliersInvoices
*
* @return boolean true if model can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -86,7 +86,7 @@ abstract class ModeleNumRefSuppliersInvoices
*
* @return string Description Text
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("invoices");
@@ -97,7 +97,7 @@ abstract class ModeleNumRefSuppliersInvoices
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("invoices");
@@ -108,7 +108,7 @@ abstract class ModeleNumRefSuppliersInvoices
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -120,18 +120,18 @@ abstract class ModeleNumRefSuppliersInvoices
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object, $mode)
- {
+ public function getNextValue($objsoc, $object, $mode)
+ {
global $langs;
return $langs->trans("NotAvailable");
- }
+ }
/** Returns version of the model numbering
*
* @return string Value
*/
- function getVersion()
- {
+ public function getVersion()
+ {
global $langs;
$langs->load("admin");
@@ -140,5 +140,5 @@ abstract class ModeleNumRefSuppliersInvoices
if ($this->version == 'dolibarr') return DOL_VERSION;
if ($this->version) return $this->version;
return $langs->trans("NotAvailable");
- }
+ }
}
diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index 2d2164ebeb1..7e3f7c68c88 100644
--- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -117,8 +117,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
+ public function __construct($db)
+ {
global $conf, $langs, $mysoc;
// Load translation files required by the page
@@ -180,10 +180,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->localtax2=array();
$this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -195,8 +195,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager,$nblignes;
@@ -608,9 +608,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->error=$langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR");
return 0;
}
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -621,7 +621,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -832,7 +832,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -932,17 +932,17 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
*
- * @param PDF $pdf Object PDF
- * @param FactureFournisseur $object Object invoice
- * @param int $posy Position y in PDF
- * @param Translate $outputlangs Object langs for output
- * @return int <0 if KO, >0 if OK
+ * @param PDF $pdf Object PDF
+ * @param FactureFournisseur $object Object invoice
+ * @param int $posy Position y in PDF
+ * @param Translate $outputlangs Object langs for output
+ * @return int <0 if KO, >0 if OK
*/
- function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -1028,13 +1028,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Show top header of page.
*
- * @param PDF $pdf Object PDF
- * @param FactureFournisseur $object Object to show
- * @param int $showaddress 0=no, 1=yes
- * @param Translate $outputlangs Object lang for output
- * @return void
+ * @param PDF $pdf Object PDF
+ * @param FactureFournisseur $object Object to show
+ * @param int $showaddress 0=no, 1=yes
+ * @param Translate $outputlangs Object lang for output
+ * @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
@@ -1238,19 +1238,19 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
return $top_shift;
}
- /**
- * Show footer of page. Need this->emetteur object
+ /**
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param FactureFournisseur $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
- */
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
- {
- global $conf;
- $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
- return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
- }
+ * @param PDF $pdf PDF
+ * @param FactureFournisseur $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
+ */
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ {
+ global $conf;
+ $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
+ return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
+ }
}
diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
index 4fb3f4b2e9d..6f0cb59ca89 100644
--- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
+++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
@@ -60,7 +60,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $conf;
@@ -72,7 +72,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -84,7 +84,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -96,7 +96,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -132,7 +132,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
* @param Object $object Object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc = 0, $object = '')
+ public function getNextValue($objsoc = 0, $object = '')
{
global $db,$conf;
@@ -163,7 +163,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la reference de commande suivante non utilisee
*
@@ -171,7 +171,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
* @param Object $object Object
* @return string Texte descripif
*/
- function commande_get_num($objsoc = 0, $object = '')
+ public function commande_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php
index 556ca56d2db..320c33dce7d 100644
--- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php
+++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php
@@ -61,7 +61,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $db, $conf, $langs;
@@ -102,7 +102,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -125,7 +125,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
* @param Object $object Object
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc = 0, $object = '')
+ public function getNextValue($objsoc = 0, $object = '')
{
global $db,$conf;
@@ -146,7 +146,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la reference de commande suivante non utilisee
*
@@ -154,7 +154,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
* @param Object $object Object
* @return string Texte descripif
*/
- function commande_get_num($objsoc = 0, $object = '')
+ public function commande_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php
index b462814f624..e7cba73672d 100644
--- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php
+++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php
@@ -43,7 +43,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
*
@@ -51,7 +51,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -82,7 +82,7 @@ abstract class ModeleNumRefSuppliersOrders
*
* @return boolean true if model can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -91,7 +91,7 @@ abstract class ModeleNumRefSuppliersOrders
*
* @return string Description Text
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("orders");
@@ -102,7 +102,7 @@ abstract class ModeleNumRefSuppliersOrders
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("orders");
@@ -113,7 +113,7 @@ abstract class ModeleNumRefSuppliersOrders
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -122,7 +122,7 @@ abstract class ModeleNumRefSuppliersOrders
*
* @return string Valeur
*/
- function getNextValue()
+ public function getNextValue()
{
global $langs;
return $langs->trans("NotAvailable");
@@ -132,7 +132,7 @@ abstract class ModeleNumRefSuppliersOrders
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
index a95440ad42f..0cc9d4f6af3 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -120,7 +120,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -197,7 +197,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -209,7 +209,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$hookmanager,$mysoc,$nblignes;
@@ -708,7 +708,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
*
@@ -718,13 +718,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
- function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -734,7 +734,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Langs object
* @return integer
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -789,7 +789,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
return $posy;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -800,7 +800,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -1017,7 +1017,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1126,7 +1126,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
@@ -1363,15 +1363,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
/**
- * Show footer of page. Need this->emetteur object
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param CommandeFournisseur $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
+ * @param PDF $pdf PDF
+ * @param CommandeFournisseur $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
index 87b4791524e..cb52a14f721 100644
--- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
@@ -117,7 +117,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -176,7 +176,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -188,7 +188,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
@@ -517,7 +517,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -527,7 +527,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_cheque(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_cheque(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -590,7 +590,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf,$mysoc;
@@ -631,7 +631,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
@@ -810,7 +810,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php
index a947573dd1a..c1f6e003d6d 100644
--- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php
+++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php
@@ -59,7 +59,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -99,7 +99,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -122,7 +122,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -143,7 +143,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -151,7 +151,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function commande_get_num($objsoc, $objforref)
+ public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php
index 5ab0909e720..e071f8d5505 100644
--- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php
+++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php
@@ -60,7 +60,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -72,7 +72,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -84,7 +84,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -119,7 +119,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $db,$conf;
@@ -155,7 +155,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
@@ -163,7 +163,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
* @param string $objforref Object for number to search
* @return string Next free value
*/
- function payment_get_num($objsoc, $objforref)
+ public function payment_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
index f8afdeea063..a3f7495efb5 100644
--- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
+++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
@@ -28,7 +28,7 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation models
*
@@ -36,7 +36,7 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -68,7 +68,7 @@ abstract class ModeleNumRefSupplierPayments
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -78,7 +78,7 @@ abstract class ModeleNumRefSupplierPayments
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("bills");
@@ -90,7 +90,7 @@ abstract class ModeleNumRefSupplierPayments
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("bills");
@@ -102,7 +102,7 @@ abstract class ModeleNumRefSupplierPayments
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -114,7 +114,7 @@ abstract class ModeleNumRefSupplierPayments
* @param Object $object Object we need next value for
* @return string Valeur
*/
- function getNextValue($objsoc, $object)
+ public function getNextValue($objsoc, $object)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -125,15 +125,15 @@ abstract class ModeleNumRefSupplierPayments
*
* @return string Value
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
+ elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ elseif ($this->version == 'dolibarr') return DOL_VERSION;
+ elseif ($this->version) return $this->version;
return $langs->trans("NotAvailable");
}
}
diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
index 27163ac32db..d2dffce83c4 100644
--- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
@@ -62,7 +62,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -107,7 +107,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf, $langs;
@@ -221,7 +221,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -233,7 +233,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
index faad9b8d66a..e5759d9ff6d 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
@@ -193,7 +193,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->atleastonediscount=0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -205,7 +205,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
@@ -704,7 +704,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
*
@@ -714,13 +714,13 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
- function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@@ -730,7 +730,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Langs object
* @return void
*/
- function _tableau_info(&$pdf, $object, $posy, $outputlangs)
+ private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@@ -888,7 +888,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
*
@@ -899,7 +899,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
- function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
+ private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@@ -1174,7 +1174,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param string $currency Currency code
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@@ -1283,7 +1283,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Object lang for output
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
@@ -1491,16 +1491,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
return $top_shift;
}
- /**
- * Show footer of page. Need this->emetteur object
+ /**
+ * Show footer of page. Need this->emetteur object
*
- * @param PDF $pdf PDF
- * @param Object $object Object to show
- * @param Translate $outputlangs Object lang for output
- * @param int $hidefreetext 1=Hide free text
- * @return int Return height of bottom margin including footer text
- */
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ * @param PDF $pdf PDF
+ * @param Object $object Object to show
+ * @param Translate $outputlangs Object lang for output
+ * @param int $hidefreetext 1=Hide free text
+ * @return int Return height of bottom margin including footer text
+ */
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
index 7e80c009388..21c2a68e629 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php
@@ -62,7 +62,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
*
* @return string Text with description
*/
- function info()
+ public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
@@ -74,7 +74,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefix."0501-0001";
}
@@ -86,7 +86,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -124,7 +124,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
* @param Propal $supplier_proposal Object commercial proposal
* @return string Next value
*/
- function getNextValue($objsoc, $supplier_proposal)
+ public function getNextValue($objsoc, $supplier_proposal)
{
global $db,$conf;
@@ -165,7 +165,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
* @param Object $objforref Object for number to search
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref)
+ public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
index 5ae686f3542..f8cd365d5a7 100644
--- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
+++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php
@@ -62,7 +62,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $conf, $langs;
@@ -102,7 +102,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $conf,$langs,$mysoc;
@@ -125,7 +125,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
* @param Propal $supplier_proposal Object supplier_proposal
* @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $supplier_proposal)
+ public function getNextValue($objsoc, $supplier_proposal)
{
global $db,$conf;
diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
index 8b09d011da4..a7c12a9aeed 100644
--- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
+++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php
@@ -42,7 +42,7 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -50,7 +50,7 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
@@ -81,7 +81,7 @@ abstract class ModeleNumRefSupplierProposal
*
* @return boolean true if module can be used
*/
- function isEnabled()
+ public function isEnabled()
{
return true;
}
@@ -91,7 +91,7 @@ abstract class ModeleNumRefSupplierProposal
*
* @return string Texte descripif
*/
- function info()
+ public function info()
{
global $langs;
$langs->load("supplier_proposal");
@@ -103,7 +103,7 @@ abstract class ModeleNumRefSupplierProposal
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
global $langs;
$langs->load("supplier_proposal");
@@ -116,7 +116,7 @@ abstract class ModeleNumRefSupplierProposal
*
* @return boolean false si conflit, true si ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
return true;
}
@@ -128,7 +128,7 @@ abstract class ModeleNumRefSupplierProposal
* @param Propal $propal Object commercial proposal
* @return string Valeur
*/
- function getNextValue($objsoc, $propal)
+ public function getNextValue($objsoc, $propal)
{
global $langs;
return $langs->trans("NotAvailable");
@@ -139,7 +139,7 @@ abstract class ModeleNumRefSupplierProposal
*
* @return string Valeur
*/
- function getVersion()
+ public function getVersion()
{
global $langs;
$langs->load("admin");
diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
index b58c327e1bc..80e95037d24 100644
--- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
+++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
@@ -59,7 +59,7 @@ class doc_generic_user_odt extends ModelePDFUser
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -104,7 +104,7 @@ class doc_generic_user_odt extends ModelePDFUser
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf, $langs;
@@ -203,9 +203,9 @@ class doc_generic_user_odt extends ModelePDFUser
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Function to build a document on disk using the generic odt module.
+ * Function to build a document on disk using the generic odt module.
*
* @param User $object Object source to build document
* @param Translate $outputlangs Lang output object
@@ -215,7 +215,7 @@ class doc_generic_user_odt extends ModelePDFUser
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
@@ -330,7 +330,7 @@ class doc_generic_user_odt extends ModelePDFUser
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->user->dir_temp,
@@ -439,7 +439,7 @@ class doc_generic_user_odt extends ModelePDFUser
return -1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get substitution array for object
*
@@ -448,7 +448,7 @@ class doc_generic_user_odt extends ModelePDFUser
* @param string $array_key key for array
* @return array array of substitutions
*/
- function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
+ public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{
// phpcs:enable
$array_other = array();
diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php
index 7add1cf99d1..bdd04f1c097 100644
--- a/htdocs/core/modules/user/modules_user.class.php
+++ b/htdocs/core/modules/user/modules_user.class.php
@@ -44,7 +44,7 @@ abstract class ModelePDFUser extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -52,7 +52,7 @@ abstract class ModelePDFUser extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
- static function liste_modeles($db, $maxfilenamelength = 0)
+ public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
index 2dfd2cfcfee..0840f40a868 100644
--- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
+++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
@@ -62,7 +62,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -107,7 +107,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -206,7 +206,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -218,7 +218,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
@@ -353,7 +353,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->user->dir_temp,
@@ -527,6 +527,6 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
}
}
- return -1;
- }
+ return -1;
+ }
}
diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php
index 2bd717624d7..6259366aeed 100644
--- a/htdocs/core/modules/usergroup/modules_usergroup.class.php
+++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php
@@ -38,30 +38,30 @@
*/
abstract class ModelePDFUserGroup extends CommonDocGenerator
{
- /**
- * @var string Error code (or message)
- */
- public $error='';
-
-
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
- * Return list of active generation modules
- *
+ * @var string Error code (or message)
+ */
+ public $error='';
+
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
- */
- static function liste_modeles($db, $maxfilenamelength = 0)
- {
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- $type = 'group';
- $list = array();
+ $type = 'group';
+ $list = array();
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $list = getListOfModels($db, $type, $maxfilenamelength);
- return $list;
- }
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $list = getListOfModels($db, $type, $maxfilenamelength);
+ return $list;
+ }
}
diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php
index ac7ee20139a..493c7b65295 100644
--- a/htdocs/core/tpl/admin_extrafields_view.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php
@@ -1,7 +1,7 @@
* Copyright (C) 2012-2017 Regis Houssin
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2019 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -96,7 +96,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
if (! empty($conf->multicompany->enabled)) {
print ''.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).' ';
}
- print ''.img_edit().' ';
+ print ''.img_edit().' ';
print " ".img_delete()." \n";
print " ";
}
diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php
index a66eb12c78e..19518b60e6c 100644
--- a/htdocs/core/triggers/dolibarrtriggers.class.php
+++ b/htdocs/core/triggers/dolibarrtriggers.class.php
@@ -134,16 +134,16 @@ abstract class DolibarrTriggers
}
}
- /**
- * Function called when a Dolibarrr business event is done.
- * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
- *
- * @param string $action Event action code
- * @param Object $object Object
- * @param User $user Object user
- * @param Translate $langs Object langs
- * @param conf $conf Object conf
- * @return int <0 if KO, 0 if no triggered ran, >0 if OK
- */
- abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf);
+ /**
+ * Function called when a Dolibarrr business event is done.
+ * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
+ *
+ * @param string $action Event action code
+ * @param Object $object Object
+ * @param User $user Object user
+ * @param Translate $langs Object langs
+ * @param conf $conf Object conf
+ * @return int <0 if KO, 0 if no triggered ran, >0 if OK
+ */
+ public abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf);
}
diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
index 8570eaba8d1..ec195030448 100644
--- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
+++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
@@ -96,7 +96,7 @@ class InterfaceNotification extends DolibarrTriggers
*
* @return array Array of events managed by notification module
*/
- function getListOfManagedEvents()
+ public function getListOfManagedEvents()
{
global $conf;
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index b4289f60f36..1f22e7b910c 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -108,7 +108,7 @@ class Cronjob extends CommonObject
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -121,7 +121,7 @@ class Cronjob extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @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;
$error=0;
@@ -302,7 +302,7 @@ class Cronjob extends CommonObject
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
$sql = "SELECT";
$sql.= " t.rowid,";
@@ -393,7 +393,7 @@ class Cronjob extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load object in memory from the database
*
@@ -406,7 +406,7 @@ class Cronjob extends CommonObject
* @param int $processing Processing or not
* @return int <0 if KO, >0 if OK
*/
- function fetch_all($sortorder = 'DESC', $sortfield = 't.rowid', $limit = 0, $offset = 0, $status = 1, $filter = '', $processing = -1)
+ public function fetch_all($sortorder = 'DESC', $sortfield = 't.rowid', $limit = 0, $offset = 0, $status = 1, $filter = '', $processing = -1)
{
// phpcs:enable
global $langs;
@@ -541,7 +541,7 @@ class Cronjob extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
@@ -691,37 +691,21 @@ class Cronjob extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
$error=0;
$this->db->begin();
-// if (! $error)
-// {
-// if (! $notrigger)
-// {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action calls a trigger.
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
+ $sql.= " WHERE rowid=".$this->id;
- //// Call triggers
- //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- //$interface=new Interfaces($this->db);
- //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
- //if ($result < 0) { $error++; $this->errors=$interface->errors; }
- //// End call triggers
-// }
-// }
-
-// if (! $error)
-// {
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
- $sql.= " WHERE rowid=".$this->id;
-
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
- $resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
-// }
+ dol_syslog(get_class($this)."::delete", LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if (! $resql) {
+ $error++;
+ $this->errors[]="Error ".$this->db->lasterror();
+ }
// Commit or rollback
if ($error)
@@ -749,7 +733,7 @@ class Cronjob extends CommonObject
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
- function createFromClone($fromid)
+ public function createFromClone($fromid)
{
global $user,$langs;
@@ -805,7 +789,7 @@ class Cronjob extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
$this->ref=0;
@@ -852,7 +836,7 @@ class Cronjob extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -909,7 +893,7 @@ class Cronjob extends CommonObject
*
* @return int
*/
- function info()
+ public function info()
{
$sql = "SELECT";
$sql.= " f.rowid, f.datec, f.tms, f.fk_user_mod, f.fk_user_author";
@@ -941,7 +925,7 @@ class Cronjob extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Run a job.
* Once job is finished, status and nb of run is updated.
@@ -950,7 +934,7 @@ class Cronjob extends CommonObject
* @param string $userlogin User login
* @return int <0 if KO, >0 if OK
*/
- function run_jobs($userlogin)
+ public function run_jobs($userlogin)
{
// phpcs:enable
global $langs, $conf, $hookmanager;
@@ -1127,8 +1111,7 @@ class Cronjob extends CommonObject
}
}
- if($this->jobtype == 'function')
- {
+ if ($this->jobtype == 'function') {
//load lib
$libpath = '/' . strtolower($this->module_name) . '/lib/' . $this->libname;
$ret = dol_include_once($libpath);
@@ -1219,7 +1202,7 @@ class Cronjob extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Reprogram a job
*
@@ -1227,7 +1210,7 @@ class Cronjob extends CommonObject
* @param timestamp $now Date returned by dol_now()
* @return int <0 if KO, >0 if OK
*/
- function reprogram_jobs($userlogin, $now)
+ public function reprogram_jobs($userlogin, $now)
{
// phpcs:enable
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
@@ -1303,12 +1286,12 @@ class Cronjob extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode, $this->processing);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -1317,7 +1300,7 @@ class Cronjob extends CommonObject
* @param int $processing 0=Not running, 1=Running
* @return string Label of status
*/
- function LibStatut($status, $mode = 0, $processing = 0)
+ public function LibStatut($status, $mode = 0, $processing = 0)
{
// phpcs:enable
global $langs;
@@ -1351,12 +1334,12 @@ class Cronjob extends CommonObject
if ($status == 1) return img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"').' '.$langs->trans('Enabled').$moretext;
elseif ($status == 0) return img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled').$moretext;
}
- elseif ($mode == 5)
- {
- if ($status == 1) return $langs->trans('Enabled').$moretext.' '.img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"');
- elseif ($status == 0) return $langs->trans('Disabled').$moretext.' '.img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"');
- }
- }
+ elseif ($mode == 5)
+ {
+ if ($status == 1) return $langs->trans('Enabled').$moretext.' '.img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"');
+ elseif ($status == 0) return $langs->trans('Disabled').$moretext.' '.img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"');
+ }
+ }
}
@@ -1425,7 +1408,7 @@ class Cronjobline
* Constructor
*
*/
- function __construct()
+ public function __construct()
{
return 1;
}
diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php
index 7362542e8d6..e336e8d6df6 100644
--- a/htdocs/datapolicy/class/actions_datapolicy.class.php
+++ b/htdocs/datapolicy/class/actions_datapolicy.class.php
@@ -72,7 +72,7 @@ class ActionsDatapolicy
* =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions.
*/
- function getNomUrl($parameters, &$object, &$action)
+ public function getNomUrl($parameters, &$object, &$action)
{
global $db, $langs, $conf, $user;
$this->resprints = '';
@@ -300,7 +300,7 @@ class ActionsDatapolicy
* =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions.
*/
- function beforePDFCreation($parameters, &$object, &$action)
+ public function beforePDFCreation($parameters, &$object, &$action)
{
global $conf, $user, $langs;
global $hookmanager;
@@ -329,7 +329,7 @@ class ActionsDatapolicy
* @param HookManager $hookmanager Hook manager
* @return void
*/
- function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
+ public function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
{
global $conf, $user, $langs;
$langs->load('datapolicy@datapolicy');
@@ -388,7 +388,7 @@ class ActionsDatapolicy
* @param HookManager $hookmanager Hook manager
* @return void
*/
- function printCommonFooter($parameters, &$object, &$action, $hookmanager)
+ public function printCommonFooter($parameters, &$object, &$action, $hookmanager)
{
global $conf, $user, $langs;
diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php
index 01953fba0ee..ea720e0586f 100644
--- a/htdocs/datapolicy/class/datapolicy.class.php
+++ b/htdocs/datapolicy/class/datapolicy.class.php
@@ -35,7 +35,7 @@ Class DataPolicy
*
* @return number
*/
- function getAllContactNotInformed()
+ public function getAllContactNotInformed()
{
global $langs, $conf, $db, $user;
@@ -71,7 +71,7 @@ Class DataPolicy
*
* @return number
*/
- function getAllCompaniesNotInformed()
+ public function getAllCompaniesNotInformed()
{
global $langs, $conf, $db, $user;
@@ -106,7 +106,7 @@ Class DataPolicy
*
* @return number
*/
- function getAllAdherentsNotInformed()
+ public function getAllAdherentsNotInformed()
{
global $langs, $conf, $db, $user;
@@ -142,73 +142,73 @@ Class DataPolicy
* @param mixed $contact Contact
* @return void
*/
- function sendMailDataPolicyContact($contact)
+ public function sendMailDataPolicyContact($contact)
{
- global $langs, $conf, $db, $user;
+ global $langs, $conf, $db, $user;
- $error = 0;
+ $error = 0;
- $from = $user->getFullName($langs) . ' <' . $user->email . '>';
+ $from = $user->getFullName($langs) . ' <' . $user->email . '>';
- $sendto = $contact->email;
- $code= md5($contact->email);
- if (!empty($contact->default_lang)) {
- $l = $contact->default_lang;
- } else {
- $l = $langs->defaultlang;
- }
- $s = "DATAPOLICIESSUBJECT_" . $l;
- $ma = "DATAPOLICIESCONTENT_" . $l;
- $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l;
- $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l;
+ $sendto = $contact->email;
+ $code= md5($contact->email);
+ if (!empty($contact->default_lang)) {
+ $l = $contact->default_lang;
+ } else {
+ $l = $langs->defaultlang;
+ }
+ $s = "DATAPOLICIESSUBJECT_" . $l;
+ $ma = "DATAPOLICIESCONTENT_" . $l;
+ $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l;
+ $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l;
- $subject = $conf->global->$s;
- $message = $conf->global->$ma;
- $linka = $conf->global->$la;
- $linkr = $conf->global->$lr;
- $sendtocc = $sendtobcc = '';
- $filepath = $mimetype = $filename = array();
- $deliveryreceipt = 0;
+ $subject = $conf->global->$s;
+ $message = $conf->global->$ma;
+ $linka = $conf->global->$la;
+ $linkr = $conf->global->$lr;
+ $sendtocc = $sendtobcc = '';
+ $filepath = $mimetype = $filename = array();
+ $deliveryreceipt = 0;
- $substitutionarray = array(
- '__LINKACCEPT__' => ''.$linka.' ',
- '__LINKREFUSED__' => ''.$linkr.' ',
- '__FIRSTNAME__' => $contact->firstname,
- '__NAME__' => $contact->lastname,
- '__CIVILITY__' => $contact->civility,
- );
- $subject = make_substitutions($subject, $substitutionarray);
- $message = make_substitutions($message, $substitutionarray);
+ $substitutionarray = array(
+ '__LINKACCEPT__' => ''.$linka.' ',
+ '__LINKREFUSED__' => ''.$linkr.' ',
+ '__FIRSTNAME__' => $contact->firstname,
+ '__NAME__' => $contact->lastname,
+ '__CIVILITY__' => $contact->civility,
+ );
+ $subject = make_substitutions($subject, $substitutionarray);
+ $message = make_substitutions($message, $substitutionarray);
- $actiontypecode = 'AC_EMAIL';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc)
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
+ $actiontypecode = 'AC_EMAIL';
+ $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
+ if ($message) {
+ if ($sendtocc)
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
+ $actionmsg = dol_concatdesc($actionmsg, $message);
+ }
- // Send mail
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
+ // Send mail
+ require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
+ $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
- if ($mailfile->error) {
- $resultmasssend .= '' . $mailfile->error . '
';
- } else {
- $result4 = $mailfile->sendfile();
- if (!$error) {
+ if ($mailfile->error) {
+ $resultmasssend .= '' . $mailfile->error . '
';
+ } else {
+ $result4 = $mailfile->sendfile();
+ if (!$error) {
- $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . " ";
- $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
- $contact->update($contact->id);
- } else {
- dol_print_error($db);
- }
- }
- setEventMessage($resultmasssend);
+ $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . " ";
+ $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
+ $contact->update($contact->id);
+ } else {
+ dol_print_error($db);
+ }
+ }
+ setEventMessage($resultmasssend);
}
/**
@@ -217,7 +217,7 @@ Class DataPolicy
* @param Societe $societe Object societe
* @return void
*/
- function sendMailDataPolicyCompany($societe)
+ public function sendMailDataPolicyCompany($societe)
{
global $langs, $conf, $db, $user;
@@ -291,7 +291,7 @@ Class DataPolicy
* @param Adherent $adherent Member
* @return void
*/
- function sendMailDataPolicyAdherent($adherent)
+ public function sendMailDataPolicyAdherent($adherent)
{
global $langs, $conf, $db, $user;
diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php
index 226fdf48c94..eea023951e3 100644
--- a/htdocs/dav/dav.class.php
+++ b/htdocs/dav/dav.class.php
@@ -41,7 +41,7 @@ class CdavLib
* @param DoliDB $db Database handler
* @param Translate $langs translation
*/
- function __construct($user, $db, $langs)
+ public function __construct($user, $db, $langs)
{
$this->user = $user;
$this->db = $db;
@@ -245,15 +245,15 @@ class CdavLib
return $caldata;
}
- /**
- * getFullCalendarObjects
- *
- * @param int $calendarId Calendar id
- * @param int $bCalendarData Add calendar data
- * @return array|string[][]
- */
- public function getFullCalendarObjects($calendarId, $bCalendarData)
- {
+ /**
+ * getFullCalendarObjects
+ *
+ * @param int $calendarId Calendar id
+ * @param int $bCalendarData Add calendar data
+ * @return array|string[][]
+ */
+ public function getFullCalendarObjects($calendarId, $bCalendarData)
+ {
$calid = ($calendarId*1);
$calevents = array();
diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php
index de854ce806d..06ddd5616c0 100644
--- a/htdocs/don/class/api_donations.class.php
+++ b/htdocs/don/class/api_donations.class.php
@@ -44,10 +44,10 @@ class Donations extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
- global $db, $conf;
- $this->db = $db;
+ global $db, $conf;
+ $this->db = $db;
$this->don = new Don($this->db);
}
@@ -61,7 +61,7 @@ class Donations extends DolibarrApi
*
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
if(! DolibarrApiAccess::$user->rights->don->lire) {
throw new RestException(401);
@@ -99,7 +99,7 @@ class Donations extends DolibarrApi
*
* @throws RestException
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf;
@@ -115,7 +115,7 @@ class Donations extends DolibarrApi
$sql.= ' WHERE t.entity IN ('.getEntity('don').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) ) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($thirdparty_ids) $sql.= " AND t.fk_soc = ".$thirdparty_ids." ";
-
+
// Add sql filters
if ($sqlfilters)
{
@@ -140,7 +140,7 @@ class Donations extends DolibarrApi
dol_syslog("API Rest request");
$result = $db->query($sql);
-
+
if ($result)
{
$num = $db->num_rows($result);
@@ -164,7 +164,7 @@ class Donations extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No donation found');
}
-
+
return $obj_ret;
}
@@ -174,15 +174,15 @@ class Donations extends DolibarrApi
* @param array $request_data Request data
* @return int ID of order
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->don->creer) {
+ if (! DolibarrApiAccess::$user->rights->don->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
$this->don->$field = $value;
}
/*if (isset($request_data["lines"])) {
@@ -208,7 +208,7 @@ class Donations extends DolibarrApi
*
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->don->creer) {
throw new RestException(401);
@@ -222,7 +222,7 @@ class Donations extends DolibarrApi
if (! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
$this->don->$field = $value;
}
@@ -243,7 +243,7 @@ class Donations extends DolibarrApi
* @param int $id Order ID
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->don->supprimer) {
throw new RestException(401);
@@ -291,7 +291,7 @@ class Donations extends DolibarrApi
*
* @return array
*/
- function validate($id, $idwarehouse = 0, $notrigger = 0)
+ public function validate($id, $idwarehouse = 0, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->don->creer) {
throw new RestException(401);
@@ -332,7 +332,7 @@ class Donations extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -354,7 +354,7 @@ class Donations extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$don = array();
foreach (Orders::$FIELDS as $field) {
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index f361299f83a..834f16c7737 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -6,6 +6,7 @@
* Copyright (C) 2015-2017 Alexandre Spangaro
* Copyright (C) 2016 Juanjo Menent
* Copyright (C) 2019 Thibault FOUCART
+ * Copyright (C) 2019 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -103,7 +104,7 @@ class Don extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -115,12 +116,12 @@ class Don extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -128,7 +129,7 @@ class Don extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
- function LibStatut($statut, $mode = 0)
+ public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
if (empty($this->labelstatut) || empty($this->labelstatutshort))
@@ -198,7 +199,7 @@ class Don extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $conf, $user,$langs;
@@ -257,7 +258,7 @@ class Don extends CommonObject
* @param int $minimum Minimum
* @return int 0 if KO, >0 if OK
*/
- function check($minimum = 0)
+ public function check($minimum = 0)
{
global $langs;
$langs->load('main');
@@ -350,7 +351,7 @@ class Don extends CommonObject
* @return int <0 if KO, id of created donation if OK
* TODO add numbering module for Ref
*/
- function create($user, $notrigger = 0)
+ public function create($user, $notrigger = 0)
{
global $conf, $langs;
@@ -429,7 +430,7 @@ class Don extends CommonObject
// End call triggers
}
}
- else
+ else
{
$this->error = $this->db->lasterror();
$this->errno = $this->db->lasterrno();
@@ -473,7 +474,7 @@ class Don extends CommonObject
* @param int $notrigger Disable triggers
* @return int >0 if OK, <0 if KO
*/
- function update($user, $notrigger = 0)
+ public function update($user, $notrigger = 0)
{
global $langs, $conf;
@@ -564,7 +565,7 @@ class Don extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, 0 if not possible, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $user, $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@@ -639,7 +640,7 @@ class Don extends CommonObject
* @param string $ref Ref of donation to load
* @return int <0 if KO, >0 if OK
*/
- function fetch($id, $ref = '')
+ public function fetch($id, $ref = '')
{
global $conf;
@@ -729,12 +730,12 @@ class Don extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
- function setValid($user, $notrigger = 0)
+ public function setValid($user, $notrigger = 0)
{
return $this->valid_promesse($this->id, $user->id, $notrigger);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Validate a promise of donation
*
@@ -743,7 +744,7 @@ class Don extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function valid_promesse($id, $userid, $notrigger = 0)
+ public function valid_promesse($id, $userid, $notrigger = 0)
{
// phpcs:enable
global $langs, $user;
@@ -786,7 +787,7 @@ class Don extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the donation as paid, the donation was received
*
@@ -794,7 +795,7 @@ class Don extends CommonObject
* @param int $modepayment mode of payment
* @return int <0 if KO, >0 if OK
*/
- function set_paid($id, $modepayment = 0)
+ public function set_paid($id, $modepayment = 0)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2";
@@ -823,14 +824,14 @@ class Don extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set donation to status cancelled
*
* @param int $id id of donation
* @return int <0 if KO, >0 if OK
*/
- function set_cancel($id)
+ public function set_cancel($id)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id;
@@ -854,14 +855,14 @@ class Don extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Sum of donations
*
* @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses
* @return int Summ of donations
*/
- function sum_donations($param)
+ public function sum_donations($param)
{
// phpcs:enable
global $conf;
@@ -883,13 +884,13 @@ class Don extends CommonObject
return $result;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb pour le tableau de bord
*
* @return int <0 if KO, >0 if OK
*/
- function load_state_board()
+ public function load_state_board()
{
// phpcs:enable
global $conf;
@@ -926,7 +927,7 @@ class Don extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto = 0, $notooltip = 0)
+ public function getNomUrl($withpicto = 0, $notooltip = 0)
{
global $langs;
@@ -950,7 +951,7 @@ class Don extends CommonObject
* @param int $id Id of record
* @return void
*/
- function info($id)
+ public function info($id)
{
$sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
$sql.= ' d.tms';
diff --git a/htdocs/don/class/donstats.class.php b/htdocs/don/class/donstats.class.php
index 2418f1babfd..bf6a61bb248 100644
--- a/htdocs/don/class/donstats.class.php
+++ b/htdocs/don/class/donstats.class.php
@@ -39,12 +39,12 @@ class DonationStats extends Stats
*/
public $table_element;
- var $socid;
- var $userid;
+ public $socid;
+ public $userid;
- var $from;
- var $field;
- var $where;
+ public $from;
+ public $field;
+ public $where;
/**
@@ -55,7 +55,7 @@ class DonationStats extends Stats
* @param string $mode Option (not used)
* @param int $userid Id user for filter (creation user)
*/
- function __construct($db, $socid, $mode, $userid = 0)
+ public function __construct($db, $socid, $mode, $userid = 0)
{
global $user, $conf;
@@ -77,13 +77,13 @@ class DonationStats extends Stats
}
/**
- * Return shipment number by month for a year
+ * Return shipment number by month for a year
*
- * @param int $year Year to scan
- * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
- * @return array Array with number by month
+ * @param int $year Year to scan
+ * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
+ * @return array Array with number by month
*/
- function getNbByMonth($year, $format = 0)
+ public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -104,7 +104,7 @@ class DonationStats extends Stats
* @return array Array with number by year
*
*/
- function getNbByYear()
+ public function getNbByYear()
{
global $user;
@@ -117,21 +117,21 @@ class DonationStats extends Stats
return $this->_getNbByYear($sql);
}
- /**
- * Return nb, total and average
- *
- * @return array Array of values
- */
- function getAllByYear()
- {
- global $user;
+ /**
+ * Return nb, total and average
+ *
+ * @return array Array of values
+ */
+ public function getAllByYear()
+ {
+ global $user;
- $sql = "SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->field.") as total, AVG(".$this->field.") as avg";
- $sql.= " FROM ".$this->from;
- $sql.= " WHERE ".$this->where;
- $sql.= " GROUP BY year";
+ $sql = "SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->field.") as total, AVG(".$this->field.") as avg";
+ $sql.= " FROM ".$this->from;
+ $sql.= " WHERE ".$this->where;
+ $sql.= " GROUP BY year";
$sql.= $this->db->order('year', 'DESC');
- return $this->_getAllByYear($sql);
- }
+ return $this->_getAllByYear($sql);
+ }
}
diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php
index deec339c1cc..ac35e3f5c44 100644
--- a/htdocs/don/class/paymentdonation.class.php
+++ b/htdocs/don/class/paymentdonation.class.php
@@ -88,7 +88,7 @@ class PaymentDonation extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -101,7 +101,7 @@ class PaymentDonation extends CommonObject
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, id of payment if OK
*/
- function create($user, $notrigger = false)
+ public function create($user, $notrigger = false)
{
global $conf, $langs;
@@ -193,7 +193,7 @@ class PaymentDonation extends CommonObject
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
global $langs;
$sql = "SELECT";
@@ -264,7 +264,7 @@ class PaymentDonation extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user, $notrigger = 0)
+ public function update($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -344,7 +344,7 @@ class PaymentDonation extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -411,7 +411,7 @@ class PaymentDonation extends CommonObject
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
- function createFromClone($fromid)
+ public function createFromClone($fromid)
{
global $user,$langs;
@@ -467,12 +467,12 @@ class PaymentDonation extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -480,13 +480,13 @@ class PaymentDonation extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
- function LibStatut($statut, $mode = 0)
- {
+ public function LibStatut($statut, $mode = 0)
+ {
// phpcs:enable
global $langs;
- return '';
- }
+ return '';
+ }
/**
@@ -496,7 +496,7 @@ class PaymentDonation extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -526,7 +526,7 @@ class PaymentDonation extends CommonObject
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
- function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
+ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;
@@ -597,14 +597,14 @@ class PaymentDonation extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
- /**
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
* Update link between the donation payment and the generated line in llx_bank
*
* @param int $id_bank Id if bank
* @return int >0 if OK, <=0 if KO
*/
- function update_fk_bank($id_bank)
+ public function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
@@ -629,7 +629,7 @@ class PaymentDonation extends CommonObject
* @param int $maxlen Longueur max libelle
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto = 0, $maxlen = 0)
+ public function getNomUrl($withpicto = 0, $maxlen = 0)
{
global $langs;
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 1d2b7f34ba6..d0f4f3e6567 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -105,7 +105,7 @@ class EcmDirectory // extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
return 1;
@@ -118,7 +118,7 @@ class EcmDirectory // extends CommonObject
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
- function create($user)
+ public function create($user)
{
global $conf, $langs;
@@ -230,7 +230,7 @@ class EcmDirectory // extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
@@ -288,7 +288,7 @@ class EcmDirectory // extends CommonObject
* @param string $value '+' or '-' or new number
* @return int <0 if KO, >0 if OK
*/
- function changeNbOfFiles($value)
+ public function changeNbOfFiles($value)
{
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
@@ -320,7 +320,7 @@ class EcmDirectory // extends CommonObject
* @param int $id Id of object
* @return int <0 if KO, 0 if not found, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
$sql = "SELECT";
$sql.= " t.rowid,";
@@ -375,7 +375,7 @@ class EcmDirectory // extends CommonObject
* @param int $deletedirrecursive 1=Agree to delete content recursiveley (otherwise an error will be returned when trying to delete)
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $mode = 'all', $deletedirrecursive = 0)
+ public function delete($user, $mode = 'all', $deletedirrecursive = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -448,7 +448,7 @@ class EcmDirectory // extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -468,7 +468,7 @@ class EcmDirectory // extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto = 0, $option = '', $max = 0, $more = '', $notooltip = 0)
+ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $more = '', $notooltip = 0)
{
global $langs;
@@ -501,7 +501,7 @@ class EcmDirectory // extends CommonObject
* @param int $force Force reload of full arbo even if already loaded
* @return string Relative physical path
*/
- function getRelativePath($force = 0)
+ public function getRelativePath($force = 0)
{
$this->get_full_arbo($force);
@@ -535,13 +535,13 @@ class EcmDirectory // extends CommonObject
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load this->motherof that is array(id_son=>id_parent, ...)
*
* @return int <0 if KO, >0 if OK
*/
- function load_motherof()
+ public function load_motherof()
{
// phpcs:enable
global $conf;
@@ -579,12 +579,12 @@ class EcmDirectory // extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
*
@@ -592,7 +592,7 @@ class EcmDirectory // extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
* @return string Label of status
*/
- static function LibStatut($status, $mode = 0)
+ public static function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -600,7 +600,7 @@ class EcmDirectory // extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée
* Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec:
@@ -620,7 +620,7 @@ class EcmDirectory // extends CommonObject
* @param int $force Force reload of full arbo even if already loaded in cache $this->cats
* @return array Tableau de array
*/
- function get_full_arbo($force = 0)
+ public function get_full_arbo($force = 0)
{
// phpcs:enable
global $conf;
@@ -701,7 +701,7 @@ class EcmDirectory // extends CommonObject
return $this->cats;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs.
* Separator between directories is always '/', whatever is OS.
@@ -710,7 +710,7 @@ class EcmDirectory // extends CommonObject
* @param int $protection Deep counter to avoid infinite loop
* @return void
*/
- function build_path_from_id_categ($id_categ, $protection = 0)
+ public function build_path_from_id_categ($id_categ, $protection = 0)
{
// phpcs:enable
// Define fullpath
@@ -750,7 +750,7 @@ class EcmDirectory // extends CommonObject
* @param int $all 0=refresh record using this->id , 1=refresh record using this->entity
* @return int -1 if KO, Nb of files in directory if OK
*/
- function refreshcachenboffile($all = 0)
+ public function refreshcachenboffile($all = 0)
{
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -787,7 +787,7 @@ class EcmDirectory // extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Call trigger based on this instance
*
@@ -799,7 +799,7 @@ class EcmDirectory // extends CommonObject
* @param User $user Object user
* @return int Result of run_triggers
*/
- function call_trigger($trigger_name, $user)
+ public function call_trigger($trigger_name, $user)
{
// phpcs:enable
global $langs,$conf;
diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php
index 3b229f48c1c..4f4c8dfea61 100644
--- a/htdocs/ecm/class/ecmfiles.class.php
+++ b/htdocs/ecm/class/ecmfiles.class.php
@@ -28,8 +28,6 @@
// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
-//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
-//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/**
* Class to manage ECM files
@@ -766,7 +764,7 @@ class EcmFiles extends CommonObject
* @param string $morecss Add more css on link
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -815,12 +813,12 @@ class EcmFiles extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
*
@@ -828,7 +826,7 @@ class EcmFiles extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
* @return string Label of status
*/
- static function LibStatut($status, $mode = 0)
+ public static function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php
index 7877b85b0a5..c210d0ae2d4 100644
--- a/htdocs/ecm/class/htmlecm.form.class.php
+++ b/htdocs/ecm/class/htmlecm.form.class.php
@@ -27,15 +27,15 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
*/
class FormEcm
{
- /**
+ /**
* @var DoliDB Database handler.
*/
public $db;
-
- /**
- * @var string Error code (or message)
- */
- public $error='';
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
/**
@@ -43,7 +43,7 @@ class FormEcm
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -57,7 +57,7 @@ class FormEcm
* @param string $module Module ('ecm', 'medias', ...)
* @return string String with HTML select
*/
- function selectAllSections($selected = 0, $select_name = '', $module = 'ecm')
+ public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm')
{
global $conf, $langs;
$langs->load("ecm");
@@ -70,7 +70,7 @@ class FormEcm
$cat = new EcmDirectory($this->db);
$cate_arbo = $cat->get_full_arbo();
}
- if ($module == 'medias')
+ elseif ($module == 'medias')
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$path = $conf->medias->multidir_output[$conf->entity];
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 7a4744d789f..e0f745dabec 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -99,22 +99,22 @@ class EmailCollector extends CommonObject
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password"),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
- //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
- //'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
+ //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
+ //'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'comment'=>"Where to store messages once processed"),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1,),
'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,),
- 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1,),
- 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),
- 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,),
+ 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1,),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
- 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1,),
- //'date_validation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
- 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>510, 'notnull'=>1,),
- 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>511, 'notnull'=>-1,),
- //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
- 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1,),
- 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Inactive', '1'=>'Active'))
+ 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1,),
+ //'date_validation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
+ 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>510, 'notnull'=>1,),
+ 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>511, 'notnull'=>-1,),
+ //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
+ 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1,),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Inactive', '1'=>'Active'))
);
@@ -305,14 +305,16 @@ class EmailCollector extends CommonObject
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
- /*public function fetchLines()
- {
- $this->lines=array();
+ /*
+ public function fetchLines()
+ {
+ $this->lines=array();
- // Load lines with object EmailCollectorLine
+ // Load lines with object EmailCollectorLine
- return count($this->lines)?1:0;
- }*/
+ return count($this->lines)?1:0;
+ }
+ */
/**
* Fetch all account and load objects into an array
@@ -407,7 +409,7 @@ class EmailCollector extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -549,7 +551,7 @@ class EmailCollector extends CommonObject
*/
public function info($id)
{
- $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
+ $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql.= ' fk_user_creat, fk_user_modif';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql.= ' WHERE t.rowid = '.$id;
@@ -673,7 +675,7 @@ class EmailCollector extends CommonObject
*
* @return string
*/
- function getConnectStringIMAP()
+ public function getConnectStringIMAP()
{
// Connect to IMAP
$flags ='/service=imap'; // IMAP
diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php
index 6eec6190b71..11ccfbc858e 100644
--- a/htdocs/emailcollector/class/emailcollectoraction.class.php
+++ b/htdocs/emailcollector/class/emailcollectoraction.class.php
@@ -32,298 +32,298 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
*/
class EmailCollectorAction extends CommonObject
{
- /**
- * @var string ID to identify managed object
- */
- public $element = 'emailcollectoraction';
+ /**
+ * @var string ID to identify managed object
+ */
+ public $element = 'emailcollectoraction';
- /**
- * @var string Name of table without prefix where object is stored
- */
- public $table_element = 'emailcollector_emailcollectoraction';
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element = 'emailcollector_emailcollectoraction';
- /**
- * @var int Does emailcollectoraction support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
- */
- public $ismultientitymanaged = 0;
+ /**
+ * @var int Does emailcollectoraction support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ */
+ public $ismultientitymanaged = 0;
- /**
- * @var int Does emailcollectoraction support extrafields ? 0=No, 1=Yes
- */
- public $isextrafieldmanaged = 0;
+ /**
+ * @var int Does emailcollectoraction support extrafields ? 0=No, 1=Yes
+ */
+ public $isextrafieldmanaged = 0;
- /**
- * @var string String with name of icon for emailcollectoraction. Must be the part after the 'object_' into object_emailcollectoraction.png
- */
- public $picto = 'emailcollectoraction@emailcollector';
+ /**
+ * @var string String with name of icon for emailcollectoraction. Must be the part after the 'object_' into object_emailcollectoraction.png
+ */
+ public $picto = 'emailcollectoraction@emailcollector';
- /**
- * 'type' if the field format.
- * 'label' the translation key.
- * 'enabled' is a condition when the field must be managed.
- * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
- * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
- * 'default' is a default value for creation (can still be replaced by the global setup of default values)
- * 'index' if we want an index in database.
- * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
- * 'position' is the sort order of field.
- * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
- * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
- * 'css' is the CSS style to use on field. For example: 'maxwidth200'
- * 'help' is a string visible as a tooltip on field
- * 'comment' is not used. You can store here any text of your choice. It is not used by application.
- * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
- * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
- */
+ /**
+ * 'type' if the field format.
+ * 'label' the translation key.
+ * 'enabled' is a condition when the field must be managed.
+ * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
+ * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
+ * 'default' is a default value for creation (can still be replaced by the global setup of default values)
+ * 'index' if we want an index in database.
+ * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
+ * 'position' is the sort order of field.
+ * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
+ * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
+ * 'css' is the CSS style to use on field. For example: 'maxwidth200'
+ * 'help' is a string visible as a tooltip on field
+ * 'comment' is not used. You can store here any text of your choice. It is not used by application.
+ * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
+ * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
+ */
- // BEGIN MODULEBUILDER PROPERTIES
- /**
- * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
- */
- public $fields=array(
- 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
- 'fk_emailcollector' => array('type'=>'integer', 'label'=>'Id of emailcollector', 'foreignkey'=>'emailcollector.rowid'),
- 'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1),
- 'actionparam' => array('type'=>'varchar(255)', 'label'=>'ParamForAction', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>-1),
- 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
- 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
- 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
- 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
- 'position' => array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>1, 'position'=>600, 'default'=>'0',),
- 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
- 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled')),
- );
- public $rowid;
- public $fk_emailcollector;
- public $type;
- public $actionparam;
- public $date_creation;
- public $tms;
- public $fk_user_creat;
- public $fk_user_modif;
- public $position;
- public $import_key;
- public $status;
- // END MODULEBUILDER PROPERTIES
+ // BEGIN MODULEBUILDER PROPERTIES
+ /**
+ * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
+ */
+ public $fields=array(
+ 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
+ 'fk_emailcollector' => array('type'=>'integer', 'label'=>'Id of emailcollector', 'foreignkey'=>'emailcollector.rowid'),
+ 'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1),
+ 'actionparam' => array('type'=>'varchar(255)', 'label'=>'ParamForAction', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>-1),
+ 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
+ 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
+ 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
+ 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
+ 'position' => array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>1, 'position'=>600, 'default'=>'0',),
+ 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled')),
+ );
+ public $rowid;
+ public $fk_emailcollector;
+ public $type;
+ public $actionparam;
+ public $date_creation;
+ public $tms;
+ public $fk_user_creat;
+ public $fk_user_modif;
+ public $position;
+ public $import_key;
+ public $status;
+ // END MODULEBUILDER PROPERTIES
- // If this object has a subtable with lines
+ // If this object has a subtable with lines
- /**
- * @var int Name of subtable line
- */
- //public $table_element_line = 'emailcollectoractiondet';
+ // /**
+ // * @var int Name of subtable line
+ // */
+ //public $table_element_line = 'emailcollectoractiondet';
- /**
- * @var int Field with ID of parent key if this field has a parent
- */
- //public $fk_element = 'fk_emailcollectoraction';
+ // /**
+ // * @var int Field with ID of parent key if this field has a parent
+ // */
+ //public $fk_element = 'fk_emailcollectoraction';
- /**
- * @var int Name of subtable class that manage subtable lines
- */
- //public $class_element_line = 'EmailcollectorActionline';
+ // /**
+ // * @var int Name of subtable class that manage subtable lines
+ // */
+ //public $class_element_line = 'EmailcollectorActionline';
- /**
- * @var array Array of child tables (child tables to delete before deleting a record)
- */
- //protected $childtables=array('emailcollectoractiondet');
+ // /**
+ // * @var array Array of child tables (child tables to delete before deleting a record)
+ // */
+ //protected $childtables=array('emailcollectoractiondet');
- /**
- * @var EmailcollectorActionLine[] Array of subtable lines
- */
- //public $lines = array();
+ // /**
+ // * @var EmailcollectorActionLine[] Array of subtable lines
+ // */
+ //public $lines = array();
- /**
- * Constructor
- *
- * @param DoliDb $db Database handler
- */
- public function __construct(DoliDB $db)
- {
- global $conf, $langs, $user;
+ /**
+ * Constructor
+ *
+ * @param DoliDb $db Database handler
+ */
+ public function __construct(DoliDB $db)
+ {
+ global $conf, $langs, $user;
- $this->db = $db;
+ $this->db = $db;
- if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
- if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
+ if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
- // Unset fields that are disabled
- foreach($this->fields as $key => $val)
- {
- if (isset($val['enabled']) && empty($val['enabled']))
- {
- unset($this->fields[$key]);
- }
- }
+ // Unset fields that are disabled
+ foreach($this->fields as $key => $val)
+ {
+ if (isset($val['enabled']) && empty($val['enabled']))
+ {
+ unset($this->fields[$key]);
+ }
+ }
- // Translate some data of arrayofkeyval
- foreach($this->fields as $key => $val)
- {
- if (is_array($this->fields['status']['arrayofkeyval']))
- {
- foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2)
- {
- $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2);
- }
- }
- }
- }
+ // Translate some data of arrayofkeyval
+ foreach($this->fields as $key => $val)
+ {
+ if (is_array($this->fields['status']['arrayofkeyval']))
+ {
+ foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2)
+ {
+ $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2);
+ }
+ }
+ }
+ }
- /**
- * Create object into database
- *
- * @param User $user User that creates
- * @param bool $notrigger false=launch triggers after, true=disable triggers
- * @return int <0 if KO, Id of created object if OK
- */
- public function create(User $user, $notrigger = false)
- {
- global $langs;
- if (empty($this->type))
- {
- $langs->load("errors");
- $this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
- return -1;
- }
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, Id of created object if OK
+ */
+ public function create(User $user, $notrigger = false)
+ {
+ global $langs;
+ if (empty($this->type))
+ {
+ $langs->load("errors");
+ $this->errors[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
+ return -1;
+ }
- return $this->createCommon($user, $notrigger);
- }
+ return $this->createCommon($user, $notrigger);
+ }
- /**
- * Clone and object into another one
- *
- * @param User $user User that creates
- * @param int $fromid Id of object to clone
- * @return mixed New object created, <0 if KO
- */
- public function createFromClone(User $user, $fromid)
- {
- global $langs, $hookmanager, $extrafields;
- $error = 0;
+ /**
+ * Clone and object into another one
+ *
+ * @param User $user User that creates
+ * @param int $fromid Id of object to clone
+ * @return mixed New object created, <0 if KO
+ */
+ public function createFromClone(User $user, $fromid)
+ {
+ global $langs, $hookmanager, $extrafields;
+ $error = 0;
- dol_syslog(__METHOD__, LOG_DEBUG);
+ dol_syslog(__METHOD__, LOG_DEBUG);
- $object = new self($this->db);
+ $object = new self($this->db);
- $this->db->begin();
+ $this->db->begin();
- // Load source object
- $object->fetchCommon($fromid);
- // Reset some properties
- unset($object->id);
- unset($object->fk_user_creat);
- unset($object->import_key);
+ // Load source object
+ $object->fetchCommon($fromid);
+ // Reset some properties
+ unset($object->id);
+ unset($object->fk_user_creat);
+ unset($object->import_key);
- // Clear fields
- $object->ref = "copy_of_".$object->ref;
- $object->title = $langs->trans("CopyOf")." ".$object->title;
- // ...
- // Clear extrafields that are unique
- if (is_array($object->array_options) && count($object->array_options) > 0)
- {
- $extrafields->fetch_name_optionals_label($this->element);
- foreach($object->array_options as $key => $option)
- {
- $shortkey = preg_replace('/options_/', '', $key);
- if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
- {
- //var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
- unset($object->array_options[$key]);
- }
- }
- }
+ // Clear fields
+ $object->ref = "copy_of_".$object->ref;
+ $object->title = $langs->trans("CopyOf")." ".$object->title;
+ // ...
+ // Clear extrafields that are unique
+ if (is_array($object->array_options) && count($object->array_options) > 0)
+ {
+ $extrafields->fetch_name_optionals_label($this->element);
+ foreach($object->array_options as $key => $option)
+ {
+ $shortkey = preg_replace('/options_/', '', $key);
+ if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
+ {
+ //var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
+ unset($object->array_options[$key]);
+ }
+ }
+ }
- // Create clone
- $object->context['createfromclone'] = 'createfromclone';
- $result = $object->createCommon($user);
- if ($result < 0) {
- $error++;
- $this->error = $object->error;
- $this->errors = $object->errors;
- }
+ // Create clone
+ $object->context['createfromclone'] = 'createfromclone';
+ $result = $object->createCommon($user);
+ if ($result < 0) {
+ $error++;
+ $this->error = $object->error;
+ $this->errors = $object->errors;
+ }
- unset($object->context['createfromclone']);
+ unset($object->context['createfromclone']);
- // End
- if (!$error) {
- $this->db->commit();
- return $object;
- } else {
- $this->db->rollback();
- return -1;
- }
- }
+ // End
+ if (!$error) {
+ $this->db->commit();
+ return $object;
+ } else {
+ $this->db->rollback();
+ return -1;
+ }
+ }
- /**
- * Load object in memory from the database
- *
- * @param int $id Id object
- * @param string $ref Ref
- * @return int <0 if KO, 0 if not found, >0 if OK
- */
- public function fetch($id, $ref = null)
- {
- $result = $this->fetchCommon($id, $ref);
- if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
- return $result;
- }
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetch($id, $ref = null)
+ {
+ $result = $this->fetchCommon($id, $ref);
+ if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
+ return $result;
+ }
- /**
- * Load object lines in memory from the database
- *
- * @return int <0 if KO, 0 if not found, >0 if OK
- */
- /*public function fetchLines()
- {
- $this->lines=array();
+ /**
+ * Load object lines in memory from the database
+ *
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ /*public function fetchLines()
+ {
+ $this->lines=array();
- // Load lines with object EmailcollectorActionLine
+ // Load lines with object EmailcollectorActionLine
- return count($this->lines)?1:0;
- }*/
+ return count($this->lines)?1:0;
+ }*/
- /**
- * Update object into database
- *
- * @param User $user User that modifies
- * @param bool $notrigger false=launch triggers after, true=disable triggers
- * @return int <0 if KO, >0 if OK
- */
- public function update(User $user, $notrigger = false)
- {
- return $this->updateCommon($user, $notrigger);
- }
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update(User $user, $notrigger = false)
+ {
+ return $this->updateCommon($user, $notrigger);
+ }
- /**
- * Delete object in database
- *
- * @param User $user User that deletes
- * @param bool $notrigger false=launch triggers after, true=disable triggers
- * @return int <0 if KO, >0 if OK
- */
- public function delete(User $user, $notrigger = false)
- {
- return $this->deleteCommon($user, $notrigger);
- }
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete(User $user, $notrigger = false)
+ {
+ return $this->deleteCommon($user, $notrigger);
+ }
- /**
- * Return a link to the object card (with optionaly the picto)
- *
- * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
- * @param string $option On what the link point to ('nolink', ...)
+ /**
+ * Return a link to the object card (with optionaly the picto)
+ *
+ * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+ * @param string $option On what the link point to ('nolink', ...)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
- * @return string String with URL
- */
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
- {
- global $db, $conf, $langs, $hookmanager;
+ * @return string String with URL
+ */
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+ {
+ global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
@@ -340,10 +340,10 @@ class EmailCollectorAction extends CommonObject
if ($option != 'nolink')
{
- // Add param to save lastsearch_values or not
- $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
- if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose='';
@@ -366,152 +366,152 @@ class EmailCollectorAction extends CommonObject
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
- $linkstart = '';
- $linkend=' ';
+ $linkstart = '';
+ $linkend=' ';
- $result .= $linkstart;
- if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
- if ($withpicto != 2) $result.= $this->ref;
- $result .= $linkend;
- //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
+ $result .= $linkstart;
+ if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
+ if ($withpicto != 2) $result.= $this->ref;
+ $result .= $linkend;
+ //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
- global $action,$hookmanager;
- $hookmanager->initHooks(array('emailcollectoractiondao'));
- $parameters=array('id'=>$this->id, 'getnomurl'=>$result);
- $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $result = $hookmanager->resPrint;
- else $result .= $hookmanager->resPrint;
+ global $action,$hookmanager;
+ $hookmanager->initHooks(array('emailcollectoractiondao'));
+ $parameters=array('id'=>$this->id, 'getnomurl'=>$result);
+ $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ if ($reshook > 0) $result = $hookmanager->resPrint;
+ else $result .= $hookmanager->resPrint;
- return $result;
- }
+ return $result;
+ }
- /**
- * Return label of the status
- *
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
- * @return string Label of status
- */
- public function getLibStatut($mode = 0)
- {
- return $this->LibStatut($this->status, $mode);
- }
+ /**
+ * Return label of the status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function getLibStatut($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Return the status
- *
- * @param int $status Id status
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
- * @return string Label of status
- */
- public function LibStatut($status, $mode = 0)
- {
- // phpcs:enable
- if (empty($this->labelstatus))
- {
- global $langs;
- //$langs->load("emailcollector");
- $this->labelstatus[1] = $langs->trans('Enabled');
- $this->labelstatus[0] = $langs->trans('Disabled');
- }
+ /**
+ * Return the status
+ *
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function LibStatut($status, $mode = 0)
+ {
+ // phpcs:enable
+ if (empty($this->labelstatus))
+ {
+ global $langs;
+ //$langs->load("emailcollector");
+ $this->labelstatus[1] = $langs->trans('Enabled');
+ $this->labelstatus[0] = $langs->trans('Disabled');
+ }
- if ($mode == 0)
- {
- return $this->labelstatus[$status];
- }
- elseif ($mode == 1)
- {
- return $this->labelstatus[$status];
- }
- elseif ($mode == 2)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- }
- elseif ($mode == 3)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 4)
- {
- if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
- }
- elseif ($mode == 5)
- {
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- elseif ($mode == 6)
- {
- if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
- elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
- }
- }
+ if ($mode == 0)
+ {
+ return $this->labelstatus[$status];
+ }
+ elseif ($mode == 1)
+ {
+ return $this->labelstatus[$status];
+ }
+ elseif ($mode == 2)
+ {
+ if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ }
+ elseif ($mode == 3)
+ {
+ if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ }
+ elseif ($mode == 4)
+ {
+ if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ }
+ elseif ($mode == 5)
+ {
+ if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ }
+ elseif ($mode == 6)
+ {
+ if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
+ }
+ }
- /**
- * Charge les informations d'ordre info dans l'objet commande
- *
- * @param int $id Id of order
- * @return void
- */
- public function info($id)
- {
- $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
- $sql.= ' fk_user_creat, fk_user_modif';
- $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
- $sql.= ' WHERE t.rowid = '.$id;
- $result=$this->db->query($sql);
- if ($result)
- {
- if ($this->db->num_rows($result))
- {
- $obj = $this->db->fetch_object($result);
- $this->id = $obj->rowid;
- if ($obj->fk_user_author)
- {
- $cuser = new User($this->db);
- $cuser->fetch($obj->fk_user_author);
- $this->user_creation = $cuser;
- }
+ /**
+ * Charge les informations d'ordre info dans l'objet commande
+ *
+ * @param int $id Id of order
+ * @return void
+ */
+ public function info($id)
+ {
+ $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
+ $sql.= ' fk_user_creat, fk_user_modif';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
+ $sql.= ' WHERE t.rowid = '.$id;
+ $result=$this->db->query($sql);
+ if ($result)
+ {
+ if ($this->db->num_rows($result))
+ {
+ $obj = $this->db->fetch_object($result);
+ $this->id = $obj->rowid;
+ if ($obj->fk_user_author)
+ {
+ $cuser = new User($this->db);
+ $cuser->fetch($obj->fk_user_author);
+ $this->user_creation = $cuser;
+ }
- if ($obj->fk_user_valid)
- {
- $vuser = new User($this->db);
- $vuser->fetch($obj->fk_user_valid);
- $this->user_validation = $vuser;
- }
+ if ($obj->fk_user_valid)
+ {
+ $vuser = new User($this->db);
+ $vuser->fetch($obj->fk_user_valid);
+ $this->user_validation = $vuser;
+ }
- if ($obj->fk_user_cloture)
- {
- $cluser = new User($this->db);
- $cluser->fetch($obj->fk_user_cloture);
- $this->user_cloture = $cluser;
- }
+ if ($obj->fk_user_cloture)
+ {
+ $cluser = new User($this->db);
+ $cluser->fetch($obj->fk_user_cloture);
+ $this->user_cloture = $cluser;
+ }
- $this->date_creation = $this->db->jdate($obj->datec);
- $this->date_modification = $this->db->jdate($obj->datem);
- $this->date_validation = $this->db->jdate($obj->datev);
- }
+ $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_modification = $this->db->jdate($obj->datem);
+ $this->date_validation = $this->db->jdate($obj->datev);
+ }
- $this->db->free($result);
- }
- else
- {
- dol_print_error($this->db);
- }
- }
+ $this->db->free($result);
+ }
+ else
+ {
+ dol_print_error($this->db);
+ }
+ }
- /**
- * Initialise object with example values
- * Id must be 0 if object instance is a specimen
- *
- * @return void
- */
- public function initAsSpecimen()
- {
- $this->initAsSpecimenCommon();
- }
+ /**
+ * Initialise object with example values
+ * Id must be 0 if object instance is a specimen
+ *
+ * @return void
+ */
+ public function initAsSpecimen()
+ {
+ $this->initAsSpecimenCommon();
+ }
}
diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php
index e0556bf865b..d46dfb1c9ae 100644
--- a/htdocs/emailcollector/class/emailcollectorfilter.class.php
+++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php
@@ -296,7 +296,7 @@ class EmailCollectorFilter extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php
index 3352927f7c9..73923105c7d 100644
--- a/htdocs/expedition/class/api_shipments.class.php
+++ b/htdocs/expedition/class/api_shipments.class.php
@@ -46,10 +46,10 @@ class Shipments extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
- global $db, $conf;
- $this->db = $db;
+ global $db, $conf;
+ $this->db = $db;
$this->shipment = new Expedition($this->db);
}
@@ -60,26 +60,26 @@ class Shipments extends DolibarrApi
*
* @param int $id ID of shipment
* @return array|mixed data without useless information
- *
+ *
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
- if(! DolibarrApiAccess::$user->rights->expedition->lire) {
- throw new RestException(401);
- }
+ if(! DolibarrApiAccess::$user->rights->expedition->lire) {
+ throw new RestException(401);
+ }
$result = $this->shipment->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
$this->shipment->fetchObjectLinked();
- return $this->_cleanObjectDatas($this->shipment);
+ return $this->_cleanObjectDatas($this->shipment);
}
@@ -97,9 +97,9 @@ class Shipments extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of shipment objects
*
- * @throws RestException
+ * @throws RestException
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf;
@@ -134,7 +134,7 @@ class Shipments extends DolibarrApi
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@@ -173,7 +173,7 @@ class Shipments extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No shipment found');
}
- return $obj_ret;
+ return $obj_ret;
}
/**
@@ -182,7 +182,7 @@ class Shipments extends DolibarrApi
* @param array $request_data Request data
* @return int ID of shipment
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401, "Insuffisant rights");
@@ -218,7 +218,7 @@ class Shipments extends DolibarrApi
* @return int
*/
/*
- function getLines($id)
+ public function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
@@ -252,7 +252,7 @@ class Shipments extends DolibarrApi
* @return int
*/
/*
- function postLine($id, $request_data = null)
+ public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -315,7 +315,7 @@ class Shipments extends DolibarrApi
* @return object
*/
/*
- function putLine($id, $lineid, $request_data = null)
+ public function putLine($id, $lineid, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -376,32 +376,32 @@ class Shipments extends DolibarrApi
* @throws 401
* @throws 404
*/
- function deleteLine($id, $lineid)
+ public function deleteLine($id, $lineid)
{
- if(! DolibarrApiAccess::$user->rights->expedition->creer) {
- throw new RestException(401);
- }
+ if(! DolibarrApiAccess::$user->rights->expedition->creer) {
+ throw new RestException(401);
+ }
- $result = $this->shipment->fetch($id);
- if( ! $result ) {
- throw new RestException(404, 'Shipment not found');
- }
+ $result = $this->shipment->fetch($id);
+ if( ! $result ) {
+ throw new RestException(404, 'Shipment not found');
+ }
- if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- // TODO Check the lineid $lineid is a line of ojbect
+ // TODO Check the lineid $lineid is a line of ojbect
- $request_data = (object) $request_data;
- $updateRes = $this->shipment->deleteline(DolibarrApiAccess::$user, $lineid);
- if ($updateRes > 0) {
- return $this->get($id);
- }
- else
- {
- throw new RestException(405, $this->shipment->error);
- }
+ $request_data = (object) $request_data;
+ $updateRes = $this->shipment->deleteline(DolibarrApiAccess::$user, $lineid);
+ if ($updateRes > 0) {
+ return $this->get($id);
+ }
+ else
+ {
+ throw new RestException(405, $this->shipment->error);
+ }
}
/**
@@ -412,7 +412,7 @@ class Shipments extends DolibarrApi
*
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -423,9 +423,9 @@ class Shipments extends DolibarrApi
throw new RestException(404, 'Shipment not found');
}
- if (! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if (! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->shipment->$field = $value;
@@ -437,7 +437,7 @@ class Shipments extends DolibarrApi
}
else
{
- throw new RestException(500, $this->shipment->error);
+ throw new RestException(500, $this->shipment->error);
}
}
@@ -448,19 +448,19 @@ class Shipments extends DolibarrApi
*
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->shipment->supprimer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->shipment->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
if( ! $this->shipment->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when deleting shipment : '.$this->shipment->error);
@@ -493,26 +493,26 @@ class Shipments extends DolibarrApi
* "notrigger": 0
* }
*/
- function validate($id, $notrigger = 0)
+ public function validate($id, $notrigger = 0)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->shipment->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Shipment not found');
}
- if ( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if ( ! DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- $result = $this->shipment->valid(DolibarrApiAccess::$user, $notrigger);
- if ($result == 0) {
- throw new RestException(304, 'Error nothing done. May be object is already validated');
- }
- if ($result < 0) {
- throw new RestException(500, 'Error when validating Shipment: '.$this->shipment->error);
+ $result = $this->shipment->valid(DolibarrApiAccess::$user, $notrigger);
+ if ($result == 0) {
+ throw new RestException(304, 'Error nothing done. May be object is already validated');
+ }
+ if ($result < 0) {
+ throw new RestException(500, 'Error when validating Shipment: '.$this->shipment->error);
}
$result = $this->shipment->fetch($id);
if ( ! $result ) {
@@ -542,7 +542,8 @@ class Shipments extends DolibarrApi
* @throws 404
* @throws 405
*/
-/* function setinvoiced($id)
+ /*
+ public function setinvoiced($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
@@ -562,7 +563,7 @@ class Shipments extends DolibarrApi
}
return $result;
}
-*/
+ */
/**
@@ -579,7 +580,7 @@ class Shipments extends DolibarrApi
* @throws 405
*/
/*
- function createShipmentFromOrder($orderid)
+ public function createShipmentFromOrder($orderid)
{
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
@@ -607,7 +608,7 @@ class Shipments extends DolibarrApi
$this->shipment->fetchObjectLinked();
return $this->_cleanObjectDatas($this->shipment);
}
- */
+ */
/**
* Clean sensible object datas
@@ -615,7 +616,7 @@ class Shipments extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -633,15 +634,15 @@ class Shipments extends DolibarrApi
{
foreach ($object->lines as $line)
{
- unset($line->tva_tx);
- unset($line->vat_src_code);
- unset($line->total_ht);
- unset($line->total_ttc);
- unset($line->total_tva);
- unset($line->total_localtax1);
- unset($line->total_localtax2);
- unset($line->remise_percent);
- }
+ unset($line->tva_tx);
+ unset($line->vat_src_code);
+ unset($line->total_ht);
+ unset($line->total_ttc);
+ unset($line->total_tva);
+ unset($line->total_localtax1);
+ unset($line->total_localtax2);
+ unset($line->remise_percent);
+ }
}
return $object;
@@ -654,7 +655,7 @@ class Shipments extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$shipment = array();
foreach (Shipments::$FIELDS as $field) {
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 84853fe51e6..afb1469da26 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -171,7 +171,7 @@ class Expedition extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -207,7 +207,7 @@ class Expedition extends CommonObject
* @param Societe $soc Thirdparty object
* @return string Free reference for contract
*/
- function getNextNumRef($soc)
+ public function getNextNumRef($soc)
{
global $langs, $conf;
$langs->load("sendings");
@@ -264,7 +264,7 @@ class Expedition extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 si erreur, id expedition creee si ok
*/
- function create($user, $notrigger = 0)
+ public function create($user, $notrigger = 0)
{
global $conf, $hookmanager;
@@ -434,7 +434,7 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a expedition line
*
@@ -444,7 +444,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, line_id if OK
*/
- function create_line($entrepot_id, $origin_line_id, $qty, $array_options = 0)
+ public function create_line($entrepot_id, $origin_line_id, $qty, $array_options = 0)
{
//phpcs:enable
$expeditionline = new ExpeditionLigne($this->db);
@@ -462,7 +462,7 @@ class Expedition extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create the detail (eat-by date) of the expedition line
*
@@ -470,7 +470,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
- function create_line_batch($line_ext, $array_options = 0)
+ public function create_line_batch($line_ext, $array_options = 0)
{
// phpcs:enable
$error = 0;
@@ -520,7 +520,7 @@ class Expedition extends CommonObject
* @param string $ref_int Internal reference of other object
* @return int >0 if OK, 0 if not found, <0 if KO
*/
- function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
+ public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
{
global $conf;
@@ -646,7 +646,7 @@ class Expedition extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if OK, >0 if KO
*/
- function valid($user, $notrigger = 0)
+ public function valid($user, $notrigger = 0)
{
global $conf, $langs;
@@ -862,14 +862,14 @@ class Expedition extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a delivery receipt from a shipment
*
* @param User $user User
* @return int <0 if KO, >=0 if OK
*/
- function create_delivery($user)
+ public function create_delivery($user)
{
// phpcs:enable
global $conf;
@@ -908,7 +908,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
- function addline($entrepot_id, $id, $qty, $array_options = 0)
+ public function addline($entrepot_id, $id, $qty, $array_options = 0)
{
global $conf, $langs;
@@ -971,7 +971,7 @@ class Expedition extends CommonObject
$this->lines[$num] = $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a shipment line with batch record
*
@@ -979,7 +979,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
- function addline_batch($dbatch, $array_options = 0)
+ public function addline_batch($dbatch, $array_options = 0)
{
// phpcs:enable
global $conf,$langs;
@@ -1048,7 +1048,7 @@ class Expedition extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf;
$error=0;
@@ -1152,7 +1152,7 @@ class Expedition extends CommonObject
*
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
*/
- function delete()
+ public function delete()
{
global $conf, $langs, $user;
@@ -1360,13 +1360,13 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load lines
*
* @return int >0 if OK, Otherwise if KO
*/
- function fetch_lines()
+ public function fetch_lines()
{
// phpcs:enable
global $conf, $mysoc;
@@ -1548,7 +1548,7 @@ class Expedition extends CommonObject
* @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO
*/
- function deleteline($user, $lineid)
+ public function deleteline($user, $lineid)
{
global $user;
@@ -1593,7 +1593,7 @@ class Expedition extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs;
@@ -1643,12 +1643,12 @@ class Expedition extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Libelle
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a status
*
@@ -1656,7 +1656,7 @@ class Expedition extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Label of status
*/
- function LibStatut($statut, $mode)
+ public function LibStatut($statut, $mode)
{
// phpcs:enable
global $langs;
@@ -1700,7 +1700,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $langs;
@@ -1772,7 +1772,7 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set the planned delivery date
*
@@ -1780,7 +1780,7 @@ class Expedition extends CommonObject
* @param timestamp $date_livraison Date de livraison
* @return int <0 if KO, >0 if OK
*/
- function set_date_livraison($user, $date_livraison)
+ public function set_date_livraison($user, $date_livraison)
{
// phpcs:enable
if ($user->rights->expedition->creer)
@@ -1808,13 +1808,13 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
*
* @return void
*/
- function fetch_delivery_methods()
+ public function fetch_delivery_methods()
{
// phpcs:enable
global $langs;
@@ -1836,14 +1836,14 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch all deliveries method and return an array. Load array this->listmeths.
*
* @param id $id only this carrier, all if none
* @return void
*/
- function list_delivery_methods($id = '')
+ public function list_delivery_methods($id = '')
{
// phpcs:enable
global $langs;
@@ -1872,7 +1872,7 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update/create delivery method.
*
@@ -1880,7 +1880,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function update_delivery_method($id = '')
+ public function update_delivery_method($id = '')
{
// phpcs:enable
if ($id=='')
@@ -1902,7 +1902,7 @@ class Expedition extends CommonObject
if ($resql < 0) dol_print_error($this->db, '');
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Activate delivery method.
*
@@ -1910,7 +1910,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function activ_delivery_method($id)
+ public function activ_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
@@ -1919,7 +1919,7 @@ class Expedition extends CommonObject
$resql = $this->db->query($sql);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* DesActivate delivery method.
*
@@ -1927,7 +1927,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function disable_delivery_method($id)
+ public function disable_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
@@ -1943,7 +1943,7 @@ class Expedition extends CommonObject
* @param string $value Value
* @return void
*/
- function getUrlTrackingStatus($value = '')
+ public function getUrlTrackingStatus($value = '')
{
if (! empty($this->shipping_method_id))
{
@@ -1977,7 +1977,7 @@ class Expedition extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
- function setClosed()
+ public function setClosed()
{
global $conf,$langs,$user;
@@ -2123,13 +2123,13 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @return int <0 if ko, >0 if ok
*/
- function set_billed()
+ public function set_billed()
{
// phpcs:enable
global $user;
@@ -2174,7 +2174,7 @@ class Expedition extends CommonObject
*
* @return int <0 if KO, 0 if already open, >0 if OK
*/
- function reOpen()
+ public function reOpen()
{
global $conf,$langs,$user;
@@ -2273,14 +2273,13 @@ class Expedition extends CommonObject
}
}
- if (! $error)
- {
+ if (! $error) {
// Call trigger
$result=$this->call_trigger('SHIPPING_REOPEN', $user);
if ($result < 0) {
$error++;
}
- }
+ }
} else {
$error++;
$this->errors[]=$this->db->lasterror();
@@ -2510,7 +2509,7 @@ class ExpeditionLigne extends CommonObjectLine
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
@@ -2521,7 +2520,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $rowid Id line order
* @return int <0 if KO, >0 if OK
*/
- function fetch($rowid)
+ public function fetch($rowid)
{
$sql = 'SELECT ed.rowid, ed.fk_expedition, ed.fk_entrepot, ed.fk_origin_line, ed.qty, ed.rang';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as ed';
@@ -2556,7 +2555,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $notrigger 1 = disable triggers
* @return int <0 if KO, line id >0 if OK
*/
- function insert($user = null, $notrigger = 0)
+ public function insert($user = null, $notrigger = 0)
{
global $langs, $conf;
@@ -2638,7 +2637,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int >0 if OK, <0 if KO
*/
- function delete($user = null, $notrigger = 0)
+ public function delete($user = null, $notrigger = 0)
{
global $conf;
@@ -2715,7 +2714,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $notrigger 1 = disable triggers
* @return int < 0 if KO, > 0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf;
diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php
index e15e766c439..1cc0f277af6 100644
--- a/htdocs/expedition/class/expeditionbatch.class.php
+++ b/htdocs/expedition/class/expeditionbatch.class.php
@@ -35,21 +35,21 @@ class ExpeditionLineBatch extends CommonObject
private static $_table_element='expeditiondet_batch'; //!< Name of table without prefix where object is stored
- var $sellby;
- var $eatby;
- var $batch;
- var $qty;
- var $dluo_qty; // deprecated, use qty
- var $entrepot_id;
- var $fk_origin_stock;
- var $fk_expeditiondet;
+ public $sellby;
+ public $eatby;
+ public $batch;
+ public $qty;
+ public $dluo_qty; // deprecated, use qty
+ public $entrepot_id;
+ public $fk_origin_stock;
+ public $fk_expeditiondet;
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -60,7 +60,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $id_stockdluo Rowid in product_batch table
* @return int -1 if KO, 1 if OK
*/
- function fetchFromStock($id_stockdluo)
+ public function fetchFromStock($id_stockdluo)
{
$sql = "SELECT";
$sql.= " pb.batch,";
@@ -104,7 +104,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $id_line_expdet rowid of expedtiondet record
* @return int <0 if KO, Id of record (>0) if OK
*/
- function create($id_line_expdet)
+ public function create($id_line_expdet)
{
$error = 0;
@@ -155,7 +155,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $id_expedition rowid of shipment
* @return int -1 if KO, 1 if OK
*/
- static function deletefromexp($db, $id_expedition)
+ public static function deletefromexp($db, $id_expedition)
{
$id_expedition = (int) $id_expedition;
@@ -181,7 +181,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $fk_product If provided, load also detailed information of lot
* @return int|array -1 if KO, array of ExpeditionLineBatch if OK
*/
- static function fetchAll($db, $id_line_expdet, $fk_product = 0)
+ public static function fetchAll($db, $id_line_expdet, $fk_product = 0)
{
$sql="SELECT";
$sql.= " eb.rowid,";
diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php
index e1bb3c0b219..d6ac5e2242a 100644
--- a/htdocs/expedition/class/expeditionstats.class.php
+++ b/htdocs/expedition/class/expeditionstats.class.php
@@ -34,17 +34,17 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
*/
class ExpeditionStats extends Stats
{
- /**
- * @var string Name of table without prefix where object is stored
- */
- public $table_element;
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element;
- var $socid;
- var $userid;
+ public $socid;
+ public $userid;
- var $from;
- var $field;
- var $where;
+ public $from;
+ public $field;
+ public $where;
/**
@@ -55,7 +55,7 @@ class ExpeditionStats extends Stats
* @param string $mode Option (not used)
* @param int $userid Id user for filter (creation user)
*/
- function __construct($db, $socid, $mode, $userid = 0)
+ public function __construct($db, $socid, $mode, $userid = 0)
{
global $user, $conf;
@@ -88,7 +88,7 @@ class ExpeditionStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
- function getNbByMonth($year, $format = 0)
+ public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -110,7 +110,7 @@ class ExpeditionStats extends Stats
* @return array Array with number by year
*
*/
- function getNbByYear()
+ public function getNbByYear()
{
global $user;
@@ -129,7 +129,7 @@ class ExpeditionStats extends Stats
*
* @return array Array of values
*/
- function getAllByYear()
+ public function getAllByYear()
{
global $user;
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index a490089325d..be7bcfa50ef 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -357,7 +357,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '';
- print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100');
+ print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print ' ';
}
// Company type
diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php
index 02e1021a141..35ce9f9a4a2 100644
--- a/htdocs/expensereport/class/api_expensereports.class.php
+++ b/htdocs/expensereport/class/api_expensereports.class.php
@@ -45,7 +45,7 @@ class ExpenseReports extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -59,26 +59,26 @@ class ExpenseReports extends DolibarrApi
*
* @param int $id ID of Expense Report
* @return array|mixed Data without useless information
- *
+ *
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
- if(! DolibarrApiAccess::$user->rights->expensereport->lire) {
- throw new RestException(401);
- }
+ if(! DolibarrApiAccess::$user->rights->expensereport->lire) {
+ throw new RestException(401);
+ }
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Expense report not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
$this->expensereport->fetchObjectLinked();
- return $this->_cleanObjectDatas($this->expensereport);
+ return $this->_cleanObjectDatas($this->expensereport);
}
/**
@@ -94,7 +94,7 @@ class ExpenseReports extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of Expense Report objects
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -115,7 +115,7 @@ class ExpenseReports extends DolibarrApi
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@@ -152,7 +152,7 @@ class ExpenseReports extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No Expense Report found');
}
- return $obj_ret;
+ return $obj_ret;
}
/**
@@ -161,7 +161,7 @@ class ExpenseReports extends DolibarrApi
* @param array $request_data Request data
* @return int ID of Expense Report
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401, "Insuffisant rights");
@@ -195,8 +195,8 @@ class ExpenseReports extends DolibarrApi
*
* @return int
*/
-/*
- function getLines($id)
+ /*
+ public function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expensereport->lire) {
throw new RestException(401);
@@ -217,7 +217,7 @@ class ExpenseReports extends DolibarrApi
}
return $result;
}
-*/
+ */
/**
* Add a line to given Expense Report
@@ -229,22 +229,22 @@ class ExpenseReports extends DolibarrApi
*
* @return int
*/
-/*
- function postLine($id, $request_data = null)
+ /*
+ public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'expensereport not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- $request_data = (object) $request_data;
+ $request_data = (object) $request_data;
$updateRes = $this->expensereport->addline(
$request_data->desc,
$request_data->subprice,
@@ -279,7 +279,7 @@ class ExpenseReports extends DolibarrApi
}
return false;
}
-*/
+ */
/**
* Update a line to given Expense Report
@@ -293,22 +293,22 @@ class ExpenseReports extends DolibarrApi
* @return object
*/
/*
- function putLine($id, $lineid, $request_data = null)
+ public function putLine($id, $lineid, $request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
- throw new RestException(401);
- }
+ if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
+ throw new RestException(401);
+ }
- $result = $this->expensereport->fetch($id);
- if( ! $result ) {
- throw new RestException(404, 'expensereport not found');
- }
+ $result = $this->expensereport->fetch($id);
+ if( ! $result ) {
+ throw new RestException(404, 'expensereport not found');
+ }
- if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
- $request_data = (object) $request_data;
- $updateRes = $this->expensereport->updateline(
+ if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
+ $request_data = (object) $request_data;
+ $updateRes = $this->expensereport->updateline(
$lineid,
$request_data->desc,
$request_data->subprice,
@@ -330,16 +330,16 @@ class ExpenseReports extends DolibarrApi
$request_data->special_code,
$request_data->array_options,
$request_data->fk_unit
- );
+ );
- if ($updateRes > 0) {
- $result = $this->get($id);
- unset($result->line);
- return $this->_cleanObjectDatas($result);
- }
- return false;
+ if ($updateRes > 0) {
+ $result = $this->get($id);
+ unset($result->line);
+ return $this->_cleanObjectDatas($result);
+ }
+ return false;
}
- */
+ */
/**
* Delete a line of given Expense Report
@@ -352,19 +352,19 @@ class ExpenseReports extends DolibarrApi
* @return int
*/
/*
- function deleteLine($id, $lineid)
+ public function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'expensereport not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
// TODO Check the lineid $lineid is a line of ojbect
@@ -385,7 +385,7 @@ class ExpenseReports extends DolibarrApi
*
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401);
@@ -407,11 +407,11 @@ class ExpenseReports extends DolibarrApi
if ($this->expensereport->update(DolibarrApiAccess::$user) > 0)
{
return $this->get($id);
- }
- else
- {
- throw new RestException(500, $this->expensereport->error);
- }
+ }
+ else
+ {
+ throw new RestException(500, $this->expensereport->error);
+ }
}
/**
@@ -421,19 +421,19 @@ class ExpenseReports extends DolibarrApi
*
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->expensereport->supprimer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Expense Report not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('expensereport', $this->expensereport->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
if( ! $this->expensereport->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete Expense Report : '.$this->expensereport->error);
@@ -463,19 +463,19 @@ class ExpenseReports extends DolibarrApi
* }
*/
/*
- function validate($id, $idwarehouse=0)
+ public function validate($id, $idwarehouse=0)
{
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->expensereport->fetch($id);
if( ! $result ) {
throw new RestException(404, 'expensereport not found');
}
- if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
if( ! $this->expensereport->valid(DolibarrApiAccess::$user, $idwarehouse)) {
throw new RestException(500, 'Error when validate expensereport');
@@ -495,17 +495,17 @@ class ExpenseReports extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
- $object = parent::_cleanObjectDatas($object);
+ $object = parent::_cleanObjectDatas($object);
- unset($object->barcode_type);
- unset($object->barcode_type_code);
- unset($object->barcode_type_label);
- unset($object->barcode_type_coder);
+ unset($object->barcode_type);
+ unset($object->barcode_type_code);
+ unset($object->barcode_type_label);
+ unset($object->barcode_type_coder);
- return $object;
+ return $object;
}
/**
@@ -515,7 +515,7 @@ class ExpenseReports extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$expensereport = array();
foreach (ExpenseReports::$FIELDS as $field) {
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 8dc0cbcdcf8..bbada0e22f7 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -44,62 +44,62 @@ class ExpenseReport extends CommonObject
*/
public $table_element='expensereport';
- var $table_element_line = 'expensereport_det';
- var $fk_element = 'fk_expensereport';
- var $picto = 'trip';
+ public $table_element_line = 'expensereport_det';
+ public $fk_element = 'fk_expensereport';
+ public $picto = 'trip';
- var $lines=array();
+ public $lines=array();
public $date_debut;
public $date_fin;
- var $status;
- var $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied
- var $fk_c_paiement;
- var $paid;
+ public $status;
+ public $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied
+ public $fk_c_paiement;
+ public $paid;
- var $user_author_infos;
- var $user_validator_infos;
+ public $user_author_infos;
+ public $user_validator_infos;
- var $fk_typepayment;
- var $num_payment;
- var $code_paiement;
- var $code_statut;
+ public $fk_typepayment;
+ public $num_payment;
+ public $code_paiement;
+ public $code_statut;
// ACTIONS
// Create
- var $date_create;
- var $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for.
+ public $date_create;
+ public $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for.
// Update
- var $date_modif;
- var $fk_user_modif;
+ public $date_modif;
+ public $fk_user_modif;
// Refus
- var $date_refuse;
- var $detail_refuse;
- var $fk_user_refuse;
+ public $date_refuse;
+ public $detail_refuse;
+ public $fk_user_refuse;
// Annulation
- var $date_cancel;
- var $detail_cancel;
- var $fk_user_cancel;
+ public $date_cancel;
+ public $detail_cancel;
+ public $fk_user_cancel;
- var $fk_user_validator; // User that is defined to approve
+ public $fk_user_validator; // User that is defined to approve
// Validation
- var $date_valid; // User making validation
- var $fk_user_valid;
- var $user_valid_infos;
+ public $date_valid; // User making validation
+ public $fk_user_valid;
+ public $user_valid_infos;
// Approve
- var $date_approve;
- var $fk_user_approve; // User that has approved
+ public $date_approve;
+ public $fk_user_approve; // User that has approved
// Paiement
- var $user_paid_infos;
+ public $user_paid_infos;
/*
END ACTIONS
@@ -137,7 +137,7 @@ class ExpenseReport extends CommonObject
*
* @param DoliDB $db Handler acces base de donnees
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->total_ht = 0;
@@ -155,10 +155,10 @@ class ExpenseReport extends CommonObject
* Create object in database
*
* @param User $user User that create
- * @param int $notrigger Disable triggers
+ * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function create($user, $notrigger = 0)
+ public function create($user, $notrigger = 0)
{
global $conf;
@@ -307,7 +307,7 @@ class ExpenseReport extends CommonObject
* @param int $fk_user_author Id of new user
* @return int New id of clone
*/
- function createFromClone($fk_user_author)
+ public function createFromClone($fk_user_author)
{
global $user,$hookmanager;
@@ -377,7 +377,7 @@ class ExpenseReport extends CommonObject
* @param User $userofexpensereport New user we want to have the expense report on.
* @return int <0 if KO, >0 if OK
*/
- function update($user, $notrigger = 0, $userofexpensereport = null)
+ public function update($user, $notrigger = 0, $userofexpensereport = null)
{
global $langs;
@@ -447,7 +447,7 @@ class ExpenseReport extends CommonObject
* @param string $ref Ref {@name ref}
* @return int <0 if KO, >0 if OK
*/
- function fetch($id, $ref = '')
+ public function fetch($id, $ref = '')
{
global $conf;
@@ -545,7 +545,7 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the expense report as paid
*
@@ -554,7 +554,7 @@ class ExpenseReport extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function set_paid($id, $fuser, $notrigger = 0)
+ public function set_paid($id, $fuser, $notrigger = 0)
{
// phpcs:enable
$error = 0;
@@ -613,12 +613,12 @@ class ExpenseReport extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the label of a statut
*
@@ -626,7 +626,7 @@ class ExpenseReport extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
- function LibStatut($status, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -660,7 +660,7 @@ class ExpenseReport extends CommonObject
* @param int $id Id of object
* @return void
*/
- function info($id)
+ public function info($id)
{
global $conf;
@@ -684,16 +684,16 @@ class ExpenseReport extends CommonObject
{
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
- $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->date_modification);
- $this->date_validation = $this->db->jdate($obj->datev);
- $this->date_approbation = $this->db->jdate($obj->datea);
+ $this->date_validation = $this->db->jdate($obj->datev);
+ $this->date_approbation = $this->db->jdate($obj->datea);
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
- $this->user_creation = $cuser;
+ $this->user_creation = $cuser;
if ($obj->fk_user_creation)
{
@@ -737,7 +737,7 @@ class ExpenseReport extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $user,$langs,$conf;
@@ -767,8 +767,7 @@ class ExpenseReport extends CommonObject
$this->note_public='SPECIMEN';
$nbp = 5;
$xnbp = 0;
- while ($xnbp < $nbp)
- {
+ while ($xnbp < $nbp) {
$line=new ExpenseReportLine($this->db);
$line->comments=$langs->trans("Comment")." ".$xnbp;
$line->date=($now-3600*(1+$xnbp));
@@ -793,7 +792,7 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* fetch_line_by_project
*
@@ -801,7 +800,7 @@ class ExpenseReport extends CommonObject
* @param User $user User
* @return int <0 if KO, >0 if OK
*/
- function fetch_line_by_project($projectid, $user = '')
+ public function fetch_line_by_project($projectid, $user = '')
{
// phpcs:enable
global $conf,$db,$langs;
@@ -906,7 +905,7 @@ class ExpenseReport extends CommonObject
* @param int $id Id of expense report
* @return int <0 if KO, >0 if OK
*/
- function recalculer($id)
+ public function recalculer($id)
{
$sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt';
@@ -950,13 +949,13 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* fetch_lines
*
* @return int <0 if OK, >0 if KO
*/
- function fetch_lines()
+ public function fetch_lines()
{
// phpcs:enable
$this->lines=array();
@@ -1038,7 +1037,7 @@ class ExpenseReport extends CommonObject
* @param User $fuser User that delete
* @return int <0 if KO, >0 if OK
*/
- function delete(User $fuser = null)
+ public function delete(User $fuser = null)
{
global $user,$langs,$conf;
@@ -1078,7 +1077,7 @@ class ExpenseReport extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, 0 if nothing done, >0 if OK
*/
- function setValidate($fuser, $notrigger = 0)
+ public function setValidate($fuser, $notrigger = 0)
{
global $conf,$langs,$user;
@@ -1195,14 +1194,14 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* set_save_from_refuse
*
* @param User $fuser User
* @return int <0 if KO, >0 if OK
*/
- function set_save_from_refuse($fuser)
+ public function set_save_from_refuse($fuser)
{
// phpcs:enable
global $conf,$langs;
@@ -1249,16 +1248,15 @@ class ExpenseReport extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, 0 if nothing done, >0 if OK
*/
- function setApproved($fuser, $notrigger = 0)
+ public function setApproved($fuser, $notrigger = 0)
{
$now=dol_now();
- $error = 0;
+ $error = 0;
// date approval
$this->date_approve = $now;
- if ($this->fk_statut != 5)
- {
- $this->db->begin();
+ if ($this->fk_statut != 5) {
+ $this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = 5, fk_user_approve = ".$fuser->id.",";
@@ -1309,10 +1307,10 @@ class ExpenseReport extends CommonObject
*
* @param User $fuser User
* @param Details $details Details
- * @param int $notrigger Disable triggers
+ * @param int $notrigger Disable triggers
* @return int
*/
- function setDeny($fuser, $details, $notrigger = 0)
+ public function setDeny($fuser, $details, $notrigger = 0)
{
$now = dol_now();
$error = 0;
@@ -1369,7 +1367,7 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* set_unpaid
*
@@ -1377,7 +1375,7 @@ class ExpenseReport extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function set_unpaid($fuser, $notrigger = 0)
+ public function set_unpaid($fuser, $notrigger = 0)
{
// phpcs:enable
$error = 0;
@@ -1430,7 +1428,7 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* set_cancel
*
@@ -1439,7 +1437,7 @@ class ExpenseReport extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function set_cancel($fuser, $detail, $notrigger = 0)
+ public function set_cancel($fuser, $detail, $notrigger = 0)
{
// phpcs:enable
$error = 0;
@@ -1499,7 +1497,7 @@ class ExpenseReport extends CommonObject
*
* @return string free ref
*/
- function getNextNumRef()
+ public function getNextNumRef()
{
global $langs, $conf;
$langs->load("trips");
@@ -1559,7 +1557,7 @@ class ExpenseReport extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs, $conf;
@@ -1615,7 +1613,7 @@ class ExpenseReport extends CommonObject
return $result;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update total of an expense report when you add a line.
*
@@ -1623,7 +1621,7 @@ class ExpenseReport extends CommonObject
* @param string $ligne_total_tva Amount of all taxes
* @return void
*/
- function update_totaux_add($ligne_total_ht, $ligne_total_tva)
+ public function update_totaux_add($ligne_total_ht, $ligne_total_tva)
{
// phpcs:enable
$this->total_ht = $this->total_ht + $ligne_total_ht;
@@ -1645,7 +1643,7 @@ class ExpenseReport extends CommonObject
endif;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update total of an expense report when you delete a line.
*
@@ -1653,7 +1651,7 @@ class ExpenseReport extends CommonObject
* @param string $ligne_total_tva Amount of all taxes
* @return void
*/
- function update_totaux_del($ligne_total_ht, $ligne_total_tva)
+ public function update_totaux_del($ligne_total_ht, $ligne_total_tva)
{
// phpcs:enable
$this->total_ht = $this->total_ht - $ligne_total_ht;
@@ -1689,7 +1687,7 @@ class ExpenseReport extends CommonObject
* @param int $type Type line
* @return int <0 if KO, >0 if OK
*/
- function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0)
+ public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0)
{
global $conf,$langs,$mysoc;
@@ -1783,7 +1781,7 @@ class ExpenseReport extends CommonObject
* @param string $seller seller, but actually he is unknown
* @return true or false
*/
- function checkRules($type = 0, $seller = '')
+ public function checkRules($type = 0, $seller = '')
{
global $user,$conf,$db,$langs;
@@ -1852,7 +1850,7 @@ class ExpenseReport extends CommonObject
*
* @return boolean true=applied, false=not applied
*/
- function applyOffset()
+ public function applyOffset()
{
global $conf;
@@ -1900,7 +1898,7 @@ class ExpenseReport extends CommonObject
*
* @return bool
*/
- function offsetAlreadyGiven()
+ public function offsetAlreadyGiven()
{
$sql = 'SELECT e.rowid FROM '.MAIN_DB_PREFIX.'expensereport e';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'expensereport_det d ON (e.rowid = d.fk_expensereport)';
@@ -1939,7 +1937,7 @@ class ExpenseReport extends CommonObject
* @param int $fk_c_exp_tax_cat id of category of car
* @return int <0 if KO, >0 if OK
*/
- function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat = 0)
+ public function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat = 0)
{
global $user, $mysoc;
@@ -2046,7 +2044,7 @@ class ExpenseReport extends CommonObject
* @param User $fuser User
* @return int <0 if KO, >0 if OK
*/
- function deleteline($rowid, $fuser = '')
+ public function deleteline($rowid, $fuser = '')
{
$this->db->begin();
@@ -2068,7 +2066,7 @@ class ExpenseReport extends CommonObject
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* periode_existe
*
@@ -2077,7 +2075,7 @@ class ExpenseReport extends CommonObject
* @param Date $date_fin End date
* @return int <0 if KO, >0 if OK
*/
- function periode_existe($fuser, $date_debut, $date_fin)
+ public function periode_existe($fuser, $date_debut, $date_fin)
{
// phpcs:enable
$sql = "SELECT rowid, date_debut, date_fin";
@@ -2086,8 +2084,7 @@ class ExpenseReport extends CommonObject
dol_syslog(get_class($this)."::periode_existe sql=".$sql);
$result = $this->db->query($sql);
- if($result)
- {
+ if ($result) {
$num_lignes = $this->db->num_rows($result); $i = 0;
if ($num_lignes>0)
@@ -2126,14 +2123,14 @@ class ExpenseReport extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of people with permission to validate expense reports.
* Search for permission "approve expense report"
*
* @return array Array of user ids
*/
- function fetch_users_approver_expensereport()
+ public function fetch_users_approver_expensereport()
{
// phpcs:enable
$users_validator=array();
@@ -2207,7 +2204,7 @@ class ExpenseReport extends CommonObject
* @param int $active Active or not
* @return array
*/
- function listOfTypes($active = 1)
+ public function listOfTypes($active = 1)
{
global $langs;
$ret=array();
@@ -2234,13 +2231,13 @@ class ExpenseReport extends CommonObject
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb pour le tableau de bord
*
* @return int <0 if KO, >0 if OK
*/
- function load_state_board()
+ public function load_state_board()
{
// phpcs:enable
global $conf;
@@ -2253,10 +2250,8 @@ class ExpenseReport extends CommonObject
$sql.= " AND ex.entity IN (".getEntity('expensereport').")";
$resql=$this->db->query($sql);
- if ($resql)
- {
- while ($obj=$this->db->fetch_object($resql))
- {
+ if ($resql) {
+ while ($obj=$this->db->fetch_object($resql)) {
$this->nb["expensereports"]=$obj->nb;
}
$this->db->free($resql);
@@ -2270,7 +2265,7 @@ class ExpenseReport extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
@@ -2278,16 +2273,16 @@ class ExpenseReport extends CommonObject
* @param string $option 'topay' or 'toapprove'
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
- function load_board($user, $option = 'topay')
+ public function load_board($user, $option = 'topay')
{
// phpcs:enable
global $conf, $langs;
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
- $now=dol_now();
+ $now=dol_now();
- $userchildids = $user->getAllChildIds(1);
+ $userchildids = $user->getAllChildIds(1);
$sql = "SELECT ex.rowid, ex.date_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
@@ -2484,17 +2479,17 @@ class ExpenseReportLine
public $projet_ref;
public $projet_title;
- var $vatrate;
- var $total_ht;
- var $total_tva;
- var $total_ttc;
+ public $vatrate;
+ public $total_ht;
+ public $total_tva;
+ public $total_ttc;
/**
* Constructor
*
* @param DoliDB $db Handlet database
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db= $db;
}
@@ -2505,7 +2500,7 @@ class ExpenseReportLine
* @param int $rowid Id of object to load
* @return int <0 if KO, >0 if OK
*/
- function fetch($rowid)
+ public function fetch($rowid)
{
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet, fde.date,';
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
@@ -2557,7 +2552,7 @@ class ExpenseReportLine
* @param bool $fromaddline false=keep default behavior, true=exclude the update_price() of parent object
* @return int <0 if KO, >0 if OK
*/
- function insert($notrigger = 0, $fromaddline = false)
+ public function insert($notrigger = 0, $fromaddline = false)
{
global $langs,$user,$conf;
@@ -2679,7 +2674,7 @@ class ExpenseReportLine
* @param User $fuser User
* @return int <0 if KO, >0 if OK
*/
- function update($fuser)
+ public function update($fuser)
{
global $fuser,$langs,$conf;
@@ -2758,7 +2753,6 @@ class ExpenseReportLine
}
-// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Retourne la liste deroulante des differents etats d'une note de frais.
* Les valeurs de la liste sont les id de la table c_expensereport_statuts
@@ -2771,7 +2765,6 @@ class ExpenseReportLine
*/
function select_expensereport_statut($selected = '', $htmlname = 'fk_statut', $useempty = 1, $useshortlabel = 0)
{
- // phpcs:enable
global $db, $langs;
$tmpep=new ExpenseReport($db);
@@ -2796,7 +2789,6 @@ function select_expensereport_statut($selected = '', $htmlname = 'fk_statut', $u
print '';
}
-// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Return list of types of notes with select value = id
*
@@ -2808,7 +2800,6 @@ function select_expensereport_statut($selected = '', $htmlname = 'fk_statut', $u
*/
function select_type_fees_id($selected = '', $htmlname = 'type', $showempty = 0, $active = 1)
{
- // phpcs:enable
global $db,$langs,$user;
$langs->load("trips");
diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php
index 0eec447d997..082e3ce016e 100644
--- a/htdocs/expensereport/class/expensereportstats.class.php
+++ b/htdocs/expensereport/class/expensereportstats.class.php
@@ -50,7 +50,7 @@ class ExpenseReportStats extends Stats
* @param int $userid Id user for filter
* @return void
*/
- function __construct($db, $socid = 0, $userid = 0)
+ public function __construct($db, $socid = 0, $userid = 0)
{
global $conf, $user;
@@ -89,7 +89,7 @@ class ExpenseReportStats extends Stats
*
* @return array Array of values
*/
- function getNbByYear()
+ public function getNbByYear()
{
$sql = "SELECT YEAR(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').") as dm, count(*)";
$sql.= " FROM ".$this->from;
@@ -107,7 +107,7 @@ class ExpenseReportStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
- function getNbByMonth($year, $format = 0)
+ public function getNbByMonth($year, $format = 0)
{
$sql = "SELECT MONTH(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').") as dm, count(*)";
$sql.= " FROM ".$this->from;
@@ -129,7 +129,7 @@ class ExpenseReportStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
- function getAmountByMonth($year, $format = 0)
+ public function getAmountByMonth($year, $format = 0)
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from;
@@ -149,7 +149,7 @@ class ExpenseReportStats extends Stats
* @param int $year Year to scan
* @return array Array of values
*/
- function getAverageByMonth($year)
+ public function getAverageByMonth($year)
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%m') as dm, avg(".$this->field.")";
$sql.= " FROM ".$this->from;
@@ -166,7 +166,7 @@ class ExpenseReportStats extends Stats
*
* @return array Array of values
*/
- function getAllByYear()
+ public function getAllByYear()
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL', 'e.date_create', 'e.date_valid').",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql.= " FROM ".$this->from;
@@ -174,6 +174,6 @@ class ExpenseReportStats extends Stats
$sql.= " GROUP BY year";
$sql.= $this->db->order('year', 'DESC');
- return $this->_getAllByYear($sql);
- }
+ return $this->_getAllByYear($sql);
+ }
}
diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php
index 655c148069e..f731638ea1d 100644
--- a/htdocs/expensereport/class/paymentexpensereport.class.php
+++ b/htdocs/expensereport/class/paymentexpensereport.class.php
@@ -92,7 +92,7 @@ class PaymentExpenseReport extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -104,7 +104,7 @@ class PaymentExpenseReport extends CommonObject
* @param User $user User making payment
* @return int <0 if KO, id of payment if OK
*/
- function create($user)
+ public function create($user)
{
global $conf, $langs;
@@ -113,8 +113,7 @@ class PaymentExpenseReport extends CommonObject
$now=dol_now();
// Validate parameters
- if (! $this->datepaid)
- {
+ if (! $this->datepaid) {
$this->error='ErrorBadValueForParameterCreatePaymentExpenseReport';
return -1;
}
@@ -184,10 +183,10 @@ class PaymentExpenseReport extends CommonObject
/**
* Load object in memory from database
*
- * @param int $id Id object
+ * @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
global $langs;
$sql = "SELECT";
@@ -258,7 +257,7 @@ class PaymentExpenseReport extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -266,7 +265,7 @@ class PaymentExpenseReport extends CommonObject
// Clean parameters
- if (isset($this->fk_expensereport)) $this->fk_expensereport=trim($this->fk_expensereport);
+ if (isset($this->fk_expensereport)) $this->fk_expensereport=trim($this->fk_expensereport);
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
@@ -341,11 +340,11 @@ class PaymentExpenseReport extends CommonObject
/**
* Delete object in database
*
- * @param User $user User that delete
+ * @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -370,13 +369,16 @@ class PaymentExpenseReport extends CommonObject
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ if (! $resql) {
+ $error++;
+ $this->errors[]="Error ".$this->db->lasterror();
+ }
}
- if (! $error)
- {
- if (! $notrigger)
- {
+ //if (! $error)
+ //{
+ // if (! $notrigger)
+ // {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
@@ -386,8 +388,8 @@ class PaymentExpenseReport extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
- }
- }
+ // }
+ //}
// Commit or rollback
if ($error)
@@ -415,7 +417,7 @@ class PaymentExpenseReport extends CommonObject
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
- function createFromClone($fromid)
+ public function createFromClone($fromid)
{
global $user,$langs;
@@ -444,11 +446,6 @@ class PaymentExpenseReport extends CommonObject
$error++;
}
- if (! $error)
- {
-
- }
-
unset($object->context['createfromclone']);
// End
@@ -471,12 +468,12 @@ class PaymentExpenseReport extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return '';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -484,13 +481,13 @@ class PaymentExpenseReport extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
- function LibStatut($statut, $mode = 0)
- {
+ public function LibStatut($statut, $mode = 0)
+ {
// phpcs:enable
- global $langs;
+ global $langs;
- return '';
- }
+ return '';
+ }
/**
@@ -500,7 +497,7 @@ class PaymentExpenseReport extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -530,7 +527,7 @@ class PaymentExpenseReport extends CommonObject
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
- function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
+ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $langs,$conf;
@@ -631,14 +628,14 @@ class PaymentExpenseReport extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update link between the expense report payment and the generated line in llx_bank
*
* @param int $id_bank Id if bank
* @return int >0 if OK, <=0 if KO
*/
- function update_fk_bank($id_bank)
+ public function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
@@ -659,11 +656,11 @@ class PaymentExpenseReport extends CommonObject
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @param int $maxlen Longueur max libelle
- * @return string Chaine avec URL
+ * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
+ * @param int $maxlen Longueur max libelle
+ * @return string Chaine avec URL
*/
- function getNomUrl($withpicto = 0, $maxlen = 0)
+ public function getNomUrl($withpicto = 0, $maxlen = 0)
{
global $langs;
@@ -691,8 +688,8 @@ class PaymentExpenseReport extends CommonObject
* @param int $id Payment id
* @return void
*/
- function info($id)
- {
+ public function info($id)
+ {
$sql = 'SELECT e.rowid, e.datec, e.fk_user_creat, e.fk_user_modif, e.tms';
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as e';
$sql.= ' WHERE e.rowid = '.$id;
@@ -718,7 +715,7 @@ class PaymentExpenseReport extends CommonObject
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
- $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->db->free($result);
@@ -727,5 +724,5 @@ class PaymentExpenseReport extends CommonObject
{
dol_print_error($this->db);
}
- }
+ }
}
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index a964f5f373a..7ce39a43354 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -35,28 +35,28 @@ class Export
*/
public $db;
- var $array_export_code=array(); // Tableau de "idmodule_numlot"
- var $array_export_module=array(); // Tableau de "nom de modules"
- var $array_export_label=array(); // Tableau de "libelle de lots"
- var $array_export_sql_start=array(); // Tableau des "requetes sql"
- var $array_export_sql_end=array(); // Tableau des "requetes sql"
- var $array_export_sql_order=array(); // Tableau des "requetes sql"
+ public $array_export_code=array(); // Tableau de "idmodule_numlot"
+ public $array_export_module=array(); // Tableau de "nom de modules"
+ public $array_export_label=array(); // Tableau de "libelle de lots"
+ public $array_export_sql_start=array(); // Tableau des "requetes sql"
+ public $array_export_sql_end=array(); // Tableau des "requetes sql"
+ public $array_export_sql_order=array(); // Tableau des "requetes sql"
- var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
- var $array_export_TypeFields=array(); // Tableau des listes de champ+Type de filtre
- var $array_export_FilterValue=array(); // Tableau des listes de champ+Valeur a filtrer
- var $array_export_entities=array(); // Tableau des listes de champ+alias a exporter
- var $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
- var $array_export_special=array(); // Tableau des operations speciales sur champ
- var $array_export_examplevalues=array(); // array with examples
+ public $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
+ public $array_export_TypeFields=array(); // Tableau des listes de champ+Type de filtre
+ public $array_export_FilterValue=array(); // Tableau des listes de champ+Valeur a filtrer
+ public $array_export_entities=array(); // Tableau des listes de champ+alias a exporter
+ public $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
+ public $array_export_special=array(); // Tableau des operations speciales sur champ
+ public $array_export_examplevalues=array(); // array with examples
- // To store export modules
- var $hexa;
- var $hexafiltervalue;
- var $datatoexport;
- var $model_name;
+ // To store export modules
+ public $hexa;
+ public $hexafiltervalue;
+ public $datatoexport;
+ public $model_name;
- var $sqlusedforexport;
+ public $sqlusedforexport;
/**
@@ -64,13 +64,13 @@ class Export
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
- $this->db=$db;
- }
+ public function __construct($db)
+ {
+ $this->db=$db;
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load an exportable dataset
*
@@ -78,12 +78,12 @@ class Export
* @param string $filter Load a particular dataset only
* @return int <0 if KO, >0 if OK
*/
- function load_arrays($user, $filter = '')
- {
+ public function load_arrays($user, $filter = '')
+ {
// phpcs:enable
- global $langs,$conf,$mysoc;
+ global $langs,$conf,$mysoc;
- dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
+ dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
$i=0;
@@ -206,10 +206,10 @@ class Export
}
return 1;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build the sql export request.
* Arrays this->array_export_xxx are already loaded for required datatoexport
@@ -219,8 +219,8 @@ class Export
* @param array $array_filterValue Filter records on array of value for fields
* @return string SQL String. Example "select s.rowid as r_rowid, s.status as s_status from ..."
*/
- function build_sql($indice, $array_selected, $array_filterValue)
- {
+ public function build_sql($indice, $array_selected, $array_filterValue)
+ {
// phpcs:enable
// Build the sql request
$sql=$this->array_export_sql_start[$indice];
@@ -273,7 +273,7 @@ class Export
return $sql;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build the conditionnal string from filter the query
*
@@ -282,8 +282,8 @@ class Export
* @param string $ValueField Value of the field for filter. Must not be ''
* @return string sql string of then field ex : "field='xxx'>"
*/
- function build_filterQuery($TypeField, $NameField, $ValueField)
- {
+ public function build_filterQuery($TypeField, $NameField, $ValueField)
+ {
// phpcs:enable
//print $TypeField." ".$NameField." ".$ValueField;
$InfoFieldList = explode(":", $TypeField);
@@ -352,23 +352,23 @@ class Export
}
/**
- * conditionDate
+ * conditionDate
*
* @param string $Field Field operand 1
* @param string $Value Value operand 2
* @param string $Sens Comparison operator
* @return string
*/
- function conditionDate($Field, $Value, $Sens)
- {
+ public function conditionDate($Field, $Value, $Sens)
+ {
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
return $Condition;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build an input field used to filter the query
*
@@ -377,8 +377,8 @@ class Export
* @param string $ValueField Initial value of the field to filter
* @return string html string of the input field ex : " "
*/
- function build_filterField($TypeField, $NameField, $ValueField)
- {
+ public function build_filterField($TypeField, $NameField, $ValueField)
+ {
// phpcs:enable
global $conf,$langs;
@@ -488,16 +488,16 @@ class Export
}
return $szFilterField;
- }
+ }
- /**
- * Build an input field used to filter the query
- *
- * @param string $TypeField Type of Field to filter
- * @return string html string of the input field ex : " "
- */
- function genDocFilter($TypeField)
- {
+ /**
+ * Build an input field used to filter the query
+ *
+ * @param string $TypeField Type of Field to filter
+ * @return string html string of the input field ex : " "
+ */
+ public function genDocFilter($TypeField)
+ {
global $langs;
$szMsg='';
@@ -523,7 +523,7 @@ class Export
return $szMsg;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build export file.
* File is built into directory $conf->export->dir_temp.'/'.$user->id
@@ -537,8 +537,8 @@ class Export
* @param string $sqlquery If set, transmit the sql request for select (otherwise, sql request is generated from arrays)
* @return int <0 if KO, >0 if OK
*/
- function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
- {
+ public function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
+ {
// phpcs:enable
global $conf,$langs;
@@ -698,7 +698,7 @@ class Export
* @param User $user Object user that save
* @return int <0 if KO, >0 if OK
*/
- function create($user)
+ public function create($user)
{
global $conf;
@@ -741,11 +741,11 @@ class Export
/**
* Load an export profil from database
*
- * @param int $id Id of profil to load
- * @return int <0 if KO, >0 if OK
+ * @param int $id Id of profil to load
+ * @return int <0 if KO, >0 if OK
*/
- function fetch($id)
- {
+ public function fetch($id)
+ {
$sql = 'SELECT em.rowid, em.label, em.type, em.field, em.filter';
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
$sql.= ' WHERE em.rowid = '.$id;
@@ -757,12 +757,12 @@ class Export
$obj = $this->db->fetch_object($result);
if ($obj)
{
- $this->id = $obj->rowid;
- $this->model_name = $obj->label;
- $this->datatoexport = $obj->type;
+ $this->id = $obj->rowid;
+ $this->model_name = $obj->label;
+ $this->datatoexport = $obj->type;
- $this->hexa = $obj->field;
- $this->hexafiltervalue = $obj->filter;
+ $this->hexa = $obj->field;
+ $this->hexafiltervalue = $obj->filter;
return 1;
}
@@ -787,7 +787,7 @@ class Export
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -835,15 +835,15 @@ class Export
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output list all export models
* TODO Move this into a class htmlxxx.class.php
*
* @return void
*/
- function list_export_model()
- {
+ public function list_export_model()
+ {
// phpcs:enable
global $conf, $langs;
@@ -886,9 +886,8 @@ class Export
$i++;
}
- }
- else {
- dol_print_error($this->db);
- }
- }
+ } else {
+ dol_print_error($this->db);
+ }
+ }
}
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index 942ec66b002..4b81697be66 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -428,9 +428,6 @@ if ($step == 1 || ! $datatoexport)
{
llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones');
- /*
- * Affichage onglets
- */
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
@@ -438,20 +435,13 @@ if ($step == 1 || ! $datatoexport)
$hselected=$h;
$h++;
- /*
- $head[$h][0] = '';
- $head[$h][1] = $langs->trans("Step")." 2";
- $h++;
- */
-
dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -1);
- print '';
-
print ''.$langs->trans("SelectExportDataSet").'
';
// Affiche les modules d'exports
+ print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
';
print '';
print ''.$langs->trans("Module").' ';
@@ -490,8 +480,7 @@ if ($step == 1 || ! $datatoexport)
print ' '.$langs->trans("NoExportableData").' ';
}
print '
';
-
- print '
';
+ print '';
print '';
}
@@ -500,10 +489,6 @@ if ($step == 2 && $datatoexport)
{
llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones');
-
- /*
- * Affichage onglets
- */
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
@@ -515,11 +500,12 @@ if ($step == 2 && $datatoexport)
$hselected=$h;
$h++;
- dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -1);
+ dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -2);
print '';
print '
';
- print '
';
+
+ print '';
// Module
print ''.$langs->trans("Module").' ';
@@ -551,24 +537,25 @@ if ($step == 2 && $datatoexport)
print ' ';
print ' ';
print ' ';
- print '';
+ print '';
print '';
+ print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
';
-
+ print '
';
/*
* Barre d'action
@@ -697,9 +684,6 @@ if ($step == 3 && $datatoexport)
llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones');
- /*
- * Affichage onglets
- */
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
@@ -715,11 +699,11 @@ if ($step == 3 && $datatoexport)
$hselected=$h;
$h++;
- dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -1);
+ dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -2);
print '';
print '
';
- print '
';
+ print '';
// Module
print ''.$langs->trans("Module").' ';
@@ -754,11 +738,13 @@ if ($step == 3 && $datatoexport)
print ' ';
// Combo list of export models
- print $langs->trans("SelectFilterFields").' ';
+ print ''.$langs->trans("SelectFilterFields").' ';
// un formulaire en plus pour recuperer les filtres
print '