mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 14:31:29 +01:00
ok on insert
This commit is contained in:
@@ -855,7 +855,7 @@ class Fichinter extends CommonObject
|
|||||||
* @param int $duration Intervention duration
|
* @param int $duration Intervention duration
|
||||||
* @return int >0 if ok, <0 if ko
|
* @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");
|
dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration");
|
||||||
|
|
||||||
@@ -871,9 +871,15 @@ class Fichinter extends CommonObject
|
|||||||
$line->datei = $date_intervention;
|
$line->datei = $date_intervention;
|
||||||
$line->duration = $duration;
|
$line->duration = $duration;
|
||||||
|
|
||||||
|
if (is_array($array_option) && count($array_option)>0) {
|
||||||
|
$line->array_options=$array_option;
|
||||||
|
}
|
||||||
|
|
||||||
$result=$line->insert($user);
|
$result=$line->insert($user);
|
||||||
if ($result > 0)
|
|
||||||
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1091,21 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
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();
|
$result=$this->update_total();
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->rang=$rangToUse;
|
$this->rang=$rangToUse;
|
||||||
@@ -1143,6 +1163,17 @@ class FichinterLigne extends CommonObjectLine
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
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();
|
$result=$this->update_total();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -266,12 +266,20 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
|
|||||||
$duration = 0;
|
$duration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$predef = '';
|
||||||
|
// Extrafields
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||||
|
|
||||||
|
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$user,
|
$user,
|
||||||
$id,
|
$id,
|
||||||
$desc,
|
$desc,
|
||||||
$date_intervention,
|
$date_intervention,
|
||||||
$duration
|
$duration,
|
||||||
|
$array_option
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@@ -433,12 +441,19 @@ else if ($action == "addline" && $user->rights->ficheinter->creer)
|
|||||||
$date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int'));
|
$date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int'));
|
||||||
$duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int'));
|
$duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int'));
|
||||||
|
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||||
|
|
||||||
$result=$object->addline(
|
$result=$object->addline(
|
||||||
$user,
|
$user,
|
||||||
$id,
|
$id,
|
||||||
$desc,
|
$desc,
|
||||||
$date_intervention,
|
$date_intervention,
|
||||||
$duration
|
$duration,
|
||||||
|
$array_option
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
@@ -524,6 +539,13 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST(
|
|||||||
$objectline->datei = $date_inter;
|
$objectline->datei = $date_inter;
|
||||||
$objectline->desc = $desc;
|
$objectline->desc = $desc;
|
||||||
$objectline->duration = $duration;
|
$objectline->duration = $duration;
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||||
|
$objectline->array_options = $array_option;
|
||||||
|
|
||||||
$result = $objectline->update($user);
|
$result = $objectline->update($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user