diff --git a/include/ListView/ListViewController.php b/include/ListView/ListViewController.php
index cc826aa8965b4082524710032ff82b0553d0edca..99a70295555b6db290ef0d3dd0df4cb19eefb960 100644
--- a/include/ListView/ListViewController.php
+++ b/include/ListView/ListViewController.php
@@ -464,7 +464,7 @@ class ListViewController {
 					if(php7_count($moduleList) == 1) {
 						$parentModule = $moduleList[0];
 					} else {
-						$parentModule = $this->typeList[$value];
+						$parentModule = isset($this->typeList[$value]) ? $this->typeList[$value] : '';
 					}
 					if(!empty($value) && !empty($this->nameList[$fieldName]) && !empty($parentModule)) {
 						$parentMeta = $this->queryGenerator->getMeta($parentModule);
diff --git a/include/Webservices/WebserviceField.php b/include/Webservices/WebserviceField.php
index d7c4dc921a39d5521aac1129cd87f70fedf06e59..033b4730923579511ce6c6931413a6d6edd69d39 100644
--- a/include/Webservices/WebserviceField.php
+++ b/include/Webservices/WebserviceField.php
@@ -49,6 +49,8 @@ class WebserviceField{
 	private $readOnly = 0;
 	private $isunique = 0;
 
+	public $parentReferenceField; //To avoid undefined property warning.
+
 	private function __construct($adb,$row){
 		$this->uitype = isset($row['uitype'])? $row['uitype'] : 0;
 		$this->blockId = isset($row['block'])? $row['block'] : 0;
diff --git a/include/utils/EditViewUtils.php b/include/utils/EditViewUtils.php
index d012eab9999a835bcd07980a5dcfd57b7b7027b6..ea1c68d57f181c0339bb0622fad72e8d3ded7c12 100755
--- a/include/utils/EditViewUtils.php
+++ b/include/utils/EditViewUtils.php
@@ -565,7 +565,7 @@ function getAssociatedProducts($module, $focus, $seid = '', $refModuleName = fal
 	$product_Detail[1]['final_details']['adjustment'] = $adjustment;
 
 	//To set the grand total
-	$grandTotal = ($focus->column_fields['hdnGrandTotal'] != '')?$focus->column_fields['hdnGrandTotal']:0;
+	$grandTotal = (isset($focus->column_fields['hdnGrandTotal']) && $focus->column_fields['hdnGrandTotal'] != '')?$focus->column_fields['hdnGrandTotal']:0;
 	$grandTotal = number_format($grandTotal, $no_of_decimal_places,'.','');
 	$product_Detail[1]['final_details']['grandTotal'] = $grandTotal;
 
diff --git a/layouts/v7/modules/Calendar/ListViewRecordActions.tpl b/layouts/v7/modules/Calendar/ListViewRecordActions.tpl
index 5ea415cff4850bc951d4fbdf1fe2a7dc5a81795b..9ea7dccf4b14599d60209247d5bb2074a63c9689 100644
--- a/layouts/v7/modules/Calendar/ListViewRecordActions.tpl
+++ b/layouts/v7/modules/Calendar/ListViewRecordActions.tpl
@@ -30,10 +30,10 @@
 			</span>
 		{/if}
 		{assign var=EDIT_VIEW_URL value={$LISTVIEW_ENTRY->getEditViewUrl()}}
-		{if $IS_MODULE_EDITABLE && $EDIT_VIEW_URL && $LISTVIEW_ENTRY->get('taskstatus') neq vtranslate('Held', $MODULE) && $LISTVIEW_ENTRY->get('taskstatus') neq vtranslate('Completed', $MODULE)}
+		{if isset($IS_MODULE_EDITABLE) && $IS_MODULE_EDITABLE && $EDIT_VIEW_URL && $LISTVIEW_ENTRY->get('taskstatus') neq vtranslate('Held', $MODULE) && $LISTVIEW_ENTRY->get('taskstatus') neq vtranslate('Completed', $MODULE)}
 			<span class="fa fa-check icon action markAsHeld" title="{vtranslate('LBL_MARK_AS_HELD', $MODULE)}" onclick="Calendar_Calendar_Js.markAsHeld('{$LISTVIEW_ENTRY->getId()}');"></span>
 		{/if}
-		{if $IS_CREATE_PERMITTED && $EDIT_VIEW_URL && $LISTVIEW_ENTRY->get('taskstatus') eq vtranslate('Held', $MODULE)}
+		{if isset($IS_CREATE_PERMITTED) && $IS_CREATE_PERMITTED && $EDIT_VIEW_URL && $LISTVIEW_ENTRY->get('taskstatus') eq vtranslate('Held', $MODULE)}
 			<span class="fa fa-flag icon action holdFollowupOn" title="{vtranslate('LBL_HOLD_FOLLOWUP_ON', "Events")}" onclick="Calendar_Calendar_Js.holdFollowUp('{$LISTVIEW_ENTRY->getId()}');"></span>
 		{/if}
 		<span class="more dropdown action">
@@ -41,7 +41,7 @@
 				<i class="fa fa-ellipsis-v icon"></i></span>
 			<ul class="dropdown-menu">
 				<li><a data-id="{$LISTVIEW_ENTRY->getId()}" href="{$LISTVIEW_ENTRY->getFullDetailViewUrl()}&app={$SELECTED_MENU_CATEGORY}">{vtranslate('LBL_DETAILS', $MODULE)}</a></li>
-					{if $RECORD_ACTIONS}
+					{if isset($RECORD_ACTIONS) && $RECORD_ACTIONS}
 						{if $RECORD_ACTIONS['edit']}
 						<li><a data-id="{$LISTVIEW_ENTRY->getId()}" href="javascript:void(0);" data-url="{$LISTVIEW_ENTRY->getEditViewUrl()}&app={$SELECTED_MENU_CATEGORY}" name="editlink">{vtranslate('LBL_EDIT', $MODULE)}</a></li>
 						{/if}
diff --git a/layouts/v7/modules/HelpDesk/SelectEmailFields.tpl b/layouts/v7/modules/HelpDesk/SelectEmailFields.tpl
index f032b1b0476f00150f9d417190d92993244c015b..68157f6803fa661da0ca75244b50aea3e51fef89 100644
--- a/layouts/v7/modules/HelpDesk/SelectEmailFields.tpl
+++ b/layouts/v7/modules/HelpDesk/SelectEmailFields.tpl
@@ -62,7 +62,7 @@
             </div>
             <div class="preferenceDiv" style="padding: 0px 0px 10px 35px;">
                 <label class="checkbox displayInlineBlock">
-                    <input type="checkbox" name="saveRecipientPrefs" id="saveRecipientPrefs" {if $RECIPIENT_PREF_ENABLED}checked="true"{/if}/>&nbsp;&nbsp;&nbsp;
+                    <input type="checkbox" name="saveRecipientPrefs" id="saveRecipientPrefs" {if isset($RECIPIENT_PREF_ENABLED) &&  $RECIPIENT_PREF_ENABLED}checked="true"{/if}/>&nbsp;&nbsp;&nbsp;
                     {vtranslate('LBL_REMEMBER_MY_PREF',$MODULE)}&nbsp;&nbsp;
                 </label>
                 <i class="fa fa-info-circle" title="{vtranslate('LBL_EDIT_EMAIL_PREFERENCE_TOOLTIP', $MODULE)}"></i>
diff --git a/layouts/v7/modules/Vtiger/ListViewContents.tpl b/layouts/v7/modules/Vtiger/ListViewContents.tpl
index 2cea24ff8c318058e8254e16e21c942cbedac575..b5f0a1aa30f32ec0476900a71f035aa19efa08f2 100644
--- a/layouts/v7/modules/Vtiger/ListViewContents.tpl
+++ b/layouts/v7/modules/Vtiger/ListViewContents.tpl
@@ -23,7 +23,7 @@
 		</div>
 	{/if}
 	<input type="hidden" name="view" id="view" value="{$VIEW}" />
-	<input type="hidden" name="cvid" value="{$VIEWID}" />
+	<input type="hidden" name="cvid" value="{(isset($VIEWID)) ? $VIEWID : ''}" />
 	<input type="hidden" name="pageStartRange" id="pageStartRange" value="{$PAGING_MODEL->getRecordStartRange()}" />
 	<input type="hidden" name="pageEndRange" id="pageEndRange" value="{$PAGING_MODEL->getRecordEndRange()}" />
 	<input type="hidden" name="previousPageExist" id="previousPageExist" value="{$PAGING_MODEL->isPrevPageExists()}" />
@@ -33,14 +33,14 @@
 	<input type="hidden" name="totalCount" id="totalCount" value="{$LISTVIEW_COUNT}" />
 	<input type='hidden' name="pageNumber" value="{$PAGE_NUMBER}" id='pageNumber'>
 	<input type='hidden' name="pageLimit" value="{$PAGING_MODEL->getPageLimit()}" id='pageLimit'>
-	<input type="hidden" name="noOfEntries" value="{$LISTVIEW_ENTRIES_COUNT}" id="noOfEntries">
-	<input type="hidden" name="currentSearchParams" value="{Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($SEARCH_DETAILS))}" id="currentSearchParams" />
-        <input type="hidden" name="currentTagParams" value="{Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($TAG_DETAILS))}" id="currentTagParams" />
-	<input type="hidden" name="noFilterCache" value="{$NO_SEARCH_PARAMS_CACHE}" id="noFilterCache" >
-	<input type="hidden" name="orderBy" value="{$ORDER_BY}" id="orderBy">
-	<input type="hidden" name="sortOrder" value="{$SORT_ORDER}" id="sortOrder">
-	<input type="hidden" name="list_headers" value='{$LIST_HEADER_FIELDS}'/>
-	<input type="hidden" name="tag" value="{$CURRENT_TAG}" />
+	<input type="hidden" name="noOfEntries" value="{(isset($LISTVIEW_ENTRIES_COUNT)) ? $LISTVIEW_ENTRIES_COUNT : ''}" id="noOfEntries">
+	<input type="hidden" name="currentSearchParams" value="{(isset($SEARCH_DETAILS)) ? Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($SEARCH_DETAILS)) : ''}" id="currentSearchParams" />
+        <input type="hidden" name="currentTagParams" value="{(isset($TAG_DETAILS)) ? Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($TAG_DETAILS)) : ''}" id="currentTagParams" />
+	<input type="hidden" name="noFilterCache" value="{(isset($NO_SEARCH_PARAMS_CACHE)) ? $NO_SEARCH_PARAMS_CACHE : ''}" id="noFilterCache" >
+	<input type="hidden" name="orderBy" value="{(isset($ORDER_BY)) ? $ORDER_BY : ''}" id="orderBy">
+	<input type="hidden" name="sortOrder" value="{(isset($SORT_ORDER)) ? $SORT_ORDER : ''}" id="sortOrder">
+	<input type="hidden" name="list_headers" value='{(isset($LIST_HEADER_FIELDS)) ? $LIST_HEADER_FIELDS : ''}'/>
+	<input type="hidden" name="tag" value="{(isset($CURRENT_TAG)) ? $CURRENT_TAG : ''}" />
 	<input type="hidden" name="folder_id" value="{$FOLDER_ID}" />
 	<input type="hidden" name="folder_value" value="{$FOLDER_VALUE}" />
 	<input type="hidden" name="viewType" value="{$VIEWTYPE}" />
@@ -55,7 +55,7 @@
 
 	<div id="table-content" class="table-container">
 		<form name='list' id='listedit' action='' onsubmit="return false;">
-			<table id="listview-table" class="table {if $LISTVIEW_ENTRIES_COUNT eq '0'}listview-table-norecords {/if} listview-table ">
+			<table id="listview-table" class="table {if isset($LISTVIEW_ENTRIES_COUNT) && $LISTVIEW_ENTRIES_COUNT eq '0'}listview-table-norecords {/if} listview-table ">
 				<thead>
 					<tr class="listViewContentHeader">
 						<th>
@@ -99,7 +99,7 @@
 					{else}
 						{assign var=NO_SORTING value=0}
 					{/if}
-					<th {if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')} nowrap="nowrap" {/if}>
+					<th {if isset($COLUMN_NAME) && $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')} nowrap="nowrap" {/if}>
 						<a href="#" class="{if $NO_SORTING}noSorting{else}listViewContentHeaderValues{/if}" {if !$NO_SORTING}data-nextsortorderval="{if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}{$NEXT_SORT_ORDER}{else}ASC{/if}" data-columnname="{$LISTVIEW_HEADER->get('name')}"{/if} data-field-id='{$LISTVIEW_HEADER->getId()}'>
 							{if !$NO_SORTING}
 								{if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}
@@ -110,7 +110,7 @@
 							{/if}
 							&nbsp;{vtranslate($LISTVIEW_HEADER->get('label'), $LISTVIEW_HEADER->getModuleName())}&nbsp;
 						</a>
-						{if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}
+						{if isset($COLUMN_NAME) && $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}
 							<a href="#" class="removeSorting"><i class="fa fa-remove"></i></a>
 							{/if}
 					</th>
@@ -234,7 +234,7 @@
 					{/foreach}
 					</tr>
 				{/foreach}
-				{if $LISTVIEW_ENTRIES_COUNT eq '0'}
+				{if isset($LISTVIEW_ENTRIES_COUNT) && $LISTVIEW_ENTRIES_COUNT eq '0'}
 					<tr class="emptyRecordsDiv">
 						{assign var=COLSPAN_WIDTH value={php7_count($LISTVIEW_HEADERS)}+1}
 						<td colspan="{$COLSPAN_WIDTH}">
diff --git a/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl b/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl
index 8f77d1b0f59d4b448c5d6ef83b4779fd02a141c7..6aca7e7a8b84a113d3dadb9d3708cf65a418583b 100644
--- a/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl
+++ b/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl
@@ -35,7 +35,7 @@
             <i class="fa fa-ellipsis-v icon"></i></span>
         <ul class="dropdown-menu">
             <li><a data-id="{$LISTVIEW_ENTRY->getId()}" href="{$LISTVIEW_ENTRY->getFullDetailViewUrl()}&app={$SELECTED_MENU_CATEGORY}">{vtranslate('LBL_DETAILS', $MODULE)}</a></li>
-			{if $RECORD_ACTIONS}
+			{if isset($RECORD_ACTIONS) && $RECORD_ACTIONS}
 				{if $RECORD_ACTIONS['edit']}
 					<li><a data-id="{$LISTVIEW_ENTRY->getId()}" href="javascript:void(0);" data-url="{$LISTVIEW_ENTRY->getEditViewUrl()}&app={$SELECTED_MENU_CATEGORY}" name="editlink">{vtranslate('LBL_EDIT', $MODULE)}</a></li>
 				{/if}
diff --git a/layouts/v7/modules/Vtiger/QuickCreate.tpl b/layouts/v7/modules/Vtiger/QuickCreate.tpl
index ce2b67ce44bc78df7b733a9d5a119bb1954e2424..ece9d92ca606a62171588f020bb96120b94bc9d6 100644
--- a/layouts/v7/modules/Vtiger/QuickCreate.tpl
+++ b/layouts/v7/modules/Vtiger/QuickCreate.tpl
@@ -67,7 +67,7 @@
                                                     <span class="pull-right">
                                                         <select style="width:150px;" class="select2 referenceModulesList {if $FIELD_MODEL->isMandatory() eq true}reference-mandatory{/if}">
                                                             {foreach key=index item=value from=$referenceList}
-                                                                <option value="{$value}" {if $value eq $REFERENCED_MODULE_NAME} selected {/if} >{vtranslate($value, $value)}</option>
+                                                                <option value="{$value}" {if isset($REFERENCED_MODULE_NAME) && $value eq $REFERENCED_MODULE_NAME} selected {/if} >{vtranslate($value, $value)}</option>
                                                             {/foreach}
                                                         </select>
                                                     </span>
diff --git a/layouts/v7/modules/Vtiger/SearchResults.tpl b/layouts/v7/modules/Vtiger/SearchResults.tpl
index 9e239e3775921de50bf6a6d1f305df2b7dda931f..1b49bdc65cd02389976baf8a1d317cfa45ea4544 100644
--- a/layouts/v7/modules/Vtiger/SearchResults.tpl
+++ b/layouts/v7/modules/Vtiger/SearchResults.tpl
@@ -22,7 +22,7 @@
 			<input type="hidden" value="{$SEARCH_VALUE|escape:"html"}" id="searchValue">
 			<div class="scrollableSearchContent">
 				<div class="container-fluid moduleResults-container">
-					<input type="hidden" name="groupStart" value="{$GROUP_START}" class="groupStart"/>
+					<input type="hidden" name="groupStart" value="{(isset($GROUP_START)) ? $GROUP_START : ''}" class="groupStart"/>
 					{assign var=NORECORDS value=false}
 					{foreach key=MODULE item=LISTVIEW_MODEL from=$MATCHING_RECORDS}
 						{assign var=RECORDS_COUNT value=$LISTVIEW_MODEL->recordsCount}
diff --git a/layouts/v7/modules/Vtiger/partials/EditViewContents.tpl b/layouts/v7/modules/Vtiger/partials/EditViewContents.tpl
index 106011ffc94504b8abd9752caed8d2b284d22eec..acfa3dcdfe06b37c7a38c546f24a655ac0c1430c 100644
--- a/layouts/v7/modules/Vtiger/partials/EditViewContents.tpl
+++ b/layouts/v7/modules/Vtiger/partials/EditViewContents.tpl
@@ -59,7 +59,7 @@
 												{/if}
 												<select style="width: 140px;" class="select2 referenceModulesList">
 													{foreach key=index item=value from=$refrenceList}
-														<option value="{$value}" {if $value eq $REFERENCED_MODULE_NAME} selected {/if}>{vtranslate($value, $value)}</option>
+														<option value="{$value}" {if isset($REFERENCED_MODULE_NAME) && $value eq $REFERENCED_MODULE_NAME} selected {/if}>{vtranslate($value, $value)}</option>
 													{/foreach}
 												</select>
 											{else}
diff --git a/layouts/v7/modules/Vtiger/uitypes/Reference.tpl b/layouts/v7/modules/Vtiger/uitypes/Reference.tpl
index e18d1517df15cc196f7b0163c7886c1518dfaede..f03837d59e93edc5ece48ac92a2ced012de3bd3a 100644
--- a/layouts/v7/modules/Vtiger/uitypes/Reference.tpl
+++ b/layouts/v7/modules/Vtiger/uitypes/Reference.tpl
@@ -28,7 +28,7 @@
         {if !empty($REFERENCED_MODULE_STRUCT)}
             {assign var="REFERENCED_MODULE_NAME" value=$REFERENCED_MODULE_STRUCT->get('name')}
         {/if}
-        {if in_array($REFERENCED_MODULE_NAME, $REFERENCE_LIST)}
+        {if isset($REFERENCED_MODULE_NAME) && in_array($REFERENCED_MODULE_NAME, $REFERENCE_LIST)}
             <input name="popupReferenceModule" type="hidden" value="{$REFERENCED_MODULE_NAME}" />
         {else}
             <input name="popupReferenceModule" type="hidden" value="{$REFERENCE_LIST[0]}" />
diff --git a/modules/Calendar/models/ListView.php b/modules/Calendar/models/ListView.php
index 72b2bb379b7cc33f3a20ad84c05d5017dc1049ae..1bd0818361043d25a40d9c1cd70aeda50efdf4fd 100644
--- a/modules/Calendar/models/ListView.php
+++ b/modules/Calendar/models/ListView.php
@@ -130,6 +130,7 @@ class Calendar_ListView_Model extends Vtiger_ListView_Model {
 		$headerFields = $listViewContoller->getListViewHeaderFields();
 		foreach($headerFields as $fieldName => $webserviceField) {
 			if($webserviceField && !in_array($webserviceField->getPresence(), array(0,2))) continue;
+			
 			if($webserviceField && $webserviceField->parentReferenceField && !in_array($webserviceField->parentReferenceField->getPresence(), array(0,2))){
 				continue;
 			}
diff --git a/modules/Faq/Faq.php b/modules/Faq/Faq.php
index e5867d0a6626237b81fcd424d68985fc9b9d3ab1..72b384f40b19d1f7622a8919047f6f52cac7a442 100755
--- a/modules/Faq/Faq.php
+++ b/modules/Faq/Faq.php
@@ -113,7 +113,7 @@ class Faq extends CRMEntity {
 		if($this->column_fields['comments'] != '')
 			$comment = $this->column_fields['comments'];
 		else
-			$comment = $_REQUEST['comments'];
+			$comment = isset($_REQUEST['comments']) ? $_REQUEST['comments'] : '';
 
 		if($comment != '')
 		{
diff --git a/modules/Products/models/RelationListView.php b/modules/Products/models/RelationListView.php
index a3c19f32ed29c77a562797537f5ff4ff1127b42b..3f781ee898d85173e65afc8da983f7cc5e31f5b7 100644
--- a/modules/Products/models/RelationListView.php
+++ b/modules/Products/models/RelationListView.php
@@ -10,7 +10,7 @@
 
 class Products_RelationListView_Model extends Vtiger_RelationListView_Model {
 
-	protected $tab_label;
+	public $tab_label;
 
 	/**
 	 * Function to get the links for related list
diff --git a/modules/Vtiger/models/Module.php b/modules/Vtiger/models/Module.php
index 35d844b881a7deec5a3a96154992240093544e33..9598039732ee8161ad674c9c10c2c39f20d518c0 100644
--- a/modules/Vtiger/models/Module.php
+++ b/modules/Vtiger/models/Module.php
@@ -1623,6 +1623,7 @@ class Vtiger_Module_Model extends Vtiger_Module {
         if(empty($relationIds))  return array();
         
 		$focus = CRMEntity::getInstance($this->getName());
+		$focus->related_module_table_index=isset($focus->related_module_table_index) ? $focus->related_module_table_index : null;
 		$relatedModuleMapping = $focus->related_module_table_index;
         
         $relationFieldMapping = array();
@@ -1656,9 +1657,9 @@ class Vtiger_Module_Model extends Vtiger_Module {
                 
                 
                 if(empty($relationFieldId)){
-                    $tablename = $relatedModuleMapping[$module]['table_name'];
-                    $tabIndex = $relatedModuleMapping[$module]['table_index'];
-                    $relIndex = $relatedModuleMapping[$module]['rel_index'];
+                    $tablename = isset($relatedModuleMapping[$module]['table_name']) ? $relatedModuleMapping[$module]['table_name'] : '';
+                    $tabIndex = isset($relatedModuleMapping[$module]['table_index']) ? $relatedModuleMapping[$module]['table_index'] : '';
+                    $relIndex = isset($relatedModuleMapping[$module]['rel_index']) ? $relatedModuleMapping[$module]['rel_index'] : '';
 					//To show related records comments in documents, should get related document records from vtiger_senotesrel.
 					if(empty($tablename) && $this->getName() == 'Documents') {
 						$tablename = 'vtiger_senotesrel';
diff --git a/modules/Vtiger/models/Record.php b/modules/Vtiger/models/Record.php
index 9384788e96ab84d202269e300a052582a0b950c3..e1bbf5b6ddc69f45be8ff66e476142ac62a4fa26 100644
--- a/modules/Vtiger/models/Record.php
+++ b/modules/Vtiger/models/Record.php
@@ -628,7 +628,7 @@ class Vtiger_Record_Model extends Vtiger_Base_Model {
 		$fieldName = $fieldInstance->get('listViewRawFieldName');
 		$fieldValue = $this->get($fieldName); 
 		$rawData = $this->getRawData();
-		$rawValue = $rawData[$fieldName];
+		$rawValue = isset($rawData[$fieldName]) ? $rawData[$fieldName] : '';
 		if ($fieldInstance) {
 			$dataType = $fieldInstance->getFieldDataType();
 			$uiType = $fieldInstance->get('uitype');
diff --git a/pkg/vtiger/modules/ModComments/layouts/v7/modules/ModComments/ListViewContents.tpl b/pkg/vtiger/modules/ModComments/layouts/v7/modules/ModComments/ListViewContents.tpl
index fd73eda42b2c11fe0e6912f81203adfb45e30513..b5651ae270ee6260fb83808166114253b695b153 100644
--- a/pkg/vtiger/modules/ModComments/layouts/v7/modules/ModComments/ListViewContents.tpl
+++ b/pkg/vtiger/modules/ModComments/layouts/v7/modules/ModComments/ListViewContents.tpl
@@ -11,7 +11,7 @@
 
 <div class="col-sm-12 col-xs-12 ">
     <input type="hidden" name="view" id="view" value="{$VIEW}" />
-    <input type="hidden" name="cvid" value="{$VIEWID}" />
+    <input type="hidden" name="cvid" value="{(isset($VIEWID)) ? $VIEWID : ''}" />
     <input type="hidden" name="pageStartRange" id="pageStartRange" value="{$PAGING_MODEL->getRecordStartRange()}" />
     <input type="hidden" name="pageEndRange" id="pageEndRange" value="{$PAGING_MODEL->getRecordEndRange()}" />
     <input type="hidden" name="previousPageExist" id="previousPageExist" value="{$PAGING_MODEL->isPrevPageExists()}" />
@@ -21,17 +21,17 @@
     <input type="hidden" name="totalCount" id="totalCount" value="{$LISTVIEW_COUNT}" />
     <input type='hidden' name="pageNumber" value="{$PAGE_NUMBER}" id='pageNumber'>
     <input type='hidden' name="pageLimit" value="{$PAGING_MODEL->getPageLimit()}" id='pageLimit'>
-    <input type="hidden" name="noOfEntries" value="{$LISTVIEW_ENTRIES_COUNT}" id="noOfEntries">
-    <input type="hidden" name="currentSearchParams" value="{Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($SEARCH_DETAILS))}" id="currentSearchParams" />
-    <input type="hidden" name="currentTagParams" value="{Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($TAG_DETAILS))}" id="currentTagParams" />
-    <input type="hidden" name="noFilterCache" value="{$NO_SEARCH_PARAMS_CACHE}" id="noFilterCache" >
-    <input type="hidden" name="orderBy" value="{$ORDER_BY}" id="orderBy">
-    <input type="hidden" name="sortOrder" value="{$SORT_ORDER}" id="sortOrder">
-    <input type="hidden" name="list_headers" value='{$LIST_HEADER_FIELDS}'/>
-    <input type="hidden" name="tag" value="{$CURRENT_TAG}" />
+    <input type="hidden" name="noOfEntries" value="{(isset($LISTVIEW_ENTRIES_COUNT)) ? $LISTVIEW_ENTRIES_COUNT : ''}" id="noOfEntries">
+    <input type="hidden" name="currentSearchParams" value="{(isset($SEARCH_DETAILS)) ? Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($SEARCH_DETAILS)) : ''}" id="currentSearchParams" />
+    <input type="hidden" name="currentTagParams" value="{(isset($TAG_DETAILS)) ? Vtiger_Util_Helper::toSafeHTML(Zend_JSON::encode($TAG_DETAILS)) : ''}" id="currentTagParams" />
+    <input type="hidden" name="noFilterCache" value="{(isset($NO_SEARCH_PARAMS_CACHE)) ? $NO_SEARCH_PARAMS_CACHE : ''}" id="noFilterCache" >
+    <input type="hidden" name="orderBy" value="{(isset($ORDER_BY)) ? $ORDER_BY : ''}" id="orderBy">
+    <input type="hidden" name="sortOrder" value="{(isset($SORT_ORDER)) ? $SORT_ORDER : ''}" id="sortOrder">
+    <input type="hidden" name="list_headers" value='{(isset($LIST_HEADER_FIELDS)) ? $LIST_HEADER_FIELDS : ''}'/>
+    <input type="hidden" name="tag" value="{(isset($CURRENT_TAG)) ? $CURRENT_TAG : ''}" />
     <input type="hidden" name="folder_id" value="{$FOLDER_ID}" />
     <input type="hidden" name="folder_value" value="{$FOLDER_VALUE}" />
-    <input type="hidden" name="app" id="appName" value="{$SELECTED_MENU_CATEGORY}">
+    <input type="hidden" name="app" id="appName" value="{(isset($SELECTED_MENU_CATEGORY)) ? $SELECTED_MENU_CATEGORY : ''}">
     {if !empty($PICKIST_DEPENDENCY_DATASOURCE)}
         <input type="hidden" name="picklistDependency" value='{Vtiger_Util_Helper::toSafeHTML($PICKIST_DEPENDENCY_DATASOURCE)}' />
     {/if}
@@ -41,7 +41,7 @@
 
     <div id="table-content" class="table-container">
         <form name='list' id='listedit' action='' onsubmit="return false;">
-            <table id="listview-table" class="table {if $LISTVIEW_ENTRIES_COUNT eq '0'}listview-table-norecords {/if} listview-table ">
+            <table id="listview-table" class="table {if isset($LISTVIEW_ENTRIES_COUNT) && $LISTVIEW_ENTRIES_COUNT eq '0'}listview-table-norecords {/if} listview-table ">
                 <thead>
                     <tr class="listViewContentHeader">
                         <th>
@@ -69,7 +69,7 @@
                             {else}
                                 {assign var=NO_SORTING value=0}
                             {/if}
-                            <th {if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')} nowrap="nowrap" {/if}>
+                            <th {if isset($COLUMN_NAME) && $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')} nowrap="nowrap" {/if}>
                                 <a href="#" class="{if $NO_SORTING}noSorting{else}listViewContentHeaderValues{/if}" {if !$NO_SORTING}data-nextsortorderval="{if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}{$NEXT_SORT_ORDER}{else}ASC{/if}" data-columnname="{$LISTVIEW_HEADER->get('name')}"{/if}>
                                     {if !$NO_SORTING}
                                         {if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}
@@ -80,7 +80,7 @@
                                     {/if}
                                     &nbsp;{vtranslate($LISTVIEW_HEADER->get('label'), $LISTVIEW_HEADER->getModuleName())}&nbsp;
                                 </a>
-                                {if $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}
+                                {if isset($COLUMN_NAME) && $COLUMN_NAME eq $LISTVIEW_HEADER->get('name')}
                                     <a href="#" class="removeSorting"><i class="fa fa-remove"></i></a>
                                 {/if}
                             </th>
@@ -115,7 +115,7 @@
                                 {assign var=DATA_URL value=$RELATED_TO->getDetailViewUrl()}
                             {/if}
                         {/if}
-                        <tr class="listViewEntries" data-id='{$DATA_ID}' data-recordUrl='{$DATA_URL}&app={$SELECTED_MENU_CATEGORY}' id="{$MODULE}_listView_row_{$smarty.foreach.listview.index+1}" {if $MODULE eq 'Calendar'}data-recurring-enabled='{$LISTVIEW_ENTRY->isRecurringEnabled()}'{/if}>
+                        <tr class="listViewEntries" data-id='{$DATA_ID}' data-recordUrl='{$DATA_URL}&app={(isset($SELECTED_MENU_CATEGORY)) ? $SELECTED_MENU_CATEGORY : ''}' id="{$MODULE}_listView_row_{$smarty.foreach.listview.index+1}" {if $MODULE eq 'Calendar'}data-recurring-enabled='{$LISTVIEW_ENTRY->isRecurringEnabled()}'{/if}>
                             <td class = "listViewRecordActions">&nbsp;</td>
                             {foreach item=LISTVIEW_HEADER from=$LISTVIEW_HEADERS}
                                 {assign var=LISTVIEW_HEADERNAME value=$LISTVIEW_HEADER->get('name')}
@@ -157,7 +157,7 @@
                             {/foreach}
                         </tr>
                     {/foreach}
-                    {if $LISTVIEW_ENTRIES_COUNT eq '0'}
+                    {if isset($LISTVIEW_ENTRIES_COUNT)  && $LISTVIEW_ENTRIES_COUNT eq '0'}
                         <tr class="emptyRecordsDiv">
                             {assign var=COLSPAN_WIDTH value={php7_count($LISTVIEW_HEADERS)}+1}
                             <td colspan="{$COLSPAN_WIDTH}">
diff --git a/pkg/vtiger/modules/Projects/Project/modules/Project/views/MassActionAjax.php b/pkg/vtiger/modules/Projects/Project/modules/Project/views/MassActionAjax.php
index c8d8421549e30458b55c5766f34b3369d314e8ac..5b892168165a188c942a127e158e53f749821282 100644
--- a/pkg/vtiger/modules/Projects/Project/modules/Project/views/MassActionAjax.php
+++ b/pkg/vtiger/modules/Projects/Project/modules/Project/views/MassActionAjax.php
@@ -15,10 +15,11 @@ class Project_MassActionAjax_View extends Vtiger_MassActionAjax_View {
 		$emailFieldsInfo = array();
 		$moduleModel = Vtiger_Module_Model::getInstance($sourceModule);
 		$recipientPrefModel = Vtiger_RecipientPreference_Model::getInstance($sourceModule);
-
+		$recipientPrefs = array();
+		
 		if ($recipientPrefModel)
 			$recipientPrefs = $recipientPrefModel->getPreferences();
-		$moduleEmailPrefs = $recipientPrefs[$moduleModel->getId()];
+		$moduleEmailPrefs = isset($recipientPrefs[$moduleModel->getId()]) ? $recipientPrefs[$moduleModel->getId()] : '';
 		$emailAndRefFields = $moduleModel->getFieldsByType(array('email', 'reference'));
 		$accesibleFields = array();
 		$referenceFieldValues = array();
@@ -57,7 +58,7 @@ class Project_MassActionAjax_View extends Vtiger_MassActionAjax_View {
 				if (empty($refModuleEmailFields)) {
 					continue;
 				}
-				$refModuleEmailPrefs = $recipientPrefs[$refModule->getId()];
+				$refModuleEmailPrefs = $refModuleEmailPrefs = isset($recipientPrefs[$refModule->getId()]) ? $recipientPrefs[$refModule->getId()] : '';
 				foreach ($refModuleEmailFields as $refModuleEmailField) {
 					if ($refModuleEmailField->isViewable()) {
 						$refModuleEmailField->set('baseRefField', $referenceField->getFieldName());
diff --git a/pkg/vtiger/modules/ServiceContracts/modules/ServiceContracts/ServiceContracts.php b/pkg/vtiger/modules/ServiceContracts/modules/ServiceContracts/ServiceContracts.php
index 96822dcb420115bd46d5826a19c15a384cfd7c99..61d99b0ceb5271b615d683be7f071060e3888158 100644
--- a/pkg/vtiger/modules/ServiceContracts/modules/ServiceContracts/ServiceContracts.php
+++ b/pkg/vtiger/modules/ServiceContracts/modules/ServiceContracts/ServiceContracts.php
@@ -111,9 +111,9 @@ class ServiceContracts extends CRMEntity {
 	}
 
 	function save_module($module) {
-		$return_action = $_REQUEST['return_action'];
-		$for_module = $_REQUEST['return_module'];
-		$for_crmid  = $_REQUEST['return_id'];
+		$return_action = isset($_REQUEST['return_action']) ? $_REQUEST['return_action'] : '';
+		$for_module = isset($_REQUEST['return_module']) ? $_REQUEST['return_module'] : '';
+		$for_crmid  = isset($_REQUEST['return_id']) ? $_REQUEST['return_id'] : '';
 		if ($return_action && $for_module && $for_crmid) {
 			if ($for_module == 'HelpDesk') {
 				$on_focus = CRMEntity::getInstance($for_module);
@@ -655,7 +655,7 @@ class ServiceContracts extends CRMEntity {
 	 */
 	function transferRelatedRecords($module, $transferEntityIds, $entityId) {
 		global $adb,$log;
-		$log->debug("Entering function transferRelatedRecords ($module, $transferEntityIds, $entityId)");
+		$log->debug("Entering function transferRelatedRecords ($module, ".implode(' ',$transferEntityIds).", $entityId)");
 
 		$rel_table_arr = Array("Documents"=>"vtiger_senotesrel","Attachments"=>"vtiger_seattachmentsrel");