Sfoglia il codice sorgente

Merge branch 'master' of bn.git:plabudda/se

Piotr Labudda 8 anni fa
parent
commit
bb396a8471

+ 23 - 15
SE/schema/ant-object/default_db.BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI.xsd

@@ -1,20 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml/3.2"
    xmlns:Types__x3A__default_Default="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"
-   xmlns:default_db__x3A__IN7_DZIENNIK_KORESP="https://biuro.biall-net.pl/wfs/default_db/table/IN7_DZIENNIK_KORESP.xsd"
    xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty"
-   xmlns:default_db__x3A__ADMIN_USERS="https://biuro.biall-net.pl/wfs/default_db/table/ADMIN_USERS.xsd"
-   xmlns:default_db__x3A__IN7_MK_BAZA_DYSTRYBUCJI="https://biuro.biall-net.pl/wfs/default_db/table/IN7_MK_BAZA_DYSTRYBUCJI.xsd"
-   xmlns:SystemObjects__x3A__AccessGroup="https://biuro.biall-net.pl/wfs/default_db/SystemObjects/AccessGroup.xsd"
-   xmlns:SystemObjects__x3A__AccessOwner="https://biuro.biall-net.pl/wfs/default_db/SystemObjects/AccessOwner.xsd"
    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_KONTRAHENCI.xsd"
    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_UMOWY.xsd"
    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
-   targetNamespace="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_KONTRAHENCI.xsd">
+   targetNamespace="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_KONTRAHENCI.xsd"
+   xmlns:default_db__x3A__BI_audit_taxpayer="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_taxpayer.xsd">
    <xs:import
       namespace="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_UMOWY.xsd"
       schemaLocation="../../default_db.BI_audit_ENERGA_RUM_UMOWY/BI_audit_ENERGA_RUM_UMOWY/BI_audit_ENERGA_RUM_UMOWY.xsd"/>
+   <xs:import namespace="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_taxpayer.xsd"
+      schemaLocation="../../default_db.BI_audit_taxpayer/BI_audit_taxpayer/BI_audit_taxpayer.xsd"/>
    <xs:simpleType name="A_STATUS_Type" id="KONTRAHENCI___d4e4954-1_A_STATUS_T">
       <xs:restriction base="xs:string">
          <xs:enumeration value="NORMAL"/>
@@ -26,6 +24,12 @@
          <xs:enumeration value="OFF_HARD"/>
       </xs:restriction>
    </xs:simpleType>
+   <xs:simpleType name="ownCompany_Type" id="KONTRAHENCI___d5e5126-1">
+      <xs:restriction base="xs:string">
+         <xs:enumeration value="Y"/>
+         <xs:enumeration value="N"/>
+      </xs:restriction>
+   </xs:simpleType>
    <xs:complexType name="BI_audit_ENERGA_RUM_KONTRAHENCI" id="KONTRAHENCI___d4e4963-1_BI_audit_E">
       <xs:sequence id="KONTRAHENCI___d4e4964-1">
          <xs:element name="ID" type="xs:integer" id="KONTRAHENCI___d4e4989-1_ID"/>
@@ -75,14 +79,8 @@
                </xs:restriction>
             </xs:simpleType>
          </xs:element>
-         <xs:element name="ownCompany" id="KONTRAHENCI___d5e5125-1_ownCompany">
-            <xs:simpleType id="KONTRAHENCI___d5e5126-1">
-               <xs:restriction base="xs:string">
-                  <xs:enumeration value="Y"/>
-                  <xs:enumeration value="N"/>
-               </xs:restriction>
-            </xs:simpleType>
-         </xs:element>
+         <xs:element name="ownCompany" id="KONTRAHENCI___d5e5125-1_ownCompany"
+            type="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:ownCompany_Type"> </xs:element>
          <xs:element name="TERYT_SYM" type="xs:integer" id="KONTRAHENCI___d4e5013-1_TERYT_SYM"/>
          <xs:element name="TERYT_SYM_UL" type="xs:integer" id="KONTRAHENCI___d4e5014-1_TERYT_SYM_"/>
          <xs:element name="A_RECORD_CREATE_DATE" type="xs:dateTime"
@@ -102,7 +100,7 @@
             </xs:annotation>
          </xs:element>
          <xs:element ref="default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY"
-            id="KONTRAHENCI___d5ess5122-1">
+            id="KONTRAHENCI___d5ess5122-1" maxOccurs="unbounded" minOccurs="0">
             <xs:annotation>
                <xs:appinfo>
                   <system_cache__appinfo:flat_relation_cache>
@@ -111,6 +109,16 @@
                </xs:appinfo>
             </xs:annotation>
          </xs:element>
+         <xs:element ref="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer" minOccurs="0"
+            id="KONTRAHENCI___d5ess5taxp">
+            <xs:annotation>
+               <xs:appinfo>
+                  <system_cache__appinfo:flat_relation_cache>
+                     <system_cache__appinfo:source system_cache__appinfo:name="NIP" system_cache__appinfo:xpath="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer/nip"/>
+                  </system_cache__appinfo:flat_relation_cache>
+               </xs:appinfo>
+            </xs:annotation>
+         </xs:element>
       </xs:sequence>
    </xs:complexType>
    <xs:element name="BI_audit_ENERGA_RUM_KONTRAHENCI"

+ 7 - 37
SE/schema/ant-object/default_db.BI_audit_KRS/BI_audit_KRS/BI_audit_KRS.xsd

@@ -64,56 +64,26 @@
          <xs:element name="A_nrDomu" type="xs:string" id="I_audit_KRS___d4e4537-1_A_nrDomu"/>
          <xs:element name="A_ulica" type="xs:string" id="I_audit_KRS___d4e4538-1_A_ulica"/>
          <xs:element ref="default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person"
-            maxOccurs="unbounded" minOccurs="0" id="I_audit_KRS___d4e4539-1">
-            <xs:annotation>
-               <xs:appinfo>
-                  <system_cache__appinfo:flat_relation_cache>
-                     <system_cache__appinfo:source system_cache__appinfo:name="ID" system_cache__appinfo:xpath="default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/BI_audit_KRS"/>
-                  </system_cache__appinfo:flat_relation_cache>
-               </xs:appinfo>
-            </xs:annotation>
-         </xs:element>
+            maxOccurs="unbounded" minOccurs="0" id="I_audit_KRS___d4e4539-1"/>
          <xs:element maxOccurs="unbounded" minOccurs="0"
             ref="default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company"
-            id="I_audit_KRS___d4e4546-1"
-            ><!--<xs:annotation>
-               <xs:appinfo>
-                  <system_cache__appinfo:flat_relation_cache>
-                     <system_cache__appinfo:source system_cache__appinfo:name="ID" system_cache__appinfo:xpath="default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/BI_audit_KRS"/>
-                  </system_cache__appinfo:flat_relation_cache>
-               </xs:appinfo>
-               <xs:documentation>Relacja podpieta z tamtej strony w polu BI_audit_KRS</xs:documentation>
-            </xs:annotation>--></xs:element>
+            id="I_audit_KRS___d4e4546-1"/>
          <xs:element maxOccurs="unbounded"
             ref="default_db__x3A__BI_audit_KRS_address:BI_audit_KRS_address"
-            id="I_audit_KRS___d5e17508-1"
-            ><!--<xs:annotation>
-               <xs:appinfo>
-                  <system_cache__appinfo:flat_relation_cache>
-                     <system_cache__appinfo:source system_cache__appinfo:name="ID" system_cache__appinfo:xpath="default_db__x3A__BI_audit_KRS_address:BI_audit_KRS_address/TODO_FIX_BACKREF"/>
-                  </system_cache__appinfo:flat_relation_cache>
-               </xs:appinfo>
-            </xs:annotation>--></xs:element>
+            id="I_audit_KRS___d5e17508-1"/>
          <xs:element maxOccurs="unbounded" ref="default_db__x3A__BI_audit_KRS_PKD:BI_audit_KRS_PKD"
-            id="I_audit_KRS___d5e17509-1"
-            ><!--<xs:annotation>
-               <xs:appinfo>
-                  <system_cache__appinfo:flat_relation_cache>
-                     <system_cache__appinfo:source system_cache__appinfo:name="ID" system_cache__appinfo:xpath="default_db__x3A__BI_audit_KRS_PKD:BI_audit_KRS_PKD/TODO_FIX_BACKREF"/>
-                  </system_cache__appinfo:flat_relation_cache>
-               </xs:appinfo>
-            </xs:annotation>--></xs:element>
+            id="I_audit_KRS___d5e17509-1"/>
          <xs:element ref="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer"
-            id="I_audit_KRS___d5e5495-1">
+            id="I_audit_KRS___d5e5495-1" minOccurs="0">
             <xs:annotation>
                <xs:appinfo>
                   <system_cache__appinfo:flat_relation_cache>
                      <system_cache__appinfo:source system_cache__appinfo:name="nip" system_cache__appinfo:xpath="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer/nip"/>
                   </system_cache__appinfo:flat_relation_cache>
                </xs:appinfo>
-               <xs:documentation>Informacja o aktualnym płatniku VAT w tabeli referencyjnej (relacja
+               <!--<xs:documentation>Informacja o aktualnym płatniku VAT w tabeli referencyjnej (relacja
                   nip do
-                  default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer/nip)</xs:documentation>
+                  default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer/nip)</xs:documentation>-->
             </xs:annotation>
          </xs:element>
          <xs:element name="TERYT_SYM" id="I_audit_KRS___d4e5219-1_TERYT_SYM">

+ 12 - 1
SE/schema/ant-object/default_db.BI_audit_MSIG/BI_audit_MSIG/BI_audit_MSIG.xsd

@@ -77,7 +77,18 @@
          <xs:element maxOccurs="unbounded" minOccurs="0"
             ref="default_db__x3A__BI_audit_MSIG_PKD:BI_audit_MSIG_PKD"
                      id="_audit_MSIG___d5e6043-1"/>
-         <xs:element ref="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer"/>
+         <xs:element ref="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer">
+            <xs:annotation>
+               <xs:appinfo>
+                  <system_cache__appinfo:flat_relation_cache>
+                     <system_cache__appinfo:source system_cache__appinfo:name="nip" system_cache__appinfo:xpath="default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer/nip"/>
+                  </system_cache__appinfo:flat_relation_cache>
+               </xs:appinfo>
+               <!--<xs:documentation>Informacja o aktualnym płatniku VAT w tabeli referencyjnej (relacja
+                  nip do
+                  default_db__x3A__BI_audit_taxpayer:BI_audit_taxpayer/nip)</xs:documentation>-->
+            </xs:annotation>
+         </xs:element>
          <xs:element name="cached" id="KRS_company___d5e5531-1_cached" type="xs:int">
             <xs:annotation>
                <xs:documentation>Opis aktyalny właściwy w obiekcie BI_audit_ENERGA_PRACOWNICY

