fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7133] bkbooking: updated booking


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [7133] bkbooking: updated booking
Date: Tue, 22 Mar 2011 16:03:57 +0000

Revision: 7133
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7133
Author:   kjell
Date:     2011-03-22 16:03:56 +0000 (Tue, 22 Mar 2011)
Log Message:
-----------
bkbooking: updated booking

Modified Paths:
--------------
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/inc/class.uibooking.inc.php
    trunk/booking/inc/class.uievent.inc.php
    trunk/booking/jasper/templates/application.jrxml
    trunk/booking/setup/phpgw_no.lang
    trunk/booking/templates/base/booking_new_preview.xsl

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2011-03-21 19:58:47 UTC 
(rev 7132)
+++ trunk/booking/inc/class.uiallocation.inc.php        2011-03-22 16:03:56 UTC 
(rev 7133)
@@ -151,7 +151,7 @@
 
                                $errors = $this->bo->validate($allocation);
 
-                               if (!$errors)
+                               if (!$errors['booking'] && 
!$errors['season_boundary'])
                                {
                                        $step++;
                                }
@@ -164,7 +164,7 @@
                                                $errors['global'] = lang('Could 
not add object due to insufficient permissions');
                                        }
                                }
-                               else if ($_POST['outseason'] == 'on' && 
!$errors && $step > 1)
+                               else if ($_POST['outseason'] == 'on' && 
!$errors['booking'] && !$errors['season_boundary'] && $step > 1)
                                {
 
                                        $repeat_until = 
strtotime($season['to_'])+60*60*24; 
@@ -228,7 +228,7 @@
                        $allocation['resources_json'] = 
json_encode(array_map('intval', $allocation['resources']));
                        $allocation['cancel_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.index'));
                        array_set_default($allocation, 'cost', '0');
