fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6696] bkbooking: bugfix events error checking


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [6696] bkbooking: bugfix events error checking
Date: Wed, 22 Dec 2010 15:12:30 +0000

Revision: 6696
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6696
Author:   kjell
Date:     2010-12-22 15:12:28 +0000 (Wed, 22 Dec 2010)
Log Message:
-----------
bkbooking: bugfix events error checking

Modified Paths:
--------------
    trunk/booking/inc/class.uievent.inc.php
    trunk/booking/inc/class.uiorganization.inc.php
    trunk/booking/templates/base/event_new.xsl

Modified: trunk/booking/inc/class.uievent.inc.php
===================================================================
--- trunk/booking/inc/class.uievent.inc.php     2010-12-22 11:23:08 UTC (rev 
6695)
+++ trunk/booking/inc/class.uievent.inc.php     2010-12-22 15:12:28 UTC (rev 
6696)
@@ -270,32 +270,10 @@
                                $event['secret'] = $this->generate_secret();
                                $event['is_public'] = 1;
                                $event['building_name'] = 
$_POST['building_name'];
-                               
-                               if ($_POST['organization_name']) {
-                                       $event['customer_organization_name'] = 
$_POST['organization_name'];
-                                       $event['customer_organization_id'] = 
$_POST['organization_id'];
-                                       $organization = 
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id', 
'POST')));
-                                       if ($organization['customer_internal'] 
== 0) {                                  
-                                               
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
-                                               $event['customer_internal'] = 
$organization['customer_internal'];
-                                               if 
(strlen($organization['customer_organization_number']) == 9) {
-                                                       
$event['customer_organization_number'] = 
$organization['customer_organization_number'];
-                                               } else {
-                                                       
$errors['organization_number'] = lang('The organization number is wrong or not 
present');
-                                               }
-                                       } else {
-                                               
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
-                                               $event['customer_internal'] = 
$organization['customer_internal'];
-                                               if 
(strlen($organization['customer_number']) == 5) {
-                                                       
$event['customer_organization_number'] = $organization['customer_number'];
-                                               } else {
-                                                       
$errors['resource_number'] = lang('The resource number is wrong or not 
present');
-                                               }
-                                       }
-                               } 
 
                                if (!$_POST['application_id'])
                                {
+                    $temp_errors = array();
                                        foreach( $event['dates'] as $checkdate) 
                        
                                        {
                                                $event['from_'] = 
$checkdate['from_'];
@@ -312,7 +290,11 @@
                                                                $errors['time'] 
= lang('Time is set wrong');
                                                        }
                                                }  
+                        if ($errors != array()) {
+                            $temp_errors = $errors;
+                        }
                                        }                                       
        
+                    $errors = $temp_errors;
                                }
                                else
                                {
@@ -326,11 +308,33 @@
                                                }
                                        }  
                                }
+                               if ($_POST['organization_name']) {
+                                       $event['customer_organization_name'] = 
$_POST['organization_name'];
+                                       $event['customer_organization_id'] = 
$_POST['organization_id'];
+                                       $organization = 
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id', 
'POST')));
+                                       if ($organization['customer_internal'] 
== 0) {
+                                               
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
+                                               $event['customer_internal'] = 
$organization['customer_internal'];
+                                               if 
(strlen($organization['customer_organization_number']) == 9) {
+                                                       
$event['customer_organization_number'] = 
$organization['customer_organization_number'];
+                                               } else {
+                                                       
$errors['organization_number'] = lang('The organization number is wrong or not 
present');
+                                               }
+                                       } else {
+                                               
$event['customer_identifier_type'] = 'organization_number';
+                                               $event['customer_internal'] = 
$organization['customer_internal'];
+                                               if 
(strlen($organization['customer_number']) == 5) {
+                                                       
$event['customer_organization_number'] = $organization['customer_number'];
+                                               } else {
+                                                       
$errors['resource_number'] = lang('The resource number is wrong or not 
present');
+                                               }
+                                       }
+                               } 
+
                                if ($_POST['cost'] != 0 and 
!$event['customer_organization_number'] and !$event['customer_ssn']) {
                                        $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
                                } 
-
-                               if(!$errors['event'] && !$errors['time'] && 
!$errors['invoice_data'] && !$errors['resource_number'] && 
!$errors['organization_number'])
+                               if(!$errors['event'] && !$errors['from_'] && 
!$errors['time'] && !$errors['invoice_data'] && !$errors['resource_number'] && 
!$errors['organization_number'])
                                {
                                        if (!$_POST['application_id'])
                                        {
@@ -366,7 +370,6 @@
                                        $this->redirect(array('menuaction' => 
'booking.uievent.edit', 'id'=>$receipt['id'], 'secret'=>$event['secret'], 
'warnings'=>$errors));
                                }
                        }
-
                        $default_dates = array_map(array(self, 
'_combine_dates'), '','');
                        array_set_default($event, 'dates', $default_dates);
 
@@ -459,7 +462,7 @@
                                                        
$errors['organization_number'] = lang('The organization number is wrong or not 
present');
                                                }
                                        } else {
-                                               
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
+                                               
$event['customer_identifier_type'] = 'organization_number';
                                                $event['customer_internal'] = 
$organization['customer_internal'];
                                                if 
(strlen($organization['customer_number']) == 5) {
                                                        
$event['customer_organization_number'] = $organization['customer_number'];

Modified: trunk/booking/inc/class.uiorganization.inc.php
===================================================================
--- trunk/booking/inc/class.uiorganization.inc.php      2010-12-22 11:23:08 UTC 
(rev 6695)
+++ trunk/booking/inc/class.uiorganization.inc.php      2010-12-22 15:12:28 UTC 
(rev 6696)
@@ -97,6 +97,10 @@
                                                        'label' => 
lang('Organization shortname'),
                                                ),
                                                array(
+                                                       'key' => 
'customer_number',
+                                                       'label' => 
lang('Customer number')
+                                               ),
+                                               array(
                                                        'key' => 
'organization_number',
                                                        'label' => 
lang('Organization number')
                                                ),

Modified: trunk/booking/templates/base/event_new.xsl
===================================================================
--- trunk/booking/templates/base/event_new.xsl  2010-12-22 11:23:08 UTC (rev 
6695)
+++ trunk/booking/templates/base/event_new.xsl  2010-12-22 15:12:28 UTC (rev 
6696)
@@ -173,7 +173,7 @@
                         <xsl:attribute name="value"><xsl:value-of 
select="event/organization_id"/></xsl:attribute>
                     </input>
                     <input id="field_org_name" name="organization_name" 
type="text">
-                        <xsl:attribute name="value"><xsl:value-of 
select="event/organization_name"/></xsl:attribute>
+                        <xsl:attribute name="value"><xsl:value-of 
select="event/customer_organization_name"/></xsl:attribute>
                     </input>
                     <div id="org_container"/>
                 </div>




reply via email to

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