phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.uientity.inc.php class.uiact...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.uientity.inc.php class.uiact...
Date: Sat, 07 Oct 2006 15:44:07 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   06/10/07 15:44:07

Modified files:
        inc            : class.uientity.inc.php class.uiactor.inc.php 
                         class.bocommon.inc.php 

Log message:
        preserve values for custom attributes in case of posting wtih errors

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uientity.inc.php?cvsroot=phpgroupware&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uiactor.inc.php?cvsroot=phpgroupware&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.bocommon.inc.php?cvsroot=phpgroupware&r1=1.45&r2=1.46

Patches:
Index: class.uientity.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uientity.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- class.uientity.inc.php      6 Oct 2006 12:23:22 -0000       1.30
+++ class.uientity.inc.php      7 Oct 2006 15:44:07 -0000       1.31
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage entity
-       * @version $Id: class.uientity.inc.php,v 1.30 2006/10/06 12:23:22 
sigurdne Exp $
+       * @version $Id: class.uientity.inc.php,v 1.31 2006/10/07 15:44:07 
sigurdne Exp $
        */
 
        /**
@@ -765,31 +765,12 @@
                                        $values = 
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
                                }
 
+                       }
+
                                /* Preserve attribute values from post */
                                if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
                                {
-                                       foreach ( $values_attribute as $key => 
$attribute )
-                                       {       
-                                               for 
($i=0;$i<count($values['attributes']);$i++)
-                                               {
-                                                       
if($values['attributes'][$i]['attrib_id'] == $attribute['attrib_id'])
-                                                       {
-                                                               
$values['attributes'][$i]['value'] = $attribute['value'];
-                                                               
-                                                               
if(isset($values['attributes'][$i]['choice']) && 
is_array($values['attributes'][$i]['choice']))
-                                                               {
-                                                                       for 
($j=0;$j<count($values['attributes'][$i]['choice']);$j++)
-                                                                       {
-                                                                               
if($values['attributes'][$i]['choice'][$j]['id'] == $attribute['value'])
-                                                                               
{
-                                                                               
        $values['attributes'][$i]['choice'][$j]['checked'] = 'checked'; 
-                                                                               
}
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
+                               $values = 
$this->bocommon->preserve_attribute_values($values,$values_attribute);
                        }
 
                        $lookup_type='form';

Index: class.uiactor.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uiactor.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- class.uiactor.inc.php       5 Oct 2006 11:33:53 -0000       1.21
+++ class.uiactor.inc.php       7 Oct 2006 15:44:07 -0000       1.22
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.uiactor.inc.php,v 1.21 2006/10/05 11:33:53 
sigurdne Exp $
+       * @version $Id: class.uiactor.inc.php,v 1.22 2006/10/07 15:44:07 
sigurdne Exp $
        */
 
        /**
@@ -429,6 +429,12 @@
 
                        $actor = 
$this->bo->read_single(array('actor_id'=>$actor_id));
 
+                       /* Preserve attribute values from post */
+                       if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
+                       {
+                               $actor = 
$this->bocommon->preserve_attribute_values($actor,$values_attribute);
+                       }
+
                        if ($actor_id)
                        {
                                $this->cat_id = 
($actor['cat_id']?$actor['cat_id']:$this->cat_id);

Index: class.bocommon.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- class.bocommon.inc.php      6 Oct 2006 13:07:07 -0000       1.45
+++ class.bocommon.inc.php      7 Oct 2006 15:44:07 -0000       1.46
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.bocommon.inc.php,v 1.45 2006/10/06 13:07:07 
sigurdne Exp $
+       * @version $Id: class.bocommon.inc.php,v 1.46 2006/10/07 15:44:07 
sigurdne Exp $
        */
 
        /**
@@ -1401,5 +1401,39 @@
                {
                        return $this->socommon->active_group_members($group_id);
                }
+               
+               /**
+               * Preserve attribute values from post in case of an error
+               *
+               * @param array $values_attribute attribute definition and 
values from posting
+               * @param array $values value set with 
+               * @return array Array with attribute definition and values
+               */
+               function preserve_attribute_values($values,$values_attribute)
+               {
+                       foreach ( $values_attribute as $key => $attribute )
+                       {       
+                               for ($i=0;$i<count($values['attributes']);$i++)
+                               {
+                                       
if($values['attributes'][$i]['attrib_id'] == $attribute['attrib_id'])
+                                       {
+                                               
$values['attributes'][$i]['value'] = $attribute['value'];
+
+                                               
if(isset($values['attributes'][$i]['choice']) && 
is_array($values['attributes'][$i]['choice']))
+                                               {
+                                                       for 
($j=0;$j<count($values['attributes'][$i]['choice']);$j++)
+                                                       {
+                                                               
if($values['attributes'][$i]['choice'][$j]['id'] == $attribute['value'])
+                                                               {
+                                                                       
$values['attributes'][$i]['choice'][$j]['checked'] = 'checked'; 
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       
+                       return $values;
+               }
        }
 ?>




reply via email to

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