Bläddra i källkod

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

Piotr Labudda 8 år sedan
förälder
incheckning
131741fb49

+ 78 - 7
SE/schema/WPS_Functions/build_WPS_Functions.xml

@@ -8,17 +8,33 @@
   
     <!-- parent properties -->
     <property name="build_root.xml" location="${basedir}/build.xml"/>
-    <property name="build_properties" location="${basedir}/build_properties" />
+    <property name="build_properties" location="${basedir}/.build_properties" />
   
     <!-- modules WPS_Functions - to be copied to any module needed -->
     <property name="WPS_Functions" location="${basedir}/WPS_Functions"/>
-    <property name="build_WPS_Functions.xml" location="${WPS_Functions}/build_WPS_Functions.xml"/> <!-- call it to get properties -->
-    <property name="build_WPS_Functions.xml.properties" location="${build_WPS_Functions.xml}.properties"/>
+    <property name="WPS_Functions.temp" location="${WPS_Functions}/temp"/>
+    <property name="WPS_Functions.childproperties" location="${WPS_Functions}/.build_WPS_Functions.childproperties"/>
+    <property name="WPS_Functions.childproperties.builds.xml" location="${WPS_Functions.childproperties}/WPS_Functions.builds.xml"/>
+    <property name="build_WPS_Functions.childproperties.builds.xml" location="${WPS_Functions.temp}/build_WPS_Functions.childproperties.builds.xml"/><property name="build_WPS_Functions.xml" location="${WPS_Functions}/build_WPS_Functions.xml"/> <!-- call it to get properties -->
+    <property name="build_WPS_Functions.xsl" location="${WPS_Functions}/build_WPS_Functions.xsl"/>
     <!-- eof modules WPS_Functions  -->
   
   <!-- modules properties copied / controlled references -->
     
-    <property name="object_modeling_basedir" location="${basedir}/WPS_Functions/object_modeling"  />
+    <property name="build_WPS_Functions.xml.properties" location="${WPS_Functions}/.build_WPS_Functions.xml.properties"/>
+    
+    <!-- eof modules WPS_Functions  -->
+  
+    
+  
+  
+  
+    <!-- TODO combinated object combinate_objects_for_instance_prototypes.xsl  -->
+    <property  name="combinate_objects_for_instance_prototypes.xsl" location="${basedir}/default_db_xml_cache/combinate_objects_for_instance_prototypes.xsl"/>
+    
+    
+    <!-- modules properties copied / controlled references -->
+    <property name="object_install_se_ant_object" location="${basedir}/WPS_Functions/object_install_se_ant_object/build_object_install_se_ant_object.xml"/><property name="object_modeling_basedir" location="${basedir}/WPS_Functions/object_modeling"  />
     <property name="object_modeling_build" location="${object_modeling_basedir}/build_object_modeling.xml"  />
     <property name="object_modeling_new_basedir" location="${basedir}/WPS_Functions/object_modeling_new"  />
     <property name="object_modeling_by_default_db_xml_schema_basedir" location="${basedir}/WPS_Functions/object_modeling_by_default_db_xml_schema"  />
@@ -37,7 +53,8 @@
     <property name="get_wfs_basedir.temp" location="${get_wfs_basedir}/temp"/>
     <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/><!-- to ordinary retrieve wfs data  -->
     
-    <property  name="object_modeling_new.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling_new.xsl"/>
+    <property name="object_modeling_build_infrastructure" location="${basedir}/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml"/>
+    <property name="object_modeling_new" location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml"/><property  name="object_modeling_new.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling_new.xsl"/>
     <property  name="object_modeling.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling.xsl"/>
     <property name="object_modeling_new_by_xml_schema.xsl" value="${basedir}/default_db_xml_cache.public/object_modeling_new_by_xml_schema.xsl"/>
     
@@ -73,7 +90,53 @@
     
     
   
