add visibility

This commit is contained in:
Frédéric FRANCE
2019-02-28 22:44:12 +01:00
parent 7e31ca48d8
commit 0022c4fe72
13 changed files with 301 additions and 303 deletions

View File

@@ -62,7 +62,7 @@ class ExportCsv extends ModeleExports
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf, $langs; global $conf, $langs;
$this->db = $db; $this->db = $db;
@@ -89,7 +89,7 @@ class ExportCsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverId() public function getDriverId()
{ {
return $this->id; return $this->id;
} }
@@ -99,7 +99,7 @@ class ExportCsv extends ModeleExports
* *
* @return string Return driver label * @return string Return driver label
*/ */
function getDriverLabel() public function getDriverLabel()
{ {
return $this->label; return $this->label;
} }
@@ -109,7 +109,7 @@ class ExportCsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverDesc() public function getDriverDesc()
{ {
return $this->desc; return $this->desc;
} }
@@ -119,7 +119,7 @@ class ExportCsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverExtension() public function getDriverExtension()
{ {
return $this->extension; return $this->extension;
} }
@@ -129,7 +129,7 @@ class ExportCsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverVersion() public function getDriverVersion()
{ {
return $this->version; return $this->version;
} }
@@ -139,7 +139,7 @@ class ExportCsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibLabel() public function getLibLabel()
{ {
return $this->label_lib; return $this->label_lib;
} }
@@ -149,13 +149,13 @@ class ExportCsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibVersion() public function getLibVersion()
{ {
return $this->version_lib; return $this->version_lib;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Open output file * Open output file
* *
@@ -163,7 +163,7 @@ class ExportCsv extends ModeleExports
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function open_file($file, $outputlangs) public function open_file($file, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -184,21 +184,21 @@ class ExportCsv extends ModeleExports
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output header into file * Output header into file
* *
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_header($outputlangs) public function write_header($outputlangs)
{ {
// phpcs:enable // phpcs:enable
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output title line into file * Output title line into file
* *
@@ -208,7 +208,7 @@ class ExportCsv extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; 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 * Output record line into file
* *
@@ -244,7 +244,7 @@ class ExportCsv extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; global $conf;
@@ -288,26 +288,26 @@ class ExportCsv extends ModeleExports
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output footer into file * Output footer into file
* *
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_footer($outputlangs) public function write_footer($outputlangs)
{ {
// phpcs:enable // phpcs:enable
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close file handle * Close file handle
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function close_file() public function close_file()
{ {
// phpcs:enable // phpcs:enable
fclose($this->handle); fclose($this->handle);

View File

@@ -70,17 +70,17 @@ class ExportExcel extends ModeleExports
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf, $langs; global $conf, $langs;
$this->db = $db; $this->db = $db;
$this->id='excel'; // Same value then xxx in file name export_xxx.modules.php $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->desc = $langs->trans('Excel95FormatDesc');
$this->extension='xls'; // Extension for generated file by this driver $this->extension='xls'; // Extension for generated file by this driver
$this->picto='mime/xls'; // Picto $this->picto='mime/xls'; // Picto
$this->version='1.30'; // Driver version $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) $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 * @return string
*/ */
function getDriverId() public function getDriverId()
{ {
return $this->id; return $this->id;
} }
@@ -122,7 +122,7 @@ class ExportExcel extends ModeleExports
* *
* @return string Return driver label * @return string Return driver label
*/ */
function getDriverLabel() public function getDriverLabel()
{ {
return $this->label; return $this->label;
} }
@@ -132,7 +132,7 @@ class ExportExcel extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverDesc() public function getDriverDesc()
{ {
return $this->desc; return $this->desc;
} }
@@ -142,7 +142,7 @@ class ExportExcel extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverExtension() public function getDriverExtension()
{ {
return $this->extension; return $this->extension;
} }
@@ -152,7 +152,7 @@ class ExportExcel extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverVersion() public function getDriverVersion()
{ {
return $this->version; return $this->version;
} }
@@ -162,7 +162,7 @@ class ExportExcel extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibLabel() public function getLibLabel()
{ {
return $this->label_lib; return $this->label_lib;
} }
@@ -172,13 +172,13 @@ class ExportExcel extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibVersion() public function getLibVersion()
{ {
return $this->version_lib; return $this->version_lib;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Open output file * Open output file
* *
@@ -186,7 +186,7 @@ class ExportExcel extends ModeleExports
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function open_file($file, $outputlangs) public function open_file($file, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $user,$conf,$langs; global $user,$conf,$langs;
@@ -202,8 +202,7 @@ class ExportExcel extends ModeleExports
$ret=1; $ret=1;
$outputlangs->load("exports"); $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_workbookbig.inc.php';
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
@@ -249,14 +248,14 @@ class ExportExcel extends ModeleExports
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write header * Write header
* *
* @param Translate $outputlangs Object lang to translate values * @param Translate $outputlangs Object lang to translate values
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_header($outputlangs) public function write_header($outputlangs)
{ {
// phpcs:enable // phpcs:enable
//$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO //$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 * Output title line into file
* *
@@ -275,7 +274,7 @@ class ExportExcel extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; global $conf;
@@ -322,7 +321,7 @@ class ExportExcel extends ModeleExports
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output record line into file * Output record line into file
* *
@@ -332,7 +331,7 @@ class ExportExcel extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; global $conf;
@@ -442,27 +441,27 @@ class ExportExcel extends ModeleExports
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write footer * Write footer
* *
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_footer($outputlangs) public function write_footer($outputlangs)
{ {
// phpcs:enable // phpcs:enable
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close Excel file * Close Excel file
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function close_file() public function close_file()
{ {
// phpcs:enable // phpcs:enable
global $conf; 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 * @param string $newvalue String to clean
* @return string Value cleaned * @return string Value cleaned
*/ */
function excel_clean($newvalue) public function excel_clean($newvalue)
{ {
// phpcs:enable // phpcs:enable
// Rule Dolibarr: No HTML // Rule Dolibarr: No HTML
$newvalue=dol_string_nohtmltag($newvalue); $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 * @param int $c Column position
* @return string Letter * @return string Letter
*/ */
function column2Letter($c) public function column2Letter($c)
{ {
$c = intval($c); $c = intval($c);
if ($c <= 0) return ''; if ($c <= 0) {
return '';
}
while ($c != 0) while ($c != 0) {
{ $p = ($c - 1) % 26;
$p = ($c - 1) % 26; $c = intval(($c - $p) / 26);
$c = intval(($c - $p) / 26); $letter = chr(65 + $p) . $letter;
$letter = chr(65 + $p) . $letter; }
}
return $letter; return $letter;
} }
} }

View File

@@ -70,7 +70,7 @@ class ExportExcel2007 extends ExportExcel
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf, $langs; global $conf, $langs;
$this->db = $db; $this->db = $db;

View File

@@ -72,7 +72,7 @@ class ExportExcelnew extends ModeleExports
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf, $langs; global $conf, $langs;
$this->db = $db; $this->db = $db;
@@ -105,7 +105,7 @@ class ExportExcelnew extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverId() public function getDriverId()
{ {
return $this->id; return $this->id;
} }
@@ -115,7 +115,7 @@ class ExportExcelnew extends ModeleExports
* *
* @return string Return driver label * @return string Return driver label
*/ */
function getDriverLabel() public function getDriverLabel()
{ {
return $this->label; return $this->label;
} }
@@ -125,7 +125,7 @@ class ExportExcelnew extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverDesc() public function getDriverDesc()
{ {
return $this->desc; return $this->desc;
} }
@@ -135,7 +135,7 @@ class ExportExcelnew extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverExtension() public function getDriverExtension()
{ {
return $this->extension; return $this->extension;
} }
@@ -145,7 +145,7 @@ class ExportExcelnew extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverVersion() public function getDriverVersion()
{ {
return $this->version; return $this->version;
} }
@@ -155,7 +155,7 @@ class ExportExcelnew extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibLabel() public function getLibLabel()
{ {
return $this->label_lib; return $this->label_lib;
} }
@@ -165,13 +165,13 @@ class ExportExcelnew extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibVersion() public function getLibVersion()
{ {
return $this->version_lib; return $this->version_lib;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Open output file * Open output file
* *
@@ -179,7 +179,7 @@ class ExportExcelnew extends ModeleExports
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function open_file($file, $outputlangs) public function open_file($file, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $user,$conf,$langs; global $user,$conf,$langs;
@@ -227,14 +227,14 @@ class ExportExcelnew extends ModeleExports
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write header * Write header
* *
* @param Translate $outputlangs Object lang to translate values * @param Translate $outputlangs Object lang to translate values
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_header($outputlangs) public function write_header($outputlangs)
{ {
// phpcs:enable // phpcs:enable
//$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO //$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 * Output title line into file
* *
@@ -253,7 +253,7 @@ class ExportExcelnew extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; global $conf;
@@ -286,7 +286,7 @@ class ExportExcelnew extends ModeleExports
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output record line into file * Output record line into file
* *
@@ -296,7 +296,7 @@ class ExportExcelnew extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; 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)) 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); $newvalue=dol_stringtotime($newvalue);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($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(); $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd'); $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)) 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); $newvalue=dol_stringtotime($newvalue);
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($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(); $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss'); $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
} }
else else
{ {
if ($typefield == 'Text' || $typefield == 'TextAuto') if ($typefield == 'Text' || $typefield == 'TextAuto')
{ {
//$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING); //$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); $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue);
$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate(); $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@'); $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
$this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT); $this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
} }
else else
{ {
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue); $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
} }
} }
$this->col++; $this->col++;
} }
@@ -367,48 +367,48 @@ class ExportExcelnew extends ModeleExports
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Write footer * Write footer
* *
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_footer($outputlangs) public function write_footer($outputlangs)
{ {
// phpcs:enable // phpcs:enable
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close Excel file * Close Excel file
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function close_file() public function close_file()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
$objWriter = new Xlsx($this->workbook); $objWriter = new Xlsx($this->workbook);
$objWriter->save($this->file); $objWriter->save($this->file);
$this->workbook->disconnectWorksheets(); $this->workbook->disconnectWorksheets();
unset($this->workbook); unset($this->workbook);
return 1; return 1;
} }
// 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 * @param string $newvalue String to clean
* @return string Value cleaned * @return string Value cleaned
*/ */
function excel_clean($newvalue) public function excel_clean($newvalue)
{ {
// phpcs:enable // phpcs:enable
// Rule Dolibarr: No HTML // Rule Dolibarr: No HTML
@@ -424,14 +424,13 @@ class ExportExcelnew extends ModeleExports
* @param int $c Column position * @param int $c Column position
* @return string Letter * @return string Letter
*/ */
function column2Letter($c) public function column2Letter($c)
{ {
$c = intval($c); $c = intval($c);
if ($c <= 0) return ''; if ($c <= 0) return '';
while ($c != 0) while ($c != 0) {
{
$p = ($c - 1) % 26; $p = ($c - 1) % 26;
$c = intval(($c - $p) / 26); $c = intval(($c - $p) / 26);
$letter = chr(65 + $p) . $letter; $letter = chr(65 + $p) . $letter;

View File

@@ -59,11 +59,11 @@ class ExportTsv extends ModeleExports
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf, $langs; global $conf, $langs;
$this->db = $db; $this->db = $db;
@@ -85,7 +85,7 @@ class ExportTsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverId() public function getDriverId()
{ {
return $this->id; return $this->id;
} }
@@ -95,7 +95,7 @@ class ExportTsv extends ModeleExports
* *
* @return string Return driver label * @return string Return driver label
*/ */
function getDriverLabel() public function getDriverLabel()
{ {
return $this->label; return $this->label;
} }
@@ -105,7 +105,7 @@ class ExportTsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverDesc() public function getDriverDesc()
{ {
return $this->desc; return $this->desc;
} }
@@ -115,7 +115,7 @@ class ExportTsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverExtension() public function getDriverExtension()
{ {
return $this->extension; return $this->extension;
} }
@@ -125,7 +125,7 @@ class ExportTsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getDriverVersion() public function getDriverVersion()
{ {
return $this->version; return $this->version;
} }
@@ -135,7 +135,7 @@ class ExportTsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibLabel() public function getLibLabel()
{ {
return $this->label_lib; return $this->label_lib;
} }
@@ -145,21 +145,21 @@ class ExportTsv extends ModeleExports
* *
* @return string * @return string
*/ */
function getLibVersion() public function getLibVersion()
{ {
return $this->version_lib; return $this->version_lib;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Open output file * Open output file
* *
* @param string $file Path of filename to generate * @param string $file Path of filename to generate
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function open_file($file, $outputlangs) public function open_file($file, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -180,21 +180,21 @@ class ExportTsv extends ModeleExports
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output header into file * Output header into file
* *
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_header($outputlangs) public function write_header($outputlangs)
{ {
// phpcs:enable // phpcs:enable
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output title line into file * Output title line into file
* *
@@ -203,8 +203,8 @@ class ExportTsv extends ModeleExports
* @param Translate $outputlangs Object lang to translate values * @param Translate $outputlangs Object lang to translate values
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
foreach($array_selected_sorted as $code => $value) 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 * Output record line into file
* *
@@ -229,7 +229,7 @@ class ExportTsv extends ModeleExports
* @param array $array_types Array with types of fields * @param array $array_types Array with types of fields
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; global $conf;
@@ -263,33 +263,33 @@ class ExportTsv extends ModeleExports
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output footer into file * Output footer into file
* *
* @param Translate $outputlangs Output language object * @param Translate $outputlangs Output language object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function write_footer($outputlangs) public function write_footer($outputlangs)
{ {
// phpcs:enable // phpcs:enable
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close file handle * Close file handle
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function close_file() public function close_file()
{ {
// phpcs:enable // phpcs:enable
fclose($this->handle); fclose($this->handle);
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Clean a cell to respect rules of TSV file cells * 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 * @param string $charset Input AND Output character set
* @return string Value cleaned * @return string Value cleaned
*/ */
function tsv_clean($newvalue, $charset) public function tsv_clean($newvalue, $charset)
{ {
// phpcs:enable // phpcs:enable
// Rule Dolibarr: No HTML // Rule Dolibarr: No HTML
$newvalue=dol_string_nohtmltag($newvalue, 1, $charset); $newvalue=dol_string_nohtmltag($newvalue, 1, $charset);
// Rule 1 TSV: No CR, LF in cells // Rule 1 TSV: No CR, LF in cells
$newvalue=str_replace("\r", '', $newvalue); $newvalue=str_replace("\r", '', $newvalue);
$newvalue=str_replace("\n", '\n', $newvalue); $newvalue=str_replace("\n", '\n', $newvalue);
// Rule 2 TSV: If value contains tab, we must replace by space // Rule 2 TSV: If value contains tab, we must replace by space
if (preg_match('/'.$this->separator.'/', $newvalue)) if (preg_match('/'.$this->separator.'/', $newvalue)) {
{ $newvalue=str_replace("\t", " ", $newvalue);
$newvalue=str_replace("\t", " ", $newvalue); }
}
return $newvalue; return $newvalue;
} }

View File

@@ -44,7 +44,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
public $libversion=array(); public $libversion=array();
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into memory list of available export format * 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 * @param integer $maxfilenamelength Max length of value to show
* @return array List of templates (same content than array this->driverlabel) * @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 // phpcs:enable
dol_syslog(get_class($this)."::liste_modeles"); 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 * @param string $key Key of driver
* @return string Picto string * @return string Picto string
*/ */
function getPictoForKey($key) public function getPictoForKey($key)
{ {
return $this->picto[$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 * @param string $key Key of driver
* @return string Label * @return string Label
*/ */
function getDriverLabelForKey($key) public function getDriverLabelForKey($key)
{ {
return $this->driverlabel[$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 * @param string $key Key of driver
* @return string Description * @return string Description
*/ */
function getDriverDescForKey($key) public function getDriverDescForKey($key)
{ {
return $this->driverdesc[$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 * @param string $key Key of driver
* @return string Driver version * @return string Driver version
*/ */
function getDriverVersionForKey($key) public function getDriverVersionForKey($key)
{ {
return $this->driverversion[$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 * @param string $key Key of driver
* @return string Label of library * @return string Label of library
*/ */
function getLibLabelForKey($key) public function getLibLabelForKey($key)
{ {
return $this->liblabel[$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 * @param string $key Key of driver
* @return string Version of library * @return string Version of library
*/ */
function getLibVersionForKey($key) public function getLibVersionForKey($key)
{ {
return $this->libversion[$key]; return $this->libversion[$key];
} }

View File

@@ -31,12 +31,12 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modIFTTT extends DolibarrModules class modIFTTT extends DolibarrModules
{ {
/** /**
* Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $langs,$conf; global $langs,$conf;
$this->db = $db; $this->db = $db;
@@ -116,12 +116,12 @@ class modIFTTT extends DolibarrModules
$this->tabs = array(); $this->tabs = array();
// Dictionaries // Dictionaries
if (! isset($conf->ifttt->enabled)) if (! isset($conf->ifttt->enabled))
{ {
$conf->ifttt=new stdClass(); $conf->ifttt=new stdClass();
$conf->ifttt->enabled=0; $conf->ifttt->enabled=0;
} }
$this->dictionaries=array(); $this->dictionaries=array();
// Boxes // Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box. // 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. * Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories * It also creates data directories
* *
* @param string $options Options when enabling module ('', 'noboxes') * @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 = '')
{ {
$sql = array(); $sql = array();
@@ -230,22 +230,22 @@ class modIFTTT extends DolibarrModules
return $this->_init($sql, $options); return $this->_init($sql, $options);
} }
/** /**
* Function called when module is disabled. * Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database. * Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted. * Data directories are not deleted.
* *
* @param string $options Options when enabling module ('', 'noboxes') * @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 remove($options = '') public function remove($options = '')
{ {
// Remove old constants with entity fields different of 0 // Remove old constants with entity fields different of 0
$sql = array( $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('MAIN_MODULE_IFTTT', 1),
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('IFTTT_PRODUCTION_MODE', 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);
} }
} }

View File

@@ -107,7 +107,7 @@ class ProductFournisseur extends Product
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $langs; 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 * Remove all prices for this couple supplier-product
* *
* @param int $id_fourn Supplier Id * @param int $id_fourn Supplier Id
* @return int < 0 if error, > 0 if ok * @return int < 0 if error, > 0 if ok
*/ */
function remove_fournisseur($id_fourn) public function remove_fournisseur($id_fourn)
{ {
// phpcs:enable // phpcs:enable
$ok=1; $ok=1;
@@ -1056,7 +1056,7 @@ class ProductFournisseur extends Product
return $result; return $result;
} }
/** /**
* Private function to log price history * Private function to log price history
* *

View File

@@ -191,8 +191,8 @@ class Establishment extends CommonObject
{ {
global $langs; global $langs;
// Check parameters // Check parameters
if (empty($this->name)) if (empty($this->name))
{ {
$this->error='ErrorBadParameter'; $this->error='ErrorBadParameter';
return -1; return -1;
@@ -391,7 +391,7 @@ class Establishment extends CommonObject
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
/** /**
* Get on record Establishment * Get on record Establishment
* *
@@ -447,7 +447,7 @@ class Establishment extends CommonObject
if ($withpicto != 2) $result.=$link.$this->name.$linkend; if ($withpicto != 2) $result.=$link.$this->name.$linkend;
return $result; return $result;
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
@@ -460,7 +460,7 @@ class Establishment extends CommonObject
global $langs, $conf; global $langs, $conf;
$result=''; $result='';
$obj = $this->getEstablishment(($id>0)?$id:$conf->entity); $obj = $this->getEstablishment(($id>0)?$id:$conf->entity);
$link = '<a href="'.DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$obj->rowid.'">'; $link = '<a href="'.DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$obj->rowid.'">';

View File

@@ -27,21 +27,21 @@
*/ */
class Import class Import
{ {
var $array_import_module; public $array_import_module;
var $array_import_perms; public $array_import_perms;
var $array_import_icon; public $array_import_icon;
var $array_import_code; public $array_import_code;
var $array_import_label; public $array_import_label;
var $array_import_tables; public $array_import_tables;
var $array_import_tables_creator; public $array_import_tables_creator;
var $array_import_fields; public $array_import_fields;
var $array_import_fieldshidden; public $array_import_fieldshidden;
var $array_import_entities; public $array_import_entities;
var $array_import_regex; public $array_import_regex;
var $array_import_updatekeys; public $array_import_updatekeys;
var $array_import_examplevalues; public $array_import_examplevalues;
var $array_import_convertvalue; public $array_import_convertvalue;
var $array_import_run_sql_after; public $array_import_run_sql_after;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
@@ -54,18 +54,18 @@ class Import
public $errors = array(); public $errors = array();
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db=$db; $this->db=$db;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load description int this->array_import_module, this->array_import_fields, ... of an importable dataset * 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. * @param string $filter Load a particular dataset only. Index will start to 0.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_arrays($user, $filter = '') public function load_arrays($user, $filter = '')
{ {
// phpcs:enable // phpcs:enable
global $langs,$conf; 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. * Build an import example file.
* Arrays this->array_export_xxx are already loaded for required datatoexport * Arrays this->array_export_xxx are already loaded for required datatoexport
@@ -196,7 +196,7 @@ class Import
* @param string $datatoimport Dataset to import * @param string $datatoimport Dataset to import
* @return string <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf,$langs; global $conf,$langs;
@@ -236,7 +236,7 @@ class Import
* @param User $user Object user that save * @param User $user Object user that save
* @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; global $conf;
@@ -276,7 +276,7 @@ class Import
* @param int $id Id of profil to load * @param int $id Id of profil to load
* @return int <0 if KO, >0 if OK * @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 = 'SELECT em.rowid, em.field, em.label, em.type';
$sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $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 * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;

View File

@@ -73,7 +73,7 @@ class Livraison extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->lines = array(); $this->lines = array();
@@ -91,7 +91,7 @@ class Livraison extends CommonObject
* @param User $user Objet du user qui cree * @param User $user Objet du user qui cree
* @return int <0 si erreur, id livraison cree si ok * @return int <0 si erreur, id livraison cree si ok
*/ */
function create($user) public function create($user)
{ {
global $conf; 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 * Create a line
* *
@@ -237,8 +237,8 @@ class Livraison extends CommonObject
* @param string $description Description * @param string $description Description
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
$error = 0; $error = 0;
$idprod = $fk_product; $idprod = $fk_product;
@@ -269,7 +269,7 @@ class Livraison extends CommonObject
* @param int $id Id of object to load * @param int $id Id of object to load
* @return integer * @return integer
*/ */
function fetch($id) public function fetch($id)
{ {
global $conf; global $conf;
@@ -353,7 +353,7 @@ class Livraison extends CommonObject
* @param User $user Object user that validate * @param User $user Object user that validate
* @return int * @return int
*/ */
function valid($user) public function valid($user)
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -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 * 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 * @param int $sending_id Id of the expedition that serves as a model
* @return integer * @return integer
*/ */
function create_from_sending($user, $sending_id) public function create_from_sending($user, $sending_id)
{ {
// phpcs:enable // phpcs:enable
$expedition = new Expedition($this->db); $expedition = new Expedition($this->db);
@@ -546,7 +546,7 @@ class Livraison extends CommonObject
return $this->create($user); return $this->create($user);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update a livraison line (only extrafields) * Update a livraison line (only extrafields)
* *
@@ -554,7 +554,7 @@ class Livraison extends CommonObject
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; global $conf;
@@ -586,7 +586,7 @@ class Livraison extends CommonObject
* @param int $qty Qty * @param int $qty Qty
* @return void * @return void
*/ */
function addline($origin_id, $qty) public function addline($origin_id, $qty)
{ {
$num = count($this->lines); $num = count($this->lines);
$line = new LivraisonLigne($this->db); $line = new LivraisonLigne($this->db);
@@ -603,7 +603,7 @@ class Livraison extends CommonObject
* @param int $lineid Line id * @param int $lineid Line id
* @return integer|null * @return integer|null
*/ */
function deleteline($lineid) public function deleteline($lineid)
{ {
if ($this->statut == 0) if ($this->statut == 0)
{ {
@@ -628,7 +628,7 @@ class Livraison extends CommonObject
* *
* @return integer * @return integer
*/ */
function delete() public function delete()
{ {
global $conf, $langs, $user; 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 * @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 * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
{ {
global $langs; global $langs;
@@ -745,13 +745,13 @@ class Livraison extends CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load lines * Load lines
* *
* @return void * @return void
*/ */
function fetch_lines() public function fetch_lines()
{ {
// phpcs:enable // phpcs:enable
$this->lines = array(); $this->lines = array();
@@ -811,12 +811,12 @@ class Livraison extends CommonObject
* @param int $mode Mode * @param int $mode Mode
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $mode); 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 * 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 * @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 * @return string Label
*/ */
function LibStatut($statut, $mode) public function LibStatut($statut, $mode)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@@ -863,7 +863,7 @@ class Livraison extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@@ -918,7 +918,7 @@ class Livraison extends CommonObject
* @return array Product remaining to be delivered * @return array Product remaining to be delivered
* TODO use new function * TODO use new function
*/ */
function getRemainingDelivered() public function getRemainingDelivered()
{ {
global $langs; 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 * Set the planned delivery date
* *
@@ -997,7 +997,7 @@ class Livraison extends CommonObject
* @param timestamp $date_livraison Date de livraison * @param timestamp $date_livraison Date de livraison
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
if ($user->rights->expedition->creer) if ($user->rights->expedition->creer)
@@ -1087,13 +1087,13 @@ class LivraisonLigne extends CommonObjectLine
*/ */
public $db; public $db;
// From llx_expeditiondet // From llx_expeditiondet
var $qty; public $qty;
var $qty_asked; public $qty_asked;
var $qty_shipped; public $qty_shipped;
var $price; public $price;
var $fk_product; public $fk_product;
var $origin_id; public $origin_id;
/** /**
* @var string delivery note lines label * @var string delivery note lines label
@@ -1129,13 +1129,13 @@ class LivraisonLigne extends CommonObjectLine
*/ */
public $table_element='livraisondet'; public $table_element='livraisondet';
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db=$db; $this->db=$db;
} }
} }

View File

@@ -65,7 +65,7 @@ class Dolresource extends CommonObject
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@@ -77,7 +77,7 @@ class Dolresource extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$error=0; $error=0;
@@ -181,7 +181,7 @@ class Dolresource extends CommonObject
* @param string $ref Ref of object * @param string $ref Ref of object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
global $langs; global $langs;
$sql = "SELECT"; $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 * Load object in memory from database
* *
* @param int $id id object * @param int $id id object
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_element_resource($id) public function fetch_element_resource($id)
{ {
// phpcs:enable // phpcs:enable
global $langs; 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 * Load resource objects into $this->lines
* *
@@ -495,7 +495,7 @@ class Dolresource extends CommonObject
* @param array $filter filter output * @param array $filter filter output
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; 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 * Load all objects into $this->lines
* *
@@ -592,7 +592,7 @@ class Dolresource extends CommonObject
* @param array $filter filter output * @param array $filter filter output
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; 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 * Load all objects into $this->lines
* *
@@ -670,7 +670,7 @@ class Dolresource extends CommonObject
* @param array $filter filter output * @param array $filter filter output
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
global $conf; 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 * Fetch all resources available, declared by modules
* Load available resource in array $this->available_resources * Load available resource in array $this->available_resources
@@ -747,7 +747,7 @@ class Dolresource extends CommonObject
* @deprecated, remplaced by hook getElementResources * @deprecated, remplaced by hook getElementResources
* @see getElementResources() * @see getElementResources()
*/ */
function fetch_all_available() public function fetch_all_available()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@@ -761,7 +761,7 @@ class Dolresource extends CommonObject
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update element resource into database * Update element resource into database
* *
@@ -769,7 +769,7 @@ class Dolresource extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_element_resource($user = null, $notrigger = 0) public function update_element_resource($user = null, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@@ -839,7 +839,7 @@ class Dolresource extends CommonObject
* @param string $resource_type Type * @param string $resource_type Type
* @return array Aray of resources * @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 // Links beetween objects are stored in this table
$sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory';
@@ -878,7 +878,7 @@ class Dolresource extends CommonObject
* *
* @return int * @return int
*/ */
function fetchElementResources($element, $element_id) public function fetchElementResources($element, $element_id)
{ {
$resources = $this->getElementResources($element, $element_id); $resources = $this->getElementResources($element, $element_id);
$i=0; $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) * Load in cache resource type code (setup in dictionary)
* *
* @return int Nb lignes chargees, 0 si deja chargees, <0 si ko * @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 // phpcs:enable
global $langs; global $langs;
@@ -941,7 +941,7 @@ class Dolresource extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @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; 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 * @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 * @return string Label of status
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->status, $mode); return $this->LibStatut($this->status, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return the status * 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 * @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 * @return string Label of status
*/ */
static function LibStatut($status, $mode = 0) public static function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;

View File

@@ -54,13 +54,13 @@ class FormResource
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html form to select a resource * Output html form to select a resource
* *
@@ -76,7 +76,7 @@ class FormResource
* @param int $limit Limit number of answers * @param int $limit Limit number of answers
* @return string HTML string with * @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 // phpcs:enable
global $conf,$user,$langs; global $conf,$user,$langs;
@@ -157,7 +157,7 @@ class FormResource
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return html list of tickets type * Return html list of tickets type
* *
@@ -170,7 +170,7 @@ class FormResource
* @param int $maxlength Max length of label * @param int $maxlength Max length of label
* @return void * @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 // phpcs:enable
global $langs,$user; global $langs,$user;