+ 11 - 10
SE/schema/ant-object/default_db.BI_audit_operational_raport_note/BI_audit_operational_raport_note/BI_audit_operational_raport_note.xsd

@@ -30,14 +30,12 @@
       schemaLocation="../../default_db.BI_audit_KRS/BI_audit_KRS/BI_audit_KRS.xsd"/>
    <xs:import namespace="https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_CEIDG.xsd"
       schemaLocation="../../default_db.BI_audit_CEIDG/BI_audit_CEIDG/BI_audit_CEIDG.xsd"/>
-   
    <xs:simpleType name="action_Type" id="raport_note___d5e6216-1_A_rapt">
       <xs:restriction base="xs:string">
          <xs:enumeration value="IGNORE"/>
          <xs:enumeration value="REPORT"/>
       </xs:restriction>
    </xs:simpleType>
-   
    <xs:simpleType name="A_STATUS_Type" id="raport_note___d5e6216-1_A_STATUS_T">
       <xs:restriction base="xs:string">
          <xs:enumeration value="NORMAL"/>
@@ -49,7 +47,6 @@
          <xs:enumeration value="OFF_HARD"/>
       </xs:restriction>
    </xs:simpleType>
-   
    <xs:complexType name="BI_audit_operational_raport_note" id="raport_note___d5e6225-1_BI_audit_o">
       <xs:annotation>
          <xs:documentation>Baza operacyjnych notatek umożliwiająca ignorowanie obiektu lub wskazywanie w raporcie informacji powiązanych dla obiektu w specjalny sposób.</xs:documentation>
@@ -61,7 +58,8 @@
                <xs:documentation>Opis/notatka kontekstu danego obiektu (Pracownik, KRS, Osoba) z jakimś zdarzeniem/podejrzeniem, z powodu którego należy dany rekord ignorować lub dodatkowo raportować w specjalny widoczny sposób w raporcie.</xs:documentation>
             </xs:annotation>
          </xs:element>
-         <xs:element name="long_note" type="xs:string" id="raport_note___d5e6235-1_long_note">
+         <xs:element name="long_note" type="xs:string" id="raport_note___d5e6235-1_long_note"
+            minOccurs="0">
             <xs:annotation>
                <xs:documentation>W przypadku długich opisów w notatce, należy w tym polu wprowadzić informacje, przekraczające 255 znaków.</xs:documentation>
             </xs:annotation>
@@ -79,22 +77,25 @@
          <xs:element name="A_RECORD_UPDATE_AUTHOR" type="xs:string" id="raport_note___d5e6239-RUA"/>
          <xs:element name="A_STATUS"
             type="default_db__x3A__BI_audit_operational_raport_note:A_STATUS_Type"
-            id="raport_note___d5e6243-1_A_STATUS"/>
-         <xs:element name="A_STATUS_INFO" type="xs:string" id="raport_note___d5e6244-1_A_STATUS_I"/>
+            id="raport_note___d5e6243-1_A_STATUS" minOccurs="0"/>
+         <xs:element name="A_STATUS_INFO" type="xs:string" id="raport_note___d5e6244-1_A_STATUS_I"
+            minOccurs="0"/>
          <xs:element name="L_APPOITMENT_USER" type="xs:string"
-            id="raport_note___d5e6245-1_L_APPOITME">
+            id="raport_note___d5e6245-1_L_APPOITME" minOccurs="0">
             <xs:annotation>
                <xs:documentation>Osoba odpowiedzialna za daną notatkę/przypomnienie/kontynuację działania.</xs:documentation>
             </xs:annotation>
          </xs:element>
          <xs:element name="L_APPOITMENT_DATE" type="xs:dateTime"
-            id="raport_note___d5e6244-1_LAPPDate">
+            id="raport_note___d5e6244-1_LAPPDate" minOccurs="0">
             <xs:annotation>
                <xs:documentation>Data przypomnienia.</xs:documentation>
             </xs:annotation>
          </xs:element>
-         <xs:element name="A_CLASSIFIED" type="xs:string" id="raport_note___d5e6246-1_A_CLASSIFI"/>
-         <xs:element name="A_ADM_COMPANY" type="xs:string" id="raport_note___d5e6247-1_A_ADM_COMP"/>
+         <xs:element name="A_CLASSIFIED" type="xs:string" id="raport_note___d5e6246-1_A_CLASSIFI"
+            minOccurs="0"/>
+         <xs:element name="A_ADM_COMPANY" type="xs:string" id="raport_note___d5e6247-1_A_ADM_COMP"
+            minOccurs="0"/>
          <xs:element ref="default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY"
             maxOccurs="unbounded" minOccurs="0" id="raport_note___d5e6243-1"/>
          <xs:element ref="default_db__x3A__BI_audit_ENERGA_FAKTURY:BI_audit_ENERGA_FAKTURY"

+ 4 - 4
SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl

@@ -29,11 +29,11 @@
     <xsl:param name="parallel" select="false()"/> <!-- if true will run in parallel using java parallel -->
     <xsl:param name="threadCount" select="10"/>
     <xsl:param name="ant-launcher.jar" required="yes"/>
-    <!--<xsl:param name="external_schema_table.path" required="yes"/>-->
-    
-    
     <xsl:param name="debug_level_param"/>
 
+<!--<xsl:param name="external_schema_table.path" required="yes"/>-->        
+    
+
     <xsl:template mode="build_element_complexType.xml build_tr_map.xml" match="system_cache__appinfo:element_complexType"> <!-- for type generate in main build.xml mode -->
                 <project basedir="{$basedir}" name="{$antfile_prefix}" default="{$antfile_prefix}"
                     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
@@ -92,7 +92,6 @@
             </param>
             <param name="debug_level_param" expression="{$debug_level_param}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
-
         </xslt>
             <delete>
                 <xsl:attribute name="file" select="concat('${',with-param/@select,with-param/@name,'}')"/>
@@ -103,6 +102,7 @@
     <xsl:template mode="build_tr_map.xml" match="build_cache">
         <sequential>
             <tempfile property="{with-param/@select}{with-param/@name}" deleteonexit="yes"><xsl:attribute name="destdir" select="'${detect_resource_type.local}'"/></tempfile>
+            <echo>creating <xsl:value-of select="with-param/@select"/>:<xsl:value-of select="with-param/@name"/></echo>
             <xslt basedir="./"    destdir="./"   out="${with-param/@select}{with-param/@name}">
                 <xsl:attribute name="style" select="'${p5_tr_map.xsl}'"/>
                 <xsl:attribute name="in" select="'${empty.xml}'"/>

+ 201 - 22
SE/schema/default_db_xml_cache.public/build_object_install_se_ant_object.xsl

@@ -35,7 +35,6 @@
    
     <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external"/>
         
-   
     <xsl:template match="system_cache__appinfo:get_all_xsd[ schema/( 
         @targetNamespace='http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/graph_relation_elements.xsd' or
         @targetNamespace='http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd' or
@@ -65,13 +64,15 @@
             <xsl:attribute name="found" select="$system_cache__appinfo:vrtfNamespaces//node()[local-name()='ns'][@uri=$targetNamespace][1]/@prefix" />
             <!-\-<xsl:copy-of select="$vrtfNamespaces"/>-\->
         </prefix>-->
+        <xsl:variable name="current.schema" select="."/>
         <xsl:variable name="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external">
             <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external">
                 <xsl:with-param name="prefix" select="$prefix"/>
                 <xsl:with-param name="targetNamespace" select="@targetNamespace"/>
                 <xsl:with-param name="prefix_root" select="$prefix"/>
                 <xsl:with-param name="targetNamespace_root" select="@targetNamespace"/>
-                <xsl:with-param name="system_cache__appinfo:document-uri-orig"></xsl:with-param>
+                <xsl:with-param name="system_cache__appinfo:document-uri-orig"/>
+            <xsl:with-param name="current.schema" select="$current.schema"/>
             </xsl:apply-templates>
         </xsl:variable>
         
@@ -113,7 +114,7 @@
                         <xsl:namespace name="{@prefix}" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final(@targetNamespace)"/>
                     </xsl:for-each-group>
                     
-                    <xsl:namespace name="{$schema.prefix}" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final($schema.targetNamespace)"/>
+                    <xsl:namespace name="xs" select="'http://www.w3.org/2001/XMLSchema'"/><xsl:namespace name="{$schema.prefix}" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final($schema.targetNamespace)"/>
                     
                     <xsl:namespace name="system_cache__appinfo" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd'"/>
                     <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
@@ -121,7 +122,7 @@
                         <!--<xsl:copy-of select="@*"/>-->
                         <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables_schema"/>
                     <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="$system_cache__appinfo:document-uri-orig"/>
-                    <xsl:comment>#92 including</xsl:comment>
+                    <xsl:attribute name="debig.106.count" select="count(current-group())"/><xsl:comment>#92 including</xsl:comment>
                     <!--<generate_tables_from_external_root.required_by.path_init>
                         <xsl:copy-of select=" current-group()/generate_tables_from_external_root.required_by.path_init/*" xpath-default-namespace=""/>
                     </generate_tables_from_external_root.required_by.path_init>-->
@@ -131,9 +132,9 @@
                             <xsl:attribute name="schemaLocation" select="concat(@prefix,'.xsd')"/>
                         </xsl:element>
                     </xsl:for-each-group>
-                    <xsl:comment>#81 now groping by type and @lat_token</xsl:comment>
+                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" select="$current.schema/*"/><xsl:comment>#81 now groping by type and @lat_token</xsl:comment>
                     <xsl:for-each-group select="current-group()" group-by="concat(@targetNamespace,name())">
-                        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema" select=".">
+                        <xsl:comment>#136 grouping schema elements count=<xsl:value-of select="count(current-group())"/></xsl:comment><xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema" select=".">
                             <xsl:with-param name="prefix" select="$prefix"/>
                             <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
                             <xsl:with-param name="prefix_root" select="$prefix"/>
@@ -152,7 +153,7 @@
                 <xsl:message >#138 $ant-obj-save-path element/@name=<xsl:value-of select="@name"/> <xsl:value-of select="$ant-obj-save-path"/></xsl:message>
                 
                 <xsl:result-document href="{$ant-obj-save-path}">
-                    <xsl:apply-templates select="../../."  mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element">
+                    <xsl:apply-templates select="../../."  mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.schema">
                         <xsl:with-param name="name" select="@name"/>
                     </xsl:apply-templates>
                 </xsl:result-document>
@@ -166,7 +167,7 @@
         
     </xsl:template>
     
-    <xsl:template match="schema" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+    <xsl:template match="schema" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
         <xsl:param name="name" required="yes"/>
         <xsl:element name="{name()}"  namespace="http://www.w3.org/2001/XMLSchema">
             <xsl:copy-of select="namespace::node()"/>
@@ -174,21 +175,33 @@
             <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element">
                 <xsl:with-param name="name" select="$name"/>
             </xsl:apply-templates>
-        </xsl:element>
+        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" select="*//system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root">
+                <xsl:with-param name="name" select="$name"/>
+            </xsl:apply-templates></xsl:element>
     </xsl:template>
     
     <xsl:template match="element[@name]" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
         <xsl:param name="name" required="yes"/>
         <xsl:choose>
             <xsl:when test="@name=$name">
