mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Trad: Traduction du statut des fiches interventions
This commit is contained in:
@@ -35,187 +35,197 @@ require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
*/
|
||||
class Fichinter
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
var $socidp;
|
||||
var $author;
|
||||
var $ref;
|
||||
var $date;
|
||||
var $duree;
|
||||
var $note;
|
||||
var $projet_id;
|
||||
var $id;
|
||||
var $db;
|
||||
var $socidp;
|
||||
var $author;
|
||||
var $ref;
|
||||
var $date;
|
||||
var $duree;
|
||||
var $note;
|
||||
var $projet_id;
|
||||
|
||||
function Fichinter($DB, $soc_idp="")
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acc<63>s base de donn<6E>es
|
||||
* \param soc_idp Id societe
|
||||
*/
|
||||
function Fichinter($DB, $soc_idp="")
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->products = array();
|
||||
$this->projet_id = 0;
|
||||
global $langs;
|
||||
|
||||
$this->db = $DB ;
|
||||
$this->socidp = $soc_idp;
|
||||
$this->products = array();
|
||||
$this->projet_id = 0;
|
||||
|
||||
// Statut 0=brouillon, 1=valid<69>
|
||||
$this->statuts[0]=$langs->trans("Draft");
|
||||
$this->statuts[1]=$langs->trans("Validated");
|
||||
}
|
||||
|
||||
function add_product($idproduct)
|
||||
|
||||
function add_product($idproduct)
|
||||
{
|
||||
if ($idproduct > 0)
|
||||
{
|
||||
$i = sizeof($this->products);
|
||||
$this->products[$i] = $idproduct;
|
||||
}
|
||||
if ($idproduct > 0)
|
||||
{
|
||||
$i = sizeof($this->products);
|
||||
$this->products[$i] = $idproduct;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Cr<43>e une fiche intervention en base
|
||||
*
|
||||
*/
|
||||
function create()
|
||||
/*
|
||||
* \brief Cr<43>e une fiche intervention en base
|
||||
*
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
if (!strlen($this->duree)) { $this->duree = 0; }
|
||||
if (!strlen($this->duree)) { $this->duree = 0; }
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter (fk_soc, datei, datec, ref, fk_user_author, note, duree";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ",fk_projet";
|
||||
}
|
||||
$sql .= ") ";
|
||||
$sql .= " VALUES ($this->socidp, $this->date, now(), '$this->ref', $this->author, '$this->note', $this->duree";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ", $this->projet_id";
|
||||
}
|
||||
$sql .= ")";
|
||||
$sqlok = 0;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
return $this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter (fk_soc, datei, datec, ref, fk_user_author, note, duree";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ",fk_projet";
|
||||
}
|
||||
$sql .= ") ";
|
||||
$sql .= " VALUES ($this->socidp, $this->date, now(), '$this->ref', $this->author, '$this->note', $this->duree";
|
||||
if ($this->projet_id) {
|
||||
$sql .= ", $this->projet_id";
|
||||
}
|
||||
$sql .= ")";
|
||||
$sqlok = 0;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
return $this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function update($id)
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function update($id)
|
||||
{
|
||||
if (! strlen($this->projet_id))
|
||||
{
|
||||
$this->projet_id = 0;
|
||||
}
|
||||
if (! strlen($this->projet_id))
|
||||
{
|
||||
$this->projet_id = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insertion dans la base
|
||||
*/
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
|
||||
$sql .= " datei = $this->date";
|
||||
$sql .= ", note = '$this->note'";
|
||||
$sql .= ", duree = $this->duree";
|
||||
$sql .= ", fk_projet = $this->projet_id";
|
||||
$sql .= " WHERE rowid = $id";
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function get_new_num($prefix_comm)
|
||||
{
|
||||
|
||||
$sql = "SELECT max(ref) FROM ".MAIN_DB_PREFIX."fichinter WHERE ref like 'FI-".$prefix_comm."-%'";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$row = $this->db->fetch_row(0);
|
||||
$num = $row[0];
|
||||
/*
|
||||
*$num = substr($num, strlen($num) - 4, 4);
|
||||
*$num = $num + 1;
|
||||
*$num = '0000' . $num;
|
||||
*$num = 'FI-' . $prefix_comm . '-' . substr($num, strlen($num) - 4, 4);
|
||||
*/
|
||||
$num = substr($num, 3);
|
||||
$num = substr(strstr($num, "-"),1);
|
||||
/*
|
||||
* Insertion dans la base
|
||||
*/
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
|
||||
$sql .= " datei = $this->date";
|
||||
$sql .= ", note = '$this->note'";
|
||||
$sql .= ", duree = $this->duree";
|
||||
$sql .= ", fk_projet = $this->projet_id";
|
||||
$sql .= " WHERE rowid = $id";
|
||||
|
||||
$num = $num + 1;
|
||||
//$num = '0000' . $num;
|
||||
//$num = 'FI-' . $prefix_comm . '-' . substr($num, strlen($num) - 4, 4);
|
||||
$num = 'FI-' . $prefix_comm . '-' . $num;
|
||||
return $num;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch($rowid)
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function get_new_num($prefix_comm)
|
||||
{
|
||||
|
||||
$sql = "SELECT ref,note,fk_soc,fk_statut,duree,".$this->db->pdate(datei)."as di, fk_projet FROM ".MAIN_DB_PREFIX."fichinter WHERE rowid=$rowid;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->date = $obj->di;
|
||||
$this->duree = $obj->duree;
|
||||
$this->ref = $obj->ref;
|
||||
$this->note = stripslashes($obj->note);
|
||||
$this->societe_id = $obj->fk_soc;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->statut = $obj->fk_statut;
|
||||
|
||||
$this->db->free();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = "SELECT max(ref) FROM ".MAIN_DB_PREFIX."fichinter WHERE ref like 'FI-".$prefix_comm."-%'";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$row = $this->db->fetch_row(0);
|
||||
$num = $row[0];
|
||||
/*
|
||||
*$num = substr($num, strlen($num) - 4, 4);
|
||||
*$num = $num + 1;
|
||||
*$num = '0000' . $num;
|
||||
*$num = 'FI-' . $prefix_comm . '-' . substr($num, strlen($num) - 4, 4);
|
||||
*/
|
||||
$num = substr($num, 3);
|
||||
$num = substr(strstr($num, "-"),1);
|
||||
|
||||
$num = $num + 1;
|
||||
//$num = '0000' . $num;
|
||||
//$num = 'FI-' . $prefix_comm . '-' . substr($num, strlen($num) - 4, 4);
|
||||
$num = 'FI-' . $prefix_comm . '-' . $num;
|
||||
return $num;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function valid($userid, $outputdir)
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
|
||||
$sql = "SELECT ref,note,fk_soc,fk_statut,duree,".$this->db->pdate(datei)."as di, fk_projet FROM ".MAIN_DB_PREFIX."fichinter WHERE rowid=$rowid;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->date = $obj->di;
|
||||
$this->duree = $obj->duree;
|
||||
$this->ref = $obj->ref;
|
||||
$this->note = stripslashes($obj->note);
|
||||
$this->societe_id = $obj->fk_soc;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->statut = $obj->fk_statut;
|
||||
|
||||
$this->db->free();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function valid($userid, $outputdir)
|
||||
{
|
||||
$action_notify = 1; // ne pas modifier cette valeur
|
||||
|
||||
|
||||
$this->fetch($this->id);
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid";
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
/*
|
||||
* Set generates files readonly
|
||||
*
|
||||
*/
|
||||
* Set generates files readonly
|
||||
*/
|
||||
umask(0);
|
||||
$file = $outputdir . "/$this->ref/$this->ref.tex";
|
||||
if (is_writeable($file))
|
||||
@@ -232,15 +242,15 @@ class Fichinter
|
||||
{
|
||||
chmod($filepdf, 0444);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Notify
|
||||
*/
|
||||
* Notify
|
||||
*/
|
||||
$mesg = "La fiche d'intervention ".$this->ref." a <20>t<EFBFBD> valid<69>e.\n";
|
||||
|
||||
|
||||
$notify = New Notify($this->db);
|
||||
$notify->send($action_notify, $this->societe_id, $mesg, "ficheinter", $this->id, $filepdf);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@@ -248,30 +258,49 @@ class Fichinter
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Charge la liste des clients depuis la base
|
||||
*/
|
||||
function fetch_client()
|
||||
/*
|
||||
* \brief Charge la liste des clients depuis la base
|
||||
*/
|
||||
function fetch_client()
|
||||
{
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($this->societe_id);
|
||||
$this->client = $client;
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($this->societe_id);
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Charge les infos du projet depuis la base
|
||||
*
|
||||
*/
|
||||
function fetch_projet()
|
||||
/*
|
||||
* \brief Charge les infos du projet depuis la base
|
||||
*
|
||||
*/
|
||||
function fetch_projet()
|
||||
{
|
||||
$projet = new Project($this->db);
|
||||
$projet->fetch($this->projet_id);
|
||||
$this->projet = $projet->title;
|
||||
$projet = new Project($this->db);
|
||||
$projet->fetch($this->projet_id);
|
||||
$this->projet = $projet->title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libell<6C> du statut de l'intervantion
|
||||
* \return string Libell<6C>
|
||||
*/
|
||||
function getLibStatut()
|
||||
{
|
||||
return $this->LibStatut($this->statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libell<6C> d'un statut donn<6E>
|
||||
* \param statut id statut
|
||||
* \return string Libell<6C>
|
||||
*/
|
||||
function LibStatut($statut)
|
||||
{
|
||||
return $this->statuts[$statut];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php");
|
||||
|
||||
$langs->load("interventions");
|
||||
|
||||
@@ -69,48 +70,49 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1 ,$offset);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php","&socid=$socid",$sortfield,$sortorder,'',$num);
|
||||
$fichinter_static=new Fichinter($db);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"index.php","f.ref","","&socid=$socid",'width="15%"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socid=$socid",'',$sortfield);
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print_liste_field_titre($langs->trans("Date"),"index.php","f.datei","","&socid=$socid",'align="center"',$sortfield);
|
||||
print '<td align="right">'.$langs->trans("Duration").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
$total = 0;
|
||||
while ($i < $num)
|
||||
$num = $db->num_rows($result);
|
||||
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php","&socid=$socid",$sortfield,$sortorder,'',$num);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"index.php","f.ref","","&socid=$socid",'width="15%"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socid=$socid",'',$sortfield);
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print_liste_field_titre($langs->trans("Date"),"index.php","f.datei","","&socid=$socid",'align="center"',$sortfield);
|
||||
print '<td align="right">'.$langs->trans("Duration").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
$total = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?id=$objp->fichid\">".img_object($langs->trans("Show"),"task").' '.$objp->ref."</a></td>\n";
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?id=$objp->fichid\">".img_object($langs->trans("Show"),"task").' '.$objp->ref."</a></td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44)."</a></td>\n";
|
||||
print '<td>'.nl2br($objp->note).'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->dp)."</td>\n";
|
||||
print '<td align="right">'.price($objp->duree).'</td>';
|
||||
print '<td align="center">'.$fichinter_static->LibStatut($objp->fk_statut).'</td>';
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$objp->nom."</a></td>\n";
|
||||
print '<td>'.nl2br($objp->note).'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->dp)."</td>\n";
|
||||
print '<td align="right">'.price($objp->duree).'</td>';
|
||||
print '<td align="center">'.$objp->fk_statut.'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$total += $objp->duree;
|
||||
$i++;
|
||||
print "</tr>\n";
|
||||
$total += $objp->duree;
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="3"></td><td>'.$langs->trans("Total").'</td>';
|
||||
print "<td align=\"right\" nowrap>".price($total)."</td><td></td>";
|
||||
print "</tr>";
|
||||
print '<tr class="liste_total"><td colspan="3"></td><td>'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right" nowrap>'.price($total).'</td><td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
print '</table>';
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@@ -29,6 +30,7 @@ if ($user->societe_id > 0)
|
||||
}
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
* Liste
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user