Seul l'id de ligne suffit pour afficher fiche
This commit is contained in:
parent
2c9fa5bd45
commit
b9a91c041e
@ -278,8 +278,8 @@ class Contrat extends CommonObject
|
||||
$sql.= " note, note_public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat WHERE rowid = $id";
|
||||
|
||||
dolibarr_syslog("Contrat::fetch sql=".$sql);
|
||||
$resql = $this->db->query($sql) ;
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$result = $this->db->fetch_array($resql);
|
||||
@ -1219,6 +1219,8 @@ class ContratLigne
|
||||
var $date_fin_prevue;
|
||||
var $date_fin_reel;
|
||||
|
||||
var $datem;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur d'objets ligne de contrat
|
||||
@ -1293,7 +1295,54 @@ class ContratLigne
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* \brief Chargement depuis la base des données du contrat
|
||||
* \param id Id du contrat à charger
|
||||
* \return int <0 si ko, id du contrat chargé si ok
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT rowid, fk_contrat, fk_product, ".$this->db->pdate("tms")." as datem,";
|
||||
$sql.= " statut,";
|
||||
$sql.= " label,";
|
||||
$sql.= " description";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet WHERE rowid = ".$id;
|
||||
|
||||
dolibarr_syslog("ContratLigne::fetch sql=".$sql);
|
||||
$resql = $this->db->query($sql) ;
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$this->id = $obj->rowid;
|
||||
$this->fk_contrat = $obj->fk_contrat;
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->datem = $obj->datem;
|
||||
$this->statut = $obj->statut;
|
||||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Contract line not found";
|
||||
dolibarr_syslog("ContratLigne::Fetch ".$this->error,LOG_ERROR);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("ContratLigne::Fetch ".$this->error,LOG_ERROR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Mise a jour en base des champs total_xxx de ligne
|
||||
* \remarks Utilisé par migration
|
||||
* \return int <0 si ko, >0 si ok
|
||||
|
||||
@ -106,11 +106,16 @@ $html = new Form($db);
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
$id = $_GET["id"];
|
||||
if ($id > 0)
|
||||
$lineid = $_GET["ligne"];
|
||||
if ($lineid > 0)
|
||||
{
|
||||
$line = new ContratLigne($db);
|
||||
$result=$line->fetch($lineid);
|
||||
|
||||
$contrat = New Contrat($db);
|
||||
if ( $contrat->fetch($id) > 0)
|
||||
$result=$contrat->fetch($line->fk_contrat);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($contrat->socid);
|
||||
@ -123,7 +128,7 @@ if ($id > 0)
|
||||
$h=sizeof($head);
|
||||
|
||||
// On ajout onglet service
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id."&ligne=".$_GET["ligne"];
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id."&ligne=".$line->id;
|
||||
$head[$h][1] = $langs->trans($langs->trans("EditServiceLine"));
|
||||
$hselected = $h;
|
||||
|
||||
@ -233,8 +238,8 @@ if ($id > 0)
|
||||
$sql.= " p.ref, p.label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE cd.fk_contrat = ".$id;
|
||||
$sql.= " AND cd.rowid = ".$_GET["ligne"];
|
||||
$sql.= " WHERE cd.fk_contrat = ".$contrat->id;
|
||||
$sql.= " AND cd.rowid = ".$line->id;
|
||||
$sql.= " ORDER BY cd.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
@ -420,7 +425,7 @@ if ($id > 0)
|
||||
*/
|
||||
$form = new Form($db);
|
||||
|
||||
print '<form name="close" action="ligne.php?id='.$contrat->id.'&ligne='.$_GET["ligne"].'&action=close" method="post">';
|
||||
print '<form name="close" action="ligne.php?id='.$contrat->id.'&ligne='.$line->id.'&action=close" method="post">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("CloseService").'</td></tr>';
|
||||
@ -449,7 +454,7 @@ if ($id > 0)
|
||||
|
||||
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Close").'"></td></tr>';
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="70" type="text" name="commentaire" value="'.$_POST["commentaire"].'"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="70" type="text" class="flat" name="commentaire" value="'.$_POST["commentaire"].'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user