New: Add navigation between interventions
This commit is contained in:
parent
5652291f8b
commit
d5f9e9dc85
@ -44,8 +44,19 @@ if (defined("FICHEINTER_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/mod
|
||||
$langs->load("companies");
|
||||
$langs->load("interventions");
|
||||
|
||||
// Get parameters
|
||||
$fichinterid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
// Load object if defined
|
||||
$fichinterid=0;
|
||||
$fichinter = new Fichinter($db);
|
||||
if ($_GET["id"] > 0 || ! empty($_GET["ref"]))
|
||||
{
|
||||
$result=$fichinter->fetch($_GET["id"],$_GET["ref"]);
|
||||
if (! $result > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$fichinterid=$fichinter->id;
|
||||
}
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_POST['socid_id']))
|
||||
@ -63,7 +74,7 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter');
|
||||
/*
|
||||
* Traitements des actions
|
||||
*/
|
||||
if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! $_REQUEST["id"] > 0)
|
||||
if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! $_REQUEST["id"] > 0 && empty($_REQUEST["ref"]))
|
||||
{
|
||||
Header("Location: index.php");
|
||||
return;
|
||||
@ -481,18 +492,11 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($_GET["id"] > 0)
|
||||
elseif ($fichinterid)
|
||||
{
|
||||
/*
|
||||
* Affichage en mode visu
|
||||
*/
|
||||
$fichinter = new Fichinter($db);
|
||||
$result=$fichinter->fetch($_GET["id"]);
|
||||
if (! $result > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$fichinter->fetch_client();
|
||||
|
||||
$societe=new Societe($db);
|
||||
@ -535,7 +539,9 @@ elseif ($_GET["id"] > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>'.$fichinter->ref.'</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $html->showrefnav($fichinter,'ref','',1,'ref','ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Societe
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$fichinter->client->getNomUrl(1)."</td></tr>";
|
||||
|
||||
@ -185,15 +185,16 @@ class Fichinter extends CommonObject
|
||||
* \param rowid Id de la fiche a charger
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function fetch($rowid)
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
$sql = "SELECT ref, description, fk_soc, fk_statut,";
|
||||
$sql = "SELECT rowid, ref, description, fk_soc, fk_statut,";
|
||||
$sql.= " ".$this->db->pdate("datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("date_valid")." as datev,";
|
||||
$sql.= " ".$this->db->pdate("tms")." as datem,";
|
||||
$sql.= " duree, fk_projet, note_public, note_private, model_pdf";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
|
||||
$sql.= " WHERE rowid=".$rowid;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
if ($ref) $sql.= " WHERE f.ref='".$ref."'";
|
||||
else $sql.= " WHERE f.rowid=".$rowid;
|
||||
|
||||
dol_syslog("Fichinter::fetch sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -203,7 +204,7 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->description = $obj->description;
|
||||
$this->socid = $obj->fk_soc;
|
||||
@ -227,7 +228,7 @@ class Fichinter extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Fichinter::update error ".$this->error,LOG_ERR);
|
||||
dol_syslog("Fichinter::fetch ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,11 +113,17 @@ class ModeleBoxes
|
||||
print "\n\n<!-- Box start -->\n";
|
||||
print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$this->box_id.'">'."\n";
|
||||
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || $nblines)
|
||||
{
|
||||
print '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
print '<table summary="boxtable'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
}
|
||||
|
||||
// Show box title
|
||||
if (! empty($head['text']) || ! empty($head['sublink']))
|
||||
{
|
||||
print '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
print '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
//print '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
//print '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
print '<tr class="box_titre">';
|
||||
print '<td';
|
||||
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
|
||||
@ -144,14 +150,14 @@ class ModeleBoxes
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
// print "</table>\n";
|
||||
// print "</div>\n";
|
||||
}
|
||||
|
||||
// Show box lines
|
||||
if ($nblines)
|
||||
{
|
||||
print '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
//print '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
// Loop on each record
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
{
|
||||
@ -224,7 +230,13 @@ class ModeleBoxes
|
||||
$i++;
|
||||
}*/
|
||||
|
||||
//print "</table>\n";
|
||||
}
|
||||
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || $nblines)
|
||||
{
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
}
|
||||
|
||||
// If invisible box with no contents
|
||||
|
||||
@ -746,7 +746,15 @@ border-collapse: collapse;
|
||||
|
||||
table.noborder {
|
||||
border-collapse: collapse;
|
||||
border: 0px;
|
||||
border-top-color: #FEFEFE;
|
||||
/*
|
||||
border-right-width: 1px;
|
||||
border-right-color: #BBBBBB;
|
||||
border-right-style: solid;
|
||||
*/
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: #BBBBBB;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
table.noborder td {
|
||||
border: 0px;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user