fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17007] Property: FDV-131


From: sigurdne
Subject: [Fmsystem-commits] [17007] Property: FDV-131
Date: Tue, 29 Aug 2017 09:25:52 -0400 (EDT)

Revision: 17007
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17007
Author:   sigurdne
Date:     2017-08-29 09:25:52 -0400 (Tue, 29 Aug 2017)
Log Message:
-----------
Property: FDV-131

Modified Paths:
--------------
    trunk/property/inc/class.bolocation.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.solocation.inc.php
    trunk/property/inc/class.uigeneric.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
    trunk/property/js/portico/project.edit.js
    trunk/property/js/portico/tts.add.js
    trunk/property/js/portico/tts.view.js
    trunk/property/js/portico/workorder.edit.js
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/tts.xsl

Modified: trunk/property/inc/class.bolocation.inc.php
===================================================================
--- trunk/property/inc/class.bolocation.inc.php 2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.bolocation.inc.php 2017-08-29 13:25:52 UTC (rev 
17007)
@@ -1178,4 +1178,9 @@
                        return $this->so->get_delivery_address($loc1);
                }
 
+               function get_location_exception($location_code = '' )
+               {
+                       return 
$this->so->get_location_exception($location_code, $alert_vendor = false);
+               }
+
        }
\ No newline at end of file

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.menu.inc.php       2017-08-29 13:25:52 UTC (rev 
17007)
@@ -901,20 +901,16 @@
                                        'image' => array('property', 
'responsibility_role')
                                );
 
-                               /*                              if ( 
$acl->check('.location', 16, 'property') )
-                                 {
-                                 $children['type'] = array
-                                 (
-                                 'url' => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.index')),
-                                 'text'        => lang('Location type')
-                                 );
-                                 $children['config'] = array
-                                 (
-                                 'url' => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.config')),
-                                 'text'        => lang('Config')
-                                 );
-                                 }
-                                */
+                               $children['location_exception'] = array
+                                       (
+                                               'text' => lang('location 
exception'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                       'type' => 
'location_exception',
+                                                       'menu_selection' => 
'property::location::location_exception')),
+
+                                       );
+
+
                                $menus['navigation']['location'] = array
                                        (
                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uilocation.index',

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.sogeneric.inc.php  2017-08-29 13:25:52 UTC (rev 
17007)
@@ -2517,8 +2517,8 @@
                                                (
                                                        array
                                                        (
-                                                               'name' => 
'name',
-                                                               'descr' => 
lang('name'),
+                                                               'name' => 
'content',
+                                                               'descr' => 
lang('content'),
                                                                'type' => 
'varchar',
                                                                'nullable' => 
false
                                                        ),
@@ -2567,7 +2567,7 @@
                                                                'name' => 
'descr',
                                                                'descr' => 
lang('descr'),
                                                                'type' => 
'text',
-                                                               'nullable' => 
false
+                                                               'nullable' => 
true
                                                        ),
                                                        array
                                                        (
@@ -2621,7 +2621,13 @@
                                                                        
'get_single_value' => 'property.sogeneric.get_name',
                                                                        
'method_input' => array('role' => 'parent', 'type' => 
'location_exception_category', 'selected' => '##category_id##')
                                                                )
-                                                       )
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'alert_vendor',
+                                                               'descr' => 
lang('alert vendor'),
+                                                               'type' => 
'checkbox'
+                                                       ),
                                                ),
                                                'edit_msg' => lang('edit'),
                                                'add_msg' => lang('add'),

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.solocation.inc.php 2017-08-29 13:25:52 UTC (rev 
17007)
@@ -2189,7 +2189,7 @@
 
                        $sql = "SELECT fm_district.delivery_address FROM 
fm_location1 "
                                . " {$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.id)"
-                               . " {$this->join} fm_district ON 
(fm_part_of_town.district_id = fm_district.id)"                        
+                               . " {$this->join} fm_district ON 
(fm_part_of_town.district_id = fm_district.id)"
                                . " WHERE loc1 = '$loc1'";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
@@ -2198,4 +2198,49 @@
                        return $delivery_address;
 
                }
