62 if (empty($conf->blockedlog) || empty($conf->blockedlog->enabled)) {
69 $listofqualifiedelement = array(
'facture',
'don',
'payment',
'payment_donation',
'subscription',
'payment_various',
'cashcontrol');
70 if (!is_object($object) || !property_exists($object,
'element') || !in_array($object->element, $listofqualifiedelement)) {
75 dol_syslog(
"Trigger '".$this->
name.
"' for action '".$action.
"' launched by ".__FILE__.
". id=".$object->id);
77 require_once DOL_DOCUMENT_ROOT.
'/blockedlog/class/blockedlog.class.php';
79 $b->loadTrackedEvents();
82 if (!in_array($action, array_keys($b->trackedevents))) {
89 if ($action ===
'BILL_VALIDATE' || (($action ===
'BILL_DELETE' || $action ===
'BILL_SENTBYMAIL') && $object->statut != 0)
90 || $action ===
'BILL_SUPPLIER_VALIDATE' || (($action ===
'BILL_SUPPLIER_DELETE' || $action ===
'BILL_SUPPLIER_SENTBYMAIL') && $object->statut != 0)
91 || $action ===
'MEMBER_SUBSCRIPTION_CREATE' || $action ===
'MEMBER_SUBSCRIPTION_MODIFY' || $action ===
'MEMBER_SUBSCRIPTION_DELETE'
92 || $action ===
'DON_VALIDATE' || (($action ===
'DON_MODIFY' || $action ===
'DON_DELETE') && $object->statut != 0)
93 || $action ===
'CASHCONTROL_VALIDATE'
94 || (in_array($object->element, array(
'facture',
'supplier_invoice')) && $action ===
'DOC_DOWNLOAD' && $object->statut != 0)
95 || (in_array($object->element, array(
'facture',
'supplier_invoice')) && $action ===
'DOC_PREVIEW' && $object->statut != 0)
100 if (in_array($action, array(
101 'MEMBER_SUBSCRIPTION_CREATE',
'MEMBER_SUBSCRIPTION_MODIFY',
'MEMBER_SUBSCRIPTION_DELETE',
102 'DON_VALIDATE',
'DON_MODIFY',
'DON_DELETE'))) {
103 $amounts = (float) $object->amount;
104 } elseif ($action ==
'CASHCONTROL_VALIDATE') {
105 $amounts = (float) $object->cash + (
float) $object->cheque + (float) $object->card;
106 } elseif (property_exists($object,
'total_ttc')) {
107 $amounts = (float) $object->total_ttc;
116 if ($action ===
'PAYMENT_CUSTOMER_CREATE' || $action ===
'PAYMENT_SUPPLIER_CREATE' || $action ===
'DONATION_PAYMENT_CREATE'
117 || $action ===
'PAYMENT_CUSTOMER_DELETE' || $action ===
'PAYMENT_SUPPLIER_DELETE' || $action ===
'DONATION_PAYMENT_DELETE') {
120 if (!empty($object->amounts)) {
121 foreach ($object->amounts as $amount) {
122 $amounts += (float) $amount;
124 } elseif (!empty($object->amount)) {
125 $amounts = $object->amount;
127 } elseif (strpos($action,
'PAYMENT') !==
false && !in_array($action, array(
'PAYMENT_ADD_TO_BANK'))) {
129 $amounts = (float) $object->amount;
139 $result = $b->setObjectData($object, $action, $amounts, $user);
143 $this->error = $b->error;
144 $this->errors = $b->errors;
148 $res = $b->create($user);
151 $this->error = $b->error;
152 $this->errors = $b->errors;