[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/layouts/vlayout/modules/Invoice/resources/ -> Edit.js (source)

   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("Invoice_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') {
  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              }
  39          }
  40          return params;
  41      },
  42  
  43      /**
  44       * Function to search module names
  45       */
  46      searchModuleNames : function(params) {
  47          var aDeferred = jQuery.Deferred();
  48  
  49          if(typeof params.module == 'undefined') {
  50              params.module = app.getModuleName();
  51          }
  52          if(typeof params.action == 'undefined') {
  53              params.action = 'BasicAjax';
  54          }
  55  
  56          if (params.search_module == 'Contacts') {
  57              var form = this.getForm();
  58              var parentIdElement  = form.find('[name="account_id"]');
  59              if(parentIdElement.length > 0 && parentIdElement.val().length > 0) {
  60                  var closestContainer = parentIdElement.closest('td');
  61                  params.parent_id = parentIdElement.val();
  62                  params.parent_module = closestContainer.find('[name="popupReferenceModule"]').val();
  63              }
  64          }
  65          AppConnector.request(params).then(
  66              function(data){
  67                  aDeferred.resolve(data);
  68              },
  69              function(error){
  70                  aDeferred.reject();
  71              }
  72          )
  73          return aDeferred.promise();
  74      },
  75  
  76      registerEvents: function(){
  77          this._super();
  78          this.registerForTogglingBillingandShippingAddress();
  79          this.registerEventForCopyAddress();
  80      }
  81  });
  82  
  83  


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1