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