From 1216f9e2c5ec23ec5bc946c623122d06a245f75e Mon Sep 17 00:00:00 2001 From: appu <apparao@vtiger.com> Date: Fri, 15 Dec 2023 12:18:34 +0530 Subject: [PATCH] #Fixed:internal issues --- includes/http/Request.php | 19 ++++++++++++------- layouts/v7/modules/Vtiger/resources/Popup.js | 1 + .../v7/modules/Vtiger/uitypes/Reference.tpl | 2 +- modules/Emails/models/Record.php | 4 ++-- vtlib/Vtiger/Utils.php | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/includes/http/Request.php b/includes/http/Request.php index 8ad3ad750..0a1ee077e 100644 --- a/includes/http/Request.php +++ b/includes/http/Request.php @@ -57,14 +57,19 @@ class Vtiger_Request { } } if($isJSON) { - $decodeValue = json_decode($value, true); - $value = json_last_error() ? $value : $decodeValue; + $oldValue = Zend_Json::$useBuiltinEncoderDecoder; + Zend_Json::$useBuiltinEncoderDecoder = false; + $decodeValue = Zend_Json::decode($value); + if(isset($decodeValue)) { + $value = $decodeValue; + } + Zend_Json::$useBuiltinEncoderDecoder = $oldValue; + } + + //Handled for null because vtlib_purify returns empty string + if(!empty($value)){ + $value = vtlib_purify($value); } - - //Handled for null because vtlib_purify returns empty string - if(!empty($value)){ - $value = vtlib_purify($value); - } return $value; } diff --git a/layouts/v7/modules/Vtiger/resources/Popup.js b/layouts/v7/modules/Vtiger/resources/Popup.js index 62387f416..0e7cf4b55 100644 --- a/layouts/v7/modules/Vtiger/resources/Popup.js +++ b/layouts/v7/modules/Vtiger/resources/Popup.js @@ -531,6 +531,7 @@ jQuery.Class("Vtiger_Popup_Js",{ jQuery('#searchvalue').val(""); jQuery('#totalPageCount').text(""); thisInstance.searchHandler().then(function(data){ + thisInstance.writeSelectedIds(new Array()); jQuery('#pageNumber').val(1); jQuery('#pageToJump').val(1); thisInstance.updatePagination(); diff --git a/layouts/v7/modules/Vtiger/uitypes/Reference.tpl b/layouts/v7/modules/Vtiger/uitypes/Reference.tpl index c82174b4e..75da18101 100644 --- a/layouts/v7/modules/Vtiger/uitypes/Reference.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/Reference.tpl @@ -47,7 +47,7 @@ data-specific-rules='{ZEND_JSON::encode($FIELD_INFO["validator"])}' {/if} /> - <a href="#" class="clearReferenceSelection {if $FIELD_VALUE eq 0}hide{/if}"> x </a> + <a href="#" class="clearReferenceSelection {if empty($FIELD_VALUE) || $FIELD_VALUE lte 0}hide{/if}"> x </a> <span class="input-group-addon relatedPopup cursorPointer" title="{vtranslate('LBL_SELECT', $MODULE)}"> <i id="{$MODULE}_editView_fieldName_{$FIELD_NAME}_select" class="fa fa-search"></i> </span> diff --git a/modules/Emails/models/Record.php b/modules/Emails/models/Record.php index 78e0e39c8..09370b417 100644 --- a/modules/Emails/models/Record.php +++ b/modules/Emails/models/Record.php @@ -57,7 +57,7 @@ class Emails_Record_Model extends Vtiger_Record_Model { $userName = $currentUserModel->getName(); // To eliminate the empty value of an array - $toEmailInfo = array_filter($this->get('toemailinfo')); + $toEmailInfo = $this->get('toemailinfo') ? array_filter($this->get('toemailinfo')) : array(); $emailsInfo = array(); foreach ($toEmailInfo as $id => $emails) { foreach($emails as $key => $value){ @@ -828,4 +828,4 @@ class Emails_Record_Model extends Vtiger_Record_Model { } return false; } -} \ No newline at end of file +} diff --git a/vtlib/Vtiger/Utils.php b/vtlib/Vtiger/Utils.php index 64a36a485..e5415688d 100644 --- a/vtlib/Vtiger/Utils.php +++ b/vtlib/Vtiger/Utils.php @@ -342,7 +342,7 @@ class Vtiger_Utils { public static function writeLogFile($logFileName, $log) { if ($logFileName && $log) { $logFilePath = self::$logFolder . '/' . $logFileName; - file_put_contents($logFilePath, print_r($log, true), FILE_APPEND); + file_put_contents($logFilePath, print_r($log, true).PHP_EOL, FILE_APPEND); } } } -- GitLab