[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/layouts/vlayout/modules/PriceBooks/resources/ -> RelatedList.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  Vtiger_RelatedList_Js("PriceBooks_RelatedList_Js",{},{
  11      
  12      /**
  13       * Function to handle the popup show
  14       */
  15      showSelectRelationPopup : function(){
  16          var thisInstance = this;
  17          var popupInstance = Vtiger_Popup_Js.getInstance();
  18          popupInstance.show(this.getPopupParams(), function(responseString){
  19                  var responseData = JSON.parse(responseString);
  20                  thisInstance.addRelations(responseData).then(
  21                      function(data){
  22                          var relatedCurrentPage = thisInstance.getCurrentPageNum();
  23                          var params = {'page':relatedCurrentPage};
  24                          thisInstance.loadRelatedList(params);
  25                      }
  26                  );
  27              }
  28          );
  29      },
  30      /**
  31       * Function to get params for show event invocation
  32       */
  33      getPopupParams : function(){
  34          var parameters = {
  35              'module' : this.relatedModulename,
  36              'src_module' :this.parentModuleName ,
  37              'src_record' : this.parentRecordId,
  38               'view' : "PriceBookProductPopup",
  39               'src_field' : 'priceBookRelatedList',
  40              'multi_select' : true
  41          }
  42          return parameters;
  43      },
  44      /**
  45       * Function to handle the adding relations between parent and child window
  46       */
  47      addRelations : function(idList){
  48          var aDeferred = jQuery.Deferred();
  49          var sourceRecordId = this.parentRecordId;
  50          var sourceModuleName = this.parentModuleName;
  51          var relatedModuleName = this.relatedModulename;
  52  
  53          var params = {};
  54          params['mode'] = "addListPrice";
  55          params['module'] = sourceModuleName;
  56          params['action'] = 'RelationAjax';
  57          
  58          params['related_module'] = relatedModuleName;
  59          params['src_record'] = sourceRecordId;
  60          params['relinfo'] = JSON.stringify(idList);
  61          AppConnector.request(params).then(
  62              function(responseData){
  63                  aDeferred.resolve(responseData);
  64              }
  65              );
  66          return aDeferred.promise();
  67      }
  68  })


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