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
*/
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);

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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];
}

View File

@@ -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);
}
}