fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14624] added history on cost for allocation, booking


From: Sigurd Nes
Subject: [Fmsystem-commits] [14624] added history on cost for allocation, booking and event
Date: Wed, 06 Jan 2016 12:06:27 +0000

Revision: 14624
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14624
Author:   sigurdne
Date:     2016-01-06 12:06:26 +0000 (Wed, 06 Jan 2016)
Log Message:
-----------
added history on cost for allocation, booking and event

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.soallocation.inc.php
    branches/dev-syncromind/booking/inc/class.sobooking.inc.php
    branches/dev-syncromind/booking/inc/class.soevent.inc.php
    branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
    branches/dev-syncromind/booking/inc/class.uibooking.inc.php
    branches/dev-syncromind/booking/inc/class.uievent.inc.php
    branches/dev-syncromind/booking/js/booking/allocation.js
    branches/dev-syncromind/booking/js/booking/booking.js
    branches/dev-syncromind/booking/js/booking/event.js
    branches/dev-syncromind/booking/setup/phpgw_no.lang
    branches/dev-syncromind/booking/setup/setup.inc.php
    branches/dev-syncromind/booking/setup/tables_current.inc.php
    branches/dev-syncromind/booking/setup/tables_update.inc.php
    branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
    branches/dev-syncromind/booking/templates/base/booking.xsl
    branches/dev-syncromind/booking/templates/base/booking_edit.xsl
    branches/dev-syncromind/booking/templates/base/event_edit.xsl

Modified: branches/dev-syncromind/booking/inc/class.soallocation.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soallocation.inc.php      
2016-01-05 10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/inc/class.soallocation.inc.php      
2016-01-06 12:06:26 UTC (rev 14624)
@@ -66,6 +66,13 @@
                                                'key'    => 'allocation_id',
                                                'column' => 'resource_id'
                                        )),
+                               'costs'                                         
 => array('type'                 => 'string',
+                                       'manytomany' => array(
+                                               'table'  => 
'bb_allocation_cost',
+                                               'key'    => 'allocation_id',
+                                               'column' => array('time', 
'author', 'comment', 'cost'),
+                                               'order'  => array('sort' => 
'time', 'dir' => 'ASC')
+                                       )),
                        )
                        );
                }
@@ -314,4 +321,21 @@
                        $sql             = "UPDATE $table_name SET completed = 
1 WHERE {$table_name}.id IN ($ids);";
                        $db->query($sql, __LINE__, __FILE__);
                }
+
+               function get_ordered_costs($id)
+               {
+                       $results = array();
+                       $this->db->query("SELECT * FROM bb_allocation_cost 
WHERE allocation_id=($id) ORDER BY time DESC", __LINE__, __FILE__);
+                       while($this->db->next_record())
+                       {
+                               $results[] = array(
+                                       'time'           => 
$this->db->f('time'),
+                                       'author'         => 
$this->db->f('author',true),
+                                       'comment'        => 
$this->db->f('comment', true),
+                                       'cost'           => $this->db->f('cost')
+                               );
+                       }
+                       return $results;
+               }
+
        }
\ No newline at end of file

Modified: branches/dev-syncromind/booking/inc/class.sobooking.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.sobooking.inc.php 2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/inc/class.sobooking.inc.php 2016-01-06 
12:06:26 UTC (rev 14624)
@@ -82,6 +82,13 @@
                                                'key'    => 'booking_id',
                                                'column' => 'resource_id'
                                        )),
+                               'costs'                                         
 => array('type'                 => 'string',
+                                       'manytomany' => array(
+                                               'table'  => 'bb_booking_cost',
+                                               'key'    => 'booking_id',
+                                               'column' => array('time', 
'author', 'comment', 'cost'),
+                                               'order'  => array('sort' => 
'time', 'dir' => 'ASC')
+                                       )),
                        )
                        );
                }
@@ -757,4 +764,20 @@
                        }
                        return $results;
                }
+
+               function get_ordered_costs($id)
+               {
+                       $results = array();
+                       $this->db->query("SELECT * FROM bb_booking_cost WHERE 
booking_id=($id) ORDER BY time DESC", __LINE__, __FILE__);
+                       while($this->db->next_record())
+                       {
+                               $results[] = array(
+                                       'time'           => 
$this->db->f('time'),
+                                       'author'         => 
$this->db->f('author',true),
+                                       'comment'        => 
$this->db->f('comment', true),
+                                       'cost'           => $this->db->f('cost')
+                               );
+                       }
+                       return $results;
+               }
        }
