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