Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
This commit is contained in:
parent
e4ad082214
commit
c5bb55064f
@ -24,6 +24,7 @@ For users:
|
||||
- Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message
|
||||
- Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action
|
||||
- Fix: [ bug #1506, #1507 ] ECM trigger error problem
|
||||
- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
|
||||
|
||||
|
||||
|
||||
|
||||
@ -183,12 +183,10 @@ class Contact extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTACT_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -304,12 +302,10 @@ class Contact extends CommonObject
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTACT_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTACT_MODIFY',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -319,7 +315,6 @@ class Contact extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=join(',',$this->errors);
|
||||
dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -$error;
|
||||
@ -777,14 +772,10 @@ class Contact extends CommonObject
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if ($error) $this->error=join(',',$this->errors);
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTACT_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -1067,12 +1058,10 @@ class Contact extends CommonObject
|
||||
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
|
||||
if ($result)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTACT_ENABLEDISABLE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTACT_ENABLEDISABLE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if ($error)
|
||||
|
||||
@ -138,19 +138,30 @@ if (empty($reshook))
|
||||
if ($action == 'disable')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setstatus(0);
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
if ($object->setstatus(0)<0)
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation activation
|
||||
if ($action == 'enable')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setstatus(1);
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
|
||||
if ($object->setstatus(1)<0)
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Add contact
|
||||
@ -235,7 +246,8 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=$object->error; $errors=$object->errors;
|
||||
setEventMessage($object->error,'errors');
|
||||
setEventMessage($object->errors,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +307,8 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=$object->error; $errors=$object->errors;
|
||||
setEventMessage($object->error,'errors');
|
||||
setEventMessage($object->errors,'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
@ -367,6 +380,8 @@ else
|
||||
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
dol_fiche_head($head, 'card', $title, 0, 'contact');
|
||||
|
||||
dol_htmloutput_events();
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
|
||||
@ -211,6 +211,10 @@ class InterfaceDemo
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
}
|
||||
elseif ($action == 'CONTACT_ENABLEDISABLE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
}
|
||||
|
||||
// Products
|
||||
elseif ($action == 'PRODUCT_CREATE')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user