-               
+
                        if ($step < 2) 
                        {
                                if($_SERVER['REQUEST_METHOD'] == 'POST' && 
$errors) {                           

Modified: trunk/booking/inc/class.uibooking.inc.php
===================================================================
--- trunk/booking/inc/class.uibooking.inc.php   2011-03-21 19:58:47 UTC (rev 
7132)
+++ trunk/booking/inc/class.uibooking.inc.php   2011-03-22 16:03:56 UTC (rev 
7133)
@@ -192,9 +192,11 @@
                        $time_to =      split(" ",phpgw::get_var('to_', 'str', 
'GET'));
                        $step = phpgw::get_var('step', 'str', 'POST');
                        if (! isset($step)) $step = 1;
+                       if (! isset($noallocation)) $noallocation = 1;
                        $invalid_dates = array();
                        $valid_dates = array();
 
+
                        if(isset($allocation_id))
                        {
                                $allocation = 
$this->allocation_bo->read_single($allocation_id);
@@ -207,7 +209,10 @@
                                $booking['organization_id'] = 
$allocation['organization_id'];
                                $booking['organization_name'] = 
$allocation['organization_name'];
                        } else {
-                               $season = 
$this->season_bo->read_single($_POST['season_id']);
+                               $season = 
$this->season_bo->read_single($_POST['season_id']);
+                               $booking['organization_id'] = 
$_POST['organization_id'];
+                               $booking['organization_name'] = 
$_POST['organization_name'];
+                $noallocation = 1;
             }
 
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
@@ -235,7 +240,6 @@
 
                                $errors = $this->bo->validate($booking);
 
-
 #                              if (strtotime($_POST['from_']) < $today[0])
 #                              {
 #                                      if($_POST['recurring'] == 'on' || 
$_POST['outseason'] == 'on')
@@ -252,17 +256,37 @@
                                        $errors['booking'] = lang('This booking 
is not connected to a season');
                                }       
 
-                               if (!$errors)
+                               if (!$errors['booking'] && 
!$errors['season_boundary'])
                                {
                                        $step++;
                                }
 
                                if (!$errors && $_POST['recurring'] != 'on' && 
$_POST['outseason'] != 'on' )
                                {
-                                       $receipt = $this->bo->add($booking);
+                    if( isset($noallocation)) {
+                        $allocation['resources'] = $booking['resources'];
+                        $allocation['cost'] = $booking['cost'];
+                        $allocation['building_id'] = $booking['building_id'];
+                        $allocation['building_name'] = 
$booking['building_name'];
+                        $allocation['season_id'] = $booking['season_id'];
+                        $allocation['organization_id'] = 
$booking['organization_id'];
+                        $allocation['organization_name'] = 
$booking['organization_name'];
+                        $allocation['from_'] = $booking['from_'];
+                        $allocation['to_'] = $booking['to_'];
+                                       $allocation['active'] = '1';
+                                       $allocation['completed'] = '0';
+                        $receipt = $this->allocation_bo->add($allocation);
+                        $booking['allocation_id'] = $receipt['id'];
+                        $booking['secret'] = $this->generate_secret();
+                        $receipt = $this->bo->add($booking);
+                    } else {
+                        $booking['secret'] = $this->generate_secret();
+                        $receipt = $this->bo->add($booking);
+                    }
+
                                        $this->redirect(array('menuaction' => 
'booking.uimassbooking.schedule', 'id'=>$booking['building_id']));
                                }
-                               else if ( ($_POST['recurring'] == 'on' || 
$_POST['outseason'] == 'on')  && !$errors && $step > 1)
+                               else if ( ($_POST['recurring'] == 'on' || 
$_POST['outseason'] == 'on')  && !$errors['booking'] && 
!$errors['season_boundary'] && $step > 1)
                                {
                                        if ($_POST['recurring'] == 'on') {
                                                $repeat_until = 
strtotime($_POST['repeat_until'])+60*60*24; 
@@ -284,7 +308,9 @@
                                                $todate = date('Y-m-d H:i', 
strtotime($_POST['to_']) + ($interval*$i));
                                                $booking['from_'] = $fromdate;
                                                $booking['to_'] = $todate;
+
                                                $err = 
$this->bo->validate($booking);
+
                                                if ($err) 
                                                {
                                                        
$invalid_dates[$i]['from_'] = $fromdate;
@@ -296,8 +322,27 @@
                                                        $valid_dates[$i]['to_'] 
= $todate;
                                                        if ($step == 3)
                                                        {
-                                                               
$booking['secret'] = $this->generate_secret();
-                                                               $receipt = 
$this->bo->add($booking);
+                                if( isset($noallocation)) {
+                                    $allocation['resources'] = 
$booking['resources'];
+                                    $allocation['cost'] = $booking['cost'];
+                                    $allocation['building_id'] = 
$booking['building_id'];
+                                    $allocation['building_name'] = 
$booking['building_name'];
+                                    $allocation['season_id'] = 
$booking['season_id'];
+                                    $allocation['organization_id'] = 
$booking['organization_id'];
+                                    $allocation['organization_name'] = 
$booking['organization_name'];
+                                    $allocation['from_'] = $booking['from_'];
+                                    $allocation['to_'] = $booking['to_'];
+                                                       $allocation['active'] = 
'1';
+                                               $allocation['completed'] = '0';
+                                    $receipt = 
$this->allocation_bo->add($allocation);
+                                    $booking['allocation_id'] = $receipt['id'];
+                                                               
$booking['secret'] = $this->generate_secret();
+                                                               $receipt = 
$this->bo->add($booking);
+                                    $booking['allocation_id'] = '';
+                                } else {
+                                                               
$booking['secret'] = $this->generate_secret();
+                                                               $receipt = 
$this->bo->add($booking);
+                                }
                                                        }
                                                }
                                                $i++;
@@ -324,11 +369,7 @@
                        $groups = $groups['results'];
 
                        $resouces_full = 
$this->resource_bo->so->read(array('filters'=>array('id'=>$booking['resources']),
 'sort'=>'name'));
-                       $res_names = array();
-                       foreach($resouces_full['results'] as $res)
-                       {
-                               $res_names[] = array('id' => $res['id'],'name' 
=> $res['name']);
-                       }
+
                        if ($step < 2) 
                        {
                                self::render_template('booking_new', 
array('booking' => $booking, 
@@ -343,7 +384,7 @@
                                        'outseason' => $_POST['outseason'],
                                        'date_from' => $time_from[0],
                                        'date_to' => $time_to[0],
-                                       'res_names' => $res_names)
+                    'noallocation' => $noallocation)
                                );
                        } 
                        else if ($step == 2) 
@@ -361,7 +402,8 @@
                                        'to_date' => $_POST['to_'],
                                        'valid_dates' => $valid_dates,
                                        'invalid_dates' => $invalid_dates,
-                                       'groups' => $groups)
+                                       'groups' => $groups,
+                    'noallocation' => $noallocation)
                                );
                        }
                }

