mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -614,10 +614,21 @@ class DiscountAbsolute extends CommonObject
|
||||
*/
|
||||
public function getAvailableDiscounts($company = null, $user = null, $filter = '', $maxvalue = 0, $discount_type = 0, $multicurrency = 0)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $hookmanager;
|
||||
|
||||
dol_syslog(get_class($this)."::getAvailableDiscounts discount_type=".$discount_type, LOG_DEBUG);
|
||||
|
||||
$parameters = array(
|
||||
'company' => $company,
|
||||
'user' => $user,
|
||||
'filter' => $filter,
|
||||
'maxvalue' => $maxvalue,
|
||||
'discount_type' => $discount_type,
|
||||
'multicurrency' => $multicurrency
|
||||
);
|
||||
|
||||
$reshook = $hookmanager->executeHooks('getAvailableDiscounts', $parameters);
|
||||
if (empty($reshook)) {
|
||||
$sql = "SELECT SUM(rc.amount_ttc) as amount, SUM(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.entity = ".$conf->entity;
|
||||
@@ -639,6 +650,9 @@ class DiscountAbsolute extends CommonObject
|
||||
if ($maxvalue) {
|
||||
$sql .= ' AND rc.amount_ttc <= '.((float) price2num($maxvalue));
|
||||
}
|
||||
} else {
|
||||
$sql = $hookmanager->resArray['sql'];
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
Reference in New Issue
Block a user