fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14229] booking:more on reports


From: Sigurd Nes
Subject: [Fmsystem-commits] [14229] booking:more on reports
Date: Thu, 22 Oct 2015 12:38:31 +0000

Revision: 14229
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14229
Author:   sigurdne
Date:     2015-10-22 12:38:28 +0000 (Thu, 22 Oct 2015)
Log Message:
-----------
booking:more on reports

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.soactivity.inc.php
    branches/dev-syncromind/booking/inc/class.soresource.inc.php
    branches/dev-syncromind/booking/inc/class.uireports.inc.php
    branches/dev-syncromind/booking/js/booking/report.js
    branches/dev-syncromind/booking/templates/base/report_new.xsl

Modified: branches/dev-syncromind/booking/inc/class.soactivity.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soactivity.inc.php        
2015-10-21 22:00:20 UTC (rev 14228)
+++ branches/dev-syncromind/booking/inc/class.soactivity.inc.php        
2015-10-22 12:38:28 UTC (rev 14229)
@@ -3,6 +3,8 @@
        
        class booking_soactivity extends booking_socommon
        {
+               private $activity_tree = array();
+
                function __construct()
                {
                        parent::__construct('bb_activity', 
@@ -73,4 +75,20 @@
                        }
                        return $values;
                }
+
+               public function get_children($parent, $level = 0)
+               {
+                       $parent = (int)$parent;
+                       $db              = clone($this->db);
+                       $sql     = "SELECT * FROM bb_activity WHERE  parent_id 
= {$parent} ORDER BY name ASC";
+                       $db->query($sql, __LINE__, __FILE__);
+
+                       while($db->next_record())
+                       {
+                               $id                                             
 = $db->f('id');
+                               $this->activity_tree[]   = $id;
+                               $this->get_children($id, $level + 1);
+                       }
+                       return $this->activity_tree;
+               }
        }

Modified: branches/dev-syncromind/booking/inc/class.soresource.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soresource.inc.php        
2015-10-21 22:00:20 UTC (rev 14228)
+++ branches/dev-syncromind/booking/inc/class.soresource.inc.php        
2015-10-22 12:38:28 UTC (rev 14229)
@@ -89,4 +89,18 @@
                                $errors['type'] = lang('Invalid Resource Type');
                        }
                }
+
+               function _get_conditions($query, $filters)
+               {
+
+                       if(isset($filters['activity_id']) && 
$filters['activity_id'])
+                       {
+                               $soactivity = 
createObject('booking.soactivity');
+                               $children = 
$soactivity->get_children($filters['activity_id']);
+                               $activity_ids = 
array_merge(array($filters['activity_id']),$children);
+                               $filters['activity_id'] = $activity_ids;
+                       }
+                       $conditions = parent::_get_conditions($query, $filters);
+                       return $conditions;
+               }
        }

Modified: branches/dev-syncromind/booking/inc/class.uireports.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-10-21 
22:00:20 UTC (rev 14228)
+++ branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-10-22 
12:38:28 UTC (rev 14229)
@@ -54,7 +54,7 @@
                public function add()
                {
                        
self::set_active_menu('booking::reportcenter::add_generic');
-
+                       _debug_array($_POST);
                        $errors  = array();
                        $report  = array();
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
@@ -157,8 +157,8 @@
                                                $receipt = 
$this->bo->add($report);
                                                
$this->bo->so->update_id_string();
                                        }
-                                       $this->redirect(array('menuaction' => 
'booking.uireports.edit', 'id' => $receipt['id'],
-                                               'secret' => $report['secret'], 
'warnings' => $errors));
+       //                              $this->redirect(array('menuaction' => 
'booking.uireports.edit', 'id' => $receipt['id'],
+       //                                      'secret' => $report['secret'], 
'warnings' => $errors));
                                }
                        }
                        if($errors['report'])

