diff --git a/include/utils/utils.php b/include/utils/utils.php
index 8f567566d834c4b281a0484dad6b294b8e5cb328..2212e80eb8f9cb6819f42e2728a669e6c493a373 100755
--- a/include/utils/utils.php
+++ b/include/utils/utils.php
@@ -1804,7 +1804,12 @@ function getValidDBInsertDateValue($value) {
 			break;
 		}
 	}
-	list($y,$m,$d) = explode('-',$value);
+	global $current_user;
+	$formate=$current_user->date_format;
+	list($d,$m,$y) = explode('-',$value);
+	if(strlen($d) == 4 || $formate == 'mm-dd-yyyy'){
+		list($y,$m,$d)=explode('-',$value);
+	}
 	if(strlen($y) == 1) $y = '0'.$y;
 	if(strlen($m) == 1) $m = '0'.$m;
 	if(strlen($d) == 1) $d = '0'.$d;
diff --git a/modules/CustomView/actions/Delete.php b/modules/CustomView/actions/Delete.php
index 963cf6baf8f36af2811968d8fd358878039ba879..f6dc2c99e7a78efac67369559737ad98c5417840 100644
--- a/modules/CustomView/actions/Delete.php
+++ b/modules/CustomView/actions/Delete.php
@@ -25,7 +25,7 @@ class CustomView_Delete_Action extends Vtiger_Action_Controller {
 		$moduleModel = $customViewModel->getModule();
 		$customViewOwner = $customViewModel->getOwnerId();
 		$currentUser = Users_Record_Model::getCurrentUserModel();
-		if ((!$currentUser->isAdminUser()) || ($customViewOwner != $currentUser->getId())) {
+		if ((!$currentUser->isAdminUser()) && ($customViewOwner != $currentUser->getId())) {
 			throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
 		}
 		$customViewModel->delete();