diff --git a/layouts/vlayout/modules/Calendar/resources/Edit.js b/layouts/vlayout/modules/Calendar/resources/Edit.js
index e52b21a48d53d5b60bdc9bf33906242508b1f8e9..8f6d26d30cdf92865cf67a7774571dc3496f7c1d 100644
--- a/layouts/vlayout/modules/Calendar/resources/Edit.js
+++ b/layouts/vlayout/modules/Calendar/resources/Edit.js
@@ -209,9 +209,6 @@ Vtiger_Edit_Js("Calendar_Edit_Js",{
 			var dateStartElement = container.find('[name="date_start"]');
             var endDateElement = container.find('[name="due_date"]');
 			
-            if(endDateElement.data('userChangedTime') == true) {
-                return;
-            }
             if(jQuery('[name="userChangedEndDateTime"]').val() == '1') {
                 return;
             }
@@ -452,4 +449,4 @@ Vtiger_Edit_Js("Calendar_Edit_Js",{
         this.registerRelatedContactSpecificEvents();
 		this._super();
 	}
-});
\ No newline at end of file
+});
diff --git a/layouts/vlayout/modules/Vtiger/ListViewContents.tpl b/layouts/vlayout/modules/Vtiger/ListViewContents.tpl
index f047135d14588256ef50eeefc6c3ee118b1742bf..3a3e316d6f134ddb8341838585a030d8b0b6698d 100644
--- a/layouts/vlayout/modules/Vtiger/ListViewContents.tpl
+++ b/layouts/vlayout/modules/Vtiger/ListViewContents.tpl
@@ -137,7 +137,7 @@
 			<tr>
 				<td>
 					{assign var=SINGLE_MODULE value="SINGLE_$MODULE"}
-					{vtranslate('LBL_EQ_ZERO')} {vtranslate($MODULE, $MODULE)} {vtranslate('LBL_FOUND')}.{if $IS_MODULE_EDITABLE} {vtranslate('LBL_CREATE')} <a href="{$MODULE_MODEL->getCreateRecordUrl()}">{vtranslate($SINGLE_MODULE, $MODULE)}</a>{/if}
+					{vtranslate('LBL_EQ_ZERO')} {vtranslate($SINGLE_MODULE, $MODULE)} {vtranslate('LBL_FOUND')}.{if $IS_MODULE_EDITABLE} {vtranslate('LBL_CREATE')} <a href="{$MODULE_MODEL->getCreateRecordUrl()}">{vtranslate($SINGLE_MODULE, $MODULE)}</a>{/if}
 				</td>
 			</tr>
 		</tbody>
