FIX Trigger *_MODIFY must be called when editing a property event extra.
Clean duplicate trigggers "*_CLONE"
This commit is contained in:
parent
15ba0c3b49
commit
809ef1bd00
@ -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:
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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 "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
|
||||
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -1368,11 +1368,6 @@ class CommandeFournisseur 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_SUPPLIER_CLONE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
unset($this->context['createfromclone']);
|
||||
|
||||
@ -963,7 +963,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$object->insertExtraFields();
|
||||
$result=$object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@ -1274,7 +1274,7 @@ if (empty($reshook))
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
|
||||
$result=$object->insertExtraFields();
|
||||
$result=$object->insertExtraFields('BILL_SUPPLIER_MODIFY');
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@ -206,7 +206,7 @@ if ($action == 'update_extras')
|
||||
$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('DELIVERY_MODIFY');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -151,13 +151,13 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
case 'STOCK_MOVEMENT':
|
||||
|
||||
//MYECMDIR
|
||||
case 'MYECMDIR_DELETE':
|
||||
case 'MYECMDIR_CREATE':
|
||||
case 'MYECMDIR_MODIFY':
|
||||
case 'MYECMDIR_DELETE':
|
||||
|
||||
// Customer orders
|
||||
case 'ORDER_CREATE':
|
||||
case 'ORDER_CLONE':
|
||||
case 'ORDER_MODIFY':
|
||||
case 'ORDER_VALIDATE':
|
||||
case 'ORDER_DELETE':
|
||||
case 'ORDER_CANCEL':
|
||||
@ -170,7 +170,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
|
||||
// Supplier orders
|
||||
case 'ORDER_SUPPLIER_CREATE':
|
||||
case 'ORDER_SUPPLIER_CLONE':
|
||||
case 'ORDER_SUPPLIER_MODIFY':
|
||||
case 'ORDER_SUPPLIER_VALIDATE':
|
||||
case 'ORDER_SUPPLIER_DELETE':
|
||||
case 'ORDER_SUPPLIER_APPROVE':
|
||||
@ -184,7 +184,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
|
||||
// Proposals
|
||||
case 'PROPAL_CREATE':
|
||||
case 'PROPAL_CLONE':
|
||||
case 'PROPAL_MODIFY':
|
||||
case 'PROPAL_VALIDATE':
|
||||
case 'PROPAL_SENTBYMAIL':
|
||||
@ -197,7 +196,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
|
||||
// SupplierProposal
|
||||
case 'SUPPLIER_PROPOSAL_CREATE':
|
||||
case 'SUPPLIER_PROPOSAL_CLONE':
|
||||
case 'SUPPLIER_PROPOSAL_MODIFY':
|
||||
case 'SUPPLIER_PROPOSAL_VALIDATE':
|
||||
case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
|
||||
@ -210,8 +208,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
|
||||
// Contracts
|
||||
case 'CONTRACT_CREATE':
|
||||
case 'CONTRACT_ACTIVATE':
|
||||
case 'CONTRACT_MODIFY':
|
||||
case 'CONTRACT_ACTIVATE':
|
||||
case 'CONTRACT_CANCEL':
|
||||
case 'CONTRACT_CLOSE':
|
||||
case 'CONTRACT_DELETE':
|
||||
@ -221,7 +219,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
|
||||
// Bills
|
||||
case 'BILL_CREATE':
|
||||
case 'BILL_CLONE':
|
||||
case 'BILL_MODIFY':
|
||||
case 'BILL_VALIDATE':
|
||||
case 'BILL_UNVALIDATE':
|
||||
|
||||
@ -135,7 +135,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('PRODUCT_LOT_MODIFY');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -334,7 +334,7 @@ if (empty($reshook))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->insertExtraFields();
|
||||
$result = $object->insertExtraFields('COMPANY_MODIFY');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -934,7 +934,7 @@ if (empty($reshook))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->insertExtraFields();
|
||||
$result = $object->insertExtraFields('SUPPLIER_PROPOSAL_MODIFY');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -1101,11 +1101,6 @@ class SupplierProposal 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('SUPPLIER_PROPOSAL_CLONE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
// End
|
||||
|
||||
Loading…
Reference in New Issue
Block a user