fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7223] Merge 7218:7222 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7223] Merge 7218:7222 from trunk
Date: Fri, 15 Apr 2011 11:03:32 +0000

Revision: 7223
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7223
Author:   sigurdne
Date:     2011-04-15 11:03:32 +0000 (Fri, 15 Apr 2011)
Log Message:
-----------
Merge 7218:7222 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
    branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
    branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
    branches/Version-1_0-branch/booking/setup/phpgw_no.lang
    branches/Version-1_0-branch/booking/templates/base/allocation.xsl
    branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl
    branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php

Added Paths:
-----------
    branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl
    
branches/Version-1_0-branch/booking/templates/base/allocation_delete_preview.xsl

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222

Modified: branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php  
2011-04-15 11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php  
2011-04-15 11:03:32 UTC (rev 7223)
@@ -220,9 +220,52 @@
                        }
                        return $results;
                }
+               function get_allocation_id($allocation)
+               {
 
-               public function update_id_string() {
+            $from = "'".$allocation['from_']."'";
+            $to = "'".$allocation['to_']."'";
+            $org_id = $allocation['organization_id'];
+            $season_id = $allocation['season_id'];
+            $resources = implode(",", $allocation['resources']);
+
+            $sql = "SELECT id FROM bb_allocation ba2 WHERE ba2.from_ = ($from) 
AND ba2.to_ = ($to) AND ba2.organization_id = ($org_id) AND ba2.season_id = 
($season_id) AND EXISTS ( SELECT 1 FROM bb_allocation  a,bb_allocation_resource 
b WHERE a.id = b.allocation_id AND b.resource_id IN ($resources))";
+
+                       $this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('id', false);
+        }
+
+               function check_for_booking($id)
+        {
+            $sql = "SELECT id FROM bb_booking  WHERE allocation_id = ($id)";
+
+                       $this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('id', false);
+            
+        }
+
+               public function delete_allocation($id)
+        {
+                       $db = $this->db;
+                       $table_name = $this->table_name.'_resource';
+                       $sql = "DELETE FROM $table_name WHERE allocation_id = 
($id)";
+                       $db->query($sql, __LINE__, __FILE__);
                        $table_name = $this->table_name;
+                       $sql = "DELETE FROM $table_name WHERE id = ($id)";
+                       $db->query($sql, __LINE__, __FILE__);
+               }
+
+               public function update_id_string() 
+        {
+                       $table_name = $this->table_name;
                        $db = $this->db;
                        $sql = "UPDATE $table_name SET id_string = cast(id AS 
varchar)";
                        $db->query($sql, __LINE__, __FILE__);

Modified: branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php  
2011-04-15 11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php  
2011-04-15 11:03:32 UTC (rev 7223)
@@ -10,6 +10,7 @@
                        'add'                   =>      true,
                        'show'                  =>      true,
                        'edit'                  =>      true,
+                       'delete'                        =>      true,
                        'info'                  =>      true,
                        'toggle_show_inactive'  =>      true,
                );
@@ -373,11 +374,115 @@
                        $allocation['application_link'] = 
self::link(array('menuaction' => 'booking.uiapplication.show', 'id' => 
$allocation['application_id']));
                        self::render_template('allocation_edit', 
array('allocation' => $allocation));
                }
