[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/Emails/ -> mailSelect.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  require_once ('Smarty_setup.php');
  12  require_once ('include/database/PearDatabase.php');
  13  
  14  
  15  global $app_strings;
  16  global $mod_strings;
  17  
  18  global $theme;
  19  $image_path = 'themes/'.$theme.'/images/';
  20  $idlist = $_REQUEST['idlist'];
  21  $pmodule=$_REQUEST['return_module'];
  22  $ids=explode(';',$idlist);
  23  $single_record = false;
  24  if(!strpos($idlist,':'))
  25  {
  26      $single_record = true;
  27  }
  28  $smarty = new vtigerCRM_Smarty;
  29  if ($pmodule=='Accounts')
  30  {
  31      $querystr="select fieldid,fieldlabel,columnname,tablename from vtiger_field where tabid=6 and uitype=13;"; 
  32  }
  33  elseif ($pmodule=='Contacts')
  34  {
  35      $querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=4 and uitype=13;";
  36  }
  37  elseif ($pmodule=='Leads')
  38  {
  39      $querystr="select fieldid,fieldlabel,columnname from vtiger_field where tabid=7 and uitype=13;";
  40  }
  41  $result=$adb->query($querystr);
  42  $numrows = $adb->num_rows($result);
  43  $returnvalue = Array();
  44  for ($i=0;$i<$numrows;$i++)
  45  {
  46      $value = Array();
  47      $temp=$adb->query_result($result,$i,'columnname');
  48      $columnlists [] = $temp;
  49      $fieldid=$adb->query_result($result,$i,'fieldid');
  50      $value[] =$adb->query_result($result,$i,'fieldlabel');
  51      $returnvalue [$fieldid]= $value;
  52      
  53  }
  54  
  55  if($single_record)
  56  {
  57      $count = 1;    
  58      switch($pmodule)
  59      {
  60          case 'Accounts':
  61              $query = 'select accountname,'.implode(",",$columnlists).' from vtiger_account left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_account.accountid = '.$idlist;
  62              $result=$adb->query($query);
  63                  foreach($columnlists as $columnname)    
  64              {
  65                  $field_value[$count++] = $adb->query_result($result,0,$columnname);
  66              }
  67              $entity_name = $adb->query_result($result,0,'accountname');
  68              break;
  69          case 'Leads':
  70              $query = 'select concat(firstname," ",lastname) as leadname,'.implode(",",$columnlists).' from vtiger_leaddetails left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_leaddetails.leadid = '.$idlist;
  71              $result=$adb->query($query);
  72                  foreach($columnlists as $columnname)    
  73              {
  74                  $field_value[$count++] = $adb->query_result($result,0,$columnname);
  75              }
  76              $entity_name = $adb->query_result($result,0,'leadname');
  77              break;
  78          case 'Contacts':
  79              $query = 'select concat(firstname," ",lastname) as contactname,'.implode(",",$columnlists).' from vtiger_contactdetails left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_contactdetails.contactid = '.$idlist;
  80              $result=$adb->query($query);
  81                  foreach($columnlists as $columnname)    
  82              {
  83                  $field_value[$count++] = $adb->query_result($result,0,$columnname);
  84              }    
  85              $entity_name = $adb->query_result($result,0,'contactname');
  86              break;    
  87      }    
  88  }
  89  $smarty->assign('ENTITY_NAME',$entity_name);
  90  $smarty->assign('ONE_RECORD',$single_record);
  91  $smarty->assign('MAILDATA',$field_value);
  92  $smarty->assign('MAILINFO',$returnvalue);
  93  $smarty->assign("MOD", $mod_strings);
  94  $smarty->assign("IDLIST", $idlist);
  95  $smarty->assign("APP", $app_strings);
  96  $smarty->assign("FROM_MODULE", $pmodule);
  97  $smarty->assign("IMAGE_PATH",$image_path);
  98  
  99  $smarty->display("SelectEmail.tpl");
 100  ?>


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