New: Add navigation between interventions
This commit is contained in:
parent
5652291f8b
commit
d5f9e9dc85
@ -352,14 +352,14 @@ class CommonObject
|
||||
function fetch_client()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$client = new Societe($this->db);
|
||||
$result=$client->fetch($this->socid);
|
||||
$this->client = $client;
|
||||
|
||||
// Use first price level if level not defined for third party
|
||||
if ($conf->global->PRODUIT_MULTIPRICES && empty($this->client->price_level)) $this->client->price_level=1;
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -282,7 +293,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$outputlangs = $langs;
|
||||
if (! empty($_REQUEST['lang_id']))
|
||||
{
|
||||
@ -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>";
|
||||
|
||||
@ -88,7 +88,7 @@ class Fichinter extends CommonObject
|
||||
function create()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
dol_syslog("Fichinter.class::create ref=".$this->ref);
|
||||
|
||||
if (! is_numeric($this->duree)) { $this->duree = 0; }
|
||||
@ -152,7 +152,7 @@ class Fichinter extends CommonObject
|
||||
function update($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if (! is_numeric($this->duree)) { $this->duree = 0; }
|
||||
if (! strlen($this->projet_id))
|
||||
{
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -445,7 +446,7 @@ class Fichinter extends CommonObject
|
||||
function info($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$sql = "SELECT f.rowid, ";
|
||||
$sql.= $this->db->pdate("f.datec")." as datec";
|
||||
$sql.= ", ".$this->db->pdate("f.date_valid")." as datev";
|
||||
@ -499,14 +500,14 @@ class Fichinter extends CommonObject
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet";
|
||||
$sql.= " WHERE fk_fichinter = ".$this->id;
|
||||
|
||||
|
||||
dol_syslog("Fichinter::delete sql=".$sql);
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
|
||||
dol_syslog("Fichinter::delete sql=".$sql);
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
@ -564,7 +565,7 @@ class Fichinter extends CommonObject
|
||||
function set_date_delivery($user, $date_delivery)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||
@ -596,7 +597,7 @@ class Fichinter extends CommonObject
|
||||
function set_description($user, $description)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||
@ -958,7 +959,7 @@ class FichinterLigne
|
||||
function update_total()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$sql = "SELECT SUM(duree) as total_duration";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet";
|
||||
$sql.= " WHERE fk_fichinter=".$this->fk_fichinter;
|
||||
|
||||
@ -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