-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetComboData.php
80 lines (77 loc) · 1.63 KB
/
getComboData.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?
include_once('setConParam.php');
include_once('Class.Query.php');
$metaData = array(
'kod_org'=>array(
'table'=>'torg_ref'
,'fName'=>'naimp_org'
)
,'kod_kls'=>array(
'table'=>'tkls_main'
,'fName'=>'naimk_kls'
)
,'kod_kls_dolz'=>array(
'fKey'=>'kod_kls'
,'type'=>'COMBO'
,'condition'=>'kod_qualifier = 92'
)
,'kod_kls_okato'=>array(
'fKey'=>'kod_kls'
,'condition'=>'kod_qualifier = 55'
)
,'kod_kls_svyaz'=>array(
'fKey'=>'kod_kls'
,'type'=>'COMBO'
,'condition'=>'kod_qualifier = 22'
)
,'kod_pers'=>array(
'table'=>'torg_personal'
,'fName'=>'fio_pers'
)
);
$aFlds = $_REQUEST['req_combo'];
for($i=0; $i<count($aFlds); $i++)
{
$fld = $aFlds[$i];
if ( !$cQry )
$cQry = new CQuery($configure['connect']);
$cQry->execQuery("SET client_encoding TO utf8;");
$param = $metaData[$fld];
if ( $metaData[$fld]['type'] != 'COMBO' )
$param['LIMIT'] = 30;
if ( ($key=$param['fKey']) )
$param = array_merge($param, $metaData[$param['fKey']]);
else
$key = $fld;
$name = $param['table'];
if ( $_REQUEST['filt'] )
$param['filt'] = $_REQUEST['filt'];
$sqlText = $cQry->makeQuery($name, $param);
if ( $_REQUEST['l_trace'] )
echo $sqlText;
$cQry->execQuery($sqlText, $params, $name);
while($row=$cQry->getDataRow())
{
// $res[$row[$key]] = $row;
$row['kod_kls_dolz'] = $row['kod_kls'];
$res[] = $row;
}
// $text .= '
//HRC.Manager.setData("CMB_' . $name . '", ' .
//makeJSON($res) . ');';
$text .= makeJSON($res);
}
if ( $_REQUEST['l_trace'] )
{
echo '<pre>';
print_r($res);
echo $text;
}
else
{
if ( !$text )
$text = 'null';
header('Content-Type: application/xml; charset=utf-8');
echo $text;
}
?>