Add constant to manage update_price function
Some external module want no update price after a trigger because they have a other method to calculate the total (ex: with a extrafield).
This commit is contained in:
parent
67c571f952
commit
2f3f04c2b1
@ -12,6 +12,7 @@
|
|||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
|
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
|
||||||
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -2260,6 +2261,29 @@ 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)
|
||||||
|
$MODULE = "";
|
||||||
|
if ($this->element == 'propal')
|
||||||
|
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL";
|
||||||
|
elseif ($this->element == 'order')
|
||||||
|
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER";
|
||||||
|
elseif ($this->element == 'facture')
|
||||||
|
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE";
|
||||||
|
elseif ($this->element == 'facture_fourn')
|
||||||
|
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_INVOICE";
|
||||||
|
elseif ($this->element == 'order_supplier')
|
||||||
|
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_ORDER";
|
||||||
|
elseif ($this->element == 'supplier_proposal')
|
||||||
|
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL";
|
||||||
|
|
||||||
|
if(!empty($MODULE)){
|
||||||
|
if (!empty($conf->global->$MODULE)) {
|
||||||
|
$modsactivated = explode(',', $conf->global->$MODULE);
|
||||||
|
foreach ($modsactivated as $mod) {
|
||||||
|
if ($conf->$mod->enabled) return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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
|
||||||
@ -2454,6 +2478,7 @@ abstract class CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add objects linked in llx_element_element.
|
* Add objects linked in llx_element_element.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user