PageRenderTime 53ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/vtlib/ModuleDir/5.0.4/updateRelations.php

https://bitbucket.org/yousef_fadila/vtiger
PHP | 58 lines | 44 code | 4 blank | 10 comment | 15 complexity | fd5418fd96c11b834f3d117949c9fa83 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. @include_once('user_privileges/default_module_view.php');
  12. global $adb, $singlepane_view, $currentModule;
  13. $idlist = $_REQUEST['idlist'];
  14. $destinationModule = $_REQUEST['destination_module'];
  15. $parenttab = $_REQUEST['parenttab'];
  16. $forCRMRecord = $_REQUEST['parentid'];
  17. $mode = $_REQUEST['mode'];
  18. // Split the string of ids
  19. if($mode == 'delete') {
  20. $ids = explode (";",trim($idlist,";"));
  21. if(function_exists('checkFileAccess')) {
  22. checkFileAccess("modules/$currentModule/$currentModule.php");
  23. }
  24. require_once("modules/$currentModule/$currentModule.php");
  25. $focus = new $currentModule();
  26. if(method_exists($focus, 'delete_related_module')) {
  27. $focus->delete_related_module($currentModule, $forCRMRecord, $destinationModule, $ids);
  28. }
  29. if($singlepane_view == 'true') {
  30. header("Location: index.php?module=$currentModule&record=$forCRMRecord&action=DetailView&parenttab=$parenttab");
  31. } else {
  32. header("Location: index.php?module=$currentModule&record=$forCRMRecord&action=CallRelatedList&parenttab=$parenttab");
  33. }
  34. exit;
  35. }
  36. if(!empty($_REQUEST['idlist'])) {
  37. $ids = explode (";",trim($idlist,";"));
  38. if(function_exists('checkFileAccess')) {
  39. checkFileAccess("modules/$currentModule/$currentModule.php");
  40. }
  41. require_once("modules/$currentModule/$currentModule.php");
  42. $focus = new $currentModule();
  43. if(method_exists($focus, 'save_related_module')) {
  44. $focus->save_related_module($currentModule, $forCRMRecord, $destinationModule, $ids);
  45. }
  46. if($singlepane_view == 'true') {
  47. header("Location: index.php?module=$currentModule&record=$forCRMRecord&action=DetailView&parenttab=$parenttab");
  48. } else {
  49. header("Location: index.php?module=$currentModule&record=$forCRMRecord&action=CallRelatedList&parenttab=$parenttab");
  50. }
  51. } else if(!empty($_REQUEST['entityid'])){
  52. // TODO: Handle this case
  53. }
  54. ?>