diff --git a/layouts/vlayout/modules/Vtiger/resources/Detail.js b/layouts/vlayout/modules/Vtiger/resources/Detail.js
index 791408bcc27ebaaaba01bfb8c77c92bfe73d6771..1239e86102064e2647fd2ad08d08cb46939ddb60 100644
--- a/layouts/vlayout/modules/Vtiger/resources/Detail.js
+++ b/layouts/vlayout/modules/Vtiger/resources/Detail.js
@@ -967,10 +967,9 @@ jQuery.Class("Vtiger_Detail_Js",{
 
 
 
-
                 fieldElement.validationEngine('hide');
                 //Before saving ajax edit values we need to check if the value is changed then only we have to save
-                if(previousValue == ajaxEditNewValue) {
+                if((""+previousValue) == (""+ajaxEditNewValue)) { // Normalize(99!="099") Fix http://code.vtiger.com/vtiger/vtigercrm/issues/16 
                     editElement.addClass('hide');
                     detailViewValue.removeClass('hide');
 					actionElement.show();
@@ -2046,4 +2045,4 @@ jQuery.Class("Vtiger_Detail_Js",{
 		app.registerEventForTextAreaFields(jQuery('.commentcontent'));
 		this.registerEventForTotalRecordsCount();
 	}
-});
\ No newline at end of file
+});
diff --git a/modules/Calendar/Activity.php b/modules/Calendar/Activity.php
index 2926ecb68e0753adb68fd6d090f4f58af78a629a..65a143555973dd85099bab2aa6c8b812f700e16b 100644
--- a/modules/Calendar/Activity.php
+++ b/modules/Calendar/Activity.php
@@ -204,19 +204,26 @@ class Activity extends CRMEntity {
 				$reminderid = $adb->query_result($reminderidres, 0, "reminderid");
 			}
 
-			if(isset($reminderid)) {
-                $current_date = new DateTime();
-                $record_date = new DateTime($cbdate.' '.$cbtime);
-
-                $current = $current_date->format('Y-m-d H:i:s');
-                $record = $record_date->format('Y-m-d H:i:s');
-                if(strtotime($record) > strtotime($current)){
-                    $callback_query = "UPDATE vtiger_activity_reminder_popup set status = 0, date_start = ?, time_start = ? WHERE reminderid = ?";
-                    $callback_params = array($cbdate, $cbtime, $reminderid);
-                }
+            $current_date = new DateTime();
+            $record_date = new DateTime($cbdate.' '.$cbtime);
+
+            $current = $current_date->format('Y-m-d H:i:s');
+			$record = $record_date->format('Y-m-d H:i:s');
+
+			$reminder = false;
+			if(strtotime($record) > strtotime($current)){
+				$status = 0;
+				$reminder = true;
 			} else {
-				$callback_query = "INSERT INTO vtiger_activity_reminder_popup (recordid, semodule, date_start, time_start) VALUES (?,?,?,?)";
-				$callback_params = array($cbrecord, $cbmodule, $cbdate, $cbtime);
+				$status = 1;
+			}
+
+            if(isset($reminderid)){
+                $callback_query = "UPDATE vtiger_activity_reminder_popup set status = 0, date_start = ?, time_start = ? WHERE reminderid = ?";
+                $callback_params = array($cbdate, $cbtime, $reminderid);
+			} else if ($reminder) {
+				$callback_query = "INSERT INTO vtiger_activity_reminder_popup (recordid, semodule, date_start, time_start, status) VALUES (?,?,?,?,?)";
+				$callback_params = array($cbrecord, $cbmodule, $cbdate, $cbtime, $status);
 			}
 
             if($callback_query)
diff --git a/modules/Contacts/ContactsHandler.php b/modules/Contacts/ContactsHandler.php
index 972f44a2ab9ca8797050239b6a768d5147dee132..54c876936084277c33ac60d05cd6879f4593fe70 100644
--- a/modules/Contacts/ContactsHandler.php
+++ b/modules/Contacts/ContactsHandler.php
@@ -42,13 +42,13 @@ function Contacts_sendCustomerPortalLoginDetails($entityData){
 		$password = makeRandomPassword();
 		$md5_password = md5($password);
 		if ($insert == true) {
-			$sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
-			$params = array($entityId, $email, $md5_password, 'C', 1);
+			$sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,cryptmode,type,isactive) VALUES(?,?,?,?,?)";
+			$params = array($entityId, $email, $md5_password, 'MD5', 'C', 1);
 			$adb->pquery($sql, $params);
 		}
 		if ($update == true && $portalChanged == true) {
-			$sql = "UPDATE vtiger_portalinfo SET user_password=? WHERE id=?";
-			$params = array($md5_password, $entityId);
+			$sql = "UPDATE vtiger_portalinfo SET user_password=?, cryptmode=? WHERE id=?";
+			$params = array($md5_password, 'MD5', $entityId);
 			$adb->pquery($sql, $params);
 		}
 		if (($insert == true || ($update = true && $portalChanged == true)) && $entityData->get('emailoptout') == 0) {
diff --git a/modules/CustomView/models/Record.php b/modules/CustomView/models/Record.php
index 079dbc4cfc500477388ad05a7973b64d90f3bcca..a5ffd8442491f6b8b14e8001b99636de897dc933 100644
--- a/modules/CustomView/models/Record.php
+++ b/modules/CustomView/models/Record.php
@@ -188,8 +188,13 @@ class CustomView_Record_Model extends Vtiger_Base_Model {
         if(empty($searchParams)) {
             $searchParams = array();
         }
-        $transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParams, $moduleModel);
-        $queryGenerator->parseAdvFilterList($transformedSearchParams);
+		$transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParams, $moduleModel);
+
+		$glue = "";
+		if(count($queryGenerator->getWhereFields()) > 0 && (count($transformedSearchParams)) > 0) {
+			$glue = QueryGenerator::$AND;
+		}
+        $queryGenerator->parseAdvFilterList($transformedSearchParams, $glue);
 
 		$listQuery = $queryGenerator->getQuery();
 		if($module == 'RecycleBin'){
@@ -1073,4 +1078,4 @@ class CustomView_Record_Model extends Vtiger_Base_Model {
 		}
 		return self::getInstanceById($viewId);
 	}
-}
\ No newline at end of file
+}
diff --git a/modules/Migration/schema/640_to_650.php b/modules/Migration/schema/640_to_650.php
index 432024594bba15a8e3d49c76429e8241d3a68934..99628c7cf43a8eb02a66115b9ba8f4d9dfe24b68 100644
--- a/modules/Migration/schema/640_to_650.php
+++ b/modules/Migration/schema/640_to_650.php
@@ -11,14 +11,16 @@
 if(defined('VTIGER_UPGRADE')) {
 
 //Start add new currency - 'CFP Franc or Pacific Franc' 
-global $db;
+global $adb;
+
+Vtiger_Utils::AddColumn('vtiger_portalinfo', 'cryptmode', 'varchar(20)');
 
 //Updating existing users password to thier md5 hash
+$updateQuery = "UPDATE vtiger_portalinfo SET user_password=MD5(user_password),cryptmode='MD5' WHERE cryptmode is null";
+$adb->pquery($updateQuery, array());
+
+//Change column type of inventory line-item comment.
+$adb->pquery("ALTER TABLE vtiger_inventoryproductrel MODIFY COLUMN comment TEXT", array());
 
-$selectQuery = 'SELECT 1 FROM vtiger_portalinfo';
-$resultSet = $db->pquery($selectQuery, array());
-if ($db->num_rows($resultSet) > 0) {
-    $updateQuery = 'UPDATE vtiger_portalinfo SET user_password=MD5(user_password)';
-    $db->pquery($updateQuery, array());
 }
-}
\ No newline at end of file
+
diff --git a/modules/Reports/models/Chart.php b/modules/Reports/models/Chart.php
index d31a32c35c276183cda3c9c7cc1b7ce17b1b3808..195469f18ca66690fb41524ec157cd35ab6afd93 100644
--- a/modules/Reports/models/Chart.php
+++ b/modules/Reports/models/Chart.php
@@ -218,6 +218,14 @@ abstract class Base_Chart extends Vtiger_Base_Model{
 
 		$columnSQL = $reportRunObject->getColumnSQL($selectedfields);
 
+		// Fix for http://code.vtiger.com/vtiger/vtigercrm/issues/4
+		switch ($selectedfields[count($selectedfields)-1]) {
+			case 'MY':
+				$columnSQL = str_replace('%M', '%m', $columnSQL); // %M (yields Jan), %m - 01
+				break;
+		}
+		// End
+
 		$reportRunObject->append_currency_symbol_to_value = $append_currency_symbol_to_value;
 		return $columnSQL;
 	}
