diff --git a/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl b/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl index 774a89b6286ccb45bcabb0bf7d2481d7b7f9a13a..ae916ee3259514bb56735227698b2bc7d639fa41 100644 --- a/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl +++ b/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl @@ -63,8 +63,6 @@ {assign var="IS_INDIVIDUAL_TAX_TYPE" value=true} {/if} -<input type="hidden" id="customFields" value='{Zend_Json::encode($CUSTOM_FIELDS)}'> -<input type="hidden" id="customFieldsDefaultValues" value='{Zend_Json::encode($CUSTOM_FIELDS_DEFAULT_VALUES)}'> <input type="hidden" class="numberOfCurrencyDecimal" value="{$USER_MODEL->get('no_of_currency_decimals')}" /> <input type="hidden" name="totalProductCount" id="totalProductCount" value="{$row_no}" /> <input type="hidden" name="subtotal" id="subtotal" value="" /> diff --git a/layouts/v7/modules/Vtiger/dashboards/MiniListWizard.tpl b/layouts/v7/modules/Vtiger/dashboards/MiniListWizard.tpl index 8c50ab19ee3fbec2f37055befc2818399caf1d36..9391882549c4a68745ce84fd7474a943d3f55cf9 100644 --- a/layouts/v7/modules/Vtiger/dashboards/MiniListWizard.tpl +++ b/layouts/v7/modules/Vtiger/dashboards/MiniListWizard.tpl @@ -54,7 +54,7 @@ <td class="col-lg-4"></td> </tr> </tbody> - <input type="hidden" id="translatedModuleNames" value='{ZEND_JSON::encode($TRANSLATED_MODULE_NAMES)}'> + <input type="hidden" id="translatedModuleNames" value='{Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($TRANSLATED_MODULE_NAMES))}'> </table> {include file='ModalFooter.tpl'|@vtemplate_path:$MODULE} </form> diff --git a/layouts/v7/modules/Vtiger/resources/Field.js b/layouts/v7/modules/Vtiger/resources/Field.js index c8fce927ab98cc9351d7aafe12a17f6156382d66..55043e606a68be2867b22ea81cf828f2e1f71d43 100644 --- a/layouts/v7/modules/Vtiger/resources/Field.js +++ b/layouts/v7/modules/Vtiger/resources/Field.js @@ -245,14 +245,39 @@ Vtiger_Field_Js('Vtiger_Picklist_Field_Js',{},{ if(typeof pickListValues[' '] == 'undefined' || pickListValues[' '].length <= 0 || pickListValues[' '] != 'Select an Option') { html += '<option value="">Select an Option</option>'; } + + var data = this.getData(); + var picklistColors = data['picklistColors']; + + var fieldName = this.getName(); for(var option in pickListValues) { html += '<option value="'+option+'" '; + + var className = ''; + if (picklistColors[option]) { + className = 'picklistColor_'+fieldName+'_'+option.replace(' ', '_'); + html += 'class="'+className+'"'; + } + if(option == selectedOption) { html += ' selected '; } html += '>'+pickListValues[option]+'</option>'; } html +='</select>'; + + if (picklistColors) { + html +='<style type="text/css">'; + for(option in picklistColors) { + var picklistColor = picklistColors[option]; + if (picklistColor) { + className = '.picklistColor_'+fieldName+'_'+option.replace(' ', '_'); + html += className+'{background-color: '+picklistColor+' !important;}'; + } + } + html +='<\style>'; + } + var selectContainer = jQuery(html); this.addValidationToElement(selectContainer); return selectContainer; @@ -319,14 +344,38 @@ Vtiger_Field_Js('Vtiger_Multipicklist_Field_Js',{},{ var selectedOption = app.htmlDecode(this.getValue()); var selectedOptionsArray = this.getSelectedOptions(selectedOption); + var data = this.getData(); + var picklistColors = data['picklistColors']; + + var fieldName = this.getName(); for(var option in pickListValues) { html += '<option value="'+option+'" '; + + var className = ''; + if (picklistColors[option]) { + className = 'picklistColor_'+fieldName+'_'+option.replace(' ', '_'); + html += 'class="'+className+'"'; + } + if(jQuery.inArray(option,selectedOptionsArray) != -1){ html += ' selected '; } html += '>'+pickListValues[option]+'</option>'; } html +='</select>'; + + if (picklistColors) { + html +='<style type="text/css">'; + for(option in picklistColors) { + var picklistColor = picklistColors[option]; + if (picklistColor) { + className = '.picklistColor_'+fieldName+'_'+option.replace(' ', '_'); + html += className+'{background-color: '+picklistColor+' !important;}'; + } + } + html +='<\style>'; + } + var selectContainer = jQuery(html); this.addValidationToElement(selectContainer); return selectContainer; diff --git a/layouts/v7/modules/Vtiger/uitypes/MultiPicklist.tpl b/layouts/v7/modules/Vtiger/uitypes/MultiPicklist.tpl index c9a94e8cb30718ac714a7d476e722f4afe3815c6..2a35d33f8e828d87bee01bd15a71cbe4f9bc4923 100644 --- a/layouts/v7/modules/Vtiger/uitypes/MultiPicklist.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/MultiPicklist.tpl @@ -14,7 +14,7 @@ {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()} {assign var="SPECIAL_VALIDATOR" value=$FIELD_MODEL->getValidator()} {assign var="FIELD_VALUE_LIST" value=explode(' |##| ',$FIELD_MODEL->get('fieldvalue'))} - {assign var=PICKLIST_COLORS value=$FIELD_MODEL->getPicklistColors()} + {assign var=PICKLIST_COLORS value=$FIELD_INFO['picklistColors']} <input type="hidden" name="{$FIELD_MODEL->getFieldName()}" value="" data-fieldtype="multipicklist"/> <select id="{$MODULE}_{$smarty.request.view}_fieldName_{$FIELD_MODEL->getFieldName()}" multiple class="select2" name="{$FIELD_MODEL->getFieldName()}[]" data-fieldtype="multipicklist" style='width:210px;height:30px;' {if $FIELD_INFO["mandatory"] eq true} data-rule-required="true" {/if} diff --git a/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl b/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl index 7eb5c880ac947e1db0b16616fe34a069f2c75139..cceae5116b986121628fee490479d98977677c01 100644 --- a/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl @@ -11,7 +11,7 @@ {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()} {assign var=PICKLIST_VALUES value=$FIELD_MODEL->getPicklistValues()} {assign var="SPECIAL_VALIDATOR" value=$FIELD_MODEL->getValidator()} -{assign var=PICKLIST_COLORS value=$FIELD_MODEL->getPicklistColors()} +{assign var=PICKLIST_COLORS value=$FIELD_INFO['picklistColors']} <select data-fieldname="{$FIELD_MODEL->getFieldName()}" data-fieldtype="picklist" class="inputElement select2 {if $OCCUPY_COMPLETE_WIDTH} row {/if}" type="picklist" name="{$FIELD_MODEL->getFieldName()}" {if !empty($SPECIAL_VALIDATOR)}data-validator='{Zend_Json::encode($SPECIAL_VALIDATOR)}'{/if} data-selected-value='{$FIELD_MODEL->get('fieldvalue')}' {if $FIELD_INFO["mandatory"] eq true} data-rule-required="true" {/if} {if count($FIELD_INFO['validator'])} diff --git a/modules/Vtiger/models/Field.php b/modules/Vtiger/models/Field.php index c838a9b9bf9963d4dc27ed64175c54ea2701b069..e7ab867b972549c8bf77b877c9e9af35fe08cf7a 100644 --- a/modules/Vtiger/models/Field.php +++ b/modules/Vtiger/models/Field.php @@ -538,6 +538,12 @@ class Vtiger_Field_Model extends Vtiger_Field { } else { $this->fieldInfo['picklistvalues'] = array(); } + + $this->fieldInfo['picklistColors'] = array(); + $picklistColors = $this->getPicklistColors(); + if ($picklistColors) { + $this->fieldInfo['picklistColors'] = $picklistColors; + } } if($fieldDataType === 'currencyList'){