(function(){u8.Crm.SerialEntryOptionProvider=function(e){$.extend(this,$.extend(true,{},u8.Crm.SerialEntryOptionProvider.defaults,e))};u8.Crm.SerialEntryOptionProvider.makeClass({name:"SerialEntryOptionProvider"});u8.Crm.SerialEntryOptionProvider.defaults={defaults:{useNullForEmptyValues:false,showMiniDetails:true,showOptions:true,showRelatedView:true,showSearch:true,useAutoSearch:true,disableFilter:false,ignoredFieldsOnDuplicate:null,ignoredLinksOnDuplicate:null,saveAsync:true}};$.extend(u8.Crm.SerialEntryOptionProvider.prototype,{urlToOptions:function(e){var t=e.getOptions("properties");if(t){t=t.toObject()}var r=null,i=e.getArray("copyTargetFields"),a=e.getArray("copySourceFields");if(i&&a){r={};var o=Math.min(i.length,a.length);for(var s=0;s<o;s++){r[i[s]]=a[s]}}var l=e.getInt("maxRows",undefined);var n=e.getInt("pageSize",l);var u={useDirtyCheck:true,model:{url:e,name:e.get("name"),recentFilter:this._urlToRecentFilterOptions(e),link:e.getUid(),filterType:e.get("filterType"),properties:t,copyFields:r,maxRows:l,pageSize:n,headerGroupName:e.get("headerGroupName"),headerName:e.get("headerName","SerialEntry"),searchFieldGroupName:e.get("searchFieldGroupName"),optionsFormName:e.get("optionsFormName"),listHeaderGroupName:e.get("listHeaderGroupName")||e.get("headerGroupName"),listHeaderName:e.get("listHeaderName","SerialEntry.List"),listFieldGroupName:e.get("listFieldGroupName"),additionalParameters:this._urlToAdditionalParameters(e),totals:{formName:e.get("totalsFormName")},useNullForEmptyValues:e.get("useNullForEmptyValues",this.defaults.useNullForEmptyValues)},showMiniDetails:e.getBoolean("showMiniDetails",this.defaults.showMiniDetails),showOptions:e.getBoolean("showOptions",this.defaults.showOptions),showRelatedView:e.getBoolean("showRelatedView",this.defaults.showRelatedView),showSearch:e.getBoolean("showSearch",this.defaults.showSearch),searchForm:{pageSize:n,useAutoSearch:e.getBoolean("autoSearch",this.defaults.useAutoSearch),fixedFilterName:e.get("fixedFilter"),showFilters:!e.getBoolean("disableFilter",this.defaults.disableFilter),defaultFieldValues:e.get("searchDefaultFieldValues"),fixedFieldValues:e.get("searchFixedFieldValues"),infoAreaId:e.get("searchInfoAreaId"),sourceCopyFieldGroupName:e.get("sourceCopyFieldGroupName")},ignoredFieldsOnDuplicate:e.get("ignoredFieldsOnDuplicate",this.defaults.ignoredFieldsOnDuplicate),ignoredLinksOnDuplicate:e.get("ignoredLinksOnDuplicate",this.defaults.ignoredLinksOnDuplicate),saveAsync:e.getBoolean("saveAsync",this.defaults.saveAsync)};return u},_urlToRecentFilterOptions:function(e){var t=e.getArray("recentFilterOptions");if(!t){return null}var r={};["parentInfoAreaId","dateField","historyLength"].forEach(function(e,i){if(i<t.length){r[e]=t[i]}});return r},_urlToAdditionalParameters:function(e){var t={};var r=e.get("targetPositionLoadStrategy");if(r){t.TargetPositionLoadStrategy=r}return t}});u8.services.add("serialEntryOptionProvider",u8.Crm.SerialEntryOptionProvider)})();