@@ -601,4 +609,4 @@ class HorizontalbarChart extends VerticalbarChart {
 
 class LineChart extends VerticalbarChart{
 
-}
\ No newline at end of file
+}
diff --git a/modules/Vtiger/actions/ExportData.php b/modules/Vtiger/actions/ExportData.php
index d43d99546e9d12c702e5eb45c09b0dc76fb21fe6..fedbe65d9bf1675763842b0d3597d5f06adae05d 100644
--- a/modules/Vtiger/actions/ExportData.php
+++ b/modules/Vtiger/actions/ExportData.php
@@ -170,21 +170,14 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action {
 		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
 		header("Cache-Control: post-check=0, pre-check=0", false );
 
-		$header = implode("\", \"", $headers);
-		$header = "\"" .$header;
-		$header .= "\"\r\n";
-		echo $header;
+		$fp = fopen("php://output", "w");
+		fputcsv($fp, $headers);
 
 		foreach($entries as $row) {
-			// Escape double quotes in the value.
-			foreach ($row as $key => $value) {
-				$row[$key] = str_replace('"', '""', $value);
-			}
-			$line = implode("\",\"",$row);
-			$line = "\"" .$line;
-			$line .= "\"\r\n";
-			echo $line;
+			fputcsv($fp, $row);
 		}
+		
+		fclose($fp);
 	}
 
 	private $picklistValues;
