fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15553] rental: More on application


From: sigurdne
Subject: [Fmsystem-commits] [15553] rental: More on application
Date: Wed, 31 Aug 2016 19:26:24 +0000 (UTC)

Revision: 15553
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15553
Author:   sigurdne
Date:     2016-08-31 19:26:24 +0000 (Wed, 31 Aug 2016)
Log Message:
-----------
rental: More on application

Modified Paths:
--------------
    trunk/rental/inc/class.soapplication.inc.php
    trunk/rental/inc/class.uiapplication.inc.php
    trunk/rental/inc/model/class.application.inc.php
    trunk/rental/templates/base/application.xsl

Modified: trunk/rental/inc/class.soapplication.inc.php
===================================================================
--- trunk/rental/inc/class.soapplication.inc.php        2016-08-31 18:12:20 UTC 
(rev 15552)
+++ trunk/rental/inc/class.soapplication.inc.php        2016-08-31 19:26:24 UTC 
(rev 15553)
@@ -67,6 +67,8 @@
                protected function update( $object )
                {
                        $this->db->transaction_begin();
+                       $status_text = rental_application::get_status_list();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 
                        $original = 
$this->read_single($object->get_id());//returned as array()
                        foreach ($this->fields as $field => $params)
@@ -76,6 +78,25 @@
                                $label = !empty($params['label']) ? 
lang($params['label']) : $field;
                                if (!empty($params['history']) && ($new_value 
!= $old_value))
                                {
+                                       switch ($field)
+                                       {
+                                               case 'status':
+                                                       $old_value = 
$status_text[$old_value];
+                                                       $new_value = 
$status_text[$new_value];
+                                                       break;
+                                               case 'assign_date_start':
+                                               case 'assign_date_end':
+                                                       $old_value = 
$GLOBALS['phpgw']->common->show_date($old_value, $dateformat);
+                                                       $new_value = 
$GLOBALS['phpgw']->common->show_date($new_value, $dateformat);
+
+                                                       break;
+                                               case 'executive_officer':
+                                                       $old_value = $old_value 
? $GLOBALS['phpgw']->accounts->get($old_value)->__toString() : '';
+                                                       $new_value = $new_value 
? $GLOBALS['phpgw']->accounts->get($new_value)->__toString() : '';
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
                                        $value_set = array
                                        (
                                                'application_id'        => 
$object->get_id(),
@@ -92,7 +113,7 @@
                        }
 
                        parent::update($object);
-       
+
                        return  $this->db->transaction_commit();
 
 

Modified: trunk/rental/inc/class.uiapplication.inc.php
===================================================================
--- trunk/rental/inc/class.uiapplication.inc.php        2016-08-31 18:12:20 UTC 
(rev 15552)
+++ trunk/rental/inc/class.uiapplication.inc.php        2016-08-31 19:26:24 UTC 
(rev 15553)
@@ -69,30 +69,20 @@
                private function get_status_options( $selected = 0 )
                {
                        $status_options = array();
+                       $status_list = rental_application::get_status_list();
+
                        $status_options[] = array(
                                'id' => '',
                                'name' => lang('all')
                        );
-                       $status_options[] = array(
-                               'id' => rental_application::STATUS_REGISTERED,
-                               'name' => lang('registered')
-                       );
-                       $status_options[] = array(
-                               'id' => rental_application::STATUS_PENDING,
-                               'name' => lang('pending')
-                       );
-                       $status_options[] = array(
-                               'id' => rental_application::STATUS_REJECTED,
-                               'name' => lang('rejected')
-                       );
-                       $status_options[] = array(
-                               'id' => rental_application::STATUS_APPROVED,
-                               'name' => lang('approved')
-                       );
 
-                       foreach ($status_options as &$entry)
+                       foreach ($status_list as $_key => $_value)
                        {
-                               $entry['selected'] = $entry['id'] == $selected 
? 1 : 0;
+                               $status_options[] = array(
+                                       'id' => $_key,
+                                       'name' => $_value,
+                                       'selected' => $_key == $selected ? 1 : 0
+                               );
                        }
                        return $status_options;
                }
@@ -420,12 +410,7 @@
                {
                        $params = $this->bo->build_default_read_params();
                        $applications = $this->bo->read($params);
-                       $status_text = array(
-                               rental_application::STATUS_REGISTERED => 
lang('registered'),
-                               rental_application::STATUS_PENDING      => 
lang('pending'),
-                               rental_application::STATUS_REJECTED => 
lang('rejected'),
-                               rental_application::STATUS_APPROVED     => 
lang('approved')
-                       );
+                       $status_text = rental_application::get_status_list();
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        foreach ($applications['results'] as &$application)
                        {

Modified: trunk/rental/inc/model/class.application.inc.php
===================================================================
--- trunk/rental/inc/model/class.application.inc.php    2016-08-31 18:12:20 UTC 
(rev 15552)
+++ trunk/rental/inc/model/class.application.inc.php    2016-08-31 19:26:24 UTC 
(rev 15553)
@@ -83,7 +83,17 @@
                {
                        return array(1 => 'Hybel', 2 => 'Leilighet');
                }
+               public static function get_status_list()
+               {
+                       return array(
+                               self::STATUS_REGISTERED => lang('registered'),
+                               self::STATUS_PENDING    => lang('pending'),
+                               self::STATUS_REJECTED => lang('rejected'),
+                               self::STATUS_APPROVED   => lang('approved')
+                       );
+               }
 
+
                public static function get_payment_methods()
                {
                        return array(1 => 'Faktura', 2 => 'Trekk i lønn',3 => 
'intern faktura');
@@ -187,9 +197,15 @@
                                        'related' => true,
                                        ),
                                'assign_date_start' => array('action'=> 
PHPGW_ACL_READ | PHPGW_ACL_EDIT,
-                                       'type' => 'date'),
+                                       'type' => 'date',
+                                       'label'=> 'assign_start',
+                                       'history' => true
+                                       ),
                                'assign_date_end' => array('action'=> 
PHPGW_ACL_READ | PHPGW_ACL_EDIT,
-                                       'type' => 'date'),
+                                       'type' => 'date',
+                                       'label'=> 'assign_end',
+                                       'history' => true
+                                       ),
                                'status' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'int',
                                        'history' => true,

Modified: trunk/rental/templates/base/application.xsl
===================================================================
--- trunk/rental/templates/base/application.xsl 2016-08-31 18:12:20 UTC (rev 
15552)
+++ trunk/rental/templates/base/application.xsl 2016-08-31 19:26:24 UTC (rev 
15553)
@@ -10,10 +10,10 @@
                </xsl:when>
                <xsl:when test="adjustment_price">
                        <xsl:apply-templates select="adjustment_price" />
-                       
+
                </xsl:when>
        </xsl:choose>
-       
+
 </xsl:template>
 
 <!-- add / edit  -->
@@ -410,28 +410,20 @@
                                                                <label>
                                                                        
<xsl:value-of select="php:function('lang', 'details')"/>
                                                                </label>
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="additional_notes=''">
-                                                                               
<xsl:value-of select="php:function('lang', 'no additional notes')"/>
-                                                                       
</xsl:when>
-                                                                       
<xsl:otherwise>
-                                                                               
<div class = 'pure-u-md-1-2'>
-                                                                               
        <xsl:for-each select="datatable_def">
-                                                                               
                <xsl:if test="container = 'datatable-container_0'">
-                                                                               
                        <xsl:call-template name="table_setup">
-                                                                               
                                <xsl:with-param name="container" select 
='container'/>
-                                                                               
                                <xsl:with-param name="requestUrl" select 
='requestUrl'/>
-                                                                               
                                <xsl:with-param name="ColumnDefs" select 
='ColumnDefs'/>
-                                                                               
                                <xsl:with-param name="data" select ='data'/>
-                                                                               
                                <xsl:with-param name="config" select ='config'/>
-                                                                               
                        </xsl:call-template>
-                                                                               
                </xsl:if>
-                                                                               
        </xsl:for-each>
-                                                                               
</div>
-                                                                       
</xsl:otherwise>
-                                                               </xsl:choose>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_0'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
                <xsl:with-param name="data" select ='data'/>
+                                                                               
                <xsl:with-param name="config" select ='config'/>
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
                                                        </div>
-                                               
                                                </fieldset>
                                        </div>
                                </xsl:if>
@@ -445,7 +437,7 @@
                                </input>
                                <xsl:variable name="cancel_url">
                                        <xsl:value-of select="cancel_url"/>
-                               </xsl:variable>                         
+                               </xsl:variable>
                                <input type="button" class="pure-button 
pure-button-primary" name="cancel" onClick="window.location = '{cancel_url}';">
                                        <xsl:attribute name="value">
                                                <xsl:value-of 
select="php:function('lang', 'cancel')"/>
@@ -482,7 +474,7 @@
                                                <div class="pure-control-group">
                                                        <label>
                                                                <xsl:value-of 
select="php:function('lang', 'field_of_responsibility')"/>
-                                                       </label>                
                                
+                                                       </label>
                                                        <xsl:value-of 
select="value_field_of_responsibility"/>
                                                </div>
                                                <div class="pure-control-group">
@@ -501,7 +493,7 @@
                                                                                
<xsl:if test="is_area = 1">
                                                                                
        <xsl:attribute name="checked" value="checked"/>
                                                                                
</xsl:if>
-                                                                       
</input> 
+                                                                       </input>
                                                                        
<xsl:value-of select="php:function('lang', 'calculate_price_per_area')"/>
                                                                </div>
                                                                <div>
@@ -509,7 +501,7 @@
                                                                                
<xsl:if test="is_area = 0">
                                                                                
        <xsl:attribute name="checked" value="checked"/>
                                                                                
</xsl:if>
-                                                                       
</input> 
+                                                                       </input>
                                                                        
<xsl:value-of select="php:function('lang', 'calculate_price_apiece')"/>
                                                                </div>
                                                        </div>
@@ -537,7 +529,7 @@
                                                        </input>
                                                        <xsl:if 
test="has_active_contract = 1">
                                                                <xsl:value-of 
select="lang_price_element_in_use"/>
-                                                       </xsl:if>               
                                                        
+                                                       </xsl:if>
                                                </div>
                                                <div class="pure-control-group">
                                                        <label>
@@ -557,7 +549,7 @@
                        <div class="proplist-col">
                                <xsl:variable name="cancel_url">
                                        <xsl:value-of select="cancel_url"/>
-                               </xsl:variable>                         
+                               </xsl:variable>
                                <input type="button" class="pure-button 
pure-button-primary" name="cancel" value="{lang_cancel}" 
onMouseout="window.status='';return true;" onClick="window.location = 
'{cancel_url}';"/>
                        </div>
                </form>




reply via email to

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