[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/include/ -> FormValidationUtil.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  /*
  13   * File containing methods to proceed with the ui validation for all the forms
  14   *
  15   */
  16  /** Function to get the details for fieldlabels for a given table array
  17    * @param $tablearray -- tablearray:: Type string array (table names in array)
  18    * @param $tabid -- tabid:: Type integer 
  19    * @returns $fieldName_array -- fieldName_array:: Type string array (field name details)
  20    *
  21   */
  22  
  23  
  24  function getDBValidationData($tablearray,$tabid='')
  25  {
  26    global $log;
  27    $log->debug("Entering getDBValidationData(".$tablearray.",".$tabid.") method ...");
  28    $sql = '';
  29    $tab_con = "";
  30    $numValues = count($tablearray);
  31    global $adb,$mod_strings;
  32  
  33    if($tabid!='') $tab_con = ' and tabid='.$tabid;
  34      
  35    for($i=0;$i<$numValues;$i++)
  36    {
  37  
  38        if(in_array("emails",$tablearray))
  39        {
  40          if($numValues > 1 && $i != $numValues-1)
  41              {
  42              $sql .= "select fieldlabel,fieldname,typeofdata from vtiger_field where tablename='".$tablearray[$i] ."'and tabid=10 and displaytype <> 2 union ";
  43               }
  44             else
  45              {
  46                 $sql  .= "select fieldlabel,fieldname,typeofdata from vtiger_field where tablename='".$tablearray[$i] ."' and tabid=10 and displaytype <> 2 ";
  47              }
  48        }
  49        else
  50        {
  51              if($numValues > 1 && $i != $numValues-1)
  52              {
  53                    $sql .= "select fieldlabel,fieldname,typeofdata from vtiger_field where tablename='".$tablearray[$i] ."'".$tab_con." and displaytype in (1,3) union ";
  54              }
  55              else
  56              {
  57                    $sql  .= "select fieldlabel,fieldname,typeofdata from vtiger_field where tablename='".$tablearray[$i] ."'".$tab_con." and displaytype in (1,3)";
  58              }
  59        }
  60    }
  61    $result = $adb->query($sql);
  62    $noofrows = $adb->num_rows($result);
  63    $fieldName_array = Array();
  64    for($i=0;$i<$noofrows;$i++)
  65    {
  66      $fieldlabel = $mod_strings[$adb->query_result($result,$i,'fieldlabel')];
  67      $fieldname = $adb->query_result($result,$i,'fieldname');
  68      $typeofdata = $adb->query_result($result,$i,'typeofdata');
  69     //echo '<br> '.$fieldlabel.'....'.$fieldname.'....'.$typeofdata;
  70      $fldLabel_array = Array();
  71      $fldLabel_array[$fieldlabel] = $typeofdata;
  72      $fieldName_array[$fieldname] = $fldLabel_array;
  73  
  74    }
  75  
  76    
  77    $log->debug("Exiting getDBValidationData method ...");
  78    return $fieldName_array;
  79    
  80  
  81  
  82  }
  83  ?>


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