fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11999] bkbooking: stavanger update


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [11999] bkbooking: stavanger update
Date: Tue, 03 Jun 2014 09:12:06 +0000

Revision: 11999
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11999
Author:   kjell
Date:     2014-06-03 09:12:04 +0000 (Tue, 03 Jun 2014)
Log Message:
-----------
bkbooking: stavanger update

Modified Paths:
--------------
    branches/stavangerkommune/booking/inc/class.uiapplication.inc.php

Modified: branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiapplication.inc.php   
2014-06-02 13:16:42 UTC (rev 11998)
+++ branches/stavangerkommune/booking/inc/class.uiapplication.inc.php   
2014-06-03 09:12:04 UTC (rev 11999)
@@ -5,7 +5,8 @@
        class booking_uiapplication extends booking_uicommon
        {
                const COMMENT_TYPE_OWNERSHIP='ownership';
-               
+        const ORGNR_SESSION_KEY = 'orgnr';
+
                public $public_functions = array
                (
                        'index'                 =>      true,
@@ -16,11 +17,14 @@
                        'toggle_show_inactive'  =>      true,
                );
                
-               protected $customer_id;
+               protected $customer_id,
+                  $default_module = 'bookingfrontend',
+                  $module;
 
                public function __construct()
                {
                        parent::__construct();
+            $this->set_module();
                        self::process_booking_unauthorized_exceptions();
                        $this->bo = CreateObject('booking.boapplication');
                        $this->customer_id = 
CreateObject('booking.customer_identifier');
@@ -30,6 +34,7 @@
                        $this->assoc_bo = new 
booking_boapplication_association();
                        $this->agegroup_bo = CreateObject('booking.boagegroup');
                        $this->resource_bo = CreateObject('booking.boresource');
+            $this->organization_bo = CreateObject('booking.boorganization');
                        $this->document_bo = 
CreateObject('booking.bodocument_building');
                        self::set_active_menu('booking::applications');
                        $this->fields = array('description', 'equipment', 
'resources', 'activity_id',
@@ -37,7 +42,17 @@
                                                                  
'contact_email', 'contact_phone', 'audience',
                                                                  'active', 
'accepted_documents');
                }
-               
+
+        protected function set_module($module = null)
+        {
+            $this->module = is_string($module) ? $module : 
$this->default_module;
+        }
+
+        public function get_module()
+        {
+            return $this->module;
+        }
+
                protected function is_assigned_to_current_user(&$application) {
                        $current_account_id = $this->current_account_id();
                        if (empty($current_account_id) || 
!isset($application['case_officer_id'])) { return false; }
@@ -439,7 +454,8 @@
                {
             $config    = CreateObject('phpgwapi.config','booking');
                        $config->read();
-                       $application_text = $config->config_data;
+            $orgnr = phpgwapi_cache::session_get($this->module, 
self::ORGNR_SESSION_KEY);
+
                        $errors = array();
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
@@ -551,6 +567,21 @@
                        $audience = $audience['results'];
                        $this->install_customer_identifier_ui($application);
                        $application['customer_identifier_types']['ssn'] = 
'Date of birth or SSN';
+            if ($orgnr) {
+                $application['customer_identifier_type'] = 
'organization_number';
+                $application['customer_organization_number'] = $orgnr;
+                $orgid = $this->organization_bo->so->get_orgid($orgnr);
+                $organization = $this->organization_bo->read_single($orgid);
+                if ($organization['contacts'][0]['name'] != '') {
+                    $application['contact_name'] = 
$organization['contacts'][0]['name'];
+                    $application['contact_email'] = 
$organization['contacts'][0]['email'];
+                    $application['contact_phone'] = 
$organization['contacts'][0]['phone'];
+                } else {
+                    $application['contact_name'] = 
$organization['contacts'][1]['name'];
+                    $application['contact_email'] = 
$organization['contacts'][1]['email'];
+                    $application['contact_phone'] = 
$organization['contacts'][1]['phone'];
+                }
+            }
                        self::render_template('application_new', 
array('application' => $application, 'activities' => $activities, 'agegroups' 
=> $agegroups, 'audience' => $audience,'config' => $application_text));
                }
 




reply via email to

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