diff --git a/include/database/PearDatabase.php b/include/database/PearDatabase.php
index 0b7646c23a4a23199c6fbe0d3f9033d68211b73c..fa41139bee6793849e055f7d2b0b9dc662bd7446 100644
--- a/include/database/PearDatabase.php
+++ b/include/database/PearDatabase.php
@@ -961,10 +961,12 @@ class PearDatabase{
 		$this->checkConnection();
 		$adoflds = $this->database->MetaColumns($tablename);
 		$i=0;
-		foreach($adoflds as $fld) {
-		    $colNames[$i] = $fld->name;
-		    $i++;
-		}
+        if(!empty($adoflds)){
+            foreach($adoflds as $fld) {
+                $colNames[$i] = $fld->name;
+                $i++;
+            }
+        }
 		return $colNames;
     }
 
diff --git a/include/fields/CurrencyField.php b/include/fields/CurrencyField.php
index 5f475df09df174d77c7888d72fdfcd338bddb9f0..44e9a735f9fa38e49a041ba153f3266cf317836b 100644
--- a/include/fields/CurrencyField.php
+++ b/include/fields/CurrencyField.php
@@ -410,7 +410,7 @@ class CurrencyField {
     
 	public static function convertToDollar($amount, $conversionRate) {
 		if ($conversionRate == 0) return 0;
-		return $amount / $conversionRate;
+		return (float)$amount / (float)$conversionRate;
 	}
 	
 	public static function convertFromDollar($amount, $conversionRate) {
diff --git a/include/utils/EmailTemplate.php b/include/utils/EmailTemplate.php
index 4c4b1790c362264deb80ca742fbc2fd23d48bd9d..8e57aaaa13b50c9014297c7da34ff01e296d71bc 100644
--- a/include/utils/EmailTemplate.php
+++ b/include/utils/EmailTemplate.php
@@ -66,6 +66,7 @@ class EmailTemplate {
 	public function process($params) {
 		$module = $this->module;
 		$recordId = $this->recordId;
+        $variableList = array();
 		$variableList = $this->getTemplateVariableListForModule($module);
 		$handler = vtws_getModuleHandlerFromName($module, $this->user);
 		$meta = $handler->getMeta();
diff --git a/modules/Calendar/models/Module.php b/modules/Calendar/models/Module.php
index 4c79cd351ada8206df67288c656e40556ccb742a..adfd7ed18202e1c4030f2ce14c66174e2ac92f8f 100644
--- a/modules/Calendar/models/Module.php
+++ b/modules/Calendar/models/Module.php
@@ -204,7 +204,7 @@ class Calendar_Module_Model extends Vtiger_Module_Model {
 	 * Function to get export query
 	 * @return <String> query;
 	 */
-	public function getExportQuery($where) {
+	public function getExportQuery($focus, $where) {
 		$currentUserModel = Users_Record_Model::getCurrentUserModel();
 		$userId = $currentUserModel->getId();
 		$userGroup = new GetUserGroups();
diff --git a/modules/Migration/schema/660_to_700.php b/modules/Migration/schema/660_to_700.php
index 0692a19241e9d871e242f67edaf94ec35f0bb86b..bd78c8a2cabace32fd385ad167c6fa7f7137fec7 100644
--- a/modules/Migration/schema/660_to_700.php
+++ b/modules/Migration/schema/660_to_700.php
@@ -1226,7 +1226,7 @@ if(defined('VTIGER_UPGRADE')) {
 	}
 
 	$modules = array();
-	$ignoreModules = array('SMSNotifier', 'ModComments');
+	$ignoreModules = array('SMSNotifier', 'ModComments', 'PBXManager');
 	$result = $db->pquery('SELECT name FROM vtiger_tab WHERE isentitytype=? AND name NOT IN ('.generateQuestionMarks($ignoreModules).')', array(1, $ignoreModules));
 	while ($row = $db->fetchByAssoc($result)) {
 		$modules[] = $row['name'];
diff --git a/modules/Migration/schema/701_to_710.php b/modules/Migration/schema/701_to_710.php
index a5340d1ca6ec85d90fbdcad533a084b96e0684a2..7562d9775ccd0776a4a41f1f55a6605a8fea3d1c 100644
--- a/modules/Migration/schema/701_to_710.php
+++ b/modules/Migration/schema/701_to_710.php
@@ -95,7 +95,7 @@ if (defined('VTIGER_UPGRADE')) {
             $customTableName = $customTable[0];
             $customTableId = $customTable[1];
             $customTableColumns = $db->getColumnNames($customTableName);
-            if (in_array($fieldName, $customTableColumns)) {
+            if (!empty($customTableColumns) && in_array($fieldName, $customTableColumns)) {
                 $fieldModel = Vtiger_Field_Model::getInstance($fieldName, $moduleModel);
                 $db->pquery("UPDATE vtiger_field SET tablename=? WHERE fieldid=?", array($baseTableName, $fieldModel->id));
                 $db->pquery("ALTER TABLE $baseTableName ADD COLUMN $fieldName VARCHAR(1)", array());
diff --git a/modules/Migration/schema/711_to_720.php b/modules/Migration/schema/711_to_720.php
index abf2134192ac5e4cda3f6e6cb73b21587bae49ca..8ef2b7b493c6fd41c4a4f953ec57ee22a16943ee 100644
--- a/modules/Migration/schema/711_to_720.php
+++ b/modules/Migration/schema/711_to_720.php
@@ -13,5 +13,9 @@ if (defined('VTIGER_UPGRADE')) {
 	$db = PearDatabase::getInstance();
 
 	// Added column storedname for vtiger_attachments to support reverse mapping.
-	$db->pquery('ALTER TABLE vtiger_attachments ADD COLUMN storedname varchar(255) NULL AFTER path', array());
+    $columns = $db->getColumnNames('vtiger_attachments');
+    $columnName = "storedname";
+    if(!in_array($columnName,$columns)) {
+        $db->pquery('ALTER TABLE vtiger_attachments ADD COLUMN storedname varchar(255) NULL AFTER path', array());
+    }
 }
diff --git a/modules/Users/actions/SystemSetupSave.php b/modules/Users/actions/SystemSetupSave.php
index e910c0b65cd29d362ca146e34f7ea5517169902c..287de2fccfd70ed54574347511447182a9f32e13 100644
--- a/modules/Users/actions/SystemSetupSave.php
+++ b/modules/Users/actions/SystemSetupSave.php
@@ -19,7 +19,7 @@ class Users_SystemSetupSave_Action extends Users_Save_Action {
 	
 	public function process(Vtiger_Request $request) {
 		$moduleName = $request->getModule();
-		$packages = $request->get(packages);
+		$packages = $request->get('packages');
 		$userModuleModel = Users_Module_Model::getInstance($moduleName);
 		$userModuleModel::savePackagesInfo($packages);
 		header ('Location: index.php?module=Users&parent=Settings&view=UserSetup');
diff --git a/modules/Users/views/UserSetup.php b/modules/Users/views/UserSetup.php
index 03bca8c0e2fa7a08b1eef7f7516bdb7388a2929c..a1b0421de56f30bf4fb7c5e4e99ec0ce09b3fe19 100644
--- a/modules/Users/views/UserSetup.php
+++ b/modules/Users/views/UserSetup.php
@@ -14,7 +14,7 @@ class Users_UserSetup_View extends Vtiger_Index_View {
 		return array();
 	}
     
-    public function preProcess(Vtiger_Request $request) {
+    public function preProcess(Vtiger_Request $request, $display=true) {
 		return true;
 	}
 
diff --git a/modules/Vtiger/models/Module.php b/modules/Vtiger/models/Module.php
index 5ee02638af76e200f5aa14299719c58d3d0d9f79..516803eab4cbbcfb7df9ddb8bfda35cd19a8c65b 100644
--- a/modules/Vtiger/models/Module.php
+++ b/modules/Vtiger/models/Module.php
@@ -889,8 +889,10 @@ class Vtiger_Module_Model extends Vtiger_Module {
 	 * @param <String> $where
 	 * @return <String> export query
 	 */
-	public function getExportQuery($where,$query=false) {
-		$focus = CRMEntity::getInstance($this->getName());
+	public function getExportQuery($focus, $where) {
+		if(!$focus) {
+			$focus = CRMEntity::getInstance($this->getName());
+        }
 		$query = $focus->create_export_query($where);
 		return $query;
 	}
diff --git a/modules/Vtiger/uitypes/Boolean.php b/modules/Vtiger/uitypes/Boolean.php
index bcd6e5d9b25c1f3c7be7170131701f6f9caabcb0..e2f29f8f07fcab5ba9b305f04005f0e667e83186 100644
--- a/modules/Vtiger/uitypes/Boolean.php
+++ b/modules/Vtiger/uitypes/Boolean.php
@@ -23,7 +23,7 @@ class Vtiger_Boolean_UIType extends Vtiger_Base_UIType {
 	 * @param <Object> $value
 	 * @return <Object>
 	 */
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		if($value == 1 || $value == '1' || strtolower($value) == 'on') {
 			return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName());
 		}
diff --git a/modules/Vtiger/uitypes/Currency.php b/modules/Vtiger/uitypes/Currency.php
index acf655b9e04f3e136966685ddf973dcca60196b5..c39b03abed186d592dc5a33f5972d22bdfd27d81 100644
--- a/modules/Vtiger/uitypes/Currency.php
+++ b/modules/Vtiger/uitypes/Currency.php
@@ -23,7 +23,7 @@ class Vtiger_Currency_UIType extends Vtiger_Base_UIType {
 	 * @param <Object> $value
 	 * @return <Object>
 	 */
-	public function getDisplayValue($value, $skipConversion = false) {
+	public function getDisplayValue($value, $skipConversion = false, $recordInstance=false) {
 		$uiType = $this->get('field')->get('uitype');
 		if ($value) {
 			if ($uiType == 72) {
diff --git a/modules/Vtiger/uitypes/Datetime.php b/modules/Vtiger/uitypes/Datetime.php
index 1c1d8dd240349cfba28ccedd8a40006fd1482191..51a233043c846a1f1252ed3f0293d0420cb5e385 100644
--- a/modules/Vtiger/uitypes/Datetime.php
+++ b/modules/Vtiger/uitypes/Datetime.php
@@ -23,7 +23,7 @@ class Vtiger_Datetime_UIType extends Vtiger_Date_UIType {
 	 * @param <Object> $value
 	 * @return <Object>
 	 */
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		$dateValue = '--';
 
 		if ($value != '') {
diff --git a/modules/Vtiger/uitypes/Email.php b/modules/Vtiger/uitypes/Email.php
index 3cf39170bf63e2e5347213a48f078dd1c83e5467..7dbab62b85f2b6a8d3b2e672ba4b6ab21c24904a 100644
--- a/modules/Vtiger/uitypes/Email.php
+++ b/modules/Vtiger/uitypes/Email.php
@@ -18,7 +18,7 @@ class Vtiger_Email_UIType extends Vtiger_Base_UIType {
 		return 'uitypes/Email.tpl';
 	}
 
-	public function getDisplayValue($value, $recordId) {
+	public function getDisplayValue($value, $recordId, $recordInstance=false) {
 		$currentUser = Users_Record_Model::getCurrentUserModel();
 		$internalMailer = $currentUser->get('internal_mailer');
 		if($value){
diff --git a/modules/Vtiger/uitypes/Owner.php b/modules/Vtiger/uitypes/Owner.php
index f62578842a886146430de2858c9bb247125ac289..9c9661a6d4241682783581f8e98d48e89c553924 100644
--- a/modules/Vtiger/uitypes/Owner.php
+++ b/modules/Vtiger/uitypes/Owner.php
@@ -23,7 +23,7 @@ class Vtiger_Owner_UIType extends Vtiger_Base_UIType {
 	 * @param <Object> $value
 	 * @return <Object>
 	 */
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		if (self::getOwnerType($value) === 'User') {
 			$userModel = Users_Record_Model::getCleanInstance('Users');
 			$userModel->set('id', $value);
diff --git a/modules/Vtiger/uitypes/Picklist.php b/modules/Vtiger/uitypes/Picklist.php
index 14eaa9847c160106c89c0421c3b9fc0ee6a52662..8bf9e05682715e3d7b4989b41b725a31817cc9e4 100644
--- a/modules/Vtiger/uitypes/Picklist.php
+++ b/modules/Vtiger/uitypes/Picklist.php
@@ -23,7 +23,7 @@ class Vtiger_Picklist_UIType extends Vtiger_Base_UIType {
 	 * @param <Object> $value
 	 * @return <Object>
 	 */
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		return Vtiger_Language_Handler::getTranslatedString($value, $this->get('field')->getModuleName());
 	}
     
diff --git a/modules/Vtiger/uitypes/Reference.php b/modules/Vtiger/uitypes/Reference.php
index af07437e76ba9c11b0dc2af040e0093d20b8550d..530e1aab5b6a16f1e787271255dbd7664d7d4afb 100644
--- a/modules/Vtiger/uitypes/Reference.php
+++ b/modules/Vtiger/uitypes/Reference.php
@@ -40,7 +40,7 @@ class Vtiger_Reference_UIType extends Vtiger_Base_UIType {
 	 * @param <Integer> crmid of record
 	 * @return <String>
 	 */
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		$referenceModule = $this->getReferenceModule($value);
 		if($referenceModule && !empty($value)) {
 			$referenceModuleName = $referenceModule->get('name');
diff --git a/modules/Vtiger/uitypes/Text.php b/modules/Vtiger/uitypes/Text.php
index abca8ea22e261482b2dcd361a9a0edcca9b3095e..074f19d29550e961d1ea61f30beb9c5934a6191f 100644
--- a/modules/Vtiger/uitypes/Text.php
+++ b/modules/Vtiger/uitypes/Text.php
@@ -15,7 +15,7 @@ class Vtiger_Text_UIType extends Vtiger_Base_UIType {
 	 * @param <Object> $value
 	 * @return <Object>
 	 */
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		return nl2br($value);
 	}
     
diff --git a/modules/Vtiger/uitypes/Time.php b/modules/Vtiger/uitypes/Time.php
index 801e65f9c1f1840e3d5350f0d8f22153d27302cc..1f59d8156e8684f4984cbb93eaa31ef9507a4ae9 100644
--- a/modules/Vtiger/uitypes/Time.php
+++ b/modules/Vtiger/uitypes/Time.php
@@ -23,7 +23,7 @@ class Vtiger_Time_UIType extends Vtiger_Base_UIType {
 	 * @param <String> time
 	 * @return <String> time
 	 */
-	public static function getDisplayTimeValue($time) {
+	public static function getDisplayTimeValue($time, $record=false, $recordInstance=false) {
 		$date = new DateTimeField($time);
 		return $date->getDisplayTime();
 	}
diff --git a/modules/Vtiger/uitypes/Url.php b/modules/Vtiger/uitypes/Url.php
index 8d0beebd0849d9a9c1aa608929c04054c343985a..5d30391abfcdb89beb5f55298e1f7fff236d0d3b 100644
--- a/modules/Vtiger/uitypes/Url.php
+++ b/modules/Vtiger/uitypes/Url.php
@@ -18,7 +18,7 @@ class Vtiger_Url_UIType extends Vtiger_Base_UIType {
 		return 'uitypes/Url.tpl';
 	}
 
-	public function getDisplayValue($value) {
+	public function getDisplayValue($value, $record=false, $recordInstance=false) {
 		$matchPattern = "^[\w]+:\/\/^";
 		preg_match($matchPattern, $value, $matches);
 		if(!empty ($matches[0])) {
diff --git a/modules/Vtiger/views/IndexAjax.php b/modules/Vtiger/views/IndexAjax.php
index f85075f52c966c42811291af8201001b54150aa1..cd8472df5a1eba4e15a9d00a28a2c5e08c0a8029 100644
--- a/modules/Vtiger/views/IndexAjax.php
+++ b/modules/Vtiger/views/IndexAjax.php
@@ -15,7 +15,7 @@ class Vtiger_IndexAjax_View extends Vtiger_Index_View {
 		$this->exposeMethod('showActiveRecords');
 	}
 
-	function preProcess(Vtiger_Request $request) {
+	function preProcess(Vtiger_Request $request, $display=true) {
 		return true;
 	}
 
diff --git a/modules/com_vtiger_workflow/VTWorkflowManager.inc b/modules/com_vtiger_workflow/VTWorkflowManager.inc
index eed58701890b278f6bfb9cceb26296ba02e05f36..4d90b272a1128fcd46349beb900cdaa409005be2 100644
--- a/modules/com_vtiger_workflow/VTWorkflowManager.inc
+++ b/modules/com_vtiger_workflow/VTWorkflowManager.inc
@@ -122,7 +122,7 @@ class VTWorkflowManager{
 		} else {
 		//my changes
 		$result=$adb->getColumnNames("com_vtiger_workflows");
-		if(in_array(defaultworkflow,$result)){
+		if(in_array('defaultworkflow',$result)){
 			$result = $adb->pquery("select workflow_id, module_name, summary, test, execution_condition, defaultworkflow, type, filtersavedinnew
 								from com_vtiger_workflows where module_name=? and status=?",array($moduleName,1));
 		}
diff --git a/packages/vtiger/mandatory/Import.zip b/packages/vtiger/mandatory/Import.zip
index f54c3f4150a1bd912cdd9b1f66d5cd98b04a9957..def316ef2f965c59a84fd6f1bc4e731aa94fc94e 100644
Binary files a/packages/vtiger/mandatory/Import.zip and b/packages/vtiger/mandatory/Import.zip differ
diff --git a/packages/vtiger/mandatory/MailManager.zip b/packages/vtiger/mandatory/MailManager.zip
index d271460f3bc9d6c3de6c75c47555087fe7a50a1a..5a3056c49dc5fd1da2013f81087f88212cfe32e4 100644
Binary files a/packages/vtiger/mandatory/MailManager.zip and b/packages/vtiger/mandatory/MailManager.zip differ
diff --git a/packages/vtiger/mandatory/Mobile.zip b/packages/vtiger/mandatory/Mobile.zip
index 2311c6cefffd2381ae83184ef8801685d1c0e5f1..00db3aa0274f921540fe215d2bf457ff1790e993 100644
Binary files a/packages/vtiger/mandatory/Mobile.zip and b/packages/vtiger/mandatory/Mobile.zip differ
diff --git a/packages/vtiger/mandatory/ModTracker.zip b/packages/vtiger/mandatory/ModTracker.zip
index 9ec120c1651b7f95837a721163480706894cf608..205f9bd3d3ad5dc03a15d25534745836eae6fb5a 100644
Binary files a/packages/vtiger/mandatory/ModTracker.zip and b/packages/vtiger/mandatory/ModTracker.zip differ
diff --git a/packages/vtiger/mandatory/PBXManager.zip b/packages/vtiger/mandatory/PBXManager.zip
index af08bd71464808c42d33956cf88c425d018aa666..6c8f36b6e3bb0368bef971da4be8687e71fbda76 100644
Binary files a/packages/vtiger/mandatory/PBXManager.zip and b/packages/vtiger/mandatory/PBXManager.zip differ
diff --git a/packages/vtiger/mandatory/ServiceContracts.zip b/packages/vtiger/mandatory/ServiceContracts.zip
index 5053520885a4041540aec076d57277a5ea6b0044..4e58e589096912254fb203c1189d73f0209f7157 100644
Binary files a/packages/vtiger/mandatory/ServiceContracts.zip and b/packages/vtiger/mandatory/ServiceContracts.zip differ
diff --git a/packages/vtiger/mandatory/Services.zip b/packages/vtiger/mandatory/Services.zip
index 88e18feae69c9e004f828a33f535bc8456ba651c..53b3e7648a85da2f53e84b14e21f3854bf847b3e 100644
Binary files a/packages/vtiger/mandatory/Services.zip and b/packages/vtiger/mandatory/Services.zip differ
diff --git a/packages/vtiger/mandatory/WSAPP.zip b/packages/vtiger/mandatory/WSAPP.zip
index 24dbdf17294b0af4d8d1ca5d945b2304a9f6d02a..c89e176dbca22356aa1a0f62b642dded31a53d7f 100644
Binary files a/packages/vtiger/mandatory/WSAPP.zip and b/packages/vtiger/mandatory/WSAPP.zip differ
diff --git a/packages/vtiger/optional/Assets.zip b/packages/vtiger/optional/Assets.zip
index 8e0ec347b21d361b1f9ba7b6629006e55636c0d4..25a4b7b3a3061a5b3bf52a87b57315d70611465b 100644
Binary files a/packages/vtiger/optional/Assets.zip and b/packages/vtiger/optional/Assets.zip differ
diff --git a/packages/vtiger/optional/CustomerPortal.zip b/packages/vtiger/optional/CustomerPortal.zip
index cd990a65970f49c51b1452305d146cf8bbbe8c17..b2dfad3ce6dc93cb97093b68489085789305fff3 100644
Binary files a/packages/vtiger/optional/CustomerPortal.zip and b/packages/vtiger/optional/CustomerPortal.zip differ
diff --git a/packages/vtiger/optional/EmailTemplates.zip b/packages/vtiger/optional/EmailTemplates.zip
index bdde0b312e233b066f2eecaac11174958caafc8a..7c0a7810ae144c8d7905049428834b32020c1955 100644
Binary files a/packages/vtiger/optional/EmailTemplates.zip and b/packages/vtiger/optional/EmailTemplates.zip differ
diff --git a/packages/vtiger/optional/Google.zip b/packages/vtiger/optional/Google.zip
index 1da9c19d29ca1f15dec1ec79b045ce8e5f0e0b7b..3cef72438fc92fd0bc38672eec42692726026ade 100644
Binary files a/packages/vtiger/optional/Google.zip and b/packages/vtiger/optional/Google.zip differ
diff --git a/packages/vtiger/optional/ModComments.zip b/packages/vtiger/optional/ModComments.zip
index e0410edafd6605c6eb89b54c6dd404381257238b..849bffd9d8382db1512839094ce09f5f9469b15d 100644
Binary files a/packages/vtiger/optional/ModComments.zip and b/packages/vtiger/optional/ModComments.zip differ
diff --git a/packages/vtiger/optional/Projects.zip b/packages/vtiger/optional/Projects.zip
index c38ca829d839b7eb1f23894cb3796bce1d71a04c..8448efe26b69be63ec6d97cda6a0bcea460bb8d9 100644
Binary files a/packages/vtiger/optional/Projects.zip and b/packages/vtiger/optional/Projects.zip differ
diff --git a/packages/vtiger/optional/RecycleBin.zip b/packages/vtiger/optional/RecycleBin.zip
index 8953d7d3bff4ee98cca6108dbcaac02f84960149..2231914bfc3187737c819708466a7c62ed719446 100644
Binary files a/packages/vtiger/optional/RecycleBin.zip and b/packages/vtiger/optional/RecycleBin.zip differ
diff --git a/packages/vtiger/optional/SMSNotifier.zip b/packages/vtiger/optional/SMSNotifier.zip
index b16574a0e3abe73bb1de9693b7606d6e8f1f292d..8cba09aa7f37fce4cb1439f29ebf9d673d597c9b 100644
Binary files a/packages/vtiger/optional/SMSNotifier.zip and b/packages/vtiger/optional/SMSNotifier.zip differ
diff --git a/packages/vtiger/optional/Webforms.zip b/packages/vtiger/optional/Webforms.zip
index 78e9e89a91cadb9bc4a2e948b5281c2b7ec034d0..ace4065555815c3530133a89195a271229c122cf 100644
Binary files a/packages/vtiger/optional/Webforms.zip and b/packages/vtiger/optional/Webforms.zip differ
diff --git a/pkg/vtiger/modules/Assets/modules/Assets/Assets.php b/pkg/vtiger/modules/Assets/modules/Assets/Assets.php
index ba4c6b8e26914aebdfeb6a319060be3a2607266a..817ed14412f8fd645c51cf96e83d9422550ae0ca 100644
--- a/pkg/vtiger/modules/Assets/modules/Assets/Assets.php
+++ b/pkg/vtiger/modules/Assets/modules/Assets/Assets.php
@@ -374,13 +374,13 @@ class Assets extends CRMEntity {
 			$assetLabel = 'Assets';
 
 			$accountInstance = Vtiger_Module::getInstance('Accounts');
-			$accountInstance->setRelatedlist($assetInstance,$assetLabel,array(ADD),'get_dependents_list');
+			$accountInstance->setRelatedlist($assetInstance,$assetLabel,array('ADD'),'get_dependents_list');
 
 			$productInstance = Vtiger_Module::getInstance('Products');
-			$productInstance->setRelatedlist($assetInstance,$assetLabel,array(ADD),'get_dependents_list');
+			$productInstance->setRelatedlist($assetInstance,$assetLabel,array('ADD'),'get_dependents_list');
 
 			$InvoiceInstance = Vtiger_Module::getInstance('Invoice');
-			$InvoiceInstance->setRelatedlist($assetInstance,$assetLabel,array(ADD),'get_dependents_list');
+			$InvoiceInstance->setRelatedlist($assetInstance,$assetLabel,array('ADD'),'get_dependents_list');
 
 			$result = $adb->pquery("SELECT 1 FROM vtiger_modentity_num WHERE semodule = ? AND active = 1", array($moduleName));
 			if (!($adb->num_rows($result))) {
diff --git a/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php b/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php
index 8fdc5bd75d856f5149c305fc56a010dd5edd9b02..1fec60387d0d0abf284bc87d229f8b2c80179019 100644
--- a/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php
+++ b/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php
@@ -33,12 +33,12 @@ class CustomerPortal {
 				$tabId = $adb->query_result($tabIdResult, 0, 'tabid');
 				if($tabId) {
 					++$i;
-					$adb->query("INSERT INTO vtiger_customerportal_tabs (tabid,visible,sequence) VALUES (?, ?, ?)", array($tabId,1,$i));
-					$adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (?, ?, ?)", array($tabId,'showrelatedinfo',1));
+					$adb->pquery("INSERT INTO vtiger_customerportal_tabs(tabid,visible,sequence) VALUES (?, ?, ?)", array($tabId,1,$i));
+					$adb->pquery("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (?, ?, ?)", array($tabId,'showrelatedinfo',1));
 				}
 			}
 
-			$adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (?, ?, ?)", array(0,'userid',1));
+			$adb->pquery("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (?, ?, ?)", array(0,'userid',1));
 			$adb->pquery("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (?, ?, ?)", array(0,'defaultassignee',1));
 
 			// Mark the module as Standard module
diff --git a/pkg/vtiger/modules/ModComments/modules/ModComments/models/Record.php b/pkg/vtiger/modules/ModComments/modules/ModComments/models/Record.php
index 0a02da7f8c7f47c76ef8950ba740be242a4f828e..aee0a319d4997af101f280ee5a9473cbfc9938d8 100644
--- a/pkg/vtiger/modules/ModComments/modules/ModComments/models/Record.php
+++ b/pkg/vtiger/modules/ModComments/modules/ModComments/models/Record.php
@@ -139,7 +139,7 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
 	 * @param <Integer> $record
 	 * @return ModComment_Record_Model
 	 */
-	public static function getInstanceById($record) {
+	public static function getInstanceById($record, $module=null) {
 		$db = PearDatabase::getInstance();
 		$result = $db->pquery('SELECT vtiger_modcomments.*, vtiger_crmentity.smownerid,
 					vtiger_crmentity.createdtime, vtiger_crmentity.modifiedtime FROM vtiger_modcomments
diff --git a/pkg/vtiger/modules/PBXManager/modules/PBXManager/models/Record.php b/pkg/vtiger/modules/PBXManager/modules/PBXManager/models/Record.php
index a84b38329978fb752c6920a9849c835aaeb422db..6c9a106c59c6b0d3940ae15b21603633f4fa3783 100644
--- a/pkg/vtiger/modules/PBXManager/modules/PBXManager/models/Record.php
+++ b/pkg/vtiger/modules/PBXManager/modules/PBXManager/models/Record.php
@@ -14,7 +14,7 @@ class PBXManager_Record_Model extends Vtiger_Record_Model{
     const lookuptableName = 'vtiger_pbxmanager_phonelookup';
     const entitytableName = 'vtiger_crmentity';
     
-    static function getCleanInstance(){
+    static function getCleanInstance($moduleName = ''){
         return new self;
     }
     
@@ -26,7 +26,7 @@ class PBXManager_Record_Model extends Vtiger_Record_Model{
         $db = PearDatabase::getInstance();
         $query = 'SELECT * FROM '.self::moduletableName.' AS module_table INNER JOIN '.self::entitytableName.' AS entity_table  WHERE module_table.callstatus IN(?,?) AND module_table.direction=? AND module_table.pbxmanagerid=entity_table.crmid AND entity_table.deleted=0';
         $result = $db->pquery($query,array('ringing','in-progress','inbound'));
-        $recordModels = array();
+        $recordModels = $recordIds = array();
         $rowCount =  $db->num_rows($result);
         for($i=0; $i<$rowCount; $i++) {
             $rowData = $db->query_result_rowdata($result, $i);
@@ -114,7 +114,7 @@ class PBXManager_Record_Model extends Vtiger_Record_Model{
         return true;
     }
     
-    public static function getInstanceById($phonecallsid){
+    public static function getInstanceById($phonecallsid, $module=null){
         $db = PearDatabase::getInstance();
         $record = new self();
         $query = 'SELECT * FROM '.self::moduletableName.' WHERE pbxmanagerid=?';