Modified: branches/dev-syncromind/booking/js/booking/report.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/report.js        2015-10-21 
22:00:20 UTC (rev 14228)
+++ branches/dev-syncromind/booking/js/booking/report.js        2015-10-22 
12:38:28 UTC (rev 14229)
@@ -21,10 +21,10 @@
 });
 
 function populateTableChkResources(building_id, selection) {
-       oArgs = {menuaction: 'booking.uiresource.index', sort:'name', 
filter_building_id:building_id};
+       oArgs = {menuaction: 'booking.uiresource.index', sort:'name', 
filter_building_id:building_id, filter_activity_id: $("#field_activity").val()};
        var requestUrl = phpGWLink('index.php', oArgs, true);
        var container = 'resources_container';
-       var colDefsResources = [{label: '', object: [{type: 'input', attrs: 
[{name: 'type', value: 'checkbox'}, {name: 'name', value: 'resources[]'}]}], 
value: 'id', checked: selection}, {key: 'name', label: lang['Name']}, {key: 
'type', label: lang['Resource Type']}];
+       var colDefsResources = [{label: '', object: [{type: 'input', attrs: 
[{name: 'type', value: 'checkbox'}, {name: 'name', value: 'resources[]'}, 
{name: 'checked', value: 'checked'}]}], value: 'id'/*, checked: selection*/}, 
{key: 'name', label: lang['Name']}, {key: 'type', label: lang['Resource 
Type']}];
        populateTableChk(requestUrl, container, colDefsResources);
 }
 
@@ -33,12 +33,39 @@
 }
 
 $(document).ready(function(){
-
+/*
+       $( "#check_all_buildings" ).on( "click", function() {
+               if($(this).prop("checked"))
+               {
+                       $("#field_building_name").val('');
+                       $("#building_container").hide();
+                       $("#resources_container").html('');
+               }
+               else
+               {
+                       $("#building_container").show();
+                       $("#resources_container").html(lang['Select a building 
first']);
+               }
+       });
+*/
        $("#field_activity").change(function () {
                oArgs = {menuaction: 'booking.uireports.get_custom'};
                var requestUrl = phpGWLink('index.php', oArgs, true);
                var activity_id =$("#field_activity").val();
+               //reset resources on activity change
+//             $("#field_building_name").val('');
+               var building_id = $('#field_building_id').val();
+               if(building_id)
+               {
+                       populateTableChkResources(building_id, []);
+               }
 
+               
+               if(!$("#check_all_buildings").prop("checked"))
+               {
+//                     $("#resources_container").html(lang['Select a building 
first']);
+               }
+
                $.ajax({
                                type: 'POST',
                                data: {activity_id:activity_id},

Modified: branches/dev-syncromind/booking/templates/base/report_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/report_new.xsl       
2015-10-21 22:00:20 UTC (rev 14228)
+++ branches/dev-syncromind/booking/templates/base/report_new.xsl       
2015-10-22 12:38:28 UTC (rev 14229)
@@ -16,7 +16,7 @@
                        <xsl:value-of disable-output-escaping="yes" 
select="report/tabs"/>
                        <div id="report_new">
                                <fieldset>
-                                       <input type="hidden" 
name="application_id" value="{report/application_id}"/>
+                                       <input type="hidden" name="report_id" 
value="{report/report_id}"/>
                         
                                        <div class="pure-g">
                                                <div class="pure-u-1">
@@ -30,11 +30,26 @@
                                                        <div 
class="pure-control-group">
                                                                <label 
for="field_activity">
                                                                        <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'type')" />
+                                                                       </h4>
+                                                               </label>
+                                                               <select 
name="report_type" id="report_type" class="pure-u-1 pure-u-sm-1-2 
pure-u-lg-1-3">
+                                                                       <option 
value="1">
+                                                                               
<xsl:value-of select="php:function('lang', 'counting')" />
+                                                                       
</option>
+                                                                       <option 
value="2">
+                                                                               
<xsl:value-of select="php:function('lang', 'time')" />
+                                                                       
</option>
+                                                               </select>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label 
for="field_activity">
+                                                                       <h4>
                                                                                
<xsl:value-of select="php:function('lang', 'Activity')" />
                                                                        </h4>
                                                                </label>
                                                                <select 
name="activity_id" id="field_activity" class="pure-u-1 pure-u-sm-1-2 
pure-u-lg-1-3">
-                                                                       <option 
value="">
+                                                                       <option 
value="-1">
                                                                                
<xsl:value-of select="php:function('lang', '-- select an activity --')" />
                                                                        
</option>
                                                                        
<xsl:for-each select="activities">
@@ -78,19 +93,27 @@
                                                                                
<xsl:value-of select="php:function('lang', 'Building')" />
                                                                        </h4>
                                                                </label>
-                                                               <!--div 
class="autocomplete"-->
-                                                               <input 
id="field_building_id" name="building_id" type="hidden">
-                                                                       
<xsl:attribute name="value">
-                                                                               
<xsl:value-of select="report/building_id"/>
-                                                                       
</xsl:attribute>
-                                                               </input>
-                                                               <input 
id="field_building_name" name="building_name" type="text" class="pure-u-1 
pure-u-sm-1-2 pure-u-md-1">
-                                                                       
<xsl:attribute name="value">
-                                                                               
<xsl:value-of select="report/building_name"/>
-                                                                       
</xsl:attribute>
-                                                               </input>
-                                                               <!--div 
id="building_container"/>
-                                                               </div-->
+                                                               <ul id= 
"variable_vertical" 
style="display:inline-block;list-style:none;padding:0px;margin:0px;">
+                                                                       <li>
+                                                                               
<label>
+                                                                               
        <input id="check_all_buildings" type="checkbox" value="1" 
name="all_buildings" >
+                                                                               
        </input>
+                                                                               
        <xsl:value-of select="php:function('lang', 'All')" />
+                                                                               
</label>
+                                                                       </li>
+                                                               </ul>
+                                                               <div 
id="building_container">
+                                                                       <input 
id="field_building_id" name="building_id" type="hidden">
+                                                                               
<xsl:attribute name="value">
+                                                                               
        <xsl:value-of select="report/building_id"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       <input 
id="field_building_name" name="building_name" type="text" class="pure-u-1 
pure-u-sm-1-2 pure-u-lg-1-3">
+                                                                               
<xsl:attribute name="value">
+                                                                               
        <xsl:value-of select="report/building_name"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </div>
                                                        </div>
                                                        <div 
class="pure-control-group">
                                                                <label>
@@ -158,27 +181,6 @@
                                                                                
        <input maxlength="2" size="2" class="pure-input" id="end_minute" 
name="end_minute" type="text" placeholder = "00"></input>
                                                                                
</div>
                                                                        </div>
-                                                                       
-                                                                       <div 
class="pure-control-group pure-u-1 pure-u-md-1-2 pure-u-lg-1">
-                                                                               
<!--label for="start_time">
-                                                                               
        <xsl:value-of select="php:function('lang', 'start time')" />
-                                                                               
</label>
-                                                                               
<span>
-                                                                               
        <input maxlength="2" size="2" id="start_hour" name="start_hour" 
type="text" placeholder = "00">
-                                                                               
        </input>
-                                                                               
        <xsl:text>:</xsl:text>
-                                                                               
        <input maxlength="2" size="2" id="start_minute" name="start_minute" 
type="text" placeholder = "00">
-                                                                               
        </input>
-                                                                               
</span
-                                                                               
<label for="end_time">
-                                                                               
        <xsl:value-of select="php:function('lang', 'end time')" />
-                                                                               
</label>
-                                                                               
<input maxlength="2" size="2" class="pure-input" id="end_hour" name="end_hour" 
type="text" placeholder = "00">
-                                                                               
</input>
-                                                                               
<xsl:text>:</xsl:text>
-                                                                               
<input maxlength="2" size="2" class="pure-input" id="end_minute" 
name="end_minute" type="text" placeholder = "00">
-                                                                               
</input>-->
-                                                                       </div>
 
                                                                </div>
                                                        </div>
@@ -193,9 +195,9 @@
                                                                                
<li>
                                                                                
        <label>
                                                                                
                <input type="checkbox" value="{id}" name="weekdays[]" >
-                                                                               
                        <xsl:if test="selected = 1">
+                                                                               
                        <!--xsl:if test="selected = 1"-->
                                                                                
                                <xsl:attribute 
name="checked">checked</xsl:attribute>
-                                                                               
                        </xsl:if>
+                                                                               
                        <!--/xsl:if-->
                                                                                
                </input>
                                                                                
                <xsl:value-of select="name" />
                                                                                
        </label>
@@ -278,6 +280,6 @@
        </form>
        <script type="text/javascript">
                var initialSelection = <xsl:value-of 
select="report/resources_json"/>;
-               var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'From', 'To', 'Resource Type')"/>;
+               var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'From', 'To', 'Resource Type', 'Select a building first')"/>;
        </script>
 </xsl:template>




reply via email to

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