Przeglądaj źródła

added TestKrs route

Piotr Labudda 8 lat temu
rodzic
commit
44836242d5

+ 1 - 1
SE/se-lib/AclQueryBuilder.php

@@ -391,7 +391,7 @@ class AclQueryBuilder {
     }
 
     $fieldType = $this->from->getXsdFieldType($fieldName);
-    list($typePrefix, $typeName, $retTypeName) = explode(':', $fieldType);
+    @list($typePrefix, $typeName, $retTypeName) = explode(':', $fieldType);
     switch ($typePrefix) {
       case 'xsd': return "{$prefix}.`{$fieldName}`";
       // 'gml:PolygonPropertyType':

+ 1 - 1
SE/se-lib/Route/Storage.php

@@ -706,7 +706,7 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
 					return 'ref:' === substr($field['xsdType'], 0, 4);
 				});
 				UI::table([
-					'caption' => UI::h('span', [], "Obiekty powiązane"),
+					'caption' => UI::h('span', [], "Obiekty powiązane (TODO backRef)"),
 					'rows' => array_map(function ($field) use ($thisGetLink) {
 						$ns = str_replace(['__x3A__', ':'], '/', substr($field['xsdType'], strlen('ref:')));
 						$isInstalled = (1 == DB::getPDO()->fetchValue("

+ 62 - 0
SE/se-lib/Route/TestKrs.php

@@ -0,0 +1,62 @@
+<?php
+
+Lib::loadClass('RouteBase');
+Lib::loadClass('P5');
+Lib::loadClass('Core_AclHelper');
+
+class Route_TestKrs extends RouteBase {
+
+  public function defaultAction() {
+    UI::gora();
+		UI::startContainer();
+    try {
+      echo UI::h('a', [
+        'class' => "btn btn-primary",
+        'href' => Router::getRoute('Storage')->getLink('objectStruct', ['idStorage'=>36, 'namespace'=>'default_db/BI_audit_KRS/BI_audit_KRS']),
+      ], "Storage BI_audit_KRS");
+
+      $refTableCom = ACL::getRefTable('default_db/BI_audit_KRS/BI_audit_KRS', 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company');
+      $refTablePer = ACL::getRefTable('default_db/BI_audit_KRS/BI_audit_KRS', 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person');
+      echo UI::h('pre', [], "
+        Tabela `{$refTableCom}`: 'default_db/BI_audit_KRS/BI_audit_KRS' ref do 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company'
+        Tablea `{$refTablePer}`: 'default_db/BI_audit_KRS/BI_audit_KRS' ref do 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person'
+      ");
+
+      $krsItems = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_KRS')->buildQuery([
+        'cols' => [ // TODO:? propertyName = []
+          'ID',
+          'A_STATUS_INFO',
+          'A_kod',
+          'A_kraj',
+          'A_miejscowosc',
+          'A_nrDomu',
+          'A_nrLokalu',
+          'A_poczta',
+          'A_ulica',
+          'L_APPOITMENT_USER',
+          'S_gmina',
+          'S_kraj',
+          'S_miejscowosc',
+          'S_powiat',
+          'S_wojewodztwo',
+          'dataDokumentu',
+          'krs',
+          'nazwa',
+          'nip',
+          'regon',
+          'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/*', // TODO: '/**' recursive - deep limit?
+          'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/*', // TODO: '/**' recursive - deep limit?
+        ]
+      ])->getItems([
+        'limit' => 10
+      ]);
+      DBG::nicePrint($krsItems, '$krsItems - limit 10');
+    } catch (Exception $e) {
+      DBG::log($e);
+      UI::alert('danger', $e->getMessage());
+    }
+    UI::endContainer();
+    UI::dol();
+  }
+
+}