diff --git a/ChangeLog b/ChangeLog index fd18deeac14..5aff4d6d3ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,7 +12,9 @@ Following changes may create regressions for some external modules, but were nec 'doaction' into 'sendMail'. * Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE - +* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is + a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required. + ***** ChangeLog for 7.0.0 compared to 6.0.5 ***** For users: diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 81443f04d62..506b0c6fa8d 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -195,7 +195,7 @@ if (empty($reshook)) if ($ret < 0) $error++; if (! $error) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('COMPANY_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 54e3cf36c45..9c72170b880 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1234,7 +1234,7 @@ if (empty($reshook)) if ($ret < 0) $error++; if (! $error) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('PROPAL_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5efc1cf9db4..312d228b2d4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1289,11 +1289,6 @@ class Propal extends CommonObject $reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } - - // Call trigger - $result=$clonedObj->call_trigger('PROPAL_CLONE',$user); - if ($result < 0) { $error++; } - // End call triggers } unset($this->context['createfromclone']); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6e1d411d55e..54c7db7d6ca 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1281,7 +1281,7 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by // some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('ORDER_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 65b704693fb..8f2f233fb10 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1073,11 +1073,6 @@ class Commande extends CommonOrder $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } - - // Call trigger - $result=$this->call_trigger('ORDER_CLONE',$user); - if ($result < 0) $error++; - // End call triggers } unset($this->context['createfromclone']); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 19612349214..ab7e0826553 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2119,7 +2119,7 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by // some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('BILL_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7edc3b65b41..184b9c80f3c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -958,11 +958,6 @@ class Facture extends CommonInvoice $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } - - // Call trigger - $result=$this->call_trigger('BILL_CLONE',$user); - if ($result < 0) $error++; - // End call triggers } unset($this->context['createfromclone']); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index af81e797252..f869c01aa53 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -450,7 +450,7 @@ if (empty($reshook)) if ($ret < 0) $error++; if (! $error) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('BILLREC_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 6111be6c7ee..cdbcb46f815 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -881,7 +881,7 @@ if (empty($reshook)) if ($ret < 0) $error++; if (! $error) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('CONTRACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 12e08984411..cf809adfc6c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2430,17 +2430,6 @@ class Contrat extends CommonObject } - if (! $notrigger && empty($error)) - { - // Call trigger - $clonedObj->old_copy=$this; - $result = $clonedObj->call_trigger('CONTRACT_CLONE', $user); - if ($result < 0) { - $error ++; - } - // End call triggers - } - unset($this->context['createfromclone']); // End diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 9f48d27ca00..8fc21e0653e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -168,7 +168,7 @@ if (empty($reshook)) $parameters = array('id' => $object->id); $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('SHIPMENT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index a358d349531..d172d1034ca 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -193,7 +193,7 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by // some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('SHIPMENT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 6d989e6efc0..59c8b719d4e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -299,7 +299,7 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by // some hooks if (empty($reshook)) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('FICHINTER_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b1523f3bbf9..5674192906c 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -341,11 +341,6 @@ class ExpenseReport extends CommonObject $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } - - // Call trigger - $result=$this->call_trigger('EXPENSEREPORT_CLONE',$user); - if ($result < 0) $error++; - // End call triggers } unset($this->context['createfromclone']); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 81e7fe9ac54..e7839f66da2 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -755,7 +755,7 @@ if (empty($reshook)) $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $result=$object->insertExtraFields(); + $result=$object->insertExtraFields('INTERVENTION_MODIFY'); if ($result < 0) { $error++; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 6ee279d2015..49db7cddc00 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1107,11 +1107,6 @@ class Fichinter extends CommonObject $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } - - // Call trigger - $result=$this->call_trigger('INTERVENTION_CLONE',$user); - if ($result < 0) $error++; - // End call triggers } unset($this->context['createfromclone']); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 588c13ca849..6f06a6778fd 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -101,7 +101,7 @@ if (empty($reshook)) $result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int')); if ($result < 0) dol_print_error($db,$object->error); } - + // update supplier order min amount if ($action == 'setsupplier_order_min_amount') { @@ -121,7 +121,7 @@ if (empty($reshook)) if ($ret < 0) $error++; if (! $error) { - $result = $object->insertExtraFields(); + $result = $object->insertExtraFields('COMPANY_MODIFY'); if ($result < 0) $error++; } if ($error) $action = 'edit_extras'; @@ -255,14 +255,14 @@ if ($object->id > 0) } print ""; print ''; - + print '