[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Products/actions/ -> MassSave.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  class Products_MassSave_Action extends Vtiger_MassSave_Action {
  12  
  13  	public function process(Vtiger_Request $request) {
  14          //the new values are added to $_REQUEST for MassSave, are removing the Tax details depend on the 'action' value
  15          $_REQUEST['action'] = 'MassEditSave';
  16          $request->set('action', 'MassEditSave');
  17  
  18          //the new values are added to $_REQUEST for MassSave, the unit price depend on the 'mass_edit_check' value
  19          $_REQUEST['unit_price_mass_edit_check'] = 'off';
  20          parent::process($request);
  21      }
  22  
  23      /**
  24       * Function to get the record model based on the request parameters
  25       * @param Vtiger_Request $request
  26       * @return Vtiger_Record_Model or Module specific Record Model instance
  27       */
  28  	function getRecordModelsFromRequest(Vtiger_Request $request) {
  29          $moduleName = $request->getModule();
  30          $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
  31  
  32          $recordModels = parent::getRecordModelsFromRequest($request);
  33          $fieldModelList = $moduleModel->getFields();
  34  
  35          foreach($recordModels as $id => $model) {
  36              foreach ($fieldModelList as $fieldName => $fieldModel) {
  37                  $fieldDataType = $fieldModel->getFieldDataType();
  38                  // This is added as we are marking massedit in vtiger6 as not an ajax operation
  39                  // and this will force the date fields to be saved in user format. If the user format
  40                  // is other than y-m-d then it fails. We need to review the above process API changes
  41                  // which was added to fix unit price issue where it was getting changed when mass edited.
  42                  if($fieldDataType == 'date' || ($fieldDataType == 'currency') && $uiType != '72') {
  43                      $model->set($fieldName, $fieldModel->getUITypeModel()->getDBInsertValue($model->get($fieldName)));
  44                  }
  45              }
  46          }
  47          return $recordModels;
  48      }
  49  }


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