diff --git a/include/Webservices/DataTransform.php b/include/Webservices/DataTransform.php index 79c67225dec62c8a86e6242ca369d3bf58a5441a..7ac0ba0819014d8ec876d4e80777c8c00857df52 100644 --- a/include/Webservices/DataTransform.php +++ b/include/Webservices/DataTransform.php @@ -103,7 +103,7 @@ } $references = $meta->getReferenceFieldDetails(); foreach($references as $field=>$typeList){ - if(strpos($row[$field],'x')!==false){ + if(isset($row[$field]) && strpos($row[$field],'x')!==false){ $row[$field] = vtws_getIdComponents($row[$field]); $row[$field] = $row[$field][1]; } @@ -130,7 +130,7 @@ } } } - if($row["id"]){ + if(isset($row["id"])){ unset($row["id"]); } if(isset($row[$meta->getObectIndexColumn()])){ @@ -187,7 +187,7 @@ } if(!isset($row['id'])){ - if($row[$meta->getObectIndexColumn()] ){ + if(isset($row[$meta->getObectIndexColumn()] )){ $row['id'] = vtws_getId($meta->getEntityId(),$row[$meta->getObectIndexColumn()]); }else{ //TODO Handle this. @@ -273,7 +273,7 @@ foreach ($moduleFields as $fieldName => $fieldObj) { if (in_array($fieldObj->getUIType(), $supportedUITypes)) { //while doing retrieve operation we have record_id and on query operation we have id. - $id = $row['record_id'] ? $row['record_id'] : $row['id']; + $id = isset($row['record_id']) ? $row['record_id'] : (isset($row['id']) ? $row['id'] : null); $ids = Vtiger_Functions::getAttachmentIds($id, $meta->getEntityId()); if($ids) { foreach($ids as $id){ diff --git a/include/utils/utils.php b/include/utils/utils.php index c7e28588e12599457d08ee9ca672dcb68a2d6023..da1002d9d0db010acbc67571def2f240571341c5 100755 --- a/include/utils/utils.php +++ b/include/utils/utils.php @@ -2439,7 +2439,7 @@ function getRecordGroupId($record) { * Function to delete record from $_SESSION[$moduleName.'_DetailView_Navigation'.$cvId] */ function deleteRecordFromDetailViewNavigationRecords($recordId, $cvId, $moduleName) { - $recordNavigationInfo = Zend_Json::decode($_SESSION[$moduleName . '_DetailView_Navigation' . $cvId]); + $recordNavigationInfo = Zend_Json::decode(isset($_SESSION[$moduleName . '_DetailView_Navigation' . $cvId])); if (!empty($recordNavigationInfo) && (php7_count($recordNavigationInfo) != 0)) { foreach ($recordNavigationInfo as $key => $recordIdList) { $recordIdList = array_diff($recordIdList, array($recordId)); diff --git a/layouts/v7/modules/Vtiger/BreadCrumbs.tpl b/layouts/v7/modules/Vtiger/BreadCrumbs.tpl index d0a860e3d2aeb50855c3d5d96e477cee467f53ed..74ea4350c7caab4c56a3bc4d19965a8b028f8690 100644 --- a/layouts/v7/modules/Vtiger/BreadCrumbs.tpl +++ b/layouts/v7/modules/Vtiger/BreadCrumbs.tpl @@ -13,7 +13,7 @@ {foreach key=CRUMBID item=STEPTEXT from=$BREADCRUMB_LABELS name=breadcrumbLabels} {assign var=INDEX value=$smarty.foreach.breadcrumbLabels.index} {assign var=INDEX value=$INDEX+1} - <li class="step {if $smarty.foreach.breadcrumbLabels.first} first {$FIRSTBREADCRUMB} {else} {$ADDTIONALCLASS} {/if} {if $smarty.foreach.breadcrumbLabels.last} last {/if} {if $ACTIVESTEP eq $INDEX}active{/if}" + <li class="step {if $smarty.foreach.breadcrumbLabels.first} first {if isset($FIRSTBREADCRUMB)} {$FIRSTBREADCRUMB} {/if} {else} {if isset($ADDTIONALCLASS)} {$ADDTIONALCLASS} {/if}{/if} {if $smarty.foreach.breadcrumbLabels.last} last {/if} {if $ACTIVESTEP eq $INDEX}active{/if}" id="{$CRUMBID}" data-value="{$INDEX}" style="z-index:{$ZINDEX}"> <a href="#"> <span class="stepNum">{$INDEX}</span> diff --git a/layouts/v7/modules/Vtiger/Export.tpl b/layouts/v7/modules/Vtiger/Export.tpl index 8f84d447e1a21165ea3de404cdd0bb390b7b939a..881caeebf13ad59a78f6962d392b6e294e20cb6a 100644 --- a/layouts/v7/modules/Vtiger/Export.tpl +++ b/layouts/v7/modules/Vtiger/Export.tpl @@ -19,9 +19,9 @@ <input type="hidden" name="selected_ids" value={ZEND_JSON::encode($SELECTED_IDS)}> <input type="hidden" name="excluded_ids" value={ZEND_JSON::encode($EXCLUDED_IDS)}> <input type="hidden" id="page" name="page" value="{$PAGE}" /> - <input type="hidden" name="search_key" value= "{$SEARCH_KEY}" /> + <input type="hidden" name="search_key" {if isset($SEARCH_KEY)} value= "{$SEARCH_KEY}" {/if}/> <input type="hidden" name="operator" value="{$OPERATOR}" /> - <input type="hidden" name="search_value" value="{$ALPHABET_VALUE}" /> + <input type="hidden" name="search_value" {if isset($ALPHABET_VALUE)} value="{$ALPHABET_VALUE}" {/if}/> <input type="hidden" name="search_params" value='{Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($SEARCH_PARAMS))}' /> <input type="hidden" name="orderby" value="{$ORDER_BY}" /> <input type="hidden" name="sortorder" value="{$SORT_ORDER}" /> @@ -72,7 +72,7 @@ <input type="radio" name="mode" value="ExportAllData" id="group3" {if empty($SELECTED_IDS)} checked="checked" {/if} style="margin:2px 0 -4px" /> <label style="font-weight:normal" for="group3"> {vtranslate('LBL_EXPORT_ALL_DATA',$MODULE)}</label> </div> - {if $MULTI_CURRENCY} + {if isset($MULTI_CURRENCY)} <br> <div class="row"> <div class="col-lg-8 col-md-8 col-lg-pull-0"><strong>{vtranslate('LBL_EXPORT_LINEITEM_CURRENCY',$MODULE)}: </strong> diff --git a/layouts/v7/modules/Vtiger/RecentActivities.tpl b/layouts/v7/modules/Vtiger/RecentActivities.tpl index ab22c6e86948a99bc4cd3dffa7d2caffa21f61db..a3351c2a4aa28627f90ea0c8b97b8f23d82aea45 100644 --- a/layouts/v7/modules/Vtiger/RecentActivities.tpl +++ b/layouts/v7/modules/Vtiger/RecentActivities.tpl @@ -84,6 +84,8 @@ {assign var=FIELD_DATA_TYPE value=$FIELDMODEL->getFieldInstance()->getFieldDataType()} {assign var=PRE_DISPLAY_VALUE value=$FIELDMODEL->getDisplayValue(decode_html($FIELDMODEL->get('prevalue')))} {assign var=POST_DISPLAY_VALUE value=$FIELDMODEL->getDisplayValue(decode_html($FIELDMODEL->get('postvalue')))} + {assign var=TIME_PRE_DISPLAY_VALUE value=$FIELDMODEL->getDisplayValue(decode_html($FIELDMODEL->get('prevalue')))} + {assign var=TIME_POST_DISPLAY_VALUE value=$FIELDMODEL->getDisplayValue(decode_html($FIELDMODEL->get('postvalue')))} {if in_array($FIELD_NAME,array('time_start','time_end')) && in_array($MODULE_NAME,array('Events','Calendar'))} {assign var=CALENDAR_RECORD_MODEL value =Vtiger_Record_Model::getInstanceById($RECORD_ID)} diff --git a/modules/Emails/models/Record.php b/modules/Emails/models/Record.php index e20d76b4f12ffab9a5a02ceb78b33106b78e5222..5595d222b624a79ebc5c5060a1f71aa8dda327ce 100644 --- a/modules/Emails/models/Record.php +++ b/modules/Emails/models/Record.php @@ -173,7 +173,7 @@ class Emails_Record_Model extends Vtiger_Record_Model { $plainBody = decode_emptyspace_html($description); $plainBody = preg_replace(array("/<p>/i","/<br>/i","/<br \/>/i"),array("\n","\n","\n"),$plainBody); $plainBody .= "\n\n".$currentUserModel->get('signature'); - $plainBody = strip_tags($plainBody); + $plainBody = utf8_encode(strip_tags($plainBody)); $plainBody = Emails_Mailer_Model::convertToAscii($plainBody); $plainBody = $this->convertUrlsToTrackUrls($plainBody, $id,'plain'); $mailer->AltBody = $plainBody; diff --git a/modules/Vtiger/actions/ExportData.php b/modules/Vtiger/actions/ExportData.php index 454b0d23443543e1695d298e74ac8815a8219ca0..d8c4e51aca5b2eae41d3166b38ff6b5f9b6234a6 100644 --- a/modules/Vtiger/actions/ExportData.php +++ b/modules/Vtiger/actions/ExportData.php @@ -110,7 +110,7 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action { $fieldInstances = $this->moduleFieldInstances; $orderBy = $request->get('orderby'); - $orderByFieldModel = $fieldInstances[$orderBy]; + $orderByFieldModel = isset($fieldInstances[$orderBy]) ? $fieldInstances[$orderBy] : ""; $sortOrder = $request->get('sortorder'); if ($mode !== 'ExportAllData') { @@ -293,14 +293,16 @@ class Vtiger_ExportData_Action extends Vtiger_Mass_Action { continue; } //Track if the value had quotes at beginning - $beginsWithDoubleQuote = strpos($value, '"') === 0; - $endsWithDoubleQuote = substr($value,-1) === '"'?1:0; + if (is_string($value)) { + $beginsWithDoubleQuote = strpos($value, '"') === 0; + $endsWithDoubleQuote = substr($value,-1) === '"'?1:0; + $value = trim($value,"\""); + } - $value = trim($value,"\""); $uitype = $fieldInfo->get('uitype'); $fieldname = $fieldInfo->get('name'); - if(!$this->fieldDataTypeCache[$fieldName]) { + if(!isset($this->fieldDataTypeCache[$fieldName])) { $this->fieldDataTypeCache[$fieldName] = $fieldInfo->getFieldDataType(); } $type = $this->fieldDataTypeCache[$fieldName]; diff --git a/modules/Vtiger/helpers/Util.php b/modules/Vtiger/helpers/Util.php index f793b582a8da26151e4f1b4b239943921d711d4d..0dc1862dc3240d140066b9316f9678191882cdc8 100644 --- a/modules/Vtiger/helpers/Util.php +++ b/modules/Vtiger/helpers/Util.php @@ -115,7 +115,7 @@ class Vtiger_Util_Helper { */ public static function toVtiger6SafeHTML($input) { $allowableTags = '<a><br>'; - return strip_tags($input, $allowableTags); + return strip_tags((string) $input, $allowableTags); } /** * Function to validate the input with given pattern. diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl index 6c5909cbb82eb1ec14a25239ccb7755e1ab06d59..32e4210fa805d6e0af07a9396a0931bfa3485dd3 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl @@ -27,15 +27,15 @@ <div class='modal-body'> {assign var=LABELS value=[]} - {if $FORMAT eq 'vcf'} + {if isset($FORMAT) eq 'vcf'} {$LABELS["step1"] = 'LBL_UPLOAD_VCF'} - {else if $FORMAT eq 'ics'} + {else if isset($FORMAT) eq 'ics'} {$LABELS["step1"] = 'LBL_UPLOAD_ICS'} {else} {$LABELS["step1"] = 'LBL_UPLOAD_CSV'} {/if} - {if $DUPLICATE_HANDLING_NOT_SUPPORTED eq 'true'} + {if isset($DUPLICATE_HANDLING_NOT_SUPPORTED) eq 'true'} {$LABELS["step3"] = 'LBL_FIELD_MAPPING'} {else} {$LABELS["step2"] = 'LBL_DUPLICATE_HANDLING'} diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportBasicStep.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportBasicStep.tpl index 3dc4cb650cca00ac7f6121c49ecebf5fc11c3a92..966cd6887018a380caa989520594f7cfd9400abb 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportBasicStep.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportBasicStep.tpl @@ -32,7 +32,7 @@ {/if} {if $FORMAT neq 'ics'} - {if $DUPLICATE_HANDLING_NOT_SUPPORTED eq 'true'} + {if isset($DUPLICATE_HANDLING_NOT_SUPPORTED) eq 'true'} {$LABELS["step3"] = 'LBL_FIELD_MAPPING'} {else} {$LABELS["step2"] = 'LBL_DUPLICATE_HANDLING'} @@ -56,7 +56,7 @@ <a class="cancelLink" data-dismiss="modal" href="#">{vtranslate('LBL_CANCEL', $MODULE)}</a> {else} <div id="importStepOneButtonsDiv"> - {if $DUPLICATE_HANDLING_NOT_SUPPORTED eq 'true'} + {if isset($DUPLICATE_HANDLING_NOT_SUPPORTED) eq 'true'} <button class="btn btn-success btn-lg" id="skipDuplicateMerge" onclick="Vtiger_Import_Js.uploadAndParse('0');">{vtranslate('LBL_NEXT_BUTTON_LABEL', $MODULE)}</button> {else} <button class="btn btn-success btn-lg" id ="importStep2" onclick="Vtiger_Import_Js.importActionStep2();">{vtranslate('LBL_NEXT_BUTTON_LABEL', $MODULE)}</button> diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportResult.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportResult.tpl index 8691a62f79e05197f69b1332f33647c1455e36c3..a53a55683fffb974a3b7e2dfd541623f738e0de3 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportResult.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportResult.tpl @@ -18,7 +18,7 @@ <div class="summaryWidgetContainer"> <input type="hidden" name="module" value="{$FOR_MODULE}" /> <h4>{'LBL_TOTAL_RECORDS_SCANNED'|@vtranslate:$MODULE} : {$IMPORT_RESULT.TOTAL}</h4> - {if $ERROR_MESSAGE neq ''}<span>{$ERROR_MESSAGE}</span>{/if} + {if isset($ERROR_MESSAGE) && $ERROR_MESSAGE neq ''}<span>{$ERROR_MESSAGE}</span>{/if} <hr> <div>{include file="Import_Result_Details.tpl"|@vtemplate_path:'Import'}</div> </div> diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepOne.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepOne.tpl index 72d070aad7f72b8a52622de17a3eb6d86e37c77e..6629fb0952759e75c287539d18dbd13627cd6af1 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepOne.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepOne.tpl @@ -71,7 +71,7 @@ {/foreach} </td> </tr> - {if $MULTI_CURRENCY} + {if isset($MULTI_CURRENCY)} <tr id="lineitem_currency_container" style="height:50px"> <td>{vtranslate('LBL_IMPORT_LINEITEMS_CURRENCY',$MODULE)}</td> <td> diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepThree.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepThree.tpl index e27a7527d69134eec5ba3370bb94cd7d8593847f..517634478248c3e4a123316bc339fff56b8af2ca 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepThree.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportStepThree.tpl @@ -19,7 +19,7 @@ <input type="checkbox" name="save_map" id="save_map"> <label for="save_map">{'LBL_SAVE_AS_CUSTOM_MAPPING'|@vtranslate:$MODULE}</label> <input type="text" name="save_map_as" id="save_map_as" class = "form-control"> </div> -{if !$IMPORTABLE_FIELDS} +{if !isset($IMPORTABLE_FIELDS)} {assign var=IMPORTABLE_FIELDS value=$AVAILABLE_FIELDS} {/if} {include file="Import_Default_Values_Widget.tpl"|@vtemplate_path:'Import' IMPORTABLE_FIELDS=$IMPORTABLE_FIELDS} \ No newline at end of file diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl index dea8a75edaedbfae8c0c3098ecf70f8a6eaada23..7d1078fdf99827c6de839c82f2fb9e1951c288d2 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl @@ -10,7 +10,7 @@ {strip} <input type="hidden" name="merge_type" value='{$USER_INPUT->get('merge_type')}' /> <input type="hidden" name="merge_fields" value='{$MERGE_FIELDS}' /> - <input type="hidden" name="lineitem_currency" value='{$LINEITEM_CURRENCY}'> + <input type="hidden" name="lineitem_currency" value='{if isset($LINEITEM_CURRENCY)}{$LINEITEM_CURRENCY}{else}''{/if}'> <input type="hidden" id="mandatory_fields" name="mandatory_fields" value='{$ENCODED_MANDATORY_FIELDS}' /> <input type="hidden" name="field_mapping" id="field_mapping" value="" /> <input type="hidden" name="default_values" id="default_values" value="" /> diff --git a/pkg/vtiger/modules/Import/modules/Import/actions/Data.php b/pkg/vtiger/modules/Import/modules/Import/actions/Data.php index 9ccaf0d4d4220650d3876d3f82cbeae0d1469b6b..d4ca1b2ad068eda319f27bab801bc54f974d9690 100644 --- a/pkg/vtiger/modules/Import/modules/Import/actions/Data.php +++ b/pkg/vtiger/modules/Import/modules/Import/actions/Data.php @@ -652,7 +652,7 @@ class Import_Data_Action extends Vtiger_Action_Controller { unset($this->allPicklistValues[$fieldName]); } } else { - $fieldData[$fieldName] = $picklistDetails[$picklistValueInLowerCase]; + $fieldData[$fieldName] = isset($picklistDetails[$picklistValueInLowerCase]); } } else if ($fieldDataType == 'currency') { // While exporting we are exporting as user format, we should import as db format while importing @@ -773,7 +773,7 @@ class Import_Data_Action extends Vtiger_Action_Controller { $fieldData['source'] = $this->recordSource; if ($fieldData != null && $checkMandatoryFieldValues) { foreach ($moduleFields as $fieldName => $fieldInstance) { - if ((($fieldData[$fieldName] == '') || ($fieldData[$fieldName] == null)) && $fieldInstance->isMandatory()) { + if ((empty($fieldData[$fieldName]) || !isset($fieldData[$fieldName])) && $fieldInstance->isMandatory()) { return null; } } diff --git a/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php b/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php index 5e16ff426b0f7a28960311c0378a2f9bbc606a11..fed3847c3de14314bbae2b32373320a179ac875c 100644 --- a/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php +++ b/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php @@ -9,7 +9,9 @@ * All Rights Reserved. * *********************************************************************************** */ //required for auto detecting file endings for files create in mac -ini_set("auto_detect_line_endings", true); +if (version_compare(PHP_VERSION, '8.1.0') <= 0) { + ini_set("auto_detect_line_endings", true); +} class Import_Utils_Helper { @@ -142,6 +144,7 @@ class Import_Utils_Helper { } public static function getAssignedToUserList($module) { + $current_user = Users_Record_Model::getCurrentUserModel(); $cache = Vtiger_Cache::getInstance(); if($cache->getUserList($module,$current_user->id)){ return $cache->getUserList($module,$current_user->id); @@ -153,6 +156,7 @@ class Import_Utils_Helper { } public static function getAssignedToGroupList($module) { + $current_user = Users_Record_Model::getCurrentUserModel(); $cache = Vtiger_Cache::getInstance(); if($cache->getGroupList($module,$current_user->id)){ return $cache->getGroupList($module,$current_user->id); diff --git a/pkg/vtiger/modules/Import/modules/Import/readers/CSVReader.php b/pkg/vtiger/modules/Import/modules/Import/readers/CSVReader.php index 008969489cb1d87666c979373d521c746b78ccfa..7c383d23bf273caa5c1a62e7d28e21557d095b11 100644 --- a/pkg/vtiger/modules/Import/modules/Import/readers/CSVReader.php +++ b/pkg/vtiger/modules/Import/modules/Import/readers/CSVReader.php @@ -7,7 +7,9 @@ * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. *************************************************************************************/ -ini_set("auto_detect_line_endings", true); +if(version_compare(PHP_VERSION, '8.1.0') <= 0) { + ini_set("auto_detect_line_endings", true); +} class Import_CSVReader_Reader extends Import_FileReader_Reader { diff --git a/pkg/vtiger/modules/Import/modules/Import/views/Main.php b/pkg/vtiger/modules/Import/modules/Import/views/Main.php index 6cceb2e0fc778807e8c990be8f4e88874777db45..fe6179cc515ffd22d687920998cd4062cb0dfedc 100644 --- a/pkg/vtiger/modules/Import/modules/Import/views/Main.php +++ b/pkg/vtiger/modules/Import/modules/Import/views/Main.php @@ -118,6 +118,7 @@ class Import_Main_View extends Vtiger_View_Controller{ public static function showResult($importInfo, $importStatusCount) { $moduleName = $importInfo['module']; $ownerId = $importInfo['user_id']; + $skippedRecords = $importStatusCount['SKIPPED']; $viewer = new Vtiger_Viewer();