|
|
@@ -55,12 +55,12 @@ $tables['Z']['BI_audit_CEIDG_pelnomocnicy']['rel']['nip']='nip';
|
|
|
$tables['Z']['BI_audit_CEIDG_pelnomocnicy']['rel_and']['adres']['miejscowosc']='miejscowosc';
|
|
|
$tables['Z']['BI_audit_CEIDG_pelnomocnicy']['rel_and']['adres']['ulica']='ulica';
|
|
|
$tables['Z']['BI_audit_CEIDG_pelnomocnicy']['rel_and']['adres']['kodPocztowy']='kodPocztowy';
|
|
|
-//$tables['Z']['BI_audit_CEIDG_pelnomocnicy']['ref'][]='BI_audit_CEIDG';
|
|
|
+$tables['Z']['BI_audit_CEIDG_pelnomocnicy']['backref'][19]='BI_audit_CEIDG';
|
|
|
|
|
|
|
|
|
$tables['Z']['BI_audit_CEIDG_powiazania']['rel']['nip']='nip';
|
|
|
$tables['Z']['BI_audit_CEIDG_powiazania']['rel']['regon']='nip';
|
|
|
-//$tables['Z']['BI_audit_CEIDG_powiazania']['ref'][]='BI_audit_CEIDG';
|
|
|
+$tables['Z']['BI_audit_CEIDG_powiazania']['backref'][18]='BI_audit_CEIDG';
|
|
|
|
|
|
|
|
|
$tables['Z']['BI_audit_KRS']['rel']['nip']='nip';
|
|
|
@@ -76,6 +76,7 @@ $tables['Z']['BI_audit_KRS']['ref'][11]='BI_audit_KRS_company';
|
|
|
|
|
|
$tables['Z']['BI_audit_KRS_company']['rel']['regon']='regon';
|
|
|
$tables['Z']['BI_audit_KRS_company']['rel']['krs']='krs';
|
|
|
+$tables['Z']['BI_audit_KRS_company']['backref'][11]='BI_audit_KRS';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -287,7 +288,7 @@ function dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time) {
|
|
|
while($h=$db->fetch($res)) {
|
|
|
echo "\n<br> #149 found ";// print_r($h);
|
|
|
$hist_loop[$T][]=$h;
|
|
|
- // $hist_time[][$T]=$sql_ext;
|
|
|
+ $hist_time[][$T]=$sql_ext;
|
|
|
$hist_time[][$T]=$h;
|
|
|
// print_r($hist_loop);
|
|
|
|
|
|
@@ -312,6 +313,24 @@ function dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ foreach($tables[$T]['backref'] as $ref_id => $ref_table) {
|
|
|
+ $sql_ref=" select PRIMARY_KEY from `CRM__#REF_TABLE__".$ref_id."` where `REMOTE_PRIMARY_KEY`=".$h->ID." ";
|
|
|
+ $res_rel=$db->query($sql_ref) or die('318 blad '.$sql_ref);
|
|
|
+ echo "<br>#319 ".$sql_ref;
|
|
|
+ while($h_rel=$db->fetch($res_rel)){
|
|
|
+ $sql_rel_rec="select * from `".$ref_table."` where ID=".$h_rel->PRIMARY_KEY." ";
|
|
|
+ $res_rel_rec=$db->query($sql_rel_rec) or die('211 blad '.$sql_rel_rec);
|
|
|
+ echo "<br>#324 ref tbl ".$sql_rel_rec;
|
|
|
+ while($h_rel_rec=$db->fetch($res_rel_rec)){
|
|
|
+ $hist_loop[$ref_table][]=$h_rel_rec;
|
|
|
+ $hist_time[][$ref_table]=$sql_rel_rec;
|
|
|
+ $hist_time[][$ref_table]=$h_rel_rec;
|
|
|
+ dig_next($hist_loop,$tables['Z'][$ref_table],$h_rel_rec,$loop,$hist_time);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|