diff --git a/kcfinder/lib/class_gd.php b/kcfinder/lib/class_gd.php index adfc89784d4af89c457c5986b6f2d51edbe35233..0ac2aaea996434370ce1822fba0a33df657830b5 100644 --- a/kcfinder/lib/class_gd.php +++ b/kcfinder/lib/class_gd.php @@ -52,8 +52,13 @@ class gd { $height = @imagesy($image); } elseif (is_array($image)) { - list($key, $width) = each($image); - list($key, $height) = each($image); + $key = key($image); + $width = current($image); + next($image); + + $key = key($image); + $height = current($image); + next($image); $image = imagecreatetruecolor($width, $height); } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) { @@ -71,8 +76,8 @@ class gd { } $return = ( - is_resource($image) && - (get_resource_type($image) == "gd") && + ((is_resource($image) && get_resource_type($image) === 'gd') || + (is_object($image) && $image instanceof \GDImage)) && isset($width) && isset($height) && (preg_match('/^[1-9][0-9]*$/', $width) !== false) && diff --git a/layouts/v7/modules/Settings/Groups/resources/Edit.js b/layouts/v7/modules/Settings/Groups/resources/Edit.js index 1b0a169cd5d0467f71ec27bebfbfa23efc8345ba..ea8291c483b525e3dc3f55877bc7e42a34c6578c 100644 --- a/layouts/v7/modules/Settings/Groups/resources/Edit.js +++ b/layouts/v7/modules/Settings/Groups/resources/Edit.js @@ -60,7 +60,7 @@ Settings_Vtiger_Edit_Js("Settings_Groups_Edit_Js",{},{ form.submit(); }, function(data, err){ - app.helper.showErrorNotification({message:app.vtranslate('JS_DUPLICATES_EXIST')}); + app.helper.showErrorNotification({message:data.message}); jQuery('.saveButton').removeAttr('disabled'); return false; } diff --git a/modules/Calendar/actions/Save.php b/modules/Calendar/actions/Save.php index 0074aa18d452bb62a57b289d6f23fe8f36befd5c..f6b4cf19ff32dec68e476eeb92b2ff4f1b808d2c 100644 --- a/modules/Calendar/actions/Save.php +++ b/modules/Calendar/actions/Save.php @@ -159,6 +159,7 @@ class Calendar_Save_Action extends Vtiger_Save_Action { if(!is_array($fieldValue)) { $fieldValue = trim($fieldValue); } + $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue, $fieldModel); $recordModel->set($fieldName, $fieldValue); } } diff --git a/modules/Calendar/views/TaskManagement.php b/modules/Calendar/views/TaskManagement.php index 678bdcd13a563d69b7f9dca8584f234f618abe78..21b3e15411ce44f0889f9e00ff018e1ace986d64 100644 --- a/modules/Calendar/views/TaskManagement.php +++ b/modules/Calendar/views/TaskManagement.php @@ -99,7 +99,7 @@ class Calendar_TaskManagement_View extends Vtiger_Index_View { if (!$request->get('colors')) { $colors = array(); foreach ($priorities as $key => $value) { - $colors[$key] = $this->getColor($key); + $colors[$key] = $this->getColors($key,$field->getName()); } } else { $colors = $request->get('colors'); @@ -107,14 +107,19 @@ class Calendar_TaskManagement_View extends Vtiger_Index_View { return $colors; } - public function getColor($priority) { - $color = ''; - switch ($priority) { - case 'High' : $color = '#FF5555'; break; - case 'Medium' : $color = '#03C04A'; break; - case 'Low' : $color = '#54A7F5'; break; - default : $color = '#'.dechex(rand(0x000000, 0xFFFFFF)); - break; + public function getColors($priorities,$fieldname){ + $db=PearDatabase::getInstance(); + if(isset($priorities)){ + $tableName = "vtiger_$fieldname"; + $result=$db->pquery("SELECT color FROM $tableName WHERE $fieldname=?",array($priorities)); + $no_of_row=$db->num_rows($result); + for($i=0;$i<$no_of_row;$i++){ + $color = $db->query_result($result,$i,'color'); + } + } + if(($color=='#ffffff') || ($color=' ')) + { + $color = '#'.dechex(rand(0x000000, 0xFFFFFF)); } return $color; } diff --git a/modules/SalesOrder/actions/SaveAjax.php b/modules/SalesOrder/actions/SaveAjax.php index 92d2df700f9145cd73c988e4848b6d264451ca92..3a04b4049fcbf16a3c6e4839b35dad479ed97c86 100755 --- a/modules/SalesOrder/actions/SaveAjax.php +++ b/modules/SalesOrder/actions/SaveAjax.php @@ -66,6 +66,7 @@ class SalesOrder_SaveAjax_Action extends Inventory_SaveAjax_Action { if (!is_array($fieldValue)) { $fieldValue = trim($fieldValue); } + $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue, $fieldModel); $recordModel->set($fieldName, $fieldValue); } $recordModel->set($fieldName, $fieldValue); @@ -84,9 +85,6 @@ class SalesOrder_SaveAjax_Action extends Inventory_SaveAjax_Action { $fieldValue = $fieldModel->getDefaultFieldValue(); } $fieldDataType = $fieldModel->getFieldDataType(); - if($fieldValue){ - $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue,$fieldModel); - } if ($fieldDataType == 'time' && $fieldValue !== null) { $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue); } @@ -94,6 +92,7 @@ class SalesOrder_SaveAjax_Action extends Inventory_SaveAjax_Action { if (!is_array($fieldValue)) { $fieldValue = trim($fieldValue); } + $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue, $fieldModel); $recordModel->set($fieldName, $fieldValue); } } diff --git a/modules/Settings/LayoutEditor/actions/Field.php b/modules/Settings/LayoutEditor/actions/Field.php index 2e22908e349ed514ed477565c1036104ae8adb57..33569309f79a8af9fa49961653a5234737b719af 100644 --- a/modules/Settings/LayoutEditor/actions/Field.php +++ b/modules/Settings/LayoutEditor/actions/Field.php @@ -100,10 +100,6 @@ class Settings_LayoutEditor_Field_Action extends Settings_Vtiger_Index_Action { $defaultValue = $fieldInstance->get('defaultvalue'); if(!is_null($request->get('fieldDefaultValue', null))) { $defaultValue = decode_html($request->get('fieldDefaultValue')); - if(preg_match('/AM|PM/',$defaultValue) && ($fieldInstance->get('uitype') =='14')) - { - $defaultValue=Vtiger_Time_UIType::getTimeValueWithSeconds($defaultValue); - } $fieldInstance->set('defaultvalue', $defaultValue); } $response = new Vtiger_Response(); diff --git a/modules/Settings/Vtiger/models/ConfigModule.php b/modules/Settings/Vtiger/models/ConfigModule.php index f316486258d21038c1f8694c1bed63a2fc3d2f1d..09c10b560c2558d7c6df1d3e1175964df057420b 100644 --- a/modules/Settings/Vtiger/models/ConfigModule.php +++ b/modules/Settings/Vtiger/models/ConfigModule.php @@ -153,9 +153,7 @@ class Settings_Vtiger_ConfigModule_Model extends Settings_Vtiger_Module_Model { return "LBL_INVALID_EMAILID"; } else if(array_key_exists('HELPDESK_SUPPORT_NAME',$updatedFields) && preg_match ('/[\'";?><]/', $updatedFields['HELPDESK_SUPPORT_NAME'])) { return "LBL_INVALID_SUPPORT_NAME"; - } else if((array_key_exists('upload_maxsize',$updatedFields) && !filter_var(ltrim($updatedFields['upload_maxsize'],'0'), FILTER_VALIDATE_INT)) - || (array_key_exists('list_max_entries_per_page',$updatedFields) && !filter_var(ltrim($updatedFields['list_max_entries_per_page'], '0'), FILTER_VALIDATE_INT)) - || (array_key_exists('listview_max_textlength',$updatedFields) && !filter_var(ltrim($updatedFields['listview_max_textlength'], '0'), FILTER_VALIDATE_INT))) { + } else if((array_key_exists('upload_maxsize',$updatedFields) && !filter_var(ltrim($updatedFields['upload_maxsize'],'0'), FILTER_VALIDATE_INT)) || (array_key_exists('list_max_entries_per_page',$updatedFields) && filter_var(ltrim($updatedFields['list_max_entries_per_page'], '0'), FILTER_VALIDATE_INT, array("options" => array("min_range"=>1, "max_range"=>100))) === false) || (array_key_exists('listview_max_textlength',$updatedFields) && filter_var(ltrim($updatedFields['listview_max_textlength'], '0'), FILTER_VALIDATE_INT , array("options" => array("min_range"=>1, "max_range"=>100))) === false)){ return "LBL_INVALID_NUMBER"; } return true; diff --git a/modules/Vtiger/actions/ExportData.php b/modules/Vtiger/actions/ExportData.php index ef3a7fc8382143d57b20130788e6162ecaf8f391..454b0d23443543e1695d298e74ac8815a8219ca0 100644 --- a/modules/Vtiger/actions/ExportData.php +++ b/modules/Vtiger/actions/ExportData.php @@ -348,7 +348,13 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action { if ($value && $value != '0000-00-00') { $value = DateTimeField::convertToUserFormat($value); } - } elseif($type == 'datetime') { + } /** + * Handled Conversion of time as per custom field time format in exported file + */ + elseif($uitype == 14) { + $timeUIObj = new Vtiger_Time_UIType(); + $value = $timeUIObj->getDisplayValue($value); + }elseif($type == 'datetime') { if ($moduleName == 'Calendar' && in_array($fieldName, array('date_start', 'due_date'))) { $timeField = 'time_start'; if ($fieldName === 'due_date') { diff --git a/modules/Vtiger/actions/Save.php b/modules/Vtiger/actions/Save.php index 33a714782f31ccf9128589ab8e27c16aeaa4bde3..4a9c41dd78f172419a0cddda70f100df38b52c9c 100644 --- a/modules/Vtiger/actions/Save.php +++ b/modules/Vtiger/actions/Save.php @@ -170,6 +170,7 @@ class Vtiger_Save_Action extends Vtiger_Action_Controller { if(!is_array($fieldValue) && $fieldDataType != 'currency') { $fieldValue = trim($fieldValue); } + $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue, $fieldModel); $recordModel->set($fieldName, $fieldValue); } } diff --git a/modules/Vtiger/actions/SaveAjax.php b/modules/Vtiger/actions/SaveAjax.php index e8a8618d8cd34ecfa804945a49f2ebea04d4fc8a..0c5013d106ef63f11e14d2051d5fbeeb360f18e0 100644 --- a/modules/Vtiger/actions/SaveAjax.php +++ b/modules/Vtiger/actions/SaveAjax.php @@ -38,9 +38,10 @@ class Vtiger_SaveAjax_Action extends Vtiger_Save_Action { $displayValue = $fieldModel->getDisplayValue($fieldValue, $recordModel->getId()); } if ($fieldModel->getFieldDataType() == 'currency') { - $displayValue = Vtiger_Currency_UIType::transformDisplayValue($fieldValue); + $displayValue = Vtiger_Currency_UIType::transformDisplayValue(Vtiger_Currency_UIType::convertToDBFormat($fieldValue)); } - if(!empty($picklistColorMap)) { + + if(!empty($picklistColorMap) && ($fieldModel->getFieldDataType() == 'picklist' || $fieldModel->getFieldDataType() == 'multipicklist')) { $result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue, 'colormap' => $picklistColorMap); } else { $result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue); @@ -111,6 +112,7 @@ class Vtiger_SaveAjax_Action extends Vtiger_Save_Action { if (!is_array($fieldValue)) { $fieldValue = trim($fieldValue); } + $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue, $fieldModel); $recordModel->set($fieldName, $fieldValue); } $recordModel->set($fieldName, $fieldValue); @@ -132,9 +134,6 @@ class Vtiger_SaveAjax_Action extends Vtiger_Save_Action { } else { $fieldValue = $fieldModel->getDefaultFieldValue(); } - if($fieldValue){ - $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue,$fieldModel); - } $fieldDataType = $fieldModel->getFieldDataType(); if ($fieldDataType == 'time' && $fieldValue !== null) { $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue); @@ -144,6 +143,7 @@ class Vtiger_SaveAjax_Action extends Vtiger_Save_Action { if (!is_array($fieldValue)) { $fieldValue = trim($fieldValue); } + $fieldValue = Vtiger_Util_Helper::validateFieldValue($fieldValue, $fieldModel); $recordModel->set($fieldName, $fieldValue); } } diff --git a/modules/Vtiger/helpers/Util.php b/modules/Vtiger/helpers/Util.php index dbc43a38edbf01867daa0b7652b25d76c8341143..ee94c7792e56776804a92ca6debbb92007fbe75c 100644 --- a/modules/Vtiger/helpers/Util.php +++ b/modules/Vtiger/helpers/Util.php @@ -140,7 +140,7 @@ class Vtiger_Util_Helper { global $adb; $query = 'Select deleted from vtiger_crmentity where crmid=?'; $result = $adb->pquery($query, array($recordId)); - return $adb->query_result($result, 'deleted'); + return $adb->query_result($result, 0, 'deleted'); } /**