+
+               function get_location_exception($location_code = '', 
$alert_vendor = false)
+               {
+
+                       if(!$location_code)
+                       {
+                               return array();
+                       }
+
+                       $location_arr = explode('-', $location_code);
+                       $exceptions = array();
+                       $now = time();
+                       $_location_arr = array();
+                       foreach ($location_arr as $loc)
+                       {
+                               $_location_arr[] = 
$this->db->db_addslashes($loc);
+
+                               $_location_code = implode('-', $_location_arr);
+
+                               $sql = "SELECT DISTINCT 
fm_location_exception_severity.name AS severity,"
+                                       . " fm_location_exception_category.name 
AS category,"
+                                       . " content AS category_text, descr as 
location_descr, alert_vendor"
+                                       . " FROM fm_location_exception"
+                                       . " {$this->join} 
fm_location_exception_severity ON fm_location_exception.severity_id = 
fm_location_exception_severity.id"
+                                       . " {$this->join} 
fm_location_exception_category ON fm_location_exception.category_id = 
fm_location_exception_category.id"
+                                       . " {$this->left_join} 
fm_location_exception_category_text ON fm_location_exception_category.id = 
fm_location_exception_category_text.category_id"
+                                       . " WHERE location_code = 
'{$_location_code}'"
+                                       . " AND start_date < $now AND (end_date 
IS NULL  OR end_date = 0 OR end_date > $now)";
+
+                               $this->db->query($sql, __LINE__, __FILE__);
+
+                               while($this->db->next_record())
+                               {
+                                       $exceptions[] = array(
+                                               'severity'                      
=> $this->db->f('severity', true),
+                                               'category'                      
=> $this->db->f('category', true),
+                                               'category_text'         => 
$this->db->f('category_text', true),
+                                               'location_descr'        => 
$this->db->f('location_descr', true),
+                                               'alert_vendor'          => 
$this->db->f('alert_vendor'),
+                                       );
+                               }
+                       }
+
+                       return $exceptions;
+               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php  2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.uigeneric.inc.php  2017-08-29 13:25:52 UTC (rev 
17007)
@@ -99,6 +99,13 @@
                                
$GLOBALS['phpgw_info']['flags']['menu_selection'] = str_replace('property', 
$appname, $GLOBALS['phpgw_info']['flags']['menu_selection']);
                                $this->appname = $appname;
                        }
+
+                       $_menu_selection = phpgw::get_var('menu_selection');
+                       //Override
+                       if($_menu_selection)
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] = $_menu_selection;
+                       }
                }
                /*
                 * Overrides with incoming data from POST

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.uilocation.inc.php 2017-08-29 13:25:52 UTC (rev 
17007)
@@ -69,7 +69,8 @@
                        'columns' => true,
                        'update_location' => true,
                        'responsiblility_role' => true,
-                       'get_delivery_address'  => true
+                       'get_delivery_address'  => true,
+                       'get_location_exception'=> true,
                );
 
                function __construct()
@@ -1009,7 +1010,7 @@
 
                                try
                                {
-                                       parent.on_loc1_updated();
+                                       
parent.on_location_updated(aData["location_code"]);
                                }
                                catch(err)
                                {}
@@ -2911,4 +2912,16 @@
                        );
 
                }
+
+               function get_location_exception( )
+               {
+                       $location_code = phpgw::get_var('location_code', 
'string');
+
+                       $location_exception = 
$this->bo->get_location_exception($location_code);
+
+                       return array(
+                               'location_exception' => $location_exception
+                       );
+
+               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/inc/class.uitts.inc.php      2017-08-29 13:25:52 UTC (rev 
17007)
@@ -3428,8 +3428,27 @@
                        $pdf->ezText($contact_phone, 14);
                        $pdf->ezSetDy(-20);
                        $pdf->ezText("Av hensyn til våre ansatte og leietakere 
ber vi om at kontakt på bygget blir kontaktet minst 1 dag i forkant av 
oppdrag.", 14);
+
+                       $location_exceptions = 
createObject('property.solocation')->get_location_exception($ticket['location_code'],
 $alert_vendor = true);
+
+                       if($location_exceptions)
+                       {
+                               $pdf->ezSetDy(-20);
+                               $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica-Bold.afm');
+                               $pdf->ezText(lang('important information'), 14);
+                               $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica.afm');
+                       }
+
+                       foreach ($location_exceptions as $location_exception)
+                       {
+                               
$pdf->ezText($location_exception['category_text'], 14);
+
+                               if($location_exception['location_descr'])
+                               {
+                                       
$pdf->ezText($location_exception['location_descr'], 14);
+                               }
+                       }
                        $pdf->ezSetDy(-20);
-
                        $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica-Bold.afm');
                        $pdf->ezText("Faktura må merkes med ordrenummer: 
{$ticket['order_id']} og ressursnr.:{$ressursnr}", 14);
                        $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica.afm');
@@ -3626,6 +3645,23 @@
                                '</b>'
                                        ), $order_email_template));
 
+                       $location_exceptions = 
createObject('property.solocation')->get_location_exception($ticket['location_code'],
 $alert_vendor = true);
+
+                       if($location_exceptions)
+                       {
+                               $body .= "<br/><br/><b>" . lang('important 
information') . '</b>';
+                       }
+                       foreach ($location_exceptions as $location_exception)
+                       {
+                               $body .= "<br/>" . 
$location_exception['category_text'] . '<br/>';
+
+                               if($location_exception['location_descr'])
+                               {
+                                       $body .= 
$location_exception['location_descr'] . '<br/>';
+                               }
+                       }
+
+
                        $html = "<html><head><meta http-equiv=\"Content-Type\" 
content=\"text/html; charset=utf-8\"><title>{$subject}</title></head>";
 
                        $body .='</br>';

Modified: 
trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
===================================================================
--- trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2017-08-28 17:30:05 UTC (rev 17006)
+++ trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2017-08-29 13:25:52 UTC (rev 17007)
@@ -58,7 +58,7 @@
                         * prosjekt
                         * tjeneste
                         */
