From d5f9e9dc85d02291bb9aabea39f971176662a746 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jul 2009 16:19:37 +0000 Subject: [PATCH] New: Add navigation between interventions --- htdocs/commonobject.class.php | 4 ++-- htdocs/fichinter/fiche.php | 32 +++++++++++++++---------- htdocs/fichinter/fichinter.class.php | 29 +++++++++++----------- htdocs/includes/boxes/modules_boxes.php | 22 +++++++++++++---- htdocs/theme/eldy/eldy.css.php | 10 +++++++- 5 files changed, 62 insertions(+), 35 deletions(-) diff --git a/htdocs/commonobject.class.php b/htdocs/commonobject.class.php index 4d3ab13cc4b..8f97214cfab 100644 --- a/htdocs/commonobject.class.php +++ b/htdocs/commonobject.class.php @@ -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; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 7f4a6a4539c..9bb99f69cb7 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -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 ''; // Ref - print ''; + print ''; // Societe print ""; diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php index 35b8d13207e..ffb3211222f 100644 --- a/htdocs/fichinter/fichinter.class.php +++ b/htdocs/fichinter/fichinter.class.php @@ -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; diff --git a/htdocs/includes/boxes/modules_boxes.php b/htdocs/includes/boxes/modules_boxes.php index a35fa1daaf4..e59c579989c 100644 --- a/htdocs/includes/boxes/modules_boxes.php +++ b/htdocs/includes/boxes/modules_boxes.php @@ -113,11 +113,17 @@ class ModeleBoxes print "\n\n\n"; print '
'."\n"; + if (! empty($head['text']) || ! empty($head['sublink']) || $nblines) + { + print '
'."\n"; + print '
'.$langs->trans("Ref").''.$fichinter->ref.'
'.$langs->trans("Ref").''; + print $html->showrefnav($fichinter,'ref','',1,'ref','ref'); + print '
".$langs->trans("Company")."".$fichinter->client->getNomUrl(1)."
'."\n"; + } + // Show box title if (! empty($head['text']) || ! empty($head['sublink'])) { - print '
'."\n"; - print '
'."\n"; + //print '
'."\n"; + //print '
'."\n"; print ''; print ' 0) { print ' colspan="'.$nbcol.'"'; } @@ -144,14 +150,14 @@ class ModeleBoxes } print ''; print "\n"; - print "
\n"; - print "\n"; +// print "\n"; +// print "\n"; } // Show box lines if ($nblines) { - print ''."\n"; + //print '
'."\n"; // Loop on each record for ($i=0, $n=$nblines; $i < $n; $i++) { @@ -224,7 +230,13 @@ class ModeleBoxes $i++; }*/ + //print "
\n"; + } + + if (! empty($head['text']) || ! empty($head['sublink']) || $nblines) + { print "\n"; + print "\n"; } // If invisible box with no contents diff --git a/htdocs/theme/eldy/eldy.css.php b/htdocs/theme/eldy/eldy.css.php index c1b5938e489..dc8edfc724b 100644 --- a/htdocs/theme/eldy/eldy.css.php +++ b/htdocs/theme/eldy/eldy.css.php @@ -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;