How to use setDefaultValue method in Playwright Internal

Best JavaScript code snippet using playwright-internal

AVA_ConfigFunctions.js

Source:AVA_ConfigFunctions.js Github

copy

Full Screen

...91 if(searchresult != null && searchresult.length > 0)92 {93 var AVA_Record = nlapiLoadRecord('customrecord_avaconfig', searchresult[0].getId());94 var AVA_LoadValues = AVA_LoadValuesToGlobals(AVA_Record); 95 form.getField('ava_accountvalue').setDefaultValue(AVA_AccountValue); 96 form.getField('ava_licensekey').setDefaultValue(AVA_LicenseKey); 97 form.getField('ava_serviceurl').setDefaultValue(AVA_ServiceUrl); 98 form.getField('ava_expirydate').setDefaultValue(AVA_ExpiryDate);99 form.getField('ava_username').setDefaultValue(AVA_Username); 100 form.getField('ava_password').setDefaultValue(AVA_Password);101 form.getField('ava_accountvalue').setDisplayType('disabled');102 form.getField('ava_licensekey').setDisplayType('disabled');103 form.getField('ava_serviceurl').setDisplayType('disabled'); 104 form.getField('ava_expirydate').setDisplayType('disabled');105 form.getField('ava_username').setDisplayType('disabled'); 106 form.getField('ava_password').setDisplayType('disabled');107 if(AVA_ServiceTypes != null)108 { 109 if(AVA_ServiceTypes.search('TaxSvc') != -1)110 {111 form.addTab('ava_general', 'General');112 form.addTab('ava_taxcalculation', 'Tax Calculation'); 113 114 // Adding Elements inside First Tab - General115 // Item Specific Fields116 form.addField('ava_itemhelp', 'help', '<b>Item Specific:</b><hr>', null, 'ava_general').setLayoutType('startrow','startcol');117 form.addField('ava_udf1', 'checkbox', 'User Defined 1', null, 'ava_general');118 form.addField('ava_udf2', 'checkbox', 'User Defined 2', null, 'ava_general');119 form.addField('ava_itemaccount', 'checkbox', 'Send Item Account to Avalara', null, 'ava_general');120 form.addField('ava_taxcodemapping', 'checkbox', 'Enable Tax Code Mapping', null, 'ava_general');121 122 //Customer Specific Fields123 form.addField('ava_custhelp', 'help', '<b>Customer Specific:</b><hr>', null, 'ava_general').setLayoutType('startrow','startcol'); 124 var AVA_CustCodeField = form.addField('ava_customercode', 'select', 'Customer Code', null, 'ava_general');125 AVA_CustCodeField.addSelectOption('0','Customer ID');126 AVA_CustCodeField.addSelectOption('1','Customer Name'); 127 AVA_CustCodeField.addSelectOption('2','Customer Internal ID');128 AVA_CustCodeField.addSelectOption('3','Partner ID');129 AVA_CustCodeField.addSelectOption('4','Partner Name');130 AVA_CustCodeField.addSelectOption('5','Partner Internal ID');131 AVA_CustCodeField.addSelectOption('6','Customer ID/Name');132 AVA_CustCodeField.addSelectOption('7','Partner ID/Name');133 AVA_CustCodeField.setHelpText('Customer Code with which the tax call needs to be made to AvaTax.', false);134 135 var AVA_MarkCustomerTaxable = form.addField('ava_markcusttaxable', 'select', 'Customers Default to Taxable', null, 'ava_general');136 AVA_MarkCustomerTaxable.addSelectOption('0','');137 AVA_MarkCustomerTaxable.addSelectOption('1','New and Existing Customer(s)');138 AVA_MarkCustomerTaxable.addSelectOption('2','Only New Customer(s)');139 AVA_MarkCustomerTaxable.addSelectOption('3','Only Existing Customer(s)');140 141 var AVA_DefaultCustTaxcode = form.addField('ava_defaultcustomer', 'select', 'Default Taxcode To', null, 'ava_general');142 AVA_DefaultCustTaxcode.addSelectOption('0','');143 AVA_DefaultCustTaxcode.addSelectOption('1','New and Existing Customer(s)');144 AVA_DefaultCustTaxcode.addSelectOption('2','Only New Customer(s)');145 AVA_DefaultCustTaxcode.addSelectOption('3','Only Existing Customer(s)'); 146 147 form.addField('ava_entityusecode', 'checkbox', 'Enable Entity/Use Code', null, 'ava_general');148 149 //Miscellaneous Setting Fields150 form.addField('ava_mischelp', 'help', '<b>Miscellaneous Settings:</b><hr>', null, 'ava_general').setLayoutType('startrow','startcol');151 form.addField('ava_defshipcode', 'text', 'Default Shipping Code', null, 'ava_general');152 153 var AVA_ShowMsgs = form.addField('ava_showmessages', 'select', 'Show Warnings/Errors', null, 'ava_general'); 154 155 AVA_ShowMsgs.addSelectOption('0','None');156 AVA_ShowMsgs.addSelectOption('1','Only Warnings');157 AVA_ShowMsgs.addSelectOption('2','Only Errors');158 AVA_ShowMsgs.addSelectOption('3','Both');159 AVA_ShowMsgs.setDefaultValue('3');160 161 var AVA_BillTimeName;162 if(nlapiGetContext().getSetting('FEATURE', 'billscosts') == 'T')163 {164 AVA_BillTimeName = form.addField('ava_billtimename', 'select', 'Billable Time Name', null, 'ava_general');165 AVA_BillTimeName.addSelectOption('0','Billable Time');166 AVA_BillTimeName.addSelectOption('1','Item Name');167 }168 169 //Consumer UseTax Settings170 form.addField('ava_usetaxhelp', 'help', '<b>Consumer Use Tax Assessment Settings:</b><hr>', null, 'ava_general').setLayoutType('startrow','startcol');171 form.addField('ava_enableusetax', 'checkbox', 'Enable Use Tax Assessment on Vendor Bill', null, 'ava_general');172 173 var AVA_VendorCodeField = form.addField('ava_vendorcode', 'select', 'Vendor Code', null, 'ava_general');174 175 AVA_VendorCodeField.addSelectOption('0','Vendor ID');176 AVA_VendorCodeField.addSelectOption('1','Vendor Name');177 AVA_VendorCodeField.addSelectOption('2','Vendor Internal ID');178 AVA_VendorCodeField.setHelpText('Vendor Code with which the tax call will be made to AvaTax.', false);179 form.addField('ava_creditaccount', 'select', 'Use Tax Payable Liability Account', 'account', 'ava_general');180 form.addField('ava_glaccount', 'label', 'GL Account to Debit', null, 'ava_general');181 form.addField('ava_glaccounts', 'radio', 'Individual Item/Expense Account', 'itemaccount', 'ava_general');182 form.addField('ava_glaccounts', 'radio', 'Select a Use Tax Debit GL Account', 'glaccount', 'ava_general');183 form.getField('ava_glaccounts').setDefaultValue('itemaccount');184 form.addField('ava_debitaccount', 'select', 'Use Tax Debit GL Account', 'account', 'ava_general');185 186 // Adding Elements inside Second Tab - Tax Calcuation187 form.addField('ava_disabletax', 'checkbox', 'Disable Tax Calculation', null, 'ava_taxcalculation');188 form.addField('ava_disableline', 'checkbox', 'Disable Tax Calculation at line level', null, 'ava_taxcalculation'); 189 190 form.addField('ava_enablelogging', 'checkbox', 'Enable Logging', null, 'ava_taxcalculation');191 192 form.addField('ava_taxondemand', 'checkbox', 'Calculate Tax on Demand', null, 'ava_taxcalculation');193 194 form.addField('ava_taxinclude', 'checkbox', 'Tax Included Capability', null, 'ava_taxcalculation');195 form.addField('ava_enablediscount', 'checkbox', 'Enable Discount Mechanism', null, 'ava_taxcalculation');196 var AVA_ShowDiscountMapping = form.addField('ava_discountmapping', 'select', 'Discount Mapping', null, 'ava_taxcalculation');197 AVA_ShowDiscountMapping.addSelectOption('0', 'Gross Amount');198 AVA_ShowDiscountMapping.addSelectOption('1', 'Net Amount');199 200 form.addField('ava_discounttaxcode', 'text', 'Discount Tax Code', null , 'ava_taxcalculation');201 202 var AVA_ShowTaxRate = form.addField('ava_taxrate', 'select', 'Tax Rate', null, 'ava_taxcalculation');203 AVA_ShowTaxRate.addSelectOption('0','Show Base Rate');204 AVA_ShowTaxRate.addSelectOption('1','Show Net Rate');205 AVA_ShowTaxRate.setLayoutType('normal', 'startcol');206 var AVA_DeciPlaces = form.addField('ava_decimalplaces', 'select', 'Round-off Tax percentage(Decimal Places)', null, 'ava_taxcalculation');207 AVA_DeciPlaces.addSelectOption('2','2');208 AVA_DeciPlaces.addSelectOption('3','3');209 AVA_DeciPlaces.addSelectOption('4','4');210 AVA_DeciPlaces.addSelectOption('5','5');211 form.addField('ava_usepostingperiod', 'checkbox', 'Use Posting Period as Transaction date during Tax calls', null, 'ava_taxcalculation');212 form.addField('ava_disableloccode', 'checkbox', 'Disable Location Code', null, 'ava_taxcalculation');213 form.addField('ava_enableupccode', 'checkbox', 'Enable UPC Code as ItemCode', null, 'ava_taxcalculation');214 215 form.addField('ava_taxsettings', 'help','<b>Abort Save Operation on Tax Calculation Error(s)/Incomplete data:</b><hr>', null, 'ava_taxcalculation').setLayoutType('startrow','startcol');216 form.addField('ava_abortbulkbilling', 'checkbox', 'Bulk Billing', null, 'ava_taxcalculation');217 form.addField('ava_abortuserinterfaces', 'checkbox', 'User Interfaces', null, 'ava_taxcalculation'); 218 form.addField('ava_abortwebservices', 'checkbox', 'Webservices', null, 'ava_taxcalculation');219 form.addField('ava_abortcsvimports', 'checkbox', 'CSV Imports', null, 'ava_taxcalculation');220 form.addField('ava_abortscheduledscripts', 'checkbox', 'Scheduled Scripts', null, 'ava_taxcalculation'); 221 form.addField('ava_abortsuitelets', 'checkbox', 'Suitelets', null, 'ava_taxcalculation');222 form.addField('ava_abortworkflowactionscripts', 'checkbox', 'Workflow Action Scripts', null, 'ava_taxcalculation'); 223 224 var AVA_SubsidiarySubList = form.addSubList('custpage_subsidiarylist', 'list', 'Subsidiary List', 'ava_taxcalculation'); 225 226 AVA_SubsidiarySubList.addField('ava_customsubid', 'text', 'Custom Record Sub ID', null);227 AVA_SubsidiarySubList.getField('ava_customsubid').setDisplayType('hidden');228 229 var AVA_SubId = AVA_SubsidiarySubList.addField('ava_subid', 'text', 'Sub ID', null);230 AVA_SubId.setDisplayType('hidden');231 232 var AVA_SubsidiaryField = AVA_SubsidiarySubList.addField('ava_subsidiary', 'text', 'Subsidiary', null);233 AVA_SubsidiaryField.setDisplayType('normal'); 234 var AVA_DefTaxcode = AVA_SubsidiarySubList.addField('ava_deftaxcode', 'text', 'Default Tax Code', null);235 var AVA_DefTaxcodeRate = AVA_SubsidiarySubList.addField('ava_deftaxcoderate', 'text', 'Default Tax Code Rate', null);236 var AVA_SubsidiaryAddress = AVA_SubsidiarySubList.addField('ava_defaultaddr', 'text', 'Ship-From Address', null);237 238 AVA_SubsidiarySubList.addField('ava_companyaddr', 'textarea', 'Company Address', null);239 AVA_SubsidiarySubList.addField('ava_shipaddr', 'textarea', 'Shipping Address', null);240 AVA_SubsidiarySubList.addField('ava_subnexuses', 'textarea', 'Subsidiary Nexuses', null).setDisplayType('hidden');241 242 var column = new Array();243 column[0] = new nlobjSearchColumn('custrecord_ava_subsidiary');244 column[1] = new nlobjSearchColumn('custrecord_ava_subdeftaxcode');245 column[2] = new nlobjSearchColumn('custrecord_ava_companyaddr');246 column[3] = new nlobjSearchColumn('custrecord_ava_shipaddr');247 column[4] = new nlobjSearchColumn('custrecord_ava_iscompanyaddr');248 column[5] = new nlobjSearchColumn('custrecord_ava_subname');249 column[6] = new nlobjSearchColumn('custrecord_ava_subnexuses');250 251 var subsidiaryArray = nlapiSearchRecord('customrecord_avasubsidiaries', null, null, column);252 for(var k = 0; subsidiaryArray != null && k < subsidiaryArray.length; k++ )253 {254 AVA_SubsidiarySubList.setLineItemValue('ava_customsubid', k+1, subsidiaryArray[k].getId());255 AVA_SubsidiarySubList.setLineItemValue('ava_subid', k+1, subsidiaryArray[k].getValue('custrecord_ava_subsidiary'));256 AVA_SubsidiarySubList.setLineItemValue('ava_subsidiary', k+1, subsidiaryArray[k].getValue('custrecord_ava_subname'));257 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcode', k+1, subsidiaryArray[k].getValue('custrecord_ava_subdeftaxcode'));258 var TaxCode = subsidiaryArray[k].getValue('custrecord_ava_subdeftaxcode');259 AVA_DefaultTaxCode = (TaxCode!=null) ? TaxCode.substring(0, TaxCode.lastIndexOf('+')) : '';260 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcode', k+1, AVA_DefaultTaxCode);261 262 var val = subsidiaryArray[k].getValue('custrecord_ava_subdeftaxcode');263 val = (val != null && val.length > 0) ? val.substr(val.lastIndexOf('+')+1, val.length) : ''; /* Modified by Vinod */264 265 if(val != null && val.length > 0)266 {267 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcoderate', k+1, '0.00%'); 268 }269 270 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcodecountry', k+1, val); 271 var TaxCodeValidate = (val != null && val.length > 0) ? 1 : '';272 273 AVA_SubsidiarySubList.setLineItemValue('ava_taxcodevalidate', k+1, TaxCodeValidate); 274 275 AVA_SubsidiarySubList.setLineItemValue('ava_defaultaddr', k+1, (subsidiaryArray[k].getValue('custrecord_ava_iscompanyaddr')=='T') ? 'Company Address' : 'Shipping Address');276 277 AVA_SubsidiarySubList.setLineItemValue('ava_companyaddr', k+1, subsidiaryArray[k].getValue('custrecord_ava_companyaddr'));278 AVA_SubsidiarySubList.setLineItemValue('ava_shipaddr', k+1, subsidiaryArray[k].getValue('custrecord_ava_shipaddr'));279 AVA_SubsidiarySubList.setLineItemValue('ava_subnexuses', k+1, subsidiaryArray[k].getValue('custrecord_ava_subnexuses'));280 }281 //Setting values282 /* General Tab Elements Detail */283 form.getField('ava_udf1').setDefaultValue(AVA_UDF1); 284 form.getField('ava_udf2').setDefaultValue(AVA_UDF2); 285 form.getField('ava_entityusecode').setDefaultValue(AVA_EntityUseCode); 286 form.getField('ava_itemaccount').setDefaultValue(AVA_ItemAccount); 287 form.getField('ava_taxcodemapping').setDefaultValue(AVA_TaxCodeMapping);288 289 if(AVA_CustomerCode != null && AVA_CustomerCode.length > 0)290 {291 form.getField('ava_customercode').setDefaultValue(AVA_CustomerCode); 292 }293 else294 {295 form.getField('ava_customercode').setDefaultValue('1');296 }297 298 if(AVA_MarkCustTaxable != null && AVA_MarkCustTaxable.length > 0)299 {300 form.getField('ava_markcusttaxable').setDefaultValue(AVA_MarkCustTaxable);301 }302 else303 {304 form.getField('ava_markcusttaxable').setDefaultValue('');305 }306 307 if(AVA_DefaultCustomerTaxcode != null && AVA_DefaultCustomerTaxcode.length > 0)308 {309 form.getField('ava_defaultcustomer').setDefaultValue(AVA_DefaultCustomerTaxcode);310 }311 else312 {313 form.getField('ava_defaultcustomer').setDefaultValue('');314 }315 316 if(AVA_ShowMessages != null && AVA_ShowMessages.length > 0)317 {318 form.getField('ava_showmessages').setDefaultValue(AVA_ShowMessages);319 }320 else321 {322 form.getField('ava_showmessages').setDefaultValue('3');323 }324 325 if(form.getField('ava_billtimename') != null) 326 {327 if(AVA_BillableTimeName != null && AVA_BillableTimeName.length > 0)328 {329 form.getField('ava_billtimename').setDefaultValue(AVA_BillableTimeName); 330 }331 else332 {333 form.getField('ava_billtimename').setDefaultValue(0);334 }335 } 336 337 form.getField('ava_defshipcode').setDefaultValue(AVA_DefaultShippingCode);338 form.getField('ava_enableusetax').setDefaultValue(AVA_EnableUseTax);339 340 if(AVA_VendorCode != null && AVA_VendorCode.length > 0)341 {342 form.getField('ava_vendorcode').setDefaultValue(AVA_VendorCode); 343 }344 else345 {346 form.getField('ava_vendorcode').setDefaultValue('1');347 }348 349 if(AVA_GlAccounts != null && AVA_GlAccounts.length > 0)350 {351 form.getField('ava_glaccounts').setDefaultValue(AVA_GlAccounts); 352 }353 else354 {355 form.getField('ava_glaccounts').setDefaultValue('itemaccount');356 }357 358 if(AVA_UseTaxCredit != null && AVA_UseTaxCredit.length > 0)359 {360 form.getField('ava_creditaccount').setDefaultValue(AVA_UseTaxCredit);361 }362 else363 {364 form.getField('ava_creditaccount').setDefaultValue('');365 }366 367 if(AVA_UseTaxDebit != null && AVA_UseTaxDebit.length > 0)368 {369 form.getField('ava_debitaccount').setDefaultValue(AVA_UseTaxDebit);370 }371 else372 {373 form.getField('ava_debitaccount').setDefaultValue('');374 }375 376 /* Tax Calculation Elements Details */ 377 form.getField('ava_disabletax').setDefaultValue(AVA_DisableTax); 378 if (nlapiGetFieldValue('ava_disabletax') == 'T')379 {380 form.getField('ava_disableline').setDisplayType('disabled');381 form.getField('ava_taxondemand').setDisplayType('disabled');382 form.getField('ava_enablelogging').setDisplayType('disabled');383 }384 385 form.getField('ava_disableline').setDefaultValue(AVA_DisableLine); 386 form.getField('ava_taxondemand').setDefaultValue(AVA_CalculateonDemand); 387 form.getField('ava_enablelogging').setDefaultValue(AVA_EnableLogging);388 form.getField('ava_taxrate').setDefaultValue(AVA_TaxRate);389 form.getField('ava_decimalplaces').setDefaultValue(AVA_DecimalPlaces);390 form.getField('ava_usepostingperiod').setDefaultValue(AVA_UsePostingPeriod);391 form.getField('ava_taxinclude').setDefaultValue(AVA_TaxInclude);392 form.getField('ava_enablediscount').setDefaultValue(AVA_EnableDiscount);393 form.getField('ava_discounttaxcode').setDefaultValue(AVA_DiscountTaxCode);394 form.getField('ava_discountmapping').setDefaultValue(AVA_DiscountMapping);395 if (nlapiGetFieldValue('ava_enablediscount') == 'F')396 {397 form.getField('ava_discountmapping').setDisplayType('disabled');398 form.getField('ava_discounttaxcode').setDisplayType('disabled');399 }400 form.getField('ava_disableloccode').setDefaultValue(AVA_DisableLocationCode);401 form.getField('ava_enableupccode').setDefaultValue(AVA_EnableUpcCode);402 403 form.getField('ava_abortbulkbilling').setDefaultValue(AVA_AbortBulkBilling);404 form.getField('ava_abortuserinterfaces').setDefaultValue(AVA_AbortUserInterfaces);405 form.getField('ava_abortwebservices').setDefaultValue(AVA_AbortWebServices);406 form.getField('ava_abortcsvimports').setDefaultValue(AVA_AbortCSVImports);407 form.getField('ava_abortscheduledscripts').setDefaultValue(AVA_AbortScheduledScripts);408 form.getField('ava_abortsuitelets').setDefaultValue(AVA_AbortSuitelets);409 form.getField('ava_abortworkflowactionscripts').setDefaultValue(AVA_AbortWorkflowActionScripts);410 411 //Setting Display Type412 form.getField('ava_udf1').setDisplayType('disabled');413 form.getField('ava_udf2').setDisplayType('disabled');414 form.getField('ava_entityusecode').setDisplayType('disabled');415 form.getField('ava_itemaccount').setDisplayType('disabled');416 form.getField('ava_taxcodemapping').setDisplayType('disabled');417 form.getField('ava_defshipcode').setDisplayType('disabled');418 form.getField('ava_customercode').setDisplayType('disabled');419 AVA_MarkCustomerTaxable.setDisplayType('disabled');420 AVA_DefaultCustTaxcode.setDisplayType('disabled');421 form.getField('ava_enableusetax').setDisplayType('disabled');422 form.getField('ava_vendorcode').setDisplayType('disabled');423 form.getField('ava_glaccounts', 'glaccount').setDisplayType('disabled');424 form.getField('ava_glaccounts', 'itemaccount').setDisplayType('disabled');425 form.getField('ava_creditaccount').setDisplayType('disabled');426 form.getField('ava_debitaccount').setDisplayType('disabled');427 if(form.getField('ava_billtimename') != null)428 {429 form.getField('ava_billtimename').setDisplayType('disabled');430 }431 432 form.getField('ava_disabletax').setDisplayType('disabled');433 form.getField('ava_disableline').setDisplayType('disabled');434 form.getField('ava_taxondemand').setDisplayType('disabled');435 form.getField('ava_enablelogging').setDisplayType('disabled');436 form.getField('ava_decimalplaces').setDisplayType('disabled');437 form.getField('ava_taxrate').setDisplayType('disabled');438 form.getField('ava_showmessages').setDisplayType('disabled');439 form.getField('ava_usepostingperiod').setDisplayType('disabled');440 form.getField('ava_taxinclude').setDisplayType('disabled');441 form.getField('ava_enablediscount').setDisplayType('disabled');442 form.getField('ava_discountmapping').setDisplayType('disabled');443 form.getField('ava_discounttaxcode').setDisplayType('disabled');444 form.getField('ava_disableloccode').setDisplayType('disabled');445 form.getField('ava_enableupccode').setDisplayType('disabled');446 447 AVA_DefTaxcode.setDisplayType('disabled'); 448 AVA_DefTaxcodeRate.setDisplayType('normal'); 449 form.getField('ava_abortbulkbilling').setDisplayType('disabled');450 form.getField('ava_abortuserinterfaces').setDisplayType('disabled');451 form.getField('ava_abortwebservices').setDisplayType('disabled');452 form.getField('ava_abortcsvimports').setDisplayType('disabled');453 form.getField('ava_abortscheduledscripts').setDisplayType('disabled');454 form.getField('ava_abortsuitelets').setDisplayType('disabled');455 form.getField('ava_abortworkflowactionscripts').setDisplayType('disabled');456 }457 if(AVA_ServiceTypes.search('AddressSvc') != -1)458 {459 form.addTab('ava_addressvalidation', 'Address Validation');460 // Adding Elements inside Third Tab - Address Validation461 var AVA_DisableAddVal = form.addField('ava_disableaddvalidation', 'checkbox', 'Disable Address Validation', null, 'ava_addressvalidation');462 var AVA_EnableAddressValonTran = form.addField('ava_enableaddvalontran', 'checkbox', 'Enable Address Validation on Transaction(s)', null, 'ava_addressvalidation');463 var AVA_EnableAddressValFlag = form.addField('ava_enableaddvalflag', 'checkbox', 'Track Previously Validated Addresses', null, 'ava_addressvalidation');464 var AVA_UpperCaseAddress = form.addField('ava_uppercaseaddress', 'checkbox', 'Result in Upper Case', null, 'ava_addressvalidation').setLayoutType('startrow','startcol');465 var AVA_AddBatchProField = form.addField('ava_addbatchprocessing', 'select', 'Batch Processing', null, 'ava_addressvalidation');466 AVA_AddBatchProField.addSelectOption('manual', 'Manual');467 AVA_AddBatchProField.addSelectOption('automatic', 'Automatic');468 AVA_AddBatchProField.setHelpText('Manual: Once the addresses are validated, user would need to select all the addresses that he want to get updated in the respective subsidiary/customer or location record(s) manually. \n Automatic: In this case, as soon as the addresses get validated, it will get updated in the respective subsidiary/customer or location record(s) automatically. ', false);469 // Setting Values470 form.getField('ava_disableaddvalidation').setDefaultValue(AVA_DisableAddValidation); 471 form.getField('ava_uppercaseaddress').setDefaultValue(AVA_AddUpperCase); 472 form.getField('ava_addbatchprocessing').setDefaultValue((AVA_AddBatchProcessing == 0) ? 'manual' : 'automatic');473 form.getField('ava_enableaddvalontran').setDefaultValue(AVA_EnableAddValonTran);474 form.getField('ava_enableaddvalflag').setDefaultValue(AVA_EnableAddValFlag);475 476 if(AVA_DisableAddValidation == 'T')477 {478 form.getField('ava_uppercaseaddress').setDefaultValue('F');479 form.getField('ava_uppercaseaddress').setDisplayType('disabled');480 form.getField('ava_addbatchprocessing').setDefaultValue('manual');481 form.getField('ava_addbatchprocessing').setDisplayType('disabled');482 form.getField('ava_enableaddvalontran').setDisplayType('disabled');483 }484 485 AVA_DisableAddVal.setDisplayType('disabled');486 AVA_UpperCaseAddress.setDisplayType('disabled');487 AVA_AddBatchProField.setDisplayType('disabled');488 AVA_EnableAddressValonTran.setDisplayType('disabled');489 AVA_EnableAddressValFlag.setDisplayType('disabled');490 } 491 }492 493 form.addTab('ava_about', 'About Avalara');494 495 // Adding Elements inside Fourth Tab - About AvaTax496 var dYear = new Date();497 var AVA_Copyright = form.addField('ava_copyright', 'help', 'Copyright &copy ' + dYear.getFullYear() + ' Avalara, Inc. All Rights Reserved.', null, 'ava_about');498 499 var AVA_Ver = form.addField('ava_version', 'text', 'Version', null, 'ava_about');500 AVA_Ver.setDisplayType('inline');501 AVA_Ver.setDefaultValue(AVA_ClientAtt);502 503 var AVA_SerVersion = form.addField('ava_serversion', 'text', 'AvaTax Version', null, 'ava_about');504 AVA_SerVersion.setDisplayType('inline');505 AVA_SerVersion.setDefaultValue(AVA_Ping());506 507 var AVA_Email = form.addField('ava_email', 'email', 'Email', null, 'ava_about');508 AVA_Email.setDisplayType('inline');509 AVA_Email.setDefaultValue('support@avalara.com');510 511 var AVA_Phone = form.addField('ava_phone', 'phone', 'Phone', null, 'ava_about');512 AVA_Phone.setDisplayType('inline');513 AVA_Phone.setDefaultValue('(877)-780-4848');514 515 var AVA_Web = form.addField('ava_web', 'url', 'Website', null, 'ava_about');516 AVA_Web.setDisplayType('inline');517 AVA_Web.setDefaultValue('http://www.avalara.com/');518 519 var AVA_AdminConsole = form.addField('ava_adminconsole', 'url', 'AvaTax Connect DashBoard', null, 'ava_about');520 AVA_AdminConsole.setDisplayType('inline');521 AVA_AdminConsole.setDefaultValue((AVA_ServiceUrl.search('development') != -1) ? 'https://admin-development.avalara.net/login.aspx' : 'https://admin-avatax.avalara.net/login.aspx');522 523 var AVA_UserCenter = form.addField('ava_usercenter', 'url', 'Avalara User Center', null, 'ava_about');524 AVA_UserCenter.setDisplayType('inline');525 AVA_UserCenter.setDefaultValue('https://help.avalara.com');526 form.addButton('ava_homepage', 'Home', "window.location = '" + nlapiResolveURL('TASKLINK', 'CARD_-29') + "'");527 response.writePage(form);528 }529 else530 {531 nlapiSetRedirectURL('SUITELET', 'customscript_avaconfig_wizard', 'customdeploy_ava_configurewizard', null, null);532 }533 }534 }535}536function AVA_SetValuesFromGlobals(FormName)537{538 if(FormName.getCurrentStep().getName() == 'ava_credentials')539 { 540 /* Header level Details */541 FormName.getField('ava_accountvalue').setDefaultValue((nlapiGetFieldValue('ava_accountvalue') != null && nlapiGetFieldValue('ava_accountvalue').length > 0 && nlapiGetFieldValue('ava_accountvalue') != AVA_AccountValue) ? nlapiGetFieldValue('ava_accountvalue') : AVA_AccountValue); 542 FormName.getField('ava_licensekey').setDefaultValue((nlapiGetFieldValue('ava_licensekey') != null && nlapiGetFieldValue('ava_licensekey').length > 0 && nlapiGetFieldValue('ava_licensekey') != AVA_LicenseKey) ? nlapiGetFieldValue('ava_licensekey') : AVA_LicenseKey);543 FormName.getField('ava_serviceurl').setDefaultValue((nlapiGetFieldValue('ava_serviceurl') != null && nlapiGetFieldValue('ava_serviceurl').length > 0 && nlapiGetFieldValue('ava_serviceurl') != AVA_ServiceUrl) ? nlapiGetFieldValue('ava_serviceurl') : AVA_ServiceUrl);544 FormName.getField('ava_expirydate').setDefaultValue((nlapiGetFieldValue('ava_expirydate') != null && nlapiGetFieldValue('ava_expirydate').length > 0 && nlapiGetFieldValue('ava_expirydate') != AVA_ExpiryDate) ? nlapiGetFieldValue('ava_expirydate') : AVA_ExpiryDate);545 FormName.getField('ava_enablebatchservice').setDefaultValue((nlapiGetFieldValue('ava_enablebatchservice') != null && nlapiGetFieldValue('ava_enablebatchservice') != AVA_EnableBatchService) ? nlapiGetFieldValue('ava_enablebatchservice') : (AVA_EnableBatchService != null && AVA_EnableBatchService != 'undefined' ? AVA_EnableBatchService : 'F'));546 FormName.getField('ava_username').setDefaultValue((nlapiGetFieldValue('ava_username') != null && nlapiGetFieldValue('ava_username').length > 0 && nlapiGetFieldValue('ava_username') != AVA_Username) ? nlapiGetFieldValue('ava_username') : AVA_Username);547 FormName.getField('ava_password').setDefaultValue((nlapiGetFieldValue('ava_password') != null && nlapiGetFieldValue('ava_password').length > 0 && nlapiGetFieldValue('ava_password') != AVA_Password) ? nlapiGetFieldValue('ava_password') : AVA_Password);548 549 if(AVA_EnableBatchService == 'T')550 {551 FormName.getField('ava_username').setDisplayType('normal');552 FormName.getField('ava_password').setDisplayType('normal');553 }554 }555 556 if(FormName.getCurrentStep().getName() == 'ava_taxsetup1')557 {558 /* General Tab Elements Detail */559 FormName.getField('ava_udf1').setDefaultValue((nlapiGetFieldValue('ava_udf1') != null && nlapiGetFieldValue('ava_udf1') != AVA_UDF1) ? nlapiGetFieldValue('ava_udf1') : (AVA_UDF1 != null && AVA_UDF1 != 'undefined' ? AVA_UDF1 : 'F')); 560 FormName.getField('ava_udf2').setDefaultValue((nlapiGetFieldValue('ava_udf2') != null && nlapiGetFieldValue('ava_udf2') != AVA_UDF2) ? nlapiGetFieldValue('ava_udf2') : (AVA_UDF2 != null && AVA_UDF2 != 'undefined' ? AVA_UDF2 : 'F')); 561 FormName.getField('ava_entityusecode').setDefaultValue((nlapiGetFieldValue('ava_entityusecode') != null && nlapiGetFieldValue('ava_entityusecode') != AVA_EntityUseCode) ? nlapiGetFieldValue('ava_entityusecode') : (AVA_EntityUseCode != null && AVA_EntityUseCode != 'undefined' ? AVA_EntityUseCode : 'F')); 562 FormName.getField('ava_itemaccount').setDefaultValue((nlapiGetFieldValue('ava_itemaccount') != null && nlapiGetFieldValue('ava_itemaccount') != AVA_ItemAccount) ? nlapiGetFieldValue('ava_itemaccount') : (AVA_ItemAccount != null && AVA_ItemAccount != 'undefined' ? AVA_ItemAccount : 'F')); 563 FormName.getField('ava_taxcodemapping').setDefaultValue((nlapiGetFieldValue('ava_taxcodemapping') != null && nlapiGetFieldValue('ava_taxcodemapping') != AVA_TaxCodeMapping) ? nlapiGetFieldValue('ava_taxcodemapping') : (AVA_TaxCodeMapping != null && AVA_TaxCodeMapping != 'undefined' ? AVA_TaxCodeMapping : 'F')); 564 565 if(AVA_CustomerCode != null && AVA_CustomerCode.length > 0)566 {567 FormName.getField('ava_customercode').setDefaultValue((nlapiGetFieldValue('ava_customercode') != null && nlapiGetFieldValue('ava_customercode') != AVA_CustomerCode) ? nlapiGetFieldValue('ava_customercode') : AVA_CustomerCode); 568 }569 else570 {571 FormName.getField('ava_customercode').setDefaultValue('1');572 }573 574 if(AVA_MarkCustTaxable != null && AVA_MarkCustTaxable.length > 0)575 {576 FormName.getField('ava_markcusttaxable').setDefaultValue((nlapiGetFieldValue('ava_markcusttaxable') != null && nlapiGetFieldValue('ava_markcusttaxable') != AVA_MarkCustTaxable) ? nlapiGetFieldValue('ava_markcusttaxable') : AVA_MarkCustTaxable); 577 }578 else579 {580 FormName.getField('ava_markcusttaxable').setDefaultValue('');581 }582 583 if(AVA_DefaultCustomerTaxcode != null && AVA_DefaultCustomerTaxcode.length > 0)584 {585 FormName.getField('ava_defaultcustomer').setDefaultValue((nlapiGetFieldValue('ava_defaultcustomer') != null && nlapiGetFieldValue('ava_defaultcustomer') != AVA_DefaultCustomerTaxcode) ? nlapiGetFieldValue('ava_defaultcustomer') : AVA_DefaultCustomerTaxcode); 586 }587 else588 {589 FormName.getField('ava_defaultcustomer').setDefaultValue('');590 }591 592 if(AVA_ShowMessages != null && AVA_ShowMessages.length > 0)593 {594 FormName.getField('ava_showmessages').setDefaultValue((nlapiGetFieldValue('ava_showmessages') != null && nlapiGetFieldValue('ava_showmessages') != AVA_ShowMessages) ? nlapiGetFieldValue('ava_showmessages') : AVA_ShowMessages); 595 }596 else597 {598 FormName.getField('ava_showmessages').setDefaultValue('3');599 }600 601 if(FormName.getField('ava_billtimename') != null) 602 {603 if(AVA_BillableTimeName != null && AVA_BillableTimeName.length > 0)604 {605 FormName.getField('ava_billtimename').setDefaultValue((nlapiGetFieldValue('ava_billtimename') != null && nlapiGetFieldValue('ava_billtimename') != AVA_BillableTimeName) ? nlapiGetFieldValue('ava_billtimename') : AVA_BillableTimeName); 606 }607 else608 {609 FormName.getField('ava_billtimename').setDefaultValue(0);610 }611 }612 613 FormName.getField('ava_defshipcode').setDefaultValue((nlapiGetFieldValue('ava_defshipcode') != null && nlapiGetFieldValue('ava_defshipcode') != AVA_DefaultShippingCode) ? nlapiGetFieldValue('ava_defshipcode') : AVA_DefaultShippingCode);614 FormName.getField('ava_enableusetax').setDefaultValue((nlapiGetFieldValue('ava_enableusetax') != null && nlapiGetFieldValue('ava_enableusetax') != AVA_EnableUseTax) ? nlapiGetFieldValue('ava_enableusetax') : (AVA_EnableUseTax != null && AVA_EnableUseTax != 'undefined' ? AVA_EnableUseTax : 'F'));615 FormName.getField('ava_glaccounts').setDefaultValue((nlapiGetFieldValue('ava_glaccounts') != null && nlapiGetFieldValue('ava_glaccounts') != AVA_GlAccounts) ? nlapiGetFieldValue('ava_glaccounts') : (AVA_GlAccounts != null && AVA_GlAccounts != 'undefined' ? AVA_GlAccounts : 'itemaccount'));616 617 if(AVA_VendorCode != null && AVA_VendorCode.length > 0)618 {619 FormName.getField('ava_vendorcode').setDefaultValue((nlapiGetFieldValue('ava_vendorcode') != null && nlapiGetFieldValue('ava_vendorcode') != AVA_VendorCode) ? nlapiGetFieldValue('ava_vendorcode') : AVA_VendorCode); 620 }621 else622 {623 FormName.getField('ava_vendorcode').setDefaultValue('1');624 }625 626 if(AVA_UseTaxCredit != null && AVA_UseTaxCredit.length > 0)627 {628 FormName.getField('ava_creditaccount').setDefaultValue((nlapiGetFieldValue('ava_creditaccount') != null && nlapiGetFieldValue('ava_creditaccount') != AVA_UseTaxCredit) ? nlapiGetFieldValue('ava_creditaccount') : AVA_UseTaxCredit); 629 }630 else631 {632 FormName.getField('ava_creditaccount').setDefaultValue('');633 }634 635 if(AVA_UseTaxDebit != null && AVA_UseTaxDebit.length > 0)636 {637 FormName.getField('ava_debitaccount').setDefaultValue((nlapiGetFieldValue('ava_debitaccount') != null && nlapiGetFieldValue('ava_debitaccount') != AVA_UseTaxDebit) ? nlapiGetFieldValue('ava_debitaccount') : AVA_UseTaxDebit); 638 }639 else640 {641 FormName.getField('ava_debitaccount').setDefaultValue('');642 }643 644 if (AVA_EnableUseTax == 'T')645 {646 FormName.getField('ava_vendorcode').setDisplayType('normal');647 FormName.getField('ava_creditaccount').setDisplayType('normal');648 FormName.getField('ava_glaccounts', 'glaccount').setDisplayType('normal');649 FormName.getField('ava_glaccounts', 'itemaccount').setDisplayType('normal');650 if(AVA_GlAccounts == 'glaccount')651 {652 FormName.getField('ava_debitaccount').setDisplayType('normal');653 }654 }655 656 var firstStep = FormName.getStep( "ava_credentials" );657 if(firstStep.getFieldValue('ava_enablebatchservice') == 'T')658 {659 FormName.getField('ava_enableusetax').setDefaultValue('F');660 FormName.getField('ava_enableusetax').setDisplayType('disabled');661 FormName.getField('ava_vendorcode').setDisplayType('disabled');662 FormName.getField('ava_creditaccount').setDisplayType('disabled');663 FormName.getField('ava_glaccounts', 'glaccount').setDisplayType('disabled');664 FormName.getField('ava_glaccounts', 'itemaccount').setDisplayType('disabled');665 FormName.getField('ava_debitaccount').setDisplayType('disabled');666 }667 }668 669 if(FormName.getCurrentStep().getName() == 'ava_taxsetup2')670 {671 /* Tax Calculation Elements Details */ 672 FormName.getField('ava_disabletax').setDefaultValue((nlapiGetFieldValue('ava_disabletax') != null && nlapiGetFieldValue('ava_disabletax') != AVA_DisableTax) ? nlapiGetFieldValue('ava_disabletax') : (AVA_DisableTax != null && AVA_DisableTax != 'undefined' ? AVA_DisableTax : 'F')); 673 if (AVA_DisableTax == 'T')674 {675 FormName.getField('ava_disableline').setDisplayType('disabled');676 FormName.getField('ava_taxondemand').setDisplayType('disabled');677 FormName.getField('ava_enablelogging').setDisplayType('disabled');678 FormName.getField('ava_taxrate').setDisplayType('disabled');679 FormName.getField('ava_decimalplaces').setDisplayType('disabled');680 FormName.getField('ava_usepostingperiod').setDisplayType('disabled');681 FormName.getField('ava_taxinclude').setDisplayType('disabled');682 FormName.getField('ava_enablediscount').setDisplayType('disabled');683 FormName.getField('ava_discountmapping').setDisplayType('disabled');684 FormName.getField('ava_discounttaxcode').setDisplayType('disabled');685 FormName.getField('ava_disableloccode').setDisplayType('disabled');686 FormName.getField('ava_abortbulkbilling').setDisplayType('disabled');687 FormName.getField('ava_abortuserinterfaces').setDisplayType('disabled');688 FormName.getField('ava_abortwebservices').setDisplayType('disabled');689 FormName.getField('ava_abortcsvimports').setDisplayType('disabled');690 FormName.getField('ava_abortscheduledscripts').setDisplayType('disabled');691 FormName.getField('ava_abortsuitelets').setDisplayType('disabled');692 FormName.getField('ava_abortworkflowactionscripts').setDisplayType('disabled');693 }694 695 FormName.getField('ava_disableline').setDefaultValue((nlapiGetFieldValue('ava_disableline') != null && nlapiGetFieldValue('ava_disableline') != AVA_DisableLine) ? nlapiGetFieldValue('ava_disableline') : (AVA_DisableLine != null && AVA_DisableLine != 'undefined' ? AVA_DisableLine : 'T')); 696 FormName.getField('ava_taxondemand').setDefaultValue((nlapiGetFieldValue('ava_taxondemand') != null && nlapiGetFieldValue('ava_taxondemand') != AVA_CalculateonDemand) ? nlapiGetFieldValue('ava_taxondemand') : (AVA_CalculateonDemand != null && AVA_CalculateonDemand != 'undefined' ? AVA_CalculateonDemand : 'F')); 697 FormName.getField('ava_enablelogging').setDefaultValue((nlapiGetFieldValue('ava_enablelogging') != null && nlapiGetFieldValue('ava_enablelogging') != AVA_EnableLogging) ? nlapiGetFieldValue('ava_enablelogging') : (AVA_EnableLogging != null && AVA_EnableLogging != 'undefined' ? AVA_EnableLogging : 'F')); 698 FormName.getField('ava_taxrate').setDefaultValue((nlapiGetFieldValue('ava_taxrate') != null && AVA_TaxRate != null && AVA_TaxRate != undefined && nlapiGetFieldValue('ava_taxrate') != AVA_TaxRate) ? nlapiGetFieldValue('ava_taxrate') : (AVA_TaxRate != null && AVA_TaxRate != 'undefined' ? AVA_TaxRate : '2')); 699 FormName.getField('ava_decimalplaces').setDefaultValue((nlapiGetFieldValue('ava_decimalplaces') != null && AVA_DecimalPlaces != null && AVA_DecimalPlaces != undefined && nlapiGetFieldValue('ava_decimalplaces') != AVA_DecimalPlaces) ? nlapiGetFieldValue('ava_decimalplaces') : (AVA_DecimalPlaces != null && AVA_DecimalPlaces != 'undefined' ? AVA_DecimalPlaces : '2'));700 FormName.getField('ava_usepostingperiod').setDefaultValue((nlapiGetFieldValue('ava_usepostingperiod') != null && nlapiGetFieldValue('ava_usepostingperiod') != AVA_UsePostingPeriod) ? nlapiGetFieldValue('ava_usepostingperiod') : (AVA_UsePostingPeriod != null && AVA_UsePostingPeriod != 'undefined' ? AVA_UsePostingPeriod : 'F'));701 FormName.getField('ava_taxinclude').setDefaultValue((nlapiGetFieldValue('ava_taxinclude') != null && nlapiGetFieldValue('ava_taxinclude') != AVA_TaxInclude) ? nlapiGetFieldValue('ava_taxinclude') : (AVA_TaxInclude != null && AVA_TaxInclude != 'undefined' ? AVA_TaxInclude : 'F'));702 FormName.getField('ava_discounttaxcode').setDefaultValue((nlapiGetFieldValue('ava_discounttaxcode') != null && nlapiGetFieldValue('ava_discounttaxcode') != AVA_DiscountTaxCode) ? nlapiGetFieldValue('ava_discounttaxcode') : (AVA_DiscountTaxCode != null && AVA_DiscountTaxCode != 'undefined' ? AVA_DiscountTaxCode : 'NT'));703 FormName.getField('ava_enablediscount').setDefaultValue((nlapiGetFieldValue('ava_enablediscount') != null && nlapiGetFieldValue('ava_enablediscount') != AVA_EnableDiscount) ? nlapiGetFieldValue('ava_enablediscount') : (AVA_EnableDiscount != null && AVA_EnableDiscount != 'undefined' ? AVA_EnableDiscount : 'F'));704 FormName.getField('ava_discountmapping').setDefaultValue((nlapiGetFieldValue('ava_discountmapping') != null && AVA_DiscountMapping != null && AVA_DiscountMapping != undefined && nlapiGetFieldValue('ava_discountmapping') != AVA_DiscountMapping) ? nlapiGetFieldValue('ava_discountmapping') : (AVA_DiscountMapping != null && AVA_DiscountMapping != 'undefined' ? AVA_DiscountMapping : '1'));705 if (AVA_EnableDiscount == 'T')706 {707 FormName.getField('ava_discountmapping').setDisplayType('normal');708 FormName.getField('ava_discounttaxcode').setDisplayType('normal');709 }710 FormName.getField('ava_disableloccode').setDefaultValue((nlapiGetFieldValue('ava_disableloccode') != null && nlapiGetFieldValue('ava_disableloccode') != AVA_DisableLocationCode) ? nlapiGetFieldValue('ava_disableloccode') : (AVA_DisableLocationCode != null && AVA_DisableLocationCode != 'undefined' ? AVA_DisableLocationCode : 'F'));711 FormName.getField('ava_enableupccode').setDefaultValue((nlapiGetFieldValue('ava_enableupccode') != null && nlapiGetFieldValue('ava_enableupccode') != AVA_EnableUpcCode) ? nlapiGetFieldValue('ava_enableupccode') : (AVA_EnableUpcCode != null && AVA_EnableUpcCode != 'undefined' ? AVA_EnableUpcCode : 'F'));712 FormName.getField('ava_abortbulkbilling').setDefaultValue((nlapiGetFieldValue('ava_abortbulkbilling') != null && AVA_AbortBulkBilling != null && AVA_AbortBulkBilling != undefined && nlapiGetFieldValue('ava_abortbulkbilling') != AVA_AbortBulkBilling) ? nlapiGetFieldValue('ava_abortbulkbilling') : (AVA_AbortBulkBilling != null && AVA_AbortBulkBilling != 'undefined' ? AVA_AbortBulkBilling : 'F')); 713 FormName.getField('ava_abortuserinterfaces').setDefaultValue((nlapiGetFieldValue('ava_abortuserinterfaces') != null && AVA_AbortUserInterfaces != null && AVA_AbortUserInterfaces != undefined && nlapiGetFieldValue('ava_abortuserinterfaces') != AVA_AbortUserInterfaces) ? nlapiGetFieldValue('ava_abortuserinterfaces') : (AVA_AbortUserInterfaces != null && AVA_AbortUserInterfaces != 'undefined' ? AVA_AbortUserInterfaces : 'F')); 714 FormName.getField('ava_abortwebservices').setDefaultValue((nlapiGetFieldValue('ava_abortwebservices') != null && AVA_AbortWebServices != null && AVA_AbortWebServices != undefined && nlapiGetFieldValue('ava_abortwebservices') != AVA_AbortWebServices) ? nlapiGetFieldValue('ava_abortwebservices') : (AVA_AbortWebServices != null && AVA_AbortWebServices != 'undefined' ? AVA_AbortWebServices : 'F')); 715 FormName.getField('ava_abortcsvimports').setDefaultValue((nlapiGetFieldValue('ava_abortcsvimports') != null && AVA_AbortCSVImports != null && AVA_AbortCSVImports != undefined && nlapiGetFieldValue('ava_abortcsvimports') != AVA_AbortCSVImports) ? nlapiGetFieldValue('ava_abortcsvimports') : (AVA_AbortCSVImports != null && AVA_AbortCSVImports != 'undefined' ? AVA_AbortCSVImports : 'F')); 716 FormName.getField('ava_abortscheduledscripts').setDefaultValue((nlapiGetFieldValue('ava_abortscheduledscripts') != null && AVA_AbortScheduledScripts != null && AVA_AbortScheduledScripts != undefined && nlapiGetFieldValue('ava_abortscheduledscripts') != AVA_AbortScheduledScripts) ? nlapiGetFieldValue('ava_abortscheduledscripts') : (AVA_AbortScheduledScripts != null && AVA_AbortScheduledScripts != 'undefined' ? AVA_AbortScheduledScripts : 'F')); 717 FormName.getField('ava_abortsuitelets').setDefaultValue((nlapiGetFieldValue('ava_abortsuitelets') != null && AVA_AbortSuitelets != null && AVA_AbortSuitelets != undefined && nlapiGetFieldValue('ava_abortsuitelets') != AVA_AbortSuitelets) ? nlapiGetFieldValue('ava_abortsuitelets') : (AVA_AbortSuitelets != null && AVA_AbortSuitelets != 'undefined' ? AVA_AbortSuitelets : 'F')); 718 FormName.getField('ava_abortworkflowactionscripts').setDefaultValue((nlapiGetFieldValue('ava_abortworkflowactionscripts') != null && AVA_AbortWorkflowActionScripts != null && AVA_AbortWorkflowActionScripts != undefined && nlapiGetFieldValue('ava_abortworkflowactionscripts') != AVA_AbortWorkflowActionScripts) ? nlapiGetFieldValue('ava_abortworkflowactionscripts') : (AVA_AbortWorkflowActionScripts != null && AVA_AbortWorkflowActionScripts != 'undefined' ? AVA_AbortWorkflowActionScripts : 'F'));719 }720 721 if(FormName.getCurrentStep().getName() == 'ava_addsetup')722 { 723 FormName.getField('ava_disableaddvalidation').setDefaultValue((nlapiGetFieldValue('ava_disableaddvalidation') != null && nlapiGetFieldValue('ava_disableaddvalidation') != AVA_DisableAddValidation) ? nlapiGetFieldValue('ava_disableaddvalidation') : (AVA_DisableAddValidation != null && AVA_DisableAddValidation != 'undefined' ? AVA_DisableAddValidation : 'F')); 724 FormName.getField('ava_uppercaseaddress').setDefaultValue((nlapiGetFieldValue('ava_uppercaseaddress') != null && nlapiGetFieldValue('ava_uppercaseaddress') != AVA_AddUpperCase) ? nlapiGetFieldValue('ava_uppercaseaddress') : (AVA_AddUpperCase != null && AVA_AddUpperCase != 'undefined' ? AVA_AddUpperCase : 'F')); 725 FormName.getField('ava_addbatchprocessing').setDefaultValue((nlapiGetFieldValue('ava_addbatchprocessing') != null && nlapiGetFieldValue('ava_addbatchprocessing') != ((AVA_AddBatchProcessing == 0) ? 'manual' : 'automatic')) ? nlapiGetFieldValue('ava_addbatchprocessing') : ((AVA_AddBatchProcessing == 0) ? 'manual' : 'automatic'));726 FormName.getField('ava_enableaddvalontran').setDefaultValue((nlapiGetFieldValue('ava_enableaddvalontran') != null && nlapiGetFieldValue('ava_enableaddvalontran') != AVA_EnableAddValonTran) ? nlapiGetFieldValue('ava_enableaddvalontran') : (AVA_EnableAddValonTran != null && AVA_EnableAddValonTran != 'undefined' ? AVA_EnableAddValonTran : 'F'));727 FormName.getField('ava_enableaddvalflag').setDefaultValue((nlapiGetFieldValue('ava_enableaddvalflag') != null && nlapiGetFieldValue('ava_enableaddvalflag') != AVA_EnableAddValFlag) ? nlapiGetFieldValue('ava_enableaddvalflag') : (AVA_EnableAddValFlag != null && AVA_EnableAddValFlag != 'undefined' ? AVA_EnableAddValFlag : 'F'));728 729 if(AVA_DisableAddValidation == 'T')730 {731 FormName.getField('ava_uppercaseaddress').setDefaultValue('F');732 FormName.getField('ava_uppercaseaddress').setDisplayType('disabled');733 FormName.getField('ava_addbatchprocessing').setDefaultValue('manual');734 FormName.getField('ava_addbatchprocessing').setDisplayType('disabled');735 FormName.getField('ava_enableaddvalontran').setDisplayType('disabled');736 FormName.getField('ava_enableaddvalflag').setDisplayType('disabled');737 }738 }739}740function AVA_ConfigWizardChanged(type, name, linenum)741{742 var AVA_TaxInit;743 var AVA_Address = new Array(7);744 var address = '';745 var AVA_Changed = 'F';746 747 /* Start of 1st Check */748 if (name == 'ava_disabletax')749 {750 if (nlapiGetFieldValue('ava_disabletax') == 'T')751 {752 if (confirm('Are you sure you want to disable AvaTax Tax Calculation ?') == true)753 {754 AVA_DisableTaxFields(true);755 }756 else757 {758 nlapiSetFieldValue('ava_disabletax', 'F');759 }760 }761 else762 {763 AVA_DisableTaxFields(false);764 }765 }766 /* End of 1st Check */ 767 /* Start of 2nd Check */ 768 if(name == 'ava_deftaxcode')769 {770 var val = nlapiGetCurrentLineItemValue('custpage_subsidiarylist', 'ava_deftaxcode', linenum);771 val = (val != null && val.length > 0) ? val.substr(val.lastIndexOf('+') + 1, val.length) : '';772 773 nlapiSetCurrentLineItemValue('custpage_subsidiarylist', 'ava_deftaxcoderate', val);774 nlapiSetCurrentLineItemValue('custpage_subsidiarylist', 'ava_deftaxcodecountry', val);775 776 var CurrentTaxCode = nlapiGetCurrentLineItemValue('custpage_subsidiarylist', 'ava_deftaxcodecountry');777 778 var SubNexuses = new Array();779 SubNexuses = nlapiGetCurrentLineItemValue('custpage_subsidiarylist','ava_subnexuses').split(',');780 781 if(CurrentTaxCode != null && CurrentTaxCode.length > 0 && SubNexuses != null && SubNexuses.length-1 > 0)782 {783 for(var i = 0; i < SubNexuses.length-1; i++)784 {785 if (nlapiGetCurrentLineItemText('custpage_subsidiarylist', 'ava_deftaxcodecountry') == SubNexuses[i])786 {787 var TaxRate = nlapiGetCurrentLineItemText('custpage_subsidiarylist', 'ava_deftaxcoderate');788 TaxRate = (TaxRate.indexOf('%') == -1)? TaxRate : TaxRate.substr(0, TaxRate.indexOf('%'));789 790 var TaxCodeValidate = (parseFloat(TaxRate) > 0)? 3 : 1;791 nlapiSetCurrentLineItemValue('custpage_subsidiarylist', 'ava_taxcodevalidate', TaxCodeValidate);792 break;793 }794 else795 {796 nlapiSetCurrentLineItemValue('custpage_subsidiarylist', 'ava_taxcodevalidate', 2);797 }798 }799 }800 else801 { 802 nlapiSetCurrentLineItemValue('custpage_subsidiarylist', 'ava_taxcodevalidate', '');803 }804 }805 806 /* End of 2nd Check */ 807 808 if(name == 'ava_disableaddvalidation')809 {810 if(nlapiGetFieldValue('ava_disableaddvalidation') == 'T')811 {812 nlapiDisableField('ava_enableaddvalontran', true);813 nlapiDisableField('ava_enableaddvalflag', true);814 nlapiSetFieldValue('ava_uppercaseaddress', 'F');815 nlapiDisableField('ava_uppercaseaddress', true);816 nlapiSetFieldValue('ava_addbatchprocessing', 'manual');817 nlapiDisableField('ava_addbatchprocessing', true);818 }819 else if(nlapiGetFieldValue('ava_disableaddvalidation') == 'F')820 {821 nlapiDisableField('ava_enableaddvalontran', false);822 nlapiDisableField('ava_enableaddvalflag', false);823 nlapiDisableField('ava_uppercaseaddress', false);824 nlapiDisableField('ava_addbatchprocessing', false);825 }826 }827 828 /* Start of 3rd check */829 if(name == 'ava_customercode')830 {831 if(nlapiGetFieldValue('ava_customercode') >= 3)832 {833 if(nlapiGetContext().getFeature('prm') != true)834 {835 alert('Partner information cannot be passed to service as the required features are not enabled.');836 }837 else838 {839 if(nlapiGetContext().getFeature('multipartner') == true)840 {841 alert('Customer information will be passed to the service as Multi-Partner Management feature is enabled.');842 }843 }844 }845 }846 847 if(name == 'ava_enablebatchservice')848 {849 var displaytype = (nlapiGetFieldValue('ava_enablebatchservice') == 'T') ? false : true;850 nlapiDisableField('ava_username', displaytype);851 nlapiDisableField('ava_password', displaytype);852 }853 854 if(name == 'ava_licensekey' && AVA_EncryptFlag == 0)855 {856 var licensekey = nlapiGetFieldValue('ava_licensekey');857 if(licensekey != null && licensekey.length > 0)858 {859 if(licensekey.length > 16)860 {861 licensekey = licensekey.substring(0, 16);862 }863 864 AVA_EncryptFlag = 1;865 nlapiSetFieldValue('ava_licensekey', nlapiEncrypt(licensekey, 'base64'));866 }867 }868 869 if(name == 'ava_password' && AVA_EncryptFlag == 0)870 {871 var password = nlapiGetFieldValue('ava_password');872 if(password != null && password.length > 0)873 {874 if(password.length > 50)875 {876 password = password.substring(0, 50);877 }878 879 AVA_EncryptFlag = 1;880 nlapiSetFieldValue('ava_password', nlapiEncrypt(password, 'base64'));881 }882 }883 if(name == 'ava_enablediscount')884 {885 var displaytype = (nlapiGetFieldValue('ava_enablediscount') == 'T') ? false : true;886 nlapiDisableField('ava_discountmapping', displaytype);887 nlapiDisableField('ava_discounttaxcode', displaytype);888 }889 890 if(name == 'ava_enableusetax')891 {892 var displaytype = (nlapiGetFieldValue('ava_enableusetax') == 'T') ? false : true;893 nlapiDisableField('ava_vendorcode', displaytype);894 nlapiDisableField('ava_creditaccount', displaytype);895 nlapiDisableField('ava_glaccounts', displaytype);896 if(nlapiGetFieldValue('ava_glaccounts') == 'glaccount')897 {898 nlapiDisableField('ava_debitaccount', displaytype);899 }900 }901 902 if(name == 'ava_glaccounts')903 {904 if(nlapiGetFieldValue('ava_glaccounts') == 'glaccount')905 {906 nlapiDisableField('ava_debitaccount', false);907 }908 else909 {910 nlapiDisableField('ava_debitaccount', true);911 }912 }913 914 AVA_EncryptFlag = 0;915}916function AVA_DisableTaxFields(displaytype)917{918 nlapiDisableField('ava_disableline', displaytype);919 nlapiDisableField('ava_taxondemand', displaytype);920 nlapiDisableField('ava_enablelogging', displaytype);921 nlapiDisableField('ava_taxrate', displaytype);922 nlapiDisableField('ava_decimalplaces', displaytype);923 nlapiDisableField('ava_usepostingperiod', displaytype);924 nlapiDisableField('ava_taxinclude', displaytype);925 nlapiDisableField('ava_enablediscount', displaytype);926 var display = (displaytype == true) ? true : ((nlapiGetFieldValue('ava_enablediscount') == 'T') ? false : true);927 nlapiDisableField('ava_discountmapping', display);928 nlapiDisableField('ava_discounttaxcode', display);929 nlapiDisableField('ava_disableloccode', displaytype);930 nlapiDisableField('ava_enableupccode', displaytype);931 nlapiDisableField('ava_abortbulkbilling', displaytype);932 nlapiDisableField('ava_abortuserinterfaces', displaytype);933 nlapiDisableField('ava_abortwebservices', displaytype);934 nlapiDisableField('ava_abortcsvimports', displaytype);935 nlapiDisableField('ava_abortscheduledscripts', displaytype);936 nlapiDisableField('ava_abortsuitelets', displaytype);937 nlapiDisableField('ava_abortworkflowactionscripts', displaytype);938}939//Script for creating subsidiaries - no more a Scheduled script940function AVA_SubsidiaryCreation()941{942 var customSubs = new Array();943 944 var cols = new Array();945 cols[0] = new nlobjSearchColumn('custrecord_ava_subsidiary');946 947 var searchCustom = nlapiSearchRecord('customrecord_avasubsidiaries', null, null, cols);948 949 for(var k=0; searchCustom != null && k < searchCustom.length ; k++)950 {951 customSubs[k] = searchCustom[k].getValue('custrecord_ava_subsidiary');952 }953 954 var searchResult;955 var filter = new Array();956 filter[0] = new nlobjSearchFilter('isinactive',null,'is','F');957 958 if(customSubs != null && customSubs.length > 0)959 {960 filter[1] = new nlobjSearchFilter('internalid', null, 'noneof', customSubs);961 }962 963 searchResult = nlapiSearchRecord('subsidiary', null, filter, null);964 965 for(var i=0; searchResult != null && i < searchResult.length ; i++)966 {967 var subRecord = nlapiLoadRecord('subsidiary',searchResult[i].getId());968 969 var record = nlapiCreateRecord('customrecord_avasubsidiaries');970 record.setFieldValue('custrecord_ava_subsidiary', subRecord.getId());971 //record.setFieldValue('custrecord_ava_subdeftaxcode', request.getLineItemValue('custpage_subsidiarylist','ava_deftaxcode',k+1));972 record.setFieldValue('custrecord_ava_companyaddr', subRecord.getFieldValue('addrtext'));973 record.setFieldValue('custrecord_ava_shipaddr', subRecord.getFieldValue('shipaddr'));974 record.setFieldValue('custrecord_ava_iscompanyaddr', 'T');975 record.setFieldValue('custrecord_ava_subname', subRecord.getFieldValue('name'));976 977 var nexuses = '';978 for(var j=0; j<subRecord.getLineItemCount('nexus'); j++)979 {980 nexuses += subRecord.getLineItemValue('nexus','country',j+1) + ',';981 }982 record.setFieldValue('custrecord_ava_subnexuses', nexuses);983 var recId = nlapiSubmitRecord(record);984 }985} 986function AVA_ConfigWizardSave()987{988 var connResult = true;989 if(nlapiGetFieldValue('ava_servicetypes') != null)990 {991 connResult = AVA_ConfigTestConnection();992 nlapiSetFieldValue('ava_servicetypes', AVA_ServiceTypes);993 }994 995 var AVA_SubsidiaryFlag = 'F';996 if (nlapiGetLineItemCount('custpage_subsidiarylist') != null)997 {998 for (i = 0, cnt=0; i < nlapiGetLineItemCount('custpage_subsidiarylist'); i++)999 {1000 var TaxCodeValidate = nlapiGetLineItemValue('custpage_subsidiarylist', 'ava_taxcodevalidate', i+1);1001 var SubsidiaryName = nlapiGetLineItemValue('custpage_subsidiarylist', 'ava_subsidiary', i+1);1002 var TaxRate = nlapiGetLineItemValue('custpage_subsidiarylist', 'ava_deftaxcoderate', i+1);1003 var DefaultAddr = nlapiGetLineItemValue('custpage_subsidiarylist', 'ava_defaultaddr', i+1);1004 var CompanyAddr = nlapiGetLineItemValue('custpage_subsidiarylist', 'ava_companyaddr', i+1);1005 var ShipAddr = nlapiGetLineItemValue('custpage_subsidiarylist', 'ava_shipaddr', i+1);1006 if (TaxCodeValidate == '')1007 {1008 AVA_SubsidiaryFlag = 'F';1009 cnt++;1010 }1011 else if (TaxCodeValidate == '2')1012 {1013 alert('The Tax Code selected for subsidiary \"' + SubsidiaryName + '\" does not have any association with the associated nexus for the subsidiary.');1014 AVA_SubsidiaryFlag = 'F';1015 return false;1016 }1017 else if(TaxCodeValidate == '3')1018 {1019 alert('The Tax Rate assigned for subsidiary \"' + SubsidiaryName + '\" should be equal to zero.');1020 AVA_SubsidiaryFlag = 'F';1021 return false;1022 }1023 else1024 {1025 if (DefaultAddr == 'companyaddr' && (CompanyAddr == null || CompanyAddr.length == 0))1026 {1027 alert('The Company Address assigned for subsidiary \"' + SubsidiaryName + '\" cannot be blank.'); 1028 return false;1029 }1030 else if (DefaultAddr == 'shippingaddr' && (ShipAddr == null || ShipAddr.length == 0))1031 {1032 alert('The Shipping Address assigned for subsidiary \"' + SubsidiaryName + '\" cannot be blank.'); 1033 return false;1034 }1035 AVA_SubsidiaryFlag = 'T';1036 }1037 }1038 if(AVA_SubsidiaryFlag == 'F' && cnt == nlapiGetLineItemCount('custpage_subsidiarylist'))1039 {1040 alert('The configuration options cannot be saved without any taxcodes being assigned for subsidiaries');1041 return false;1042 }1043 }1044 if(nlapiGetFieldValue('ava_customercode') >= 3)1045 {1046 if(nlapiGetContext().getFeature('prm') != true)1047 {1048 alert('Partner information cannot be passed to service as the required features are not enabled.');1049 return false;1050 }1051 }1052 1053 if(nlapiGetFieldValue('ava_enablediscount') == 'T')1054 {1055 if(nlapiGetFieldValue('ava_discounttaxcode') == null || nlapiGetFieldValue('ava_discounttaxcode').length == 0)1056 {1057 alert('Please Enter Discount Tax Code');1058 return false;1059 }1060 }1061 1062 if(nlapiGetFieldValue('ava_enableusetax') == 'T' && nlapiGetFieldValue('ava_creditaccount') != null && nlapiGetFieldValue('ava_debitaccount') != null)1063 {1064 nlapiSetFieldValue('ava_glaccountstext', nlapiGetFieldValue('ava_glaccounts'));1065 if(nlapiGetFieldValue('ava_creditaccount') == null || nlapiGetFieldValue('ava_creditaccount').length == 0)1066 {1067 alert('Please select Use Tax Payable Liability Account');1068 return false;1069 }1070 if(nlapiGetFieldValue('ava_glaccounts') == 'glaccount' && (nlapiGetFieldValue('ava_debitaccount') == null || nlapiGetFieldValue('ava_debitaccount').length == 0))1071 {1072 alert('Please select Use Tax Debit Account');1073 return false;1074 }1075 }1076 return connResult;1077}1078function AVA_LoadConfigData(assistant)1079{1080 var searchresult = nlapiSearchRecord('customrecord_avaconfig', null, null, null);1081 1082 if(searchresult != null && searchresult.length > 0)1083 {1084 var AVA_Record = nlapiLoadRecord('customrecord_avaconfig', searchresult[0].getId());1085 var AVA_LoadValues = AVA_LoadValuesToGlobals(AVA_Record); 1086 }1087 1088 AVA_SetValuesFromGlobals(assistant);1089}1090function AVA_AvaTaxConfigurationWizard(request, response)1091{1092 var assistant = nlapiCreateAssistant("Avalara Configuration Assistant", false); 1093 assistant.setOrdered( true );1094 1095 assistant.addStep('ava_credentials', 'Enter Avalara Credentials').setHelpText( "Enter Avalara credentials provided to you at the time of registration.");1096 assistant.addStep('ava_taxsetup1', 'General Settings ').setHelpText("General settings related to Avalara Service.");1097 assistant.addStep('ava_taxsetup2', 'Tax Calculation Settings ').setHelpText("Settings related to Avalara Tax Calculation."); 1098 assistant.addStep('ava_addsetup', 'Address Validation Settings ').setHelpText("Settings related to Avalara Address Service.");1099 assistant.addStep('ava_info', 'Avalara Details').setHelpText("Avalara Information.");1100 1101 /* handle page load (GET) requests. */1102 if (request.getMethod() == 'GET')1103 {1104 assistant.setScript('customscript_avaconfig_client');1105 1106 /*.Check whether the assistant is finished */1107 if ( !assistant.isFinished() )1108 {1109 // If initial step, set the Splash page and set the intial step1110 if ( assistant.getCurrentStep() == null )1111 {1112 assistant.setCurrentStep(assistant.getStep( 'ava_credentials' ) ); 1113 assistant.setSplash("Welcome to the AvaTax Configuration Assistant!", "<b>What you'll be doing</b><br>The AvaTax Configuration Setup Assistant will walk you through the process of configuring your NetSuite account to run AvaTax utility.", "<b>When you finish</b><br>your account will be ready to make AvaTax service calls as per the settings you made.");1114 }1115 1116 var step = assistant.getCurrentStep(); 1117 1118 // Build the page for a step by adding fields, field groups, and sublists to the assistant 1119 if (step.getName() == 'ava_credentials')1120 {1121 AVA_AvaTaxConfigSetup(assistant); 1122 AVA_LoadConfigData(assistant);1123 }1124 else if (step.getName() == 'ava_taxsetup1')1125 {1126 var firstStep = assistant.getStep( "ava_credentials" );1127 1128 AVA_ServiceTypes = firstStep.getFieldValue('ava_servicetypes');1129 if(AVA_ServiceTypes != null && AVA_ServiceTypes.search('TaxSvc') != -1)1130 {1131 AVA_GeneralConfigSetup(assistant);1132 1133 } 1134 else if(AVA_ServiceTypes != null && AVA_ServiceTypes.search('AddressSvc') != -1)1135 {1136 assistant.setCurrentStep(assistant.getStep( "ava_addsetup" )); 1137 1138 AVA_AddressConfigSetup(assistant);1139 }1140 else1141 {1142 assistant.setCurrentStep(assistant.getStep( "ava_info" ));1143 AVA_AboutAvaTaxConfig(assistant);1144 } 1145 }1146 else if (step.getName() == 'ava_taxsetup2')1147 {1148 var firstStep = assistant.getStep("ava_credentials");1149 1150 AVA_ServiceTypes = firstStep.getFieldValue('ava_servicetypes');1151 1152 if(assistant.getLastStep().getName() == "ava_addsetup" && AVA_ServiceTypes != null && AVA_ServiceTypes.search("TaxSvc") == -1)1153 {1154 assistant.setCurrentStep(assistant.getStep( "ava_credentials" )); 1155 AVA_AvaTaxConfigSetup(assistant);1156 } 1157 else1158 { 1159 AVA_TaxCalcConfigSetup(assistant); 1160 }1161 1162 } 1163 else if (step.getName() == 'ava_addsetup') 1164 {1165 var firstStep = assistant.getStep("ava_credentials");1166 1167 AVA_ServiceTypes = firstStep.getFieldValue('ava_servicetypes');1168 1169 if(assistant.getLastStep().getName() == "ava_info" && AVA_ServiceTypes != null && AVA_ServiceTypes.search("AddressSvc") == -1)1170 {1171 if(AVA_ServiceTypes.search("TaxSvc") != -1)1172 {1173 assistant.setCurrentStep(assistant.getStep( "ava_taxsetup2" )); 1174 AVA_TaxCalcConfigSetup(assistant); 1175 }1176 else1177 {1178 assistant.setCurrentStep(assistant.getStep( "ava_credentials" )); 1179 AVA_AvaTaxConfigSetup(assistant);1180 }1181 } 1182 else1183 {1184 if(AVA_ServiceTypes != null && AVA_ServiceTypes.search("AddressSvc") != -1)1185 {1186 assistant.setCurrentStep(assistant.getStep( "ava_addsetup" ));1187 AVA_AddressConfigSetup(assistant);1188 }1189 else1190 {1191 //show final page1192 assistant.setCurrentStep(assistant.getStep( "ava_info" ));1193 AVA_AboutAvaTaxConfig(assistant);1194 }1195 }1196 }1197 else if (step.getName() == 'ava_info') 1198 {1199 1200 assistant.setCurrentStep(assistant.getStep( "ava_info" ));1201 AVA_AboutAvaTaxConfig(assistant);1202 1203 }1204 } 1205 1206 response.writePage(assistant);1207 1208 } 1209 /* handle user submit (POST) requests. */ 1210 else 1211 { 1212 assistant.setError( null ); 1213 1214 if (assistant.getLastAction() == "finish")1215 { 1216 var crdntlStep = assistant.getStep( 'ava_credentials' );1217 var gnlStep = assistant.getStep( 'ava_taxsetup1' ); 1218 var taxStep = assistant.getStep( 'ava_taxsetup2' );1219 var addStep = assistant.getStep( 'ava_addsetup' );1220 1221 var searchresult = nlapiSearchRecord('customrecord_avaconfig', null, null, null);1222 1223 if (searchresult != null && searchresult.length > 0)1224 {1225 var record = nlapiLoadRecord('customrecord_avaconfig', searchresult[0].getId());1226 }1227 else1228 {1229 var record = nlapiCreateRecord('customrecord_avaconfig');1230 }1231 1232 record.setFieldValue('custrecord_ava_accountvalue', crdntlStep.getFieldValue('ava_accountvalue')); 1233 record.setFieldValue('custrecord_ava_licensekey', crdntlStep.getFieldValue('ava_licensekey')); 1234 record.setFieldValue('custrecord_ava_url', crdntlStep.getFieldValue('ava_serviceurl')); 1235 record.setFieldValue('custrecord_ava_servicetypes', crdntlStep.getFieldValue('ava_servicetypes')); 1236 record.setFieldValue('custrecord_ava_expirydate', crdntlStep.getFieldValue('ava_expirydate')); 1237 record.setFieldValue('custrecord_ava_enablebatchservice', crdntlStep.getFieldValue('ava_enablebatchservice')); 1238 if(crdntlStep.getFieldValue('ava_enablebatchservice') == 'T')1239 {1240 record.setFieldValue('custrecord_ava_username', crdntlStep.getFieldValue('ava_username')); 1241 record.setFieldValue('custrecord_ava_password', crdntlStep.getFieldValue('ava_password'));1242 }1243 1244 /* General Tab Elements Detail */1245 record.setFieldValue('custrecord_ava_udf1', gnlStep.getFieldValue('ava_udf1') ); 1246 record.setFieldValue('custrecord_ava_udf2', gnlStep.getFieldValue('ava_udf2')); 1247 record.setFieldValue('custrecord_ava_entityusecode', gnlStep.getFieldValue('ava_entityusecode')); 1248 record.setFieldValue('custrecord_ava_itemaccount', gnlStep.getFieldValue('ava_itemaccount')); 1249 record.setFieldValue('custrecord_ava_taxcodemapping', gnlStep.getFieldValue('ava_taxcodemapping')); 1250 record.setFieldValue('custrecord_ava_customercode', gnlStep.getFieldValue('ava_customercode'));1251 record.setFieldValue('custrecord_ava_markcusttaxable', gnlStep.getFieldValue('ava_markcusttaxable'));1252 record.setFieldValue('custrecord_ava_defaultcustomer', gnlStep.getFieldValue('ava_defaultcustomer'));1253 record.setFieldValue('custrecord_ava_showmessages', gnlStep.getFieldValue('ava_showmessages'));1254 1255 if(gnlStep.getFieldValue('ava_billtimename') != null && gnlStep.getFieldValue('ava_billtimename').length > 0)1256 {1257 record.setFieldValue('custrecord_ava_billtimename', gnlStep.getFieldValue('ava_billtimename'));1258 }1259 1260 var defshipcode = gnlStep.getFieldValue('ava_defshipcode');1261 defshipcode = (defshipcode != null && defshipcode.length > 1)? defshipcode.substring(0,(defshipcode.length)): defshipcode;1262 1263 record.setFieldValue('custrecord_ava_defshipcode', defshipcode);1264 record.setFieldValue('custrecord_ava_enableusetax', gnlStep.getFieldValue('ava_enableusetax'));1265 if(gnlStep.getFieldValue('ava_enableusetax') == 'T')1266 {1267 record.setFieldValue('custrecord_ava_vendorcode', gnlStep.getFieldValue('ava_vendorcode'));1268 record.setFieldValue('custrecord_ava_glaccounts', gnlStep.getFieldValue('ava_glaccountstext'));1269 record.setFieldValue('custrecord_ava_usetaxcredit', gnlStep.getFieldValue('ava_creditaccount'));1270 if(gnlStep.getFieldValue('ava_glaccounts') == 'glaccount')1271 {1272 record.setFieldValue('custrecord_ava_usetaxdebit', gnlStep.getFieldValue('ava_debitaccount'));1273 }1274 }1275 1276 /* Tax Calculation Elements Details */ 1277 record.setFieldValue('custrecord_ava_disabletax', taxStep.getFieldValue('ava_disabletax')); 1278 record.setFieldValue('custrecord_ava_disableline', taxStep.getFieldValue('ava_disableline')); 1279 record.setFieldValue('custrecord_ava_taxondemand', taxStep.getFieldValue('ava_taxondemand'));1280 record.setFieldValue('custrecord_ava_enablelogging', taxStep.getFieldValue('ava_enablelogging'));1281 record.setFieldValue('custrecord_ava_taxrate', taxStep.getFieldValue('ava_taxrate'));1282 record.setFieldValue('custrecord_ava_decimalplaces', taxStep.getFieldValue('ava_decimalplaces'));1283 record.setFieldValue('custrecord_ava_usepostingdate', taxStep.getFieldValue('ava_usepostingperiod'));1284 record.setFieldValue('custrecord_ava_taxinclude', taxStep.getFieldValue('ava_taxinclude'));1285 record.setFieldValue('custrecord_ava_enablediscount', taxStep.getFieldValue('ava_enablediscount'));1286 record.setFieldValue('custrecord_ava_discountmapping', taxStep.getFieldValue('ava_discountmapping'));1287 record.setFieldValue('custrecord_ava_discounttaxcode', taxStep.getFieldValue('ava_discounttaxcode'));1288 record.setFieldValue('custrecord_ava_disableloccode', taxStep.getFieldValue('ava_disableloccode'));1289 record.setFieldValue('custrecord_ava_enableupccode', taxStep.getFieldValue('ava_enableupccode'));1290 1291 record.setFieldValue('custrecord_ava_abortbulkbilling', taxStep.getFieldValue('ava_abortbulkbilling'));1292 record.setFieldValue('custrecord_ava_abortuserinterfaces', taxStep.getFieldValue('ava_abortuserinterfaces'));1293 record.setFieldValue('custrecord_ava_abortwebservices', taxStep.getFieldValue('ava_abortwebservices'));1294 record.setFieldValue('custrecord_ava_abortcsvimports', taxStep.getFieldValue('ava_abortcsvimports'));1295 record.setFieldValue('custrecord_ava_abortscheduledscripts', taxStep.getFieldValue('ava_abortscheduledscripts'));1296 record.setFieldValue('custrecord_ava_abortsuitelets', taxStep.getFieldValue('ava_abortsuitelets'));1297 record.setFieldValue('custrecord_ava_abortworkflowscripts', taxStep.getFieldValue('ava_abortworkflowactionscripts'));1298 1299 /* Address Validation Elements Details */1300 record.setFieldValue('custrecord_ava_disableaddvalidation', addStep.getFieldValue('ava_disableaddvalidation'));1301 record.setFieldValue('custrecord_ava_adduppercase', addStep.getFieldValue('ava_uppercaseaddress'));1302 record.setFieldValue('custrecord_ava_addbatchprocessing', (addStep.getFieldValue('ava_addbatchprocessing') == 'manual' ? '0' : '1'));1303 record.setFieldValue('custrecord_ava_enableaddvalontran', addStep.getFieldValue('ava_enableaddvalontran'));1304 record.setFieldValue('custrecord_ava_enableaddvalflag', addStep.getFieldValue('ava_enableaddvalflag'));1305 var avaidl = nlapiSubmitRecord(record, false);1306 for(var k=0 ; k < taxStep.getLineItemCount('custpage_subsidiarylist'); k++)1307 {1308 var SubRecord = taxStep.getLineItemValue('custpage_subsidiarylist','ava_customsubid',k+1);1309 1310 if(SubRecord !=null && SubRecord.length > 0)1311 {1312 var fields = new Array();1313 var values = new Array();1314 1315 fields[fields.length] = 'custrecord_ava_subdeftaxcode';1316 values[values.length] = taxStep.getLineItemValue('custpage_subsidiarylist','ava_deftaxcode',k+1);1317 1318 fields[fields.length] = 'custrecord_ava_configrecord';1319 values[values.length] = avaidl;1320 1321 fields[fields.length] = 'custrecord_ava_iscompanyaddr';1322 values[values.length] = (taxStep.getLineItemValue('custpage_subsidiarylist','ava_defaultaddr',k+1) == 'companyaddr') ? 'T' : 'F';1323 1324 nlapiSubmitField('customrecord_avasubsidiaries', SubRecord, fields, values);1325 }1326 } 1327 1328 var configSuitelet = nlapiResolveURL('SUITELET', 'customscript_avaconfig_suitlet', 'customdeploy_configuration', null, null);1329 var wizardSuitelet = nlapiResolveURL('SUITELET', 'customscript_avaconfig_wizard', 'customdeploy_ava_configurewizard', null, null);1330 1331 var finishedText = "Congratulations! You have completed the Avalara Configuration Assistant.<tr><td colspan=2> &nbsp; </td></tr>";1332 finishedText += "<tr><td colspan=2 class=text align=left>Quick Links</td></tr><tr><td class=textbold style='padding-left:50; padding-top:20' colspan=2 align=left valign=top><a href='" + configSuitelet + "'>View Avalara Configuration</a></td></tr>"; 1333 finishedText += "<tr><td class=text colspan=2 style='padding-left:50;' align=left valign=top>Click this link to view the Avalara Configuration settings done.</td></tr>"; 1334 finishedText += "<tr> <td class=textbold style='padding-left:50; padding-top:20' colspan=2 align=left valign=top><a href='" + wizardSuitelet + "'>Modify Avalara Configuration</a></td></tr>"; 1335 finishedText += "<tr><td class=text colspan=2 style='padding-left:50;' align=left valign=top>Click this link to change any Avalara configuration details.</td></tr>"; 1336 1337 assistant.setFinished(finishedText); 1338 1339 assistant.sendRedirect( response ); 1340 1341 } 1342 /* 2. if they clicked the "cancel" button, take them to a different page (setup tab) altogether as appropriate. */1343 else if (assistant.getLastAction() == "cancel")1344 {1345 nlapiSetRedirectURL('tasklink', "CARD_-10");1346 }1347 /* 3. For all other actions (next, back, jump), process the step and redirect to assistant page. */1348 else 1349 {1350 if (assistant.getLastStep().getName() == "ava_credentials" && assistant.getLastAction() == "next" ) 1351 {1352 AVA_ServiceTypes = request.getParameter('ava_servicetypes');1353 if(AVA_ServiceTypes != null && AVA_ServiceTypes.length > 0)1354 {1355 if(AVA_ServiceTypes.search('TaxSvc') != -1)1356 {1357 AVA_SubsidiaryCreation();1358 }1359 }1360 }1361 1362 if( !assistant.hasError() ) 1363 {1364 assistant.setCurrentStep( assistant.getNextStep() );1365 } 1366 assistant.sendRedirect( response );1367 }1368 } 1369}1370function AVA_AvaTaxConfigSetup(assistant)1371{ 1372 var firstStep = null;1373 1374 if(assistant.getLastStep() != null)1375 {1376 firstStep = assistant.getStep('ava_credentials');1377 }1378 1379 if(assistant.getCurrentStep().getName() == 'ava_credentials')1380 {1381 AVA_EncryptFlag = 0;1382 AVA_AccountValue = AVA_LicenseKey = AVA_ServiceUrl = AVA_ExpiryDate = AVA_Username = AVA_Password = '';1383 var AVA_GlobalDateFormat = assistant.addField('ava_globaldateformat', 'text', 'Global Date Format');1384 AVA_GlobalDateFormat.setDisplayType('hidden');1385 AVA_GlobalDateFormat.setDefaultValue(nlapiGetContext().getSetting('PREFERENCE', 'DATEFORMAT'));1386 1387 var AVA_ServiceTypesField = assistant.addField('ava_servicetypes', 'text', 'Service Types');1388 AVA_ServiceTypesField.setDisplayType('hidden');1389 }1390 else 1391 {1392 AVA_AccountValue = firstStep.getFieldValue('ava_accountvalue');1393 AVA_LicenseKey = firstStep.getFieldValue('ava_licensekey');1394 AVA_ServiceUrl = firstStep.getFieldValue('ava_serviceurl');1395 AVA_ExpiryDate = firstStep.getFieldValue('ava_expirydate'); 1396 AVA_EnableBatchService = firstStep.getFieldValue('ava_enablebatchservice');1397 AVA_Username = firstStep.getFieldValue('ava_username'); 1398 AVA_Password = firstStep.getFieldValue('ava_password');1399 }1400 1401 assistant.addFieldGroup("ava_credentialsinfo", "Avalara Credentials");1402 assistant.addField('ava_accountvalue','text','Account ID ', null,'ava_credentialsinfo');1403 assistant.getField('ava_accountvalue').setDefaultValue(AVA_AccountValue); 1404 assistant.addField('ava_licensekey','password','License Key ', null,'ava_credentialsinfo'); 1405 assistant.getField('ava_licensekey').setMaxLength(30);1406 assistant.getField('ava_licensekey').setDefaultValue(AVA_LicenseKey); 1407 assistant.addField('ava_serviceurl','text','Service URL ', null,'ava_credentialsinfo');1408 assistant.getField('ava_serviceurl').setDefaultValue(AVA_ServiceUrl); 1409 assistant.addField('ava_expirydate','text','Expiry Date ', null,'ava_credentialsinfo');1410 assistant.getField('ava_expirydate').setDefaultValue(AVA_ExpiryDate); 1411 1412 assistant.addField('ava_enablebatchservice', 'checkbox', 'Enable UseTax Batch Service', null, 'ava_credentialsinfo').setLayoutType('normal','startcol');1413 assistant.getField('ava_enablebatchservice').setDefaultValue('F');1414 assistant.addField('ava_username', 'text', 'Username', null, 'ava_credentialsinfo');1415 assistant.getField('ava_username').setDisplayType('disabled');1416 assistant.getField('ava_username').setDefaultValue(AVA_Username); 1417 assistant.addField('ava_password', 'password', 'Password', null, 'ava_credentialsinfo');1418 assistant.getField('ava_password').setMaxLength(70);1419 assistant.getField('ava_password').setDisplayType('disabled');1420 assistant.getField('ava_password').setDefaultValue(AVA_Password);1421}1422function AVA_GeneralConfigSetup(assistant)1423{1424 AVA_AvaTaxConfigSetup(assistant);1425 1426 assistant.getField('ava_accountvalue').setDisplayType('inline');1427 assistant.getField('ava_licensekey').setDefaultValue('****************');1428 assistant.getField('ava_licensekey').setDisplayType('inline'); 1429 assistant.getField('ava_serviceurl').setDisplayType('inline');1430 assistant.getField('ava_expirydate').setDisplayType('inline');1431 assistant.getField('ava_enablebatchservice').setLayoutType('normal','startcol');1432 assistant.getField('ava_enablebatchservice').setDisplayType('hidden');1433 assistant.getField('ava_username').setDisplayType('inline');1434 assistant.getField('ava_password').setDisplayType('inline');1435 if(AVA_Password != null && AVA_Password.length > 0)1436 {1437 assistant.getField('ava_password').setDefaultValue('********');1438 }1439 else1440 {1441 assistant.getField('ava_password').setDefaultValue('');1442 }1443 1444 assistant.addFieldGroup("ava_itemsetting", "Item Specific Settings");1445 assistant.addFieldGroup("ava_custsetting", "Customer Specific Settings");1446 assistant.addFieldGroup("ava_miscsetting", "Miscellaneous Settings");1447 assistant.addFieldGroup("ava_cutsetting", "Consumer Use Tax Assessment Settings");1448 1449 //General settings1450 assistant.addField('ava_udf1', 'checkbox', 'User Defined 1', null, 'ava_itemsetting');1451 assistant.addField('ava_udf2', 'checkbox', 'User Defined 2', null, 'ava_itemsetting');1452 assistant.addField('ava_itemaccount', 'checkbox', 'Send Item Account to Avalara', null, 'ava_itemsetting').setLayoutType('normal','startcol');1453 assistant.addField('ava_taxcodemapping', 'checkbox', 'Enable Tax Code Mapping', null, 'ava_itemsetting');1454 1455 // Adding Customer default Options1456 assistant.addField('ava_entityusecode', 'checkbox', 'Enable Entity/Use Code', null, 'ava_custsetting');1457 1458 var AVA_CustomerCode = assistant.addField('ava_customercode', 'select', 'Customer Code', null, 'ava_custsetting');1459 1460 AVA_CustomerCode.addSelectOption('0','Customer ID');1461 AVA_CustomerCode.addSelectOption('1','Customer Name');1462 AVA_CustomerCode.addSelectOption('2','Customer Internal ID');1463 AVA_CustomerCode.addSelectOption('3','Partner ID');1464 AVA_CustomerCode.addSelectOption('4','Partner Name');1465 AVA_CustomerCode.addSelectOption('5','Partner Internal ID');1466 AVA_CustomerCode.addSelectOption('6','Customer ID/Name');1467 AVA_CustomerCode.addSelectOption('7','Partner ID/Name');1468 AVA_CustomerCode.setHelpText('Customer/Partner Code with which the tax call will be made to AvaTax.', false);1469 var AVA_MarkCustomerTaxable = assistant.addField('ava_markcusttaxable', 'select', 'Customers Default to Taxable', null, 'ava_custsetting').setLayoutType('normal','startcol');1470 AVA_MarkCustomerTaxable.addSelectOption('0','');1471 AVA_MarkCustomerTaxable.addSelectOption('1','New and Existing Customer(s)');1472 AVA_MarkCustomerTaxable.addSelectOption('2','Only New Customer(s)');1473 AVA_MarkCustomerTaxable.addSelectOption('3','Only Existing Customer(s)');1474 1475 // Adding Taxcode defaulting Options1476 var AVA_DefaultCustomerTaxcode = assistant.addField('ava_defaultcustomer', 'select', 'Default Taxcode To', null, 'ava_custsetting');1477 1478 AVA_DefaultCustomerTaxcode.addSelectOption('0',''); 1479 AVA_DefaultCustomerTaxcode.addSelectOption('1','New and Existing Customer(s)'); 1480 AVA_DefaultCustomerTaxcode.addSelectOption('2','Only New Customer(s)'); 1481 AVA_DefaultCustomerTaxcode.addSelectOption('3','Only Existing Customer(s)'); 1482 1483 var AVA_DefShipCode = assistant.addField('ava_defshipcode', 'select', 'Default Shipping Code', null, 'ava_miscsetting');1484 var AVA_ShowMsgs = assistant.addField('ava_showmessages', 'select', 'Show Warnings/Errors', null, 'ava_miscsetting');1485 AVA_ShowMsgs.addSelectOption('0','None');1486 AVA_ShowMsgs.addSelectOption('1','Only Warnings');1487 AVA_ShowMsgs.addSelectOption('2','Only Errors');1488 AVA_ShowMsgs.addSelectOption('3','Both');1489 AVA_ShowMsgs.setDefaultValue('3');1490 1491 var AVA_BillableTimeName;1492 if(nlapiGetContext().getSetting('FEATURE', 'billscosts') == 'T')1493 {1494 AVA_BillableTimeName = assistant.addField('ava_billtimename', 'select', 'Billable Time Name', null, 'ava_miscsetting').setLayoutType('normal','startcol');1495 AVA_BillableTimeName.addSelectOption('0','Billable Time');1496 AVA_BillableTimeName.addSelectOption('1','Item Name');1497 }1498 1499 // Adding Shipping Codes1500 var searchresult = nlapiSearchRecord('customrecord_avashippingcodes', null, null, null);1501 if (searchresult != null)1502 {1503 AVA_DefShipCode.addSelectOption('', '');1504 1505 for (var i =0; i < Math.min(500, searchresult.length); i++) 1506 { 1507 var record = nlapiLoadRecord('customrecord_avashippingcodes',searchresult[i].getId()); 1508 AVA_DefShipCode.addSelectOption(record.getFieldValue('custrecord_ava_shippingcode'), record.getFieldValue('custrecord_ava_shippingcode'));1509 } 1510 }1511 1512 assistant.addField('ava_enableusetax', 'checkbox', 'Enable Use Tax Assessment on Vendor Bill', null, 'ava_cutsetting');1513 1514 var AVA_VendorCode = assistant.addField('ava_vendorcode', 'select', 'Vendor Code', null, 'ava_cutsetting').setDisplayType('disabled');1515 1516 AVA_VendorCode.addSelectOption('0','Vendor ID');1517 AVA_VendorCode.addSelectOption('1','Vendor Name');1518 AVA_VendorCode.addSelectOption('2','Vendor Internal ID');1519 AVA_VendorCode.setHelpText('Vendor Code with which the tax call will be made to AvaTax.', false);1520 assistant.addField('ava_creditaccount', 'select', 'Use Tax Payable Liability Account', 'account', 'ava_cutsetting').setDisplayType('disabled');1521 assistant.addField('ava_glaccount', 'label', 'GL Account to Debit', null, 'ava_cutsetting').setLayoutType('normal', 'startcol');1522 assistant.addField('ava_glaccounts', 'radio', 'Individual Item/Expense Account', 'itemaccount', 'ava_cutsetting').setDisplayType('disabled');1523 assistant.addField('ava_glaccounts', 'radio', 'Select a Use Tax Debit GL Account', 'glaccount', 'ava_cutsetting').setDisplayType('disabled');1524 assistant.getField('ava_glaccounts').setDefaultValue('itemaccount');1525 assistant.addField('ava_debitaccount', 'select', 'Use Tax Debit GL Account', 'account', 'ava_cutsetting').setDisplayType('disabled');1526 assistant.addField('ava_glaccountstext', 'text', 'GL Account', null, 'ava_cutsetting').setDisplayType('hidden');1527 AVA_LoadConfigData(assistant); 1528}1529function AVA_TaxCalcConfigSetup(assistant)1530{1531 // Adding Elements inside Second Tab - Tax Calcuation1532 var AVA_DisableTax = assistant.addField('ava_disabletax', 'checkbox', 'Disable Tax Calculation', null, 'ava_taxcalculation'); 1533 var AVA_DisableLine = assistant.addField('ava_disableline', 'checkbox', 'Disable Tax Calculation at line level', null, 'ava_taxcalculation'); 1534 var AVA_EnableLogging = assistant.addField('ava_enablelogging', 'checkbox', 'Enable Logging', null, 'ava_taxcalculation'); 1535 var AVA_TaxonDemand = assistant.addField('ava_taxondemand', 'checkbox', 'Calculate Tax on Demand', null, 'ava_taxcalculation');1536 var AVA_TaxInclude = assistant.addField('ava_taxinclude', 'checkbox', 'Tax Included Capability', null, 'ava_taxcalculation');1537 var AVA_EnableDiscount = assistant.addField('ava_enablediscount', 'checkbox', 'Enable Discount Mechanism', null, 'ava_taxcalculation');1538 1539 var AVA_ShowDiscountMapping = assistant.addField('ava_discountmapping', 'select', 'Discount Mapping', null, 'ava_taxcalculation');1540 AVA_ShowDiscountMapping.addSelectOption('0','Gross Amount');1541 AVA_ShowDiscountMapping.addSelectOption('1','Net Amount');1542 AVA_ShowDiscountMapping.setDisplayType('disabled');1543 AVA_ShowDiscountMapping.setLayoutType('normal', 'startcol'); 1544 1545 var AVA_DiscountTaxCode = assistant.addField('ava_discounttaxcode', 'text', 'Discount Tax Code', null).setDisplayType('disabled');1546 1547 var AVA_ShowTaxRate = assistant.addField('ava_taxrate', 'select', 'Tax Rate', null, 'ava_taxcalculation');1548 AVA_ShowTaxRate.addSelectOption('0','Show Base Rate');1549 AVA_ShowTaxRate.addSelectOption('1','Show Net Rate');1550 AVA_ShowTaxRate.setLayoutType('normal', 'startcol'); 1551 var AVA_DeciPlaces = assistant.addField('ava_decimalplaces', 'select', 'Round-off Tax percentage(Decimal Places)', null, 'ava_taxcalculation');1552 AVA_DeciPlaces.addSelectOption('2','2');1553 AVA_DeciPlaces.addSelectOption('3','3');1554 AVA_DeciPlaces.addSelectOption('4','4');1555 AVA_DeciPlaces.addSelectOption('5','5');1556 1557 var AVA_UsePostingPeriod = assistant.addField('ava_usepostingperiod', 'checkbox', 'Use Posting Date as Transaction Date during Tax calls', null, 'ava_taxcalculation');1558 if(nlapiGetContext().getFeature('accountingperiods') != true)1559 {1560 AVA_UsePostingPeriod.setDisplayType('disabled');1561 }1562 var AVA_DisableLocationCode = assistant.addField('ava_disableloccode', 'checkbox', 'Disable Location Code', null, 'ava_taxcalculation');1563 var AVA_EnableUpcCode = assistant.addField('ava_enableupccode', 'checkbox', 'Enable UPC Code as ItemCode', null, 'ava_taxcalculation');1564 if(nlapiGetContext().getFeature('barcodes') == false)1565 {1566 AVA_EnableUpcCode.setDisplayType('disabled');1567 }1568 assistant.addFieldGroup("ava_taxsetting", "Abort Save Operation on Tax Calculation Error(s)/Incomplete data");1569 assistant.addField('ava_abortbulkbilling', 'checkbox', 'Bulk Billing', null, 'ava_taxsetting');1570 assistant.addField('ava_abortuserinterfaces', 'checkbox', 'User Interfaces', null, 'ava_taxsetting');1571 assistant.addField('ava_abortwebservices', 'checkbox', 'Webservices', null, 'ava_taxsetting');1572 assistant.addField('ava_abortcsvimports', 'checkbox', 'CSV Imports', null, 'ava_taxsetting');1573 assistant.addField('ava_abortscheduledscripts', 'checkbox', 'Scheduled Scripts', null, 'ava_taxsetting').setLayoutType('normal','startcol');1574 assistant.addField('ava_abortsuitelets', 'checkbox', 'Suitelets', null, 'ava_taxsetting');1575 assistant.addField('ava_abortworkflowactionscripts', 'checkbox', 'Workflow Action Scripts', null, 'ava_taxsetting');1576 1577 var AVA_SubsidiarySubList = assistant.addSubList('custpage_subsidiarylist', 'inlineeditor', 'Subsidiary List');1578 var AVA_CRSubId = AVA_SubsidiarySubList.addField('ava_customsubid', 'text', 'Custom Record Sub ID', null);1579 AVA_CRSubId.setDisplayType('hidden');1580 var AVA_SubId = AVA_SubsidiarySubList.addField('ava_subid', 'text', 'Sub ID', null);1581 AVA_SubId.setDisplayType('hidden');1582 var AVA_SubsidiaryField = AVA_SubsidiarySubList.addField('ava_subsidiary', 'text', 'Subsidiary', null);1583 AVA_SubsidiaryField.setDisplayType('disabled');1584 var AVA_DefTaxcode = AVA_SubsidiarySubList.addField('ava_deftaxcode', 'select', 'Default Tax Code', null);1585 AVA_DefTaxcode.addSelectOption('', '');1586 var AVA_DefTaxcodeRate = AVA_SubsidiarySubList.addField('ava_deftaxcoderate', 'select', 'Default Tax Code Rate', null);1587 AVA_DefTaxcodeRate.addSelectOption('', '');1588 AVA_DefTaxcodeRate.setDisplayType('disabled');1589 var AVA_DefTaxcodeCountry = AVA_SubsidiarySubList.addField('ava_deftaxcodecountry', 'select', 'Default Tax Code Country', null);1590 AVA_DefTaxcodeCountry.addSelectOption('', '');1591 AVA_DefTaxcodeCountry.setDisplayType('disabled');1592 var AVA_TaxCodeValidate = AVA_SubsidiarySubList.addField('ava_taxcodevalidate', 'select', 'Tax Code Validate', null);1593 AVA_TaxCodeValidate.addSelectOption('', '');1594 AVA_TaxCodeValidate.addSelectOption('1', '1');1595 AVA_TaxCodeValidate.addSelectOption('2', '2');1596 AVA_TaxCodeValidate.addSelectOption('3', '3');1597 AVA_TaxCodeValidate.setDisplayType('hidden'); 1598 var TaxCodeID, TaxCodeName, TaxCodeRate, TaxCodeType, TaxCodeCountry; 1599 AVA_TaxCodesArray = new Array(); 1600 AVA_TaxCodesTypeArray = new Array();1601 1602 var filter = new Array();1603 filter[0] = new nlobjSearchFilter('isinactive',null,'is','F');1604 var cols = new Array();1605 cols[0] = new nlobjSearchColumn('itemid'); 1606 cols[1] = new nlobjSearchColumn('rate'); 1607 cols[2] = new nlobjSearchColumn('taxtype');1608 cols[3] = new nlobjSearchColumn('country'); 1609 var searchresult = nlapiSearchRecord('salestaxitem', null, filter, cols); 1610 for(var i=0, j=0; searchresult!=null && i < searchresult.length; i++) 1611 { 1612 TaxCodeID = searchresult[i].getId(); 1613 TaxCodeName = searchresult[i].getValue('itemid'); 1614 TaxCodeRate = searchresult[i].getValue('rate'); 1615 TaxCodeType = searchresult[i].getValue('taxtype'); 1616 TaxCodeCountry = searchresult[i].getValue('country'); 1617 1618 if(TaxCodeName != '-Not Taxable-') 1619 { 1620 AVA_DefTaxcodeRate.addSelectOption(TaxCodeID, TaxCodeRate); 1621 1622 // If Tax Code country is US or CA add only the TaxCode to the list 1623 if (TaxCodeCountry == 'US' || TaxCodeCountry == 'CA') 1624 { 1625 AVA_DefTaxcode.addSelectOption(TaxCodeName + '+' + TaxCodeID, TaxCodeName); 1626 } 1627 else 1628 { 1629 // If apart from US or CA, then suffix the TaxcodeType and then add to the list 1630 if(AVA_TaxCodesArray.length == 0) 1631 { 1632 AVA_TaxCodesTypeArray[j] = TaxCodeType; 1633 AVA_TaxCodesArray[j] = nlapiLookupField('taxtype', searchresult[i].getValue('taxtype'), 'name'); 1634 AVA_DefTaxcode.addSelectOption(AVA_TaxCodesArray[j] + ':' + TaxCodeName + '+' + TaxCodeID, AVA_TaxCodesArray[j] + ':' + TaxCodeName); 1635 j++; 1636 } 1637 else 1638 { 1639 var TaxCodeTypeExists = 'F'; 1640 //First check whether the Tax Type is there in the list 1641 for(var k = 0; k < AVA_TaxCodesArray.length; k++) 1642 { 1643 if (AVA_TaxCodesTypeArray[k] == TaxCodeType) 1644 { 1645 AVA_DefTaxcode.addSelectOption(AVA_TaxCodesArray[k] + ':' + TaxCodeName + '+' + TaxCodeID, AVA_TaxCodesArray[k] + ':' + TaxCodeName); 1646 TaxCodeTypeExists = 'T'; 1647 break; 1648 } 1649 else 1650 { 1651 TaxCodeTypeExists = 'F'; 1652 } 1653 } 1654 1655 if(TaxCodeTypeExists == 'F') 1656 { 1657 AVA_TaxCodesTypeArray[j] = TaxCodeType; 1658 AVA_TaxCodesArray[j] = nlapiLookupField('taxtype', searchresult[i].getValue('taxtype'), 'name'); 1659 AVA_DefTaxcode.addSelectOption(AVA_TaxCodesArray[j] + ':' + TaxCodeName + '+' + TaxCodeID, AVA_TaxCodesArray[j] + ':' + TaxCodeName); 1660 j++; 1661 } 1662 } 1663 } 1664 1665 AVA_DefTaxcodeCountry.addSelectOption(TaxCodeID, TaxCodeCountry); 1666 } 1667 } 1668 1669 var searchTaxGroups = nlapiSearchRecord('taxgroup', null, null, cols); 1670 1671 for(var i=0, j=0; searchTaxGroups!=null && i < searchTaxGroups.length; i++) 1672 { 1673 TaxCodeID = searchTaxGroups[i].getId(); 1674 TaxCodeName = searchTaxGroups[i].getValue('itemid'); 1675 TaxCodeRate = searchTaxGroups[i].getValue('rate'); 1676 TaxCodeType = searchTaxGroups[i].getValue('taxtype'); 1677 TaxCodeCountry = searchTaxGroups[i].getValue('country'); 1678 1679 if(TaxCodeName != '-Not Taxable-') 1680 { 1681 AVA_DefTaxcodeRate.addSelectOption(TaxCodeID, TaxCodeRate); 1682 1683 if (TaxCodeCountry == 'US' || TaxCodeCountry == 'CA') 1684 { 1685 AVA_DefTaxcode.addSelectOption(TaxCodeName + '+' + TaxCodeID, TaxCodeName); 1686 } 1687 else 1688 { 1689 // If apart from US or CA, then suffix the TaxcodeType and then add to the list 1690 if(AVA_TaxCodesArray.length == 0) 1691 { 1692 AVA_TaxCodesTypeArray[j] = TaxCodeType; 1693 AVA_TaxCodesArray[j] = nlapiLookupField('taxtype', searchTaxGroups[i].getValue('taxtype'), 'name'); 1694 AVA_DefTaxcode.addSelectOption(AVA_TaxCodesArray[j] + ':' + TaxCodeName + '+' + TaxCodeID, AVA_TaxCodesArray[j] + ':' + TaxCodeName); 1695 j++; 1696 } 1697 else 1698 { 1699 var TaxCodeTypeExists = 'F'; 1700 //First check whether the Tax Type is there in the list 1701 for(var k = 0; k < AVA_TaxCodesArray.length; k++) 1702 { 1703 if (AVA_TaxCodesTypeArray[k] == TaxCodeType) 1704 { 1705 AVA_DefTaxcode.addSelectOption(AVA_TaxCodesArray[k] + ':' + TaxCodeName + '+' + TaxCodeID, AVA_TaxCodesArray[k] + ':' + TaxCodeName); 1706 TaxCodeTypeExists = 'T'; 1707 break; 1708 } 1709 else 1710 { 1711 TaxCodeTypeExists = 'F'; 1712 } 1713 } 1714 1715 if(TaxCodeTypeExists == 'F') 1716 { 1717 AVA_TaxCodesTypeArray[j] = TaxCodeType; 1718 AVA_TaxCodesArray[j] = nlapiLookupField('taxtype', searchTaxGroups[i].getValue('taxtype'), 'name'); 1719 AVA_DefTaxcode.addSelectOption(AVA_TaxCodesArray[j] + ':' + TaxCodeName + '+' + TaxCodeID, AVA_TaxCodesArray[j] + ':' + TaxCodeName); 1720 j++; 1721 } 1722 } 1723 } 1724 1725 AVA_DefTaxcodeCountry.addSelectOption(TaxCodeID, TaxCodeCountry); 1726 } 1727 } 1728 1729 var AVA_SubsidiaryAddress = AVA_SubsidiarySubList.addField('ava_defaultaddr', 'select', 'Ship-From Address', null); 1730 AVA_SubsidiaryAddress.setMandatory(true); 1731 AVA_SubsidiaryAddress.addSelectOption('companyaddr', 'Company Address'); 1732 AVA_SubsidiaryAddress.addSelectOption('shippingaddr', 'Shipping Address'); 1733 1734 1735 AVA_SubsidiarySubList.addField('ava_companyaddr', 'textarea', 'Company Address', null).setDisplayType('disabled'); 1736 AVA_SubsidiarySubList.addField('ava_shipaddr', 'textarea', 'Shipping Address', null).setDisplayType('disabled'); 1737 AVA_SubsidiarySubList.addField('ava_subnexuses', 'textarea', 'Subsidiary Nexuses', null).setDisplayType('hidden'); 1738 1739 var column = new Array(); 1740 column[0] = new nlobjSearchColumn('custrecord_ava_subsidiary'); 1741 column[1] = new nlobjSearchColumn('custrecord_ava_subdeftaxcode'); 1742 column[2] = new nlobjSearchColumn('custrecord_ava_companyaddr'); 1743 column[3] = new nlobjSearchColumn('custrecord_ava_shipaddr'); 1744 column[4] = new nlobjSearchColumn('custrecord_ava_iscompanyaddr'); 1745 column[5] = new nlobjSearchColumn('custrecord_ava_subname'); 1746 column[6] = new nlobjSearchColumn('custrecord_ava_subnexuses'); 1747 1748 var subsidiaryArray = nlapiSearchRecord('customrecord_avasubsidiaries', null, null, column); 1749 for(var k = 0; subsidiaryArray != null && k < subsidiaryArray.length; k++ ) 1750 { 1751 AVA_SubsidiarySubList.setLineItemValue('ava_customsubid', k+1, subsidiaryArray[k].getId()); 1752 AVA_SubsidiarySubList.setLineItemValue('ava_subid', k+1, subsidiaryArray[k].getValue('custrecord_ava_subsidiary')); 1753 AVA_SubsidiarySubList.setLineItemValue('ava_subsidiary', k+1, subsidiaryArray[k].getValue('custrecord_ava_subname')); 1754 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcode', k+1, subsidiaryArray[k].getValue('custrecord_ava_subdeftaxcode')); 1755 1756 var val = subsidiaryArray[k].getValue('custrecord_ava_subdeftaxcode'); 1757 val = (val != null && val.length > 0) ? val.substr(val.lastIndexOf('+')+1, val.length) : ''; 1758 1759 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcoderate', k+1, val); 1760 1761 AVA_SubsidiarySubList.setLineItemValue('ava_deftaxcodecountry', k+1, val); 1762 var TaxCodeValidate = (val != null && val.length > 0) ? 1 : ''; 1763 1764 AVA_SubsidiarySubList.setLineItemValue('ava_taxcodevalidate', k+1, TaxCodeValidate); 1765 AVA_SubsidiarySubList.setLineItemValue('ava_defaultaddr', k+1, (subsidiaryArray[k].getValue('custrecord_ava_iscompanyaddr')=='T') ? 'companyaddr' : 'shippingaddr');1766 AVA_SubsidiarySubList.setLineItemValue('ava_companyaddr', k+1, subsidiaryArray[k].getValue('custrecord_ava_companyaddr'));1767 AVA_SubsidiarySubList.setLineItemValue('ava_shipaddr', k+1, subsidiaryArray[k].getValue('custrecord_ava_shipaddr')); 1768 AVA_SubsidiarySubList.setLineItemValue('ava_subnexuses', k+1, subsidiaryArray[k].getValue('custrecord_ava_subnexuses'));1769 } 1770 1771 AVA_LoadConfigData(assistant); 1772}1773function AVA_AddressConfigSetup(assistant)1774{1775 AVA_AvaTaxConfigSetup(assistant);1776 1777 assistant.getField('ava_accountvalue').setDisplayType('inline');1778 assistant.getField('ava_licensekey').setDefaultValue('****************');1779 assistant.getField('ava_licensekey').setDisplayType('inline'); 1780 assistant.getField('ava_serviceurl').setDisplayType('inline');1781 assistant.getField('ava_expirydate').setDisplayType('inline');1782 assistant.getField('ava_enablebatchservice').setLayoutType('normal','startcol');1783 assistant.getField('ava_enablebatchservice').setDisplayType('hidden');1784 assistant.getField('ava_username').setDisplayType('inline'); 1785 assistant.getField('ava_password').setDisplayType('inline');1786 if(AVA_Password != null && AVA_Password.length > 0)1787 {1788 assistant.getField('ava_password').setDefaultValue('********');1789 }1790 else1791 {1792 assistant.getField('ava_password').setDefaultValue('');1793 }1794 assistant.addFieldGroup("ava_addressvalidation", "Address Validation");1795 // Adding Elements inside Third Tab - Address Validation 1796 var AVA_DisableAddValidation = assistant.addField('ava_disableaddvalidation', 'checkbox', 'Disable Address Validation', null, 'ava_addressvalidation'); 1797 var AVA_EnableAddValonTran = assistant.addField('ava_enableaddvalontran', 'checkbox', 'Enable Address Validation on Transaction(s)', null, 'ava_addressvalidation');1798 var AVA_EnableAddValFlag = assistant.addField('ava_enableaddvalflag', 'checkbox', 'Track Previously Validated Addresses', null, 'ava_addressvalidation');1799 var AVA_UpperCaseAddress = assistant.addField('ava_uppercaseaddress', 'checkbox', 'Result in Upper Case', null, 'ava_addressvalidation'); 1800 AVA_UpperCaseAddress.setLayoutType('normal','startcol');1801 var AVA_AddBatchProcessing = assistant.addField('ava_addbatchprocessing', 'select', 'Batch Processing', null, 'ava_addressvalidation');1802 AVA_AddBatchProcessing.addSelectOption('manual', 'Manual'); 1803 AVA_AddBatchProcessing.addSelectOption('automatic', 'Automatic'); 1804 AVA_AddBatchProcessing.setHelpText('Manual: Once the addresses are validated, user would need to select all the addresses that he want to get updated in the respective subsidiary/customer or location record(s) manually. \n Automatic: In this case, as soon as the addresses get validated, it will get updated in the respective subsidiary/customer or location record(s) automatically. ', false);1805 1806 AVA_LoadConfigData(assistant);1807}1808function AVA_AboutAvaTaxConfig(assistant)1809{1810 var firstStep = assistant.getStep("ava_credentials");1811 1812 AVA_AccountValue = firstStep.getFieldValue('ava_accountvalue');1813 AVA_LicenseKey = firstStep.getFieldValue('ava_licensekey');1814 AVA_ServiceUrl = firstStep.getFieldValue('ava_serviceurl');1815 AVA_ExpiryDate = firstStep.getFieldValue('ava_expirydate');1816 1817 assistant.addFieldGroup("ava_about", "About Avalara");1818 // Adding Elements inside Fourth Tab - About AvaTax1819 var dYear = new Date();1820 var AVA_Copyright = assistant.addField('ava_copyright', 'help', 'Copyright &copy ' + dYear.getFullYear() + ' Avalara, Inc. All Rights Reserved.', null, 'ava_about');1821 1822 var AVA_Ver = assistant.addField('ava_version', 'text', 'Version', null, 'ava_about');1823 AVA_Ver.setDisplayType('inline');1824 AVA_Ver.setDefaultValue(AVA_ClientAtt);1825 1826 var AVA_SerVersion = assistant.addField('ava_serversion', 'text', 'AvaTax Version', null, 'ava_about');1827 AVA_SerVersion.setDisplayType('inline');1828 AVA_SerVersion.setDefaultValue(AVA_Ping());1829 1830 var AVA_Email = assistant.addField('ava_email', 'email', 'Email', null, 'ava_about');1831 AVA_Email.setDisplayType('inline');1832 AVA_Email.setDefaultValue('support@avalara.com');1833 1834 var AVA_Phone = assistant.addField('ava_phone', 'phone', 'Phone', null, 'ava_about');1835 AVA_Phone.setDisplayType('inline');1836 AVA_Phone.setDefaultValue('(877)-780-4848');1837 1838 var AVA_Web = assistant.addField('ava_web', 'url', 'Website', null, 'ava_about');1839 AVA_Web.setDisplayType('inline');1840 AVA_Web.setDefaultValue('http://www.avalara.com/');1841 AVA_Web.setLayoutType('normal','startcol');1842 var AVA_AdminConsole = assistant.addField('ava_adminconsole', 'url', 'AvaTax Connect DashBoard', null, 'ava_about');1843 AVA_AdminConsole.setDisplayType('inline');1844 AVA_AdminConsole.setDefaultValue((AVA_ServiceUrl.search('development') != -1) ? 'https://admin-development.avalara.net/login.aspx' : 'https://admin-avatax.avalara.net/login.aspx' );1845 1846 var AVA_UserCenter = assistant.addField('ava_usercenter', 'url', 'Avalara User Center', null, 'ava_about');1847 AVA_UserCenter.setDisplayType('inline');1848 AVA_UserCenter.setDefaultValue('https://help.avalara.com');1849}1850function AVA_ConfigTestConnection()1851{1852 AVA_ServiceTypes = '';1853 var AVA_AccountValue = nlapiGetFieldValue('ava_accountvalue');1854 var AVA_LicenseKey = nlapiGetFieldValue('ava_licensekey');1855 var AVA_URL = nlapiGetFieldValue('ava_serviceurl');1856 1857 if ((AVA_AccountValue.length != 0) && (AVA_LicenseKey.length != 0) && (AVA_URL.length != 0))1858 {1859 var security = AVA_BuildSecurity(AVA_AccountValue, AVA_LicenseKey);1860 var headers = AVA_Header(security);1861 var body = AVA_IsAuthorizedBody();1862 var soapPayload = AVA_BuildEnvelope(headers + body);...

Full Screen

Full Screen

template.js

Source:template.js Github

copy

Full Screen

...11} = require('@/utils')12const genTemplate = function (fields, formConf) {13 const genFieldAttrs = function (field) {14 const store = {15 tag: setDefaultValue(field.__config__.tag, field.__config__.tag, 'div'),16 vModel: setDefaultValue((formConf.__vModel__ && field.__vModel__ && field.__vModel__.key), `v-model="${formConf.__vModel__}.${field.__vModel__ && field.__vModel__.key}"`),17 size: setDefaultValue(field.size, `size="${field.size}"`),18 name: setDefaultValue(field.name, `name="${field.name}"`),19 disabled: setDefaultValue(field.disabled, 'disabled'),20 clearable: setDefaultValue(field.clearable, 'clearable'),21 required: setDefaultValue(field.required, 'required'),22 readonly: setDefaultValue(field.readonly, 'readonly'),23 placeholder: setDefaultValue(field.placeholder, `placeholder="${field.placeholder}"`)24 }25 return store26 }27 const genFormTemplate = function (template, formConf) {28 const store = {29 model: setDefaultValue(formConf.__vModel__, `:model="${formConf.__vModel__}"`),30 formRef: setDefaultValue(formConf.__config__.formRef, `ref="${formConf.__config__.formRef}"`),31 labelPosition: setDefaultValue(assetDefaultValue(formConf.labelPosition, 'right'), `label-position="${formConf.labelPosition}"`),32 labelWidth: setDefaultValue(formConf.labelWidth, `label-width="${formConf.labelWidth}"`),33 labelSuffix: setDefaultValue(formConf.labelSuffix, `label-suffix="${formConf.labelSuffix}"`),34 size: setDefaultValue(assetDefaultValue(formConf.size, 'medium'), `size="${formConf.size}"`),35 hideRequiredAsterisk: setDefaultValue(formConf.hideRequiredAsterisk, 'hide-required-asterisk'),36 inline: setDefaultValue(formConf.inline, 'inline'),37 required: setDefaultValue(formConf.required, 'required'),38 disabled: setDefaultValue(formConf.disabled, 'disabled')39 }40 return (41 `<el-form ${listStoreAttrs(store)}>42 ${template + setDefaultValue(formConf.__config__.formBtnGroup, genFormBtns(formConf))}43 </el-form>`44 )45 }46 const genFormBtns = function () {47 const template = `48 <el-form-item>49 <el-button type="primary" @click="${methodsName.submitForm}">提交</el-button>50 <el-button @click="${methodsName.resetForm}">重置</el-button>51 </el-form-item>`52 return template53 }54 const genChildrenTemplate = function (type, slot, options) {55 if (!type || !slot) return ''56 return endOfLine + slots[`${type}Slot`](slot, options) + endOfLine57 }58 const genFieldTemplate = function (store, type, slot, options) {59 return `${endOfLine}<${listStoreAttrs(store)}>${genChildrenTemplate(type, slot, options)}</${store.tag}>${endOfLine}`60 }61 const genSlotTemplate = function (name, content) {62 return `<template slot="${name}">${content}</template>`63 }64 const stitchProps = function (prop, key, asset) {65 const condition = (prop, asset) => asset ? assetDefaultValue(prop, asset) : prop66 const value = typeOf(prop, 'boolean') ? prop : `"${prop}"`67 return setDefaultValue(condition(prop, asset), `${key}: ${value}, `)68 }69 const layouts = {70 colFormItem (item) {71 const config = item.__config__72 const store = {}73 // process label and label-width74 store.label = setDefaultValue(config.label, `label="${config.label}"`)75 store.labelWidth = setDefaultValue(config.labelWidth, `label-width="${config.labelWidth}"`)76 if (77 config.labelWidth &&78 config.labelWidth !== formConf.labelWidth &&79 typeOf(config.label, 'number')80 ) {81 store.labelWidth = `label-width=${config.labelWidth}px`82 }83 if (!config.showLabel) {84 store.labelWidth = "label-width='0'"85 store.label = ''86 }87 // process required88 store.required = setDefaultValue(config.required, 'required')89 // process vmodel90 store.prop = setDefaultValue((item.__vModel__ && item.__vModel__.key), `prop="${item.__vModel__ && item.__vModel__.key}"`)91 // process children92 const children = setDefaultValue(tags[config.tag], tags[config.tag](item))93 return `<el-form-item ${listStoreAttrs(store)}>${children}</el-form-item>`94 },95 rowFormItem (item) {96 const store = {97 type: setDefaultValue(assetDefaultValue(item.type, 'default'), `type="${item.type}"`),98 gutter: setDefaultValue(item.gutter, `:gutter="${item.gutter}"`),99 jsutify: setDefaultValue(assetDefaultValue(item.jsutify, 'start'), `jsutify="${item.jsutify}"`),100 align: setDefaultValue(assetDefaultValue(item.align, 'top'), `align="${item.align}"`)101 }102 const children = (item.__config__.children || []).map(child => layouts[child.__config__.layout || 'colFormItem'](child)).join(endOfLine)103 return `<el-row ${listStoreAttrs(store)}>${children}</el-row>`104 }105 }106 const slots = {107 buttonSlot (slot) {108 const children = []109 if (slot.default) {110 children.push(slot.default)111 }112 return children.join(endOfLine)113 },114 textSlot (slot) {115 const children = []116 const processFix = function (fixSlot, key) {117 let template = ''118 if (isPlainObject(fixSlot)) {119 template = (120 `<i121 slot="${key}"122 class="${setDefaultValue(fixSlot.className, fixSlot.className + ' ')}el-input__icon"123 ${setDefaultValue(fixSlot.on?.click, "@click='" + fixSlot.on.click + "'")}124 />125 `126 )127 } else if (typeOf(fixSlot, 'string')) {128 if (fixSlot.indexOf('el-icon-') !== -1) {129 template = (130 `<i slot="${key}" class="${setDefaultValue(fixSlot)}" />`131 )132 } else {133 template = (`<span slot="${key}">${setDefaultValue(fixSlot)}</span>`)134 }135 }136 return template137 }138 if (slot.prefix) {139 children.push(processFix(slot.prefix, 'prefix'))140 }141 if (slot.suffix) {142 children.push(processFix(slot.suffix, 'suffix'))143 }144 if (slot.prepend) {145 children.push(genSlotTemplate('prepend', setDefaultValue(slot.prepend)))146 }147 if (slot.append) {148 children.push(genSlotTemplate('append', setDefaultValue(slot.append)))149 }150 return children.join(endOfLine)151 },152 selectSlot (slot, { isGroup }) {153 const children = []154 const genChildOption = function (options) {155 return options.map(option => {156 const store = {157 label: setDefaultValue(option.label, `label="${option.label}"`),158 value: setDefaultValue(option.value, `value="${option.value}"`),159 disabled: setDefaultValue(option.disabled)160 }161 return `<el-option ${listStoreAttrs(store)} />`162 }).join(endOfLine)163 }164 if (slot.prefix) {165 children.push(genSlotTemplate('prefix', setDefaultValue(slot.prefix)))166 }167 if (slot.empty) {168 children.push(genSlotTemplate('empty', setDefaultValue(slot.empty)))169 }170 if (slot.options) {171 let template = ''172 slot.options =173 typeOf(slot.options, 'array')174 ? slot.options175 : isPlainObject(slot.options)176 ? [slot.options]177 : []178 if (isGroup) {179 template = slot.options.map(group => (180 `<el-option-group181 ${setDefaultValue(group.label)}182 ${setDefaultValue(group.disabled)}183 >184 ${genChildOption(group.options)}185 </el-option-group>`186 )).join(endOfLine)187 } else {188 template = genChildOption(slot.options)189 }190 children.push(template)191 }192 return children.join(endOfLine)193 },194 radioAndCheckboxSlot (slot, { isGroup, isBorder, isButton, key = 'radio' }) {195 const children = []196 const genChildOption = function (options, { isBorder, isButton }) {197 return options.map(option => {198 let template = ''199 const store = {200 label: setDefaultValue(option.value, `label="${option.value}"`),201 name: setDefaultValue(option.name, `name="${option.name}"`)202 }203 if (isButton) {204 template = `<el-${key}-button ${listStoreAttrs(store)}>${setDefaultValue(option.label)}</el-${key}-button>`205 } else {206 store.border = setDefaultValue(isBorder, 'border')207 template = `<el-${key} ${listStoreAttrs(store)}>${setDefaultValue(option.label)}</el-${key}>`208 }209 return template210 }).join(endOfLine)211 }212 if (slot.options) {213 slot.options = typeOf(slot.options, 'array')214 ? slot.options215 : isPlainObject(slot.options)216 ? [slot.options]217 : []218 const obj = { isBorder }219 if (isGroup) obj.isButton = isButton220 children.push(genChildOption(slot.options, obj))221 }222 return children.join(endOfLine)223 },224 uploadSlot (slot, { autoUpload, config }) {225 const children = []226 if (slot.listType === 'picture-card') {227 children.push(228 ('<i class="el-icon-plus"></i>')229 )230 } else {231 children.push(232 (`<el-button size="${config.btnSize || 'small'}" type="${config.btnType || 'primary'}" ${setDefaultValue(!autoUpload, `@click="${methodsName.submitUpload}"`)}>233 ${config.btnText || '点击上传'}234 </el-button>`)235 )236 }237 if (slot.tip && config.showTips) {238 children.push(239 (`<div slot="tip" class="el-upload__tip">${replaceEle(slot.tip, config)}</div>`)240 )241 }242 return children.join(endOfLine)243 },244 transferSlot (slot) {245 const children = []246 if (slot.leftFooter) {247 children.push(248 genSlotTemplate('left-footer', typeOf(slot.leftFooter, 'function') ? toString(slot.leftFooter()) : slot.leftFooter)249 )250 }251 if (slot.rightFooter) {252 children.push(253 genSlotTemplate('right-footer', typeOf(slot.rightFooter, 'function') ? toString(slot.rightFooter()) : slot.rightFooter)254 )255 }256 return children.join(endOfLine)257 }258 }259 const tags = {260 'el-button' (field) {261 const { tag, disabled, size } = genFieldAttrs(field)262 const store = {263 tag,264 type: setDefaultValue(field.type, `type="${field.type}"`),265 icon: setDefaultValue(field.icon, `icon="${field.icon}"`),266 size,267 disabled,268 plain: setDefaultValue(field.plain, 'plain'),269 round: setDefaultValue(field.round, 'round'),270 circle: setDefaultValue(field.circle, 'circle'),271 autofocus: setDefaultValue(field.autofocus, 'autofocus'),272 nativeType: setDefaultValue(assetDefaultValue(field.nativeType, 'button'), `native-type="${field.nativeType}"`)273 }274 return genFieldTemplate(store, field.__config__.type, field.__slot__)275 },276 'el-input' (field) {277 const { tag, vModel, size, name, disabled, clearable, readonly, placeholder } = genFieldAttrs(field)278 const store = {279 tag,280 vModel,281 type: setDefaultValue(field.type, `type="${field.type}"`),282 size,283 name,284 placeholder,285 minLength: setDefaultValue(field.minLength, `minLength="${field.minLength}"`),286 maxLength: setDefaultValue(assetDefaultValue(field.maxLength, Infinity), `maxLength="${field.maxLength}"`),287 prefixIcon: setDefaultValue(field.prefixIcon, `prefix-icon="${field.prefixIcon}"`),288 suffixIcon: setDefaultValue(field.suffixIcon, `suffix-icon="${field.suffixIcon}"`),289 showWordLimit: setDefaultValue(field.showWordLimit, 'show-word-limit'),290 showPassword: setDefaultValue(field.showPassword, 'show-password'),291 rows: setDefaultValue(field.rows, `:rows="${field.rows}"`),292 autosize: setDefaultValue(field.autosize, 'autosize'),293 clearable,294 readonly,295 disabled296 }297 return genFieldTemplate(store, field.__config__.type, field.__slot__)298 },299 'el-input-number' (field) {300 const { tag, vModel, size, name, placeholder, disabled } = genFieldAttrs(field)301 const store = {302 tag,303 vModel,304 type: setDefaultValue(field.type, `type="${field.type}"`),305 size,306 name,307 placeholder,308 max: setDefaultValue(assetDefaultValue(field.max, Infinity), `:max="${field.max}"`),309 min: setDefaultValue(assetDefaultValue(field.min, -Infinity), `:min="${field.min}"`),310 controls: setDefaultValue(field.controls, 'controls'),311 step: setDefaultValue(field.step, `:step="${field.step}"`),312 stepStrictly: setDefaultValue(field.stepStrictly, 'step-strictly'),313 precision: setDefaultValue(field.precision, `:precision="${field.precision}"`),314 disabled315 }316 return genFieldTemplate(store)317 },318 'el-select' (field) {319 const isGroup = field.__config__.isGroup320 const { tag, vModel, name, size, placeholder, clearable, disabled } = genFieldAttrs(field)321 const store = {322 tag,323 vModel,324 name,325 size,326 placeholder,327 filterable: setDefaultValue(field.filterable, 'filterable'),328 allowCreate: setDefaultValue(field.allowCreate, 'allow-create'),329 clearable,330 disabled331 }332 return genFieldTemplate(store, field.__config__.type, field.__slot__, { isGroup })333 },334 'el-radio-group' (field) {335 const config = field.__config__336 const { isGroup, isButton, isBorder } = config337 const { tag, vModel, size, disabled } = genFieldAttrs(field)338 const store = {339 tag,340 vModel,341 size,342 textColor: setDefaultValue(field.textColor, `text-color="${field.textColor}"`),343 fill: setDefaultValue(field.fill, `fill="${field.fill}"`),344 disabled345 }346 return genFieldTemplate(347 store,348 'radioAndCheckbox',349 field.__slot__,350 { isGroup, isButton, isBorder, key: 'radio' }351 )352 },353 'el-checkbox-group' (field) {354 const config = field.__config__355 const { isGroup, isButton, isBorder } = config356 const { tag, vModel, size, disabled } = genFieldAttrs(field)357 const store = {358 tag,359 vModel,360 size,361 min: setDefaultValue(assetDefaultValue(field.min, -Infinity), `:min="${field.min}"`),362 max: setDefaultValue(assetDefaultValue(field.max, Infinity), `:max="${field.max}"`),363 textColor: setDefaultValue(field.textColor, `textColor="${field.textColor}"`),364 fill: setDefaultValue(field.fill, `fill="${field.fill}"`),365 disabled366 }367 return genFieldTemplate(368 store,369 'radioAndCheckbox',370 field.__slot__,371 { isGroup, isButton, isBorder, key: 'checkbox' }372 )373 },374 'el-cascader' (field) {375 const processProps = function (props) {376 return (377 ':props={ ' +378 stitchProps(props.expandTrigger, 'expandTrigger', 'click') +379 stitchProps(props.multiple, 'multiple') +380 stitchProps(props.checkStrictly, 'checkStrictly') +381 stitchProps(props.value, 'value', 'value') +382 stitchProps(props.label, 'label', 'label') +383 stitchProps(props.children, 'children', 'children') +384 stitchProps(props.disabled, 'disabled', 'disabled') +385 stitchProps(props.leaf, 'leaf', 'leaf') +386 ' }'387 )388 }389 const { tag, vModel, placeholder, size, name, disabled, clearable } = genFieldAttrs(field)390 const store = {391 tag,392 vModel,393 name,394 size,395 props: processProps(field.__attrs__.props),396 options: setDefaultValue(field.options, `:options='${toString(field.options, null, ' ')}'`),397 placeholder,398 separator: setDefaultValue(assetDefaultValue(field.separator, '/'), `separator="${field.separator}"`),399 clearable,400 disabled401 }402 return genFieldTemplate(store)403 },404 'el-upload' (field) {405 const config = field.__config__406 const { tag, disabled } = genFieldAttrs(field)407 const store = {408 tag,409 action: setDefaultValue(field.action, `action="${field.action}"`),410 headers: setDefaultValue(assetDefaultValue(toString(field.headers), toString({})), `:headers="${toString(field.headers, null, ' ')}"`),411 multiple: setDefaultValue(field.multiple, 'multiple'),412 data: setDefaultValue(assetDefaultValue(toString(field.data), toString({})), `:data="${toString(field.data, null, ' ')}"`),413 accept: setDefaultValue(field.accept, `accept="${field.accept}"`),414 listType: setDefaultValue(assetDefaultValue(field.listType, 'text'), `list-type="${field.listType}"`),415 fileList: setDefaultValue(assetDefaultValue(toString(field.fileList), toString([])), `:file-list="${toString(field.fileList, null, ' ')}"`),416 limit: setDefaultValue(field.limit, `:limit="${field.limit}"`),417 withCredentials: setDefaultValue(field.withCredentials, 'with-credentials'),418 showFileList: setDefaultValue(assetDefaultValue(field.showFileList, true), ':show-file-list="false"'),419 drag: setDefaultValue(field.drag, 'drag'),420 autoUpload: setDefaultValue(assetDefaultValue(field.autoUpload, true), ':auto-upload="false"'),421 disabled,422 ref: `ref="${config.type}"`,423 handleBeforeUpload: `:before-upload="${methodsName.beforeUpload}"`424 }425 return genFieldTemplate(store, config.type, field.__slot__, { autoUpload: field.autoUpload, config })426 },427 'el-transfer' (field) {428 const processData = function (data) {429 data = typeOf(data, 'function') ? data() : data430 data = typeOf(data, 'array') ? data : [data]431 return setDefaultValue(data, `:data="${data}"`)432 }433 const { tag, vModel } = genFieldAttrs(field)434 const store = {435 tag,436 vModel,437 data: processData(field.__attrs__.data),438 filterable: setDefaultValue(field.filterable, 'filterable'),439 filterablePlaceholder: setDefaultValue(field.filterablePlaceholder, `filter-placeholder="${field.filterablePlaceholder}"`),440 titles: setDefaultValue(assetDefaultValue(toString(field.titles), toString(['列表一', '列表二'])), `:titles="${field.titles}"`),441 buttonTexts: setDefaultValue(assetDefaultValue(toString(field.buttonTexts, toString([]))), `:button-texts="${field.buttonTexts}"`),442 targetOrder: setDefaultValue(assetDefaultValue(field.targetOrder, 'original'), `target-order="${field.targetOrder}"`)443 }444 return genFieldTemplate(store, field.__config__.type, field.__slot__)445 },446 'el-time' (field, pickerOptions) {447 const { tag, vModel, size, name, readonly, disabled, placeholder, clearable } = genFieldAttrs(field)448 const store = {449 tag,450 vModel,451 size,452 name,453 placeholder,454 startPlaceholder: setDefaultValue(field.startPlaceholder, `start-placeholder="${field.startPlaceholder}"`),455 endPlaceholder: setDefaultValue(field.endPlaceholder, `end-placeholder="${field.endPlaceholder}"`),456 align: setDefaultValue(assetDefaultValue(field.align, 'left'), `align="${field.align}"`),457 rangeSeparator: setDefaultValue(assetDefaultValue(field.rangeSeparator, '-'), `range-separator="${field.rangeSeparator}"`),458 prefixIcon: setDefaultValue(assetDefaultValue(field.prefixIcon, 'el-icon-time'), `prefix-icon="${field.prefixIcon}"`),459 clearIcon: setDefaultValue(assetDefaultValue(field.clearIcon, 'el-icon-circle-close'), `clear-icon="${field.clearIcon}"`),460 popperClass: setDefaultValue(field.popperClass, `popper-class="${field.popperClass}"`),461 isRange: setDefaultValue(field.isRange, 'is-range'),462 arrowControl: setDefaultValue(field.arrowControl, 'arrow-control'),463 pickerOptions: setDefaultValue(assetDefaultValue(pickerOptions, ':picker-options={ }'), pickerOptions),464 readonly,465 disabled,466 editable: setDefaultValue(field.editable, 'editable'),467 clearable468 }469 return store470 },471 'el-time-picker' (field) {472 const processPickerOptions = function (options) {473 return (474 ':picker-options={ ' +475 stitchProps(options.selectableRange, 'selectableRange') +476 stitchProps(options.format, 'format', 'HH:mm:ss') +477 ' }'478 )479 }480 const store = tags['el-time'](field, processPickerOptions(field.pickerOptions))481 return genFieldTemplate(store)482 },483 'el-time-select' (field) {484 const processPickerOptions = function (options) {485 return (486 ':picker-options={ ' +487 stitchProps(options.start, 'start', '08:00') +488 stitchProps(options.end, 'end', '18:00') +489 stitchProps(options.step, 'step', '00:30') +490 stitchProps(options.minTime, 'minTime', '00:00') +491 stitchProps(options.maxTime, 'maxTime', '23:59') +492 ' }'493 )494 }495 const store = tags['el-time'](field, processPickerOptions(field.pickerOptions))496 return genFieldTemplate(store)497 },498 'el-switch' (field) {499 const { tag, vModel, name, disabled } = genFieldAttrs(field)500 const store = {501 tag,502 vModel,503 name,504 width: setDefaultValue(assetDefaultValue(field.width, 40), `:width="${field.width}"`),505 activeIconClass: setDefaultValue(field.activeIconClass, `active-icon-class="${field.activeIconClass}"`),506 inactiveIconClass: setDefaultValue(field.inactiveIconClass, `inactive-icon-class="${field.inactiveIconClass}"`),507 activeColor: setDefaultValue(assetDefaultValue(field.activeColor, '#409EFF'), `active-color="${field.activeColor}"`),508 inactiveColor: setDefaultValue(assetDefaultValue(field.inactiveColor, '#C0CCDA'), `inactive-color="${field.inactiveColor}"`),509 disabled510 }511 return genFieldTemplate(store)512 },513 'el-slider' (field) {514 const { tag, vModel, name, disabled } = genFieldAttrs(field)515 const store = {516 tag,517 vModel,518 name,519 min: setDefaultValue(field.min, `:min="${field.min}"`),520 max: setDefaultValue(assetDefaultValue(field.max, 100), `:max="${field.max}"`),521 step: setDefaultValue(assetDefaultValue(field.step, 1), `:step="${field.step}"`),522 debounce: setDefaultValue(assetDefaultValue(field.debounce, 300), `:debounce="${field.debounce}"`),523 inputSize: setDefaultValue(assetDefaultValue(field.inputSize, 'small'), `input-size="${field.inputSize}"`),524 showInputControls: setDefaultValue(assetDefaultValue(field.showInputControls, true), 'show-input-controls'),525 showTooltip: setDefaultValue(assetDefaultValue(field.showTooltip, true), 'show-tooltip'),526 showStops: setDefaultValue(field.showStops, 'show-stops'),527 range: setDefaultValue(field.range, 'range'),528 vertical: setDefaultValue(field.vertical, 'vertical'),529 disabled530 }531 return genFieldTemplate(store)532 },533 'el-rate' (field) {534 const { tag, vModel, name, disabled } = genFieldAttrs(field)535 const store = {536 tag,537 vModel,538 name,539 max: setDefaultValue(assetDefaultValue(field.max, 5), `:max="${field.max}"`),540 colors: setDefaultValue(assetDefaultValue(toString(field.colors), toString(['#F7BA2A', '#F7BA2A', '#F7BA2A'])), `:colors="${toString(field.colors)}"`),541 voidColor: setDefaultValue(assetDefaultValue(field.voidColor, '#C6D1DE'), `void-color="${field.voidColor}"`),542 disabledVoidColor: setDefaultValue(assetDefaultValue(field.disabledVoidColor, '#EFF2F7'), `disabled-void-color="${field.disabledVoidColor}"`),543 textColor: setDefaultValue(assetDefaultValue(field.textColor, '#1F2D3D'), `text-color="${field.textColor}"`),544 texts: setDefaultValue(assetDefaultValue(toString(field.texts), toString(['极差', '失望', '一般', '满意', '惊喜'])), `:texts="${toString(field.texts)}"`),545 allowHalf: setDefaultValue(field.allowHalf, 'allow-half'),546 showText: setDefaultValue(field.showText, 'show-text'),547 showScore: setDefaultValue(field.showScore, 'show-score'),548 disabled549 }550 return genFieldTemplate(store)551 },552 'el-color-picker' (field) {553 const { tag, vModel, size, disabled } = genFieldAttrs(field)554 const store = {555 tag,556 vModel,557 size,558 colorFormat: setDefaultValue(assetDefaultValue(field.colorFormat, 'hex'), `color-format="${field.colorFormat}"`),559 popperClass: setDefaultValue(field.popperClass, `popper-class="${field.popperClass}"`),560 showAlpha: setDefaultValue(field.showAlpha, 'show-alpha'),561 disabled562 }563 return genFieldTemplate(store)564 }565 }566 return (function () {567 let template = ''568 template = (fields || []).map(item => layouts[item.__config__.layout](item)).join(endOfLine)569 return genFormTemplate(template, formConf)570 }())571}...

Full Screen

Full Screen

transition-options-list.js

Source:transition-options-list.js Github

copy

Full Screen

...29 keyword: 'twist',30 options: {31 direction: {32 ...formItemConfig.direction,33 data: setDefaultValue(formItemConfig.direction.data, [{34 value: 035 }])36 }37 },38 },39 {40 type: 21, //转场类型41 name: '抖动故障',42 key: 'GlitchMemories',43 keyword: 'twist',44 options: {},45 },46 {47 type: 22, //转场类型48 name: '圆点',49 key: 'PolkaDotsCurtain',50 keyword: 'twist',51 options: {52 dots: {53 ...formItemConfig.dots54 },55 center: {56 ...formItemConfig.center,57 data: setDefaultValue(formItemConfig.center.data, [{58 value: 059 }, {60 value: 061 }])62 }63 },64 },65 {66 type: 23, //转场类型67 name: '卡片切换',68 key: 'StereoViewer',69 keyword: 'twist',70 options: {71 corner_radius: {72 ...formItemConfig.corner_radius73 },74 zoom: {75 ...formItemConfig.zoom,76 max: 1,77 min: 0,78 step: 0.1,79 data: setDefaultValue(formItemConfig.zoom.data, [{80 value: 0.881 }])82 },83 },84 },85 {86 type: 24, //转场类型87 name: '位移',88 key: 'displacement',89 keyword: 'twist',90 options: {91 displacementMap: {92 ...formItemConfig.displacementMap93 },94 strength: {95 ...formItemConfig.strength,96 },97 },98 },99 {100 type: 25, //转场类型101 name: '折叠门',102 key: 'Windowslice',103 keyword: 'twist',104 options: {105 count: {106 ...formItemConfig.count,107 max: 50,108 min: 0,109 },110 smoothness: {111 ...formItemConfig.smoothness,112 max: 1,113 min: 0,114 step: 0.1,115 data: setDefaultValue(formItemConfig.smoothness.data, [{116 value: 0.5117 }])118 },119 },120 },121 {122 type: 26, //转场类型123 name: '上下切换',124 key: 'BowTieVertical',125 keyword: 'twist',126 options: {},127 }, {128 type: 27, //转场类型129 name: '左右切换',130 key: 'BowTieHorizontal',131 keyword: 'twist',132 options: {},133 }, {134 type: 28, //转场类型135 name: '模糊放大',136 key: 'SimpleZoom',137 keyword: 'twist',138 options: {139 zoom_quickness: {140 ...formItemConfig.zoom_quickness141 },142 },143 }, {144 type: 29, //转场类型145 name: '交叉模糊',146 key: 'LinearBlur',147 keyword: 'twist',148 options: {149 intensity: {150 ...formItemConfig.intensity151 },152 },153 }, {154 type: 30, //转场类型155 name: '水滴',156 key: 'WaterDrop',157 keyword: 'twist',158 options: {159 amplitude: {160 ...formItemConfig.amplitude,161 max: 100,162 min: 0,163 step: 1,164 data: setDefaultValue(formItemConfig.amplitude.data, [{165 value: 30166 }])167 },168 speed: {169 ...formItemConfig.speed,170 max: 100,171 },172 },173 }, {174 type: 31, //转场类型175 name: '右上翻页',176 key: 'InvertedPageCurl',177 keyword: 'switch',178 options: {},179 },180 // 参数direction需要更改181 {182 type: 32, //转场类型183 name: '亮度融化',184 key: 'Luminance_melt',185 keyword: 'switch',186 options: {187 direction: {188 name: '方向',189 dataType: 'bool',190 componentType: 'switch',191 data: [{192 name: '反向',193 value: true,194 }]195 },196 l_threshold: {197 ...formItemConfig.l_threshold198 },199 above: {200 ...formItemConfig.above201 },202 },203 },204 {205 type: 33, //转场类型206 name: '颜色溶解',207 key: 'ColourDistance',208 keyword: 'switch',209 options: {210 power: {211 ...formItemConfig.power,212 data: setDefaultValue(formItemConfig.power.data, [{213 value: 5214 }])215 },216 },217 }, {218 type: 34, //转场类型219 name: '中心圆切换',220 key: 'CircleCrop',221 keyword: 'switch',222 options: {223 bgcolor: {224 ...formItemConfig.bgcolor225 },226 },227 }, {228 type: 35, //转场类型229 name: '漩涡',230 key: 'Swirl',231 keyword: 'switch',232 options: {},233 }, {234 type: 36, //转场类型235 name: '晕染',236 key: 'Perlin',237 keyword: 'switch',238 options: {239 scale: {240 ...formItemConfig.scale,241 max: 30,242 min: 0,243 step: 1,244 data: setDefaultValue(formItemConfig.scale.data, [{245 value: 4246 }])247 },248 smoothness: {249 ...formItemConfig.smoothness,250 max: 1,251 step: 0.1252 },253 seed: {254 ...formItemConfig.seed255 },256 },257 }, {258 type: 37, //转场类型259 name: '波浪',260 key: 'Directionalwarp',261 keyword: 'switch',262 options: {263 direction: {264 ...formItemConfig.direction265 },266 },267 }, {268 type: 38, //转场类型269 name: '下拉切换',270 key: 'Bounce',271 keyword: 'switch',272 options: {273 shadow_colour: {274 ...formItemConfig.shadow_colour275 },276 shadow_height: {277 ...formItemConfig.shadow_height278 },279 bounces: {280 ...formItemConfig.bounces281 },282 },283 }, {284 type: 39, //转场类型285 name: '向右切换',286 key: 'WipeRight',287 keyword: 'switch',288 options: {},289 }, {290 type: 40, //转场类型291 name: '向左切换',292 key: 'WipeLeft',293 keyword: 'switch',294 options: {},295 }, {296 type: 41, //转场类型297 name: '向下切换',298 key: 'WipeDown',299 keyword: 'switch',300 options: {},301 }, {302 type: 42, //转场类型303 name: '向上切换',304 key: 'WipeUp',305 keyword: 'switch',306 options: {},307 }, {308 type: 43, //转场类型309 name: '交叉溶解',310 key: 'morph',311 keyword: 'switch',312 options: {313 strength: {314 ...formItemConfig.strength,315 data: setDefaultValue(formItemConfig.strength.data, [{316 value: 0.1317 }])318 },319 },320 }, {321 type: 44, //转场类型322 name: '径向变焦',323 key: 'CrossZoom',324 keyword: 'switch',325 options: {326 strength: {327 ...formItemConfig.strength328 },329 },330 }, {331 type: 45, //转场类型332 name: '声波',333 key: 'CrazyParametricFun',334 keyword: 'switch',335 options: {336 a: {337 ...formItemConfig.a338 },339 b: {340 ...formItemConfig.b341 },342 amplitude: {343 ...formItemConfig.amplitude,344 max: 150,345 min: 0,346 step: 1,347 data: setDefaultValue(formItemConfig.amplitude.data, [{348 value: 120349 }])350 },351 smoothness: {352 ...formItemConfig.smoothness,353 max: 1,354 step: 0.1355 },356 },357 }, {358 type: 46, //转场类型359 name: '波形履带',360 key: 'ButterflyWaveScrawler',361 keyword: 'switch',362 options: {363 amplitude: {364 ...formItemConfig.amplitude,365 max:3,366 min:0,367 },368 waves: {369 ...formItemConfig.waves370 },371 colorSeparation: {372 ...formItemConfig.colorSeparation,373 max:1374 },375 },376 }, {377 type: 47, //转场类型378 name: '万花筒',379 key: 'kaleidoscope',380 keyword: 'switch',381 options: {382 speed: {383 ...formItemConfig.speed,384 max: 10,385 min: 0,386 step: 1,387 data: setDefaultValue(formItemConfig.speed.data, [{388 value: 1.0389 }])390 },391 angle: {392 ...formItemConfig.angle393 },394 power: {395 ...formItemConfig.power396 },397 },398 }, {399 type: 48, //转场类型400 name: '波形溶解',401 key: 'Dreamy',402 keyword: 'switch',403 options: {},404 }, {405 type: 49, //转场类型406 name: '网格翻转',407 key: 'GridFlip',408 keyword: 'switch',409 options: {410 size: {411 ...formItemConfig.count,412 dataType: "vec2",413 max: 30,414 min: 1,415 step: 1,416 data: [{417 name: '宽',418 value: 4,419 }, {420 name: '高',421 value: 4,422 }]423 },424 pause: {425 ...formItemConfig.pause426 },427 dividerWidth: {428 ...formItemConfig.dividerWidth429 },430 bgcolor: {431 ...formItemConfig.bgcolor432 },433 randomness: {434 ...formItemConfig.randomness435 },436 },437 }, {438 type: 50, //转场类型439 name: '放大圆',440 key: 'ZoominCircles',441 keyword: 'switch',442 options: {},443 }, {444 type: 51, //转场类型445 name: '径向檫除',446 key: 'Radial',447 keyword: 'dissolution',448 options: {449 smoothness: {450 ...formItemConfig.smoothness,451 max: 2,452 min: 0,453 step: 0.1,454 data: setDefaultValue(formItemConfig.smoothness.data, [{455 value: 1456 }])457 },458 },459 }, {460 type: 52, //转场类型461 name: '马赛克',462 key: 'Mosaic',463 keyword: 'dissolution',464 options: {465 endx: {466 ...formItemConfig.endx467 },468 endy: {469 ...formItemConfig.endy470 },471 },472 }, {473 type: 53, //转场类型474 name: '波纹燃烧',475 key: 'undulatingBurnOut',476 keyword: 'dissolution',477 options: {478 smoothness: {479 ...formItemConfig.smoothness,480 max: 1,481 min: 0,482 step: 0.1,483 data: setDefaultValue(formItemConfig.smoothness.data, [{484 value: 0.1485 }])486 },487 center: {488 ...formItemConfig.center489 },490 color: {491 ...formItemConfig.color492 },493 },494 }, {495 type: 54, //转场类型496 name: '交叉影线',497 key: 'crosshatch',498 keyword: 'dissolution',499 options: {500 center: {501 ...formItemConfig.center,502 min: -1503 },504 threshold: {505 ...formItemConfig.threshold506 },507 fadeEdge: {508 ...formItemConfig.fadeEdge509 },510 },511 }, {512 type: 55, //转场类型513 name: '信号差',514 key: 'windowblinds',515 keyword: 'dissolution',516 options: {},517 }, {518 type: 56, //转场类型519 name: '椭圆切换',520 key: 'circle',521 keyword: 'dissolution',522 options: {523 center: {524 ...formItemConfig.center,525 min:-1526 },527 backColor: {528 ...formItemConfig.backColor,529 dataType: 'vec3',530 data: [{531 name: '背景颜色',532 value: "rgb(26, 26, 26)"533 }]534 },535 },536 }, {537 type: 57, //转场类型538 name: '圈开',539 key: 'circleopen',540 keyword: 'dissolution',541 options: {542 smoothness: {543 ...formItemConfig.smoothness,544 max: 1,545 min: 0,546 step: 0.1,547 data: setDefaultValue(formItemConfig.smoothness.data, [{548 value: 0.3549 }])550 },551 opening: {552 ...formItemConfig.opening553 },554 },555 }, {556 type: 58, //转场类型557 name: '色相淡入',558 key: 'colorphase',559 keyword: 'dissolution',560 options: {561 fromStep: {562 ...formItemConfig.fromStep563 },564 toStep: {565 ...formItemConfig.toStep566 },567 },568 }, {569 type: 59, //转场类型570 name: '六边形',571 key: 'hexagonalize',572 keyword: 'dissolution',573 options: {574 steps: {575 ...formItemConfig.steps576 },577 horizontalHexagons: {578 ...formItemConfig.horizontalHexagons579 },580 },581 }, {582 type: 60, //转场类型583 name: '小故障',584 key: 'GlitchDisplace',585 keyword: 'dissolution',586 options: {},587 }, {588 type: 61, //转场类型589 name: '闪白变焦',590 key: 'Dreamyzoom',591 keyword: 'dissolution',592 options: {593 rotation: {594 ...formItemConfig.rotation595 },596 scale: {597 ...formItemConfig.scale,598 max: 3,599 min: 0,600 step: 0.1,601 data: setDefaultValue(formItemConfig.scale.data, [{602 value: 1.2603 }])604 },605 },606 }, {607 type: 62, //转场类型608 name: '向下掉落',609 key: 'DoomscreenTransition',610 keyword: 'dissolution',611 options: {612 bars: {613 ...formItemConfig.bars614 },615 amplitude: {616 ...formItemConfig.amplitude,617 max: 10,618 min: 0,619 step: 0.1,620 data: setDefaultValue(formItemConfig.amplitude.data, [{621 value: 2622 }])623 },624 noise: {625 ...formItemConfig.noise626 },627 frequency: {628 ...formItemConfig.frequency629 },630 dripScale: {631 ...formItemConfig.dripScale632 },633 },634 }, {635 type: 63, //转场类型636 name: '波纹',637 key: 'ripple',638 keyword: 'dissolution',639 options: {640 amplitude: {641 ...formItemConfig.amplitude,642 max: 200,643 min: 0,644 step: 1,645 data: setDefaultValue(formItemConfig.amplitude.data, [{646 value: 100647 }])648 },649 speed: {650 ...formItemConfig.speed,651 max:200,652 },653 },654 }, {655 type: 64, //转场类型656 name: '风车',657 key: 'pinwheel',658 keyword: 'dissolution',659 options: {660 speed: {661 ...formItemConfig.speed,662 max: 30,663 min: 0,664 step: 1,665 data: setDefaultValue(formItemConfig.speed.data, [{666 value: 2667 }])668 },669 },670 }, {671 type: 65, //转场类型672 name: '逆时针径向擦除',673 key: 'angular',674 keyword: 'dissolution',675 options: {676 startingAngle: {677 ...formItemConfig.startingAngle678 },679 },680 }, {681 type: 66, //转场类型682 name: '颜色淡入',683 key: 'burn',684 keyword: 'dissolution',685 options: {686 color: {687 ...formItemConfig.color,688 data: setDefaultValue(formItemConfig.color.data, [{689 value: "rgb(230, 102, 51)"690 }])691 },692 },693 }, {694 type: 67, //转场类型695 name: '交叉扭曲',696 key: 'crosswarp',697 keyword: 'dissolution',698 options: {},699 }, {700 type: 68, //转场类型701 name: '形状切换',702 key: 'luma',703 keyword: 'dissolution',704 options: {705 luma: {706 ...formItemConfig.luma707 },708 },709 }, {710 type: 69, //转场类型711 name: '多重混合',712 key: 'multiply_blend',713 keyword: 'dissolution',714 options: {},715 }, {716 type: 70, //转场类型717 name: '像素格',718 key: 'pixelize',719 keyword: 'shape',720 options: {721 squaresMin: {722 ...formItemConfig.squaresMin723 },724 steps: {725 ...formItemConfig.steps726 },727 },728 }, {729 type: 71, //转场类型730 name: '立方体旋转',731 key: 'cube',732 keyword: 'shape',733 options: {734 persp: {735 ...formItemConfig.persp736 },737 unzoom: {738 ...formItemConfig.unzoom739 },740 reflection: {741 ...formItemConfig.reflection742 },743 floating: {744 ...formItemConfig.floating745 },746 },747 }, {748 type: 72, //转场类型749 name: '定向擦除',750 key: 'directionalwipe',751 keyword: 'shape',752 options: {753 direction: {754 ...formItemConfig.direction755 },756 smoothness: {757 ...formItemConfig.smoothness,758 max: 2,759 min: 0,760 step: 0.1,761 data: setDefaultValue(formItemConfig.smoothness.data, [{762 value: 0.5763 }])764 },765 },766 }, {767 type: 73, //转场类型768 name: '双侧平推门',769 key: 'doorway',770 keyword: 'shape',771 options: {772 reflection: {773 ...formItemConfig.reflection,774 max: 1,775 min: 0,776 step: 0.1,777 data: setDefaultValue(formItemConfig.reflection.data, [{778 value: 0.4779 }])780 },781 perspective: {782 ...formItemConfig.perspective783 },784 depth: {785 ...formItemConfig.depth786 },787 },788 }, {789 type: 74, //转场类型790 name: '淡入',791 key: 'fade',792 keyword: 'shape',793 options: {},794 }, {795 type: 75, //转场类型796 name: '淡入淡出',797 key: 'fadecolor',798 keyword: 'shape',799 options: {800 color: {801 ...formItemConfig.color802 },803 colorPhase: {804 ...formItemConfig.colorPhase805 },806 },807 }, {808 type: 76, //转场类型809 name: '褪色交叉',810 key: 'fadegrayscale',811 keyword: 'shape',812 options: {813 intensity: {814 ...formItemConfig.intensity,815 max: 1,816 min: 0,817 step: 0.01,818 data: setDefaultValue(formItemConfig.intensity.data, [{819 value: 0.3820 }])821 },822 },823 }, {824 type: 77, //转场类型825 name: '玻璃',826 key: 'flyeye',827 keyword: 'shape',828 options: {829 size: {830 ...formItemConfig.size,831 max:5,832 min:0,833 step:0.1834 },835 zoom: {836 ...formItemConfig.zoom837 },838 colorSeparation: {839 ...formItemConfig.colorSeparation,840 max:1841 },842 },843 }, {844 type: 78, //转场类型845 name: '爱心擦除',846 key: 'heart',847 keyword: 'shape',848 options: {},849 }, {850 type: 79, //转场类型851 name: '波纹擦除',852 key: 'polar_function',853 keyword: 'shape',854 options: {855 segments: {856 ...formItemConfig.segments857 },858 },859 }, {860 type: 80, //转场类型861 name: '方格',862 key: 'randomsquares',863 keyword: 'shape',864 options: {865 size: {866 name: '数量',867 dataType: 'vec2',868 componentType: 'slider',869 max: 30,870 min: 1,871 step: 1,872 data: [{873 name: '行',874 value: 10,875 }, {876 name: '列',877 value: 10,878 }]879 },880 smoothness: {881 ...formItemConfig.smoothness,882 max: 1,883 min: 0,884 step: 0.1,885 data: setDefaultValue(formItemConfig.smoothness.data, [{886 value: 0.5887 }])888 },889 },890 }, {891 type: 81, //转场类型892 name: '放大旋转',893 key: 'rotate_scale_fade',894 keyword: 'shape',895 options: {896 center: {897 ...formItemConfig.center898 },899 rotations: {900 ...formItemConfig.rotations901 },902 scale: {903 ...formItemConfig.scale,904 min:0905 },906 backColor: {907 ...formItemConfig.backColor908 },909 },910 }, {911 type: 82, //转场类型912 name: '方格擦除',913 key: 'squareswire',914 keyword: 'shape',915 options: {916 squares: {917 ...formItemConfig.squares918 },919 direction: {920 ...formItemConfig.direction921 },922 smoothness: {923 ...formItemConfig.smoothness,924 max: 1,925 min: 0,926 step: 0.1,927 data: setDefaultValue(formItemConfig.smoothness.data, [{928 value: 0.8929 }])930 },931 },932 }, {933 type: 83, //转场类型934 name: '挤压',935 key: 'squeeze',936 keyword: 'shape',937 options: {938 colorSeparation: {939 ...formItemConfig.colorSeparation,940 max: 2,941 min: 0,942 step: 0.01,943 data: setDefaultValue(formItemConfig.colorSeparation.data, [{944 value: 0.1945 }])946 },947 },948 }, {949 type: 84, //转场类型950 name: '交换',951 key: 'swap',952 keyword: 'shape',953 options: {954 reflection: {955 ...formItemConfig.reflection956 },957 perspective: {958 ...formItemConfig.perspective,959 max:1,960 min:0,961 step:0.1,962 data: setDefaultValue(formItemConfig.perspective.data, [{963 value: 0.2964 }])965 },966 depth: {967 ...formItemConfig.depth968 },969 },970 }, {971 type: 85, //转场类型972 name: '风',973 key: 'wind',974 keyword: 'shape',975 options: {976 size: {977 ...formItemConfig.size,978 max: 1,979 min: 0,980 step: 0.1,981 data: setDefaultValue(formItemConfig.size.data, [{982 value: 0.2983 }])984 },985 },986 } ...

Full Screen

Full Screen

Repair_DropOff_Two_Return_Label_Status_Five.js

Source:Repair_DropOff_Two_Return_Label_Status_Five.js Github

copy

Full Screen

...9 nlapiLogExecution("Debug","Repair Order Delivery Information if block",JSON.stringify(retObj));10 //var noOfTimesRepaired = request.getParameter("custpage_num_times_repaired");11 //nlapiLogExecution("Debug","No Of Times Repaired",noOfTimesRepaired);12 /* start here Set get data values */13 form.addField("custpage_order_num","text","Order Number").setDisplayType('hidden').setDefaultValue(orderNumber);14 form.addField("custpage_customer","text","Customer").setDisplayType('hidden').setDefaultValue(retObj.customer);15 form.addField("custpage_delivery_date","text","Delivery Date").setDisplayType('hidden').setDefaultValue(retObj.deliveryDate);16 form.addField("custpage_delivery_date_firm","checkbox","Delivery Date Firm").setDisplayType('hidden').setDefaultValue(retObj.deliveryDateFirm);17 form.addField("custpage_or_notes","textarea","Or Notes").setDisplayType('hidden').setDefaultValue(retObj.orNotes);18 form.addField("custpage_sales_rep","text","Sales Rep").setDisplayType('hidden').setDefaultValue(retObj.salesrep);19 form.addField("custpage_date_received_at_be","text","Date Received").setDisplayType('hidden').setDefaultValue(retObj.datereceived);20 form.addField("custpage_location_received_at_be","text","Location Received").setDisplayType('hidden').setDefaultValue(retObj.locationReceived);21 form.addField("custpage_pickup_location","text","Pick-up Loaction").setDisplayType('hidden').setDefaultValue(retObj.pickupLocation);22 form.addField("custpage_drop_off","text","Drop Off").setDisplayType('hidden').setDefaultValue(dropOff);23 form.addField("custpage_so_notes","textarea","Sales Order Notes").setDisplayType('hidden').setDefaultValue(retObj.so_notes);//Added on 03/06/201724 //start here set shipping information25 form.addField("custpage_addressee","text","addressee").setDisplayType('hidden').setDefaultValue(retObj.addressee);26 form.addField("custpage_attention","text","attention").setDisplayType('hidden').setDefaultValue(retObj.attention);27 form.addField("custpage_address_1","text","address1").setDisplayType('hidden').setDefaultValue(retObj.address1);28 form.addField("custpage_address_2","text","address2").setDisplayType('hidden').setDefaultValue(retObj.address2);29 form.addField("custpage_city","text","city").setDisplayType('hidden').setDefaultValue(retObj.city);30 form.addField("custpage_state","text","state").setDisplayType('hidden').setDefaultValue(retObj.state);31 form.addField("custpage_state_new","text","state new").setDisplayType('hidden').setDefaultValue(retObj.state_txt);32 form.addField("custpage_zip","text","zipcode").setDisplayType('hidden').setDefaultValue(retObj.zipcode);33 form.addField("custpage_country","text","country").setDisplayType('hidden').setDefaultValue(retObj.country);34 form.addField("custpage_delivery_instruction","text","delivery_instruction").setDisplayType('hidden').setDefaultValue(retObj.delivery_instruction);35 form.addField("custpage_delivery_date_notes","textarea","delivery_date_notes").setDisplayType('hidden').setDefaultValue(retObj.delivery_date_notes);36 form.addField("custpage_country_hidden","text","country hidden").setDisplayType('hidden').setDefaultValue(retObj.country_hid);37 form.addField("custpage_pickup_at_be","checkbox","Pick At Be").setDisplayType('hidden').setDefaultValue(retObj.pickup_at_be);38 form.addField("custpage_place_of_sale","text","Place Of Sale").setDisplayType('hidden').setDefaultValue(retObj.placeofsale);39 form.addField("custpage_num_times_repaired","integer","Number Of Times Repaired").setDisplayType('hidden').setDefaultValue(retObj.num_times_repaired);40 form.addField('custpage_copy_email_template_id','text','Copy Email Template').setDisplayType('hidden').setDefaultValue('0'); 41 // end here42 /* end here */43 var customers_reported_repair_issue = request.getParameter("custpage_customers_reported_repair_issue");44 var wear_habits = request.getParameter("custpage_wear_habits");45 var notice_issue = request.getParameter("custpage_notice_issue");46 var customer_temp = request.getParameter("custpage_customer_temp");47 var insurance_or_bbesp = request.getParameter("custpage_insurance_or_bbesp");48 var contact_inspection = request.getParameter("custpage_contact_inspection");49 form.addField("custpage_customers_reported_repair_issue","text","What is the Customers reported repair issue?").setDisplayType('hidden').setDefaultValue(customers_reported_repair_issue);50 form.addField("custpage_wear_habits","text","Wear habits?").setDisplayType('hidden').setDefaultValue(wear_habits);51 form.addField("custpage_notice_issue","text","When did they notice issue?").setDisplayType('hidden').setDefaultValue(notice_issue);52 form.addField("custpage_customer_temp","text","Customer temp?").setDisplayType('hidden').setDefaultValue(customer_temp);53 form.addField("custpage_insurance_or_bbesp","text","Insurance or BBESP?").setDisplayType('hidden').setDefaultValue(insurance_or_bbesp);54 form.addField("custpage_contact_inspection","text","Who to contact after inspection?").setDisplayType('hidden').setDefaultValue(contact_inspection);55 // set ship service for return label creation 56 //var shipService = setShipService(orderId);57 //var tranidFld = form.addField("custpage_tranid","text","Transaction #");58 //tranidFld.setDisplayType("hidden");59 //tranidFld.setDefaultValue(shipService[1]);60 //nlapiLogExecution("Debug","Trans Id",shipService[1]);61 //var fld = form.addField("custpage_service_type","text","Ship Service");62 //fld.setDisplayType('hidden');63 //fld.setDefaultValue(shipService[0]);64 //nlapiLogExecution("Debug","Ship Service",shipService[0]);65 fld = form.addField("custpage_order_id","text","Sales Order Internal ID");66 fld.setDefaultValue(orderId);67 fld.setDisplayType("hidden");68 var custEmail= nlapiLookupField('salesorder',orderId,'custbody2');69 try70 { 71 form.setScript('customscript_back_data_url');72 form.addTab("custpage_repair_review_tab","");73 form.addSubTab("custpage_repair_review_subtab","").setLabel('Select people to copy in this email or add email addresses directly from the list below.');74 form.addSubmitButton('Send Label'); 75 // var copyemailtemplateid = request.getParameter('custpage_copy_email_template_id');76 var emailType ="repair";77 var repair_emailPreview = emailPreview(orderId,emailType);78 form.addButton('custpage_email_preview','Preview Email', repair_emailPreview); 79 var edit_EmailTemplate = editEmailTemplate(orderId,emailType);80 form.addButton('custpage_edit_email_template','Edit Email Template', edit_EmailTemplate); 81 // form.addField('custpage_copy_email_template_id','text','Copy Email Template').setDisplayType('hidden').setDefaultValue('0'); 82 // form.addButton('custpage_back', 'Back', "window.history.go(-2);");83 var postSaleType='1';84 //var backDataUrl_LandingPage = backDataUrlLandingPage(orderId,postSaleType);85 // nlapiLogExecution("Debug","Back Data Url for Repair",backDataUrl_LandingPage);86 //form.addButton('custpage_back_btn','Back',backDataUrl_LandingPage);87 form.addButton('custpage_back_btn','Back','Back_Data_Url_on_Send_label_to_Customer('+orderId+','+postSaleType+')');88 //form.addButton('custpage_refresh_final_page','Refresh', "pageRefresh()");89 form.addButton('custpage_close', 'Close', "window.close();" ); 90 form.addField('custpage_repair_id','text').setDisplayType('hidden').setDefaultValue('1');91 //form.setScript('customscript_copy_others');92 form.addField("custpage_email_address","text","Email Address").setMandatory(true).setDefaultValue(custEmail);93 var sublistcopyemail = form.addSubList('custpage_employee_list', 'inlineeditor', '','custpage_repair_review_subtab');94 sublistcopyemail.addField('custpage_copy_others','select', 'Copy Others','employee');95 sublistcopyemail.addField('custpage_email','text', 'Email');96 sublistcopyemail.addField('custpage_email_cc','checkbox', 'CC');97 sublistcopyemail.addField('custpage_email_bcc','checkbox', 'BCC');98 var return_label_insurance =0; 99 var rtnItemBe =[]; 100 for(var i=1; i<=request.getLineItemCount("custpage_items"); i++)101 {102 var shipping_to_be = request.getLineItemValue("custpage_items", "sublist_shipping_to_be", i);103 if(shipping_to_be == 'T')104 {105 var itemId= request.getLineItemValue("custpage_items", "sublist_item", i);106 nlapiLogExecution("debug","item Id",itemId);107 var description = request.getLineItemValue("custpage_items", "sublist_desc", i);108 nlapiLogExecution("debug","description",description);109 var amount = request.getLineItemValue("custpage_items", "sublist_amt", i);110 nlapiLogExecution("debug","amount",amount);111 var quantity = request.getLineItemValue("custpage_items", "sublist_qty", i);112 nlapiLogExecution("debug","amount",quantity);113 var insurance = request.getLineItemValue("custpage_items", "sublist_production_ins_value", i);114 if(insurance !=null && insurance != '')115 return_label_insurance =parseFloat(return_label_insurance) + parseFloat(insurance);116 var saleAmt = request.getLineItemValue("custpage_items", "sublist_sale_amount", i); 117 var itemLink = request.getLineItemValue("custpage_items", "sublist_item_link", i);118 var createdFrom = request.getLineItemValue("custpage_items", "sublist_created_from", i);119 var centerStoneLink = request.getLineItemValue("custpage_items", "sublist_center_stone_link", i); 120 var relatedSalesOrder = request.getLineItemValue("custpage_items", "sublist_related_sales_order", i);121 rtnItemBe.push({122 custpage_rtn_item:itemId,123 custpage_rtn_item_des :description,124 custpage_rtn_item_amount : amount,125 custpage_rtn_item_sale_amt : saleAmt,126 custpage_rtn_item_qty : quantity,127 custpage_rtn_item_production_ins_val : insurance,128 custpage_rtn_item_link : itemLink,129 custpage_rtn_item_created_from : createdFrom,130 custpage_rtn_item_center_stone_link : centerStoneLink,131 custpage_rtn_item_related_sales_order : relatedSalesOrder132 }); 133 }134 }135 nlapiLogExecution("Debug","JSON Return Item Be",JSON.stringify(rtnItemBe));136 nlapiLogExecution("Debug","Production Insurance Value",return_label_insurance);137 form.addField("custpage_insurance_val","currency","Production Insuranace Value").setDisplayType('hidden').setDefaultValue(return_label_insurance);138 var item_rtn_be=form.addSubList('custpage_customer_item_returning_be', 'list', 'Customer Item Returning to BE','custpage_repair_review_tab');139 item_rtn_be.addField('custpage_rtn_item','select', 'Item','item').setDisplayType('inline');140 item_rtn_be.addField('custpage_rtn_item_des','textarea', 'Description');141 item_rtn_be.addField('custpage_rtn_item_sale_amt','currency', 'SALE AMOUNT').setDisplayType('hidden');142 item_rtn_be.addField('custpage_rtn_item_qty','integer', 'Quantity');143 item_rtn_be.addField('custpage_rtn_item_amount','currency', 'Amount');144 item_rtn_be.addField('custpage_rtn_item_production_ins_val','currency','Production Insurance Value').setDisplayType('hidden');145 item_rtn_be.addField('custpage_rtn_item_link','text', 'Item SKU').setDisplayType('hidden');;146 item_rtn_be.addField('custpage_rtn_item_created_from','select','CREATED FROM','transaction').setDisplayType('hidden'); ;147 item_rtn_be.addField('custpage_rtn_item_center_stone_link','select','Center Stone SKU','item').setDisplayType('hidden');;148 item_rtn_be.addField('custpage_rtn_item_related_sales_order','select','Related Sales Order(s)','transaction').setDisplayType('hidden'); ;149 item_rtn_be.setLineItemValues(rtnItemBe);150 form.addField('custpage_field_color','inlinehtml').setDefaultValue("<style type='text/css'> #custpage_email_address{background-color:#fce0d6 !important;} </style>");151 response.writePage(form);152 deleteNewEmailTemplate();153 // fillbackData(retObj,rtnItemBe,orderId);154 }155 catch(err)156 {157 nlapiLogExecution("error","Resize Page Processing Error in else block","Details: " + err.message);158 return true;159 }160}161/*function editEmailTemplate(orderId,emailType)162{163 nlapiLogExecution("Debug","Information","Order Id :"+orderId);164 nlapiLogExecution("Debug","Information","Email Type :"+emailType);...

Full Screen

Full Screen

sceneFinal.js

Source:sceneFinal.js Github

copy

Full Screen

...3}4GAME.sceneFinal.prototype.createSceneFinal = function (){5 var baseUrl = this.baseUrl;6 this.phone = new PIXI.Sprite.fromImage(baseUrl+'phone.png');7 setDefaultValue(this.phone,640,GAME.height,0,0,null,null,0);8 this.backPage = new PIXI.Sprite.fromImage(baseUrl+'bg.jpg');9 setDefaultValue(this.backPage,640,GAME.height,0,0,null,null,0);10 this.background = new PIXI.Sprite.fromImage(baseUrl+'bg.jpg');11 setDefaultValue(this.background,640,GAME.height,0,0,null,null,0);12 this.logo = new PIXI.Sprite.fromImage('./src/img/sceneC/logo.png');13 setDefaultValue(this.logo,157,43,35,28);14 this.tracer = new PIXI.Container();15 setDefaultValue(this.tracer,41,331,310,150,null,null,0);16 this.hand = new PIXI.Sprite.fromImage('./src/img/sceneA/hand.png');17 setDefaultValue(this.hand,100,81,10,10);18 this.tracer2 = new PIXI.Container();19 setDefaultValue(this.tracer2,41,331,310,150,null,null,0);20 this.hand2 = new PIXI.Sprite.fromImage('./src/img/sceneA/hand.png');21 setDefaultValue(this.hand2,100,81,10,10);22 this.b1 = new PIXI.Sprite.fromImage(baseUrl+'b1.png');23 setDefaultValue(this.b1,170,240,0,839);24 this.b2 = new PIXI.Sprite.fromImage(baseUrl+'b2.png');25 setDefaultValue(this.b2,211,201,55,678);26 this.b3 = new PIXI.Sprite.fromImage(baseUrl+'b4.png');27 setDefaultValue(this.b3,126,123,118,547);28 this.b4 = new PIXI.Sprite.fromImage(baseUrl+'b4.png');29 setDefaultValue(this.b4,126,123,189,437);30 this.b5 = new PIXI.Sprite.fromImage(baseUrl+'b5.png');31 setDefaultValue(this.b5,117,92,258,362);32 this.b6 = new PIXI.Sprite.fromImage(baseUrl+'b6.png');33 setDefaultValue(this.b6,129,86,310,299);34 this.b7 = new PIXI.Sprite.fromImage(baseUrl+'b7.png');35 setDefaultValue(this.b7,76,55,381,259);36 this.zn_text = new PIXI.Sprite.fromImage('./src/img/sceneB/zn_text.png');37 setDefaultValue(this.zn_text,74,175,544,330,.8,.5);38 this.znStarMap = new PIXI.Sprite.fromImage('./src/img/sceneB/zn.png');39 setDefaultValue(this.znStarMap,490,382,493,185,.5,.5);40// 195 ->54341 this.girl = new PIXI.Sprite.fromImage(baseUrl+'girl.png');42 setDefaultValue(this.girl,87,99,235,255,null,null,0);43 this.boy = new PIXI.Sprite.fromImage(baseUrl+'boy.png');44 setDefaultValue(this.boy,65,66,325,280,null,null,0);45 this.ball = new PIXI.Sprite.fromImage(baseUrl+'ball.png');46 setDefaultValue(this.ball,355,483,0,30);47 this.love = new PIXI.Sprite.fromImage(baseUrl+'love.png');48 setDefaultValue(this.love,398,312,300,310,null,.5,1);49 this.bridge = new PIXI.Sprite.fromImage(baseUrl+'bridge.png');50 // setDefaultValue(this.bridge,543,182,44,344);51 setDefaultValue(this.bridge,606,210,5,364);52 this.happy = new PIXI.Sprite.fromImage(baseUrl+'happy.png');53 setDefaultValue(this.happy,610,466,14,598,null,null,0);54 this.nl = new PIXI.Sprite.fromImage(baseUrl+'nl.png');55 setDefaultValue(this.nl,105,135,22,297);56 this.zn = new PIXI.Sprite.fromImage(baseUrl+'zn.png');57 setDefaultValue(this.zn,136,152,490,293);58 this.meet = new PIXI.Sprite.fromImage(baseUrl+'meet.png');59 setDefaultValue(this.meet,164,167,222,215,null,null,0);60 this.jin = new PIXI.Sprite.fromImage(baseUrl+'jin.png');61 setDefaultValue(this.jin,100,73,120,66);62 this.jin.anchor.set(.3,.5);63 this.heart = new PIXI.Sprite.fromImage(baseUrl+'heart.png');64 this.hearts = [];65 for(var i=0;i<6;i++){66 var h = new PIXI.Sprite.fromImage(baseUrl+'heart.png');67 var y = 20 - i*(Math.random()*5+3);68 setDefaultValue(h,29,21,80,y,null,.5,1);69 h.delay = .3 * Math.random();70 h.dir = -.5+Math.random();71 // h.speed = .1+Math.random()*.5;72 this.hearts.push(h);73 }74 this.backPage.addChild(this.b1);75 this.backPage.addChild(this.b2);76 this.backPage.addChild(this.b3);77 this.backPage.addChild(this.b4);78 this.backPage.addChild(this.b5);79 this.backPage.addChild(this.b6);80 this.backPage.addChild(this.b7);81 this.backPage.addChild(this.znStarMap);82 this.backPage.addChild(this.zn_text);...

Full Screen

Full Screen

text.js

Source:text.js Github

copy

Full Screen

...13 }14 static get styles() {15 return [unsafeCSS(styles)];16 }17 setDefaultValue(propName, propVal) {18 // Unless prop is explicitly set with an attribute, override default value from schema with `propVal`.19 const attr = this.getAttribute(propName);20 return attr ? attr : propVal;21 }22 render() {23 let longText = false; // Right now we are only checking this for headline (below)24 // Headline defaults25 if (this.headline) {26 this.tag = this.setDefaultValue('tag', 'h2');27 this.color = this.setDefaultValue('color', 'theme-headline');28 this.letterSpacing = this.setDefaultValue('letter-spacing', 'narrow');29 this.fontFamily = this.setDefaultValue('font-family', 'headline');30 this.fontSize = this.setDefaultValue('font-size', 'xlarge');31 this.fontWeight = this.setDefaultValue('font-weight', 'bold');32 if (33 this.textContent.trim().length >= 60 &&34 this.fontSize === 'xxxlarge'35 ) {36 longText = true;37 }38 }39 // Subheadline defaults40 if (this.subheadline) {41 this.color = this.setDefaultValue('color', 'theme-headline');42 this.fontFamily = this.setDefaultValue('font-family', 'headline');43 this.fontSize = this.setDefaultValue('font-size', 'large');44 }45 // Eyebrow defaults46 if (this.eyebrow) {47 this.color = this.setDefaultValue('color', 'theme-headline');48 this.textTransform = this.setDefaultValue('text-transform', 'uppercase');49 this.letterSpacing = this.setDefaultValue('letter-spacing', 'wide');50 this.lineHeight = this.setDefaultValue('line-height', 'tight');51 this.fontFamily = this.setDefaultValue('font-family', 'headline');52 this.fontSize = this.setDefaultValue('font-size', 'xsmall');53 this.opacity = this.setDefaultValue('opacity', 80);54 }55 // Important classes56 const classes = cx('c-bolt-text-v2', {57 [`is-long`]: longText,58 [`c-bolt-text-v2--${this.display}`]: this.display,59 [`c-bolt-text-v2--${this.fontFamily}`]: this.fontFamily,60 [`c-bolt-text-v2--font-size-${this.fontSize}`]: this.fontSize,61 [`c-bolt-text-v2--font-weight-${this.fontWeight}`]: this.fontWeight,62 [`c-bolt-text-v2--font-style-${this.fontStyle}`]: this.fontStyle,63 [`c-bolt-text-v2--color-${this.color}`]: this.color,64 [`c-bolt-text-v2--letter-spacing-${this.letterSpacing}`]: this65 .letterSpacing,66 [`c-bolt-text-v2--align-${this.align}`]: this.align,67 [`c-bolt-text-v2--text-transform-${this.textTransform}`]: this...

Full Screen

Full Screen

Param.js

Source:Param.js Github

copy

Full Screen

...8 });9 10 test('defaultValue', () => {11 var param = new Param('ab');12 param.setDefaultValue(123);13 assert.equal(123, param.defaultValue());14 });15 16 test('defaultValue for not optional', () => {17 var param = new Param('ab');18 param.setDefaultValue(123);19 param.setIsOptional(false);20 assert.isUndefined(param.defaultValue());21 });22 23 test('setDefaultValue updates isOptional', () => {24 var param = new Param('ab');25 param.setDefaultValue(123);26 assert.isTrue(param.isOptional());27 });28 29 test('hasDefaultValue', () => {30 var param1 = new Param('ab');31 param1.setDefaultValue(123);32 assert.isTrue(param1.hasDefaultValue());33 34 var param2 = new Param('ab');35 param2.setDefaultValue('');36 assert.isTrue(param2.hasDefaultValue());37 38 var param3 = new Param('ab');39 param3.setDefaultValue('');40 param3.setIsOptional(false);41 assert.isFalse(param3.hasDefaultValue());42 43 var param4 = new Param('ab');44 assert.isFalse(param4.hasDefaultValue());45 });46 47 test('isOptional', () => {48 var param1 = new Param('ab');49 50 assert.isFalse(param1.isOptional());51 52 param1.setIsOptional(true);53 assert.isTrue(param1.isOptional());54 });55 56 test('isAutoFillURL', () => {57 var param1 = new Param('ab');58 assert.isFalse(param1.isAutoFillURL());59 60 var param2 = new Param('ab');61 param2.setDefaultValue('');62 assert.isFalse(param2.isAutoFillURL());63 64 var param3 = new Param('ab');65 param3.setDefaultValue('');66 param3.setIsAutoFillURL(true);67 assert.isTrue(param3.isAutoFillURL());68 69 var param4 = new Param('ab');70 param3.setDefaultValue('');71 param3.setIsAutoFillURL(true);72 param3.setIsOptional(false);73 assert.isFalse(param4.isAutoFillURL());74 });75 76 test('validate', () => {77 var param1 = new Param('ab');78 assert.isTrue(param1.validate());79 });80 81 test('encode', () => {82 var param1 = new Param('ab');83 assert.strictEqual('123', param1.encode(123));84 });...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1function setDefaultValue(obj, value) {2 return obj === undefined? value : obj3}4module.exports = function safetify(config) {5 if (typeof config !== 'object') {6 throw new TypeError('Expect an object but got ' + typeof config)7 }8 config.resolve = setDefaultValue(config.resolve, {})9 config.resolve.extensions = setDefaultValue(config.resolve.extensions, ['', '.js'])10 config.resolveLoader = setDefaultValue(config.resolveLoader, {})11 config.resolveLoader.modulesDirectories = setDefaultValue(config.resolveLoader.modulesDirectories, [])12 config.module = setDefaultValue(config.module, {})13 config.module.loaders = setDefaultValue(config.module.loaders, [])14 config.plugins = setDefaultValue(config.plugins, [])15 return config...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setDefaultValue } = require('playwright');2setDefaultValue('video', 'on');3setDefaultValue('trace', 'retain-on-failure');4const { chromium } = require('playwright');5(async () => {6 const browser = await chromium.launch();7 const context = await browser.newContext();8 const page = await context.newPage();9 await page.screenshot({ path: `example.png` });10 await browser.close();11})();12module.exports = {13};14describe('playwright', () => {15 it('should launch the browser', async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.route('**/login', route => route.fulfill({7 }));8 const input = await page.$('input');9 await input.evaluateHandle(input => input.setDefaultValue('bar'));10 const value = await page.evaluate(() => document.querySelector('input').value);11 await browser.close();12})();13const { chromium } = require('playwright');14(async () => {15 const browser = await chromium.launch();16 const context = await browser.newContext();17 const page = await context.newPage();18 await page.route('**/login', route => route.fulfill({19 }));20 const input = await page.$('input');21 await input.evaluateHandle(input => input.setDefaultValue('bar'));22 const value = await page.evaluate(() => document.querySelector('input').value);23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.route('**/login', route => route.fulfill({

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setDefaultValue } = require('playwright/lib/server/page');2setDefaultValue('page.screenshot', 'fullPage', true);3const { setDefaultTimeout } = require('playwright/lib/server/browserContext');4setDefaultTimeout(30000);5const { setDefaultOptions } = require('playwright/lib/server/browserContext');6setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });7const { setDefaultOptions } = require('playwright/lib/server/browserContext');8setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });9const { setDefaultOptions } = require('playwright/lib/server/browserContext');10setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });11const { setDefaultOptions } = require('playwright/lib/server/browserContext');12setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });13const { setDefaultOptions } = require('playwright/lib/server/browserContext');14setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });15const { setDefaultOptions } = require('playwright/lib/server/browserContext');16setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });17const { setDefaultOptions } = require('playwright/lib/server/browserContext');18setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });19const { setDefaultOptions } = require('playwright/lib/server/browserContext');20setDefaultOptions('browser.newContext', { viewport: { width: 1280, height: 720 } });

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({headless: false});4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.frame({name: 'iframeResult'}).setInputFiles('input[type="file"]', 'test.txt')7 await page.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setDefaultValue } = require('playwright/lib/utils/utils');2setDefaultValue('video', 'off');3setDefaultValue('screenshot', 'only-on-failure');4setDefaultValue('timeout', 30000);5const { setDefaultOptions } = require('playwright/lib/server/browserType');6setDefaultOptions({7});8module.exports = {9}10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await browser.close();23})();24const { chromium } = require('playwright');25(async () => {26 const browser = await chromium.launch({27 });28 const context = await browser.newContext();29 const page = await context.newPage();30 await browser.close();31})();32const { chromium } = require('playwright');33(async () => {34 const browserServer = await chromium.launchServer({35 });36 const browser = await chromium.connect({37 wsEndpoint: browserServer.wsEndpoint()38 });39 const context = await browser.newContext();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setDefaultValue } = require('playwright/lib/internal/transport');2setDefaultValue('timeout', 10000);3setDefaultValue('retries', 3);4const { setDefaultTimeout } = require('playwright/lib/internal/timeoutSettings');5setDefaultTimeout(10000);6const { setDefaultRetries } = require('playwright/lib/internal/retrySettings');7setDefaultRetries(3);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setDefaultValue } = require('playwright/lib/internal/record/replay/codegen');2setDefaultValue('page', 'page');3setDefaultValue('frame', 'frame');4setDefaultValue('element', 'element');5setDefaultValue('locator', 'locator');6setDefaultValue('value', 'value');7setDefaultValue('text', 'text');8setDefaultValue('url', 'url');9setDefaultValue('path', 'path');10setDefaultValue('options', 'options');11setDefaultValue('timeout', 'timeout');12setDefaultValue('interval', 'interval');13setDefaultValue('handle', 'handle');14setDefaultValue('name', 'name');15setDefaultValue('label', 'label');16setDefaultValue('selector', 'selector');17setDefaultValue('xpath', 'xpath');18setDefaultValue('expression', 'expression');19setDefaultValue('arg', 'arg');20setDefaultValue('args', 'args');21setDefaultValue('data', 'data');22setDefaultValue('file', 'file');23setDefaultValue('files', 'files');24setDefaultValue('force', 'force');25setDefaultValue('noWaitAfter', 'noWaitAfter');26setDefaultValue('noWaitBefore', 'noWaitBefore');27setDefaultValue('state', 'state');28setDefaultValue('button', 'button');29setDefaultValue('clickCount', 'clickCount');30setDefaultValue('delay', 'delay');31setDefaultValue('options', 'options');32setDefaultValue('typeTextOptions', 'typeTextOptions');33setDefaultValue('keyboard', 'keyboard');34setDefaultValue('mouse', 'mouse');35setDefaultValue('modifiers', 'modifiers');36setDefaultValue('position', 'position');37setDefaultValue('x', 'x');38setDefaultValue('y', 'y');39setDefaultValue('button', 'button');40setDefaultValue('options

Full Screen

Using AI Code Generation

copy

Full Screen

1const { setDefaultValue } = require('playwright/lib/server/chromium/crBrowser');2const playwright = require('playwright');3(async () => {4 const browser = await playwright.chromium.launch();5 const page = await browser.newPage();6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();9#### browser.newPage([options])

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful