commit
8c306a968f
10
ChangeLog
10
ChangeLog
@ -10,12 +10,22 @@ For users:
|
|||||||
- New: Can filter events on a group of users.
|
- New: Can filter events on a group of users.
|
||||||
- New: Add thirdparty to filter on events.
|
- New: Add thirdparty to filter on events.
|
||||||
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
|
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
|
||||||
|
- Fix: [ bug #1470, #1472, #1473] User trigger problem
|
||||||
|
- Fix: [ bug #1489, #1491 ] Intervention trigger problem
|
||||||
|
- Fix: [ bug #1492, #1493 ] Member trigger problem
|
||||||
|
- Fix: [ bug #1474, #1475 ] Contract trigger problem
|
||||||
|
- Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error
|
||||||
|
- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action
|
||||||
|
- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action
|
||||||
|
- Fix: [ bug #1505, #1504] Project trigger problem
|
||||||
|
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Update language files.
|
- Update language files.
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- New: Add hook "searchAgendaFrom".
|
- New: Add hook "searchAgendaFrom".
|
||||||
|
- New: Add trigger DON_UPDATE, DON_DELETE
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.6 compared to 3.5.* *****
|
***** ChangeLog for 3.6 compared to 3.5.* *****
|
||||||
|
|||||||
@ -105,10 +105,8 @@ class Skeleton_Class extends CommonObject
|
|||||||
// want this action calls a trigger.
|
// want this action calls a trigger.
|
||||||
|
|
||||||
//// Call triggers
|
//// Call triggers
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||||
//$interface=new Interfaces($this->db);
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
//// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,10 +214,8 @@ class Skeleton_Class extends CommonObject
|
|||||||
// want this action calls a trigger.
|
// want this action calls a trigger.
|
||||||
|
|
||||||
//// Call triggers
|
//// Call triggers
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||||
//$interface=new Interfaces($this->db);
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
//// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,10 +261,8 @@ class Skeleton_Class extends CommonObject
|
|||||||
// want this action calls a trigger.
|
// want this action calls a trigger.
|
||||||
|
|
||||||
//// Call triggers
|
//// Call triggers
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||||
//$interface=new Interfaces($this->db);
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
//// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -347,12 +347,10 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('MEMBER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->errors))
|
if (count($this->errors))
|
||||||
@ -599,12 +597,10 @@ class Adherent 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('MEMBER_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('MEMBER_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,12 +778,10 @@ class Adherent 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('MEMBER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {$error++; $this->errors=$interface->errors;}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -841,6 +835,8 @@ class Adherent extends CommonObject
|
|||||||
$password_indatabase = $password;
|
$password_indatabase = $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Mise a jour
|
// Mise a jour
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
@ -885,23 +881,24 @@ class Adherent 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('MEMBER_NEW_PASSWORD',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('MEMBER_NEW_PASSWORD',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return $this->pass;
|
return $this->pass;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1301,12 +1298,10 @@ class Adherent extends CommonObject
|
|||||||
$this->last_subscription_date_start=$date;
|
$this->last_subscription_date_start=$date;
|
||||||
$this->last_subscription_date_end=$datefin;
|
$this->last_subscription_date_end=$datefin;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('MEMBER_SUBSCRIPTION',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1362,12 +1357,10 @@ class Adherent extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->statut=1;
|
$this->statut=1;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('MEMBER_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('MEMBER_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -1412,12 +1405,10 @@ class Adherent extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->statut=0;
|
$this->statut=0;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('MEMBER_RESILIATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('MEMBER_RESILIATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -213,15 +213,21 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CATEGORY_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
|
if ( ! $error )
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $id;
|
return $id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -303,12 +309,10 @@ class Categorie extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CATEGORY_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('CATEGORY_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -432,12 +436,10 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CATEGORY_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CATEGORY_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=join(',',$this->errors); }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,6 +479,8 @@ class Categorie extends CommonObject
|
|||||||
if ($type=='contact') $column_name='socpeople';
|
if ($type=='contact') $column_name='socpeople';
|
||||||
if ($type=='fournisseur') $column_name='societe';
|
if ($type=='fournisseur') $column_name='societe';
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")";
|
||||||
$sql .= " VALUES (".$this->id.", ".$obj->id.")";
|
$sql .= " VALUES (".$this->id.", ".$obj->id.")";
|
||||||
|
|
||||||
@ -517,6 +521,7 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,18 +529,26 @@ class Categorie extends CommonObject
|
|||||||
// Save object we want to link category to into category instance to provide information to trigger
|
// Save object we want to link category to into category instance to provide information to trigger
|
||||||
$this->linkto=$obj;
|
$this->linkto=$obj;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CATEGORY_LINK',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CATEGORY_LINK',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=$interface->error; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error) return 1;
|
if (! $error)
|
||||||
else return -2;
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterrno();
|
$this->error=$this->db->lasterrno();
|
||||||
@ -571,6 +584,8 @@ class Categorie extends CommonObject
|
|||||||
if ($type=='contact') $column_name='socpeople';
|
if ($type=='contact') $column_name='socpeople';
|
||||||
if ($type=='fournisseur') $column_name='societe';
|
if ($type=='fournisseur') $column_name='societe';
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type;
|
||||||
$sql .= " WHERE fk_categorie = ".$this->id;
|
$sql .= " WHERE fk_categorie = ".$this->id;
|
||||||
$sql .= " AND fk_".$column_name." = ".$obj->id;
|
$sql .= " AND fk_".$column_name." = ".$obj->id;
|
||||||
@ -581,18 +596,25 @@ class Categorie extends CommonObject
|
|||||||
// Save object we want to unlink category off into category instance to provide information to trigger
|
// Save object we want to unlink category off into category instance to provide information to trigger
|
||||||
$this->unlinkoff=$obj;
|
$this->unlinkoff=$obj;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CATEGORY_UNLINK',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CATEGORY_UNLINK',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error) return 1;
|
if (! $error)
|
||||||
else return -2;
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,14 +227,10 @@ class ActionComm 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('ACTION_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('ACTION_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -390,14 +386,10 @@ class ActionComm extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ACTION_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('ACTION_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -500,14 +492,10 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ACTION_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('ACTION_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -283,8 +283,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
setEventMessage($object->error,'errors');
|
||||||
setEventMessage($mesg,'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -308,6 +308,8 @@ class Don extends CommonObject
|
|||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
||||||
$sql.= "datec";
|
$sql.= "datec";
|
||||||
$sql.= ", entity";
|
$sql.= ", entity";
|
||||||
@ -360,19 +362,17 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."don");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."don");
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('DON_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('DON_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -393,6 +393,8 @@ class Don extends CommonObject
|
|||||||
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
||||||
$this->country=($this->country?$this->country:$this->country);
|
$this->country=($this->country?$this->country:$this->country);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
||||||
$sql .= "amount = " . price2num($this->amount);
|
$sql .= "amount = " . price2num($this->amount);
|
||||||
$sql .= ",fk_paiement = ".($this->modepaiementid?$this->modepaiementid:"null");
|
$sql .= ",fk_paiement = ".($this->modepaiementid?$this->modepaiementid:"null");
|
||||||
@ -418,10 +420,17 @@ class Don extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('DON_UPDATE',$user);
|
||||||
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -436,6 +445,8 @@ class Don extends CommonObject
|
|||||||
function delete($rowid)
|
function delete($rowid)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->db-begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -443,10 +454,17 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
if ( $this->db->affected_rows($resql) )
|
if ( $this->db->affected_rows($resql) )
|
||||||
{
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('DON_DELETE',$user);
|
||||||
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,12 +158,10 @@ class Contrat extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTRACT_SERVICE_ACTIVATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('CONTRACT_SERVICE_ACTIVATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -206,12 +204,10 @@ class Contrat extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTRACT_SERVICE_CLOSE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('CONTRACT_SERVICE_CLOSE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -322,6 +318,7 @@ class Contrat extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR);
|
dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR);
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -365,12 +362,10 @@ class Contrat extends CommonObject
|
|||||||
// Trigger calls
|
// Trigger calls
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTRACT_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTRACT_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -386,7 +381,6 @@ class Contrat extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,12 +750,10 @@ class Contrat 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('CONTRACT_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTRACT_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -776,7 +768,6 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$interface->error;
|
|
||||||
dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR);
|
||||||
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
@ -903,14 +894,10 @@ class Contrat 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('CONTRACT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -939,7 +926,6 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
|
||||||
dol_syslog(get_class($this)."::delete ERROR ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ERROR ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
@ -1255,6 +1241,9 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
if ($this->statut >= 0)
|
if ($this->statut >= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
||||||
$sql.= " WHERE rowid=".$idline;
|
$sql.= " WHERE rowid=".$idline;
|
||||||
|
|
||||||
@ -1264,16 +1253,16 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINECONTRACT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('LINECONTRACT_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2064,6 +2053,8 @@ class ContratLigne
|
|||||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||||
$sql.= " fk_contrat='".$this->fk_contrat."',";
|
$sql.= " fk_contrat='".$this->fk_contrat."',";
|
||||||
@ -2111,19 +2102,19 @@ class ContratLigne
|
|||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('LINECONTRACT_UPDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -119,6 +119,8 @@ class InterfaceDemo
|
|||||||
}
|
}
|
||||||
elseif ($action == 'USER_CREATE')
|
elseif ($action == 'USER_CREATE')
|
||||||
{
|
{
|
||||||
|
$object->error=$action;
|
||||||
|
return -1;
|
||||||
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 == 'USER_CREATE_FROM_CONTACT')
|
elseif ($action == 'USER_CREATE_FROM_CONTACT')
|
||||||
@ -150,6 +152,20 @@ 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 == 'USER_REMOVEFROMGROUP')
|
elseif ($action == 'USER_REMOVEFROMGROUP')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action
|
||||||
|
elseif ($action == 'ACTION_MODIFY')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'ACTION_CREATE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'ACTION_DELETE')
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -488,6 +504,22 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Donation
|
||||||
|
elseif ($action == 'DON_CREATE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'DON_UPDATE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'DON_DELETE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Interventions
|
// Interventions
|
||||||
elseif ($action == 'FICHINTER_CREATE')
|
elseif ($action == 'FICHINTER_CREATE')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -176,13 +176,10 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('FICHINTER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -240,14 +237,10 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('FICHINTER_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -454,14 +447,10 @@ class Fichinter 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('FICHINTER_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('FICHINTER_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -762,14 +751,10 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('FICHINTER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1137,14 +1122,10 @@ class FichinterLigne
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEFICHINTER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$resulttrigger=$interface->run_triggers('LINEFICHINTER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($resulttrigger < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,14 +1180,10 @@ class FichinterLigne
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEFICHINTER_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$resulttrigger=$interface->run_triggers('LINEFICHINTER_UPDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($resulttrigger < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,7 +1194,6 @@ class FichinterLigne
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
dol_syslog("FichinterLigne::update Error ".$this->error, LOG_ERR);
|
dol_syslog("FichinterLigne::update Error ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
@ -1309,20 +1285,15 @@ class FichinterLigne
|
|||||||
$result = $this->update_total();
|
$result = $this->update_total();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEFICHINTER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$resulttrigger=$interface->run_triggers('LINEFICHINTER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($resulttrigger < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -130,15 +130,9 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROJECT_CREATE',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result = $interface->run_triggers('PROJECT_CREATE', $this, $user, $langs, $conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,6 +193,8 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
if (dol_strlen(trim($this->ref)) > 0)
|
if (dol_strlen(trim($this->ref)) > 0)
|
||||||
{
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "projet SET";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "projet SET";
|
||||||
$sql.= " ref='" . $this->db->escape($this->ref) . "'";
|
$sql.= " ref='" . $this->db->escape($this->ref) . "'";
|
||||||
$sql.= ", title = '" . $this->db->escape($this->title) . "'";
|
$sql.= ", title = '" . $this->db->escape($this->title) . "'";
|
||||||
@ -216,15 +212,9 @@ class Project extends CommonObject
|
|||||||
{
|
{
|
||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROJECT_MODIFY',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result = $interface->run_triggers('PROJECT_MODIFY', $this, $user, $langs, $conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,13 +249,24 @@ class Project extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! $error )
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
$result = 1;
|
$result = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$result = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,18 +529,19 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROJECT_DELETE',$user);
|
||||||
$interface = new Interfaces($this->db);
|
|
||||||
$result = $interface->run_triggers('PROJECT_DELETE', $this, $user, $langs, $conf);
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
if (! empty($interface->errors))
|
||||||
|
{
|
||||||
foreach ($interface->errors as $errmsg ) {
|
foreach ($interface->errors as $errmsg ) {
|
||||||
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
||||||
$this->errors[] =$errmsg;
|
$this->errors[] =$errmsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -587,16 +589,10 @@ class Project extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROJECT_VALIDATE',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result = $interface->run_triggers('PROJECT_VALIDATE', $this, $user, $langs, $conf);
|
// End call triggers
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
@ -648,16 +644,10 @@ class Project extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROJECT_CLOSE',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result = $interface->run_triggers('PROJECT_CLOSE', $this, $user, $langs, $conf);
|
// End call triggers
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -133,11 +133,9 @@ class Task extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TASK_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('TASK_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,11 +301,9 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TASK_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('TASK_MODIFY',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,11 +390,9 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TASK_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('TASK_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,12 +738,13 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$error=0;
|
|
||||||
$ret = 0;
|
$ret = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note);
|
if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time (";
|
||||||
$sql.= "fk_task";
|
$sql.= "fk_task";
|
||||||
$sql.= ", task_date";
|
$sql.= ", task_date";
|
||||||
@ -772,11 +767,9 @@ class Task extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TASK_TIMESPENT_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $this->db->rollback(); $ret=-1; }
|
||||||
$result=$interface->run_triggers('TASK_TIMESPENT_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -784,6 +777,7 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::addTimeSpent error -1 ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::addTimeSpent error -1 ".$this->error,LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
$ret = -1;
|
$ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,6 +792,7 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
$ret = -2;
|
$ret = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -813,10 +808,12 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
$ret = -2;
|
$ret = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ret >=0) $this->db->commit();
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -879,12 +876,13 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$error=0;
|
|
||||||
$ret = 0;
|
$ret = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note);
|
if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET";
|
||||||
$sql.= " task_date = '".$this->db->idate($this->timespent_date)."',";
|
$sql.= " task_date = '".$this->db->idate($this->timespent_date)."',";
|
||||||
$sql.= " task_duration = ".$this->timespent_duration.",";
|
$sql.= " task_duration = ".$this->timespent_duration.",";
|
||||||
@ -897,19 +895,23 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TASK_TIMESPENT_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('TASK_TIMESPENT_MODIFY',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
$this->db->rollback();
|
||||||
|
$ret = -1;
|
||||||
|
}
|
||||||
|
else $ret = 1;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
$ret = 1;
|
else $ret = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::updateTimeSpent error -1 ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::updateTimeSpent error -1 ".$this->error,LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
$ret = -1;
|
$ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,11 +927,13 @@ class Task extends CommonObject
|
|||||||
if (! $this->db->query($sql) )
|
if (! $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR);
|
||||||
$ret = -2;
|
$ret = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ret >= 0) $this->db->commit();
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,11 +963,9 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TASK_TIMESPENT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('TASK_TIMESPENT_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -340,7 +340,8 @@ if (empty($reshook))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog($object->error,LOG_DEBUG);
|
dol_syslog($object->error,LOG_DEBUG);
|
||||||
$mesg='<div class="error">'.$langs->trans("CantRemoveProject").'</div>';
|
setEventMessage($object->error,'errors');
|
||||||
|
setEventMessage($object->errors,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -131,6 +131,11 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
|||||||
{
|
{
|
||||||
$result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal');
|
$result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($task->error,'errors');
|
||||||
|
setEventMessage($task->errors,'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -194,6 +199,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$head=project_prepare_head($object);
|
$head=project_prepare_head($object);
|
||||||
dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project'));
|
dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project'));
|
||||||
|
|
||||||
|
dol_htmloutput_mesg();
|
||||||
|
|
||||||
$param=($mode=='mine'?'&mode=mine':'');
|
$param=($mode=='mine'?'&mode=mine':'');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|||||||
@ -91,6 +91,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
|
|||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
|
||||||
$result=$object->update($user);
|
$result=$object->update($user);
|
||||||
|
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessage($object->error,'errors');
|
||||||
|
setEventMessage($object->errors,'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -140,7 +140,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->c
|
|||||||
$object->fetchTimeSpent($_GET['lineid']);
|
$object->fetchTimeSpent($_GET['lineid']);
|
||||||
$result = $object->delTimeSpent($user);
|
$result = $object->delTimeSpent($user);
|
||||||
|
|
||||||
if (!$result)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans($object->error),'errors');
|
setEventMessage($langs->trans($object->error),'errors');
|
||||||
|
|||||||
@ -667,12 +667,10 @@ class User extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::setstatus sql=".$sql);
|
dol_syslog(get_class($this)."::setstatus sql=".$sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('USER_ENABLEDISABLE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('USER_ENABLEDISABLE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
@ -759,12 +757,15 @@ class User 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('USER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('USER_DELETE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
$error++;
|
||||||
// Fin appel triggers
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -866,12 +867,10 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('USER_CREATE',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result = $interface->run_triggers('USER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -881,7 +880,7 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$interface->error;
|
//$this->error=$interface->error;
|
||||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
@ -953,12 +952,10 @@ class User extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::create_from_contact sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create_from_contact sql=".$sql, LOG_DEBUG);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('USER_CREATE_FROM_CONTACT',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result = $interface->run_triggers('USER_CREATE_FROM_CONTACT',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@ -1271,12 +1268,10 @@ class User 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('USER_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('USER_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1286,7 +1281,6 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
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 -1;
|
return -1;
|
||||||
@ -1367,6 +1361,8 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this);
|
if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||||
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
|
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
|
||||||
$sql.= " pass_temp = null";
|
$sql.= " pass_temp = null";
|
||||||
@ -1420,23 +1416,24 @@ class User 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('USER_NEW_PASSWORD',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('USER_NEW_PASSWORD',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) $this->errors=$interface->errors;
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return $this->pass;
|
return $this->pass;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1677,12 +1674,10 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->newgroupid=$group;
|
$this->newgroupid=$group;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('USER_SETINGROUP',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('USER_SETINGROUP',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1692,7 +1687,6 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$interface->error;
|
|
||||||
dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
@ -1735,12 +1729,10 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->oldgroupid=$group;
|
$this->oldgroupid=$group;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('USER_REMOVEFROMGROUP',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('USER_REMOVEFROMGROUP',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -547,12 +547,10 @@ class UserGroup extends CommonObject
|
|||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('GROUP_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('GROUP_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -583,6 +581,8 @@ class UserGroup extends CommonObject
|
|||||||
$entity=$this->entity;
|
$entity=$this->entity;
|
||||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity;
|
if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup (";
|
||||||
$sql.= "datec";
|
$sql.= "datec";
|
||||||
$sql.= ", nom";
|
$sql.= ", nom";
|
||||||
@ -603,18 +603,18 @@ class UserGroup extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('GROUP_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
$result=$interface->run_triggers('GROUP_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,6 +639,8 @@ class UserGroup extends CommonObject
|
|||||||
$entity=$this->entity;
|
$entity=$this->entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET ";
|
||||||
$sql.= " nom = '" . $this->db->escape($this->nom) . "'";
|
$sql.= " nom = '" . $this->db->escape($this->nom) . "'";
|
||||||
$sql.= ", entity = " . $this->db->escape($entity);
|
$sql.= ", entity = " . $this->db->escape($entity);
|
||||||
@ -651,19 +653,26 @@ class UserGroup extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('GROUP_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('GROUP_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) return 1;
|
if (! $error)
|
||||||
else return -$error;
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -$error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user