diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 8a1508b7a04..2ad4582634f 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -108,6 +108,17 @@ class BlockedLog $this->error++; } } + if($this->element === 'invoice_supplier') { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + + $object = new FactureFournisseur($this->db); + if($object->fetch($this->fk_object)>0) { + return $object->getNomUrl(1); + } + else{ + $this->error++; + } + } else if($this->element === 'payment') { require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -119,6 +130,17 @@ class BlockedLog $this->error++; } } + else if($this->element === 'payment_supplier') { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; + + $object = new PaiementFourn($this->db); + if($object->fetch($this->fk_object)>0) { + return $object->getNomUrl(1); + } + else{ + $this->error++; + } + } return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object); @@ -153,7 +175,7 @@ class BlockedLog */ public function setObjectData(&$object) { - if($object->element=='payment') { + if($object->element=='payment' || $object->element=='payment_supplier') { $this->date_object = $object->datepaye; } else{ @@ -183,13 +205,28 @@ class BlockedLog $this->object_data->note_private= (double) $object->note_private; } - elseif($this->element==='payment'){ + if($this->element === 'invoice_supplier') { + if(empty($object->thirdparty))$object->fetch_thirdparty(); + $this->object_data->thirdparty = new stdClass(); + + foreach($object->thirdparty as $key=>$value) { + if(!is_object($value)) $this->object_data->thirdparty->{$key} = $value; + } + + $this->object_data->total_ht = (double) $object->total_ht; + $this->object_data->total_tva = (double) $object->total_tva; + $this->object_data->total_ttc = (double) $object->total_ttc; + $this->object_data->total_localtax1= (double) $object->total_localtax1; + $this->object_data->total_localtax2= (double) $object->total_localtax2; + $this->object_data->note_public = (double) $object->note_public; + $this->object_data->note_private= (double) $object->note_private; + + } + elseif($this->element==='payment'|| $object->element=='payment_supplier'){ $this->object_data->amounts = $object->amounts; } - - } /** @@ -511,6 +548,15 @@ class BlockedLog $this->amounts = (double) $obj->amount; } } + if($this->element === 'payment_supplier') { + $sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiementfourn WHERE rowid=".$this->fk_object; + + $res = $this->db->query($sql); + + if($res && $obj = $this->db->fetch_object($res)) { + $this->amounts = (double) $obj->amount; + } + } elseif($this->element === 'facture') { $sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object; diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 39dae7c209e..fbd9469b391 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -49,10 +49,11 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' - || $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW') { + || $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW' + || $action === 'BILL_SUPPLIER_PAYED') { $amounts= (double) $object->total_ttc; } - else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') { + else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK' || $action === 'PAYMENT_SUPPLIER_CREATE') { $amounts = 0; if(!empty($object->amounts)) { foreach($object->amounts as $amount) {