diff --git a/data/CRMEntity.php b/data/CRMEntity.php
index ae8239f3b22a91023c58734766e92c3c68145310..cdb158b583de0a88e5efcd3871e71d9aa41f6dcd 100644
--- a/data/CRMEntity.php
+++ b/data/CRMEntity.php
@@ -2430,7 +2430,7 @@ class CRMEntity {
 			$fields[] = $value;
 		}
 		$pritablename = $tables[0];
-		$sectablename = $tables[1];
+		$sectablename = isset($tables[1]) ? $tables[1] : '';
 		$prifieldname = $fields[0][0];
 		$secfieldname = $fields[0][1];
 		$tmpname = $pritablename . 'tmp' . $secmodule;
@@ -2470,7 +2470,7 @@ class CRMEntity {
 
 		$secQuery = 'SELECT '.$selectColumns.' '.$secQueryFrom;
 
-		$secQueryTempTableQuery = $queryPlanner->registerTempTable($secQuery, array($column_name, $fields[1], $prifieldname),$secmodule);
+		$secQueryTempTableQuery = $queryPlanner->registerTempTable($secQuery, array($column_name, isset($fields[1]) ? $fields[1] : '', $prifieldname),$secmodule);
 
 		$query = '';
 		if ($pritablename == 'vtiger_crmentityrel') {
diff --git a/include/utils/VTCacheUtils.php b/include/utils/VTCacheUtils.php
index 3a286e03c386935e05e85e0040674252f4086dd7..23b3cf23ded052679d504384cdbd3ced0b9b58bf 100644
--- a/include/utils/VTCacheUtils.php
+++ b/include/utils/VTCacheUtils.php
@@ -441,7 +441,7 @@ class VTCacheUtils {
 
 	static $_report_field_bylabel = array();
 	public static function getReportFieldByLabel($module, $label) {
-		return self::$_report_field_bylabel[$module][$label];
+		return isset(self::$_report_field_bylabel[$module][$label]) ? self::$_report_field_bylabel[$module][$label] : array();
 	}
 
 	public static function setReportFieldByLabel($module, $label, $fieldInfo) {
diff --git a/layouts/v7/modules/Reports/ChartEditStep2.tpl b/layouts/v7/modules/Reports/ChartEditStep2.tpl
index 4eb05155ca7241cef23c3c0987eef1d1971faaa0..a21362e2cb54a9ffc2aaa9a2595b9a4a87bc8f1c 100644
--- a/layouts/v7/modules/Reports/ChartEditStep2.tpl
+++ b/layouts/v7/modules/Reports/ChartEditStep2.tpl
@@ -39,7 +39,7 @@
         {foreach key=BLOCK_LABEL item=BLOCK_FIELDS from=$PRIMARY_MODULE_RECORD_STRUCTURE}
             {assign var=PRIMARY_MODULE_BLOCK_LABEL value=vtranslate($BLOCK_LABEL, $PRIMARY_MODULE)}
             {assign var=key value="$PRIMARY_MODULE_LABEL $PRIMARY_MODULE_BLOCK_LABEL"}
-            {if $LINEITEM_FIELD_IN_CALCULATION eq false && $BLOCK_LABEL eq 'LBL_ITEM_DETAILS'}
+            {if isset($LINEITEM_FIELD_IN_CALCULATION) && $LINEITEM_FIELD_IN_CALCULATION eq false && $BLOCK_LABEL eq 'LBL_ITEM_DETAILS'}
                 {* dont show the line item fields block when Inventory fields are selected for calculations *}
             {else}
                 {$RECORD_STRUCTURE[$key] = $BLOCK_FIELDS}
@@ -58,6 +58,9 @@
                 <h4><strong>{vtranslate('LBL_CHOOSE_FILTER_CONDITIONS',$MODULE)}</strong></h4>
                 <br>
                 <span class="col-lg-12">
+                {if !isset($SELECTED_ADVANCED_FILTER_FIELDS)}
+                    {assign var="SELECTED_ADVANCED_FILTER_FIELDS" value=array()}
+                {/if}
                     {include file='AdvanceFilter.tpl'|@vtemplate_path RECORD_STRUCTURE=$RECORD_STRUCTURE ADVANCE_CRITERIA=$SELECTED_ADVANCED_FILTER_FIELDS COLUMNNAME_API=getReportFilterColumnName}
                 </span>
             </div>
diff --git a/layouts/v7/modules/Reports/ModuleHeader.tpl b/layouts/v7/modules/Reports/ModuleHeader.tpl
index 05f63e346a4e4dc363f6d2b2acd61b755b0952e5..fd42f20c01fe8f0fa143d69c42db8cb47964108f 100644
--- a/layouts/v7/modules/Reports/ModuleHeader.tpl
+++ b/layouts/v7/modules/Reports/ModuleHeader.tpl
@@ -36,7 +36,7 @@
 						&nbsp;
 					</p>
 				</span>
-				{if $VIEWNAME}
+				{if isset($VIEWNAME) && $VIEWNAME}
 					{if $VIEWNAME neq 'All'}
 						{foreach item=FOLDER from=$FOLDERS}
 							{if $FOLDER->getId() eq $VIEWNAME}
@@ -55,6 +55,7 @@
 
 			<span class="col-lg-5 col-md-5 pull-right">
 				<div id="appnav" class="navbar-right">
+				{if isset($LISTVIEW_LINKS['LISTVIEWBASIC'])}
 					{foreach item=LISTVIEW_BASICACTION from=$LISTVIEW_LINKS['LISTVIEWBASIC']}
 						{assign var="childLinks" value=$LISTVIEW_BASICACTION->getChildLinks()}
 						{if $childLinks && $LISTVIEW_BASICACTION->get('linklabel') == 'LBL_ADD_RECORD'}
@@ -71,15 +72,16 @@
 										{elseif $childLink->getLabel() eq 'LBL_DETAIL_REPORT'}
 											{assign var="ICON_CLASS" value='vicon-detailreport'}
 										{/if}
-										<li id="{$MODULE}_listView_basicAction_{Vtiger_Util_Helper::replaceSpaceWithUnderScores($childLink->getLabel())}" {if isset($childLink->disabled)} data-edition-disable="{$childLink->disabled}" {/if} 
-											{if isset($childLink->message)} data-edition-message="{$childLink->message}" {/if}>
-											<a {if isset($childLink->disabled) && $childLink->disabled neq '1'} {if stripos($childLink->getUrl(), 'javascript:') === 0} onclick='{$childLink->getUrl()|substr:strlen("javascript:")};' {else} href='{$childLink->getUrl()}' {/if} {else} href="javascript:void(0);" {/if}><i class='{$ICON_CLASS}' style="font-size:13px;"></i>&nbsp; {vtranslate($childLink->getLabel(), $MODULE)}</a>
+										<li id="{$MODULE}_listView_basicAction_{Vtiger_Util_Helper::replaceSpaceWithUnderScores($childLink->getLabel())}" data-edition-disable="{$childLink->disabled}" 
+											data-edition-message="{$childLink->message}">
+											<a {if $childLink->disabled neq '1'} {if stripos($childLink->getUrl(), 'javascript:') === 0} onclick='{$childLink->getUrl()|substr:strlen("javascript:")};' {else} href='{$childLink->getUrl()}' {/if} {else} href="javascript:void(0);" {/if}><i class='{$ICON_CLASS}' style="font-size:13px;"></i>&nbsp; {vtranslate($childLink->getLabel(), $MODULE)}</a>
 										</li>
 									{/foreach}
 								</ul>
 							</span>
 						{/if}
 					{/foreach}
+				{/if}
 				</div>
 			</span>
 		</div>
diff --git a/layouts/v7/modules/Reports/RelatedFields.tpl b/layouts/v7/modules/Reports/RelatedFields.tpl
index 75ccfee0568aa1cd5a50879638e3993ac7ab139e..637c32b3b7f0678f3dff9346eb9b77c6c19bcd34 100644
--- a/layouts/v7/modules/Reports/RelatedFields.tpl
+++ b/layouts/v7/modules/Reports/RelatedFields.tpl
@@ -18,7 +18,7 @@
                     {foreach key=BLOCK_LABEL item=BLOCK from=$PRIMARY_MODULE}
                         <optgroup label='{vtranslate($PRIMARY_MODULE_NAME,$MODULE)}-{vtranslate($BLOCK_LABEL,$PRIMARY_MODULE_NAME)}'>
                             {foreach key=FIELD_KEY item=FIELD_LABEL from=$BLOCK}
-                                <option value="{$FIELD_KEY}"{if $FIELD_KEY eq $SELECTED_SORT_FIELD_KEY}selected=""{/if}>{vtranslate($FIELD_LABEL, $PRIMARY_MODULE_NAME)}</option>
+                                <option value="{$FIELD_KEY}"{if isset($SELECTED_SORT_FIELD_KEY) && $FIELD_KEY eq $SELECTED_SORT_FIELD_KEY}selected=""{/if}>{vtranslate($FIELD_LABEL, $PRIMARY_MODULE_NAME)}</option>
                             {/foreach}
                         </optgroup>
                     {/foreach}
@@ -27,7 +27,7 @@
                     {foreach key=BLOCK_LABEL item=BLOCK from=$SECONDARY_MODULE}
                         <optgroup label='{vtranslate($SECONDARY_MODULE_NAME,$MODULE)}-{vtranslate($BLOCK_LABEL,$SECONDARY_MODULE_NAME)}'>
                             {foreach key=FIELD_KEY item=FIELD_LABEL from=$BLOCK}
-                                <option value="{$FIELD_KEY}"{if $FIELD_KEY eq $SELECTED_SORT_FIELD_KEY}selected=""{/if}>{vtranslate($FIELD_LABEL, $SECONDARY_MODULE_NAME)}</option>
+                                <option value="{$FIELD_KEY}"{if isset($SELECTED_SORT_FIELD_KEY) && $FIELD_KEY eq $SELECTED_SORT_FIELD_KEY}selected=""{/if}>{vtranslate($FIELD_LABEL, $SECONDARY_MODULE_NAME)}</option>
                             {/foreach}
                         </optgroup>
                     {/foreach}
@@ -39,8 +39,8 @@
         <div class="row">
             <span class="col-lg-6">
                 {assign var=ROW value='row_'|cat:$ROW_VAL}
-                <input type="radio" name="{$ROW}" class="sortOrder" value="Ascending" {if $SELECTED_SORT_FIELD_VALUE eq Ascending} checked="" {/if} />&nbsp;<span>{vtranslate('LBL_ASCENDING',$MODULE)}</span>&nbsp;&nbsp;
-                <input type="radio" name="{$ROW}" class="sortOrder" value="Descending" {if $SELECTED_SORT_FIELD_VALUE eq Descending} checked="" {/if}/>&nbsp;<span>{vtranslate('LBL_DESCENDING',$MODULE)}</span>
+                <input type="radio" name="{$ROW}" class="sortOrder" value="Ascending" {if isset($SELECTED_SORT_FIELD_VALUE) && $SELECTED_SORT_FIELD_VALUE eq Ascending} checked="" {/if} />&nbsp;<span>{vtranslate('LBL_ASCENDING',$MODULE)}</span>&nbsp;&nbsp;
+                <input type="radio" name="{$ROW}" class="sortOrder" value="Descending" {if isset($SELECTED_SORT_FIELD_VALUE) && $SELECTED_SORT_FIELD_VALUE eq Descending} checked="" {/if}/>&nbsp;<span>{vtranslate('LBL_DESCENDING',$MODULE)}</span>
             </span>
         </div>
     </span>
diff --git a/layouts/v7/modules/Reports/ReportContents.tpl b/layouts/v7/modules/Reports/ReportContents.tpl
index a9e1c9172740307652955ff365d870a821980d26..ee93270cd17a69a36628a9d577dc877be3c5f489 100644
--- a/layouts/v7/modules/Reports/ReportContents.tpl
+++ b/layouts/v7/modules/Reports/ReportContents.tpl
@@ -48,7 +48,7 @@
     </div>
     <div id="reportDetails" class="contents-bottomscroll">
         <div class="bottomscroll-div">
-            <input type="hidden" id="updatedCount" value="{$NEW_COUNT}" />
+            <input type="hidden" id="updatedCount" value="{if isset($NEW_COUNT)}{$NEW_COUNT}{else}''{/if}" />
             {if $DATA neq ''}
                 {assign var=HEADERS value=$DATA[0]}
                 <table class="table table-bordered">
@@ -139,7 +139,7 @@
                         {/foreach}
                     {/if}
                 </table>
-                {if $LIMIT_EXCEEDED}
+                {if isset($LIMIT_EXCEEDED) && $LIMIT_EXCEEDED}
                     <center>{vtranslate('LBL_LIMIT_EXCEEDED',$MODULE)} <span class="pull-right"><a href="#top" >{vtranslate('LBL_TOP',$MODULE)}</a></span></center>
                         {/if}
                     {else}
diff --git a/layouts/v7/modules/Reports/ScheduleReport.tpl b/layouts/v7/modules/Reports/ScheduleReport.tpl
index d60695a0c3015664f520dd5150a29772ab475006..6544a025d45e18ef936e7943d3ac269c5c621cbe 100644
--- a/layouts/v7/modules/Reports/ScheduleReport.tpl
+++ b/layouts/v7/modules/Reports/ScheduleReport.tpl
@@ -67,8 +67,8 @@
                 <div class='col-lg-2'>
                     <div class="input-group inputElement date" style="margin-bottom: 3px">
                         {assign var=specificDate value=Zend_Json::decode($SCHEDULEDREPORTS->get('schdate'))}
-                        {if $specificDate[0] neq ''} {assign var=specificDate1 value=DateTimeField::convertToUserFormat($specificDate[0])} {/if}
-                        <input style='width: 185px;' type="text" class="dateField form-control" id="schdate" name="schdate" value="{$specificDate1}" data-date-format="{$CURRENT_USER->date_format}" data-rule-required="true" />
+                        {if isset($specificDate[0]) && $specificDate[0] neq ''} {assign var=specificDate1 value=DateTimeField::convertToUserFormat($specificDate[0])} {/if}
+                        <input style='width: 185px;' type="text" class="dateField form-control" id="schdate" name="schdate" value="{if isset($specificDate1)}{$specificDate1}{else}''{/if}" data-date-format="{$CURRENT_USER->date_format}" data-rule-required="true" />
                         <span class="input-group-addon"><i class="fa fa-calendar "></i></span>
                     </div>
                 </div>
diff --git a/layouts/v7/modules/Reports/Step1.tpl b/layouts/v7/modules/Reports/Step1.tpl
index f58aa9cf40b84c78d8828e4038a15aa53072305f..26ba4b26bec5f594a8e7f4411736c1797f627d34 100644
--- a/layouts/v7/modules/Reports/Step1.tpl
+++ b/layouts/v7/modules/Reports/Step1.tpl
@@ -18,7 +18,7 @@
         <input type="hidden" name="module" value="{$MODULE}" />
         <input type="hidden" name="view" value="{$VIEW}" />
         <input type="hidden" class="step" value="1" />
-        <input type="hidden" name="isDuplicate" value="{$IS_DUPLICATE}" />
+        <input type="hidden" name="isDuplicate" value="{if isset($IS_DUPLICATE)}{$IS_DUPLICATE}{else}false{/if}" />
         <input type="hidden" name="record" value="{$RECORD_ID}" />
         <input type=hidden id="relatedModules" data-value='{ZEND_JSON::encode($RELATED_MODULES)}' />
         <div style="border:1px solid #ccc;padding:4%;">
@@ -68,7 +68,11 @@
                 <div class="form-group">
                     <label class="col-lg-3 control-label textAlignLeft">{vtranslate('LBL_SELECT_RELATED_MODULES',$MODULE)}&nbsp;({vtranslate('LBL_MAX',$MODULE)}&nbsp;2)</label>
                     <div class="col-lg-4">
-                        {assign var=SECONDARY_MODULES_ARR value=explode(':',$REPORT_MODEL->getSecondaryModules())}
+                        {if $REPORT_MODEL->getSecondaryModules() neq null && $REPORT_MODEL->getSecondaryModules() neq ''}
+                            {assign var="SECONDARY_MODULES_ARR" value=explode(':', $REPORT_MODEL->getSecondaryModules())}
+                        {else}
+                            {assign var="SECONDARY_MODULES_ARR" value=[]}
+                        {/if}
                         {assign var=PRIMARY_MODULE value=$REPORT_MODEL->getPrimaryModule()}
 
                         {if $PRIMARY_MODULE eq ''}
diff --git a/layouts/v7/modules/Reports/step2.tpl b/layouts/v7/modules/Reports/step2.tpl
index 94935b08dbef8530173daa8c6dd252547a8ce715..6add2c6ee722c8c4be407ce923d435731d009bcd 100644
--- a/layouts/v7/modules/Reports/step2.tpl
+++ b/layouts/v7/modules/Reports/step2.tpl
@@ -23,7 +23,7 @@
         <input type="hidden" name="description" value="{$REPORT_MODEL->get('description')}" />
         <input type="hidden" name="primary_module" value="{$PRIMARY_MODULE}" />
         <input type="hidden" name="secondary_modules" value={ZEND_JSON::encode($SECONDARY_MODULES)} />
-        <input type="hidden" name="selected_fields" id="seleted_fields" value='{ZEND_JSON::encode($SELECTED_FIELDS)}' />
+        <input type="hidden" name="selected_fields" id="selected_fields" value='{if isset($SELECTED_FIELDS)}{ZEND_JSON::encode($SELECTED_FIELDS)}{/if}' />
         <input type="hidden" name="selected_sort_fields" id="selected_sort_fields" value="" />
         <input type="hidden" name="calculation_fields" id="calculation_fields" value="" />
         <input type="hidden" name="isDuplicate" value="{$IS_DUPLICATE}" />
@@ -71,14 +71,16 @@
                 </div>
                 <div class="">
                     {assign var=ROW_VAL value=1}
+                    {if isset($SELECTED_SORT_FIELDS) && is_array($SELECTED_SORT_FIELDS)}
                     {foreach key=SELECTED_SORT_FIELD_KEY item=SELECTED_SORT_FIELD_VALUE from=$SELECTED_SORT_FIELDS}
                         <div class="row sortFieldRow" style="padding-bottom:10px;">
                             {include file='RelatedFields.tpl'|@vtemplate_path:$MODULE ROW_VAL=$ROW_VAL}
                             {assign var=ROW_VAL value=($ROW_VAL+1)}
                         </div>
                     {/foreach}
-                    {assign var=SELECTED_SORT_FEILDS_ARRAY value=$SELECTED_SORT_FIELDS}
-                    {assign var=SELECTED_SORT_FIELDS_COUNT value=php7_count($SELECTED_SORT_FEILDS_ARRAY)}
+                    {/if}
+                    {assign var=SELECTED_SORT_FEILDS_ARRAY value=(isset($SELECTED_SORT_FIELDS))?$SELECTED_SORT_FIELDS:array()}
+                    {assign var=SELECTED_SORT_FIELDS_COUNT value=(isset($SELECTED_SORT_FEILDS_ARRAY))?php7_count($SELECTED_SORT_FEILDS_ARRAY):array()}
                     {while $SELECTED_SORT_FIELDS_COUNT lt 3 }
                         <div class="row sortFieldRow" style="padding-bottom:10px;">
                             {include file='RelatedFields.tpl'|@vtemplate_path:$MODULE ROW_VAL=$ROW_VAL}
diff --git a/layouts/v7/modules/Reports/step3.tpl b/layouts/v7/modules/Reports/step3.tpl
index 3f287d2e00d44867729919f01b6b22d0c6f0e283..524a8e7912468569b744ff76d18d3f8706c36403 100644
--- a/layouts/v7/modules/Reports/step3.tpl
+++ b/layouts/v7/modules/Reports/step3.tpl
@@ -64,6 +64,9 @@
                 <h4><strong>{vtranslate('LBL_CHOOSE_FILTER_CONDITIONS',$MODULE)}</strong></h4>
                 <br>
                 <span class="col-lg-12">
+                {if !isset($SELECTED_ADVANCED_FILTER_FIELDS)}
+                    {assign var="SELECTED_ADVANCED_FILTER_FIELDS" value=array()}
+                {/if}
                     {include file='AdvanceFilter.tpl'|@vtemplate_path RECORD_STRUCTURE=$RECORD_STRUCTURE ADVANCE_CRITERIA=$SELECTED_ADVANCED_FILTER_FIELDS COLUMNNAME_API=getReportFilterColumnName}
                 </span>
             </div>
diff --git a/layouts/v7/modules/Vtiger/AdvanceFilter.tpl b/layouts/v7/modules/Vtiger/AdvanceFilter.tpl
index 50048b7f079d502e7df625543de21896fb50f65e..5b79b17127c8b4117b040dba1a87289d3853bd67 100644
--- a/layouts/v7/modules/Vtiger/AdvanceFilter.tpl
+++ b/layouts/v7/modules/Vtiger/AdvanceFilter.tpl
@@ -10,8 +10,8 @@
  ********************************************************************************/
 -->*}
 {strip}
-	{assign var=ALL_CONDITION_CRITERIA value=(isset($ADVANCE_CRITERIA[1])?$ADVANCE_CRITERIA[1]:[])}
-	{assign var=ANY_CONDITION_CRITERIA value=(isset($ADVANCE_CRITERIA[2])?$ADVANCE_CRITERIA[2]:[])}
+	{assign var=ALL_CONDITION_CRITERIA value=(isset($ADVANCE_CRITERIA[1]))?$ADVANCE_CRITERIA[1]:[]}
+	{assign var=ANY_CONDITION_CRITERIA value=(isset($ADVANCE_CRITERIA[2]))?$ADVANCE_CRITERIA[2]:[]}
 
 	{if empty($ALL_CONDITION_CRITERIA) }
 		{assign var=ALL_CONDITION_CRITERIA value=array()}
diff --git a/modules/Reports/ReportRun.php b/modules/Reports/ReportRun.php
index 9b14f253114d470d1a231a0a253e6536658c17e4..4a8bb10983f8c70729574da584a4c5d85297a237 100644
--- a/modules/Reports/ReportRun.php
+++ b/modules/Reports/ReportRun.php
@@ -341,6 +341,9 @@ class ReportRun extends CRMEntity {
 	}
 
 	public static function getInstance($reportid) {
+		if (self::$instances === false || !is_array(self::$instances)) {
+            self::$instances = array();
+        }
 		if (!isset(self::$instances[$reportid])) {
 			self::$instances[$reportid] = new ReportRun($reportid);
 		}
@@ -732,7 +735,7 @@ class ReportRun extends CRMEntity {
 	 *  returns the case query for the escaped columns
 	 */
 	function getEscapedColumns($selectedfields) {
-
+		$queryColumn = '';
 		$tableName = $selectedfields[0];
 		$columnName = $selectedfields[1];
 		$moduleFieldLabel = $selectedfields[2];
@@ -2999,7 +3002,7 @@ class ReportRun extends CRMEntity {
 		$allColumnsRestricted = false;
 
 		if ($type == 'COLUMNSTOTOTAL') {
-			if ($columnstotalsql != '') {
+			if (isset($columnstotalsql) && $columnstotalsql != '') {
 				$reportquery = "select " . $columnstotalsql . " " . $reportquery . " " . $wheresql;
 			}
 		} else {
@@ -3074,6 +3077,7 @@ class ReportRun extends CRMEntity {
 		global $mod_strings, $current_language;
 		require('user_privileges/user_privileges_' . $current_user->id . '.php');
 		$modules_selected = array();
+		$picklistarray = array();
 		static $mod_query_details = array();
 		$modules_selected[] = $this->primarymodule;
 		if (!empty($this->secondarymodule)) {
diff --git a/modules/Reports/ReportUtils.php b/modules/Reports/ReportUtils.php
index d0a18bd77e74f20f075e3ef46aac479843a9486d..9fbda724d97051126675f8118211fb092b132d25 100644
--- a/modules/Reports/ReportUtils.php
+++ b/modules/Reports/ReportUtils.php
@@ -64,11 +64,13 @@ function isReferenceUIType($uitype) {
 }
 
 function IsDateField($reportColDetails) {
-	list($tablename, $colname, $module_field, $fieldname, $typeOfData) = explode(':', $reportColDetails);
-	if ($typeOfData == "D") {
-		return true;
-	} else {
-		return false;
+	if (substr_count($reportColDetails, ':') >= 4) {
+		list($tablename, $colname, $module_field, $fieldname, $typeOfData) = explode(':', $reportColDetails);
+		if ($typeOfData == "D") {
+			return true;
+		} else {
+			return false;
+		}
 	}
 }
 
@@ -113,7 +115,7 @@ function getReportFieldValue ($report, $picklistArray, $dbField, $valueArray, $f
 		$field = WebserviceField::fromArray($db, $fieldInfo);
 		$fieldType = $field->getFieldDataType();
 	}
-	if(is_object($field) &&	$field->getUIType() == 401){
+	if(isset($field) && is_object($field) && $field->getUIType() == 401){
 		if ($value) {
 			$value = explode('_', $value);
 			$module = 'RecurringInvoice';
@@ -255,7 +257,7 @@ function getReportFieldValue ($report, $picklistArray, $dbField, $valueArray, $f
 	}
 
 	// Added to render html tag for description fields
-	if($fieldInfo['uitype'] == '19' && ($module == 'Documents' || $module == 'Emails')) {
+	if(isset($fieldInfo['uitype']) && $fieldInfo['uitype'] == '19' && ($module == 'Documents' || $module == 'Emails')) {
 		return $fieldvalue;
 	}
         if($operation == 'ExcelExport') {
diff --git a/modules/Reports/Reports.php b/modules/Reports/Reports.php
index 3bbc1d49c36682ecabf072c66deef07bd3c81e69..1dd9f3e39f4da618a735094eac741540132a70ef 100644
--- a/modules/Reports/Reports.php
+++ b/modules/Reports/Reports.php
@@ -112,6 +112,7 @@ class Reports extends CRMEntity{
 	 */
         function __construct($reportid="") {
             global $adb,$current_user,$theme,$mod_strings;
+			$is_admin = false;
             $this->initListOfModules();
             if($reportid != "")
             {
@@ -584,7 +585,7 @@ class Reports extends CRMEntity{
 			}while($report = $adb->fetch_array($result));
 		}
 		if($rpt_fldr_id !== false && $rpt_fldr_id !== 'shared' && $rpt_fldr_id !== 'All') {
-			$returndata = $returndata[$rpt_fldr_id];
+			$returndata = isset($returndata[$rpt_fldr_id]) ? $returndata[$rpt_fldr_id] : '';
 		}
 		$log->info("Reports :: ListView->Successfully returned vtiger_report details HTML");
 		return $returndata;
@@ -613,9 +614,10 @@ class Reports extends CRMEntity{
 	function getPriModuleColumnsList($module)
 	{
 		//$this->updateModuleList($module);
-		$allColumnsListByBlocks =& $this->getColumnsListbyBlock($module, array_keys($this->module_list[$module]), true);
+		$tempColumnsListByBlocks =$this->getColumnsListbyBlock($module, array_keys($this->module_list[$module]), true);
+		$allColumnsListByBlocks = & $tempColumnsListByBlocks;
 		foreach($this->module_list[$module] as $key=>$value) {
-			$temp = $allColumnsListByBlocks[$key];
+			$temp = isset($allColumnsListByBlocks[$key]) ? $allColumnsListByBlocks[$key] : array();
 
 			if (!empty($ret_module_list[$module][$value])) {
 				if (!empty($temp)) {
@@ -684,7 +686,7 @@ class Reports extends CRMEntity{
 	 * @return Array
 	 */
 	public function getBlockFieldList($module, $blockIdList, $currentFieldList,$allColumnsListByBlocks) {
-		$temp = $allColumnsListByBlocks[$blockIdList];
+		$temp = isset($allColumnsListByBlocks[$blockIdList]) ? $allColumnsListByBlocks[$blockIdList] : '';
 		if(!empty($currentFieldList)){
 			if(!empty($temp)){
 				$currentFieldList = array_merge($currentFieldList,$temp);
@@ -696,10 +698,12 @@ class Reports extends CRMEntity{
 	}
 
 	public function getModuleFieldList($module) {
-		$allColumnsListByBlocks =& $this->getColumnsListbyBlock($module, array_keys($this->module_list[$module]), true);
+		$ret_module_list = array();
+		$tempColumnsListByBlocks =$this->getColumnsListbyBlock($module, array_keys($this->module_list[$module]), true);
+		$allColumnsListByBlocks = & $tempColumnsListByBlocks;
 		foreach($this->module_list[$module] as $key=>$value) {
 			$ret_module_list[$module][$value] = $this->getBlockFieldList(
-					$module, $key, $ret_module_list[$module][$value],$allColumnsListByBlocks);
+					$module, $key, isset($ret_module_list[$module][$value]) ? $ret_module_list[$module][$value] : array(),$allColumnsListByBlocks);
 		}
 		return $ret_module_list[$module];
 	}
@@ -807,7 +811,7 @@ class Reports extends CRMEntity{
 			$optionvalue = $fieldtablename.":".$fieldcolname.":".$module."_".$fieldlabel1.":".$fieldname.":".$fieldtypeofdata;
 
 			$adv_rel_field_tod_value = '$'.$module.'#'.$fieldname.'$'."::".getTranslatedString($module,$module)." ".getTranslatedString($fieldlabel,$module);
-			if (!is_array($this->adv_rel_fields[$fieldtypeofdata]) ||
+			if (!isset($this->adv_rel_fields[$fieldtypeofdata]) || !is_array($this->adv_rel_fields[$fieldtypeofdata]) ||
 					!in_array($adv_rel_field_tod_value, $this->adv_rel_fields[$fieldtypeofdata])) {
 				$this->adv_rel_fields[$fieldtypeofdata][] = $adv_rel_field_tod_value;
 			}
diff --git a/modules/Reports/actions/DeleteAjax.php b/modules/Reports/actions/DeleteAjax.php
index b1c5ab0b9529bc79092858598144cfb886c7e7cd..70d178f883fa17391515ed77b2f0e729d7b5114a 100644
--- a/modules/Reports/actions/DeleteAjax.php
+++ b/modules/Reports/actions/DeleteAjax.php
@@ -20,6 +20,7 @@ class Reports_DeleteAjax_Action extends Vtiger_DeleteAjax_Action {
 	public function process(Vtiger_Request $request) {
 		$moduleName = $request->getModule();
 		$recordId = $request->get('record');
+		$parentModule = '';
 		$response = new Vtiger_Response();
 
 		$recordModel = Reports_Record_Model::getInstanceById($recordId, $moduleName);
diff --git a/modules/Reports/actions/MoveReports.php b/modules/Reports/actions/MoveReports.php
index 7e203c46a86b480294d58d6d507ebbbe99c1f96d..27c4a04b9bc205cfceaa37dc279b8c2cb70d1c69 100644
--- a/modules/Reports/actions/MoveReports.php
+++ b/modules/Reports/actions/MoveReports.php
@@ -18,6 +18,7 @@ class Reports_MoveReports_Action extends Vtiger_Mass_Action {
 
 	public function process(Vtiger_Request $request) {
 		$parentModule = 'Reports';
+		$sameTargetFolder = 0;
 		$reportIdsList = $this->getRecordsListFromRequest($request);
 		$folderId = $request->get('folderid');
                 $viewname=$request->get('viewname');
diff --git a/modules/Reports/models/Folder.php b/modules/Reports/models/Folder.php
index 896abdab5f8804bfb5df07179b98126cd295ec4d..9075ed0324b9ab44f36ca4a0c4f817a141895b92 100644
--- a/modules/Reports/models/Folder.php
+++ b/modules/Reports/models/Folder.php
@@ -113,10 +113,11 @@ class Reports_Folder_Model extends Vtiger_Base_Model {
 			$reportModels = array();
 			for($i=0; $i < php7_count($reportsList); $i++) {
 				$reportModel = Reports_Record_Model::getCleanInstance();
-
-				$reportModel->setData($reportsList[$i])->setModuleFromInstance($reportModuleModel);
-				$reportModels[] = $reportModel;
-				unset($reportModel);
+				if (isset($reportsList[$i]) && is_array($reportsList)) { 
+					$reportModel->setData($reportsList[$i])->setModuleFromInstance($reportModuleModel);
+					$reportModels[] = $reportModel;
+					unset($reportModel);
+				}
 			}
 			return $reportModels;
 		}
diff --git a/modules/Reports/models/Module.php b/modules/Reports/models/Module.php
index b35ea0b0957cb468f39421b22818c8d2669a37aa..4fc3eee22761e0e0b9355f71482a3ae1a42e9555 100644
--- a/modules/Reports/models/Module.php
+++ b/modules/Reports/models/Module.php
@@ -17,7 +17,7 @@ class Reports_Module_Model extends Vtiger_Module_Model {
 	function deleteRecord(Vtiger_Record_Model $reportModel) {
 		$currentUser = Users_Record_Model::getCurrentUserModel();
 		$subOrdinateUsers = $currentUser->getSubordinateUsers();
-
+		$homePageChartIdsList = array();
 		$subOrdinates = array();
 		foreach($subOrdinateUsers as $id=>$name) {
 			$subOrdinates[] = $id;
diff --git a/modules/Reports/models/Record.php b/modules/Reports/models/Record.php
index a88e21a9527e5d7644d92938668b6f1239f85055..098478e843192f319928a65446835be476a808c6 100644
--- a/modules/Reports/models/Record.php
+++ b/modules/Reports/models/Record.php
@@ -51,7 +51,7 @@ class Reports_Record_Model extends Vtiger_Record_Model {
 	 * @return type
 	 */
 	public function getMembers() {
-		if($this->members == false) {
+		if(!property_exists($this, 'members') || $this->members == false) {
 			$this->members = Settings_Groups_Member_Model::getAllByGroup($this, Settings_Groups_Member_Model::REPORTS_VIEW_MODE);
 		}
 		return $this->members;
diff --git a/modules/Reports/models/RecordStructure.php b/modules/Reports/models/RecordStructure.php
index f40d13f5364899c9accfe590264ff15497eb8217..489b37355377696ebb9981f7c1e9726ec78a9184 100644
--- a/modules/Reports/models/RecordStructure.php
+++ b/modules/Reports/models/RecordStructure.php
@@ -80,6 +80,9 @@ class Reports_RecordStructure_Model extends Vtiger_RecordStructure_Model {
 				}
 			}
 		}
+		if ($this->structuredValues === false) {
+			$this->structuredValues = array();
+		}
 		$this->structuredValues[$moduleName] = $moduleRecordStructure;
 		return $moduleRecordStructure;
 	}
diff --git a/modules/Reports/models/Report.php b/modules/Reports/models/Report.php
index 4ab553e9291aa19d144cec59c838c04e24f81b0a..2fafe65d44c4ed13fc90dd66c79f57720c82d2ef 100644
--- a/modules/Reports/models/Report.php
+++ b/modules/Reports/models/Report.php
@@ -21,6 +21,8 @@ class Vtiger_Report_Model extends Reports {
 		$currentUser = Users_Record_Model::getCurrentUserModel();
 		$userId = $currentUser->getId();
 		$currentUserRoleId = $currentUser->get('roleid');
+		$userGroupsQuery = '';
+		$current_user_parent_role_seq = '';
 		$subordinateRoles = getRoleSubordinates($currentUserRoleId);
 		array_push($subordinateRoles, $currentUserRoleId);
 
diff --git a/modules/Reports/views/Detail.php b/modules/Reports/views/Detail.php
index 22c0b28e3203d33432bacee1f617f825f9d87c96..66d35d8cd8f4f7f9e1e2dd6ef78e8b2489787565 100644
--- a/modules/Reports/views/Detail.php
+++ b/modules/Reports/views/Detail.php
@@ -58,7 +58,7 @@ class Reports_Detail_View extends Vtiger_Index_View {
 		$pagingModel->set('limit', self::REPORT_LIMIT);
 
 		$reportData = $reportModel->getReportData($pagingModel);
-		$this->reportData = $reportData['data'];
+		$this->reportData = isset($reportData['data']) ? $reportData['data'] : '';
 		$this->calculationFields = $reportModel->getReportCalulationData();
 
 		$this->count = $reportData['count'];
@@ -182,7 +182,7 @@ class Reports_Detail_View extends Vtiger_Index_View {
 			$reportType = $reportModel->get('reporttype');
 
 			$reportData = $reportModel->getReportData($pagingModel);
-			$data = $reportData['data'];
+			$data = isset($reportData['data']) ? $reportData['data'] : '';
 			$this->count = $reportData['count'];
 			$calculation = $reportModel->getReportCalulationData();
 		}
diff --git a/modules/Reports/views/Edit.php b/modules/Reports/views/Edit.php
index f90d9814f27a8d056d81f78689ad82459f904700..4f752936c2c78204e53cb426a32f7c417417fc70 100644
--- a/modules/Reports/views/Edit.php
+++ b/modules/Reports/views/Edit.php
@@ -198,7 +198,7 @@ Class Reports_Edit_View extends Vtiger_Edit_View {
 			foreach($secondaryModuleFields as $module => $blockFields){
 				if($module == 'HelpDesk'){
 					foreach($blockFields as $key => $value){
-						if(isset($value)){
+						if(isset($value) && is_array($value)){
 							foreach($value as $key1 => $value1){
 								if($key1 == 'vtiger_troubletickets:update_log:HelpDesk_Update_History:update_log:V'){
 									unset($secondaryModuleFields[$module][$key][$key1]);