Merge pull request #955 from FHenry/3.4
Fix error management and SQL resquest in action comm
This commit is contained in:
commit
2ac738d8c4
@ -54,6 +54,7 @@ For users:
|
||||
- New: [ task #741 ] Add intervention box.
|
||||
- New: [ task #826 ] Optionnal increase stock when deleting an invoice already validated.
|
||||
- New: [ task #823 ] Shipping_validate email notification.
|
||||
- New: [ task #900 ] Review code of ficheinter.class.php
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
|
||||
@ -188,8 +188,8 @@ class ActionComm extends CommonObject
|
||||
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").",";
|
||||
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").",";
|
||||
$sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").",";
|
||||
$sql.= " '".$this->type_id."',";
|
||||
$sql.= " '".$this->code."',";
|
||||
$sql.= (isset($this->type_id)?$this->type_id:"null").",";
|
||||
$sql.= (isset($this->code)?" '".$this->code."'":"null").",";
|
||||
$sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").",";
|
||||
$sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").",";
|
||||
$sql.= " '".$this->db->escape($this->note)."',";
|
||||
|
||||
@ -243,6 +243,7 @@ if ($action == 'add_action')
|
||||
$db->rollback();
|
||||
$langs->load("errors");
|
||||
$error=$langs->trans($actioncomm->error);
|
||||
setEventMessage($error,'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
@ -251,6 +252,7 @@ if ($action == 'add_action')
|
||||
$db->rollback();
|
||||
$langs->load("errors");
|
||||
$error=$langs->trans($actioncomm->error);
|
||||
setEventMessage($error,'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
@ -277,6 +279,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||
else
|
||||
{
|
||||
$mesg=$actioncomm->error;
|
||||
setEventMessage($mesg,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1845,7 +1845,11 @@ else
|
||||
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
if ($action == 'edit_extras') {
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
} else {
|
||||
$value=$object->array_options["options_".$key];
|
||||
}
|
||||
if ($extrafields->attribute_type[$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
|
||||
@ -2554,6 +2554,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' WHERE pt.fk_propal = '.$this->id;
|
||||
$sql.= ' ORDER BY pt.rang ASC, pt.rowid';
|
||||
|
||||
dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -2834,7 +2834,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* Update value of extrafields on the proposal
|
||||
* Update value of extrafields on order
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @return int <0 if ko, >0 if ok
|
||||
|
||||
@ -2145,7 +2145,11 @@ else
|
||||
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
if ($action == 'edit_extras') {
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
} else {
|
||||
$value=$object->array_options["options_".$key];
|
||||
}
|
||||
if ($extrafields->attribute_type[$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
|
||||
@ -3291,7 +3291,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
if ($action == 'edit_extras') {
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
} else {
|
||||
$value=$object->array_options["options_".$key];
|
||||
}
|
||||
if ($extrafields->attribute_type[$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
|
||||
@ -3203,6 +3203,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
||||
|
||||
dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -187,7 +187,7 @@ abstract class CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
||||
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
|
||||
$sql.= $this->db->idate($datecreate);
|
||||
$sql.= "'".$this->db->idate($datecreate)."'";
|
||||
$sql.= ", 4, '". $id_type_contact . "' ";
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::add_contact sql=".$sql);
|
||||
@ -2517,6 +2517,9 @@ abstract class CommonObject
|
||||
if ($objecttype == 'cabinetmed_cons') {
|
||||
$classpath = 'cabinetmed/class'; $module='cabinetmed'; $subelement='cabinetmedcons';
|
||||
}
|
||||
if ($objecttype == 'fichinter') {
|
||||
$classpath = 'fichinter/class'; $module='ficheinter'; $subelement='fichinter';
|
||||
}
|
||||
|
||||
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
|
||||
|
||||
|
||||
@ -445,7 +445,7 @@ class ExtraFields
|
||||
|
||||
if(is_array($param) && count($param) > 0)
|
||||
{
|
||||
$param = serialize($param);
|
||||
$param = $this->db->escape(serialize($param));
|
||||
}
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
|
||||
@ -49,8 +49,8 @@
|
||||
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();}
|
||||
else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();}
|
||||
else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();}
|
||||
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();}
|
||||
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();}
|
||||
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();}
|
||||
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();}
|
||||
else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();}
|
||||
else size.val('').attr('disabled','disabled');
|
||||
}
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/fichinter/class/fichinter.class.php
|
||||
* \ingroup ficheinter
|
||||
* \brief Fichier de la classe des gestion des fiches interventions
|
||||
*/
|
||||
* \ingroup ficheinter
|
||||
* \brief Fichier de la classe des gestion des fiches interventions
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ class Fichinter extends CommonObject
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
@ -82,16 +82,20 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* Create an intervention into data base
|
||||
*
|
||||
* @param User $user Objet user that make creation
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create()
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::create ref=".$this->ref);
|
||||
|
||||
// Check parameters
|
||||
if (! is_numeric($this->duree)) { $this->duree = 0; }
|
||||
if (! is_numeric($this->duree)) {
|
||||
$this->duree = 0;
|
||||
}
|
||||
if ($this->socid <= 0)
|
||||
{
|
||||
$this->error='ErrorBadParameterForFunc';
|
||||
@ -142,7 +146,7 @@ class Fichinter extends CommonObject
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", '".$this->ref."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->author;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".($this->description?"'".$this->db->escape($this->description)."'":"null");
|
||||
$sql.= ", '".$this->modelpdf."'";
|
||||
$sql.= ", ".($this->fk_project ? $this->fk_project : 0);
|
||||
@ -156,33 +160,33 @@ class Fichinter extends CommonObject
|
||||
if ($result)
|
||||
{
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
|
||||
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->ref."' WHERE rowid=".$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) $error++;
|
||||
}
|
||||
// Add linked object
|
||||
if (! $error && $this->origin && $this->origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked();
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($this->author);
|
||||
$result=$interface->run_triggers('FICHINTER_CREATE',$this,$tmpuser,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
// Add linked object
|
||||
if (! $error && $this->origin && $this->origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked();
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -210,12 +214,18 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* Update an intervention
|
||||
*
|
||||
* @param User $user Objet user that make creation
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update()
|
||||
function update($user, $notrigger=0)
|
||||
{
|
||||
if (! is_numeric($this->duree)) { $this->duree = 0; }
|
||||
if (! dol_strlen($this->fk_project)) { $this->fk_project = 0; }
|
||||
if (! is_numeric($this->duree)) {
|
||||
$this->duree = 0;
|
||||
}
|
||||
if (! dol_strlen($this->fk_project)) {
|
||||
$this->fk_project = 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -230,14 +240,18 @@ class Fichinter extends CommonObject
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// 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;
|
||||
|
||||
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_UPDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -297,7 +311,7 @@ class Fichinter extends CommonObject
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
*/
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -368,7 +382,7 @@ class Fichinter extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
|
||||
// Define new ref
|
||||
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
|
||||
{
|
||||
@ -396,7 +410,9 @@ class Fichinter extends CommonObject
|
||||
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; }
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
if (! $error)
|
||||
@ -510,7 +526,7 @@ class Fichinter extends CommonObject
|
||||
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0)
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -636,18 +652,18 @@ class Fichinter extends CommonObject
|
||||
* @param User $user Object user who delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Delete linked object
|
||||
$res = $this->deleteObjectLinked();
|
||||
if ($res < 0) $error++;
|
||||
$res = $this->deleteObjectLinked();
|
||||
if ($res < 0) $error++;
|
||||
|
||||
// Delete linked contacts
|
||||
$res = $this->delete_linked_contact();
|
||||
@ -703,15 +719,17 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
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
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -799,13 +817,14 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* Adding a line of intervention into data base
|
||||
*
|
||||
* @param user $user User that do the action
|
||||
* @param int $fichinterid Id of intervention
|
||||
* @param string $desc Line description
|
||||
* @param date $date_intervention Intervention date
|
||||
* @param int $duration Intervention duration
|
||||
* @return int >0 if ok, <0 if ko
|
||||
*/
|
||||
function addline($fichinterid, $desc, $date_intervention, $duration)
|
||||
function addline($user,$fichinterid, $desc, $date_intervention, $duration)
|
||||
{
|
||||
dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration");
|
||||
|
||||
@ -821,7 +840,7 @@ class Fichinter extends CommonObject
|
||||
$line->datei = $date_intervention;
|
||||
$line->duration = $duration;
|
||||
|
||||
$result=$line->insert();
|
||||
$result=$line->insert($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -839,11 +858,11 @@ class Fichinter extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
@ -868,7 +887,7 @@ class Fichinter extends CommonObject
|
||||
$line->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$line->datei=($now-3600*(1+$xnbp));
|
||||
$line->duration=600;
|
||||
$line->fk_fichinter=0;
|
||||
$line->fk_fichinter=0;
|
||||
$this->lines[$xnbp]=$line;
|
||||
$xnbp++;
|
||||
|
||||
@ -988,10 +1007,14 @@ class FichinterLigne
|
||||
/**
|
||||
* Insert the line into database
|
||||
*
|
||||
* @param User $user Objet user that make creation
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function insert()
|
||||
function insert($user, $notrigger=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
dol_syslog("FichinterLigne::insert rang=".$this->rang);
|
||||
|
||||
$this->db->begin();
|
||||
@ -1021,7 +1044,7 @@ class FichinterLigne
|
||||
$sql.= ' (fk_fichinter, description, date, duree, rang)';
|
||||
$sql.= " VALUES (".$this->fk_fichinter.",";
|
||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||
$sql.= " ".$this->db->idate($this->datei).",";
|
||||
$sql.= " '".$this->db->idate($this->datei)."',";
|
||||
$sql.= " ".$this->duration.",";
|
||||
$sql.= ' '.$rangToUse;
|
||||
$sql.= ')';
|
||||
@ -1034,6 +1057,21 @@ class FichinterLigne
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->rang=$rangToUse;
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$resulttrigger=$interface->run_triggers('FICHINTERDET_CREATE',$this,$user,$langs,$conf);
|
||||
if ($resulttrigger < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
}
|
||||
@ -1056,10 +1094,14 @@ class FichinterLigne
|
||||
/**
|
||||
* Update intervention into database
|
||||
*
|
||||
* @param User $user Objet user that make creation
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function update()
|
||||
function update($user,$notrigger=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour ligne en base
|
||||
@ -1076,6 +1118,22 @@ class FichinterLigne
|
||||
{
|
||||
$result=$this->update_total();
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$resulttrigger=$interface->run_triggers('FICHINTERDET_UPDATE',$this,$user,$langs,$conf);
|
||||
if ($resulttrigger < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
@ -1152,10 +1210,14 @@ class FichinterLigne
|
||||
/**
|
||||
* Delete a intervention line
|
||||
*
|
||||
* @param User $user Objet user that make creation
|
||||
* @param int $notrigger Disable all triggers
|
||||
* @return int >0 if ok, <0 if ko
|
||||
*/
|
||||
function deleteline()
|
||||
function deleteline($user,$notrigger=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid);
|
||||
@ -1171,6 +1233,19 @@ class FichinterLigne
|
||||
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('FICHINTERDET_DELETE',$this,$user,$langs,$conf);
|
||||
if ($resulttrigger < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user