Example #1
0
 function ProcessAjaxPopup()
 {
     global $conn, $ReportLanguage;
     $fld = NULL;
     if (@$_GET["popup"] != "") {
         $popupname = $_GET["popup"];
         // Check popup name
         // Build distinct values for invid
         if ($popupname == 'inv500_invid') {
             $bNullValue = FALSE;
             $bEmptyValue = FALSE;
             $sFilter = $this->Filter;
             $sSql = ewr_BuildReportSql($this->invid->SqlSelect, $this->getSqlWhere(), $this->getSqlGroupBy(), $this->getSqlHaving(), $this->invid->SqlOrderBy, $sFilter, "");
             $rswrk = $conn->Execute($sSql);
             while ($rswrk && !$rswrk->EOF) {
                 $this->invid->setDbValue($rswrk->fields[0]);
                 if (is_null($this->invid->CurrentValue)) {
                     $bNullValue = TRUE;
                 } elseif ($this->invid->CurrentValue == "") {
                     $bEmptyValue = TRUE;
                 } else {
                     $this->invid->GroupViewValue = $this->invid->GroupValue();
                     ewr_SetupDistinctValues($this->invid->ValueList, $this->invid->GroupValue(), $this->invid->GroupViewValue, FALSE);
                 }
                 $rswrk->MoveNext();
             }
             if ($rswrk) {
                 $rswrk->Close();
             }
             if ($bEmptyValue) {
                 ewr_SetupDistinctValues($this->invid->ValueList, EWR_EMPTY_VALUE, $ReportLanguage->Phrase("EmptyLabel"), FALSE);
             }
             if ($bNullValue) {
                 ewr_SetupDistinctValues($this->invid->ValueList, EWR_NULL_VALUE, $ReportLanguage->Phrase("NullLabel"), FALSE);
             }
             $fld =& $this->invid;
         }
         // Output data as Json
         if (!is_null($fld)) {
             $jsdb = ewr_GetJsDb($fld, $fld->FldType);
             ob_end_clean();
             echo $jsdb;
             exit;
         }
     }
 }
Example #2
0
function ewr_SetupDistinctValuesFromFilter(&$ar, $af)
{
    if (is_array($af)) {
        foreach ($af as $filter) {
            if ($filter->Enabled) {
                ewr_SetupDistinctValues($ar, $filter->ID, $filter->Name, FALSE);
            }
        }
    }
}