-    <target name="save_build_properties" > <!-- todo nie wiem czy trzymac properties tu i tam - do optymalziacji-->
+    <property name="get_wfs_recurse_xsl.xsl" location="${basedir}/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl"/>
+    
+    <!-- EOF modules properties copied / controlled references -->
+    
+    
+ 
+    
+   <!-- <property name="wfs_output.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
+    <property name="wfs_result.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_result.xml"/>
+    <property name="wfs_error.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_error.xml"/>
+    <property name="wfs_timestamp.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_timestamp.xml"/>
+    -->
+    
+    <target name="create_tempdir">
+        <mkdir dir="${WPS_Functions.childproperties}"/>
+        <mkdir dir="${WPS_Functions.temp}"/>
+    </target>
+    
+    
+    <target name="read_build_properties.childproperties" depends="create_tempdir, save_build_properties,read_WPS_Functions.childproperties.builds" description="To read child modules installed properties">
+        <concat destfile="${build_WPS_Functions.xml.properties}" fixlastline="true" overwrite="yes">
+            <fileset dir="${WPS_Functions.childproperties}" includes="*.properties"/>
+        </concat>
+        <!--<property file="${build_WPS_Functions.xml.properties}"/>-->
+    </target>
+    
+    <target name="read_WPS_Functions.childproperties.builds" depends="create_tempdir" description="Read installed modules builds to exec them in write_child_props_to_config_dir">
+        <fileset id="dist.contents" dir="${WPS_Functions}"   includes="**/build*.xml" > <!-- includes="**/build*.xml"  -->
+            <exclude name="**/temp/**"/>
+            <exclude name="**/recurse_cache/**"/>
+            <exclude name="**/build_WPS_Functions.xml/**"/>
+        </fileset>           
+        <property name="prop.dist.contents" refid="dist.contents"/>
+        <echoxml file="${WPS_Functions.childproperties.builds.xml}"><WPS_Functions.childproperties.builds>${prop.dist.contents}</WPS_Functions.childproperties.builds></echoxml>
+        
+        <!--<ant antfile="...file..." inheritall="yes" inheritrefs="yes" target="write_child_props_to_config_dir"/>-->
+        <xslt basedir="${WPS_Functions.temp}" style="${build_WPS_Functions.xsl}" in="${WPS_Functions.childproperties.builds.xml}"  destdir="${WPS_Functions.temp}" out="${build_WPS_Functions.childproperties.builds.xml}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="RelatedFeatureRoot"/>-->
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="WPS_Functions" expression="${WPS_Functions}"/>
+        </xslt>
+        <ant antfile="${build_WPS_Functions.childproperties.builds.xml}" inheritall="yes" inheritrefs="yes"/>
+        
+    </target><target name="save_build_properties" > <!-- todo nie wiem czy trzymac properties tu i tam - do optymalziacji-->
         <!-- ${uuid} -->
         <ant antfile="${build_root.xml}"  target="save_build_properties"/>
         <loadproperties srcfile="${build_properties}"/>
@@ -91,4 +154,12 @@
     </target>
   
   
-</project>
+<target name="clean" description="to clean modules dependent temporary files and its outputs">
+        <ant antfile="${default_db:recurse_ant}" target="clean"/>
+        <ant antfile="${get_wfs}" target="clean"/>
+        <ant antfile="${build_CRM_PROCES_tree}" target="clean"/>
+        <ant antfile="${graph_gnuplot}" target="clean"/>
+        <ant antfile="${object_modeling_build_infrastructure}" target="clean"/>
+        <ant antfile="${object_modeling_new}" target="clean"/>
+      
+    </target></project>

+ 26 - 0
SE/schema/WPS_Functions/build_WPS_Functions.xsl

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="WPS_Functions" required="yes"/>
+    
+    
+    <xsl:template match="WPS_Functions.childproperties.builds">
+        <project basedir="." name="WPS_Functions.childproperties.builds" default="WPS_Functions.childproperties.builds">
+            <description>
+                Generated ant by xsl from childproperties modules, to be run modules in mode to let they give their properties and dependencies
+            </description>
+            <target name="WPS_Functions.childproperties.builds">
+                <xsl:for-each select="tokenize(.,';')">
+                    <echo>Running <xsl:value-of select="."/></echo>
+                    <ant antfile="{$WPS_Functions}/{.}" inheritall="yes" inheritrefs="yes" target="write_child_props_to_config_dir"/>
+                </xsl:for-each>
+            </target>
+        </project>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 8 - 1
SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml

@@ -17,6 +17,7 @@
     <property name="CRM_PROCES_tree_basedir" location="${basedir}/WPS_Functions/default_db/CRM_PROCES_tree"  />                         
     <property name="CRM_PROCES_tree_basedir.temp" location="${CRM_PROCES_tree_basedir}/temp"  />
     
+    <property name="build_CRM_PROCES_tree.childproperties" location="${WPS_Functions.childproperties}/build_CRM_PROCES_tree.properties"/>
     <property name="set_parallel_java_process_max_aviable" value="40"/> <!-- override property for  -->
     
     <!-- eof local module individual properties -->
@@ -41,7 +42,13 @@
     
     
     
-    <target name="default_db:CRM_PROCES:tree" depends="read_build_properties" description="builds process tree finishing to PROCES_INIT without it ">
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_CRM_PROCES_tree.childproperties}"/>
+    </target>
+    
+    <target name="clean" description="Clean all output and temp files">
+        <delete dir="${CRM_PROCES_tree_basedir.temp}" failonerror="false"/>
+    </target><target name="default_db:CRM_PROCES:tree" depends="read_build_properties" description="builds process tree finishing to PROCES_INIT without it ">
         <ant antfile="${default_db:recurse_ant}"  target="clean_temp_dir">
             <property name="uuid" value="CRM_PROCES_tree"/>
         </ant>

+ 6 - 1
SE/schema/WPS_Functions/default_db/check_java_process_count/build_check_java_process_count.xml

@@ -8,6 +8,7 @@
     <property name="build_WPS_Functions.xml" location="${WPS_Functions}/build_WPS_Functions.xml"/> <!-- call it to get properties -->
     <property name="build_WPS_Functions.xml.properties" location="${build_WPS_Functions.xml}.properties"/>
     
