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