mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 22:11:36 +01:00
ok on insert
This commit is contained in:
@@ -855,7 +855,7 @@ class Fichinter extends CommonObject
|
||||
* @param int $duration Intervention duration
|
||||
* @return int >0 if ok, <0 if ko
|
||||
*/
|
||||
function addline($user,$fichinterid, $desc, $date_intervention, $duration)
|
||||
function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_option=0)
|
||||
{
|
||||
dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration");
|
||||
|
||||
@@ -871,14 +871,20 @@ class Fichinter extends CommonObject
|
||||
$line->datei = $date_intervention;
|
||||
$line->duration = $duration;
|
||||
|
||||
if (is_array($array_option) && count($array_option)>0) {
|
||||
$line->array_options=$array_option;
|
||||
}
|
||||
|
||||
$result=$line->insert($user);
|
||||
if ($result > 0)
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
@@ -1085,7 +1091,21 @@ class FichinterLigne extends CommonObjectLine
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$this->id=$this->rowid;
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result=$this->update_total();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->rang=$rangToUse;
|
||||
@@ -1143,6 +1163,17 @@ class FichinterLigne extends CommonObjectLine
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$this->id=$this->rowid;
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$result=$this->update_total();
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user