+    <property name="build_check_java_process_count.childproperties" location="${WPS_Functions.childproperties}/build_check_java_process_count.properties"/>
     <property name="build_check_java_process_count.xml"  value="${WPS_Functions}/default_db/check_java_process_count/build_check_java_process_count.xml"/>
     
     <property name="parallel_java_process_max" value="20" />
@@ -20,7 +21,11 @@
     <!-- eof modules WPS_Functions  -->
   
   
-    <target  name="check_java_process_count" >
+    <target name="write_child_props_to_config_dir">
+        <echoproperties destfile="${builds_to_ant_set_parallel_java_process_max.childproperties}"/>
+    </target>
+
+     <target  name="check_java_process_count" >
         <exec executable="bash" dir="." outputproperty="check_java_process_count" >
             <arg  value="-c" />
             <arg value="ps ax|grep ant |grep -v grep |wc -l |tr -d [:blank:]"/>

+ 60 - 2
SE/schema/WPS_Functions/default_db/recurse_ant/build_recurse_ant.xml

@@ -113,6 +113,11 @@
     
     <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
     
+    <target name="write_child_props_to_config_dir" depends="install_folders">
+        <!--<echoproperties destfile="${build_recurse_ant.childproperties}"/>-->
+        <echo> TODO #120 - module is to be updated to provide properties - he dont know where is WPS_Functions - to fix. Bypassed properties</echo>
+    </target>
+
     <target name="uuid_cond">
         <condition property="uuid_set" taskname="uuid_check">
             <or>
@@ -459,7 +464,7 @@
         <property name="build_recurse_ant_xsl_xpath_filter.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_xsl_xpath_filter.xsl"/>
         <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <property name="build_recurse_ant_cache_control.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_cache_control.xsl"/>
-        
+        <property name="get_wfs_recurse_xsl.xsl" value="${default_db_xml_cache.public}/get_wfs_recurse_xsl.xsl"/>
     </target>
     
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
@@ -472,6 +477,7 @@
         <property name="build_recurse_ant_xsl_xpath_filter.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_xsl_xpath_filter.xsl"/>
         <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <property name="build_recurse_ant_cache_control.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_cache_control.xsl"/>
+        <property name="get_wfs_recurse_xsl.xsl" value="${default_db_xml_cache.public}/get_wfs_recurse_xsl.xsl"/>
     </target>
     
     
@@ -503,7 +509,11 @@
         </xslt>-->
     </target>
    
-   
+    <target name="clean" description="Clean all output and temp files">
+        <antcall target="clean_temp_dir"/>
+        <delete dir="${out}" failonerror="false"/>
+    </target>
+
     <target name="clean_temp_dir" description="URL_TASK Wyczyść cache modułu ">
         <!--<delete includeemptydirs="yes" failonerror="false">
             <fileset dir="${default_db:recurse_ant_basedir.temp}"/>
@@ -819,6 +829,54 @@
     </target>   
      
     
+    <target name="buildpdf_recursed_xsl" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,set_dita"  description="retrieve and build object from api using just XSL calls - needed username and password">
+        
+        
+        <echo>#836 will try to in $main_build_recurse_ant.dita_with_id ${main_build_recurse_ant.dita_with_id}</echo>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${get_wfs_recurse_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${main_build_recurse_ant.dita_with_id}" > <!-- out_task.dita.final -->
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <!--<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>-->
+                <attribute name="http://saxon.sf.net/feature/initialTemplate" value="main"/>
+            </factory>
+            
+            <classpath location="/opt/local/share/java/saxon.jar"/>
+            <!--<classpath location="/opt/local/share/java/saxon9he.jar"/>-->
+            <!--<param name="webRootUrl" expression="${webRootUrl}" />--> 
+            <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
+            <param name="uuid" expression="${uuid_tested}"/>
+            <param name="username.pass" expression="${Password}"/>
+            <!--<param name="basedir" expression="${basedir}"/>-->
+            <param name="temp" expression="${temp}"/>
+            <param name="simpleSchema_dir" expression="${simpleSchema_dir}"/>
+        </xslt>
+        
+        
+        <!--<ant antfile="${build_CRM_PROCES_tree}" target="default_db:PROCES_INIT:tree:dita" inheritall="false">
+            <property name="uuid" value="${uuid}"/>
+            <property name="default_db:recurse_ant_basedir.out" value="${default_db:recurse_ant_basedir}/out"/>
+        </ant>-->
+        
+        <!--<exec executable="${dita.dir}" dir=".">
+            <arg value="-i"/>
+            <arg value="${CRM_PROCES_tree_basedir.temp}/${uuid}/${uuid}.ditamap" />
+            <!-\- <arg value="-t" />
+            <arg value="temp" />-\->
+            <arg value="-f" />
+            <arg value="pdf"/>
+            <arg value="-o"/>
+            <arg value="${out}"/>
+        </exec>-->
+        
+        <echo message="OUTPUT__START"/>
+        <!--<echo>
+            &lt;br&gt;Wygenerowano wyjsciowy plik XML - sciagnij go &lt;a href=&quot;${webRootUrl}/${out_task.dita.final_with_RelatedFeatureLoop_no_path}.xml&quot; target=&quot;_blank&quot;&gt; &quot;${webRootUrl}/${out_task.dita.final_with_RelatedFeatureLoop_no_path}.xml&lt;/a&gt;&lt;/br&gt; 
+        </echo>-->
+        <echo>
+            &lt;br&gt;# Wygenerowano wyjsciowy plik PDF - sciagnij go &lt;a href=&quot;${webRootUrl}/${out}/${uuid}.pdf&quot; target=&quot;_blank&quot;&gt; &quot;${webRootUrl}/${out}/${uuid}.pdf&lt;/a&gt;&lt;/br&gt; 
+        </echo>
+        <echo message="OUTPUT__END"/>
+    </target>
+
     <target name="buildpdf_recursed_html5" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,passwordBase64Basic_check,php_session_id_check,check_dita" if="${test_if_dita}" description="URL_TASK Pobierz Wersję HTML">
         <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
         <exec executable="${dita.dir}" dir=".">