\ No newline at end of file

Modified: branches/dev-syncromind/booking/inc/class.soevent.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soevent.inc.php   2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/inc/class.soevent.inc.php   2016-01-06 
12:06:26 UTC (rev 14624)
@@ -69,6 +69,13 @@
                                                'column' => array('time', 
'author', 'comment', 'type'),
                                                'order'  => array('sort' => 
'time', 'dir' => 'ASC')
                                        )),
+                               'costs'                                         
 => array('type'                 => 'string',
+                                       'manytomany' => array(
+                                               'table'  => 'bb_event_cost',
+                                               'key'    => 'event_id',
+                                               'column' => array('time', 
'author', 'comment', 'cost'),
+                                               'order'  => array('sort' => 
'time', 'dir' => 'ASC')
+                                       )),
                                'resources'                                     
         => array('type'                 => 'int', 'required'    => true,
                                        'manytomany' => array(
                                                'table'  => 'bb_event_resource',
@@ -113,6 +120,22 @@
                        return $results;
                }
 
+               function get_ordered_costs($id)
+               {
+                       $results = array();
+                       $this->db->query("SELECT * FROM bb_event_cost WHERE 
event_id=($id) ORDER BY time DESC", __LINE__, __FILE__);
+                       while($this->db->next_record())
+                       {
+                               $results[] = array(
+                                       'time'           => 
$this->db->f('time'),
+                                       'author'         => 
$this->db->f('author',true),
+                                       'comment'        => 
$this->db->f('comment', true),
+                                       'cost'           => $this->db->f('cost')
+                               );
+                       }
+                       return $results;
+               }
+
                function get_resource_info($id)
                {
                        $this->db->limit_query("SELECT bb_resource.id, 
bb_resource.name FROM bb_resource WHERE bb_resource.id=" . intval($id), 0, 
__LINE__, __FILE__, 1);

Modified: branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiallocation.inc.php      
2016-01-05 10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/inc/class.uiallocation.inc.php      
2016-01-06 12:06:26 UTC (rev 14624)
@@ -255,6 +255,21 @@
                        return $this->yui_results($allocations);
                }
 
+               protected function add_cost_history(&$allocation, $comment = 
'', $cost = '0.00')
+               {
+                       if(!$comment)
+                       {
+                               $comment = lang('cost is set');
+                       }
+
+                       $allocation['costs'][] = array(
+                               'time'           => 'now',
+                               'author'         => 
$this->current_account_fullname(),
+                               'comment'        => $comment,
+                               'cost'           => $cost
+                       );
+               }
+
                public function add()
                {
                        $errors                  = array();
@@ -267,6 +282,10 @@
                                $season                                  = 
$this->season_bo->read_single($_POST['season_id']);
                                array_set_default($_POST, 'resources', array());
                                $allocation                              = 
extract_values($_POST, $this->fields);
+                               if($_POST['cost'])
+                               {
+                                       $this->add_cost_history($allocation, 
phpgw::get_var('cost_comment'), phpgw::get_var('cost','float'));
+                               }
                                $allocation['active']    = '1';
                                $allocation['completed'] = '0';
 
@@ -512,8 +531,11 @@
                                $allocation              = 
array_merge($allocation, extract_values($_POST, $this->fields));
                                $organization    = 
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id', 
'int', 'POST')));
 
+                               if($_POST['cost'] != $_POST['cost_orig'])
+                               {
+                                       $this->add_cost_history($allocation, 
phpgw::get_var('cost_comment'), phpgw::get_var('cost','float'));
+                               }
 
-
                                $errors = $this->bo->validate($allocation);
                                if(!$errors)
                                {
@@ -544,10 +566,12 @@
                        $allocation['tabs']                              = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
                        $allocation['validator']                 = 
phpgwapi_jquery::formvalidator_generate(array('location',
                                'date', 'security', 'file'));
+                       $cost_history                            = 
$this->bo->so->get_ordered_costs($id);
+
                        $GLOBALS['phpgw']->jqcal->add_listener('field_from', 
'datetime');
                        $GLOBALS['phpgw']->jqcal->add_listener('field_to', 
'datetime');
 
-                       self::render_template_xsl('allocation_edit', 
array('allocation' => $allocation));
+                       self::render_template_xsl('allocation_edit', 
array('allocation' => $allocation, 'cost_history' => $cost_history));
                }
 
                public function delete()

