PageRenderTime 69ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/Calendar/updateRelations.php

https://bitbucket.org/yousef_fadila/vtiger
PHP | 64 lines | 47 code | 6 blank | 11 comment | 22 complexity | 7ca941de1dfd17c5bb946fc5e30eb0b9 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. global $adb;
  12. $idlist = $_REQUEST['idlist'];
  13. if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '' && $_REQUEST['destination_module'] == 'Contacts')
  14. {
  15. //split the string and store in an array
  16. $storearray = explode (";",trim($idlist,";"));
  17. foreach($storearray as $id)
  18. {
  19. if($id != '')
  20. {
  21. $record = vtlib_purify($_REQUEST['parentid']);
  22. $sql = "insert into vtiger_cntactivityrel values (?,?)";
  23. $adb->pquery($sql, array($id, $_REQUEST["parentid"]));
  24. }
  25. }
  26. header("Location: index.php?action=CallRelatedList&module=Calendar&activity_mode=Events&record=".$record);
  27. }
  28. elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '' && $_REQUEST['destination_module'] == 'Contacts')
  29. {
  30. $record = vtlib_purify($_REQUEST["parentid"]);
  31. $sql = "insert into vtiger_cntactivityrel values (?,?)";
  32. $adb->pquery($sql, array($_REQUEST["entityid"], $_REQUEST["parentid"]));
  33. header("Location: index.php?action=DetailView&module=Calendar&activity_mode=Events&record=".$record);
  34. }
  35. //This if for adding the vtiger_users
  36. if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '' && $_REQUEST['destination_module'] == 'Users')
  37. {
  38. //split the string and store in an array
  39. $storearray = explode (";",$idlist);
  40. foreach($storearray as $id)
  41. {
  42. if($id != '')
  43. {
  44. $record = vtlib_purify($_REQUEST['parentid']);
  45. $sql = "insert into vtiger_salesmanactivityrel values (?,?)";
  46. $adb->pquery($sql, array($id, $_REQUEST["parentid"]));
  47. }
  48. }
  49. header("Location: index.php?action=DetailView&module=Calendar&activity_mode=Events&record=".$record);
  50. }
  51. elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '' && $_REQUEST['destination_module'] == 'Users')
  52. {
  53. $record = vtlib_purify($_REQUEST['parentid']);
  54. $sql = "insert into vtiger_salesmanactivityrel values (?,?)";
  55. $adb->pquery($sql, array($_REQUEST["entityid"], $_REQUEST["parentid"]));
  56. header("Location: index.php?action=DetailView&module=Calendar&activity_mode=Events&record=".$record);
  57. }
  58. ?>