-                <xsl:copy-of select="."/>
-            </xsl:when>
-        </xsl:choose>
+                <xsl:element name="{name()}">
+                    <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
+                </xsl:element></xsl:when>
+        <xsl:otherwise>
+                <xsl:comment>#198 uwanted root name <xsl:value-of select="name()"/>;</xsl:comment>
+                <xsl:element name="{name()}">
+                    <xsl:copy-of select="@*"/>
+                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
+                </xsl:element>
+            </xsl:otherwise></xsl:choose>
     </xsl:template>
     
-    <xsl:template match="complexType|simpleType|import" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
-        <xsl:copy-of select="."/>
-    </xsl:template>
+    <xsl:template match="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" /><xsl:template match="complexType|simpleType|import" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
+        </xsl:element></xsl:template>
     
     <!--<xsl:template match="schema[ not(@targetNamespace = 'external_schema__ksiegi_wieczyste__zsin_1013.xsd')]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:comment>#67 temporary bypased : <xsl:value-of select="@targetNamespace"/> ;  to analyze one schema scenario!</xsl:comment>
@@ -199,7 +212,16 @@
     
     
     <!-- (((( SCHEMA PARSERS PREFIX NAMESPACES ))) -->
-         <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema">
+         <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+                <xsl:element name="{name()}">
+                    <xsl:copy-of select="@*"/>
+                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
+                </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="simpleSchema" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:message terminate="yes"> #232 unanteded - todo upgrade for element <xsl:value-of select="name()"/> / @name <xsl:value-of select="@name"/> ; @id = <xsl:value-of select="@id"/></xsl:message>
+    </xsl:template><xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema">
              <xsl:param name="targetNamespace" required="yes"/>
              <xsl:param name="prefix" required="yes"/>
              <xsl:param name="prefix_root"  required="yes"/>
@@ -667,7 +689,8 @@
         <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
             <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
-            <xsl:element name="{name()}">
+            <xsl:attribute name="prefix" select="$prefix"/>
+            <xsl:attribute name="targetNamespace" select="$targetNamespace"/><xsl:element name="{name()}">
                 <!--<xsl:copy-of select="@*"/>-->
                 <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root_element_force_type_element">
                     <xsl:with-param name="generate_tables_from_external_root.path" select="concat($generate_tables_from_external_root.path,'/',$generate_tables_from_external_root.name)"/>
@@ -965,7 +988,7 @@
         </xsl:element>
     </xsl:template>
     
-    <xsl:template match="element[@type and not(complexType)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template match="element[@type and not(complexType) ]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@type"/>
         <xsl:param name="generate_tables_from_external_root.path" select="@type"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -979,7 +1002,29 @@
                         <xsl:comment>#203a - type typu xs:</xsl:comment>
                         <!--<xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_element" select="."/>-->
                     </xsl:when>
-                    <xsl:otherwise>
+                    <xsl:when test="simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                        <!--<xsl:variable name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace($targetNamespace_root,system_cache__appinfo:object_install_se_ant_object.root_complextype( complexType,@name))"/>
+                        <xsl:variable name="prefix" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix_root,system_cache__appinfo:object_install_se_ant_object.root_complextype( complexType,@name))"/>-->
+                        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType"  select="@*">
+                            <xsl:with-param name="prefix" select="$prefix"/>
+                            <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                            <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                            <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                        </xsl:apply-templates>
+                        <!--<xsl:copy-of select="@*"/>--> <!-- consider @type = default_db__x3A__ADMIN_USERS:ADMIN_USERS__A_STATUS -->
+                        <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+                            <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+                            <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+                            
+                            <xsl:comment>#203b.1 - type innego typu niż xs: - dla simpleType przypadek ADMIN_USERS/A_STATUS</xsl:comment>
+                            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" >
+                                <xsl:with-param name="prefix" select="$prefix"/>
+                                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                            </xsl:apply-templates>
+                        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+                    </xsl:when><xsl:otherwise>
                         <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type" select="@*">
                             <xsl:with-param name="prefix" select="$prefix"/>
                             <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
@@ -1013,7 +1058,122 @@
             </xsl:element>
     </xsl:template>
     
-    <xsl:template match="annotation" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template match="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    <xsl:template match="@type" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+       <!-- <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>-->
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:attribute name="type" select="concat($prefix,':',system_cache__appinfo:clean_object_prefix(current()))"/>
+    </xsl:template>
+    
+    <xsl:template match="simpleType" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child">
+                <xsl:with-param name="prefix" select="$prefix"/>
+                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child">
+                <xsl:with-param name="prefix" select="$prefix"/>
+                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="restriction" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.restriction">
+                <xsl:with-param name="prefix" select="$prefix"/>
+                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.restriction" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.restriction">
+                <xsl:with-param name="prefix" select="$prefix"/>
+                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <!--<xsl:template match="restriction" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.restriction" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:message terminate="yes">#1079 To be upgraded - propably multiple simpleType derivation to be root element exponed! @id=<xsl:value-of select="@id"/></xsl:message>
+    </xsl:template>-->
+    
+    <xsl:template match="restriction[@base='xs:anyAtomicType']" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.restriction" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+        
+    
+    
+    <xsl:template match="simpleType" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:message terminate="yes">#1096 To be upgraded - propably multiple simpleType derivation to be root element exponed!</xsl:message>
+        <!--<xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>-->
+        <!--<xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child"/>
+        </xsl:element>-->
+    </xsl:template><xsl:template match="annotation" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:comment>suppressed annotation <xsl:copy-of select=".//text()"/></xsl:comment>
     </xsl:template>
     
@@ -1257,7 +1417,13 @@
                         </xsl:for-each>
                     </generate_tables_from_external_root.required_by.path_init>
                 </xsl:when>
-            </xsl:choose>
+            <xsl:otherwise>
+                    <xsl:comment>
+                        #12688 suppressed for <xsl:value-of select="name()"/> /<xsl:value-of select="@name"/>
+                            ------
+                                <xsl:copy-of select="@*"/>
+                                            </xsl:comment>
+                </xsl:otherwise></xsl:choose>
             <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables"/>
         </xsl:element>
     </xsl:template>
@@ -1418,7 +1584,20 @@
         </xsl:choose>
     </xsl:template>
     
-    <xsl:template match="*|text()|comment()" mode="system_cache__appinfo:object_install_se_ant_object.root_complextype" />
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+      
+    <xsl:template match="import[ contains(@namespace,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:element name="{name()}">
+            <xsl:attribute name="namespace" select="@namespace"/>
+            <xsl:variable name="schemaLocation" select="system_cache__appinfo:get_default_db_obj_url_table_name(@namespace)"/>
+            <xsl:attribute name="schemaLocation" select="$schemaLocation"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="import[ not(contains(@namespace,$default_db_targetNamespace_detect_string))]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:message>#1646 ignored <xsl:copy-of select="@namespace"/>; not matched = <xsl:value-of select="$default_db_targetNamespace_detect_string"/></xsl:message>
+        <xsl:comment>#1646 ignored <xsl:copy-of select="@namespace"/>; not matched = <xsl:value-of select="$default_db_targetNamespace_detect_string"/></xsl:comment>
+    </xsl:template><xsl:template match="*|text()|comment()" mode="system_cache__appinfo:object_install_se_ant_object.root_complextype" />
         
     
     

+ 87 - 2
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl

@@ -292,8 +292,31 @@
                 
                 
                 
