PageRenderTime 38ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/vtlib/ModuleDir/5.2.0/updateRelations.php

https://bitbucket.org/yousef_fadila/vtiger
PHP | 46 lines | 31 code | 5 blank | 10 comment | 10 complexity | 9153d85e0cf18f15593c749b4c915a9a 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 = vtlib_purify($_REQUEST['idlist']);
  14. $destinationModule = vtlib_purify($_REQUEST['destination_module']);
  15. $parenttab = getParentTab();
  16. $forCRMRecord = vtlib_purify($_REQUEST['parentid']);
  17. $mode = $_REQUEST['mode'];
  18. if($singlepane_view == 'true')
  19. $action = "DetailView";
  20. else
  21. $action = "CallRelatedList";
  22. $focus = CRMEntity::getInstance($currentModule);
  23. if($mode == 'delete') {
  24. // Split the string of ids
  25. $ids = explode (";",$idlist);
  26. if(!empty($ids)) {
  27. $focus->delete_related_module($currentModule, $forCRMRecord, $destinationModule, $ids);
  28. }
  29. } else {
  30. if(!empty($_REQUEST['idlist'])) {
  31. // Split the string of ids
  32. $ids = explode (";",trim($idlist,";"));
  33. } else if(!empty($_REQUEST['entityid'])){
  34. $ids = $_REQUEST['entityid'];
  35. }
  36. if(!empty($ids)) {
  37. $focus->save_related_module($currentModule, $forCRMRecord, $destinationModule, $ids);
  38. }
  39. }
  40. header("Location: index.php?module=$currentModule&record=$forCRMRecord&action=$action&parenttab=$parenttab");
  41. ?>