61 if (empty($conf->blockedlog) || empty($conf->blockedlog->enabled)) {
68 $listofqualifiedelement = array(
'facture',
'don',
'payment',
'payment_donation',
'subscription',
'payment_various',
'cashcontrol');
69 if (!is_object(
$object) || !property_exists(
$object,
'element') || !in_array(
$object->element, $listofqualifiedelement)) {
74 dol_syslog(
"Trigger '".$this->
name.
"' for action '".$action.
"' launched by ".__FILE__.
". id=".
$object->id);
76 require_once DOL_DOCUMENT_ROOT.
'/blockedlog/class/blockedlog.class.php';
78 $b->loadTrackedEvents();
81 if (!in_array($action, array_keys($b->trackedevents))) {
88 if ($action ===
'BILL_VALIDATE' || (($action ===
'BILL_DELETE' || $action ===
'BILL_SENTBYMAIL') &&
$object->statut != 0)
89 || $action ===
'BILL_SUPPLIER_VALIDATE' || (($action ===
'BILL_SUPPLIER_DELETE' || $action ===
'BILL_SUPPLIER_SENTBYMAIL') &&
$object->statut != 0)
90 || $action ===
'MEMBER_SUBSCRIPTION_CREATE' || $action ===
'MEMBER_SUBSCRIPTION_MODIFY' || $action ===
'MEMBER_SUBSCRIPTION_DELETE'
91 || $action ===
'DON_VALIDATE' || (($action ===
'DON_MODIFY' || $action ===
'DON_DELETE') &&
$object->statut != 0)
92 || $action ===
'CASHCONTROL_VALIDATE'
93 || (in_array(
$object->element, array(
'facture',
'supplier_invoice')) && $action ===
'DOC_DOWNLOAD' &&
$object->statut != 0)
94 || (in_array(
$object->element, array(
'facture',
'supplier_invoice')) && $action ===
'DOC_PREVIEW' &&
$object->statut != 0)
99 if (in_array($action, array(
100 'MEMBER_SUBSCRIPTION_CREATE',
'MEMBER_SUBSCRIPTION_MODIFY',
'MEMBER_SUBSCRIPTION_DELETE',
101 'DON_VALIDATE',
'DON_MODIFY',
'DON_DELETE'))) {
102 $amounts = (float)
$object->amount;
103 } elseif ($action ==
'CASHCONTROL_VALIDATE') {
105 } elseif (property_exists(
$object,
'total_ttc')) {
106 $amounts = (float)
$object->total_ttc;
115 if ($action ===
'PAYMENT_CUSTOMER_CREATE' || $action ===
'PAYMENT_SUPPLIER_CREATE' || $action ===
'DONATION_PAYMENT_CREATE'
116 || $action ===
'PAYMENT_CUSTOMER_DELETE' || $action ===
'PAYMENT_SUPPLIER_DELETE' || $action ===
'DONATION_PAYMENT_DELETE') {
119 if (!empty(
$object->amounts)) {
120 foreach (
$object->amounts as $amount) {
121 $amounts += (float) $amount;
123 } elseif (!empty(
$object->amount)) {
126 } elseif (strpos($action,
'PAYMENT') !==
false && !in_array($action, array(
'PAYMENT_ADD_TO_BANK'))) {
128 $amounts = (float)
$object->amount;
138 $result = $b->setObjectData(
$object, $action, $amounts, $user);
142 $this->error = $b->error;
143 $this->errors = $b->errors;
147 $res = $b->create($user);
150 $this->error = $b->error;
151 $this->errors = $b->errors;