PageRenderTime 94ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/Users/massdelete.php

https://bitbucket.org/yousef_fadila/vtiger
PHP | 81 lines | 67 code | 4 blank | 10 comment | 14 complexity | 6e4dc0d7dcec9fbfa85e6ab71e4d272d MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  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. require_once('include/database/PearDatabase.php');
  11. require_once('include/utils/UserInfoUtil.php');
  12. require_once('include/utils/CommonUtils.php');
  13. $idlist = vtlib_purify($_REQUEST['idlist']);
  14. $viewid = vtlib_purify($_REQUEST['viewname']);
  15. $returnmodule = vtlib_purify($_REQUEST['return_module']);
  16. $return_action = vtlib_purify($_REQUEST['return_action']);
  17. $excludedRecords=vtlib_purify($_REQUEST['excludedRecords']);
  18. $rstart='';
  19. //Added to fix 4600
  20. $url = getBasic_Advance_SearchURL();
  21. //split the string and store in an array
  22. $storearray = getSelectedRecords($_REQUEST,$returnmodule,$idlist,$excludedRecords);
  23. $storearray = array_filter($storearray);
  24. $ids_list = array();
  25. $errormsg = '';
  26. foreach($storearray as $id)
  27. {
  28. if(isPermitted($returnmodule,'Delete',$id) == 'yes')
  29. {
  30. $focus = CRMEntity::getInstance($returnmodule);
  31. DeleteEntity($returnmodule,$returnmodule,$focus,$id,'');
  32. }
  33. else
  34. {
  35. $ids_list[] = $id;
  36. }
  37. }
  38. if(count($ids_list) > 0) {
  39. $ret = getEntityName($returnmodule,$ids_list);
  40. if(count($ret) > 0)
  41. {
  42. $errormsg = implode(',',$ret);
  43. }
  44. }
  45. if(isset($_REQUEST['smodule']) && ($_REQUEST['smodule']!=''))
  46. {
  47. $smod = "&smodule=".vtlib_purify($_REQUEST['smodule']);
  48. }
  49. if(isset($_REQUEST['start']) && ($_REQUEST['start']!=''))
  50. {
  51. $rstart = "&start=".vtlib_purify($_REQUEST['start']);
  52. }
  53. if($returnmodule == 'Emails')
  54. {
  55. if(isset($_REQUEST['folderid']) && $_REQUEST['folderid'] != '')
  56. {
  57. $folderid = vtlib_purify($_REQUEST['folderid']);
  58. }else
  59. {
  60. $folderid = 1;
  61. }
  62. header("Location: index.php?module=".$returnmodule."&action=".$returnmodule."Ajax&folderid=".$folderid."&ajax=delete".$rstart."&file=ListView&errormsg=".$errormsg.$url);
  63. }
  64. elseif($return_action == 'ActivityAjax')
  65. {
  66. $subtab = vtlib_purify($_REQUEST['subtab']);
  67. header("Location: index.php?module=".$returnmodule."&action=".$return_action."".$rstart."&view=".vtlib_purify($_REQUEST['view'])."&hour=".vtlib_purify($_REQUEST['hour'])."&day=".vtlib_purify($_REQUEST['day'])."&month=".vtlib_purify($_REQUEST['month'])."&year=".vtlib_purify($_REQUEST['year'])."&type=".vtlib_purify($_REQUEST['type'])."&viewOption=".vtlib_purify($_REQUEST['viewOption'])."&subtab=".$subtab."&onlyforuser=".vtlib_purify($_REQUEST['onlyforuser']).$url);
  68. }
  69. elseif($returnmodule!='Faq')
  70. {
  71. header("Location: index.php?module=".$returnmodule."&action=".$returnmodule."Ajax&ajax=delete".$rstart."&file=ListView&viewname=".$viewid."&errormsg=".$errormsg.$url);
  72. }
  73. else
  74. {
  75. header("Location: index.php?module=".$returnmodule."&action=".$returnmodule."Ajax&ajax=delete".$rstart."&file=ListView&errormsg=".$errormsg.$url);
  76. }
  77. ?>