Modified: branches/dev-syncromind/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2016-01-06 
12:06:26 UTC (rev 14624)
@@ -400,6 +400,10 @@
 
                                $today   = getdate();
                                $booking = extract_values($_POST, 
$this->fields);
+                               if($_POST['cost'])
+                               {
+                                       $this->add_cost_history($booking, 
phpgw::get_var('cost_comment'), phpgw::get_var('cost','float'));
+                               }
 
                                $timestamp                       = 
strtotime($booking['from_']);
                                $booking['from_']        = date("Y-m-d H:i:s", 
$timestamp);
@@ -732,6 +736,10 @@
 
                                array_set_default($_POST, 'resources', array());
                                $booking                                        
 = array_merge($booking, extract_values($_POST, $this->fields));
+                               if($_POST['cost'] != $_POST['cost_orig'])
+                               {
+                                       $this->add_cost_history($booking, 
phpgw::get_var('cost_comment'), phpgw::get_var('cost','float'));
+                               }
                                $booking['allocation_id']        = 
$booking['allocation_id'] ? $booking['allocation_id'] : null;
                                $this->agegroup_bo->extract_form_data($booking);
                                $group                                          
 = $this->group_bo->read_single(intval(phpgw::get_var('group_id', 'int')));
@@ -767,6 +775,7 @@
                        $audience                                        = 
$audience['results'];
                        $activities                                      = 
$this->activity_bo->fetch_activities();
                        $activities                                      = 
$activities['results'];
+                       $cost_history                            = 
$this->bo->so->get_ordered_costs($id);
                        $booking['audience_json']        = 
json_encode(array_map('intval', $booking['audience']));
 
                        $GLOBALS['phpgw']->jqcal->add_listener('field_from', 
'datetime');
@@ -777,7 +786,7 @@
                                'date', 'security', 'file'));
 
                        self::render_template_xsl('booking_edit', 
array('booking' => $booking, 'activities' => $activities,
-                               'agegroups' => $agegroups, 'audience' => 
$audience));
+                               'agegroups' => $agegroups, 'audience' => 
$audience, 'cost_history' => $cost_history));
                }
 
                public function delete()
@@ -954,7 +963,8 @@
 
                public function show()
                {
-                       $booking = $this->bo->read_single(phpgw::get_var('id', 
'int'));
+                       $id = phpgw::get_var('id', 'int');
+                       $booking = $this->bo->read_single($id);
 
                        $activity_path           = 
$this->activity_bo->get_path($booking['activity_id']);
                        $top_level_activity      = $activity_path ? 
$activity_path[0]['id'] : 0;
@@ -971,6 +981,7 @@
                                $resource_ids = $resource_ids . '&filter_id[]=' 
. $res;
                        }
                        $booking['resource_ids'] = $resource_ids;
+                       $cost_history                            = 
$this->bo->so->get_ordered_costs($id);
 
                        if($GLOBALS['phpgw_info']['flags']['currentapp'] != 
'bookingfrontend')
                        {
@@ -980,7 +991,7 @@
                                $booking['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
                        }
 
-                       self::render_template_xsl('booking', array('booking' => 
$booking));
+                       self::render_template_xsl('booking', array('booking' => 
$booking, 'cost_history' => $cost_history));
                }
 
                public function info()
@@ -1011,4 +1022,19 @@
                        self::render_template('booking_info', array('booking' 
=> $booking));
                        $GLOBALS['phpgw']->xslttpl->set_output('wml'); // Evil 
hack to disable page chrome
                }
+
+               protected function add_cost_history(&$booking, $comment = '', 
$cost = '0.00')
+               {
+                       if(!$comment)
+                       {
+                               $comment = lang('cost is set');
+                       }
+
+                       $booking['costs'][] = array(
+                               'time'           => 'now',
+                               'author'         => 
$this->current_account_fullname(),
+                               'comment'        => $comment,
+                               'cost'           => $cost
+                       );
+               }
        }
\ No newline at end of file

