PageRenderTime 47ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/Emails/updateRelations.php

https://bitbucket.org/yousef_fadila/vtiger
PHP | 40 lines | 27 code | 4 blank | 9 comment | 8 complexity | 2c1a3a61fc53d1be9d3b6af2d0592224 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, $currentModule;
  12. $idlist = vtlib_purify($_REQUEST['idlist']);
  13. $record = vtlib_purify($_REQUEST["parentid"]);
  14. $storearray = array();
  15. if(!empty($_REQUEST['idlist'])) {
  16. // Split the string of ids
  17. $storearray = explode (";",trim($idlist,";"));
  18. } else if(!empty($_REQUEST['entityid'])){
  19. $storearray = array($_REQUEST['entityid']);
  20. }
  21. foreach($storearray as $id)
  22. {
  23. if($id != '')
  24. {
  25. $sql = "insert into vtiger_seactivityrel values (?,?)";
  26. $adb->pquery($sql, array($id, $record));
  27. }
  28. }
  29. if(isset($_REQUEST['user_id']) && $_REQUEST['user_id'] != '')
  30. {
  31. $record = $_REQUEST['record'];
  32. $sql = "insert into vtiger_salesmanactivityrel values (?,?)";
  33. $adb->pquery($sql, array($_REQUEST["user_id"], $record));
  34. }
  35. header("Location: index.php?action=CallRelatedList&module=Emails&record=".vtlib_purify($record));
  36. ?>