forked from Wavyzz/dolibarr
Fix technical debt
This commit is contained in:
@@ -9,7 +9,7 @@ WARNING:
|
|||||||
|
|
||||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead.
|
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead.
|
||||||
|
* The method nb_expedition() has been renamed into countNbOfShipments()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2871,7 +2871,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
// Ship
|
// Ship
|
||||||
$numshipping = 0;
|
$numshipping = 0;
|
||||||
if (isModEnabled('expedition')) {
|
if (isModEnabled('expedition')) {
|
||||||
$numshipping = $object->nb_expedition();
|
$numshipping = $object->countNbOfShipments();
|
||||||
|
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||||
if ((isModEnabled('expedition_bon') && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
|
if ((isModEnabled('expedition_bon') && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
|
||||||
|
|||||||
@@ -1173,6 +1173,8 @@ class Commande extends CommonOrder
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
@@ -2307,17 +2309,13 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
||||||
/**
|
/**
|
||||||
* Returns a array with expeditions lines number
|
* Returns an array with expeditions lines number
|
||||||
*
|
*
|
||||||
* @return int Nb of shipments
|
* @return int Nb of shipments
|
||||||
*
|
|
||||||
* TODO deprecate, move to Shipping class
|
|
||||||
*/
|
*/
|
||||||
public function nb_expedition()
|
public function countNbOfShipments()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
|
||||||
$sql = 'SELECT count(*)';
|
$sql = 'SELECT count(*)';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
|
||||||
$sql .= ', '.MAIN_DB_PREFIX.'element_element as el';
|
$sql .= ', '.MAIN_DB_PREFIX.'element_element as el';
|
||||||
@@ -2333,6 +2331,8 @@ class Commande extends CommonOrder
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@@ -2501,6 +2501,8 @@ class Commande extends CommonOrder
|
|||||||
return -1 * $error;
|
return -1 * $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2565,6 +2567,8 @@ class Commande extends CommonOrder
|
|||||||
return -1 * $error;
|
return -1 * $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3433,7 +3437,7 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test we can delete
|
// Test we can delete
|
||||||
if ($this->nb_expedition() != 0) {
|
if ($this->countNbOfShipments() != 0) {
|
||||||
$this->errors[] = $langs->trans('SomeShipmentExists');
|
$this->errors[] = $langs->trans('SomeShipmentExists');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4224,7 +4224,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param User $user User that set discount
|
* @param User $user User that set discount
|
||||||
* @param double $remise Discount
|
* @param double $remise Discount
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function set_remise($user, $remise, $notrigger = 0)
|
public function set_remise($user, $remise, $notrigger = 0)
|
||||||
{
|
{
|
||||||
@@ -4239,7 +4239,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param User $user User that set discount
|
* @param User $user User that set discount
|
||||||
* @param double $remise Discount
|
* @param double $remise Discount
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function setDiscount($user, $remise, $notrigger = 0)
|
public function setDiscount($user, $remise, $notrigger = 0)
|
||||||
{
|
{
|
||||||
@@ -4291,6 +4291,8 @@ class Facture extends CommonInvoice
|
|||||||
return -1 * $error;
|
return -1 * $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4356,6 +4358,8 @@ class Facture extends CommonInvoice
|
|||||||
return -1 * $error;
|
return -1 * $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5742,6 +5746,8 @@ class Facture extends CommonInvoice
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1016,12 +1016,10 @@ abstract class CommonDocGenerator
|
|||||||
* @param int $hidedetails Do not show line details
|
* @param int $hidedetails Do not show line details
|
||||||
* @param int $hidedesc Do not show desc
|
* @param int $hidedesc Do not show desc
|
||||||
* @param int $hideref Do not show ref
|
* @param int $hideref Do not show ref
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
public function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$this->defineColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
|
||||||
|
|
||||||
@@ -1175,7 +1173,7 @@ abstract class CommonDocGenerator
|
|||||||
* @param float $curY curent Y position
|
* @param float $curY curent Y position
|
||||||
* @param string $colKey the column key
|
* @param string $colKey the column key
|
||||||
* @param string $columnText column text
|
* @param string $columnText column text
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '')
|
public function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '')
|
||||||
{
|
{
|
||||||
@@ -1206,22 +1204,24 @@ abstract class CommonDocGenerator
|
|||||||
// restore cell padding
|
// restore cell padding
|
||||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* print description column content
|
* print description column content
|
||||||
*
|
*
|
||||||
* @param TCPDF $pdf pdf object
|
* @param TCPDF $pdf pdf object
|
||||||
* @param float $curY curent Y position
|
* @param float $curY curent Y position
|
||||||
* @param string $colKey the column key
|
* @param string $colKey the column key
|
||||||
* @param object $object CommonObject
|
* @param object $object CommonObject
|
||||||
* @param int $i the $object->lines array key
|
* @param int $i the $object->lines array key
|
||||||
* @param Translate $outputlangs Output language
|
* @param Translate $outputlangs Output language
|
||||||
* @param int $hideref hide ref
|
* @param int $hideref hide ref
|
||||||
* @param int $hidedesc hide desc
|
* @param int $hidedesc hide desc
|
||||||
* @param int $issupplierline if object need supplier product
|
* @param int $issupplierline if object need supplier product
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
|
public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
|
||||||
{
|
{
|
||||||
@@ -1265,7 +1265,7 @@ abstract class CommonDocGenerator
|
|||||||
global $hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
if (empty($object->table_element)) {
|
if (empty($object->table_element)) {
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$extrafieldsKeyPrefix = "options_";
|
$extrafieldsKeyPrefix = "options_";
|
||||||
@@ -1317,10 +1317,10 @@ abstract class CommonDocGenerator
|
|||||||
/**
|
/**
|
||||||
* display extrafields columns content
|
* display extrafields columns content
|
||||||
*
|
*
|
||||||
* @param object $object line of common object
|
* @param object $object line of common object
|
||||||
* @param Translate $outputlangs Output language
|
* @param Translate $outputlangs Output language
|
||||||
* @param array $params array of additionals parameters
|
* @param array $params array of additionals parameters
|
||||||
* @return double max y value
|
* @return string Html string
|
||||||
*/
|
*/
|
||||||
public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
|
public function getExtrafieldsInHtml($object, $outputlangs, $params = array())
|
||||||
{
|
{
|
||||||
@@ -1330,7 +1330,7 @@ abstract class CommonDocGenerator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load extrafiels if not allready does
|
// Load extrafields if not allready done
|
||||||
if (empty($this->extrafieldsCache)) {
|
if (empty($this->extrafieldsCache)) {
|
||||||
$this->extrafieldsCache = new ExtraFields($this->db);
|
$this->extrafieldsCache = new ExtraFields($this->db);
|
||||||
}
|
}
|
||||||
@@ -1366,7 +1366,6 @@ abstract class CommonDocGenerator
|
|||||||
|
|
||||||
$params = $params + $defaultParams;
|
$params = $params + $defaultParams;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $extrafields ExtraFields
|
* @var $extrafields ExtraFields
|
||||||
*/
|
*/
|
||||||
@@ -1593,12 +1592,10 @@ abstract class CommonDocGenerator
|
|||||||
* @param object $object common object det
|
* @param object $object common object det
|
||||||
* @param Translate $outputlangs langs
|
* @param Translate $outputlangs langs
|
||||||
* @param int $hidedetails Do not show line details
|
* @param int $hidedetails Do not show line details
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function defineColumnExtrafield($object, $outputlangs, $hidedetails = 0)
|
public function defineColumnExtrafield($object, $outputlangs, $hidedetails = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
if (!empty($hidedetails)) {
|
if (!empty($hidedetails)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1674,5 +1671,7 @@ abstract class CommonDocGenerator
|
|||||||
$this->insertNewColumnDef("options_".$key, $def);
|
$this->insertNewColumnDef("options_".$key, $def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4539,6 +4539,8 @@ abstract class CommonObject
|
|||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
return $row[0];
|
return $row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5772,6 +5774,9 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname
|
// TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname
|
||||||
|
// store content into $conf->cache['overwrite_default']
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -7828,7 +7833,7 @@ abstract class CommonObject
|
|||||||
* clear validation message result for a field
|
* clear validation message result for a field
|
||||||
*
|
*
|
||||||
* @param string $fieldKey Key of attribute to clear
|
* @param string $fieldKey Key of attribute to clear
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function clearFieldError($fieldKey)
|
public function clearFieldError($fieldKey)
|
||||||
{
|
{
|
||||||
@@ -7841,12 +7846,14 @@ abstract class CommonObject
|
|||||||
*
|
*
|
||||||
* @param string $fieldKey Key of attribute
|
* @param string $fieldKey Key of attribute
|
||||||
* @param string $msg the field error message
|
* @param string $msg the field error message
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setFieldError($fieldKey, $msg = '')
|
public function setFieldError($fieldKey, $msg = '')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
if (empty($msg)) { $msg = $langs->trans("UnknowError"); }
|
if (empty($msg)) {
|
||||||
|
$msg = $langs->trans("UnknowError");
|
||||||
|
}
|
||||||
|
|
||||||
$this->error = $this->validateFieldsErrors[$fieldKey] = $msg;
|
$this->error = $this->validateFieldsErrors[$fieldKey] = $msg;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,8 +221,8 @@ class DolGraph
|
|||||||
/**
|
/**
|
||||||
* Set y label
|
* Set y label
|
||||||
*
|
*
|
||||||
* @param string $label Y label
|
* @param string $label Y label
|
||||||
* @return boolean|null True
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function SetYLabel($label)
|
public function SetYLabel($label)
|
||||||
{
|
{
|
||||||
@@ -235,7 +235,7 @@ class DolGraph
|
|||||||
* Set width
|
* Set width
|
||||||
*
|
*
|
||||||
* @param int|string $w Width (Example: 320 or '100%')
|
* @param int|string $w Width (Example: 320 or '100%')
|
||||||
* @return boolean|null True
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function SetWidth($w)
|
public function SetWidth($w)
|
||||||
{
|
{
|
||||||
@@ -717,7 +717,7 @@ class DolGraph
|
|||||||
*
|
*
|
||||||
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
|
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
|
||||||
* @param string $fileurl Url path to show image if saved onto disk
|
* @param string $fileurl Url path to show image if saved onto disk
|
||||||
* @return integer|null
|
* @return mixed|boolean
|
||||||
*/
|
*/
|
||||||
public function draw($file, $fileurl = '')
|
public function draw($file, $fileurl = '')
|
||||||
{
|
{
|
||||||
@@ -736,7 +736,8 @@ class DolGraph
|
|||||||
dol_syslog(get_class($this) . "::draw " . $this->error, LOG_WARNING);
|
dol_syslog(get_class($this) . "::draw " . $this->error, LOG_WARNING);
|
||||||
}
|
}
|
||||||
$call = "draw_" . $this->_library;
|
$call = "draw_" . $this->_library;
|
||||||
call_user_func_array(array($this, $call), array($file, $fileurl));
|
|
||||||
|
return call_user_func_array(array($this, $call), array($file, $fileurl));
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
|
|||||||
@@ -339,8 +339,8 @@ class FormSetup
|
|||||||
/**
|
/**
|
||||||
* Method used to test module builder convertion to this form usage
|
* Method used to test module builder convertion to this form usage
|
||||||
*
|
*
|
||||||
* @param array $params an array of arrays of params from old modulBuilder params
|
* @param array $params an array of arrays of params from old modulBuilder params
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addItemsFromParamsArray($params)
|
public function addItemsFromParamsArray($params)
|
||||||
{
|
{
|
||||||
@@ -683,7 +683,8 @@ class FormSetupItem
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save const value based on htdocs/core/actions_setmoduleoptions.inc.php
|
* Save const value based on htdocs/core/actions_setmoduleoptions.inc.php
|
||||||
* @return int -1 if KO, 1 if OK
|
*
|
||||||
|
* @return int -1 if KO, 1 if OK
|
||||||
*/
|
*/
|
||||||
public function saveConfValue()
|
public function saveConfValue()
|
||||||
{
|
{
|
||||||
@@ -714,10 +715,13 @@ class FormSetupItem
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an override function for saving data
|
* Set an override function for saving data
|
||||||
|
*
|
||||||
* @param callable $callBack a callable function
|
* @param callable $callBack a callable function
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -1005,6 +1009,7 @@ class FormSetupItem
|
|||||||
* set the type from string : used for old module builder setup conf style conversion and tests
|
* set the type from string : used for old module builder setup conf style conversion and tests
|
||||||
* because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist
|
* because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist
|
||||||
* to be sure we can manage evolution easily
|
* to be sure we can manage evolution easily
|
||||||
|
*
|
||||||
* @param string $type possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
|
* @param string $type possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
|
||||||
* @deprecated yes this setTypeFromTypeString came deprecated because it exists only for manage setup convertion
|
* @deprecated yes this setTypeFromTypeString came deprecated because it exists only for manage setup convertion
|
||||||
* @return bool
|
* @return bool
|
||||||
@@ -1012,11 +1017,13 @@ class FormSetupItem
|
|||||||
public function setTypeFromTypeString($type)
|
public function setTypeFromTypeString($type)
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add error
|
* Add error
|
||||||
|
*
|
||||||
* @param array|string $errors the error text
|
* @param array|string $errors the error text
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
@@ -1034,7 +1041,9 @@ class FormSetupItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool|string Generate the output html for this item
|
* generateOutputField
|
||||||
|
*
|
||||||
|
* @return bool|string Generate the output html for this item
|
||||||
*/
|
*/
|
||||||
public function generateOutputField()
|
public function generateOutputField()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1011,7 +1011,7 @@ class Lessc
|
|||||||
if ($list[0] == "list" && isset($list[2][$idx - 1])) {
|
if ($list[0] == "list" && isset($list[2][$idx - 1])) {
|
||||||
return $list[2][$idx - 1];
|
return $list[2][$idx - 1];
|
||||||
}
|
}
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function lib_isnumber($value)
|
protected function lib_isnumber($value)
|
||||||
@@ -1306,7 +1306,7 @@ class Lessc
|
|||||||
if (!is_null($color = $this->coerceColor($value))) {
|
if (!is_null($color = $this->coerceColor($value))) {
|
||||||
return isset($color[4]) ? $color[4] : 1;
|
return isset($color[4]) ? $color[4] : 1;
|
||||||
}
|
}
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the alpha of the color
|
// set the alpha of the color
|
||||||
@@ -1958,7 +1958,8 @@ class Lessc
|
|||||||
if ($op == '+' || $op == '*') {
|
if ($op == '+' || $op == '*') {
|
||||||
return $this->op_color_number($op, $rgt, $lft);
|
return $this->op_color_number($op, $rgt, $lft);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function op_color_number($op, $lft, $rgt)
|
protected function op_color_number($op, $lft, $rgt)
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
|||||||
$langs->loadLangs(array('main', 'other'));
|
$langs->loadLangs(array('main', 'other'));
|
||||||
|
|
||||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->transnoentitiesnoconv("TryAnotherConnectionMode");
|
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->transnoentitiesnoconv("TryAnotherConnectionMode");
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($usertotest) {
|
if ($usertotest) {
|
||||||
|
|||||||
@@ -985,6 +985,8 @@ class ExpenseReport extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@@ -1328,8 +1330,6 @@ class ExpenseReport extends CommonObject
|
|||||||
public function set_save_from_refuse($fuser)
|
public function set_save_from_refuse($fuser)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
// Sélection de la date de début de la NDF
|
// Sélection de la date de début de la NDF
|
||||||
$sql = 'SELECT date_debut';
|
$sql = 'SELECT date_debut';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
@@ -1357,6 +1357,8 @@ class ExpenseReport extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
dol_syslog(get_class($this)."::set_save_from_refuse expensereport already with save status", LOG_WARNING);
|
dol_syslog(get_class($this)."::set_save_from_refuse expensereport already with save status", LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1465,6 +1467,8 @@ class ExpenseReport extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
dol_syslog(get_class($this)."::setDeny expensereport already with refuse status", LOG_WARNING);
|
dol_syslog(get_class($this)."::setDeny expensereport already with refuse status", LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@@ -1531,6 +1535,8 @@ class ExpenseReport extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
dol_syslog(get_class($this)."::set_unpaid expensereport already with unpaid status", LOG_WARNING);
|
dol_syslog(get_class($this)."::set_unpaid expensereport already with unpaid status", LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
|
|||||||
@@ -501,6 +501,8 @@ class Fichinter extends CommonObject
|
|||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
@@ -515,8 +517,6 @@ class Fichinter extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function setDraft($user)
|
public function setDraft($user)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Protection
|
// Protection
|
||||||
@@ -664,6 +664,8 @@ class Fichinter extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -904,8 +906,6 @@ class Fichinter extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function info($id)
|
public function info($id)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$sql = "SELECT f.rowid,";
|
$sql = "SELECT f.rowid,";
|
||||||
$sql .= " f.datec,";
|
$sql .= " f.datec,";
|
||||||
$sql .= " f.tms as date_modification,";
|
$sql .= " f.tms as date_modification,";
|
||||||
@@ -1074,13 +1074,11 @@ class Fichinter extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user Object user who define
|
* @param User $user Object user who define
|
||||||
* @param integer $date_delivery date of delivery
|
* @param integer $date_delivery date of delivery
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function set_date_delivery($user, $date_delivery)
|
public function set_date_delivery($user, $date_delivery)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
|
||||||
|
|
||||||
if ($user->rights->ficheinter->creer) {
|
if ($user->rights->ficheinter->creer) {
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||||
$sql .= " SET datei = '".$this->db->idate($date_delivery)."'";
|
$sql .= " SET datei = '".$this->db->idate($date_delivery)."'";
|
||||||
@@ -1096,6 +1094,8 @@ class Fichinter extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@@ -1109,8 +1109,6 @@ class Fichinter extends CommonObject
|
|||||||
public function set_description($user, $description)
|
public function set_description($user, $description)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
|
||||||
|
|
||||||
if ($user->rights->ficheinter->creer) {
|
if ($user->rights->ficheinter->creer) {
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||||
$sql .= " SET description = '".$this->db->escape($description)."',";
|
$sql .= " SET description = '".$this->db->escape($description)."',";
|
||||||
@@ -1126,6 +1124,8 @@ class Fichinter extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1135,13 +1135,11 @@ class Fichinter extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user Object user who modify
|
* @param User $user Object user who modify
|
||||||
* @param int $contractid Description
|
* @param int $contractid Description
|
||||||
* @return int <0 if ko, >0 if ok
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function set_contrat($user, $contractid)
|
public function set_contrat($user, $contractid)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
|
||||||
|
|
||||||
if ($user->rights->ficheinter->creer) {
|
if ($user->rights->ficheinter->creer) {
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||||
$sql .= " SET fk_contrat = ".((int) $contractid);
|
$sql .= " SET fk_contrat = ".((int) $contractid);
|
||||||
@@ -1155,6 +1153,7 @@ class Fichinter extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1261,7 +1260,7 @@ class Fichinter extends CommonObject
|
|||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration");
|
dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration");
|
||||||
|
|
||||||
if ($this->statut == 0) {
|
if ($this->statut == self::STATUS_DRAFT) {
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Insertion ligne
|
// Insertion ligne
|
||||||
@@ -1288,6 +1287,8 @@ class Fichinter extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* We save global variables into local variables
|
* We save global variables into local variables
|
||||||
*
|
|
||||||
* @return MyObjectTest
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1271,7 +1271,7 @@ class Societe extends CommonObject
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
|
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
|
||||||
$this->name = $this->name ?trim($this->name) : trim($this->nom);
|
$this->name = $this->name ? trim($this->name) : trim($this->nom);
|
||||||
$this->nom = $this->name; // For backward compatibility
|
$this->nom = $this->name; // For backward compatibility
|
||||||
$this->name_alias = trim($this->name_alias);
|
$this->name_alias = trim($this->name_alias);
|
||||||
$this->ref_ext = trim($this->ref_ext);
|
$this->ref_ext = trim($this->ref_ext);
|
||||||
@@ -2217,6 +2217,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2278,6 +2279,8 @@ class Societe extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@@ -3091,6 +3094,8 @@ class Societe extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3473,9 +3478,9 @@ class Societe extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4819,6 +4824,8 @@ class Societe extends CommonObject
|
|||||||
} elseif ($status == 3) {
|
} elseif ($status == 3) {
|
||||||
return $langs->trans("ProspectCustomer");
|
return $langs->trans("ProspectCustomer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user