Modified: trunk/booking/inc/class.uievent.inc.php
===================================================================
--- trunk/booking/inc/class.uievent.inc.php     2011-03-21 19:58:47 UTC (rev 
7132)
+++ trunk/booking/inc/class.uievent.inc.php     2011-03-22 16:03:56 UTC (rev 
7133)
@@ -71,9 +71,13 @@
                                        'source' => 
self::link(array('menuaction' => 'booking.uievent.index', 'phpgw_return_as' => 
'json')),
                                        'field' => array(
                                                array(
+                                                       'key' => 'id',
+                                                       'label' => lang('ID'),
+                                                       'formatter' => 
'YAHOO.booking.formatLink'
+                                               ),
+                                               array(
                                                        'key' => 'description',
                                                        'label' => 
lang('Event'),
-                                                       'formatter' => 
'YAHOO.booking.formatLink'
                                                ),
                                                array(
                                                        'key' => 
'activity_name',
@@ -372,6 +376,9 @@
                                        $this->redirect(array('menuaction' => 
'booking.uievent.edit', 'id'=>$receipt['id'], 'secret'=>$event['secret'], 
'warnings'=>$errors));
                                }
                        }
+            if ($errors['event']) {
+                $errors['warning'] = lang('NB! No data will be saved, if you 
navigate away you will loose all.'); 
+            }
                        $default_dates = array_map(array(self, 
'_combine_dates'), '','');
                        array_set_default($event, 'dates', $default_dates);
 

Modified: trunk/booking/jasper/templates/application.jrxml
===================================================================
--- trunk/booking/jasper/templates/application.jrxml    2011-03-21 19:58:47 UTC 
(rev 7132)
+++ trunk/booking/jasper/templates/application.jrxml    2011-03-22 16:03:56 UTC 
(rev 7133)
@@ -2,7 +2,7 @@
 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports 
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; name="report1" 
language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" 
leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
        <property name="ireport.zoom" value="0.9090909090909091"/>
        <property name="ireport.x" value="0"/>
-       <property name="ireport.y" value="478"/>
+       <property name="ireport.y" value="384"/>
        <property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
        <property name="net.sf.jasperreports.export.pdf.tag.language" 
value="EN-US"/>
        <style name="table">
@@ -20,11 +20,11 @@
                        <pen lineWidth="0.5" lineColor="#000000"/>
                </box>
        </style>
-       <style name="headers" isDefault="false" forecolor="#808080" 
fontName="Serif" fontSize="14"/>
+       <style name="headers" forecolor="#808080" fontName="Serif" 
fontSize="14"/>
        <style name="Sans_Normal" isDefault="true" fontName="Serif" 
fontSize="10" isBold="false" isItalic="false" isUnderline="false" 
isStrikeThrough="false"/>
-       <style name="Sans_Bold" isDefault="false" fontName="Serif" 
fontSize="10" isBold="true" isItalic="false" isUnderline="false" 
isStrikeThrough="false"/>
-       <style name="Sans_Italic" isDefault="false" fontName="Serif" 
fontSize="10" isBold="false" isItalic="true" isUnderline="false" 
isStrikeThrough="false"/>
-       <style name="Sans_Bold_Italic" isDefault="false" fontName="Serif" 
fontSize="10" isBold="true" isItalic="true" isUnderline="false" 
isStrikeThrough="false"/>
+       <style name="Sans_Bold" fontName="Serif" fontSize="10" isBold="true" 
isItalic="false" isUnderline="false" isStrikeThrough="false"/>
+       <style name="Sans_Italic" fontName="Serif" fontSize="10" isBold="false" 
isItalic="true" isUnderline="false" isStrikeThrough="false"/>
+       <style name="Sans_Bold_Italic" fontName="Serif" fontSize="10" 
isBold="true" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
        <subDataset name="resources">
                <parameter name="APPLICATION_ID" class="java.lang.Integer"/>
                <queryString>
@@ -212,7 +212,7 @@
                                <textElement>
                                        <font pdfFontName="Helvetica" 
isPdfEmbedded="true"/>
                                </textElement>
-                               <textFieldExpression 
class="java.lang.String"><![CDATA["Status: " + ( $F{application_status} == 
"CONFIRMED" ? "Bekreftet" : $F{application_status} )]]></textFieldExpression>
+                               <textFieldExpression 
class="java.lang.String"><![CDATA["Status: " + ( $F{application_status} == 
"ACCEPTED" ? "Bekreftet" : $F{application_status} )]]></textFieldExpression>
                        </textField>
                        <textField>
                                <reportElement x="84" y="326" width="455" 
height="13"/>
@@ -322,11 +322,6 @@
                                        </jr:column>
                                </jr:table>
                        </componentElement>
-                       <textField>
-                               <reportElement style="Sans_Normal" x="244" 
y="79" width="197" height="13"/>
-                               <textElement/>
-                               <textFieldExpression 
class="java.lang.String"><![CDATA["E-post: " + 
$F{contact_email}]]></textFieldExpression>
-                       </textField>
                </band>
                <band height="306">
                        <elementGroup>

Modified: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang   2011-03-21 19:58:47 UTC (rev 7132)
+++ trunk/booking/setup/phpgw_no.lang   2011-03-22 16:03:56 UTC (rev 7133)
@@ -488,3 +488,4 @@
 Allocations  with existing allocations or bookings (%1)        booking no      
Tildeinger med eksisterende tildelinger eller bookinger (%1)
 Contact information name is to long. max 50 characters booking no      Navn i 
kontakt informasjon er for langt. Maks 50 tegn
 Show in portal booking no      Vis i portal
+NB! No data will be saved, if you navigate away you will loose all.    booking 
no      NB! Ingen data er lagret, viss du navigerer vekk så mister du alt.

Modified: trunk/booking/templates/base/booking_new_preview.xsl
===================================================================
--- trunk/booking/templates/base/booking_new_preview.xsl        2011-03-21 
19:58:47 UTC (rev 7132)
+++ trunk/booking/templates/base/booking_new_preview.xsl        2011-03-22 
16:03:56 UTC (rev 7133)
@@ -13,7 +13,10 @@
                        <input type="hidden" name="season_id" 
value="{booking/season_id}"/>
                        <input type="hidden" name="building_id" 
value="{booking/building_id}"/>
                        <input type="hidden" name="building_name" 
value="{booking/building_name}"/>
+                       <input type="hidden" name="organization_id" 
value="{booking/organization_id}"/>
+                       <input type="hidden" name="organization_name" 
value="{booking/organization_name}"/>
                        <input type="hidden" name="allocation_id" 
value="{booking/allocation_id}"/>
+                       <input type="hidden" name="noallocation" 
value="{noallocation}" />
                        <input type="hidden" name="step" value="{step}" />
                        <input type="hidden" name="from_" value="{from_date}" />
                        <input type="hidden" name="to_" value="{to_date}" />




reply via email to

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