Conflicts:
	htdocs/fichinter/class/fichinter.class.php
This commit is contained in:
Laurent Destailleur 2017-09-11 14:41:46 +02:00
parent 029f1c411f
commit 6da5a6b82f

View File

@ -39,7 +39,7 @@ class Fichinter extends CommonObject
public $fk_element='fk_fichinter'; public $fk_element='fk_fichinter';
public $table_element_line='fichinterdet'; public $table_element_line='fichinterdet';
public $picto = 'intervention'; public $picto = 'intervention';
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -361,7 +361,7 @@ class Fichinter extends CommonObject
$this->fk_contrat = $obj->fk_contrat; $this->fk_contrat = $obj->fk_contrat;
$this->user_creation= $obj->fk_user_author; $this->user_creation= $obj->fk_user_author;
$this->extraparams = (array) json_decode($obj->extraparams, true); $this->extraparams = (array) json_decode($obj->extraparams, true);
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
@ -542,27 +542,26 @@ class Fichinter extends CommonObject
/** /**
* Returns amount based on user thm * Returns amount based on user thm
* *
* @return float amount * @return float Amount
*/ */
function getAmount() { function getAmount()
{
global $db; global $db;
$amount = 0; $amount = 0;
$this->author = new User($db); $this->author = new User($db);
$this->author->fetch($this->user_creation); $this->author->fetch($this->user_creation);
$thm = $this->author->thm; $thm = $this->author->thm;
foreach($this->lines as &$line) { foreach($this->lines as $line) {
$amount += ($line->duration / 60 / 60 * $thm);
$amount+=$line->qty * $thm;
} }
return $amount; return price2num($amount, 'MT');
} }
/** /**
* Returns the label status * Returns the label status
* *
@ -599,7 +598,7 @@ class Fichinter extends CommonObject
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
if ($mode == 6) if ($mode == 6)
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); return '<span class="hideonsmartphone">'.$langs->trans($this->statuts[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
return ''; return '';
} }
@ -949,7 +948,7 @@ class Fichinter extends CommonObject
return -2; return -2;
} }
/** /**
* Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
@ -1001,7 +1000,7 @@ class Fichinter extends CommonObject
$this->date_creation = ''; $this->date_creation = '';
$this->date_validation = ''; $this->date_validation = '';
$this->ref_client = ''; $this->ref_client = '';
// Create clone // Create clone
$result=$this->create($user); $result=$this->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
@ -1013,7 +1012,7 @@ class Fichinter extends CommonObject
{ {
$this->addline($user, $this->id, $line->desc, $line->datei, $line->duration); $this->addline($user, $this->id, $line->desc, $line->datei, $line->duration);
} }
// Hook of thirdparty module // Hook of thirdparty module
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
@ -1043,8 +1042,8 @@ class Fichinter extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Adding a line of intervention into data base * Adding a line of intervention into data base
* *