+
+               public function delete()
+               {
+                       $id = intval(phpgw::get_var('allocation_id', 'GET'));
+                       $allocation = $this->bo->read_single($id);
+               $season = 
$this->season_bo->read_single($allocation['season_id']);
+                       $step = phpgw::get_var('step', 'str', 'POST');
+               if (! isset($step)) $step = 1;
+            $errors = array();
+                       $invalid_dates = array();
+                       $valid_dates = array();
+
+
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               $from_date = $_POST['from_'];
+                               $to_date = $_POST['to_'];
+                $step++;
+
+                               if ($_POST['recurring'] != 'on' && 
$_POST['outseason'] != 'on' )
+                {
+                    $err  = $this->bo->so->check_for_booking($id);
+                    if ($err)
+                    {
+                           $errors['booking'] = lang('Could not delete 
allocation due to a booking still use it');
+                    }
+                    else
+                    {
+                        $err = $this->bo->so->delete_allocation($id);
+                        $this->redirect(array('menuaction' => 
'booking.uimassbooking.schedule', 'id'=>$allocation['building_id']));
+                    }
+                } 
+                else
+                { 
+                                       if ($_POST['recurring'] == 'on') {
+                                               $repeat_until = 
strtotime($_POST['repeat_until'])+60*60*24; 
+                                       } 
+                                       else
+                                       {
+                                               $repeat_until = 
strtotime($season['to_'])+60*60*24; 
+                                               $_POST['repeat_until'] = 
$season['to_'];
+                                       } 
+
+                                       $max_dato = strtotime($_POST['to_']); 
// highest date from input
+                                       $interval = 
$_POST['field_interval']*60*60*24*7; // weeks in seconds
+                                       $i = 0;
+                                       // calculating valid and invalid dates 
from the first booking's to-date to the repeat_until date is reached
+                                       // the form from step 1 should validate 
and if we encounter any errors they are caused by double bookings.
+                                       while (($max_dato+($interval*$i)) <= 
$repeat_until)
+                                       {
+                                               $fromdate = date('Y-m-d H:i', 
strtotime($_POST['from_']) + ($interval*$i));
+                                               $todate = date('Y-m-d H:i', 
strtotime($_POST['to_']) + ($interval*$i));
+                                               $allocation['from_'] = 
$fromdate;
+                                               $allocation['to_'] = $todate;
+
+                        $id = $this->bo->so->get_allocation_id($allocation);   
             
+                        $err  = $this->bo->so->check_for_booking($id);
+                               if ($err) 
+                                               {
+                                                       
$invalid_dates[$i]['from_'] = $fromdate;
+                                                       
$invalid_dates[$i]['to_'] = $todate;
+                                               } 
+                                               else 
+                                               {
+                                                       
$valid_dates[$i]['from_'] = $fromdate;
+                                                       $valid_dates[$i]['to_'] 
= $todate;
+                                                       if ($step == 3)
+                                                       {
+                                $stat = $this->bo->so->delete_allocation($id); 
                           }                            
+                        }
+                                               $i++;
+                    }
+                                       if ($step == 3) 
+                                       {
+                                               
$this->redirect(array('menuaction' => 'booking.uimassbooking.schedule', 
'id'=>$allocation['building_id']));
+                                       }
+                }
+                       }
+                       $this->flash_form_errors($errors);
+                       self::add_javascript('booking', 'booking', 
'allocation.js');
+                       $allocation['resources_json'] = 
json_encode(array_map('intval', $allocation['resources']));
+                       $allocation['cancel_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.show', 'id' => 
$allocation['id']));
+                       $allocation['application_link'] = 
self::link(array('menuaction' => 'booking.uiapplication.show', 'id' => 
$allocation['application_id']));
+
+                       if ($step < 2) 
+            {
+                       self::render_template('allocation_delete', 
array('allocation' => $allocation));
+            }
+                       elseif ($step == 2) 
+            {
+                               
self::render_template('allocation_delete_preview', array('allocation' => 
$allocation,
+                                       'step' => $step,
+                                       'recurring' => $_POST['recurring'],
+                                       'outseason' => $_POST['outseason'],
+                                       'interval' => $_POST['field_interval'],
+                                       'repeat_until' => 
$_POST['repeat_until'],
+                                       'from_date' => $from_date,
+                                       'to_date' => $to_date,
+                                       'valid_dates' => $valid_dates,
+                                       'invalid_dates' => $invalid_dates
+                               ));
+            }                
+               }
                
                public function show()
                {
                        $allocation = 
$this->bo->read_single(phpgw::get_var('id', 'GET'));
                        $allocation['allocations_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.index'));
+                       $allocation['delete_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.delete', 
'allocation_id'=>$allocation['id'], 'from_'=>$allocation['from_'], 
'to_'=>$allocation['to_'], 'resource'=>$allocation['resource']));
                        $allocation['edit_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.edit', 'id' => 
$allocation['id']));
                        $resource_ids = '';
                        foreach($allocation['resources'] as $res)
@@ -401,6 +506,7 @@
                        $allocation['resource_info'] = join(', ', $res_names);
                        $allocation['building_link'] = 
self::link(array('menuaction' => 'booking.uibuilding.show', 'id' => 
$allocation['resources'][0]['building_id']));
                        $allocation['org_link'] = self::link(array('menuaction' 
=> 'booking.uiorganization.show', 'id' => $allocation['organization_id']));
+                       $allocation['delete_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.delete', 
'allocation_id'=>$allocation['id'], 'from_'=>$allocation['from_'], 
'to_'=>$allocation['to_'], 'resource'=>$allocation['resource']));
                        $allocation['add_link'] = self::link(array('menuaction' 
=> 'booking.uibooking.add', 'allocation_id'=>$allocation['id'], 
'from_'=>$allocation['from_'], 'to_'=>$allocation['to_'], 
'resource'=>$allocation['resource']));
                        $allocation['when'] = 
