Explorar el Código

Portal: Debug mode now logs external keys OQL queries used in forms. Helpful to understand the final query (DM OQL intersect Scope OQL)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4743 a333f486-631f-4898-b8df-5754b55c2be0
glajarige hace 8 años
padre
commit
c6cbd52714

+ 4 - 0
datamodels/2.x/itop-portal-base/portal/web/index.php

@@ -50,6 +50,10 @@ $oContex2 = new ContextTag('Portal:' . PORTAL_MODULE_ID);
 
 // Checking if debug param is on
 $bDebug = (isset($_REQUEST['debug']) && ($_REQUEST['debug'] === 'true') );
+if($bDebug)
+{
+    $oContexDebug = new ContextTag('debug');
+}
 
 // Initializing Silex framework
 $oKPI = new ExecutionKPI();

+ 7 - 0
sources/renderer/bootstrap/fieldrenderer/bsselectobjectfieldrenderer.class.inc.php

@@ -28,6 +28,7 @@ use \UserRights;
 use \InlineImage;
 use \DBObjectSet;
 use \MetaModel;
+use \ContextTag;
 use \Combodo\iTop\Renderer\FieldRenderer;
 use \Combodo\iTop\Renderer\RenderingOutput;
 use \Combodo\iTop\Form\Field\SelectObjectField;
@@ -60,6 +61,12 @@ class BsSelectObjectFieldRenderer extends FieldRenderer
 		// Rendering field in edition mode
 		if (!$this->oField->GetReadOnly() && !$this->oField->GetHidden())
 		{
+		    // Debug trace: This is very useful when this kind of field doesn't return the expected values.
+            if(ContextTag::Check('debug'))
+            {
+                IssueLog::Info('Form field #'.$this->oField->GetId().' OQL query: '.$this->oField->GetSearch()->ToOQL(true));
+            }
+
 			// Rendering field
             // - Opening container
 			$oOutput->AddHtml('<div class="form-group form_group_small ' . $sFieldMandatoryClass . '">');