+ 9 - 0
SE/schema/WPS_Functions/get_wfs/build_get_wfs.xml

@@ -28,6 +28,7 @@
     <property name="get_wfs_basedir" location="${basedir}/WPS_Functions/get_wfs"/><!-- to ordinary retrieve wfs data  -->
     <property name="get_wfs_basedir.temp" location="${get_wfs_basedir}/temp"/>
     <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/><!-- to ordinary retrieve wfs data  -->
+    <property name="build_get_wfs.childproperties" location="${WPS_Functions.childproperties}/build_get_wfs.properties"/>
     <property name="uuid" value="${uuid}"/>
     
     <property name="wfs_output.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
@@ -50,6 +51,10 @@
     <property name="webRootUrl" value="${webRootUrl}"/>
 
 
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_get_wfs.childproperties}"/>
+    </target>
+
     <target name="read_build_properties" >
         <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
         <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
@@ -58,6 +63,10 @@
         </echo>
     </target>
 
+    <target name="clean" description="Clean all output and temp files">
+        <delete dir="${get_wfs_basedir.temp}" failonerror="false"/>
+    </target>
+    
     <target name="http_first_input">
         <echo message="FETCHING '${url}' ..."/>
         <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">

+ 5 - 0
SE/schema/WPS_Functions/mapserver_gml_to_png/build_mapserver_gml_to_png.xml

@@ -16,6 +16,7 @@
     <!-- eof shared local module individual properties -->
     
     <!-- local individual module properties -->
+    <property name="build_mapserver_gml_to_png.childproperties" location="${WPS_Functions.childproperties}/build_mapserver_gml_to_png.properties"/>
     <property name="genpng2.sh" location="${mapserver_gml_to_png_basedir}/map/genpng2.sh"/>
     <property name="shp2img" value="/opt/local/bin/shp2img"/>
     <!--<property name="PATH_ADD" value="/opt/local/bin:/usr/bin:/bin"/>-->
@@ -35,6 +36,10 @@
         <mkdir dir="${mapserver_gml_to_png_basedir.temp}"/>
     </target>
     
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_mapserver_gml_to_png.childproperties}"/>
+    </target>
+
     <target name="read_build_properties" depends="mapserver_gml_to_png:create_tempdir">
         <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
         <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>

+ 5 - 0
SE/schema/WPS_Functions/object_modeling/build_object_modeling.xml

@@ -13,6 +13,7 @@
     
     <property name="object_modeling_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
     
+    <property name="build_object_modeling.childproperties" location="${WPS_Functions.childproperties}/build_object_modeling.properties"/>
     <property name="public_html" location="${basedir}" />
     <property name="root_build.xml" location="${public_html}/build.xml"/>
     <!--<property name="build_properties.xml" location="${public_html}/build_properties.xml" />-->
@@ -26,6 +27,10 @@
     <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
     <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
     -->
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_object_modeling.childproperties}"/>
+    </target>
+
     <target name="read_build_properties">
        <!-- <ant antfile="${root_build.xml}" target="save_build_properties"/>
         <loadproperties srcfile="${build_properties}"/>-->

+ 11 - 1
SE/schema/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml

@@ -13,9 +13,11 @@
     <!-- eof modules WPS_Functions  -->
     
     
-    <property name="object_modeling_build_infrastructure_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
+    <property name="object_modeling_build_infrastructure" location="${basedir}/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml"/>
+    <property name="object_modeling_build_infrastructure_basedir" location="${basedir}/WPS_Functions/object_modeling_build_infrastructure"  />
     <property name="object_modeling_build_infrastructure_basedir.temp" location="${object_modeling_build_infrastructure_basedir}/temp"  />
     