-//                     $fellesdata->update_customer_id();
+                       $fellesdata->update_customer_id();
                        $fellesdata->update_vendor();
        //              $fellesdata->update_agresso_prosjekt(); //for mange 
treff
        //              $fellesdata->update_art();                              
//for mange treff
@@ -401,7 +401,7 @@
                                        $sql = "UPDATE rental_party"
                                                . " SET customer_id = 
{$customer_id}"
                                                . " WHERE id = " . 
(int)$party['id'];
-                                       _debug_array($sql);
+               //                      _debug_array($sql);
                                        $GLOBALS['phpgw']->db->query($sql, 
__LINE__, __FILE__);
                                }
                        }

Modified: trunk/property/js/portico/project.edit.js
===================================================================
--- trunk/property/js/portico/project.edit.js   2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/js/portico/project.edit.js   2017-08-29 13:25:52 UTC (rev 
17007)
@@ -397,7 +397,7 @@
 JqueryPortico.autocompleteHelper(strURL, 'b_account_name', 'b_account_id', 
'b_account_container');
 
 
-on_loc1_updated = function ()
+on_location_updated = function ()
 {
        if(     $("#delivery_address").val() )
        {

Modified: trunk/property/js/portico/tts.add.js
===================================================================
--- trunk/property/js/portico/tts.add.js        2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/js/portico/tts.add.js        2017-08-29 13:25:52 UTC (rev 
17007)
@@ -77,3 +77,38 @@
        errorMessageKey: ''
 });
 
+on_location_updated = function (location_code)
+{
+       location_code = location_code || $("#loc1").val();
+
+       var oArgs = {menuaction: 'property.uilocation.get_location_exception', 
location_code: location_code};
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: requestUrl,
+               success: function (data)
+               {
+                       $("#message").html('');
+
+                       if (data != null)
+                       {
+                               var htmlString = '';
+                               var exceptions = data.location_exception;
+                               $.each(exceptions, function (k, v)
+                               {
+                                       htmlString += "<div 
class=\"msg_good\">";
+                                       htmlString += v.severity + ": " + 
v.category_text;
+                                       if(v.location_descr)
+                                       {
+                                               htmlString += "<br/>" + 
v.location_descr;
+                                       }
+                                       htmlString += '</div>';
+
+                               });
+                               $("#message").html(htmlString);
+                       }
+               }
+       });
+};

Modified: trunk/property/js/portico/tts.view.js
===================================================================
--- trunk/property/js/portico/tts.view.js       2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/js/portico/tts.view.js       2017-08-29 13:25:52 UTC (rev 
17007)
@@ -69,7 +69,7 @@
 
 this.confirm_session = function (action)
 {
-       if (action === 'save' || action === 'apply'  || action === 'send_order')
+       if (action === 'save' || action === 'apply' || action === 'send_order')
        {
                conf = {
                        modules: 'date, security, file',
@@ -243,7 +243,7 @@
                {
                        refresh_files()
                }
-       });     
+       });
 };
 
 this.refresh_files = function ()
@@ -358,7 +358,7 @@
 
 var ecodimb_selection = "";
 
