fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11373] check valid lenght of datainput


From: Sigurd Nes
Subject: [Fmsystem-commits] [11373] check valid lenght of datainput
Date: Tue, 15 Oct 2013 11:04:57 +0000

Revision: 11373
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11373
Author:   sigurdne
Date:     2013-10-15 11:04:52 +0000 (Tue, 15 Oct 2013)
Log Message:
-----------
check valid lenght of datainput

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.custom_fields.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/templates/base/attributes_form.xsl

Modified: trunk/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.custom_fields.inc.php      2013-10-15 10:28:41 UTC 
(rev 11372)
+++ trunk/phpgwapi/inc/class.custom_fields.inc.php      2013-10-15 11:04:52 UTC 
(rev 11373)
@@ -1127,6 +1127,7 @@
                                        'column_name'                   => 
$this->_db->f('column_name'),
                                        'name'                                  
=> $this->_db->f('column_name'),
                                        'size'                                  
=> $this->_db->f('size'),
+                                       'precision'                             
=> $this->_db->f('precision_'),
                                        'statustext'                    => 
$this->_db->f('statustext', true),
                                        'input_text'                    => 
$this->_db->f('input_text', true),
                                        'type_name'                             
=> $this->_db->f('type'),

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2013-10-15 10:28:41 UTC (rev 
11372)
+++ trunk/property/inc/class.uitts.inc.php      2013-10-15 11:04:52 UTC (rev 
11373)
@@ -1810,6 +1810,29 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location - or an 
entity!'));
                                }
 
+                               if(isset($values_attribute) && 
is_array($values_attribute))
+                               {
+                                       foreach ($values_attribute as 
&$attribute )
+                                       {
+                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'I' && ! 
ctype_digit($attribute['value']))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter integer for attribute %1', 
$attribute['input_text']));                                              
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'V' && 
strlen($attribute['value']) > $attribute['precision'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Max length for attribute %1 is: %2', 
"\"{$attribute['input_text']}\"",$attribute['precision']));
+                                                       $attribute['value'] = 
substr($attribute['value'],0,$attribute['precision']);
+                                               }
+                                       }
+                               }
+
+
                                if(!$values['assignedto'] && 
!$values['group_id'])
                                {
                                        $_responsible = 
execMethod('property.boresponsible.get_responsible', $values);
@@ -2346,6 +2369,29 @@
                                        
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
                                }
 
+                               if(isset($values_attribute) && 
is_array($values_attribute))
+                               {
+                                       foreach ($values_attribute as 
&$attribute )
+                                       {
+                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'I' && ! 
ctype_digit($attribute['value']))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter integer for attribute %1', 
$attribute['input_text']));                                              
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'V' && 
strlen($attribute['value']) > $attribute['precision'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Max length for attribute %1 is: %2', 
$attribute['input_text'],$attribute['precision']));
+                                                       $attribute['value'] = 
substr($attribute['value'],0,$attribute['precision']);
+                                               }
+                                       }
+                               }
+
+
                                if($access_order)
                                {
                                        if((isset($values['order_id']) && 
$values['order_id']) && (!isset($values['budget']) || !$values['budget']) )

Modified: trunk/property/templates/base/attributes_form.xsl
===================================================================
--- trunk/property/templates/base/attributes_form.xsl   2013-10-15 10:28:41 UTC 
(rev 11372)
+++ trunk/property/templates/base/attributes_form.xsl   2013-10-15 11:04:52 UTC 
(rev 11373)
@@ -80,6 +80,7 @@
                                        <xsl:when test="name!=''">
                                                <input type="hidden" 
name="values_attribute[{counter}][name]" value="{name}"/>
                                                <input type="hidden" 
name="values_attribute[{counter}][datatype]" value="{datatype}"/>
+                                               <input type="hidden" 
name="values_attribute[{counter}][precision]" value="{precision}"/>
                                                <input type="hidden" 
name="values_attribute[{counter}][history]" value="{history}"/>
                                                <input type="hidden" 
name="values_attribute[{counter}][attrib_id]" value="{id}"/>
                                                <input type="hidden" 
name="values_attribute[{counter}][nullable]" value="{nullable}"/>




reply via email to

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