//	Grp_id -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("Grp_id", $data, $keylink);
 $row["Grp_id_value"] = $value;
 $format = $pSet->getViewFormat("Grp_id");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 if ($format == FORMAT_CHECKBOX) {
     $class = ' rnr-field-checkbox';
 }
 if ($format == FORMAT_NUMBER || IsNumberType($pSet->getFieldType("Grp_id"))) {
     $class = ' rnr-field-number';
 }
 $row["Grp_id_class"] = $class;
 //	StockCode -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("StockCode", $data, $keylink);
 $row["StockCode_value"] = $value;
 $format = $pSet->getViewFormat("StockCode");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
            continue;
        }
        if ($masterTablesInfoArr[$i]['dispInfo']) {
            $detailKeys = $masterTablesInfoArr[$i]['detailKeys'];
            for ($j = 0; $j < count($detailKeys); $j++) {
                $masterWhere .= " and " . $controls->getControl($detailKeys[$j])->getSuggestWhere('Equals', @$_SESSION[$strTableName . "_masterkey" . ($j + 1)]);
            }
        }
        break;
    }
}
$result = array();
// traversing searchable fields
foreach ($allSearchFields as $f) {
    // filter fields by type
    $fType = $pSet->getFieldType($f);
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) {
        continue;
    }
    if ($_connection->dbType == nDATABASE_Oracle && IsTextType($fType)) {
        continue;
    }
    if ($searchField != '' && $searchField != GoodFieldName($f) || !$pSet->checkFieldPermissions($f)) {
        continue;
    }
    $fieldControl = $controls->getControl($f);
    $isAggregateField = $pSet->isAggregateField($f);
    $where = $fieldControl->getSuggestWhere($searchOpt, $searchFor, $isAggregateField);
    $having = $fieldControl->getSuggestHaving($searchOpt, $searchFor, $isAggregateField);
    if (!strlen($where) && !strlen($having)) {
        continue;
Exemple #3
0
 function LogDelete($str_table, $values, $keys)
 {
     global $globalEvents;
     $retval = true;
     $table = $str_table;
     $pSet = new ProjectSettings($str_table);
     $arr = array();
     if ($globalEvents->exists("OnAuditLog")) {
         $retval = $globalEvents->OnAuditLog($this->strDelete, $this->params, $table, $keys, $values, $arr);
     }
     if ($retval) {
         if (count($keys) > 0) {
             $key = "";
             foreach ($keys as $idx => $val) {
                 if ($key != "") {
                     $key .= ",";
                 }
                 $key .= $val;
             }
         }
         $fp = $this->CreateLogFile();
         $str = format_datetime_custom(db2time(now()), "MMM dd,yyyy") . chr(9) . format_datetime_custom(db2time(now()), "HH:mm:ss") . chr(9) . $this->params[0] . chr(9) . $this->params[1] . chr(9) . $table . chr(9) . $this->strDelete . chr(9) . $key;
         $str_add = "";
         if ($this->logValueEnable($str_table)) {
             foreach ($values as $idx => $val) {
                 $v = "";
                 if (IsBinaryType($pSet->getFieldType($idx))) {
                     $v = "<binary value>";
                 } else {
                     $v = str_replace(array("\r\n", "\n", "\t"), " ", $val);
                     if (strlen($v) > $this->maxFieldLength) {
                         $v = substr($v, 0, $this->maxFieldLength);
                     }
                 }
                 if ($fp) {
                     $str_add .= $str . chr(9) . $idx . chr(9) . $v . "\r\n";
                 }
             }
         } else {
             $str_add = $str . "\r\n";
         }
         if ($fp) {
             fputs($fp, $str_add);
             fclose($fp);
         }
     }
     return $retval;
 }
Exemple #4
0
function WRCustomGetFieldType($table, $field)
{
    global $conn;
    if (is_wr_project()) {
        $pSet = new ProjectSettings($_SESSION['webreports']['tables'][0]);
        $type = $pSet->getFieldType($field);
        if ($type) {
            return $type;
        }
    }
    if (is_wr_db()) {
        global $wr_is_standalone;
        if (!$wr_is_standalone) {
            global $dal;
            if ($dal->Table($table)) {
                return $dal->GetFieldType($table, $field);
            }
        }
        return dbinfoFieldsType($table, $field);
    }
    if (is_wr_custom()) {
        $res = "";
        $sql = $_SESSION["object_sql"];
        if ($sql) {
            //The default connection is temporary used #9875
            $connection = getDefaultConnection();
            $arr = $connection->getFieldsList($sql);
            foreach ($arr as $val) {
                if ($val["fieldname"] == $field) {
                    $res = $val["type"];
                }
            }
        }
        return $res;
    }
}
Exemple #5
0
function GetFieldType($field, $table = "")
{
    global $pageObject;
    if ($table != "" || !isset($pageObject)) {
        if ($table == "") {
            global $strTableName;
            $table = $strTableName;
        }
        $newSet = new ProjectSettings($table);
        return $newSet->getFieldType($field);
    } else {
        return $pageObject->pSet->getFieldType($field);
    }
}
 //	Groupid -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("Groupid", $data, $keylink);
 $row["Groupid_value"] = $value;
 $format = $pSet->getViewFormat("Groupid");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 if ($format == FORMAT_CHECKBOX) {
     $class = ' rnr-field-checkbox';
 }
 if ($format == FORMAT_NUMBER || IsNumberType($pSet->getFieldType("Groupid"))) {
     $class = ' rnr-field-number';
 }
 $row["Groupid_class"] = $class;
 //	GroupName -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("GroupName", $data, $keylink);
 $row["GroupName_value"] = $value;
 $format = $pSet->getViewFormat("GroupName");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
{
	$flag=true;
	$i=0;
	$fields_type=array();
	if(is_wr_custom())
		$fields_type=WRGetAllCustomFieldType();
	while(($data=db_fetch_array($rs)) && $i<$num_rows)
	{
		$i++;

		if ($flag) {
			foreach( array_keys($data) as $key ) 
			{
				if(is_wr_project())
				{
					if(IsBinaryType($gSettings->getFieldType($key)))
						continue;
				}
				elseif(is_wr_custom())
				{
					if(IsBinaryType($fields_type[$key]))
						continue;
				}
				if($gSettings)
					$gKey = $gSettings->label($key);
				else
					$gKey = $key;
				
				$res_head .= "<th>" . runner_htmlspecialchars($gKey) . "</th>";		
			}
		}
	function GetType()
	{
		$pSet = new ProjectSettings($this->m_strTable);
		return $pSet->getFieldType($this->m_strName);
	}
 //	grp_id -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("grp_id", $data, $keylink);
 $row["grp_id_value"] = $value;
 $format = $pSet->getViewFormat("grp_id");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 if ($format == FORMAT_CHECKBOX) {
     $class = ' rnr-field-checkbox';
 }
 if ($format == FORMAT_NUMBER || IsNumberType($pSet->getFieldType("grp_id"))) {
     $class = ' rnr-field-number';
 }
 $row["grp_id_class"] = $class;
 //	coy_id -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("coy_id", $data, $keylink);
 $row["coy_id_value"] = $value;
 $format = $pSet->getViewFormat("coy_id");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 //	ID -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("ID", $data, $keylink);
 $row["ID_value"] = $value;
 $format = $pSet->getViewFormat("ID");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 if ($format == FORMAT_CHECKBOX) {
     $class = ' rnr-field-checkbox';
 }
 if ($format == FORMAT_NUMBER || IsNumberType($pSet->getFieldType("ID"))) {
     $class = ' rnr-field-number';
 }
 $row["ID_class"] = $class;
 //	GroupID -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("GroupID", $data, $keylink);
 $row["GroupID_value"] = $value;
 $format = $pSet->getViewFormat("GroupID");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
Exemple #11
0
 /**
  * Add span val for lookup fields, and average|total|count totals
  */
 function addSpanVal($fName, &$data)
 {
     global $strTableName;
     $pSet = new ProjectSettings($strTableName, PAGE_LIST);
     $type = $pSet->getFieldType($fName);
     if ((@$this->arrFieldSpanVal[$fName] == 2 || @$this->arrFieldSpanVal[$fName] == 1) && !IsBinaryType($type)) {
         return "val=\"" . runner_htmlspecialchars($data[$fName]) . "\" ";
     }
 }
 //	GroupID -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("GroupID", $data, $keylink);
 $row["GroupID_value"] = $value;
 $format = $pSet->getViewFormat("GroupID");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 if ($format == FORMAT_CHECKBOX) {
     $class = ' rnr-field-checkbox';
 }
 if ($format == FORMAT_NUMBER || IsNumberType($pSet->getFieldType("GroupID"))) {
     $class = ' rnr-field-number';
 }
 $row["GroupID_class"] = $class;
 //	CompanyID -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("CompanyID", $data, $keylink);
 $row["CompanyID_value"] = $value;
 $format = $pSet->getViewFormat("CompanyID");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
	/**
	* Get filter's WHERE clause condition basing on the filter's type
	* 
	* @param String filterType		A string representing the filter's type
	* @param String fName
	* @param String fValue
	* @return String
	*/
	function getFilterWhereByType($filterType, $fName, $fValue, $sValue, $parentValues) 
	{
		$pSet = new ProjectSettings($this->tName, PAGE_SEARCH);
		
		$fullFieldName = $pSet->getFullFieldNameCiph($fName, $this->cipherer);

		$fieldType = $pSet->getFieldType($fName);
		$dateField = IsDateFieldType($fieldType);
		$timeField = IsTimeType($fieldType);
		
		if($dateField || $timeField) 
		{			
			include_once getabspath("classes/controls/FilterControl.php");	
			include_once getabspath("classes/controls/FilterIntervalSlider.php");
			include_once getabspath("classes/controls/FilterIntervalDateSlider.php");
		}
		
		switch($filterType)
		{
			case 'interval':
				$intervalData = $pSet->getFilterIntervalDatabyIndex($fName, $fValue);
				if( !count($intervalData) )
					return "";
				
				include_once getabspath("classes/controls/FilterControl.php");	
				include_once getabspath("classes/controls/FilterIntervalList.php");
				return FilterIntervalList::getIntervalFilterWhere($fName, $intervalData, $pSet, $this->cipherer, $this->tName);

			case 'equals':
				if( !count($parentValues) )
					return $fullFieldName."=".$this->cipherer->MakeDBValue($fName, $fValue, "", "", true);
				
				$wheres = array();
				$wheres[] = $fullFieldName."=".$this->cipherer->MakeDBValue($fName, $fValue, "", "", true);
				$parentFiltersNames = $pSet->getParentFiltersNames($fName);
				
				foreach( $parentFiltersNames as $key => $parentName )
				{
					$wheres[] = $pSet->getFullFieldNameCiph($parentName, $this->cipherer)."=".$this->cipherer->MakeDBValue($parentName, $parentValues[$key], "", "", true);
				}
				
				return "(".implode(" AND ", $wheres).")";
				
			case 'checked':
				if($fValue != "on" && $fValue != "off")
					return "";
					
				$bNeedQuotes = NeedQuotes($fieldType);
				
				include_once getabspath("classes/controls/Control.php");				
				include_once getabspath("classes/controls/CheckboxField.php");	
				return CheckboxField::constructFieldWhere($fullFieldName, $bNeedQuotes, $fValue == "on");
			
			case 'slider':
				if($dateField)
					return FilterIntervalDateSlider::getDateSliderWhere($fName, $pSet, $this->cipherer, $this->tName, $fValue, $sValue, $filterType, $fullFieldName);

				if($timeField)
				{
					include_once getabspath("classes/controls/FilterIntervalTimeSlider.php");
					return FilterIntervalTimeSlider::getTimeSliderWhere($fName, $pSet, $this->cipherer, $this->tName, $fValue, $sValue, $filterType, $fullFieldName);
				}
					
				return $this->cipherer->MakeDBValue($fName, $fValue, "", "", true)."<=".$fullFieldName." AND ".$fullFieldName."<=".$this->cipherer->MakeDBValue($fName, $sValue, "", "", true);
				
			case 'moreequal':
				if($dateField)
					return FilterIntervalDateSlider::getDateSliderWhere($fName, $pSet, $this->cipherer, $this->tName, $fValue, $sValue, $filterType, $fullFieldName);

				if($timeField)
				{
					include_once getabspath("classes/controls/FilterIntervalTimeSlider.php");
					return FilterIntervalTimeSlider::getTimeSliderWhere($fName, $pSet, $this->cipherer, $this->tName, $fValue, $sValue, $filterType, $fullFieldName);
				}	
				return $this->cipherer->MakeDBValue($fName, $fValue, "", "", true)."<=".$fullFieldName;
				
			case 'lessequal':
				if($dateField)
					return FilterIntervalDateSlider::getDateSliderWhere($fName, $pSet, $this->cipherer, $this->tName, $fValue, $sValue, $filterType, $fullFieldName);

				if($timeField)
				{
					include_once getabspath("classes/controls/FilterIntervalTimeSlider.php");
					return FilterIntervalTimeSlider::getTimeSliderWhere($fName, $pSet, $this->cipherer, $this->tName, $fValue, $sValue, $filterType, $fullFieldName);
				}
				return $fullFieldName."<=".$this->cipherer->MakeDBValue($fName, $fValue, "", "", true);
			
			default: 
				return "";
		}
	}
 //	BranchCloudFolder -
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("BranchCloudFolder", $data, $keylink);
 $row["BranchCloudFolder_value"] = $value;
 $format = $pSet->getViewFormat("BranchCloudFolder");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
 if ($format == FORMAT_CHECKBOX) {
     $class = ' rnr-field-checkbox';
 }
 if ($format == FORMAT_NUMBER || IsNumberType($pSet->getFieldType("BranchCloudFolder"))) {
     $class = ' rnr-field-number';
 }
 $row["BranchCloudFolder_class"] = $class;
 //	BranchLastSyncDate - Short Date
 $viewContainer->recId = $recordsCounter;
 $value = $viewContainer->showDBValue("BranchLastSyncDate", $data, $keylink);
 $row["BranchLastSyncDate_value"] = $value;
 $format = $pSet->getViewFormat("BranchLastSyncDate");
 $class = "rnr-field-text";
 if ($format == FORMAT_FILE) {
     $class = ' rnr-field-file';
 }
 if ($format == FORMAT_AUDIO) {
     $class = ' rnr-field-audio';
 }
function WRCustomGetFieldType($table,$field)
{
	global $conn;
	if(is_wr_project())
	{
		$pSet = new ProjectSettings($_SESSION['webreports']['tables'][0]);
		$type = $pSet->getFieldType($field);
		if($type)
			return $type;
	}
	if(is_wr_db())
	{
		global $wr_is_standalone;
		if(!$wr_is_standalone)
		{
			global $dal;
			if($dal->Table($table))
				return $dal->GetFieldType($table,$field);
		}
		return dbinfoFieldsType($table,$field);
	}
	if(is_wr_custom())
	{
		$res="";
		$sql=$_SESSION["object_sql"];
		if($sql)
		{
			$arr=db_getfieldslist($sql);
			foreach($arr as $val)
				if($val["fieldname"]==$field)
					$res=$val["type"];
		}
		return $res;
	}
}