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..7bda83efc83 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; diff --git a/htdocs/core/modules/export/export_excelnew.modules.php b/htdocs/core/modules/export/export_excelnew.modules.php index f6a54b040d3..1103dcc0dbe 100644 --- a/htdocs/core/modules/export/export_excelnew.modules.php +++ b/htdocs/core/modules/export/export_excelnew.modules.php @@ -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/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/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 731695d8d27..d4018f76895 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -107,7 +107,7 @@ class ProductFournisseur extends Product * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $langs; @@ -118,14 +118,14 @@ class ProductFournisseur extends Product - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Remove all prices for this couple supplier-product * * @param int $id_fourn Supplier Id * @return int < 0 if error, > 0 if ok */ - function remove_fournisseur($id_fourn) + public function remove_fournisseur($id_fourn) { // phpcs:enable $ok=1; @@ -1056,7 +1056,7 @@ class ProductFournisseur extends Product return $result; } - + /** * Private function to log price history * diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 530287084ca..8e68afd6001 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -191,8 +191,8 @@ class Establishment extends CommonObject { global $langs; - // Check parameters - if (empty($this->name)) + // Check parameters + if (empty($this->name)) { $this->error='ErrorBadParameter'; return -1; @@ -391,7 +391,7 @@ class Establishment extends CommonObject dol_print_error($this->db); } } - + /** * Get on record Establishment * @@ -447,7 +447,7 @@ class Establishment extends CommonObject if ($withpicto != 2) $result.=$link.$this->name.$linkend; return $result; } - + /** * Return clicable name (with picto eventually) * @@ -460,7 +460,7 @@ class Establishment extends CommonObject global $langs, $conf; $result=''; - + $obj = $this->getEstablishment(($id>0)?$id:$conf->entity); $link = ''; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 59a110f5090..aebf983b541 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -27,21 +27,21 @@ */ class Import { - var $array_import_module; - var $array_import_perms; - var $array_import_icon; - var $array_import_code; - var $array_import_label; - var $array_import_tables; - var $array_import_tables_creator; - var $array_import_fields; - var $array_import_fieldshidden; - var $array_import_entities; - var $array_import_regex; - var $array_import_updatekeys; - var $array_import_examplevalues; - var $array_import_convertvalue; - var $array_import_run_sql_after; + public $array_import_module; + public $array_import_perms; + public $array_import_icon; + public $array_import_code; + public $array_import_label; + public $array_import_tables; + public $array_import_tables_creator; + public $array_import_fields; + public $array_import_fieldshidden; + public $array_import_entities; + public $array_import_regex; + public $array_import_updatekeys; + public $array_import_examplevalues; + public $array_import_convertvalue; + public $array_import_run_sql_after; /** * @var string Error code (or message) @@ -54,18 +54,18 @@ class Import public $errors = array(); - /** - * 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 + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load description int this->array_import_module, this->array_import_fields, ... of an importable dataset * @@ -73,7 +73,7 @@ class Import * @param string $filter Load a particular dataset only. Index will start to 0. * @return int <0 if KO, >0 if OK */ - function load_arrays($user, $filter = '') + public function load_arrays($user, $filter = '') { // phpcs:enable global $langs,$conf; @@ -185,7 +185,7 @@ class Import - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Build an import example file. * Arrays this->array_export_xxx are already loaded for required datatoexport @@ -196,7 +196,7 @@ class Import * @param string $datatoimport Dataset to import * @return string <0 if KO, >0 if OK */ - function build_example_file($model, $headerlinefields, $contentlinevalues, $datatoimport) + public function build_example_file($model, $headerlinefields, $contentlinevalues, $datatoimport) { // phpcs:enable global $conf,$langs; @@ -236,7 +236,7 @@ class Import * @param User $user Object user that save * @return int <0 if KO, >0 if OK */ - function create($user) + public function create($user) { global $conf; @@ -276,7 +276,7 @@ class Import * @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.field, em.label, em.type'; $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; @@ -316,7 +316,7 @@ class Import * @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; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index e85f33b18a8..49904ef44f5 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -73,7 +73,7 @@ class Livraison extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; $this->lines = array(); @@ -91,7 +91,7 @@ class Livraison extends CommonObject * @param User $user Objet du user qui cree * @return int <0 si erreur, id livraison cree si ok */ - function create($user) + public function create($user) { global $conf; @@ -227,7 +227,7 @@ class Livraison extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create a line * @@ -237,8 +237,8 @@ class Livraison extends CommonObject * @param string $description Description * @return int <0 if KO, >0 if OK */ - function create_line($origin_id, $qty, $fk_product, $description) - { + public function create_line($origin_id, $qty, $fk_product, $description) + { // phpcs:enable $error = 0; $idprod = $fk_product; @@ -269,7 +269,7 @@ class Livraison extends CommonObject * @param int $id Id of object to load * @return integer */ - function fetch($id) + public function fetch($id) { global $conf; @@ -353,7 +353,7 @@ class Livraison extends CommonObject * @param User $user Object user that validate * @return int */ - function valid($user) + public function valid($user) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -499,7 +499,7 @@ class Livraison extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Creating the delivery slip from an existing shipment * @@ -507,7 +507,7 @@ class Livraison extends CommonObject * @param int $sending_id Id of the expedition that serves as a model * @return integer */ - function create_from_sending($user, $sending_id) + public function create_from_sending($user, $sending_id) { // phpcs:enable $expedition = new Expedition($this->db); @@ -546,7 +546,7 @@ class Livraison extends CommonObject return $this->create($user); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update a livraison line (only extrafields) * @@ -554,7 +554,7 @@ class Livraison extends CommonObject * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ - function update_line($id, $array_options = 0) + public function update_line($id, $array_options = 0) { // phpcs:enable global $conf; @@ -586,7 +586,7 @@ class Livraison extends CommonObject * @param int $qty Qty * @return void */ - function addline($origin_id, $qty) + public function addline($origin_id, $qty) { $num = count($this->lines); $line = new LivraisonLigne($this->db); @@ -603,7 +603,7 @@ class Livraison extends CommonObject * @param int $lineid Line id * @return integer|null */ - function deleteline($lineid) + public function deleteline($lineid) { if ($this->statut == 0) { @@ -628,7 +628,7 @@ class Livraison extends CommonObject * * @return integer */ - function delete() + public function delete() { global $conf, $langs, $user; @@ -716,7 +716,7 @@ class Livraison extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1) { global $langs; @@ -745,13 +745,13 @@ class Livraison extends CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load lines * * @return void */ - function fetch_lines() + public function fetch_lines() { // phpcs:enable $this->lines = array(); @@ -811,12 +811,12 @@ class Livraison extends CommonObject * @param int $mode Mode * @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 /** * Renvoi le libelle d'un statut donne * @@ -824,7 +824,7 @@ class Livraison 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 */ - function LibStatut($statut, $mode) + public function LibStatut($statut, $mode) { // phpcs:enable global $langs; @@ -863,7 +863,7 @@ class Livraison extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user,$langs,$conf; @@ -918,7 +918,7 @@ class Livraison extends CommonObject * @return array Product remaining to be delivered * TODO use new function */ - function getRemainingDelivered() + public function getRemainingDelivered() { global $langs; @@ -989,7 +989,7 @@ class Livraison extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the planned delivery date * @@ -997,7 +997,7 @@ class Livraison 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) @@ -1087,13 +1087,13 @@ class LivraisonLigne extends CommonObjectLine */ public $db; - // From llx_expeditiondet - var $qty; - var $qty_asked; - var $qty_shipped; - var $price; - var $fk_product; - var $origin_id; + // From llx_expeditiondet + public $qty; + public $qty_asked; + public $qty_shipped; + public $price; + public $fk_product; + public $origin_id; /** * @var string delivery note lines label @@ -1129,13 +1129,13 @@ class LivraisonLigne extends CommonObjectLine */ public $table_element='livraisondet'; - /** - * 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; + } } diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 38abdba64bc..ce527ee7258 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -65,7 +65,7 @@ class Dolresource extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -77,7 +77,7 @@ class Dolresource 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, $hookmanager; $error=0; @@ -181,7 +181,7 @@ class Dolresource extends CommonObject * @param string $ref Ref of object * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref = '') + public function fetch($id, $ref = '') { global $langs; $sql = "SELECT"; @@ -339,14 +339,14 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load object in memory from database * * @param int $id id object * @return int <0 if KO, >0 if OK */ - function fetch_element_resource($id) + public function fetch_element_resource($id) { // phpcs:enable global $langs; @@ -484,7 +484,7 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load resource objects into $this->lines * @@ -495,7 +495,7 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - function fetch_all($sortorder, $sortfield, $limit, $offset, $filter = '') + public function fetch_all($sortorder, $sortfield, $limit, $offset, $filter = '') { // phpcs:enable global $conf; @@ -581,7 +581,7 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load all objects into $this->lines * @@ -592,7 +592,7 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter = '') + public function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter = '') { // phpcs:enable global $conf; @@ -659,7 +659,7 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load all objects into $this->lines * @@ -670,7 +670,7 @@ class Dolresource extends CommonObject * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - function fetch_all_used($sortorder, $sortfield, $limit, $offset = 1, $filter = '') + public function fetch_all_used($sortorder, $sortfield, $limit, $offset = 1, $filter = '') { // phpcs:enable global $conf; @@ -738,7 +738,7 @@ class Dolresource extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch all resources available, declared by modules * Load available resource in array $this->available_resources @@ -747,7 +747,7 @@ class Dolresource extends CommonObject * @deprecated, remplaced by hook getElementResources * @see getElementResources() */ - function fetch_all_available() + public function fetch_all_available() { // phpcs:enable global $conf; @@ -761,7 +761,7 @@ class Dolresource extends CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update element resource into database * @@ -769,7 +769,7 @@ class Dolresource extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update_element_resource($user = null, $notrigger = 0) + public function update_element_resource($user = null, $notrigger = 0) { // phpcs:enable global $conf, $langs; @@ -839,7 +839,7 @@ class Dolresource extends CommonObject * @param string $resource_type Type * @return array Aray of resources */ - function getElementResources($element, $element_id, $resource_type = '') + public function getElementResources($element, $element_id, $resource_type = '') { // Links beetween objects are stored in this table $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; @@ -878,7 +878,7 @@ class Dolresource extends CommonObject * * @return int */ - function fetchElementResources($element, $element_id) + public function fetchElementResources($element, $element_id) { $resources = $this->getElementResources($element, $element_id); $i=0; @@ -890,13 +890,13 @@ class Dolresource extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load in cache resource type code (setup in dictionary) * * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko */ - function load_cache_code_type_resource() + public function load_cache_code_type_resource() { // phpcs:enable global $langs; @@ -941,7 +941,7 @@ class Dolresource extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0) { global $langs; @@ -973,12 +973,12 @@ class Dolresource 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 * @@ -986,7 +986,7 @@ class Dolresource 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/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index c850faaa5eb..f9fd60c3566 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -54,13 +54,13 @@ class FormResource * * @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 html form to select a resource * @@ -76,7 +76,7 @@ class FormResource * @param int $limit Limit number of answers * @return string HTML string with */ - function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20) + public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20) { // phpcs:enable global $conf,$user,$langs; @@ -157,7 +157,7 @@ class FormResource return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return html list of tickets type * @@ -170,7 +170,7 @@ class FormResource * @param int $maxlength Max length of label * @return void */ - function select_types_resource($selected = '', $htmlname = 'type_resource', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0) + public function select_types_resource($selected = '', $htmlname = 'type_resource', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0) { // phpcs:enable global $langs,$user;