pretty_timestamp($allocation['from_']).' - 
'.pretty_timestamp($allocation['to_']);
                        self::render_template('allocation_info', 
array('allocation'=>$allocation));

Modified: branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php     
2011-04-15 11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/booking/inc/class.uibooking.inc.php     
2011-04-15 11:03:32 UTC (rev 7223)
@@ -192,7 +192,7 @@
                        $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;
+                       if (! isset($allocation_id)) $noallocation = 1;
                        $invalid_dates = array();
                        $valid_dates = array();
 
@@ -283,7 +283,6 @@
                         $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['booking'] && 
!$errors['season_boundary'] && $step > 1)

Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2011-04-15 
11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2011-04-15 
11:03:32 UTC (rev 7223)
@@ -491,3 +491,9 @@
 NB! No data will be saved, if you navigate away you will loose all.    booking 
no      NB! Ingen data er lagret.
 Activity       booking no      Aktiviteter
 Not selected   booking no      Ikke valgt
+Delete until   booking no      Slett til
+Recurring allocation deletion  booking no      Slettings intervall
+Delete allocation      booking no      Slett tildeling
+Delete allocations     booking no      Slett tildelinger
+Allocations that will be deleted       booking no      Tildelinger som vil bli 
slettet
+Allocations  with existing bookings (%1)       booking no      Tildeinger med 
eksisterende bookinger (%1)

Modified: branches/Version-1_0-branch/booking/templates/base/allocation.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/allocation.xsl   
2011-04-15 11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/booking/templates/base/allocation.xsl   
2011-04-15 11:03:32 UTC (rev 7223)
@@ -36,6 +36,10 @@
                            <xsl:attribute 
name="onclick">window.location.href="<xsl:value-of 
select="allocation/edit_link"/>"</xsl:attribute>
                            <xsl:value-of select="php:function('lang', 'Edit')" 
/>
                        </button>
+                       <button>
+                           <xsl:attribute 
name="onclick">window.location.href="<xsl:value-of 
select="allocation/delete_link"/>"</xsl:attribute>
+                           <xsl:value-of select="php:function('lang', 
'Delete')" />
+                       </button>
                        </xsl:if>
                </div>
     </div>

Copied: 
branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl (from 
rev 7222, trunk/booking/templates/base/allocation_delete.xsl)
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl    
                        (rev 0)