-$(window).on('load', function()
+$(window).on('load', function ()
 {
        ecodimb = $('#ecodimb').val();
        if (ecodimb)
@@ -490,7 +490,7 @@
                return;
        }
        //var width = 200;
-       var width =  $("#submitbox").width();
+       var width = $("#submitbox").width();
        $("#submitbox").css({
                position: 'absolute',
                right: '10px',
@@ -542,4 +542,45 @@
                        ;
                });
        }
+
+       on_location_updated = function (location_code)
+       {
+               location_code = location_code || $("#loc1").val();
+
+               var oArgs = {menuaction: 
'property.uilocation.get_location_exception', location_code: location_code};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function (data)
+                       {
+                               $("#message").html('');
+
+                               if (data != null)
+                               {
+                                       var htmlString = '';
+                                       var exceptions = 
data.location_exception;
+                                       $.each(exceptions, function (k, v)
+                                       {
+                                               htmlString += "<div 
class=\"msg_good\">";
+                                               htmlString += v.severity + ": " 
+ v.category_text;
+                                               if (v.location_descr)
+                                               {
+                                                       htmlString += "<br/>" + 
v.location_descr;
+                                               }
+                                               htmlString += '</div>';
+
+                                       });
+                                       $("#message").html(htmlString);
+                               }
+                       }
+               });
+       };
+
+
+       on_location_updated(location_code);
+
 });
+

Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/js/portico/workorder.edit.js 2017-08-29 13:25:52 UTC (rev 
17007)
@@ -660,7 +660,7 @@
        });
 }
 
-on_loc1_updated = function ()
+on_location_updated = function ()
 {
        if(     $("#delivery_address").val() )
        {

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2017-08-28 17:30:05 UTC (rev 17006)
+++ trunk/property/setup/phpgw_no.lang  2017-08-29 13:25:52 UTC (rev 17007)
@@ -2232,4 +2232,6 @@
 location exception     property        no      OBS varsel
 severity category      property        no      Kategori for alvorlighetsgrad
 severity category text property        no      Tekster for kategori for 
alvorlighetsgrad
-reference      property        no      Referanse
\ No newline at end of file
+reference      property        no      Referanse
+alert vendor   property        no      Varsle leverandør
+important information  property        no      Viktig informasjon
\ No newline at end of file

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2017-08-28 17:30:05 UTC (rev 17006)
+++ trunk/property/setup/setup.inc.php  2017-08-29 13:25:52 UTC (rev 17007)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.715';
+       $setup_info['property']['version']              = '0.9.17.716';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/setup/tables_current.inc.php 2017-08-29 13:25:52 UTC (rev 
17007)
@@ -2936,6 +2936,7 @@
                                'start_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => False),
                                'end_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => true),
                                'reference' => array('type' => 'text', 
'nullable' => True),
+                               'alert_vendor' => array('type' => 'int', 
'precision' => 2, 'nullable' => true),
                                'user_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => False),
                                'entry_date' => array('type' => 'int', 
'precision' => 4, 'nullable' => False),
                                'modified_date' => array('type' => 'int', 
'precision' => 4, 'nullable' => False)

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/setup/tables_update.inc.php  2017-08-29 13:25:52 UTC (rev 
17007)
@@ -9727,3 +9727,24 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.714 to 0.9.17.715
+       *
+       */
+       $test[] = '0.9.17.715';
+
+       function property_upgrade0_9_17_715()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_exception', 
'alert_vendor', array(
+                       'type' => 'int', 'precision' => 2, 'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.716';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+       
\ No newline at end of file

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2017-08-28 17:30:05 UTC (rev 
17006)
+++ trunk/property/templates/base/tts.xsl       2017-08-29 13:25:52 UTC (rev 
17007)
@@ -20,7 +20,6 @@
                var my_groups = <xsl:value-of select="my_groups"/>;
                var lang = <xsl:value-of select="php:function('js_lang', 
'Please select a person or a group to handle the ticket !')"/>;
        </script>
-
        <dl>
                <xsl:choose>
                        <xsl:when test="msgbox_data != ''">
@@ -36,6 +35,9 @@
        <form class="pure-form pure-form-aligned"  
ENCTYPE="multipart/form-data" id="form" name="form" method="post" 
action="{$form_action}">
                <div id="tab-content">
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+
+                       <div id="message" class='message'/>
+
                        <div id="add">
                                <fieldset>
                                        <xsl:for-each select="value_origin">
@@ -312,6 +314,7 @@
        <form class="pure-form pure-form-aligned" ENCTYPE="multipart/form-data" 
id="form" name="form" method="post" action="{$form_action}">
                <div id="tab-content">
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                       <div id="message" class='message'/>
                        <div id="floating-box">
                                <div id="submitbox">
                                        <table width="200px">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]