Clean code

This commit is contained in:
Laurent Destailleur 2017-10-06 12:55:48 +02:00
parent ad12aff31d
commit 2148622d40

View File

@ -2261,7 +2261,7 @@ abstract class CommonObject
{ {
global $conf; global $conf;
//Some external module want no update price after a trigger because they have a other method for calculate the total (ex: with a extrafield) // Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield)
$MODULE = ""; $MODULE = "";
if ($this->element == 'propal') if ($this->element == 'propal')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL";
@ -2276,14 +2276,16 @@ abstract class CommonObject
elseif ($this->element == 'supplier_proposal') elseif ($this->element == 'supplier_proposal')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL";
if(!empty($MODULE)){ if (! empty($MODULE)) {
if (!empty($conf->global->$MODULE)) { if (! empty($conf->global->$MODULE)) {
$modsactivated = explode(',', $conf->global->$MODULE); $modsactivated = explode(',', $conf->global->$MODULE);
foreach ($modsactivated as $mod) { foreach ($modsactivated as $mod) {
if ($conf->$mod->enabled) return 1; if ($conf->$mod->enabled)
return 1; // update was disabled by specific setup
} }
} }
} else { }
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if ($roundingadjust == '-1') $roundingadjust='auto'; // For backward compatibility if ($roundingadjust == '-1') $roundingadjust='auto'; // For backward compatibility
@ -2409,7 +2411,8 @@ abstract class CommonObject
$this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0; $this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0;
// Situations totals // Situations totals
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits'))
{
$prev_sits = $this->get_prev_sits(); $prev_sits = $this->get_prev_sits();
foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch. foreach ($prev_sits as $sit) { // $sit is an object Facture loaded with a fetch.
@ -2478,7 +2481,6 @@ abstract class CommonObject
return -1; return -1;
} }
} }
}
/** /**
* Add objects linked in llx_element_element. * Add objects linked in llx_element_element.