Modified: branches/dev-syncromind/booking/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uievent.inc.php   2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/inc/class.uievent.inc.php   2016-01-06 
12:06:26 UTC (rev 14624)
@@ -238,6 +238,21 @@
                        );
                }
 
+               protected function add_cost_history(&$event, $comment = '', 
$cost = '0.00')
+               {
+                       if(!$comment)
+                       {
+                               $comment = lang('cost is set');
+                       }
+
+                       $event['costs'][] = array(
+                               'time'           => 'now',
+                               'author'         => 
$this->current_account_fullname(),
+                               'comment'        => $comment,
+                               'cost'           => $cost
+                       );
+               }
+
                protected function 
create_sendt_mail_notification_comment_text($event, $errors)
                {
                        $data = array();
@@ -467,6 +482,10 @@
                                {
                                        $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
                                }
+                               if($_POST['cost'] != 0)
+                               {
+                                       $this->add_cost_history($event, 
lang('cost is set'), phpgw::get_var('cost','float'));
+                               }
                                if(($_POST['organization_name'] != '' or 
$_POST['org_id2'] != '') and isset($errors['contact_name']))
                                {
                                        $errors['contact_name'] = 
lang('Organization is missing booking charge');
@@ -710,6 +729,12 @@
                                {
                                        $errors['invoice_data'] = lang('There 
is set a cost, but no invoice data is filled inn');
                                }
+
+                               if($_POST['cost'] != $_POST['cost_orig'])
+                               {
+                                       $this->add_cost_history($event, 
phpgw::get_var('cost_comment'), phpgw::get_var('cost','float'));
+                               }
+
                                if(!$errors['event'] and ! 
$errors['resource_number'] and ! $errors['organization_number'] and ! 
$errors['invoice_data'] && !$errors['contact_name'] && !$errors['cost'])
                                {
                                        if(( phpgw::get_var('sendtorbuilding', 
'POST') || phpgw::get_var('sendtocontact', 'POST') || 
phpgw::get_var('sendtocollision', 'POST')) && phpgw::get_var('active', 'POST'))
@@ -960,6 +985,7 @@
                        $activities                                      = 
$activities['results'];
 #                      $comments = array_reverse($event['comments']);
                        $comments                                        = 
$this->bo->so->get_ordered_comments($id);
+                       $cost_history                            = 
$this->bo->so->get_ordered_costs($id);
                        $agegroups                                       = 
$this->agegroup_bo->fetch_age_groups($top_level_activity);
                        $agegroups                                       = 
$agegroups['results'];
                        $audience                                        = 
$this->audience_bo->fetch_target_audience($top_level_activity);
@@ -975,7 +1001,7 @@
                        $event['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
 //              echo '<pre>'; print_r($event);echo '</pre>';
                        self::render_template_xsl('event_edit', array('event' 
=> $event, 'activities' => $activities,
-                               'agegroups' => $agegroups, 'audience' => 
$audience, 'comments' => $comments));
+                               'agegroups' => $agegroups, 'audience' => 
$audience, 'comments' => $comments, 'cost_history' => $cost_history));
                }
 
                public function delete()

Modified: branches/dev-syncromind/booking/js/booking/allocation.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/allocation.js    2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/js/booking/allocation.js    2016-01-06 
12:06:26 UTC (rev 14624)
@@ -1,5 +1,18 @@
 var building_id_selection = "";
 $(document).ready(function () {
+
+       $('#field_cost_comment').hide();
+       $('#field_cost').on('input propertychange paste', function() {
+               if($('#field_cost').val() != $('#field_cost_orig').val())
+               {
+                       $('#field_cost_comment').show();
+               }
+               else
+               {
+                       $('#field_cost_comment').hide();
+               }
+       });
+
        
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uibuilding.index&phpgw_return_as=json&',
                        'field_building_name', 'field_building_id', 
'building_container');
 

Modified: branches/dev-syncromind/booking/js/booking/booking.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/booking.js       2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/js/booking/booking.js       2016-01-06 
12:06:26 UTC (rev 14624)
@@ -1,6 +1,19 @@
 var building_id_selection = "";
 var organization_id_selection = "";
 $(document).ready(function () {
+
+       $('#field_cost_comment').hide();
+       $('#field_cost').on('input propertychange paste', function() {
+               if($('#field_cost').val() != $('#field_cost_orig').val())
+               {
+                       $('#field_cost_comment').show();
+               }
+               else
+               {
+                       $('#field_cost_comment').hide();
+               }
+       });
+
        
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uibuilding.index&phpgw_return_as=json&',
                        'field_building_name', 'field_building_id', 
'building_container');
 

Modified: branches/dev-syncromind/booking/js/booking/event.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/event.js 2016-01-05 10:31:42 UTC 
(rev 14623)
+++ branches/dev-syncromind/booking/js/booking/event.js 2016-01-06 12:06:26 UTC 
(rev 14624)
@@ -1,5 +1,18 @@
 var building_id_selection = "";
 $(document).ready(function () {
+
+       $('#field_cost_comment').hide();
+       $('#field_cost').on('input propertychange paste', function() {
+               if($('#field_cost').val() != $('#field_cost_orig').val())
+               {
+                       $('#field_cost_comment').show();
+               }
+               else
+               {
+                       $('#field_cost_comment').hide();
+               }
+       });
+
        
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uibuilding.index&phpgw_return_as=json&',
                        'field_building_name', 'field_building_id', 
'building_container');
 

Modified: branches/dev-syncromind/booking/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/booking/setup/phpgw_no.lang 2016-01-05 10:31:42 UTC 
(rev 14623)
+++ branches/dev-syncromind/booking/setup/phpgw_no.lang 2016-01-06 12:06:26 UTC 
(rev 14624)
@@ -141,6 +141,9 @@
 go back to the template week   booking no      Gå tilbake til ukeplan
 group  booking no      Gruppe/Lag
 history and comments (%1)      booking no      Historikk (%1)
+History of Cost (%1)   booking no      Prishistorikk (%1)
+cost is set    booking no      Ny pris er angitt
+cost comment   booking no      Kommentar til ny pris
 hms document   booking no      HMS dokument
 homepage       booking no      Hjemmeside
 id     booking no      ID

Modified: branches/dev-syncromind/booking/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/setup.inc.php 2016-01-05 10:31:42 UTC 
(rev 14623)
+++ branches/dev-syncromind/booking/setup/setup.inc.php 2016-01-06 12:06:26 UTC 
(rev 14624)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.22';
+       $setup_info['booking']['version'] = '0.2.23';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';
@@ -19,7 +19,9 @@
                'bb_season_boundary',
                'bb_application',
                'bb_allocation',
+               'bb_allocation_cost',
                'bb_booking',
+               'bb_booking_cost',
                'bb_booking_resource',
                'bb_season_resource',
                'bb_wtemplate_alloc',
@@ -40,6 +42,7 @@
                'bb_organization_contact',
                'bb_group_contact',
                'bb_event',
+               'bb_event_cost',
                'bb_event_resource',
                'bb_event_targetaudience',
                'bb_event_agegroup',

Modified: branches/dev-syncromind/booking/setup/tables_current.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/tables_current.inc.php        
2016-01-05 10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/setup/tables_current.inc.php        
2016-01-06 12:06:26 UTC (rev 14624)
@@ -231,6 +231,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'bb_allocation_cost' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'allocation_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'time' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
+                               'author' => array('type' => 'text', 'nullable' 
=> False),
+                               'comment' => array('type' => 'text', 'nullable' 
=> False),
+                               'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'bb_allocation' => array('allocation_id' => 
'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'bb_booking' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','nullable' => 
False),
@@ -259,6 +274,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'bb_booking_cost' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'booking_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'time' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
+                               'author' => array('type' => 'text', 'nullable' 
=> False),
+                               'comment' => array('type' => 'text', 'nullable' 
=> False),
+                               'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'bb_booking' => array('booking_id' => 'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'bb_booking_resource' => array(
                        'fd' => array(
                                'booking_id' => array('type' => 
'int','precision' => '4','nullable' => False),
@@ -632,6 +662,21 @@
                        'ix' => array(),
                        'uc' => array('event_id', 'from_', 'to_')
                ),
+               'bb_event_cost' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'event_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'time' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
+                               'author' => array('type' => 'text', 'nullable' 
=> False),
+                               'comment' => array('type' => 'text', 'nullable' 
=> False),
+                               'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                                       'bb_event' => array('event_id' => 
'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'bb_completed_reservation_export' => array(
                        'fd' => array(
                                'id'                                            
=> array('type' => 'auto', 'nullable' => False),

Modified: branches/dev-syncromind/booking/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/tables_update.inc.php 2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/setup/tables_update.inc.php 2016-01-06 
12:06:26 UTC (rev 14624)
@@ -3255,3 +3255,73 @@
                        return $GLOBALS['setup_info']['booking']['currentver'];
                }
        }
+
+       $test[] = '0.2.22';
+       /**
+        * Update booking version from 0.2.22 to 0.2.23
+        *
+        */
+       function booking_upgrade0_2_22()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'bb_allocation_cost',  array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => False),
+                                       'allocation_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'time' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
+                                       'author' => array('type' => 'text', 
'nullable' => False),
+                                       'comment' => array('type' => 'text', 
'nullable' => False),
+                                       'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                       'bb_allocation' => 
array('allocation_id' => 'id')
+                               ),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'bb_event_cost', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => False),
+                                       'event_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'time' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
+                                       'author' => array('type' => 'text', 
'nullable' => False),
+                                       'comment' => array('type' => 'text', 
'nullable' => False),
+                                       'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                               'bb_event' => array('event_id' 
=> 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+               'bb_booking_cost', array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'booking_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'time' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
+                               'author' => array('type' => 'text', 'nullable' 
=> False),
+                               'comment' => array('type' => 'text', 'nullable' 
=> False),
+                               'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'bb_booking' => array('booking_id' => 'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.23';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
+       }