+<!-- ! Wyłączone tymczasowo 2017-10-19 <topichead navtitle="Powiązania do kontrahentów z którymi zawarto umowy (podział na źródła)(z wariantu porównawczego)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <topichead navtitle="żródło: {.} - Powiązania do kontrahentów z którymi zawarto umowy">
+                            <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI and  object[position() = 1]/*/source= $source]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
+                                
+                                <!-\-<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-\->
+                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                <xsl:choose>
+                                    <xsl:when test="//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">
+                                        <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_do" select="current-group()[position() = 1]">
+                                            <xsl:with-param name="group_name" select="$group_name"/>
+                                            <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+                                        </xsl:apply-templates> 
+                                    </xsl:when>
+                                </xsl:choose>
+                                <!-\-</topichead>-\->
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>-->                
+                                
                 
-                <!--@107-11-14 to be fixed? <topichead navtitle="Powiązania do kontrahentów z którymi zawarto umowy">
+<!--@107-11-14 to be fixed? <topichead navtitle="Powiązania do kontrahentów z którymi zawarto umowy">
                     
                     <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI ]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
                                 <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
@@ -448,7 +471,7 @@
                 
                 
                                 
-                                <xsl:choose>
+<xsl:choose>
                                     <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old">
                         <topichead navtitle="Powiązania dla wariantu porównawczego raportów (dostępne, nie użyte)"/>
                     </xsl:when>
@@ -456,6 +479,68 @@
                                 </xsl:choose>
                                 
                             
+<!--<topichead navtitle="Powiązania do wybranych podmiotów/kontrahentów (dla wariantu porównawczego)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <topichead navtitle="żródło: {.} -(podział na spółki własne)  Powiązania wybranych podmiotów/kontrahentów">
+                            
+                            <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_UMOWY" group-by="Spolka_glowna">
+                                <xsl:variable name="spolka_glowna" select="Spolka_glowna[1]"/>
+                                
+                                
+                                <xsl:variable name="if_topic">
+                                    <xsl:message>#268 if topic for <xsl:value-of select="$spolka_glowna"/>;</xsl:message>
+                                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI and  object[position() = 1]/*/source= $source]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                        <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
+                                        <xsl:variable name="kontrahent_id" select="object[position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                        <xsl:variable name="current_group" select="current-group()"/>
+                                        <!-\-<xsl:variable name="zrodlo" select="."/>-\->
+                                        <xsl:message>#346 kontr podzial go <xsl:value-of select="position()"/> / id: <xsl:value-of select="$kontrahent_id"/> / <xsl:value-of select="$spolka_glowna"/></xsl:message>
+                                        <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                        <!-\-<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-\->
+                                        
+                                        <xsl:for-each select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrahent_id and BI_audit_ENERGA_RUM_UMOWY/Spolka_glowna=$spolka_glowna]">
+                                            <xsl:if test="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI[ID = $kontrahent_id]">
+                                                <topicref href="{$group_name}_DO/1.dita"/>
+                                            </xsl:if>
+                                            
+                                        </xsl:for-each>
+                                    </xsl:for-each-group>
+                                </xsl:variable>
+                                
+                                <xsl:choose>
+                                    <xsl:when test="$if_topic/*">
+                                        <topichead navtitle="żródło: {$source} spółka gł:{$spolka_glowna} ">
+                                            <xsl:message>#267 podzial spolka glowna: <xsl:value-of select="$spolka_glowna"/></xsl:message>
+                                            <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI and  object[position() = 1]/*/source= $source]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                                <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI.key(ID)"/>
+                                                <xsl:variable name="kontrahent_id" select="object[position() = last() ]/* [ position() = 1]/ID"/>
+                                                <xsl:variable name="current_group" select="current-group()"/>
+                                                <!-\-<xsl:variable name="zrodlo" select="."/>-\->
+                                                
+                                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                                <!-\-<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-\->
+                                                
+
+                                                <xsl:for-each select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrahent_id and BI_audit_ENERGA_RUM_UMOWY/Spolka_glowna=$spolka_glowna]">
+                                                    <xsl:message> #270 $kontrahent =<xsl:value-of select="$group_name"/></xsl:message>
+                                                    <xsl:if test="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI[ID = $kontrahent_id]">
+                                                        <topicref href="{$group_name}/{$group_name}.dita"/>
+                                                    </xsl:if>
+                                                </xsl:for-each>
+                                                
+                                                <!-\-</topichead>-\->
+                                            </xsl:for-each-group>
+
+                                        </topichead>
+                                    </xsl:when>
+                                </xsl:choose>
+                                
+                            </xsl:for-each-group>
+
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>-->                
                 
                 <topichead navtitle="Powiązania do kontrahentów z KRS ogólnie (podział na źródła)">
                     

+ 53 - 22
SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl

@@ -3,6 +3,7 @@
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
     xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
     exclude-result-prefixes="xs"
     version="2.0">
     <!-- file is executed by
@@ -135,10 +136,8 @@
     <xsl:include href="BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors_tree_to_dita.xsl"/>
     <xsl:include href="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl"/>
     <xsl:include href="EXAMPLE/EXAMPLE_tree_to_dita.xsl"/>
-    
-    
-    
     <xsl:include href="Benford.xsl"/>
+        
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
@@ -146,7 +145,9 @@
     <xsl:param name="uuid" required="yes"/>
     
     <xsl:param name="system_cache__dita:pdf_a4_string_width" select="80"/> <!-- parameter for automate table width - how many letters fits in pdf output -->
-    <xsl:param name="system_cache__dita:simpletable.col.size" select="4"/><xsl:variable name="ditadir" select="concat($temp,'/',$uuid)"/>
+    <xsl:param name="system_cache__dita:simpletable.col.size" select="4"/> <!-- parameter for automate table width - how much space takes every column -->
+    
+    <xsl:variable name="ditadir" select="concat($temp,'/',$uuid)"/>
     
     <xsl:template mode="preprocess" match="RelatedFeatureRoot">
         <preprocess_dita>
@@ -190,10 +191,25 @@
     <xsl:template match="map" mode="ditamap_root">
         <xsl:element name="{name()}">
             <xsl:copy-of select="@*"/>
-        <xsl:copy-of select="title"/><xsl:apply-templates mode="ditamap_root.embedded_map" />
-        <xsl:message>#196 in mode="ditamap_root" digging! </xsl:message></xsl:element>
+        <xsl:copy-of select="title"/>
+            <xsl:apply-templates mode="ditamap_root.embedded_map" />
+        <xsl:message>#196 in mode="ditamap_root" digging! </xsl:message>
+            <!--<debug197><xsl:copy-of select="."/></debug197>-->
+            <!--<xsl:variable name="Benford:ditamap_root.embedded_map">
+                <xsl:apply-templates mode="Benford:ditamap_root.embedded_map" />
+            </xsl:variable>
+            <xsl:if test="$Benford:ditamap_root.embedded_map/*">
+                <topichead navtitle="Wykryto brak poprawności rozkładu Benforda">
+                    <xsl:apply-templates mode="ditamap_root.embedded_map" select="$Benford:ditamap_root.embedded_map" />
+                </topichead>
+            </xsl:if>-->
+        </xsl:element>
     </xsl:template>
     
+    <!--<xsl:template match="title" mode="ditamap_root.embedded_map">
+        <xsl:copy-of select="."/>
+    </xsl:template>-->
+    
     <xsl:template match="topichead|xref" mode="ditamap_root.embedded_map">
         <xsl:element name="{name()}">
             <xsl:copy-of select="@*"/>
@@ -201,28 +217,37 @@
         </xsl:element>
     </xsl:template>
     
-    <xsl:template mode="ditamap_root.embedded_map" match="@*"><xsl:copy-of select="."/></xsl:template><xsl:template match="topic" mode="ditamap_root.embedded_map">
+    <xsl:template mode="ditamap_root.embedded_map" match="@*"><xsl:copy-of select="."/></xsl:template>
+    
+    
+    <xsl:template match="topic" mode="ditamap_root.embedded_map">
         <topicref href="{@id}.dita">
             <xsl:variable name="ditamap_root.embedded_map.body">
                 <xsl:apply-templates mode="ditamap_root.embedded_map.body"/>
-            </xsl:variable><xsl:result-document href="{$temp}/{$uuid}/{@id}.dita">
+            </xsl:variable>
+            <xsl:result-document href="{$temp}/{$uuid}/{@id}.dita">
                 <xsl:element name="{name()}">
                     <xsl:apply-templates mode="ditamap_root.embedded_map" select="@*"/>
                     <!--<xsl:copy-of select="@*"/>-->
                     <xsl:apply-templates mode="Benford:ditamap_root.embedded_map.body.topic.cleanup" select="$ditamap_root.embedded_map.body"/>
                 </xsl:element>
             </xsl:result-document>
-            <xsl:apply-templates mode="Benford:ditamap_root.embedded_map.body.topicref.topic" select="$ditamap_root.embedded_map.body"/><xsl:apply-templates mode="ditamap_root.embedded_map" />
+            <xsl:apply-templates mode="Benford:ditamap_root.embedded_map.body.topicref.topic" select="$ditamap_root.embedded_map.body"/>
+            <xsl:apply-templates mode="ditamap_root.embedded_map" />
         </topicref>
     </xsl:template>
     
-    
     <xsl:template mode="ditamap_root.embedded_map.body" match="@*">
         <xsl:copy-of select="."/>
     </xsl:template>
     
-    <xsl:template mode="ditamap_root.embedded_map.body" match="@system_cache__dita:width_cols"/><xsl:template match="*" mode="ditamap_root.embedded_map.body">
+    <xsl:template mode="ditamap_root.embedded_map.body" match="@system_cache__dita:width_cols"/>
+        
+        
+    
+    <xsl:template match="*" mode="ditamap_root.embedded_map.body">
         <xsl:element name="{name()}">
+            <!--<xsl:copy-of select="@*"/>-->
             <xsl:apply-templates select="@*" mode="ditamap_root.embedded_map.body"/>
             <xsl:apply-templates mode="ditamap_root.embedded_map.body"/>
         </xsl:element>
@@ -232,15 +257,12 @@
         <xsl:value-of select="."/>
     </xsl:template>
     
-    <xsl:template match="simpletable[ contains(@id,'GRAPH_')]" mode="ditamap_root.embedded_map.body">
-        
+    <xsl:template match="simpletable[ contains(@id,'GRAPH_')]" mode="ditamap_root.embedded_map.body">        
         <xsl:copy-of select="."/>
-
         <xsl:apply-templates mode="system_cache__dita:graph__read" select=".">
             <xsl:with-param name="fileindex" select="@id"/>
             <xsl:with-param name="width" select="700"/>
         </xsl:apply-templates>
-        
     </xsl:template>
     
     
@@ -293,7 +315,10 @@
             <xsl:with-param name="topic.id" select="../../../@id"/>
         </xsl:apply-templates>
         <!--<xsl:copy-of select="$table_cut"/>-->
-    </xsl:template><xsl:template match="*" mode="preprocess_root.embedded_map.simpletable">
+    </xsl:template>
+    
+    
+    <xsl:template match="*" mode="preprocess_root.embedded_map.simpletable">
         <xsl:element name="{name()}">
             <xsl:copy-of select="@*"/>
             <xsl:apply-templates mode="preprocess_root.embedded_map.simpletable"/>
@@ -319,6 +344,9 @@
                 <xsl:with-param name="fileindex" select="@id"/>
             </xsl:apply-templates>
         </xsl:for-each>
+                
+
+        
         <!--<debug>
             <xsl:copy-of select="//simpletable[ contains(@id,'GRAPH_')]"></xsl:copy-of>
         </debug>-->
@@ -340,8 +368,7 @@
         
     
     
-  
-    
+<!-- TODO 2017-10-20 to implement -->  
     <xsl:template mode="table_cut" match="simpletable">
         <xsl:param name="width_cols"  select="6"/>
         <xsl:param name="header_cols" select="1"/>
@@ -638,11 +665,13 @@
         <xsl:variable name="system_cache__dita:width_cols.auto" select="round(count($simpletable/sthead/stentry) div $system_cache__dita:width_cols.auto.div )"/>
         <xsl:message>#506 system_cache__dita:width_cols.auto $sum_width=<xsl:value-of select="$sum_width"/> $screens_div_sum = <xsl:value-of select="$screens_div_sum"/> ; $system_cache__dita:width_cols.auto.cols=<xsl:value-of select="$system_cache__dita:width_cols.auto.cols"/>; $system_cache__dita:width_cols.auto.div=<xsl:value-of select="$system_cache__dita:width_cols.auto.div"/>; <xsl:value-of select="$system_cache__dita:width_cols.auto"/> </xsl:message>
         <xsl:value-of select="$system_cache__dita:width_cols.auto"/>
-    </xsl:template><xsl:template match="*|text()|comment()" mode="ditamap_root.embedded_map"/>
-    
+    </xsl:template>
     
+    <xsl:template match="*|text()|comment()" mode="ditamap_root.embedded_map"/>
     
-<xsl:template mode="system_cache__dita:xref.topic.result-document" match="@*"><xsl:copy-of select="."/></xsl:template>
+    <xsl:template mode="system_cache__dita:xref.topic.result-document" match="@*">
+        <xsl:copy-of select="."/>
+    </xsl:template>
     
     <xsl:template match="*" mode="system_cache__dita:xref.topic.result-document">
         <topicref href="{@id}.dita">
@@ -745,4 +774,6 @@
         <xsl:param name="Benford:subject"/>
         <!--<xref href="#topic_ghxf_rum_os_d1e1/simpgletablesss_inaaz_fwf_d1e1_1" format="dita">asd</xref>-->
         <xsl:value-of select="concat($Benford:subject,'_',$Benford:year)"/>
-    </xsl:function></xsl:stylesheet>
+    </xsl:function>
+    
+</xsl:stylesheet>

+ 2 - 0
SE/schema/default_db_xml_cache.public/get_all_xsd.xsl

@@ -475,6 +475,7 @@
     <!-- EOF external schema templates -->
     
     
+
     <xsl:template name="system_cache__appinfo:get_all_xsd.verify_unique_id">
         <system_cache__appinfo:get_all_xsd.verify_unique_id>
             <xsl:variable name="system_cache__appinfo:get_all_xsd" select="doc($procesy5_system_schema)"/>
@@ -494,6 +495,7 @@
         </system_cache__appinfo:get_all_xsd.verify_unique_id>
     </xsl:template>
     
+
     <xsl:template name="system_cache__appinfo:get_all_xsd">
         <xsl:param name="path2collection" select="$procesy5_system_schema_collection_dir"/> 
         <xsl:param name="get_system_schemas"/>

+ 4 - 4
SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl

@@ -235,7 +235,7 @@
                        <xsl:copy-of select="$OGC_Filter"/>
                    </Filter>-->
         </xsl:if>
-        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15')"/>
+        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003')"/>
         <xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>
         <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($url_string)"/>
         <xsl:if test="$debug &gt; 5">
@@ -247,7 +247,7 @@
                 <!--<xsl:copy-of select="$wfs_response"/>-->
                 
                 <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
-            </wfs_response>
+            <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/></wfs_response>
         </xsl:if>
         <xsl:apply-templates mode="after_first_ant_assing_vars" select="$get_wfs_recurse_xsl:GetsimpleSchema">
             <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
@@ -317,7 +317,7 @@
                           <xsl:copy-of select="$OGC_Filter"/>
                       </Filter>-->
         </xsl:if>
-        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15')"/>
+        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003')"/>
         <xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>
         <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($url_string)"/>
         <xsl:if test="$debug &gt; 5">
@@ -382,7 +382,7 @@
                       <xsl:copy-of select="$OGC_Filter"/>
                   </Filter>-->
         
-        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15')"/>
+        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003')"/>
         <xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>
         <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($url_string)"/>
         <xsl:if test="$debug &gt; 4">

+ 7 - 1
SE/schema/default_db_xml_cache.public/main_build_recurse_ant.dita_with_id.xsl

@@ -171,6 +171,7 @@
         <xsl:variable name="build_complexType" select="doc(concat($build_complexType_dir,'/',$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@prefix,'/',$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element,'.xml'))"/>
         <xsl:variable name="detect_resource_type" select=" system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_from_cache(@system_cache__appinfo:ref)"/>
         <xsl:comment>#138 from <xsl:value-of select="@system_cache__appinfo:ref"/>; I get prefixed_object_info/@element <xsl:value-of select="$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element"/>; </xsl:comment>
+
         <xsl:choose>
             <xsl:when test="@flat_relation_cache_xpath and @flat_relation_cache_name">
                 <xsl:element name="RelatedFeature">
@@ -228,7 +229,9 @@
                 <xsl:message>#228 @flat_relation_cache_xpath and @flat_relation_cache_name not set for @id<xsl:value-of select="@id"/></xsl:message>
                 <xsl:comment>#228 @flat_relation_cache_xpath and @flat_relation_cache_name not set for @id<xsl:value-of select="@id"/></xsl:comment>
             </xsl:otherwise>
-        </xsl:choose></xsl:template>
+        </xsl:choose> 
+            
+    </xsl:template>
     
     <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element_477[@system_cache__appinfo:loop_name]">
         <!--<xsl:param name="build_complexType" required="yes"/>-->
@@ -306,6 +309,9 @@
                 <xsl:attribute name="xpath_value" select="concat('../',@flat_relation_cache_name)"/>
             </xsl:when>
             <xsl:otherwise>
+                <!-- <xsl:attribute name="xpath" select="'ID'"/>
+                <xsl:attribute name="xpath_value" select="'ID'"/>-->
+                <!--<xsl:attribute name="debug" select="'#99 this is fake TODO'"/>-->
                 <xsl:message terminate="yes">#99 for @system_cache__appinfo:id=<xsl:value-of select="@system_cache__appinfo:id"/>; @system_cache__appinfo:ref=<xsl:value-of select="@system_cache__appinfo:ref"/> is empty definition for @flat_relation_cache_xpath or @flat_relation_cache_name </xsl:message>
             </xsl:otherwise>
         </xsl:choose>

+ 5 - 4
SE/schema/default_db_xml_cache.public/system_cache__appinfo/external_schema_targetNamespace.xsl

@@ -9,8 +9,7 @@
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
-    
-    
+      
     <xsl:param name="default_db_targetNamespace_detect_string" select="'default_db/table/'"/>
     
     <xsl:function name="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace">
@@ -58,9 +57,11 @@
                 <xsl:message>#56 TO MOVE TO CONFIG not adding .xsd because of default</xsl:message>
                 <xsl:value-of select="$targetNamespace"/>
             </xsl:when>
-            <xsl:otherwise><xsl:value-of select="concat($targetNamespace,'.xsd')"/>
+            <xsl:otherwise>
+                <xsl:value-of select="concat($targetNamespace,'.xsd')"/>
     </xsl:otherwise>
-        </xsl:choose></xsl:function>
+        </xsl:choose>
+    </xsl:function>
     
     <xsl:function name="system_cache__appinfo:object_install_se_ant_object.save_to_ant-object-path">
         <xsl:param name="system_cache__appinfo:document-uri-orig"/> <!-- for use in schema -->

+ 4 - 4
SE/se-lib/Core/Database/Mysql.php

@@ -257,7 +257,7 @@ class Core_Database_Mysql extends Core_Database {
 
 						       				DEBUG_S(-3,"Dane tabeli KOMORKI ".$TABLE." ",$TABLES_IMPORT[$TABLE]['FIELDS'],__FILE__, __FUNCTION__, __LINE__);
 						       				DEBUG_S(-3,"Dane tabeli INDEKSY ".$TABLE." ",$TABLES_IMPORT[$TABLE]['INDEX'],__FILE__, __FUNCTION__, __LINE__);
-						       				if(isset($TABLES_IMPORT[$TABLE]['VALUES'])) DEBUG_S(-3,"Dane tabeli VALUES ".$TABLE." ",$TABLES_IMPORT[$TABLE]['VALUES'],__FILE__, __FUNCTION__, __LINE__);
+						       				if(isset($TABLES_IMPORT[$TABLE]['VALUES'])) DEBUG_S(3,"Dane tabeli VALUES ".$TABLE." ",$TABLES_IMPORT[$TABLE]['VALUES'],__FILE__, __FUNCTION__, __LINE__);
 
 							   				//! reading triggers to conf -> $TABLES_IMPORT[$TABLE]['TRIGGERS']
 							   			    $sql=" show triggers like '".$TABLE."' ;" ;
@@ -639,7 +639,7 @@ class Core_Database_Mysql extends Core_Database {
 
 
 														//BEGIN PROCEDURE
-						DEBUG_S(-3,'Try to synchronize functions and procedures',$ARR_TABLE,__FILE__,__FUNCTION__,__LINE__);
+						DEBUG_S(3,'Try to synchronize functions and procedures',$ARR_TABLE,__FILE__,__FUNCTION__,__LINE__);
 
 													$sql=" SHOW PROCEDURE STATUS; ;" ; //listujemy nasze procedury
 									       			DEBUG_S(-3,'Looking for PROCEDURE ',$sql,__FILE__,__FUNCTION__,__LINE__);
@@ -916,7 +916,7 @@ class Core_Database_Mysql extends Core_Database {
 								       							    if($ARR_TABLE['FIELDS'][$INDEX_OF_CONFIG_TABLE]->Null=='NO') $sql.=" not null "; else $sql.=" null ";
 								       							    }
 								       							    $sql.=" ;";
-								       								DEBUG_S(-3,'add field',$sql,__FILE__,__FUNCTION__,__LINE__);
+								       								DEBUG_S(3,'add field',$sql,__FILE__,__FUNCTION__,__LINE__);
 								       								 $this->query($sql) or  DEBUG_S(-3,'Problem z sql',$sql,__FILE__, __FUNCTION__, __LINE__)  or die1();
 
 
@@ -1284,7 +1284,7 @@ class Core_Database_Mysql extends Core_Database {
 									}
 									$sql.=$vals." ) ;";
 										 $this->query($sql) or die1('\nProblem z '.$sql);
-									DEBUG_S(-3,'Dodanie rekordu do tabeli ',$sql,__FILE__,__FUNCTION__,__LINE__);
+									DEBUG_S(3,'Dodanie rekordu do tabeli ',$sql,__FILE__,__FUNCTION__,__LINE__);
 
 
 	       						}

+ 12 - 7
SE/se-lib/Route/UrlAction/BiAuditGenerate.php

@@ -119,10 +119,10 @@ class Route_UrlAction_BiAuditGenerate extends RouteBase {
       </div>
     </div>
     <div class="form-group">
-       <div class="col-sm-offset-2 col-sm-10">
-         Częściowe odświeżenie wymagane w przypadku, gdy dokonano dowolnych zmian w tabelach pracowników/kontrahentów.<br/>
-         Pełne odświeżenie wymagane w przypadku modyfikacji baz KRS lub CEiDG (UWAGA - trwa to wiele godzin)
-       </div>
+      <div class="col-sm-offset-2 col-sm-10">
+        Częściowe odświeżenie wymagane w przypadku, gdy jedynie dodano nowe rekordy w tabelach pracowników/kontrahentów.<br/>
+        Pełne odświeżenie wymagane w przypadku edycji/usunięcia istniejących rekordów w tabelach pracowników/kontrahentów (w zależności od ilości rekordów może trwać znacznie dłużej)
+      </div>
     </div>
     <div class="form-group">
       <div class="col-sm-12">
@@ -412,8 +412,8 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
     </div>
     <div class="form-group">
       <div class="col-sm-offset-4 col-sm-8">
-        Częściowe odświeżenie wymagane w przypadku, gdy dokonano dowolnych zmian w tabelach pracowników/kontrahentów.<br/>
-        Pełne odświeżenie wymagane w przypadku modyfikacji baz KRS lub CEiDG (UWAGA - trwa to wiele godzin)
+        Częściowe odświeżenie wymagane w przypadku, gdy jedynie dodano nowe rekordy w tabelach pracowników/kontrahentów.<br/>
+        Pełne odświeżenie wymagane w przypadku edycji/usunięcia istniejących rekordów w tabelach pracowników/kontrahentów (w zależności od ilości rekordów może trwać znacznie dłużej)
       </div>
     </div>
     <div class="form-group">
@@ -1827,7 +1827,12 @@ class BiAuditPowiazania {
 
 				if ($refTable = $this->getRefTable('BI_audit_operational_raport_note', $row['REMOTE_TABLE'], false)) {
 					$query = "select `note`.* from `BI_audit_operational_raport_note` `note` join `{$refTable}` `ref` on `note`.`ID` = `ref`.`PRIMARY_KEY` where `ref`.`REMOTE_PRIMARY_KEY` = '{$row['REMOTE_ID']}'";
-					if ($notes = DB::getPDO()->fetchAll($query)) $item_result[$row['REMOTE_TABLE']]['operational_raport_note'] = $notes;
+					if ($notes = DB::getPDO()->fetchAll($query)) $item_result[$row['REMOTE_TABLE']]['BI_audit_operational_raport_note'] = $notes;
+				}
+
+				if ($refTable = $this->getRefTable($row['REMOTE_TABLE'], 'BI_audit_taxpayer', false)) {
+					$query = "select `taxpayer`.* from `{$refTable}` `ref` join `BI_audit_taxpayer` `taxpayer` on `ref`.`REMOTE_PRIMARY_KEY` = `taxpayer`.`ID` where `ref`.`PRIMARY_KEY` = '{$row['REMOTE_ID']}'";
+					if ($taxpayer = DB::getPDO()->fetchFirst($query)) $item_result[$row['REMOTE_TABLE']]['BI_audit_taxpayer'] = $taxpayer;
 				}
 
 				if ($rel) $item_result['relation_from'] = $this->relationName($rel);

+ 55 - 46
SE/superedit-INSTALL_SES_PROCESY_A.php

@@ -82,7 +82,7 @@ function SSH_COMMAND_REMOTE_CREATE($username,$host,$password,$command) {
 //return '/opt/local/bin/sshpass -p '.$password.' ssh -o StrictHostKeyChecking=no '.$username.'@'.$host.' <<EOF
 return '/opt/local/bin/sshpass -p '.str_replace('!','\!',$password).' ssh -o StrictHostKeyChecking=no -o ConnectTimeout=99999 '.$username.'@'.$host.' -t <<EOF
 sudo -n su -
-declare PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/lib/mysql55/bin/:/Applications/Server.app/Contents/ServerRoot/usr/sbin/
+declare PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/lib/mariadb/bin/:/Applications/Server.app/Contents/ServerRoot/usr/sbin/
 
 '.$command.'
 
@@ -98,7 +98,7 @@ EOF';
 
 function execOnParallels($command) {
     $exec_command = 'ssh -o StrictHostKeyChecking=no -o ConnectTimeout=99999 arkadiuszbinder@parallels.biall-net.pl -t <<EOF
-        declare PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/lib/mysql55/bin/:/Applications/Server.app/Contents/ServerRoot/usr/sbin/
+        declare PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/lib/mariadb/bin/:/Applications/Server.app/Contents/ServerRoot/usr/sbin/
         '.$command.'
         EOF';
     $result = shell_exec($exec_command);
@@ -119,7 +119,8 @@ function INSTALL_GETCOMMANDS($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADMIN_USERNAME_
  $cmd[]['rsh']=' pmset autorestart 1'; //automatyczny restart po awarii zasilania
  $cmd[]['rsh']='/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw '.substr($ADMIN_USERNAME_PASSWD,0,6).' -restart -agent -privs -all'; //wlaczenie vnc z haslem 6 liter hasla glownego
  $cmd[]['rsh']='/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -configure -users '.$ADMIN_USERNAME.' -allowAccessFor -specifiedUsers  -configure -restart -agent -privs -all'; //dostep do remote desktop dla glownego admina
-
+ $cmd[]['rsh']='grep "alias SE" /etc/bashrc || echo "alias SE=\'cd /Library/Server/Web/Data/Sites/Default/SE\'" >> /etc/bashrc || echo OK';
+ $cmd[]['rsh']='defaults write /Library/Preferences/com.apple.screensaver loginWindowIdleTime 0 || echo OK';
 
 // @2014-08 firewall konfiguracja dla OSX anchora org.procesy5 \'$'\n - newline if you want to use in sed in MAC
 //dodanie anchorow do filtrowania
@@ -605,7 +606,7 @@ function INSTALL_GETCOMMANDS_XSL_ENGINES($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADM
 }
 
 function INSTALL_GETCOMMANDS_COMP_PORT($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADMIN_USERNAME_PASSWD,$SERVER_MOUNT_POINT_ROOT,$SERVER_ADDRESS,$SERVER_ADDRESS_LDAP_DC,$SERVER_ADDRESS_SHORT,$INSTALL_ROOT,$REMOTE_FOLDER_ROOT,$ADMIN_USERNAME_L1,$ADMIN_USERNAME_L1_PASS,$ADMIN_USERNAME_DIRECTORY,$ADMIN_USERNAME_INITIAL_PASSWD,$BACKUP_USB_DEVICE,$SERVER_VERSION) {
-//komendy do stworzenia komponentu dot MYSQL
+//komendy do stworzenia komponentu dot MARIADB
  $cmd[]['rsh']='cat /etc/sudoers |grep "'.$ADMIN_USERNAME.' ALL = NOPASSWD: /usr/bin/su" || echo "'.$ADMIN_USERNAME.' ALL = NOPASSWD: /usr/bin/su
  " >> /etc/sudoers;
  cat /etc/sudoers |grep "'.$ADMIN_USERNAME.' ALL = NOPASSWD: /usr/bin/su"';
@@ -642,7 +643,7 @@ $cmd[]['rsh']='which mysqldump || exit 0 &&   echo "select 1+1;" | mysql -h127.0
 //ewentualna proba upgrejdowania instniejacego portu
 
 
-//TO MOVE TO INSTALL_GETCOMMANDS_COMP_PORT_MYSQL
+//TO MOVE TO INSTALL_GETCOMMANDS_COMP_PORT_MARIADB
 if($SERVER_VERSION=='10.9Maverick') $cmd[]['rsh']="gcc 2>&1 |grep 'no input files' || echo 'You should install console-tools manually in server  - type in console gcc'";
 //@2014-10 really needed??? if($SERVER_VERSION=='10.8MountainLion') $cmd[]['scp']=array('/Library/Server/Web/Data/Sites/Default/SE/se-dev-pl/stuff/xcode462_cltools_10_86938259a.dmg','/tmp/xcode462_cltools_10_86938259a.dmg');
 //@2014-10 really needed??? if($SERVER_VERSION=='10.8MountainLion') $cmd[]['rsh']='hdiutil mount /tmp/xcode462_cltools_10_86938259a.dmg -mountpoint /Volumes/xcodetools';
@@ -676,7 +677,7 @@ if($SERVER_VERSION=='10.9Maverick') $cmd[]['rsh']="gcc 2>&1 |grep 'no input file
 
 
  $cmd[]['rsh']='xcode-select --install && '.tell_user_gui_error('zainstaluj komponenty XCODE i ponow instalacje').' && exit 1 || echo PASSED'; //@2015-11-01 - TODO do wytestowania a.binder
- $cmd[]['rsh']='mysql_ver=`port installed active 2>/dev/null|grep mysql55-server|awk "{print $2}"|cut -d "." -f 3|cut -d "_" -f 1`; if [ -z "${mysql_ver}" ]; then echo PASSED; else [ ${mysql_ver} -lt 48 ] && '.tell_user_gui_error('Dokonaj ręcznej aktualizacji bazy mysql zgodnie z krokiem procesu 5390 i ponów instalację.').' && exit 1 || echo PASSED; fi';
+ $cmd[]['rsh']='mysql_ver=`port installed active 2>/dev/null|grep mariadb-server|awk "{print $2}"|cut -d "." -f 3|cut -d "_" -f 1`; if [ -z "${mysql_ver}" ]; then echo PASSED; else [ ${mysql_ver} -lt 48 ] && '.tell_user_gui_error('Dokonaj ręcznej aktualizacji bazy mysql zgodnie z krokiem procesu 5390 i ponów instalację.').' && exit 1 || echo PASSED; fi';
  $cmd[]['rsh']='port selfupdate || echo OK ';
  $cmd[]['rsh']='port upgrade outdated || echo "Nothing to upgrade"';
  $cmd[]['rsh']='port selfupdate';
@@ -725,13 +726,13 @@ $cmd[]['rsh']='serveradmin stop web && serveradmin start web';
 
 
 //@2015-10-25 bindera: problemy po upgrade portow z niedzialajacym mysql - skip-networking- wykonanie instrukcji czyszczacych ten problem
-	$cmd[]['rsh']='cat /opt/local/etc/mysql55/macports-default.cnf |grep "skip-networking" |grep -v "#" && (
-	sed -i.bak "s/skip-networking/#skip-networking/"  /opt/local/etc/mysql55/macports-default.cnf
+	$cmd[]['rsh']="cat /opt/local/etc/mariadb/my.cnf |grep '^!include /opt/local/etc/mariadb/macports-default.cnf' && (
+	sed -i.bak '!include /opt/local/etc/mariadb/macports-default.cnf/#!include /opt/local/etc/mariadb/macports-default.cnf/'  /opt/local/etc/mariadb/my.cnf
 	killall mysqld
-	) || echo OK';
+	) || echo OK";
 
 
-//EOF TO MOVE TO INSTALL_GETCOMMANDS_COMP_PORT_MYSQL
+//EOF TO MOVE TO INSTALL_GETCOMMANDS_COMP_PORT_MARIADB
  $cmd[]['rsh']='cat /etc/paths |grep "/opt/local/bin" || echo "/opt/local/bin" >>/etc/paths';
  $cmd[]['rsh']=' grep "/opt/local/bin" /etc/paths || echo "/opt/local/bin" >>/etc/paths'; //dodanie do sciezek
  $cmd[]['rsh']=" sed  -i.bak  \"s/PS1='\\\\\h:/PS1='\\\\\H:/g\" /etc/bashrc"; //zmiana wyswietlania kurosra hosta
@@ -1126,19 +1127,20 @@ return $cmd;
 
 
 
-function INSTALL_GETCOMMANDS_MYSQL55($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADMIN_USERNAME_PASSWD,$SERVER_MOUNT_POINT_ROOT,$SERVER_ADDRESS,$SERVER_ADDRESS_LDAP_DC,$SERVER_ADDRESS_SHORT,$INSTALL_ROOT,$REMOTE_FOLDER_ROOT,$ADMIN_USERNAME_L1,$ADMIN_USERNAME_L1_PASS,$ADMIN_USERNAME_DIRECTORY,$ADMIN_USERNAME_INITIAL_PASSWD,$BACKUP_USB_DEVICE,$SERVER_VERSION) {
+function INSTALL_GETCOMMANDS_MARIADB($ADMIN_USERNAME,$SERVER_ADDRESS_IP,$ADMIN_USERNAME_PASSWD,$SERVER_MOUNT_POINT_ROOT,$SERVER_ADDRESS,$SERVER_ADDRESS_LDAP_DC,$SERVER_ADDRESS_SHORT,$INSTALL_ROOT,$REMOTE_FOLDER_ROOT,$ADMIN_USERNAME_L1,$ADMIN_USERNAME_L1_PASS,$ADMIN_USERNAME_DIRECTORY,$ADMIN_USERNAME_INITIAL_PASSWD,$BACKUP_USB_DEVICE,$SERVER_VERSION) {
 
-//! MYSQL SERVER INSTALACJA
- $cmd[]['rsh']='port -N install mysql55-server';
- $cmd[]['rsh']='sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db';
- $cmd[]['rsh']='sed -i.bak "s/<key>Disabled<\/key>/<key>Enabled<\/key>/"  /Library/LaunchDaemons/org.macports.mysql55-server.plist'; //zmieniam inita do launchctl aby sam z siebie sie odpalal
+//! MARIADB SERVER INSTALACJA
+ $cmd[]['rsh']='port installed 2 >/dev/null | grep "mysql.*server" && { '.tell_user_gui_error("Wykryto zainstalowany MySQL. Wymagany ręczne upgrade do MariaDB. Instalacja przerwana.").'; exit 1; }';
+ $cmd[]['rsh']='port -N install mariadb-server';
+ $cmd[]['rsh']='sudo -u _mysql /opt/local/lib/mariadb/bin/mysql_install_db';
+ $cmd[]['rsh']='sed -i.bak "s/<key>Disabled<\/key>/<key>Enabled<\/key>/"  /Library/LaunchDaemons/org.macports.mariadb-server.plist'; //zmieniam inita do launchctl aby sam z siebie sie odpalal
  $cmd[]['rsh']='echo "[client]
 default-character-set = latin2
 
 [mysql]
 #default-character-set = latin2
 
-[mysqld]
+[mariadb]
 log-error=/var/log/mysql.log
 #default-character-set = utf8
 collation-server = latin2_general_ci
@@ -1146,23 +1148,23 @@ init-connect=\'SET NAMES  latin2\'
 character-set-server =  latin2
 max_allowed_packet = 600M
 " > /etc/my.cnf';
- $cmd[]['rsh']='cat /opt/local/etc/mysql55/macports-default.cnf |grep "skip-networking" |grep -v "#" && sed -i.bak "s/skip-networking/#skip-networking/"  /opt/local/etc/mysql55/macports-default.cnf || echo OK';
+ $cmd[]['rsh']="cat /opt/local/etc/mariadb/my.cnf | grep '^!include /opt/local/etc/mariadb/macports-default.cnf' && sed -i.bak '!include /opt/local/etc/mariadb/macports-default.cnf/#!include /opt/local/etc/mariadb/macports-default.cnf/'  /opt/local/etc/mariadb/my.cnf || echo OK";
 //@2014-09-13 - to jest niepewne i raczej niedziala z LOWER CASE TABLES!
-//$cmd[]['rsh']='cat /opt/local/etc/mysql55/my.cnf | grep "lower_case_table_names = 0" || echo "
+//$cmd[]['rsh']='cat /opt/local/etc/mariadb/my.cnf | grep "lower_case_table_names = 0" || echo "
 // [mysqld]
 // lower_case_table_names = 0"  >> /opt/local/etc/mysql55/my.cnf';
- $cmd[]['rsh']='mkdir -p /opt/local/var/run/mysql5/';
- $cmd[]['rsh']='launchctl load -w /Library/LaunchDaemons/org.macports.mysql55-server.plist';
- $cmd[]['rsh']='echo "/opt/local/lib/mysql55/bin" >>/etc/paths';
+// $cmd[]['rsh']='mkdir -p /opt/local/var/run/mysql5/';
+ $cmd[]['rsh']='launchctl load -w /Library/LaunchDaemons/org.macports.mariadb-server.plist';
+ $cmd[]['rsh']='grep "mariadb" /etc/paths || echo "/opt/local/lib/mariadb/bin" >>/etc/paths';
  //@2013-10-03 tu jest bug : - recznie wyzwolona ta sama komenda ruszyła, a skrypt zwrócił error  - sprawdzam z zamiana wykrzyknikow w hasle!
- $cmd[]['rsh']='sleep 10 && mysql -h127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' -e \'select 1+1;\' || /opt/local/lib/mysql55/bin/mysqladmin password \''.$ADMIN_USERNAME_PASSWD.'\' ';
- $cmd[]['rsh']='[ -d /var/mysql ] || {
-  mkdir -p /var/mysql && [ -e /var/mysql/mysql.sock ] || ln -s /opt/local/var/run/mysql55/mysqld.sock /var/mysql/mysql.sock
-  }';
+ $cmd[]['rsh']='sleep 10 && mysql -h127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' -e \'select 1+1;\' || /opt/local/lib/mariadb/bin/mysqladmin password \''.$ADMIN_USERNAME_PASSWD.'\' ';
+// $cmd[]['rsh']='[ -d /var/mysql ] || {
+//  mkdir -p /var/mysql && [ -e /var/mysql/mysql.sock ] || ln -s /opt/local/var/run/mariadb/mysqld.sock /var/mysql/mysql.sock
+//  }';
 
 
- $cmd[]['rsh']='/opt/local/lib/mysql55/bin/mysql -h127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' -e "SET PASSWORD FOR \'root\'@\'localhost\' = PASSWORD(\''.$ADMIN_USERNAME_PASSWD.'\')" ';  //@2015-02-28 problem dlugosci hasla - musi byc tak ustawione
-//! MYSQL SERVER INSTALACJA EOF
+ $cmd[]['rsh']='/opt/local/lib/mariadb/bin/mysql -h127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' -e "SET PASSWORD FOR \'root\'@\'localhost\' = PASSWORD(\''.$ADMIN_USERNAME_PASSWD.'\')" ';  //@2015-02-28 problem dlugosci hasla - musi byc tak ustawione
+//! MARIADB SERVER INSTALACJA EOF
 
 
 
@@ -2065,7 +2067,7 @@ database=\"SES_USERS2\"
 
  //! inicjalizacja bazy SQIX_STRUCTURE_DB_SYNC
   $cmd[]['scp_root']=array(''.$INSTALL_ROOT.'/config/.config_base_structure_dump.sql','/Library/Server/Web/Data/Sites/Default/SE/config/');   //todo do przeniesienia wyzej - struktura musi byc wygenerowana
-  $cmd[]['rsh']='/opt/local/lib/mysql55/bin/mysql -h127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' '.$REMOTE_FOLDER_ROOT.' < /Library/Server/Web/Data/Sites/Default/SE/config/.config_base_structure_dump.sql'; //TODO powinno byc osobne miejsce do bazy i struktur bo kasuje to baze zamiast aktualizacji!
+  $cmd[]['rsh']='/opt/local/lib/mariadb/bin/mysql -h127.0.0.1 -uroot -p\''.$ADMIN_USERNAME_PASSWD.'\' '.$REMOTE_FOLDER_ROOT.' < /Library/Server/Web/Data/Sites/Default/SE/config/.config_base_structure_dump.sql'; //TODO powinno byc osobne miejsce do bazy i struktur bo kasuje to baze zamiast aktualizacji!
 
 // TODO @2014-06-16 sprawdzic dodawanie struktur DB_STRUCTURES_CREATE - czy jest potrzebne - imho TAK
  $cmd[]['rsh']='php -r"include(\'/Library/Server/Web/Data/Sites/Default/SE/superedit-DB_PROCEDURES_CREATE.php\') ; DB_PROCEDURES_CREATE(); " '.$SERVER_ADDRESS.' ';
@@ -2344,7 +2346,7 @@ function MakeCommand($command_id,$command,$installer_tmp,$installer_dir) {
 	return $ins_sh;
 }
 
-function encodePhpFiles($installer_dir, $domains = "", $domainEncodePhpFiles = []) {
+function encodePhpFiles($installer_dir, $domains = "", $domainEncodePhpFiles = [], $noEncodePhpFiles = []) {
     if (empty($installer_dir)) throw new Exception("Install path not found");
     if ($domainEncodePhpFiles and (!$domains)) throw new Exception("Domains not definied");
 
@@ -2361,16 +2363,20 @@ function encodePhpFiles($installer_dir, $domains = "", $domainEncodePhpFiles = [
     }, $out);
 
     $domainEncodePhpFiles = array_filter($allPhpFiles, function ($phpFilePath) use ($domainEncodePhpFiles) {
-        foreach ($domainEncodePhpFiles as $file) {
-            if (preg_match("|^[[:digit:]]+/" . str_replace('.', '\.', $file) . "$|", $phpFilePath)) return true;
-        }
-        return false;
+        preg_match('/^[[:digit:]]+\/(.*)$/', $phpFilePath, $matches);
+        if (!$matches || empty($matches[1])) throw new Exception("Błąd ścieżki pliku {$phpFilePath}");
+        $phpFilePath = $matches[1];
+        return (in_array($phpFilePath, $domainEncodePhpFiles));
     });
+    DEBUG_S(-3,'domainEncodePhpFiles',$domainEncodePhpFiles,__FILE__,__FUNCTION__,__LINE__);
 
-    $freeEncodePhpFiles = array_filter($allPhpFiles, function ($phpFilePath) use ($domainEncodePhpFiles) {
+    $freeEncodePhpFiles = array_filter($allPhpFiles, function ($phpFilePath) use ($domainEncodePhpFiles, $noEncodePhpFiles) {
+        preg_match('/^[[:digit:]]+\/(.*)$/', $phpFilePath, $matches);
+        if (!$matches || empty($matches[1])) throw new Exception("Błąd ścieżki pliku {$phpFilePath}");
+        $phpFilePath = $matches[1];
         if ('se-lib/Vendor/' === substr($phpFilePath, 0, strlen('se-lib/Vendor/'))) return false; // SKIP se-lib/Vendor/*
         if ('.ini.php' === substr($phpFilePath, -1 * strlen('.ini.php'))) return false; // SKIP *.ini.php
-        return (!in_array($phpFilePath, $domainEncodePhpFiles));
+        return (!in_array($phpFilePath, array_merge($domainEncodePhpFiles, $noEncodePhpFiles)));
     });
     DEBUG_S(-3,'freeEncodePhpFiles',$freeEncodePhpFiles,__FILE__,__FUNCTION__,__LINE__);
 //    if (empty($freeEncodePhpFiles)) throw new Exception("No php files to encode");
@@ -2428,7 +2434,7 @@ function MAKE_PKG_COMPONENT($h,$installer_dir_tar,$installer_url,$installer_tmp,
     mkdir($installer_dir."/install.executed_ok",0777);
 
     echo "<br> I mkdir ".$installer_dir;
-    $ins_sh="#!/bin/sh \nshopt -s dotglob\n  echo 'instaluje i robie LS' >>/tmp/loginst \n ls >>/tmp/loginst \n declare PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/lib/mysql55/bin/:/Applications/Server.app/Contents/ServerRoot/usr/sbin/\n \n";
+    $ins_sh="#!/bin/sh \nshopt -s dotglob\n  echo 'instaluje i robie LS' >>/tmp/loginst \n ls >>/tmp/loginst \n declare PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/lib/mariadb/bin/:/Applications/Server.app/Contents/ServerRoot/usr/sbin/\n \n";
     foreach($cmd as $command_id=>$command) {
         if(isset($command['rsh'])) {
             //$exec=SSH_COMMAND_REMOTE_CREATE($h->ADMIN_USERNAME,$h->SERVER_ADDRESS_IP,$h->ADMIN_USERNAME_PASSWD,$command['rsh']);
@@ -2593,7 +2599,10 @@ function MAKE_PKG_COMPONENT($h,$installer_dir_tar,$installer_url,$installer_tmp,
                 'wfs-qgis.php',
                 'wfs.php',
             ];
-            if (!encodePhpFiles($installer_dir, $domains, $domainEncodePhpFiles)) {
+            $noEncodePhpFiles = [
+                '.config_base_structure.php',
+            ];
+            if (!encodePhpFiles($installer_dir, $domains, $domainEncodePhpFiles, $noEncodePhpFiles)) {
                 DEBUG_S(-3, "No php files found to encode", [], __FILE__,__FUNCTION__,__LINE__);
             }
         } catch (Exception $e) {
@@ -2919,15 +2928,15 @@ function INSTALL_SES_PROCESY_A() {
                 $packages['pl.procesy5.INSTALL_GETCOMMANDS_XSL_ENGINES']['xml_choice']['description']='(install and update) Needed tools tools like saxon ';
                 $packages['pl.procesy5.INSTALL_GETCOMMANDS_XSL_ENGINES']['xml_choice']['start_selected']='true';
 
-		//! pakiet: INSTALL_GETCOMMANDS_MYSQL55
-		$packages['pl.procesy5.MYSQL55']['exit_file']=str_replace('.', '_', $h->ID.".MYSQL55_".$h->SERVER_ADDRESS); //czesc nazwy wynikowego pliku .pkg
-		$packages['pl.procesy5.MYSQL55']['installer_dir_name']=$h->ID.".MYSQL55_".$h->SERVER_ADDRESS; //nazwa katalogu w jakim jest przygotowywany pkg
-		$packages['pl.procesy5.MYSQL55']['installer_tmp']="/tmp/pl.procesy5_MYSQL55_".$h->ID.".".$h->SERVER_ADDRESS;  //miejsce do ktorego installer odpakuje wszystko instalator
-		$packages['pl.procesy5.MYSQL55']['CMD_FUNCTION']="INSTALL_GETCOMMANDS_MYSQL55"; //miejsce do ktorego installer odpakuje wszystko instalator
-		$packages['pl.procesy5.MYSQL55']['xml_choice']['visible']='true';
-		$packages['pl.procesy5.MYSQL55']['xml_choice']['title']='(I)Mysql-55';
-		$packages['pl.procesy5.MYSQL55']['xml_choice']['description']='(use for install only) Required Mysql55 database from MacPorts';
-		$packages['pl.procesy5.MYSQL55']['xml_choice']['start_selected']='true';
+		//! pakiet: INSTALL_GETCOMMANDS_MARIADB
+		$packages['pl.procesy5.MARIADB']['exit_file']=str_replace('.', '_', $h->ID.".MARIADB_".$h->SERVER_ADDRESS); //czesc nazwy wynikowego pliku .pkg
+		$packages['pl.procesy5.MARIADB']['installer_dir_name']=$h->ID.".MARIADB_".$h->SERVER_ADDRESS; //nazwa katalogu w jakim jest przygotowywany pkg
+		$packages['pl.procesy5.MARIADB']['installer_tmp']="/tmp/pl.procesy5_MARIADB_".$h->ID.".".$h->SERVER_ADDRESS;  //miejsce do ktorego installer odpakuje wszystko instalator
+		$packages['pl.procesy5.MARIADB']['CMD_FUNCTION']="INSTALL_GETCOMMANDS_MARIADB"; //miejsce do ktorego installer odpakuje wszystko instalator
+		$packages['pl.procesy5.MARIADB']['xml_choice']['visible']='true';
+		$packages['pl.procesy5.MARIADB']['xml_choice']['title']='(I)MariaDB';
+		$packages['pl.procesy5.MARIADB']['xml_choice']['description']='(use for install only) Required MariaDB database from MacPorts';
+		$packages['pl.procesy5.MARIADB']['xml_choice']['start_selected']='true';
 
 		//! pakiet: INSTALL_GETCOMMANDS_POSTGIS
 		$packages['pl.procesy5.POSTGIS']['exit_file']=str_replace('.', '_', $h->ID.".POSTGIS_".$h->SERVER_ADDRESS); //czesc nazwy wynikowego pliku .pkg

+ 6 - 6
SE/superedit-SQIX_STRUCTURE_DB_SYNC.php

@@ -616,7 +616,7 @@ $CONNLOCAL->query('set global max_allowed_packet=1000000000');
 							  }
 						  }
 						  if(!empty($h->ALIAS_ID)) { //wyszukanie struktur dla ALIASOW //Moze sie zapetlic!
-						  DEBUG_S(-3,' Natrafilem na ALIAS_ID wyszukuje jego rodzicow('.$h->ALIAS_ID.')',null,__FILE__,__FUNCTION__,__LINE__);	
+						  DEBUG_S(3,' Natrafilem na ALIAS_ID wyszukuje jego rodzicow('.$h->ALIAS_ID.')',null,__FILE__,__FUNCTION__,__LINE__);	
 						  		  $IMPORT[]=$h->ALIAS_ID;
 								  $x=FIND_CHILDS_OR_PARENTS_OF_FIELD($h->ALIAS_ID,'PARENT',$TABLE,$CONN,$HOW_MANY_RECURRENCES_EXEC,null);
 								  if(!empty($x)) {
@@ -938,7 +938,7 @@ $CONNLOCAL->query('set global max_allowed_packet=1000000000');
 	//		//$db[$id_bazy]=DB::getDB($id_bazy);
 	//		$struct[$id_bazy]=$CONNLOCAL->STRUCTURE_GENERATE($tabele,null,null); //TODO id_bases_try_to_get_struct
 	//	}
-		DEBUG_S(-3,'struct - struktura do exporty',$struct,__FILE__, __FUNCTION__, __LINE__);
+		DEBUG_S(3,'struct - struktura do exporty',$struct,__FILE__, __FUNCTION__, __LINE__);
 
 	//		die('smierc');
 		
@@ -1045,7 +1045,7 @@ $CONNLOCAL->query('set global max_allowed_packet=1000000000');
 					//print_r($config_base_structure_unserialized['CRM_AUTH_PROFILE']);
 					if($SYNC_OPTIONS=='SYNC_ZASOBY_STRUCTURES_FROM_CONFIG_WITHOUT_PROCEDURES_AND_VIEWS') $SKIP_OPTIONS=array('SKIP-PROCEDURE','SKIP-VIEW');
 					
-					DEBUG_S(-3,'SKIP_OPTIONS,config_base_structure_unserialized',array($SKIP_OPTIONS,$config_base_structure_unserialized),__FILE__, __FUNCTION__, __LINE__) ;
+					DEBUG_S(5,'SKIP_OPTIONS,config_base_structure_unserialized',array($SKIP_OPTIONS,$config_base_structure_unserialized),__FILE__, __FUNCTION__, __LINE__) ;
 					$CONNREMOTE->STRUCTURE_GENERATE_PARSE($config_base_structure_unserialized,$SKIP_OPTIONS); //@2014-08-14 TEST IT
 
 					
@@ -1695,7 +1695,7 @@ $CONNLOCAL->query('set global max_allowed_packet=1000000000');
 					} else { //jest numer zasobu lecimy po tabelach
 					//wyszukujemy jakie numery tabel sa w strukturze w bazie
 					$sql="select `ID`,`PARENT_ID`,`TYPE`,`DESC`,`A_STATUS` from `CRM_LISTA_ZASOBOW` where `PARENT_ID`='".$DATABASE_ROOT_ZASOB_ID."' and `TYPE`='TABELA'  ";
-					DEBUG_S(-3,'SQL 389',$sql,__FILE__, __FUNCTION__, __LINE__);
+					DEBUG_S(3,'SQL 389',$sql,__FILE__, __FUNCTION__, __LINE__);
 					$result=$CONNREMOTE->query($sql);
 
 						while($h=mysql_fetch_object($result)) {
@@ -2331,11 +2331,11 @@ $CONNLOCAL->query('set global max_allowed_packet=1000000000');
 							foreach($to_move as $mv) {
 								echo "<hr> ".$h->DESC." (".$h->ID_GROUP.")";
 				   				$sql="update CRM_LISTA_ZASOBOW set PARENT_ID='".$dest_move."' where PARENT_ID='".$mv."' ";
-				   	   			DEBUG_S(-3,'aktualizuje PARENT_ID',array($sql,$mv,$h),__FILE__,__FUNCTION__,__LINE__);
+				   	   			DEBUG_S(3,'aktualizuje PARENT_ID',array($sql,$mv,$h),__FILE__,__FUNCTION__,__LINE__);
 				   	   			if(!empty($CONFIRM_SQL_UPDATE)) $CONNREMOTE->query($sql) or die1(' Problem ze sql '.$sql);
 							
 								$sql="update CRM_LISTA_ZASOBOW set ALIAS_ID='".$dest_move."' where ALIAS_ID='".$mv."' ";
-				   	   			DEBUG_S(-3,'aktualizuje PARENT_ID',array($sql,$mv,$h),__FILE__,__FUNCTION__,__LINE__);
+				   	   			DEBUG_S(3,'aktualizuje PARENT_ID',array($sql,$mv,$h),__FILE__,__FUNCTION__,__LINE__);
 				   	   			if(!empty($CONFIRM_SQL_UPDATE)) $CONNREMOTE->query($sql) or die1(' Problem ze sql '.$sql);