+    <property name="build_object_modeling_build_infrastructure.childproperties" location="${WPS_Functions.childproperties}/build_object_modeling_build_infrastructure.properties"/>
     <property name="public_html" location="${basedir}" />
     <property name="root_build.xml" location="${public_html}/build.xml"/>
     <!--<property name="build_properties.xml" location="${public_html}/build_properties.xml" />-->
@@ -30,6 +32,10 @@
     <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
     <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
     -->
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_object_modeling_build_infrastructure.childproperties}"/>
+    </target>
+
     <target name="read_build_properties">
         <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
         <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
@@ -39,6 +45,10 @@
     </target>
     
     
+    <target name="clean" description="Clean all output and temp files">
+        <delete dir="${object_modeling_build_infrastructure_basedir.temp}" failonerror="false"/>
+    </target>
+    
     <target name="system_cache__appinfo:object_modeling_build_infrastructure" depends="read_build_properties" description="ANT_TARGET new object by using prototype from Types" >
         <ant antfile="${root_build.xml}" target="procesy5_system_schema.xml_if_not_exists" /> 
         <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>

+ 7 - 1
SE/schema/WPS_Functions/object_modeling_by_default_db_xml_schema/build_object_modeling_by_default_db_xml_schema.xml

@@ -19,7 +19,9 @@
     
     
     
-    <target name="read_build_properties">
+    <property name="build_object_modeling_by_default_db_xml_schema.childproperties" location="${WPS_Functions.childproperties}/build_object_modeling_by_default_db_xml_schema.properties"/>
+    
+<target name="read_build_properties">
         <!--<ant antfile="${root_build.xml}" target="save_build_properties.xml"/>-->
         <!--<ant antfile="${root_build.xml}" target="read_build_properties.xml"/>-->
         <!--<loadproperties srcfile="${build_properties.xml}"  />-->
@@ -29,6 +31,10 @@
     </target>
     
     
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_object_modeling_by_default_db_xml_schema.childproperties}"/>
+    </target>
+
     <target name="system_cache__appinfo:default_db_get_xml_schema_if_not_exists_check" depends="read_build_properties">
         <condition property="default_db_get_xml_schema_if_not_exists_check" taskname="system_cache__appinfo:default_db_get_xml_schema_if_not_exists">
             <available file="${default_db.xml}"/>

+ 33 - 8
SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.xml

@@ -12,6 +12,7 @@
     <property name="build_WPS_Functions.xml.properties" location="${build_WPS_Functions.xml}.properties"/>
     <!-- eof modules WPS_Functions  -->
     
+    <property name="object_modeling_new" location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml"/>
     <property name="object_modeling_new_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />                         
     <property name="object_modeling_new_basedir_repository" location="${basedir}/WPS_Functions/${ant.project.name}/object_modeling_new_repository"  />
     <property name="object_modeling_new_basedir_temp" location="${object_modeling_new_basedir}/temp"  />
@@ -32,7 +33,25 @@
     <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
     -->
     
-    <target name="system_cache__appinfo:object_modeling_new_create_dirs">
+    <property name="build_object_modeling_new.childproperties" location="${WPS_Functions.childproperties}/build_object_modeling_new.properties"/>
+    
+    <!--<property name="public_html" location="${basedir}" />-->
+    <!--<property name="root_build.xml" location="${public_html}/build.xml"/>-->
+    <!--<property name="build_properties.xml" location="${public_html}/build_properties.xml" />-->
+    
+    <!--<property  name="object_modeling_new.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling_new.xsl"/>-->
+    <!--<property name="build_properties" location="${basedir}/build_properties" />-->
+    
+    
+   <!-- <property name="table.local" location="${public_html}/table"/>
+    
+    <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
+    <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
+    -->
+    
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_object_modeling_new.childproperties}"/>
+    </target><target name="system_cache__appinfo:object_modeling_new_create_dirs">
         <mkdir dir="${object_modeling_new_basedir_temp}"/>
     </target>
     
@@ -49,6 +68,11 @@
     
     
     
+    <target name="clean" description="Clean all output and temp files">
+        <delete dir="${object_modeling_new_basedir_temp}" failonerror="false"/>
+        <delete dir="${object_modeling_new_basedir_repository}" failonerror="false"/>
+    </target>
+    
     <target  name="system_cache__appinfo:object_modeling_new_check_condition">
         <!--<input addproperty="prototype_object_namespace" defaultvalue="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd" />--> <!-- https://biuro.biall-net.pl/wfs/default_db/Types/Infrastructure.xsd -->
         <input addproperty="TargetNamespaceBindingsApi" defaultvalue="https://biuro.biall-net.pl/wfs"/> <!-- root namespace API -->
@@ -123,9 +147,10 @@
         <fail/>
     </target>
     
-    <target name="system_cache__appinfo:object_modeling_new" depends="system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="ANT_TARGET new object by using prototype from Types to local repository to model it further" >
+    <target name="system_cache__appinfo:object_modeling_new" depends="read_build_properties,system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="ANT_TARGET new object by using prototype from Types to local repository to model it further" >
         <input addproperty="prototype_object_namespace" defaultvalue="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd" />
         <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists" />
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
         <echo> object_modeling_new_repository= ${object_modeling_new_repository}
             procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
             generating from ${prototype_object_namespace}
@@ -199,8 +224,8 @@
             <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
             <param name="NamespaceObjectInstanceType" value="table"/>
         </antcall>-->
-        <antcall target="system_cache__appinfo:object_modeling_new">
-            <param name="NamespaceObjectInstanceTable" value="DEALS_TABLE"/>
+        <antcall target="system_cache__appinfo:object_modeling_new_by_xml_schema">
+            <param name="NamespaceObjectInstanceTable" value="BI_audit_KRS_person"/>
             <param name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
             <param name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
             <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
@@ -211,7 +236,7 @@
     
     
     
-    <target  name="system_cache__appinfo:object_modeling_new_add_new_table"  depends="system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="TODO Create new schema (empty table - not working currently)">
+    <target  name="system_cache__appinfo:object_modeling_new_add_new_table"  depends="read_build_properties,system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="TODO Create new schema (empty table - not working currently)">
         <input addproperty="TargetNamespaceBindingsApi" defaultvalue="https://biuro.biall-net.pl/wfs"/> <!-- root namespace API -->
         <input addproperty="NamespaceDatabaseStorageDefinitionPrefix" defaultvalue="default_db"/>
         <input addproperty="NamespaceObjectInstanceType" defaultvalue="table"/>
@@ -244,15 +269,15 @@
     </target>
     
     
-    <target  name="system_cache__appinfo:object_modeling_new_by_xml_schema"  depends="system_cache__appinfo:object_modeling_new" description="TODO Create new schema based on default_db.xml(xsd) + prototype">
+    <target  name="system_cache__appinfo:object_modeling_new_by_xml_schema" depends="read_build_properties,system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check"   description="TESTING Create new schema based on default_db.xml(xsd) + prototype">
         <input addproperty="prototype_object_namespace" defaultvalue="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd" />
         <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists" />
-        <echo> object_modeling_new_repository= ${object_modeling_new_repository}
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/><echo> object_modeling_new_repository= ${object_modeling_new_repository}
             procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
             generating from ${prototype_object_namespace}
             generating to ${new_object_namespace}
         </echo>
-        <xslt basedir="./" style="${object_modeling_new.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${new_object_by_prototype_result.xml}" >
+        <xslt basedir="./" style="${object_modeling_new_by_xml_schema.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${new_object_by_prototype_result.xml}" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
                 <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}object_modeling_new_by_xml_schema"/>

+ 302 - 9
SE/se-lib/Route/UrlAction/BiAuditGenerate.php

@@ -305,8 +305,8 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
           </tr>
 <?php
 			}
+		}
 ?>
-          </tr>
         </tbody>
       </table>
     </div>
@@ -342,11 +342,10 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
       </div>
     </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)
-       </div>
-    </div>
+      <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)
+      </div>
     </div>
     <div class="form-group">
       <div class="col-sm-12">
@@ -360,9 +359,7 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
     <input type="hidden" name="prID[]" value="<?=$pracownik['ID']?>">
   </form>
 </div>
-
 <?php
-		}
 	}
 
 	private function powiazania() {
@@ -400,6 +397,294 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
 		}
 	}
 
+	private function importKrsToPracownicy() {
+		$action = V::get('action', '', $_POST);
+		switch ($action) {
+			case "search":
+				$this->importKrsToPracownicySearch();
+				break;
+			default: $this->importKrsToPracownicyForm();
+		}
+	}
+
+	private function importKrsToPracownicyForm() {
+?>
+<div class="container" style="margin-top:20px">
+  <legend>
+    Importowanie osób z KRS do tabeli pracowników
+  </legend>
+  <div class="form-group">
+    <div class="col-sm-12">
+      <h4>Znajdź podmiot</h4>
+    </div>
+  </div>
+  <form class="form-horizontal" method="post">
+    <div class="form-group">
+      <label class="col-sm-1 control-label">Nazwa</label>
+      <div class="col-sm-4">
+        <input type="text" class="form-control" name="nazwa" title="Podaj nazwę podmiotu">
+      </div>
+    </div>
+    <div class="form-group">
+      <label class="col-sm-1 control-label">KRS</label>
+      <div class="col-sm-2">
+	<input type="text" class="form-control" name="krs" pattern="^[0-9]{0,10}$" title="Podaj KRS"/>
+      </div>
+    </div>
+    <div class="form-group">
+      <label class="col-sm-1 control-label">NIP</label>
+      <div class="col-sm-2">
+        <input type="text" class="form-control" name="nip" pattern="^[0-9]{0,10}$" title="Podaj NIP (bez kresek i bez oznaczenia kraju)"/>
+      </div>
+    </div>
+    <div class="form-group">
+      <label class="col-sm-1 control-label">Regon</label>
+      <div class="col-sm-2">
+        <input type="text" class="form-control" name="regon" pattern="^[0-9]{0,9}$" title="Podaj regon"/>
+      </div>
+    </div>
+    <div class="form-group">
+      <div class="col-sm-offset-1 col-sm-11">
+        <button type="submit" class="btn btn-primary" name="action" value="search">Szukaj</button>
+      </div>
+    </div>
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
+  </form>
+</div>
+<?php
+	}
+
+	private function importKrsToPracownicySearch() {
+		try {
+			$subaction = V::get('subaction', '', $_POST);
+			switch ($subaction) {
+				case "listKrsPerson":
+					$krsId = V::get('krsId', 0, $_POST, int);
+					break;
+				case "addKrsPersonToPracownicy":
+					$personId = V::get('personId', [], $_POST);
+					if (!$personId) throw new Exception("Błąd formularza");
+					$query = "insert into BI_audit_ENERGA_PRACOWNICY (source, imiona, nazwisko, pesel) select 'KRS', imiona, nazwisko, pesel from BI_audit_KRS_person where ID in (" . implode(", ", $personId) . ")";
+					DB::getPDO()->query($query);
+					SE_Layout::alert('success', "Pomyślnie zaimportowano " . count($personId) . " pracownik" . ((count($personId) == 1) ? "a" : "ów"));
+					$this->importKrsToPracownicyForm();
+					return;
+				default:
+					$krsId = null;
+			}
+
+			if ($krsId) {
+				$where = ["ID = '{$krsId}'"];
+			} else {
+				$items = [
+					"nazwa" => 'like',
+					"krs" => '=',
+					"nip" => '=',
+					"regon" => '=',
+				];
+				$form = [];
+				foreach ($items as $item => $type) {
+					if ($param = V::get($item, '', $_POST)) {
+						if ($type == 'like') $param = "%{$param}%";
+						$form[$item] = DB::getPDO()->quote($param);
+					}
+				}
+				if (!$form) throw new Exception("Nie wypełniono żadnego pola wyszukiwania!");
+
+				$where = [];
+				foreach ($form as $name => $value) $where[] = "`{$name}` {$items[$name]} {$value}";
+			}
+		} catch (Exception $e) {
+			SE_Layout::alert('danger', $e->getMessage());
+			$this->importKrsToPracownicyForm();
+			return;
+		}
+
+		$query = "select * from `BI_audit_KRS` where " . implode(" and ", $where) . "order by ID limit 1001";
+		$result = DB::getPDO()->fetchAll($query);
+		if (count($result) == 1001) {
+			SE_Layout::alert('danger', 'Znaleziono zbyt wiele wyników. Doprecyzuj parametry wyszukiwania.');
+			$this->importKrsToPracownicyForm();
+			return;
+		} elseif (count($result) == 1) {
+			$krsId = $result[0]['ID'];
+		}
+?>
+<div class="container" style="margin-top:20px">
+  <form method="post">
+    <legend>
+      Importowanie osób z KRS do tabeli pracowników
+    </legend>
+    <div class="form-group">
+      <div class="col-sm-12">
+        <h4>Znalezione podmioty:</h4>
+      </div>
+    </div>
+    <div class="form-group">
+      <div class="col-sm-12">
+        <table class="table table-bordered table-hover table-striped" height=5>
+          <thead>
+            <tr style="text-align:center; background-color:lightgray">
+              <td width=1>Lp.</td>
+              <td>Nazwa</td>
+              <td>Adres</td>
+              <td>KRS</td>
+              <td>NIP</td>
+              <td>Regon</td>
+<?php
+		if (count($result) > 1) {
+?>
+              <td width=1>Wybierz</td>
+<?php
+		}
+?>
+            </tr>
+          </thead>
+          <tbody>
+
+<?php
+		if (!$result) echo '<tr><td align="center" colspan="7">Nie znaleziono podmiotu</td></tr>';
+		else {
+			$lp = 1;
+			foreach ($result as $row) {
+				$adres = $row['A_miejscowosc'];
+				if ($row['A_ulica']) $adres .= ", {$row['A_ulica']}";
+				if ($row['A_nrDomu']) {
+					$adres .= " {$row['A_nrDomu']}";
+					if ($row['A_nrLokalu']) $adres .= "/{$row['A_nrLokalu']}";
+				}
+?>
+            <tr>
+              <td align="right"><?=$lp++?></td>
+              <td><?=$row['nazwa']?></td>
+              <td><?=$adres?></td>
+              <td><?=$row['krs']?></td>
+              <td><?=$row['nip']?></td>
+              <td><?=$row['regon']?></td>
+<?php
+		if (count($result) > 1) {
+?>
+              <td align="center">
+               <input type="radio" name="krsId" value="<?=$row['ID']?>"/>
+             </td>
+<?php
+		}
+?>
+            </tr>
+<?php
+			}
+		}
+?>
+          </tbody>
+        </table>
+      </div>
+    </div>
+<?php
+		if (count($result) > 1) {
+?>
+    <div class="form-group">
+      <div class="col-sm-12">
+<?php
+			foreach (array_keys($items) as $item) {
+?>
+        <input type="hidden" name="<?=$item?>" value="<?=V::get($item, '', $_POST)?>"/>
+<?php
+			}
+?>
+        <div class="containter" style="text-align:center">
+          <button type="submit" class="btn btn-primary" name="subaction" value="listKrsPerson">Znajdź osoby powiązane z podmiotem</button>
+          <a href="" class="btn btn-default">Powrót</a>
+        </div>
+      </div>
+    </div>
+<?php
+		} elseif ($krsId) {
+?>
+    <div class="form-group">
+      <div class="col-sm-12">
+        <h4>Znalezione osoby:</h4>
+      </div>
+    </div>
+    <div class="form-group">
+      <div class="col-sm-12">
+        <table class="table table-bordered table-hover table-striped" height=5>
+          <thead>
+            <tr style="text-align:center; background-color:lightgray">
+              <td width=1>Lp.</td>
+              <td>Nazwisko</td>
+              <td>Imiona</td>
+              <td>Pesel</td>
+              <td width=1><input type="checkbox" name="checkAll" onClick="toggleAll(this)"/></td>
+            </tr>
+          </thead>
+          <tbody>
+
+<?php
+			$refKrsToKrsPerson = ACL::getRefTable('default_db/BI_audit_KRS/BI_audit_KRS', "default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person");
+			$query = "select person.*, pracownicy.ID as pracownicyId from `{$refKrsToKrsPerson}` ref join `BI_audit_KRS_person` person on ref.REMOTE_PRIMARY_KEY = person.ID left join BI_audit_ENERGA_PRACOWNICY pracownicy on person.pesel = pracownicy.pesel where ref.PRIMARY_KEY = '{$krsId}'";
+			$result = DB::getPDO()->fetchAll($query);
+			if (!$result) echo '<tr><td align="center" colspan="5">Nie znaleziono osób powiązanych z podmiotem</td></tr>';
+			else {
+				$lp = 1;
+				foreach ($result as $row) {
+?>
+            <tr<?=($row['pracownicyId'] ? ' style="color:darkgrey"' : '')?>>
+              <td align="right"><?=$lp++?></td>
+              <td><?=$row['nazwisko']?></td>
+              <td><?=$row['imiona']?></td>
+              <td><?=$row['pesel']?></td>
+              <td><input type="checkbox" name="personId[]" value="<?=$row['ID']?>" onClick="toggle(this)" <?=($row['pracownicyId'] ? "disabled" : "")?>/></td>
+            </tr>
+<?php
+				}
+			}
+?>
+          </tbody>
+        </table>
+        <div class="containter" style="text-align:center">
+          <button type="submit" class="btn btn-primary" name="subaction" value="addKrsPersonToPracownicy" onClick="return validate(this)">Dodaj zaznaczone osoby do tabeli pracowników</button>
+          <a href="" class="btn btn-default">Powrót</a>
+        </div>
+      </div>
+    </div>
+<?php
+		}
+?>
+    <input type="hidden" name="action" value="search">
+  </form>
+</div>
+<script language="JavaScript">
+<!--
+function toggleAll(source) {
+  checkboxes = document.getElementsByName('personId[]');
+  checked = false;
+  for(var i=0, n=checkboxes.length;i<n;i++) {
+    if (!checkboxes[i].disabled) {
+      checkboxes[i].checked = source.checked;
+      checked = true;
+    }
+  }
+  if (source.checked && (!checked)) source.checked = false;
+}
+function toggle(source) {
+  checkboxes = document.getElementsByName('personId[]');
+  all = true;
+  for(var i=0, n=checkboxes.length;i<n;i++) if(!checkboxes[i].disabled && checkboxes[i].checked == false) all = false;
+  source.form['checkAll'].checked = all;
+}
+function validate(source) {
+  checkboxes = document.getElementsByName('personId[]');
+  checked = false;
+  for(var i=0, n=checkboxes.length;i<n;i++) if(checkboxes[i].checked) checked = true;
+  if (!checked) alert('Nie wybrano żadnej osoby!');
+  return checked;
+}
+-->
+</script>
+<?php
+
+	}
+
 	public function defaultAction() {
 		SE_Layout::gora();
 		SE_Layout::menu();
@@ -414,7 +699,15 @@ where `REMOTE_PRIMARY_KEY` = '{$this->SOURCE['ID']}'";
 			$this->SOURCE['ID'] = $ID;
 			$this->powiazania();
 		}
-		else SE_Layout::alert('danger','Błąd parametru');
+		elseif ($TABLE = V::get('_fromNamespace', '', $_GET)) {
+			switch ($TABLE) {
+				case "default_db/BI_audit_ENERGA_PRACOWNICY":
+					$this->importKrsToPracownicy();
+					break;
+				default: SE_Layout::alert('danger', 'Błąd parametru');
+			}
+		}
+		else SE_Layout::alert('danger', 'Błąd parametru');
 		SE_Layout::dol();
 	}