+++ branches/Version-1_0-branch/booking/templates/base/allocation_delete.xsl    
2011-04-15 11:03:32 UTC (rev 7223)
@@ -0,0 +1,123 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <div id="content">
+
+       <dl class="form">
+       <dt class="heading"><xsl:value-of select="php:function('lang', 'Delete 
allocation')"/></dt>
+       </dl>
+    <xsl:call-template name="msgbox"/>
+       <xsl:call-template name="yui_booking_i18n"/>
+
+    <form action="" method="POST">
+               <input type="hidden" name="application_id" 
value="{allocation/application_id}"/>
+        <input id="field_org_id" name="organization_id" type="hidden" 
value="{allocation/organization_id}" />
+        <input id="field_building_id" name="building_id" type="hidden" 
value="{allocation/building_id}" />
+        <input id="field_from" name="from_" type="hidden" 
value="{allocation/from_}" />
+        <input id="field_to" name="to_" type="hidden" value="{allocation/to_}" 
/>
+
+        <dl class="form-col">
+
+            <dt><label for="field_building"><xsl:value-of 
select="php:function('lang', 'Building')" /></label></dt>
+            <dd>
+                <div class="autocomplete">
+                        <xsl:value-of select="allocation/building_name"/>
+                </div>
+            </dd>
+
+
+            <dt><label for="field_from"><xsl:value-of 
select="php:function('lang', 'From')" /></label></dt>
+            <dd>
+                <div>
+                    <xsl:value-of select="allocation/from_"/>
+                </div>
+            </dd>
+                       <dd>
+                <div> </div>
+                       </dd>
+                       <dt><label for="field_repeat_until"><xsl:value-of 
select="php:function('lang', 'Recurring allocation deletion')" /></label></dt>
+                       <dd>
+                               <label>
+                                       <input type="checkbox" name="outseason" 
id="outseason">
+                                               <xsl:if test="outseason='on'">
+                                                       <xsl:attribute 
name="checked">checked</xsl:attribute>
+                                               </xsl:if>
+                                       </input>
+                                       <xsl:value-of 
select="php:function('lang', 'Out season')" />
+                               </label>
+                       </dd>
+                       <dd>
+                               <label>
+                                       <input type="checkbox" name="recurring" 
id="recurring">
+                                               <xsl:if test="recurring='on'">
+                                                       <xsl:attribute 
name="checked">checked</xsl:attribute>
+                                               </xsl:if>
+                                       </input>
+                                       <xsl:value-of 
select="php:function('lang', 'Delete until')" />
+                               </label>
+                       </dd>
+                       <dd class="date-picker">
+                               <input id="field_repeat_until" 
name="repeat_until" type="text">
+                                       <xsl:attribute 
name="value"><xsl:value-of select="repeat_until"/></xsl:attribute>
+                               </input>
+                       </dd>
+                       <dt><xsl:value-of select="php:function('lang', 
'Interval')" /></dt>
+                       <dd>
+                               <xsl:value-of select="../field_interval" />
+                               <select id="field_interval" 
name="field_interval">
+                                       <option value="1">
+                                               <xsl:if test="interval=1">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '1 week')" />
+                                       </option>
+                                       <option value="2">
+                                               <xsl:if test="interval=2">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '2 weeks')" />
+                                       </option>
+                                       <option value="3">
+                                               <xsl:if test="interval=3">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '3 weeks')" />
+                                       </option>
+                                       <option value="4">
+                                               <xsl:if test="interval=4">
+                                                       <xsl:attribute 
name="selected">selected</xsl:attribute>
+                                               </xsl:if>
+                                               <xsl:value-of 
select="php:function('lang', '4 weeks')" />
+                                       </option>
+                               </select>
+                       </dd>
+        </dl>
+        <dl class="form-col">
+            <dt><label for="field_org"><xsl:value-of 
select="php:function('lang', 'Organization')" /></label></dt>
+            <dd>
+                <div class="autocomplete">
+                        <xsl:value-of select="allocation/organization_name"/>
+                </div>
+            </dd>
+            <dt><label for="field_to"><xsl:value-of 
select="php:function('lang', 'To')" /></label></dt>
+            <dd>
+                <div>
+                    <xsl:value-of select="allocation/to_"/>
+                </div>
+            </dd>
+        </dl>
+        <div class="form-buttons">
+            <input type="submit">
+                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Delete')"/></xsl:attribute>
+                       </input>
+            <a class="cancel">
+                <xsl:attribute name="href"><xsl:value-of 
select="allocation/cancel_link"/></xsl:attribute>
+                <xsl:value-of select="php:function('lang', 'Cancel')" />
+            </a>
+        </div>
+    </form>
+    </div>
+    <script type="text/javascript">
+        YAHOO.booking.season_id = '<xsl:value-of 
select="allocation/season_id"/>';
+        YAHOO.booking.initialSelection = <xsl:value-of 
select="allocation/resources_json"/>;
+               var lang = <xsl:value-of select="php:function('js_lang', 
'Resource Type')"/>;
+    </script>
+</xsl:template>

Copied: 
branches/Version-1_0-branch/booking/templates/base/allocation_delete_preview.xsl
 (from rev 7222, trunk/booking/templates/base/allocation_delete_preview.xsl)
===================================================================
--- 
branches/Version-1_0-branch/booking/templates/base/allocation_delete_preview.xsl
                            (rev 0)
+++ 
branches/Version-1_0-branch/booking/templates/base/allocation_delete_preview.xsl
    2011-04-15 11:03:32 UTC (rev 7223)
