| [ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /*+*********************************************************************************** 2 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 3 * ("License"); You may not use this file except in compliance with the License 4 * The Original Code is: vtiger CRM Open Source 5 * The Initial Developer of the Original Code is vtiger. 6 * Portions created by vtiger are Copyright (C) vtiger. 7 * All Rights Reserved. 8 *************************************************************************************/ 9 10 Inventory_Edit_Js("Quotes_Edit_Js",{},{ 11 12 /** 13 * Function which will register event for Reference Fields Selection 14 */ 15 registerReferenceSelectionEvent : function(container) { 16 this._super(container); 17 var thisInstance = this; 18 19 jQuery('input[name="account_id"]', container).on(Vtiger_Edit_Js.referenceSelectionEvent, function(e, data){ 20 thisInstance.referenceSelectionEventHandler(data, container); 21 }); 22 }, 23 24 /** 25 * Function to get popup params 26 */ 27 getPopUpParams : function(container) { 28 var params = this._super(container); 29 var sourceFieldElement = jQuery('input[class="sourceField"]',container); 30 31 if(sourceFieldElement.attr('name') == 'contact_id' || sourceFieldElement.attr('name') == 'potential_id') { 32 var form = this.getForm(); 33 var parentIdElement = form.find('[name="account_id"]'); 34 if(parentIdElement.length > 0 && parentIdElement.val().length > 0 && parentIdElement.val() != 0) { 35 var closestContainer = parentIdElement.closest('td'); 36 params['related_parent_id'] = parentIdElement.val(); 37 params['related_parent_module'] = closestContainer.find('[name="popupReferenceModule"]').val(); 38 } else if(sourceFieldElement.attr('name') == 'potential_id') { 39 parentIdElement = form.find('[name="contact_id"]'); 40 if(parentIdElement.length > 0 && parentIdElement.val().length > 0) { 41 closestContainer = parentIdElement.closest('td'); 42 params['related_parent_id'] = parentIdElement.val(); 43 params['related_parent_module'] = closestContainer.find('[name="popupReferenceModule"]').val(); 44 } 45 } 46 } 47 return params; 48 }, 49 50 /** 51 * Function to search module names 52 */ 53 searchModuleNames : function(params) { 54 var aDeferred = jQuery.Deferred(); 55 56 if(typeof params.module == 'undefined') { 57 params.module = app.getModuleName(); 58 } 59 if(typeof params.action == 'undefined') { 60 params.action = 'BasicAjax'; 61 } 62 63 if (params.search_module == 'Contacts' || params.search_module == 'Potentials') { 64 var form = this.getForm(); 65 var parentIdElement = form.find('[name="account_id"]'); 66 if(parentIdElement.length > 0 && parentIdElement.val().length > 0) { 67 var closestContainer = parentIdElement.closest('td'); 68 params.parent_id = parentIdElement.val(); 69 params.parent_module = closestContainer.find('[name="popupReferenceModule"]').val(); 70 } else if(params.search_module == 'Potentials') { 71 parentIdElement = form.find('[name="contact_id"]'); 72 if(parentIdElement.length > 0 && parentIdElement.val().length > 0) { 73 closestContainer = parentIdElement.closest('td'); 74 params.parent_id = parentIdElement.val(); 75 params.parent_module = closestContainer.find('[name="popupReferenceModule"]').val(); 76 } 77 } 78 } 79 80 AppConnector.request(params).then( 81 function(data){ 82 aDeferred.resolve(data); 83 }, 84 function(error){ 85 aDeferred.reject(); 86 } 87 ) 88 return aDeferred.promise(); 89 }, 90 91 registerEvents: function(){ 92 this._super(); 93 this.registerForTogglingBillingandShippingAddress(); 94 this.registerEventForCopyAddress(); 95 } 96 }); 97 98
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |