Przeglądaj źródła

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

Piotr Labudda 8 lat temu
rodzic
commit
a2280c1619

+ 1 - 1
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/IN7_MK_BAZA_DYSTRYBUCJI.dita

@@ -15,7 +15,7 @@
     
     <p><ph>ID</ph><ph xpath="ID"/></p>
     <p><ph>Opis</ph><ph xpath="M_DIST_DESC"/></p>
-    <p><ph>Firma</ph><ph xpath="M_DISTRIBUTOR"/></p>
+    <p><ph>Firma</ph><ph xpath="M_DISTRIBUTOR"/><ph> kontakt:</ph><ph xpath="M_DISTRIBUTOR_CONTACT"/><ph> adres:</ph><ph xpath="M_DISTRIBUTOR_ADDRESS"/></p>
     <p><ph>Notatki</ph><ph xpath="L_APPOITMENT_INFO"/><ph> </ph> <ph xpath="L_APPOITMENT_DATE"/></p>
     <RelatedFeature xpath="ADM_ACCOUNT" xpath_value="../L_APPOITMENT_USER" typeName="p5_default_db:ADMIN_USERS"><!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
       <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_b2r_ldr_cz_ref_spr">

+ 5 - 14
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build_recurse_ant.xml

@@ -533,20 +533,12 @@
     </target>
     
     
-    <target name="build_recurse_ant_xsl_xpath_filter.xsl_check" description="if it is set $xpath_query ">
-        <!--<exec  executable="bash" dir="." outputproperty="typeName_tested_name"> 
-            <arg value="-c"/>
-            <arg value="echo ${typeName_tested} |sed 's/.*://'"/><!-\- tu wchodzi -DtypeName=p5_default_db:CRM_PROCES  -\->
-        </exec>-->
-        <!--<echo> #537 debug  $typeName_tested_name: ${typeName_tested_name}</echo>-->
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl_check" description="if it is set ">
         <condition taskname="build_recurse_ant_xsl_xpath_filter.xsl" property="xpath_query_set">
-            <!--<and>-->
-                <or>
-                    <equals arg1="${xpath_query}" arg2=""/>
-                    <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
-                </or>
-                <!--<available file="${simpleSchema_dir}/${namespace_prefix_p5_tr_map}/${typeName_tested_name}.xml"/>--> 
-            <!--</and>-->
+            <or>
+                <equals arg1="${xpath_query}" arg2=""/>
+                <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
+            </or>
         </condition>
         <antcall target="build_recurse_ant_xsl_xpath_filter.xsl_fail"/> <!-- if failed run or not if not -->
     </target>
@@ -576,7 +568,6 @@
             </factory>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <param name="xpath_query" expression="${xpath_query}"/>
-            <param name="typeName" expression="${typeName}"/>
             <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
         </xslt>
     </target>

+ 1 - 0
SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl

@@ -47,6 +47,7 @@
     <xsl:template mode="build_element_complexType.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="'${build_complexType.xsl}'"/>
             <xsl:attribute name="in" select="'${empty.xml}'"/>

+ 14 - 14
SE/schema/default_db_xml_cache.public/build_recurse_ant.xsl

@@ -79,7 +79,7 @@
     <xsl:param name="process_locks"/>
     <xsl:param name="get_wfs" required="yes"/>
     <xsl:param name="debug_xsl_out_filename" required="yes" />  
-    <xsl:param name="debug" select="6"/>
+    <xsl:param name="debug" select="1"/>
     <!--<xsl:variable name="temp_current">
         <xsl:choose>
             <xsl:when test="$temp='temp'">
@@ -389,10 +389,10 @@
                             </xsl:element>
                         </condition>
                     </target>
-                    <delete>
+                    <delete quiet="true">
                         <xsl:attribute name="file" select="concat('${',$temp,'-',$wfs_output.xml,'__test_featureID_name_dita.xml',$feature_pos_parent,$feature_pos,'}')"/>
                     </delete>
-                    <delete>
+                    <delete quiet="true">
                         <xsl:attribute name="file" select="concat('${',$temp,'-',$wfs_output.xml,'__test_featureID_name_dita_out.xml',$feature_pos_parent,$feature_pos,'}')"/>
                     </delete>
                     <target name="get_related_feature_run_child_ant_if{$loop_xpath_real}" depends="get_related_feature_run_child_ant_check{$loop_xpath_real}">
@@ -480,7 +480,7 @@
                             <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max_loadfile_xsl',$loop_path_recurs,$loop_xpath_real)"/>
                             <xsl:attribute name="srcfile" select="concat('${builds_to_ant_set_parallel_java_process_max_xsl',$loop_path_recurs,$loop_xpath_real,'}')"/>
                         </loadfile>
-                        <delete>
+                        <delete quiet="true">
                             <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max_xsl',$loop_path_recurs,$loop_xpath_real,'}')"/>
                         </delete>
                         <parallel>
@@ -516,7 +516,7 @@
                     <!-- task do polaczenia zaglebien -->
                     
                     <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka  -->
-                    <delete>
+                    <delete quiet="true">
                         <xsl:attribute name="file" select="concat('${builds_to_ant_lock_proj',$loop_path_recurs,$loop_xpath,'}')"/>
                     </delete>
                 </project>
@@ -936,7 +936,7 @@
                             | $loop_path_recurs = <xsl:value-of select="$loop_path_recurs"/>
                             *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
                         </echo></xsl:if>
-                        <delete>
+                        <delete quiet="true">
                             <xsl:attribute name="file" select="concat('${process_lock_loop',$loop_xpath,'_',$loop_path_recurs,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,$featureID_name_dita,$parallel_pos,'}')"/>
                         </delete>
                          <ant antfile="{$recurse_ant_basedir}/build_recurse_ant.xml" target="xml_recursed_from_tr_map" inheritall="true" />
@@ -1135,16 +1135,16 @@
                 <classpath location="/opt/local/share/java/saxon9he.jar"/>
             </xsl:element>
             <!-- delete tempfiles -->
-            <delete>
+            <delete quiet="true">
                 <xsl:attribute name="file" select="concat('${builds_to_ant__test_query__featureID_name_dita.xml',$loop_path_recurs,$loop_xpath_real,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,'}')"/>
             </delete>
-            <delete>
+            <delete quiet="true">
                 <xsl:attribute name="file" select="concat('${builds_to_ant__test_query__featureID_name_dita_out.xml',$loop_path_recurs,$loop_xpath_real,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,'}')"/>
             </delete>
-            <delete>
+            <delete quiet="true">
                 <xsl:attribute name="file" select="concat('${builds_to_ant.xml',$loop_path_recurs,$loop_xpath_real,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,'}')"/>
             </delete>
-            <delete>
+            <delete quiet="true">
                 <xsl:attribute name="file" select="concat('${builds_to_ant__test_query__featureID_name_dita_out.xml',$loop_path_recurs,$loop_xpath_real,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,'}')"/>
             </delete>
             
@@ -1169,7 +1169,7 @@
                         <xsl:attribute name="value" select="concat('${builds_to_ant_file.xml',$loop_path_recurs,$loop_xpath_real,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,'}')"/>
                     </arg>
             </java>-->
-            <delete>
+            <delete quiet="true">
                 <xsl:attribute name="file" select="concat('${builds_to_ant_file.xml',$loop_path_recurs,$loop_xpath_real,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,'}')"/>
             </delete>
             <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
@@ -1325,7 +1325,7 @@
                 <classpath location="/opt/local/share/java/saxon9he.jar"/>
                 <param name="featureID_name_dita" expression="{$featureID_name_dita}"/>
             </xsl:element>-->
-            <delete>
+            <delete quiet="true">
                 <xsl:attribute name="file" select="concat('${builds_to_ant__test_query__featureID_name_dita.xml',$loop_path_recurs,$loop_xpath,@xml_id,'.',$feature_pos_parent,'.',$feature_pos,$featureID_name_dita,$parallel_pos,'}')"/>
             </delete>
             
@@ -1832,8 +1832,8 @@
         <!-- first assign xpath to features from  -->
             <xsl:variable name="wfs_output_nodes" select="doc($wfs_output)"/>
         <xsl:variable name="current_RelatedFeature" select="*"/>
-        <xsl:variable name="xml_id" select="@xml_id"/>
-        <xsl:variable name="feature_pos_parent" select="@feature_pos"/>
+       <xsl:variable name="xml_id" select="@xml_id"/>
+       <xsl:variable name="feature_pos_parent" select="@feature_pos"/>
         <!--<input_obj_with_xpath_debug>
             <xsl:copy-of select="$wfs_output_nodes"/>
         </input_obj_with_xpath_debug>-->

+ 1 - 1
SE/schema/default_db_xml_cache.public/builds_to_ant.xsl

@@ -366,7 +366,7 @@
                     <echo>
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx #350  FIXING BAD RELATEDLOOP EXECUTION for <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'build_root.xml')"/>
                     </echo>
-                    <delete includeEmptyDirs="true">
+                    <delete includeEmptyDirs="true" quiet="true">
                         <fileset dir="{$temp}/{$loop_xpath}/{.}">
                             <include name="*"/>
                             <exclude name="build_root.xml"/>

+ 9 - 0
SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/CRM_PRZYPADEK.xsl

@@ -11,6 +11,12 @@
             <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='STANOWISKO' and contains(FORM_TREAT,'X')">
                 <p>Stanowisko odpowiedzialne</p>
             </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='URZADZENIE' and contains(FORM_TREAT,'X')">
+                <p>Użyj wskazanego urządzenia</p>
+            </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='WYPOSAZENIE' and contains(FORM_TREAT,'X')">
+                <p>Użyj wskazanego wyposażenia</p>
+            </xsl:when>
             <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='STANOWISKO' and contains(FORM_TREAT,'R')">
                 <p>Stanowisko posiada uprawnienie do kontrolowania procedury</p>
             </xsl:when>
@@ -23,6 +29,9 @@
             <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='KOMORKA' and contains(FORM_TREAT,'C') and contains(FORM_TREAT,'R') ">
                 <p>Wprowadź informację do formularza: (do nowego rekordu) </p>
             </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='KOMORKA' and contains(FORM_TREAT,'R') and contains(FORM_TREAT,'X') ">
+                <p>Wprowadź informację do formularza w miejscu filtra: (w celu wyszukania oczekiwanej wartości w tym polu) </p>
+            </xsl:when>
             <xsl:otherwise>
                 <p>Wprowadz inforamcję: (<xsl:value-of select="FORM_TREAT"/>)</p>
             </xsl:otherwise>

+ 96 - 23
SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/PROCES_INIT_tree_to_dita.xsl

@@ -16,6 +16,7 @@
     
     
     <xsl:param name="PROCES_INIT_tree.ditamap" select="'PROCES_INIT_tree.ditamap'"/> <!-- file behind will be created dita files -->
+    <xsl:param name="TargetNamespaceBindings" select="'https://biuro.biall-net.pl'"/>
    <!-- <xsl:param name="temp" required="yes"/>
     <xsl:param name="uuid" required="yes"/>-->
     
@@ -41,7 +42,7 @@
         
     
     
-    <xsl:template match="CRM_IMAGE_CRM_PROCES" mode="postprocess_images">
+    <xsl:template match="CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_LISTA_ZASOBOW" mode="postprocess_images">
         <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
         <base64_to_image srcfile="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" dstfile="{$temp}/{$uuid}/{ID}_image.{$ext}" />
     </xsl:template>
@@ -59,7 +60,7 @@
         <xsl:apply-templates mode="#current"/>
     </xsl:template>-->
     
-    <xsl:template match="PROCES_TREE|PROCES_INIT" mode="ditamap_root">
+    <xsl:template match="PROCES_TREE|PROCES_INIT|PROCES_GROUP_1|PROCES_GROUP_2" mode="ditamap_root">
         <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:map.xsd">
             <title>
@@ -125,7 +126,26 @@
                 <image href="{ID}_image.{$ext}" width="{WIDTH}"></image>
             </xsl:otherwise>
         </xsl:choose>
-        
+    </xsl:template>
+    
+    <xsl:template match="IF_TRUE_GOTO" mode="example">
+        <xsl:variable name="text" select="text()"/>
+        <xsl:choose>
+            <xsl:when test="text() = '0'"/>
+            <xsl:otherwise>                
+                <xsl:choose>
+                    <xsl:when test="//PROCES_INIT[ID/text()= $text]"><note>Wyzwala procedurę: <xref href="{text()}_topic.dita"/></note></xsl:when>
+                    <xsl:when test="//PROCES[ID/text()= $text]"><note>Odniesienie do kroku: <xref href="#task_{text()}" format="dita"/></note></xsl:when>
+                    <xsl:otherwise>
+                        <note>Wyzwala do procedurę <xsl:value-of select="$text"/> (niewidoczna w tym opracowaniu)
+                            <xref
+                                href="{$TargetNamespaceBindings}/SE/version-git/procesy5.php?task=PROCES_VIEW_LIST&amp;HIDE_PANEL=1&amp;id_proces={text()}"
+                                format="html" scope="external"/>
+                        </note>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
     </xsl:template>
     
     <xsl:template match="*|text()|comment()" mode="example"/>
@@ -153,14 +173,23 @@
                 <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
                 <!--<xsl:value-of select="DESC"/>-->
             </title>
-            <shortdesc><!--<xsl:value-of select="OPIS"/>-->
+            <!--<shortdesc><!-\-<xsl:value-of select="OPIS"/>-\->
                 <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
-                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                    <!-\-<xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="OPIS"/>
+                    </xsl:call-template>-\->
+                    <xsl:call-template name="escaped_html_to_xml_and_surrounded_enter">
+                        <xsl:with-param name="enter_surround_to" select="'p'"/>
                         <xsl:with-param name="html" select="OPIS"/>
                     </xsl:call-template>
+                   
+                    <xsl:apply-templates mode="enter_to_ph" select="OPIS">
+                        <xsl:with-param name="element" select="'bodydiv'"/>
+                        <xsl:with-param name="count" select="2"/>
+                    </xsl:apply-templates>
                 </xsl:variable>
                 <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
-            </shortdesc>
+            </shortdesc>-->
             <prolog>
                 <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/> w <xsl:value-of select="A_RECORD_CREATE_DATE"/></author>
                 <!--<change-historylist>
@@ -172,16 +201,41 @@
                 </change-historylist>-->
             </prolog>
             <taskbody>
+                
                 <!--<context>
                     <p></p>
                 </context>-->
+                
+                        <example>
+                            <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                                <xsl:call-template name="escaped_html_to_xml_and_surrounded_enter" exclude-result-prefixes="#all">
+                                    <xsl:with-param name="enter_surround_to" select="'p'"/>
+                                    <xsl:with-param name="html" select="OPIS"/>
+                                </xsl:call-template>
+                            </xsl:variable>
+                            <xsl:apply-templates mode="enter_to_ph" select="$system_cache__appinfo:escaped_html_to_xml//text()" exclude-result-prefixes="#all">
+                                <xsl:with-param name="element" select="'bodydiv'"/>
+                                <xsl:with-param name="count" select="1"/>
+                            </xsl:apply-templates>
+                            <xsl:for-each select="//IF_TRUE_GOTO[ text()= current()/ID/text()]">
+                                <note>Procedura wyzwalana z <xref href="{ ancestor::node()[ name()='PROCES_INIT'][1]/ID}_topic.dita#task_{ ../ID}"/></note>
+                            </xsl:for-each>
+                        </example>
+                
+                
                 <xsl:choose>
                     <xsl:when test="CRM_WSKAZNIK">
                         <postreq>zasoby:
-                            <ol>
-                                <li/>
+                            <xsl:variable name="task_resources_info">
                                 <xsl:apply-templates mode="task_resources_info"/>
-                            </ol>
+                            </xsl:variable>
+                            <xsl:choose>
+                                <xsl:when test="$task_resources_info/*">
+                                    <ol>
+                                        <xsl:copy-of select="$task_resources_info"/>
+                                    </ol>
+                                </xsl:when>
+                            </xsl:choose>
                         </postreq>
                     </xsl:when>
                 </xsl:choose>
@@ -237,14 +291,7 @@
                         </xsl:variable>
                         <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
                     </title>
-                    <shortdesc><!--<xsl:value-of select="OPIS"/>-->
-                        <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
-                            <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
-                                <xsl:with-param name="html" select="OPIS"/>
-                            </xsl:call-template>
-                        </xsl:variable>
-                        <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
-                    </shortdesc>
+                    
                     <prolog>
                         <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/></author>
                         <!--<change-historylist>
@@ -257,15 +304,36 @@
                     </prolog>
                     <taskbody>
                             <example>
-                                <xsl:apply-templates mode="example"/>
+                                
+                                <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                                    <xsl:call-template name="escaped_html_to_xml_and_surrounded_enter" exclude-result-prefixes="#all">
+                                        <xsl:with-param name="enter_surround_to" select="'p'"/>
+                                        <xsl:with-param name="html" select="OPIS"/>
+                                    </xsl:call-template>
+                                </xsl:variable>
+                                <xsl:apply-templates mode="enter_to_ph" select="$system_cache__appinfo:escaped_html_to_xml//text()" exclude-result-prefixes="#all">
+                                    <xsl:with-param name="element" select="'bodydiv'"/>
+                                    <xsl:with-param name="count" select="1"/>
+                                </xsl:apply-templates>
+                                <xsl:for-each select="//IF_TRUE_GOTO[ text()= current()/ID/text()]">
+                                    <note>Odwołanie wewnętrzne do procedury wyzwalane z <xref href="{ ancestor::node()[ name()='PROCES_INIT'][1]/ID}_topic.dita#task_{ ../ID}"/></note>
+                                </xsl:for-each>
+                                
+                                <xsl:apply-templates mode="example"/> <!-- obslugije m.in wyzwalane procedury -->
                             </example>
                         <xsl:choose>
                             <xsl:when test="CRM_WSKAZNIK">
+                                <xsl:variable name="task_resources_info">
+                                    <xsl:apply-templates mode="task_resources_info"/>
+                                </xsl:variable>
                                 <postreq>zasoby:
-                                    <ol>
-                                        <li/>
-                                        <xsl:apply-templates mode="task_resources_info"/>
-                                    </ol>
+                                    <xsl:choose>
+                                        <xsl:when test="$task_resources_info/*">
+                                            <ol>
+                                                <xsl:copy-of select="$task_resources_info"/>
+                                            </ol>
+                                        </xsl:when>
+                                    </xsl:choose>
                                 </postreq>
                             </xsl:when>
                         </xsl:choose>
@@ -431,6 +499,7 @@
     
     <xsl:template mode="task_resources_info" match="CRM_LISTA_ZASOBOW">
         <xsl:comment>#432 match="CRM_LISTA_ZASOBOW" mode="task_resources_info" </xsl:comment>
+        <xsl:apply-templates mode="example"/>
                 <xsl:choose>
                     <xsl:when test="TYPE='KOMORKA'">
                         <p>
@@ -441,7 +510,11 @@
                                         <xsl:with-param name="html" select="OPIS[1]"/>
                                     </xsl:call-template>
                                 </xsl:if>
-                                <xsl:if test="not(DESC/text()=DESC_PL/text())"><ph> <xsl:value-of select="DESC_PL"/></ph></xsl:if>
+                                <xsl:if test="not(DESC/text()=DESC_PL/text())"><ph> <!--<xsl:value-of select="DESC_PL"/>-->
+                                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                        <xsl:with-param name="html" select="DESC_PL"/>
+                                         </xsl:call-template>
+                                    </ph></xsl:if>
                             </codeblock>
                         </p>
                     </xsl:when>

+ 1 - 0
SE/schema/default_db_xml_cache.public/default_db/IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI_tree_to_dita.xsl

@@ -166,6 +166,7 @@
                   </p> 
                 <!--</xsl:variable>-->
                 <!--<xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>-->
+                <xsl:apply-templates mode="L_APPOITMENT_USER_body" />
                 <xsl:apply-templates mode="gml_geometry_image" select="."/>
                 <!--<xsl:apply-templates mode="gml_geometry_image" />-->
                 <xsl:apply-templates mode="infrastructure_raport"  select="."/>

+ 47 - 0
SE/schema/default_db_xml_cache.public/default_db/L_APPOITMENT_USER/L_APPOITMENT_USER_tree_to_dita.xsl

@@ -0,0 +1,47 @@
+<?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"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template match="*|text()|comment()" mode="L_APPOITMENT_USER_body"/>
+    
+    <xsl:template match="L_APPOITMENT_USER" mode="L_APPOITMENT_USER_body">
+        <xsl:choose>
+            <xsl:when test="not(*)"/><!-- must have children instead is not expected element -->
+            <xsl:when test="../name()='IN7_MK_BAZA_DYSTRYBUCJI'">
+                <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_L_APPOITMENT_USER_{ID}">
+                    <strow>
+                        <stentry>Referent odpowiedzialny za sprawę</stentry>
+                        <stentry><xsl:value-of select="ADM_NAME"/></stentry>
+                    </strow>
+                    <strow>
+                        <stentry>Kontakty</stentry>
+                        <stentry><ph><xsl:value-of select="tokenize(EMAIL_LOCAL_ACCOUNT_ADDRESS,' ')[1]"/></ph><ph><xsl:value-of select="ADM_PHONE"/></ph></stentry>
+                    </strow>
+                </simpletable>
+                </p>
+            </xsl:when>
+            <xsl:otherwise>
+                <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_L_APPOITMENT_USER_{ID}">
+                    <strow>
+                        <stentry>Osoba odpowiedzialna</stentry>
+                        <stentry><xsl:value-of select="ADM_NAME"/></stentry>
+                    </strow>
+                    <strow>
+                        <stentry>Kontakty</stentry>
+                        <stentry><ph><xsl:value-of select="tokenize(EMAIL_LOCAL_ACCOUNT_ADDRESS,' ')[1]"/></ph><ph><xsl:value-of select="ADM_PHONE"/></ph></stentry>
+                    </strow>
+                </simpletable>
+                </p>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 4 - 0
SE/schema/default_db_xml_cache.public/default_db/enter_to_ph.xsl

@@ -29,6 +29,7 @@
         </xsl:variable>
         <xsl:choose>
             <xsl:when test=" contains(  text(),'&#13;')">
+                <!--<xsl:message>#32 contains <xsl:value-of select="text()"/> 13; and will surround with <xsl:value-of select="$surround_with"/>; </xsl:message>-->
                 <xsl:for-each select="tokenize(  text(),'&#13;')">
                     <xsl:element name="{$surround_with}"><!-- to jest przetwarzane jak jest tekst lamany -->
                         <xsl:value-of select="."/>
@@ -36,6 +37,7 @@
                 </xsl:for-each>
             </xsl:when>
             <xsl:when test=" contains(  text(),'&#xD;')">
+                <!--<xsl:message>#39 contains <xsl:value-of select="text()"/> xD;  and will surround with <xsl:value-of select="$surround_with"/>; </xsl:message>-->
                 <xsl:for-each select="tokenize(  text(),'&#xD;')">
                     <xsl:element name="{$surround_with}"><!-- to jest przetwarzane jak jest tekst lamany -->
                         <xsl:value-of select="."/>
@@ -45,6 +47,7 @@
             <xsl:otherwise>
                 <xsl:choose>
                     <xsl:when test="$count &gt;1">
+                        <!--<xsl:message>#50 codeblock with <xsl:value-of select="text()"/></xsl:message>-->
                         <codeblock>
                             <!--<xsl:attribute name="DDxpath" select="@xpath"/>-->
                             <!--DN(<xsl:value-of select="$element"/>)-->
@@ -53,6 +56,7 @@
                         </codeblock>
                     </xsl:when>
                     <xsl:otherwise>
+                        <xsl:message>#58 otherwise</xsl:message>
                         <xsl:apply-templates mode="enter_to_ph_text">
                             <xsl:with-param name="element" select="$element"/>
                         </xsl:apply-templates>

+ 4 - 1
SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl

@@ -9,12 +9,15 @@
     
     
     <xsl:import href="../escaped_html_to_xml.xsl"/>
-    <xsl:import href="../dita_enter_to_ph.xsl"/>
+    <!--<xsl:import href="../dita_enter_to_ph.xsl"/>-->
+    <xsl:include href="../default_db/enter_to_ph.xsl"/>
+    
     <xsl:include href="extract_text.xsl"/>
     <xsl:include href="images/images.xsl"/>
     
     <xsl:include href="CRM_PROCES/PROCES_INIT_tree_to_dita.xsl"/>
     <xsl:include href="IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI_tree_to_dita.xsl"/>
+    <xsl:include href="L_APPOITMENT_USER/L_APPOITMENT_USER_tree_to_dita.xsl"/>
     
     
     

+ 7 - 2
SE/schema/default_db_xml_cache.public/escaped_html_to_xml.xsl

@@ -74,8 +74,6 @@
                             <gt>
                                 <xsl:attribute name="gtnum" select="position()"/>
                                 <!--<xsl:attribute name="lt_pos" select="$lt_pos"/>-->
-                                
-                                
                                 <xsl:choose>
                                     <xsl:when test="$lt_pos=1 and position()=1">
                                         <xsl:attribute name="tag_place" select="'before_tag'"/>
@@ -238,6 +236,13 @@
                 </xsl:element>
             </xsl:for-each>
         </xsl:for-each>
+        <xsl:choose><!-- warunek xxxx<br>yyyy nie zwraca - daje IFa -->
+            <xsl:when test=" count($anal_num1/anal_num1/gt) = 3 
+                and $anal_num_anal/anal_num_anal/gt[1][ @sum_cur='1' and @pos='1' and @level='0']
+                and $anal_num_anal/anal_num_anal/gt[2][ @sum_cur='2' and @pos='2' and @level='1' and @new_gr='1']
+                and $anal_num_anal/anal_num_anal/gt[3][ @sum_cur='3' and @pos='3' and @level='1']
+                "><xsl:value-of select="' '"/><xsl:value-of select="$anal_num_anal/anal_num_anal/gt[3]/text()"/></xsl:when>
+        </xsl:choose>
     </xsl:template>
     
     

+ 155 - 0
SE/se-lib/EpsgConversion.php

@@ -0,0 +1,155 @@
+<?php
+
+class EpsgConversion {
+
+	private static $fe = 500000;
+
+	private static function CalculateESquared($a, $b) {
+		return (pow($a, 2) - pow($b, 2)) / pow($a, 2);
+	}
+
+	private static function CalculateE2Squared($a, $b) {
+		return (pow($a, 2) - pow($b, 2)) / pow($b, 2);
+	}
+
+	private static function denom ($es, $sphi) {
+		$sinSphi = sin($sphi);
+		return sqrt(1 - $es * pow($sinSphi, 2));
+	}
+
+	private static function sphsr ($a, $es, $sphi) {
+		$dn = self::denom($es, $sphi);
+		return $a * (1 - $es) / pow($dn, 3);
+	}
+
+	private static function sphsn ($a, $es, $sphi) {
+		$sinSphi = sin($sphi);
+		return $a / sqrt(1 - $es * pow($sinSphi, 2));
+	}
+
+	private static function sphtmd ($ap, $bp, $cp, $dp, $ep, $sphi) {
+		return ($ap * $sphi) - ($bp * sin(2 * $sphi)) + ($cp * sin(4 * $sphi)) - ($dp * sin(6 * $sphi)) + ($ep * sin(8 * $sphi));
+	}
+
+	private static function LonLatToPUWG($a, $f, $lon, $lat, $proj) {
+		if ($lon < 13.5 || $lon >= 25.5) throw new Exception("Wrong longitude - {$lon}");
+
+		if ($proj == 1) {
+			$alam = 19 * M_PI / 180;
+			$strf = 0;
+			$nfn = -5300000.0;
+			$ok = 0.9993;
+		} else {
+			$nfn = 0;
+			$olam = floor(($lon + 1.5)/3) * M_PI / 60;
+			$strf = floor(($lon + 1.5)/3) * 1000000;
+			$ok = 0.999923;
+		}
+		
+		$result = new StdClass();
+		$latRad = $lat * M_PI / 180;
+		$lonRad = $lon * M_PI / 180;
+		$recf = 1 / $f;
+		$b = $a * ($recf - 1) / $recf;
+		$eSquared = self::CalculateESquared($a, $b);
+		$e2Squared = self::CalculateE2Squared ($a, $b);
+		$tn = ($a - $b) / ($a + $b);
+		$ap = $a * (1 - $tn + 5 * (pow($tn, 2) - pow($tn, 3)) / 4 + 81 * (pow($tn, 4) - pow($tn, 5)) / 64);
+		$bp = 3 * $a * ($tn - pow($tn, 2) + 7 * (pow($tn, 3) - pow($tn, 4)) / 8 + 55 * pow($tn, 5) / 64) / 2;
+		$cp = 15 * $a * (pow($tn, 2) - pow($tn, 3) + 3 * (pow($tn, 4) - pow($tn, 5)) / 4) / 16;
+		$dp = 35 * $a * (pow($tn, 3) - pow($tn, 4) + 11 * pow($tn, 5) / 16) / 48;
+		$ep = 315 * $a * (pow($tn, 4) - pow($tn, 5)) / 512;
+		$dlam = $lonRad - $olam;
+		$s = sin($latRad);
+		$c = cos($latRad);
+		$t = $s / $c;
+		$eta = $e2Squared * pow($c, 2);
+		$sn = self::sphsn($a, $eSquared, $latRad);
+		$tmd = self::sphtmd($ap, $bp, $cp, $dp, $ep, $latRad);
+		$t1 = $tmd * $ok;
+		$t2 = $sn * $s * $c * $ok / 2;
+		$t3 = $sn * $s * pow($c, 3) * $ok * (5 - pow($t, 2) + 9 * $eta + 4 * pow($eta, 2)) / 24;
+		$t4 = $sn * $s * pow($c, 5) * $ok * (61 - 58 * pow($t, 2) + pow($t, 4) + 270 * $eta - 330 * pow($t, 2) * $eta + 445 * pow($eta, 2) + 324 * pow($eta, 3) - 680 * pow($t, 2) * pow($eta, 2) + 88 * pow($eta, 4) - 600 * pow($t, 2) * pow($eta, 3) - 192 * pow($t, 2) * pow($eta, 4)) / 720;
+		$t5 = $sn * $s * pow($c, 7) * $ok * (1385 - 3111 * pow($t, 2) + 543 * pow($t, 4) - pow($t, 6)) / 40320;
+		$t6 = $sn * $c * $ok;
+		$t7 = $sn * pow($c, 3) * $ok * (1 - pow($t, 2) + $eta) / 6;
+		$t8 = $sn * pow($c, 5) * $ok * (5 - 18 * pow($t, 2) + pow($t, 4) + 14 * $eta - 58 * pow($t, 2) * $eta + 13 * pow($eta, 2) + 4 * pow($eta, 3) - 64 * pow($t, 2) * pow($eta, 2) - 24 * pow($t, 2) * pow($eta, 3)) / 120;
+		$t9 = $sn * pow($c, 7) * $ok * (61 - 479 * pow($t, 2) + 179 * pow($t, 4) - pow($t, 6)) / 5040;
+		$result->x = self::$fe + $strf + $dlam * $t6 + pow($dlam, 3) * $t7  + pow($dlam, 5) * $t8 + pow($dlam, 7) * $t9;
+		$result->y = $nfn + $t1 + pow($dlam, 2) * $t2 + pow($dlam, 4) * $t3 + pow($dlam, 6) * $t4 + pow($dlam, 8) * $t5;
+		return $result;
+	}
+
+	private static function PUWGToLonLat ($a, $f, $lon, $lat, $proj) {
+		$result = new StdClass();
+		$ok =  0.999923;
+		if ($proj == 1) $ok = 0.9993;
+		$recf = 1 / $f;
+		$b = $a * ($recf - 1) / $recf;
+		$eSquared = self::CalculateESquared($a, $b);
+		$e2Squared = self::CalculateE2Squared($a, $b);
+		$tn = ($a - $b) / ($a + $b);
+		$ap = $a * (1 - $tn + 5 * (pow($tn, 2) - pow($tn, 3)) / 4 + 81 * (pow($tn, 4) - pow($tn, 5)) / 64);
+		$bp = 3 * $a * ($tn - pow($tn, 2) + 7 * (pow($tn, 3) - pow($tn, 4)) / 8 + 55 * pow($tn, 5) / 64) / 2;
+		$cp = 15 * $a * (pow($tn, 2) - pow($tn, 3) + 3 * (pow($tn, 4) - pow($tn, 5)) / 4) / 16;
+		$dp = 35 * $a * (pow($tn, 3) - pow($tn, 4) + 11 * pow($tn, 5) / 16) / 48;
+		$ep = 315 * $a * (pow($tn, 4) - pow($tn, 5)) / 512;
+		if ($proj == 1) {
+			$olam = 19 * M_PI / 180;
+			$strf = 0;
+			$nfn = -5300000;
+          
+		} else {
+			$nfn = 0;
+			$strf = floor($lon / 1000000) * 1000000;
+			$olam = $strf / 1000000 * M_PI / 180;
+		}
+		$tmd = ($lat - $nfn) / $ok;
+		$sr = self::sphsr($a, $eSquared, 0);
+		$ftphi = $tmd / $sr;
+		for ($i = 0; $i < 5; $i++) {
+			$t10 = self::sphtmd($ap, $bp, $cp, $dp, $ep, $ftphi);
+			$sr = self::sphsr($a, $eSquared, $ftphi);
+			$ftphi = $ftphi + ($tmd - $t10) / $sr;
+		}
+		$sr = self::sphsr($a, $eSquared, $ftphi);
+		$sn = self::sphsn($a, $eSquared, $ftphi);
+		$s = sin($ftphi);
+		$c = cos($ftphi);
+		$t = $s / $c;
+		$eta = $e2Squared * pow($c, 2);
+		$de = $lon - self::$fe - $strf;
+		$t10 = $t / (2 * $sr * $sn * pow($ok, 2));
+		$t11 = $t * (5 + 3 * pow($t, 2) + $eta - 4 * pow($eta, 2) - 9 * pow($t, 2) * $eta) / (24 * $sr * pow($sn, 3) * pow($ok, 4));
+        
+		$t12 = $t * (61 + 90 * pow($t, 2) + 46 * $eta + 45 * pow($t, 4) - 252 * pow($t, 2) * $eta - 3 * pow($eta, 2) + 100 * pow($eta, 3) - 66 * pow($t, 2) * pow($eta, 2) - 90 * pow($t, 4) * $eta + 88 * pow($eta, 4) + 225 * pow($t, 4) * pow($eta, 2) + 84 * pow($t, 2) * pow($eta, 3) - 192 * pow($t, 2) * pow($eta, 4)) / (720 * $sr * pow($sn, 5) * pow($ok, 6));
+		$t13 = $t * (1385 + 3633 * pow($t, 2) + 4095 * pow($t, 4) + 1575  * pow($t, 6)) / (40320 * $sr * pow($sn, 7) * pow($ok, 8));
+		$result->y = $ftphi - pow($de, 2) * $t10 + pow($de, 4) * $t11 - pow($de, 6) * $t12 + pow($de, 8) * $t13;
+		$t14 = 1 / ($sn * $c * $ok);
+		$t15 = (1 + 2 * pow($t, 2) + $eta) / (6 * pow($sn, 3) * $c * pow($ok, 3));
+		$t16 = 1 * (5 + 6 * $eta + 28 * pow($t, 2) - 3 * pow($eta, 2) + 8 * pow($t, 2) * $eta + 24 * pow($t, 4) - 4 * pow($eta, 3) + 4 * pow($t, 2) * pow($eta, 2) + 24 * pow($t, 2) * pow($eta, 3)) / (120 * pow($sn, 5) * $c * pow($ok, 5));
+		$t17 = 1 * (61 + 662 * pow($t, 2) + 1320 * pow($t, 4) + 720 * pow($t, 6)) / (5040 * pow($sn, 7) * $c * pow($ok, 7));
+		$dlam = $de * $t14 - pow($de, 3) * $t15 + pow($de, 5) * $t16 - pow($de, 7) * $t17;
+		$this->x = ($olam + $dlam) * 180 / M_PI;
+		$result->y = ($ftphi - pow($de, 2) * $t10 + pow($de, 4) * $t11 - pow($de, 6) * $t12 + pow($de, 8) * $t13) * 180 / M_PI;
+		return $result;
+	}
+
+	public static function getEpsg($lon, $lat = 0) {
+		if ($lon < 13.5 || $lon >= 25.5) throw new Exception("Wrong longitude - {$lon}");
+		return floor(($lon + 1.5) / 3) + 2171;
+	}
+
+	public static function LonLatToPUWGWGS84($lon, $lat) {
+		$result = self::LonLatToPUWG(6378137, 1 / 298.257223563, $lon, $lat, 4);
+		$result->epsg = self::getEpsg($lon);
+		return $result;
+	}
+
+	public static function PUWGToLonLatWGS84($lon, $lat) {
+		$result = self::PUWGToLonLat(6378137, 1 / 298.257223563, $lon, $lat, 4);
+		$result->epsg = self::getEpsg($result->x);
+		return $result;
+	}
+
+}

+ 89 - 0
SE/se-lib/Route/GeoreferencesManager.php

@@ -0,0 +1,89 @@
+<?php
+
+Lib::loadClass('RouteBase');
+Lib::loadClass('EpsgConversion');
+
+class Route_GeoreferencesManager extends RouteBase {
+
+	protected $ACTION, $REFERER;
+	const TABLE = "WMS_MAP_GEOREFERENCES";
+
+	public function handleAuth() {
+		if (!User::logged()) {
+			User::authByRequest();
+		}
+		$this->REFERER = $_SERVER['HTTP_REFERER'];
+		$this->ACTION = V::get('action', '', $_GET, '');
+	}
+
+	public function defaultAction() {
+		SE_Layout::gora();
+		SE_Layout::menu();
+?>
+<div class="container" style="margin-top:20px">
+  <legend>Zarządzanie punktami georeferencyjnymi</legend>
+  <div class="form-group">
+    <div class="col-sm-12">
+      <a href="?_route=GeoreferencesManager&action=verifyPoints" class="btn-sm btn-primary">Zweryfikuj punkty</a>
+    </div>
+  </div>
+<?php
+		switch ($this->ACTION) {
+			case "verifyPoints":
+				$this->verifyPoints();
+				break;
+		}
+?>
+</div>
+<?php
+		SE_Layout::dol();
+	}
+
+	public function reinstallAction() {
+		$this->reinstall();
+		die('OK');
+	}
+
+	public function reinstall() {
+	}
+
+	private function verifyPoints() {
+		$points = DB::getPDO()->fetchall("select `ID`, `EPSG`, x(`the_geom`) as `gx`, y(`the_geom`) as `gy`, `x`, `y` from `" . self::TABLE . "`");
+		$errors = [];
+		foreach ($points as $point) {
+			if ($point['x'] && $point['y']) {
+				if ($point['gx'] && $point['gy']) {
+					try {
+						$test = epsgConversion::LatLonToPUWGWGS84($point['gx'], $point['gy']);
+					} catch (Exception $e) {
+						SE_Layout::alert('danger', $e->getMessage());
+					}
+					if ((abs($point['x'] - $test->x) > 1 ) || (abs($point['y'] - $test->y) > 1) || ($point['EPSG'] != $test->epsg)) {
+						$error = "[{$point['ID']}] x = <span style='color:" . ((abs($point['x'] - $test->x) > 1) ? "red" : "green") .
+							";'>{$point['x']}</span> ({$test->x}), y = <span style='color:" . ((abs($point['y'] - $test->y) > 1) ? "red" : "green") .
+							";'>{$point['y']}</span> ({$test->y}), epsg = <span style='color:" . (($point['EPSG'] != $test->epsg) ? "red" : "green") .
+							";'>{$point['EPSG']}</span>" . (($point['EPSG'] != $test->epsg) ? " ({$test->epsg})" : "");
+						$errors[] = $error;
+					}
+				}
+			}
+		}
+?>
+  <div class="form-group">
+    <div class="col-sm-12"><br/>
+<?php
+//$errors = [];
+//		if ($errors) echo "<pre>" . implode("<br/>", $errors) . "</pre>";
+		if ($errors) {
+			SE_Layout::alert('danger', "<pre>" . implode("<br/>", $errors) . "</pre>");
+?>
+    <div style="text-align:center;"><a href="?_route=GeoreferencesManager&action=repairPoints" class="btn btn-primary">Napraw wszystkie</a></div>
+<?php
+		} else SE_Layout::alert('success', "Wszystko OK"); //echo "<span style='color:green;'>Wszystko OK</span>";
+?>
+    </div>
+  </div>
+<?php
+	}
+
+}

+ 3 - 0
SE/se-lib/TableAjax.php

@@ -436,6 +436,9 @@ class TableAjax extends ViewAjax {
 				<?php elseif ($this->allowTreeView()) : ?>
 					<a class="pull-right" style="padding:0 20px 0 0;" href="<?php echo "index.php?MENU_INIT=VIEWTREE_AJAX&ZASOB_ID={$this->_zasobID}"; ?>"><i class="glyphicon glyphicon-eye-open"></i> Drzewo</a>
 				<?php endif; ?>
+				<?php if ($this->_tbl == 'WMS_MAP_GEOREFERENCES') : ?>
+					<a class="pull-right" style="padding:0 20px 0 0;" href="<?php echo "index.php?_route=GeoreferencesManager"; ?>"><i class="glyphicon glyphicon glyphicon-wrench"></i> Zarządzaj punktami</a>
+				<?php endif; ?>
 			</ul>
 			<div id="<?php echo $this->_htmlID; ?>"></div>
 		</div>

+ 54 - 1
SE/superedit-DB_PROCEDURES_CREATE.php

@@ -1111,7 +1111,7 @@ $sql['view__CRM_LISTA_ZASOBOW_ALIASY_view']="CREATE or replace ALGORITHM=UNDEFIN
 
 // funkcja do liczenia dlugosci LINESTRING
 $sql['drop_function_GDistance']="drop function if exists GDistance";
-$sql['create_function_GDistance']="CREATE DEFINER=`root`@`localhost` FUNCTION `GDistance_test`(`LS` LINESTRING) RETURNS double
+$sql['create_function_GDistance']="CREATE DEFINER=`root`@`localhost` FUNCTION `GDistance`(`LS` LINESTRING) RETURNS double
     NO SQL
 BEGIN
     DECLARE LON_A, LAT_A, LON_B, LAT_B, R, RESULT DOUBLE;
@@ -1228,6 +1228,59 @@ select concat('rks',ID) as ID, 'Rozdzielcza_Kabel_Swiatlowodowy_wsg84' as TABLE_
 
 
 
+//! ### powiazanie georeferencji z projektem oblotu:
+
+$sql['WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event_drop']="DROP EVENT if exists WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event";
+
+
+$sql['WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event']="CREATE EVENT `WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event` ON SCHEDULE EVERY 1 DAY STARTS '2015-05-12 00:04:30' ON COMPLETION NOT PRESERVE ENABLE DO
+BEGIN
+create temporary table WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE
+select gr.ID, group_concat(wl.ID) as ID_WIZJE_LOKALNE from WIZJE_LOKALNE as wl left join WMS_MAP_GEOREFERENCES as gr on ST_Intersects(wl.the_geom,gr.the_geom) group by gr.ID;
+
+update WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE wl, WMS_MAP_GEOREFERENCES gr set gr.ID_WIZJE_LOKALNE = wl.ID_WIZJE_LOKALNE where gr.ID=wl.ID;
+
+
+END
+";
+
+// EOF ### powiazanie georeferencji z projektem oblotu:
+
+
+
+//! ### powiazanie georeferencji z projektem oblotu:
+
+$sql['WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event_drop']="DROP EVENT if exists WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event";
+
+
+$sql['WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event']="CREATE EVENT `WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE_event` ON SCHEDULE EVERY 1 DAY STARTS '2015-05-12 00:04:30' ON COMPLETION NOT PRESERVE ENABLE DO
+BEGIN
+create temporary table WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE
+select gr.ID, group_concat(wl.ID) as ID_WIZJE_LOKALNE from WIZJE_LOKALNE as wl left join WMS_MAP_GEOREFERENCES as gr on ST_Intersects(wl.the_geom,gr.the_geom) group by gr.ID;
+
+update WMS_MAP_GEOREFERENCES_set_ID_WIZJE_LOKALNE wl, WMS_MAP_GEOREFERENCES gr set gr.ID_WIZJE_LOKALNE = wl.ID_WIZJE_LOKALNE where gr.ID=wl.ID;
+
+
+END
+";
+
+// EOF ### powiazanie georeferencji z projektem oblotu:
+
+//! ### powiazanie georeferencji z projektem oblotu:
+
+$sql['BUILDINGS_the_geom_MARKETING_event_drop']="DROP EVENT if exists BUILDINGS_the_geom_MARKETING_event_drop";
+
+
+$sql['BUILDINGS_the_geom_MARKETING_event']="CREATE EVENT `BUILDINGS_the_geom_MARKETING_event` ON SCHEDULE EVERY 1 DAY STARTS '2015-05-12 00:04:30' ON COMPLETION NOT PRESERVE ENABLE DO
+BEGIN
+update USERS2_MARKETING m, BUILDINGS b set m.the_geom=ST_Centroid(b.the_geom) where m.T_TELBOX_BUILDING_IN=b.S_ADDRESS_STREET  ;
+
+END
+";
+
+
+//! EOF ### powiazanie georeferencji z projektem oblotu:
+
 
 
 foreach($sql as $ind=>$sql_) {

+ 17 - 4
SE/superedit-STATYSTYKA_TABELE.php

@@ -146,6 +146,11 @@ function STATYSTYKA_TABELE() {
 
 
  			{ //posprzatanie filtrow operatorow - todo tabela konkurencji
+		 	$oper_fix['DVB%S']='DVBS';
+	 		$oper_fix['%N_KA%']='NC_PLUS';
+	 		$oper_fix['%UPS%']='UPC';
+	 		$oper_fix['%WEKTRA%']='VECTRA';
+	 		$oper_fix['%MM_NET%']='MMNET';
 	 		$oper_fix['%ORAN%']='ORANGE';
 		 	$oper_fix['%T%MOBLILE%']='T-MOBILE';
 		 	$oper_fix['%T%MOBILE%']='T-MOBILE';		 	
@@ -156,11 +161,11 @@ function STATYSTYKA_TABELE() {
 		 	$oper_fix['TP']='ORANGE';
 		 	$oper_fix['%BRAK%']='BRAK';
 		 	$oper_fix['%W%KOMURCE%']='GSM';
-		 	$oper_fix['CANAL%']='CANAL-PLUS';
-		 	$oper_fix['%CYFRA%']='CYFRA-PLUS';
+		 	$oper_fix['CANAL%']='CANAL_PLUS';
+		 	$oper_fix['%CYFRA%']='CYFRA_PLUS';
 		 	$oper_fix['KABL%WKA']='INNY';
 		 	$oper_fix['NAZ%EMNA']='DVBC';
-		 	$oper_fix['NC%']='NC-PLUS';
+		 	$oper_fix['NC%']='NC_PLUS';
 		 	$oper_fix['POLSAT%']='POLSAT';
 		 	$oper_fix['POLAT']='POLSAT';
 		 	$oper_fix['SATELITA%']='DVB-S';
@@ -457,6 +462,10 @@ function STATYSTYKA_TABELE() {
 						or USERS2_MARKETING.T_OPER='BN'
 						or USERS2_MARKETING.TV_OPER='BN'
 					), 1, 0) ) / count(USERS2_MARKETING.S_ADDRESS_STREET) * 100), 2) as ANKIET_I
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY < 50, 1 ,0 ) )  as PAY_50_less 
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  > 50 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  < 70, 1 ,0 ) )  as PAY_50_70
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  > 70 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  < 100, 1 ,0 ) )  as PAY_70_100
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  > 100 , 1 ,0 ) )  as PAY_100_more
 				, BUILDINGS.A_ADM_COMPANY
 				, BUILDINGS.the_geom, BUILDINGS.A_STATUS
 			";
@@ -531,7 +540,7 @@ function STATYSTYKA_TABELE() {
 
 		}
 
-		{// REWIRY STATSY - USERS2_MARKETING_OVERWIEV_REWIR
+		{ // REWIRY STATSY - USERS2_MARKETING_OVERWIEV_REWIR
 			$sqlList[] = "drop table if exists USERS2_MARKETING_OVERWIEV_REWIR";
 
 			$sql = " select 0 as ID
@@ -555,6 +564,10 @@ function STATYSTYKA_TABELE() {
 						or USERS2_MARKETING.T_OPER='BN'
 						or USERS2_MARKETING.TV_OPER='BN'), 1, 0)
 					) / count(USERS2_MARKETING.S_ADDRESS_STREET) * 100), 2) as ANKIET_I
+					, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY < 50, 1 ,0 ) )  as PAY_50_less 
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  > 50 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  < 70, 1 ,0 ) )  as PAY_50_70
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  > 70 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  < 100, 1 ,0 ) )  as PAY_70_100
+				, sum(  if( USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY > 0 and USERS2_MARKETING.I_PAY + USERS2_MARKETING.T_PAY + USERS2_MARKETING.TV_PAY  > 100 , 1 ,0 ) )  as PAY_100_more
 				, BUILDINGS.A_ADM_COMPANY
 				, MK_Rewiry.the_geom , MK_Rewiry.A_STATUS
 				, count(BUILDINGS.ID) as BUDYNKOW -- To jest bledne - poprawka potem - nie da sie tu policzyc