fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14806] validation and required values


From: Sigurd Nes
Subject: [Fmsystem-commits] [14806] validation and required values
Date: Fri, 04 Mar 2016 09:25:00 +0000

Revision: 14806
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14806
Author:   sigurdne
Date:     2016-03-04 09:24:57 +0000 (Fri, 04 Mar 2016)
Log Message:
-----------
validation and required values

Modified Paths:
--------------
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/templates/base/project.xsl
    trunk/rental/setup/phpgw_no.lang

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2016-03-03 12:04:19 UTC (rev 
14805)
+++ trunk/property/inc/class.soproject.inc.php  2016-03-04 09:24:57 UTC (rev 
14806)
@@ -1200,8 +1200,15 @@
                                . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,contact_id,inherit_location,periodization_id
 $cols) "
                                . "VALUES ($values $vals )", __LINE__, 
__FILE__);
 
-                       if ($project['budget'])
+                       /**
+                        *  insert an entry for the budget anyhow
+                        */
+                       if ($project['project_type_id'] == 3)//buffer
                        {
+                               $this->_update_buffer_budget($id, 
$project['budget_year'], $project['budget'], null, null);
+                       }
+                       else
+                       {
                                $this->update_budget($id, 
$project['budget_year'], $project['budget_periodization'], $project['budget'], 
$project['budget_periodization_all'], 'update', 
$project['budget_periodization_activate']);
                        }
 

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2016-03-03 12:04:19 UTC (rev 
14805)
+++ trunk/property/inc/class.uiproject.inc.php  2016-03-04 09:24:57 UTC (rev 
14806)
@@ -1635,10 +1635,11 @@
                        $values['sum'] = number_format($values['sum'], 0, 
$this->decimal_separator, '.');
                        $value_remainder = number_format($value_remainder, 0, 
$this->decimal_separator, '.');
 
+                       $s_amount_in = 0;
+                       $s_amount_out = 0;
+
                        if (isset($values['project_type_id']) && 
$values['project_type_id'] == 3)
                        {
-                               $s_amount_in = 0;
-                               $s_amount_out = 0;
                                $content_budget = 
$this->bo->get_buffer_budget($id);
                                foreach ($content_budget as & $b_entry)
                                {
@@ -1653,11 +1654,11 @@
                                        array('key' => 'year', 'label' => 
lang('year'), 'sortable' => false, 'value_footer' => lang('Sum')),
                                        array('key' => 'entry_date', 'label' => 
lang('entry date'), 'sortable' => true),
                                        array('key' => 'amount_in', 'label' => 
lang('amount in'), 'sortable' => false,
-                                               'className' => 'right', 
'formatter' => 'FormatterAmount0', 'value_footer' => 
number_format($s_amount_in, 0, $this->decimal_separator, '.')),
+                                               'className' => 'right', 
'formatter' => 'JqueryPortico.FormatterAmount0', 'value_footer' => 
number_format($s_amount_in, 0, $this->decimal_separator, '.')),
                                        array('key' => 'from_project', 'label' 
=> lang('from project'), 'sortable' => true,
                                                'className' => 'right', 
'formatter' => 'project_link'),
                                        array('key' => 'amount_out', 'label' => 
lang('amount out'), 'sortable' => false,
-                                               'className' => 'right', 
'formatter' => 'FormatterAmount0', 'value_footer' => 
number_format($s_amount_out, 0, $this->decimal_separator, '.')),
+                                               'className' => 'right', 
'formatter' => 'JqueryPortico.FormatterAmount0', 'value_footer' => 
number_format($s_amount_out, 0, $this->decimal_separator, '.')),
                                        array('key' => 'to_project', 'label' => 
lang('to project'), 'sortable' => true,
                                                'formatter' => 'project_link'),
                                        array('key' => 'remark', 'label' => 
lang('remark'), 'sortable' => true)
@@ -1694,6 +1695,8 @@
                                );
                        }
 
+                       $check_for_budget = (int)abs($s_budget) + 
(int)abs($s_amount_in);
+
                        $datatable_def[] = array
                                (
                                'container' => 'datatable-container_0',
@@ -2040,6 +2043,7 @@
                                'lang_power_meter_statustext' => lang('Enter 
the power meter'),
                                'value_power_meter' => 
isset($values['power_meter']) ? $values['power_meter'] : '',
                                'value_budget' => isset($values['budget']) && 
$this->receipt['error'] ? $values['budget'] : '',
+                               'check_for_budget'      => $check_for_budget,
                                'lang_reserve' => lang('reserve'),
                                'value_reserve' => isset($values['reserve']) ? 
$values['reserve'] : '',
                                'lang_reserve_statustext' => lang('Enter the 
reserve'),

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2016-03-03 12:04:19 UTC (rev 
14805)
+++ trunk/property/templates/base/project.xsl   2016-03-04 09:24:57 UTC (rev 
14806)
@@ -373,11 +373,23 @@
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="php:function('lang', 'Enter the budget')"/>
                                                                </xsl:attribute>
-                                                               <xsl:if 
test="not(value_project_id &gt; 0)  and mode='edit'">
-                                                                       
<xsl:attribute name="data-validation">
-                                                                               
<xsl:text>required</xsl:text>
-                                                                       
</xsl:attribute>
-                                                               </xsl:if>
+                                                               <xsl:choose>
+                                                                       
<xsl:when  test="not(value_project_id &gt; 0) and mode='edit'">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       
</xsl:when>
+                                                                       
<xsl:when  test="value_project_id &gt; 0 and not(check_for_budget &gt; 0) and 
mode='edit'">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<xsl:attribute name="data-validation-optional">
+                                                                               
        <xsl:text>true</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
                                                        </input>
                                                        <xsl:text> </xsl:text> 
[ <xsl:value-of select="currency"/> ]
                                                        <select 
name="values[budget_year]">

Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang    2016-03-03 12:04:19 UTC (rev 14805)
+++ trunk/rental/setup/phpgw_no.lang    2016-03-04 09:24:57 UTC (rev 14806)
@@ -616,4 +616,4 @@
 new    rental  no      Ny
 download excel export bk       rental  no      Last ned Excel-eksport BK
 serial_number  rental  no      Serienummer
-Name or company is required    rental  no      Navn på person eller navn på 
foretak er obligatorisk
\ No newline at end of file
+Name or company is required    rental  no      Navn på person ELLER navn på 
foretak er obligatorisk
\ No newline at end of file




reply via email to

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