diff --git a/modules/Vtiger/uitypes/Date.php b/modules/Vtiger/uitypes/Date.php
index 0d7280ad78534cffa409142be13a22d4b078370e..f8c9cc5442fec6878580e0aeecafd1de05086e24 100644
--- a/modules/Vtiger/uitypes/Date.php
+++ b/modules/Vtiger/uitypes/Date.php
@@ -101,6 +101,13 @@ class Vtiger_Date_UIType extends Vtiger_Base_UIType {
 	 * @return <String>
 	 */
 	public static function getDisplayDateValue($date) {
+		// Fix for http://code.vtiger.com/vtiger/vtigercrm/issues/4
+		// Handle (MonthNumber Year) format value conversion.
+		if (preg_match("/([0-9]{1,2}) ([0-9]{1,4})/", $date, $m)) {
+        	return date("M Y", strtotime($m[2].'-'.$m[1].'-'.'1'));
+    	}
+		// End
+
 		$date = new DateTimeField($date);
 		return $date->getDisplayDate();
 	}
@@ -111,6 +118,13 @@ class Vtiger_Date_UIType extends Vtiger_Base_UIType {
 	 * @return <String>
 	 */
 	public static function getDisplayDateTimeValue($dateTime) {
+		// Fix for http://code.vtiger.com/vtiger/vtigercrm/issues/4
+		// Handle (MonthNumber Year) format value conversion.
+		if (preg_match("/([0-9]{1,2}) ([0-9]{1,4})/", $date, $m)) {
+			return date("M Y", strtotime($m[2].'-'.$m[1].'-'.'1'));
+		}
+		// End
+
 		$date = new DateTimeField($dateTime);
 		return $date->getDisplayDateTimeValue();
 	}
@@ -119,4 +133,4 @@ class Vtiger_Date_UIType extends Vtiger_Base_UIType {
         return 'uitypes/DateFieldSearchView.tpl';
     }
 
-}
\ No newline at end of file
+}
diff --git a/modules/Vtiger/views/Header.php b/modules/Vtiger/views/Header.php
index 1051ed4debb4bb52bfc0d952b6fecd877c7df537..7cffac2a341adc838c3865f15f2ee08c64773cb7 100644
--- a/modules/Vtiger/views/Header.php
+++ b/modules/Vtiger/views/Header.php
@@ -144,10 +144,15 @@ abstract class Vtiger_Header_View extends Vtiger_View_Controller {
 			}
 			$headerLinkInstances[$index++] = $headerLinkInstance;
 		}
+
+		// Fix for http://code.vtiger.com/vtiger/vtigercrm/issues/49
+		// Push HEADERLINKS to drop-down menu shown with username (last-one) as structured above.
+		$lastindex = count($headerLinkInstances)-1;
 		$headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERLINK'));
+		if ($headerLinks) $headerLinkInstances[$lastindex]->addChildLink(Vtiger_Link_Model::getInstanceFromValues(array())); // Separator
 		foreach($headerLinks as $headerType => $headerLinks) {
 			foreach($headerLinks as $headerLink) {
-				$headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
+				$headerLinkInstances[$lastindex]->addChildLink(Vtiger_Link_Model::getInstanceFromLinkObject($headerLink));
 			}
 		}
 		return $headerLinkInstances;
diff --git a/schema/DatabaseSchema.xml b/schema/DatabaseSchema.xml
index 412532e560ae73b6d23c64335c2fa4291a1234d7..08c0f29bf5eb3e42344758725257a9d5b0c9ff45 100644
--- a/schema/DatabaseSchema.xml
+++ b/schema/DatabaseSchema.xml
@@ -587,6 +587,7 @@
 		<field name="user_name" type="C" size="50" />
 		<field name="user_password" type="C" size="30" />
 		<field name="type" type="C" size="5" />
+		<field name="cryptmode" type="C" size="20" />
 		<field name="last_login_time" type="T" />
 		<field name="login_time" type="T" />
 		<field name="logout_time" type="T" />
@@ -5401,7 +5402,7 @@
 		<field name="listprice" type="N" size="25.3" />
 		<field name="discount_percent" type="N" size="7.3" />
 		<field name="discount_amount" type="N" size="25.3" />
-		<field name="comment" type="C" size="250" />
+		<field name="comment" type="X" />
 		<field name="description" type="X" />
 		<field name="incrementondel" type="I" size="11">
 			<notnull />