Modified: branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/allocation_edit.xsl  
2016-01-05 10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/templates/base/allocation_edit.xsl  
2016-01-06 12:06:26 UTC (rev 14624)
@@ -148,6 +148,38 @@
                                                        </xsl:attribute>
                                                </input>
                                        </div>
+
+                                                       <div 
id="field_cost_comment" class="pure-control-group">
+                                                               <label 
for="field_cost_comment">
+                                                                       
<xsl:value-of select="php:function('lang', 'Cost comment')" />
+                                                               </label>
+                                                               <input 
id="field_cost_comment" name="cost_comment" type="text">
+                                                                       
<xsl:attribute name="placeholder">
+                                                                               
<xsl:value-of select="php:function('lang', 'Cost comment')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <input 
id="field_cost_orig" name="cost_orig" type="hidden" value= "{allocation/cost}"/>
+                                                       </div>
+                                                       <div>
+                                                               <div 
class="heading">
+                                                                       <legend>
+                                                                               
<h3><xsl:value-of select="php:function('lang', 'History of Cost (%1)', 
count(cost_history/author))" /></h3>
+                                                                       
</legend>
+                                                               </div>
+                                                               <xsl:for-each 
select="cost_history[author]">
+                                                                       <div 
class="pure-control-group">
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="php:function('pretty_timestamp', time)"/>: 
<xsl:value-of select="author"/>
+                                                                               
</label>
+                                                                               
<span>
+                                                                               
        <xsl:value-of select="comment"/>
