|
@@ -56,7 +56,7 @@ $tables['X']['BI_audit_ENERGA_RUM_KONTRAHENCI']['rel']['regon']='REGON';
|
|
|
$tables['X']['BI_audit_ENERGA_RUM_KONTRAHENCI']['rel']['pesel']='PESEL';
|
|
$tables['X']['BI_audit_ENERGA_RUM_KONTRAHENCI']['rel']['pesel']='PESEL';
|
|
|
//$tables['X']['BI_audit_ENERGA_RUM_KONTRAHENCI']['rel']['teryt']=1;
|
|
//$tables['X']['BI_audit_ENERGA_RUM_KONTRAHENCI']['rel']['teryt']=1;
|
|
|
|
|
|
|
|
-$tables['X']['BI_audit_ENERGA_RUM_UMOWY']['rel_like']['nip']='Strony_umowy';
|
|
|
|
|
|
|
+//$tables['X']['BI_audit_ENERGA_RUM_UMOWY']['rel_like']['nip']='Strony_umowy';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -126,7 +126,7 @@ $tables['Z']['BI_audit_KRS_person']['backref'][12]='BI_audit_KRS';
|
|
|
function start_dig($tables) {
|
|
function start_dig($tables) {
|
|
|
global $db;
|
|
global $db;
|
|
|
foreach($tables['Y'] as $Y=>$t) {
|
|
foreach($tables['Y'] as $Y=>$t) {
|
|
|
- $sql='select * from '.$Y.' where ID=12 or ID=19 or 1=1 limit 100' ;
|
|
|
|
|
|
|
+ $sql='select * from '.$Y.' where ID=12 or ID=19 or 1=12 limit 100' ;
|
|
|
$res=$db->query($sql);
|
|
$res=$db->query($sql);
|
|
|
while($h=$db->fetch($res)) {
|
|
while($h=$db->fetch($res)) {
|
|
|
$hist_loop[$Y][]=$h;
|
|
$hist_loop[$Y][]=$h;
|
|
@@ -149,7 +149,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
|
|
|
global $db,$tables;
|
|
global $db,$tables;
|
|
|
$loop++;
|
|
$loop++;
|
|
|
echo "\n<hr>###LOOP ".$loop;
|
|
echo "\n<hr>###LOOP ".$loop;
|
|
|
- if($loop<10) {
|
|
|
|
|
|
|
+ if($loop<12) {
|
|
|
//detect next ref tbls
|
|
//detect next ref tbls
|
|
|
$sql = array();
|
|
$sql = array();
|
|
|
$sql_RELAND = array();
|
|
$sql_RELAND = array();
|
|
@@ -158,8 +158,8 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
|
|
|
foreach($z['rel'] as $z_rel_from=>$z_rel_to) {
|
|
foreach($z['rel'] as $z_rel_from=>$z_rel_to) {
|
|
|
// echo "110 test z_rel_fr ".$z_rel_from." to z_rel_to ".$z_rel_to ;
|
|
// echo "110 test z_rel_fr ".$z_rel_from." to z_rel_to ".$z_rel_to ;
|
|
|
if( isset($prev_tbl['rel'][$z_rel_from])) {
|
|
if( isset($prev_tbl['rel'][$z_rel_from])) {
|
|
|
- if( strlen($prev_dig->$prev_tbl['rel'][$z_rel_from]) > 1 ) {
|
|
|
|
|
- $sql[$Z]['rel'][$z_rel_to]= $prev_dig->$prev_tbl['rel'][$z_rel_from];
|
|
|
|
|
|
|
+ if( strlen($prev_dig->$prev_tbl['rel'][$z_rel_from]) > 0 ) {
|
|
|
|
|
+ $sql[$Z]['rel'][$z_rel_to] = $prev_dig->$prev_tbl['rel'][$z_rel_from];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -171,7 +171,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
|
|
|
$rel_and_ok=1;
|
|
$rel_and_ok=1;
|
|
|
|
|
|
|
|
foreach($z_rel_and_name as $z_rel_and_name_cur=>$z_rel_and_name_col_to) {
|
|
foreach($z_rel_and_name as $z_rel_and_name_cur=>$z_rel_and_name_col_to) {
|
|
|
- if(isset($prev_dig->$z_rel_and_name_col_to) ) {//and ( strlen($prev_dig->$z_rel_and_name_cur) > 2)
|
|
|
|
|
|
|
+ if(isset($prev_dig->$z_rel_and_name_col_to) and ( strlen($prev_dig->$z_rel_and_name_col_to)) > 0 ) {//and ( strlen($prev_dig->$z_rel_and_name_cur) > 2)
|
|
|
if($rel_and_ok<>0) $rel_and_ok=2;
|
|
if($rel_and_ok<>0) $rel_and_ok=2;
|
|
|
// echo "\n<br>121 rel_and from:".$last_tbl." OK for tbl ".$Z." z_rel_and_name_col_to: ".$z_rel_and_name_col_to." value:".$prev_dig->$z_rel_and_name_cur." rel_and_ok=".$rel_and_ok;
|
|
// echo "\n<br>121 rel_and from:".$last_tbl." OK for tbl ".$Z." z_rel_and_name_col_to: ".$z_rel_and_name_col_to." value:".$prev_dig->$z_rel_and_name_cur." rel_and_ok=".$rel_and_ok;
|
|
|
} else {
|
|
} else {
|
|
@@ -206,7 +206,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
|
|
|
$sql_rel_and_sql[$T][$z_rel_and_name]="select * from ".$T." where ( ";
|
|
$sql_rel_and_sql[$T][$z_rel_and_name]="select * from ".$T." where ( ";
|
|
|
$and=0;
|
|
$and=0;
|
|
|
foreach($z_rel_and_name_col as $z_rel_and_name_cur=>$z_rel_and_name_col_to) {
|
|
foreach($z_rel_and_name_col as $z_rel_and_name_cur=>$z_rel_and_name_col_to) {
|
|
|
- if( $and==1) $sql_rel_and_sql[$T][$z_rel_and_name].=" and `".$z_rel_and_name_cur."` like '".$z_rel_and_name_col_to."' and `".$z_rel_and_name_cur."` not like '%--%' and `".$z_rel_and_name_cur."` not like '' " ;
|
|
|
|
|
|
|
+ if( $and==1) $sql_rel_and_sql[$T][$z_rel_and_name].=" and `".$z_rel_and_name_cur."` = '".$z_rel_and_name_col_to."' and `".$z_rel_and_name_cur."` not like '%--%' and `".$z_rel_and_name_cur."` not like '' " ;
|
|
|
else $sql_rel_and_sql[$T][$z_rel_and_name].=" `".$z_rel_and_name_cur."` like '".$z_rel_and_name_col_to."' and `".$z_rel_and_name_cur."` not like '%--%' and `".$z_rel_and_name_cur."` not like '' " ;
|
|
else $sql_rel_and_sql[$T][$z_rel_and_name].=" `".$z_rel_and_name_cur."` like '".$z_rel_and_name_col_to."' and `".$z_rel_and_name_cur."` not like '%--%' and `".$z_rel_and_name_cur."` not like '' " ;
|
|
|
// if($z_rel_and_name_cur=='miejscowosc') $sql_rel_and_sql[$T][$z_rel_and_name].=" and `miejscowosc` not like '' " ;
|
|
// if($z_rel_and_name_cur=='miejscowosc') $sql_rel_and_sql[$T][$z_rel_and_name].=" and `miejscowosc` not like '' " ;
|
|
|
// if($z_rel_and_name_cur=='A_ulica') $sql_rel_and_sql[$T][$z_rel_and_name].=" and `A_ulica` not like '' " ;
|
|
// if($z_rel_and_name_cur=='A_ulica') $sql_rel_and_sql[$T][$z_rel_and_name].=" and `A_ulica` not like '' " ;
|
|
@@ -336,6 +336,8 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
|
|
|
print_r($h);
|
|
print_r($h);
|
|
|
echo "<br> Historia sledzen:";
|
|
echo "<br> Historia sledzen:";
|
|
|
print_r($hist_time);
|
|
print_r($hist_time);
|
|
|
|
|
+ echo "<br>relacje:";
|
|
|
|
|
+
|
|
|
echo "#177 eof </pre>";
|
|
echo "#177 eof </pre>";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|