2
0
forked from Wavyzz/dolibarr

Merge pull request #1014 from defrance69/patch-16

Update fichinter.class.php
This commit is contained in:
Laurent Destailleur
2013-06-03 14:36:47 -07:00

View File

@@ -52,6 +52,7 @@ class Fichinter extends CommonObject
var $note_private;
var $note_public;
var $fk_project;
var $fk_contrat;
var $modelpdf;
var $extraparams=array();
@@ -67,6 +68,7 @@ class Fichinter extends CommonObject
$this->db = $db;
$this->products = array();
$this->fk_project = 0;
$this->fk_contrat = 0;
$this->statut = 0;
// List of language codes for status
@@ -137,6 +139,7 @@ class Fichinter extends CommonObject
$sql.= ", description";
$sql.= ", model_pdf";
$sql.= ", fk_projet";
$sql.= ", fk_contrat";
$sql.= ", fk_statut";
$sql.= ", note_private";
$sql.= ", note_public";
@@ -150,6 +153,7 @@ class Fichinter extends CommonObject
$sql.= ", ".($this->description?"'".$this->db->escape($this->description)."'":"null");
$sql.= ", '".$this->modelpdf."'";
$sql.= ", ".($this->fk_project ? $this->fk_project : 0);
$sql.= ", ".($this->fk_contrat ? $this->fk_contrat : 0);
$sql.= ", ".$this->statut;
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
@@ -823,6 +827,40 @@ class Fichinter extends CommonObject
}
}
/**
* Define the label of the contract
*
* @param User $user Object user who modify
* @param string $description description
* @return int <0 if ko, >0 if ok
*/
function set_contrat($user, $contratid)
{
global $conf;
if ($user->rights->ficheinter->creer)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
$sql.= " SET fk_contrat = '".$contratid."'";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
//$sql.= " AND fk_statut = 0";
if ($this->db->query($sql))
{
$this->fk_contrat = $contratid;
return 1;
}
else
{
$this->error=$this->db->error();
dol_syslog("Fichinter::set_contrat Erreur SQL");
return -1;
}
}
}
/**
* Adding a line of intervention into data base
*