[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Campaigns/ -> updateRelations.php (source)

   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   ********************************************************************************/
  11  
  12  require_once ('include/database/PearDatabase.php');
  13  require_once ('user_privileges/default_module_view.php');
  14  global $adb, $singlepane_view;
  15  $idlist = $_REQUEST['idlist'];
  16  $update_mod = $_REQUEST['destination_module'];
  17  if($update_mod == 'Leads')
  18  {
  19      $rel_table = 'vtiger_campaignleadrel';
  20      $mod_table = 'vtiger_leaddetails';
  21      $mod_field = 'leadid';
  22  }
  23  elseif($update_mod == 'Contacts')
  24  {
  25      $rel_table = 'vtiger_campaigncontrel';
  26      $mod_table = 'vtiger_contactdetails';
  27      $mod_field = 'contactid';
  28  }
  29  if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '')
  30  {
  31      //split the string and store in an array
  32      $storearray = explode (";",$idlist);
  33      foreach($storearray as $id)
  34      {
  35          if($id != '')
  36          {
  37              $sql = "insert into  ".$rel_table." values(".$_REQUEST["parentid"]." , ".$id.")";
  38                  $adb->query($sql);
  39              $sql = "update ".$mod_table." set campaignid = ".$_REQUEST["parentid"]." where ".$mod_field." = ".$id;
  40                      $adb->query($sql);
  41          }
  42      }
  43      if($singlepane_view == 'true')
  44          header("Location: index.php?action=DetailView&module=Campaigns&record=".$_REQUEST["parentid"]);
  45      else
  46           header("Location: index.php?action=CallRelatedList&module=Campaigns&record=".$_REQUEST["parentid"]);
  47  }
  48  elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '')
  49  {    
  50          $sql = "insert into ".$rel_table." values(".$_REQUEST["parid"].",".$_REQUEST["entityid"].")";
  51          $adb->query($sql);
  52          $sql = "update ".$mod_table." set campaignid = ".$_REQUEST["parid"]." where ".$mod_field." = ".$_REQUEST["entityid"];
  53                  $adb->query($sql);
  54          
  55          if($singlepane_view == 'true')
  56              header("Location: index.php?action=DetailView&module=Campaigns&record=".$_REQUEST["parid"]);
  57          else
  58               header("Location: index.php?action=CallRelatedList&module=Campaigns&record=".$_REQUEST["parid"]);
  59  }
  60  
  61  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7