+                                                                               
        <xsl:text> :: </xsl:text>
+                                                                               
        <xsl:value-of select="cost"/>
+                                                                               
</span>
+                                                                       </div>
+                                                               </xsl:for-each>
+                                                       </div>
+
                                        <div class="pure-control-group">
                                                <label for="field_mail">
                                                        <xsl:value-of 
select="php:function('lang', 'Inform contact persons')" />

Modified: branches/dev-syncromind/booking/templates/base/booking.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/booking.xsl  2016-01-05 
10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/templates/base/booking.xsl  2016-01-06 
12:06:26 UTC (rev 14624)
@@ -25,6 +25,25 @@
                                                </label>
                                                <xsl:value-of 
select="booking/cost"/>
                                        </div>
+                                                       <div>
+                                                               <div 
class="heading">
+                                                                       <legend>
+                                                                               
<h3><xsl:value-of select="php:function('lang', 'History of Cost (%1)', 
count(cost_history/author))" /></h3>
+                                                                       
</legend>
+                                                               </div>
+                                                               <xsl:for-each 
select="cost_history[author]">
+                                                                       <div 
class="pure-control-group">
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="php:function('pretty_timestamp', time)"/>: 
<xsl:value-of select="author"/>
+                                                                               
</label>
+                                                                               
<span>
+                                                                               
        <xsl:value-of select="comment"/>
+                                                                               
        <xsl:text> :: </xsl:text>
