예제 #1
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     if ($request->get('selected_ids') == 'all' && $request->get('mode') == 'FindDuplicates') {
         $recordIds = Vtiger_FindDuplicate_Model::getMassDeleteRecords($request);
     } else {
         $recordIds = $this->getRecordsListFromRequest($request);
     }
     foreach ($recordIds as $recordId) {
         if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
             $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
             $recordModel->delete();
         } else {
             $permission = 'No';
         }
     }
     if ($permission === 'No') {
         throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
     }
     $cvId = $request->get('viewname');
     $response = new Vtiger_Response();
     $response->setResult(array('viewname' => $cvId, 'module' => $moduleName));
     $response->emit();
 }
예제 #2
0
 /**
  * Function returns the number of records for the current filter
  * @param Vtiger_Request $request
  */
 function getRecordsCount(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $duplicateSearchFields = $request->get('fields');
     $dataModelInstance = Vtiger_FindDuplicate_Model::getInstance($moduleName);
     $dataModelInstance->set('fields', $duplicateSearchFields);
     $count = $dataModelInstance->getRecordCount();
     $result = array();
     $result['module'] = $moduleName;
     $result['count'] = $count;
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     $response->setResult($result);
     $response->emit();
 }
예제 #3
0
 /**
  * Function returns the number of records for the current filter
  * @param Vtiger_Request $request
  */
 function getRecordsCount(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $duplicateSearchFields = $request->get('fields');
     $dataModelInstance = Vtiger_FindDuplicate_Model::getInstance($moduleName);
     $ignoreEmpty = $request->get('ignoreEmpty');
     $ignoreEmptyValue = false;
     if ($ignoreEmpty == 'on' || $ignoreEmpty == 'true' || $ignoreEmpty == '1') {
         $ignoreEmptyValue = true;
     }
     $dataModelInstance->set('ignoreEmpty', $ignoreEmptyValue);
     $dataModelInstance->set('fields', $duplicateSearchFields);
     $count = $dataModelInstance->getRecordCount();
     $result = array();
     $result['module'] = $moduleName;
     $result['count'] = $count;
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     $response->setResult($result);
     $response->emit();
 }