@@ -0,0 +1,70 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <div id="content">
+
+       <dl class="form">
+       <dt class="heading"><xsl:value-of select="php:function('lang', 'Delete 
Allocations')"/></dt>
+       </dl>
+    <xsl:call-template name="msgbox"/>
+       <xsl:call-template name="yui_booking_i18n"/>
+
+       <!-- <xsl:call-template name="xmlsource"/> -->
+
+           <form action="" method="POST">
+                       <input type="hidden" name="organization_name" 
value="{allocation/organization_name}"/>
+                       <input type="hidden" name="organization_id" 
value="{allocation/organization_id}"/>
+                       <input type="hidden" name="building_name" 
value="{allocation/building_name}"/>
+                       <input type="hidden" name="building_id" 
value="{allocation/building_id}"/>
+                       <input type="hidden" name="from_" value="{from_date}"/>
+                       <input type="hidden" name="to_" value="{to_date}"/>
+                       <input type="hidden" name="building_id" 
value="{allocation/building_id}"/>
+                       <input type="hidden" name="cost" 
value="{allocation/cost}"/>
+                       <input type="hidden" name="season_id" 
value="{allocation/season_id}"/>
+                       <input type="hidden" name="field_building_id" 
value="{allocation/building_id}"/>
+                       <input type="hidden" name="step" value="{step}" />
+                       <input type="hidden" name="repeat_until" 
value="{repeat_until}" />
+                       <input type="hidden" name="field_interval" 
value="{interval}" />
+                       <input type="hidden" name="outseason" 
value="{outseason}" />
+                       <xsl:for-each select="allocation/resources">
+                               <input type="hidden" name="resources[]" 
value="{.}" />
+                       </xsl:for-each>
+
+                       <h4><xsl:value-of select="php:function('lang', 
'Allocations that will be deleted')" /></h4>
+                       <div class="allocation-list">
+                               <xsl:for-each select="valid_dates">
+                                       <li>
+                                               <xsl:value-of select="from_"/> 
- <xsl:value-of select="to_"/>
+                                       </li>
+                               </xsl:for-each>
+                       </div>
+
+                       <h4><xsl:value-of select="php:function('lang', 
'Allocations  with existing bookings (%1)', count(result/invalid[from_]))" 
/></h4>
+                       <div class="allocation-list">
+                               <xsl:for-each select="invalid_dates">
+                                       <li>
+                                               <xsl:value-of select="from_"/> 
- <xsl:value-of select="to_"/>
+                                       </li>
+                               </xsl:for-each>
+                       </div>
+               <div class="form-buttons">
+                   <input type="submit" name="create">
+                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Delete')" /></xsl:attribute>
+                               </input>
+                   <a class="cancel">
+                       <xsl:attribute name="href"><xsl:value-of 
select="allocation/cancel_link"/></xsl:attribute>
+                       <xsl:value-of select="php:function('lang', 'Cancel')" />
+                   </a>
+               </div>
+               </form>
+
+    </div>
+    <script type="text/javascript">
+        YAHOO.booking.initialSelection = <xsl:value-of 
select="allocation/resources_json"/>;
+    </script>
+</xsl:template>
+<xsl:template name="xmlsource">
+  NODE <xsl:value-of select="name()"/>
+  ATTR { <xsl:for-each select="attribute::*"><xsl:value-of 
select="name()"/>=<xsl:value-of select="."/> </xsl:for-each> }
+  CHILDREN: { <xsl:for-each select="*"><xsl:call-template 
name="xmlsource"/></xsl:for-each> }
+  TEXT <xsl:value-of select="text()"/>
+  <br/>
+</xsl:template>

Modified: branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl      
2011-04-15 11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/booking/templates/base/allocation_info.xsl      
2011-04-15 11:03:32 UTC (rev 7223)
@@ -16,7 +16,13 @@
        </dl>
        <xsl:if test="allocation/add_link">
                <div class="actions">
-                       <button 
onclick="location.href='{allocation/add_link}'"><xsl:value-of 
select="php:function('lang', 'Create new booking')"/></button>
+                       <button 
onclick="location.href='{allocation/add_link}'"><xsl:value-of 
select="php:function('lang', 'Create new booking')"/></button> 
                </div>
        </xsl:if>
+       <xsl:if test="allocation/delete_link">
+               <div class="actions">
+                       <button 
onclick="location.href='{allocation/delete_link}'"><xsl:value-of 
select="php:function('lang', 'Delete allocation')"/></button>
+               </div>
+       </xsl:if>
+
 </xsl:template>

Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2011-04-15 11:01:08 UTC (rev 7222)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2011-04-15 11:03:32 UTC (rev 7223)
@@ -206,7 +206,7 @@
                        $vendor_id              = phpgw::get_var('vendor_id', 
'int');
                        $workorder_id   = phpgw::get_var('workorder_id', 'int');
                        $loc1                   = phpgw::get_var('loc1');
-                       $voucher_id     = phpgw::get_var('voucher_id', 'int');
+                       $voucher_id     = $this->query && 
ctype_digit($this->query) ? $this->query : phpgw::get_var('voucher_id', 'int');
                        $b_account_class= phpgw::get_var('b_account_class', 
'int');
 
                        //-- ubica focus del menu derecho




reply via email to

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