FIX: Error on add contact (#35460)
* FIX: Error on add contact Trigger COMMANDE_ADD_CONTACT causing error when adding a contact to and order, this fix updates the COMMANDE prefix to ORDER * FIX: delete contact This fixes the trigger call for delete contact on orders * FIX: Update patch Updated to reflect recent PR to add TRIGGER_PREFIX to commande class * Update commonobject.class.php Reduce risk of regression --------- Co-authored-by: brad <brad@endurotags.com.au> Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
75925aee71
commit
4f81ffb308
1 changed files with 4 additions and 8 deletions
|
|
@ -1347,7 +1347,8 @@ abstract class CommonObject
|
|||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if (!$notrigger) {
|
||||
$result = $this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
||||
$triggerPrefix = (empty($this->TRIGGER_PREFIX) ? strtoupper($this->element) : $this->TRIGGER_PREFIX);
|
||||
$result = $this->call_trigger($triggerPrefix.'_ADD_CONTACT', $user);
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
|
|
@ -1445,7 +1446,8 @@ abstract class CommonObject
|
|||
if (!$error && empty($notrigger)) {
|
||||
// Call trigger
|
||||
$this->context['contact_id'] = ((int) $rowid);
|
||||
$result = $this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user);
|
||||
$triggerPrefix = (empty($this->TRIGGER_PREFIX) ? strtoupper($this->element) : $this->TRIGGER_PREFIX);
|
||||
$result = $this->call_trigger($triggerPrefix.'_DELETE_CONTACT', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -2728,9 +2730,6 @@ abstract class CommonObject
|
|||
if (!$error && !$notrigger) {
|
||||
// Call triggers
|
||||
$triggerName = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
|
||||
if (get_class($this) == 'Commande') {
|
||||
$triggerName = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
|
||||
}
|
||||
$result = $this->call_trigger($triggerName.'_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -3245,9 +3244,6 @@ abstract class CommonObject
|
|||
// Call trigger
|
||||
$this->context = array('shippingmethodupdate' => 1);
|
||||
$triggerPrefix = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
|
||||
if (get_class($this) == 'Commande') {
|
||||
$triggerPrefix = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
|
||||
}
|
||||
$result = $this->call_trigger($triggerPrefix.'_MODIFY', $userused);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue