Procházet zdrojové kódy

N.948 - Obsolete objects become visible when navigating in paginated lists

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4884 a333f486-631f-4898-b8df-5754b55c2be0
romainq před 7 roky
rodič
revize
6771978bc1
2 změnil soubory, kde provedl 19 přidání a 5 odebrání
  1. 9 4
      application/datatable.class.inc.php
  2. 10 1
      pages/ajax.render.php

+ 9 - 4
application/datatable.class.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2015 Combodo SARL
+// Copyright (C) 2010-2017 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -18,7 +18,7 @@
 /**
  * Data Table to display a set of objects in a tabular manner in HTML
  *
- * @copyright   Copyright (C) 2010-2015 Combodo SARL
+ * @copyright   Copyright (C) 2010-2017 Combodo SARL
  * @license     http://opensource.org/licenses/AGPL-3.0
  */
 
@@ -31,7 +31,8 @@ class DataTable
 	protected $iNbObjects;		// Total number of objects inthe set
 	protected $bUseCustomSettings;	// Whether or not the current display uses custom settings
 	protected $oDefaultSettings;	// the default settings for displaying such a list
-		
+	protected $bShowObsoleteData;
+
 	/**
 	 * @param $iListId mixed Unique ID for this div/table in the page
 	 * @param $oSet DBObjectSet The set of data to display
@@ -47,6 +48,7 @@ class DataTable
 		$this->iNbObjects = $oSet->Count();
 		$this->bUseCustomSettings = false;
 		$this->oDefaultSettings = null;
+		$this->bShowObsoleteData = $oSet->GetShowObsoleteData();
 	}
 	
 	public function Display(WebPage $oPage, DataTableSettings $oSettings, $bActionsMenu, $sSelectMode, $bViewLink, $aExtraParams)
@@ -145,7 +147,9 @@ class DataTable
 		$sHtml .= "<tr><td class=\"datacontents\">$sDataTable</td></tr>";
 		$sHtml .= "</table>\n";
 		$oPage->add_at_the_end($sConfigDlg);
-		
+
+		$aExtraParams['show_obsolete_data'] = $this->bShowObsoleteData;
+
 		$aOptions = array(
 			'sPersistentId' => '',
 			'sFilter' => $this->oSet->GetFilter()->serialize(),
@@ -486,6 +490,7 @@ EOF;
 		{
 			$aExtraParams['query_params'][$sName] = $sValue;
 		}
+		$aExtraParams['show_obsolete_data'] = $this->bShowObsoleteData;
 
 		$sHtml .= "<tr><td>";
 		$sHtml .= $oPage->GetTable($aAttribs, $aValues);

+ 10 - 1
pages/ajax.render.php

@@ -97,7 +97,6 @@ try
 		$aColumns = utils::ReadParam('columns', array(), false, 'raw_data');
 		$aClassAliases = utils::ReadParam('class_aliases', array());
 		$iListId = utils::ReadParam('list_id', 0);
-		//$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClassName, 'list'));
 
 		// Filter the list to removed linked set since we are not able to display them here
 		$aOrderBy = array();
@@ -174,6 +173,16 @@ try
 		$oSet = new DBObjectSet($oFilter, $aOrderBy, $aExtraParams, null, $iEnd-$iStart, $iStart);
 		$oSet->OptimizeColumnLoad($aColumnsLoad);
 
+		if (isset($aExtraParams['show_obsolete_data']))
+		{
+			$bShowObsoleteData = $aExtraParams['show_obsolete_data'];
+		}
+		else
+		{
+			$bShowObsoleteData = utils::ShowObsoleteData();
+		}
+		$oSet->SetShowObsoleteData($bShowObsoleteData);
+
 		$oDataTable = new DataTable($iListId, $oSet, $oSet->GetSelectedClasses());
 		if ($operation == 'datatable')
 		{