+                                                                               
        <xsl:value-of select="cost"/>
+                                                                               
</span>
+                                                                       </div>
+                                                               </xsl:for-each>
+                                                       </div>
                                        <div class="pure-control-group">
                                                <label>
                                                        <xsl:value-of 
select="php:function('lang', 'Season')" />

Modified: branches/dev-syncromind/booking/templates/base/booking_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/booking_edit.xsl     
2016-01-05 10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/templates/base/booking_edit.xsl     
2016-01-06 12:06:26 UTC (rev 14624)
@@ -196,6 +196,39 @@
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </div>
+
+                                                       <div 
id="field_cost_comment" class="pure-control-group">
+                                                               <label 
for="field_cost_comment">
+                                                                       
<xsl:value-of select="php:function('lang', 'Cost comment')" />
+                                                               </label>
+                                                               <input 
id="field_cost_comment" name="cost_comment" type="text">
+                                                                       
<xsl:attribute name="placeholder">
+                                                                               
<xsl:value-of select="php:function('lang', 'Cost comment')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <input 
id="field_cost_orig" name="cost_orig" type="hidden" value= "{booking/cost}"/>
+                                                       </div>
+                                                       <div>
+                                                               <div 
class="heading">
+                                                                       <legend>
+                                                                               
<h3><xsl:value-of select="php:function('lang', 'History of Cost (%1)', 
count(cost_history/author))" /></h3>
+                                                                       
</legend>
+                                                               </div>
+                                                               <xsl:for-each 
select="cost_history[author]">
+                                                                       <div 
class="pure-control-group">
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="php:function('pretty_timestamp', time)"/>: 
<xsl:value-of select="author"/>
+                                                                               
</label>
+                                                                               
<span>
+                                                                               
        <xsl:value-of select="comment"/>
+                                                                               
        <xsl:text> :: </xsl:text>
+                                                                               
        <xsl:value-of select="cost"/>
+                                                                               
</span>
+                                                                       </div>
+                                                               </xsl:for-each>
+                                                       </div>
+
+
                                                </div>
                                                <div class="pure-u-1 
pure-u-md-1 pure-u-lg-1-3">
                                                        <div class="heading">

Modified: branches/dev-syncromind/booking/templates/base/event_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/event_edit.xsl       
2016-01-05 10:31:42 UTC (rev 14623)
+++ branches/dev-syncromind/booking/templates/base/event_edit.xsl       
2016-01-06 12:06:26 UTC (rev 14624)
@@ -388,6 +388,37 @@
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </div>
+                                                       <div 
id="field_cost_comment" class="pure-control-group">
+                                                               <label 
for="field_cost_comment">
+                                                                       
<xsl:value-of select="php:function('lang', 'Cost comment')" />
+                                                               </label>
+                                                               <input 
id="field_cost_comment" name="cost_comment" type="text" class="pure-u-1 
pure-u-sm-1-2 pure-u-md-1">
+                                                                       
<xsl:attribute name="placeholder">
+                                                                               
<xsl:value-of select="php:function('lang', 'Cost comment')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <input 
id="field_cost_orig" name="cost_orig" type="hidden" value= "{event/cost}"/>
+                                                       </div>
+                                                       <div class="pure-u-1 
pure-u-md-1-2 pure-u-lg-1-3">
+                                                               <div 
class="heading">
+                                                                       <legend>
+                                                                               
<h3><xsl:value-of select="php:function('lang', 'History of Cost (%1)', 
count(cost_history/author))" /></h3>
+                                                                       
</legend>
+                                                               </div>
+                                                               <xsl:for-each 
select="cost_history[author]">
+                                                                       <div 
class="pure-control-group">
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="php:function('pretty_timestamp', time)"/>: 
<xsl:value-of select="author"/>
+                                                                               
</label>
+                                                                               
<span>
+                                                                               
        <xsl:value-of select="comment"/>
+                                                                               
        <xsl:text> :: </xsl:text>
+                                                                               
        <xsl:value-of select="cost"/>
+                                                                               
</span>
+                                                                       </div>
+                                                               </xsl:for-each>
+                                                       </div>
+
                                                </div>
                                                <div class="pure-u-1 
pure-u-md-1-2 pure-u-lg-1-3">
                                                        <div class="heading">




reply via email to

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