fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12188] bkbooking: stavanger updated mail on cancel f


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [12188] bkbooking: stavanger updated mail on cancel function
Date: Thu, 16 Oct 2014 12:16:05 +0000

Revision: 12188
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12188
Author:   kjell
Date:     2014-10-16 12:16:05 +0000 (Thu, 16 Oct 2014)
Log Message:
-----------
bkbooking: stavanger updated mail on cancel function

Modified Paths:
--------------
    branches/stavangerkommune/booking/inc/class.boorganization.inc.php
    branches/stavangerkommune/booking/inc/class.soorganization.inc.php
    branches/stavangerkommune/booking/templates/base/settings.xsl
    branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php
    branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php
    branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php

Modified: branches/stavangerkommune/booking/inc/class.boorganization.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.boorganization.inc.php  
2014-10-16 12:06:33 UTC (rev 12187)
+++ branches/stavangerkommune/booking/inc/class.boorganization.inc.php  
2014-10-16 12:16:05 UTC (rev 12188)
@@ -103,8 +103,8 @@
                /**
                 * @see soorganization
                 */
-               function find_building_users($building_id)
+               function find_building_users($building_id, $split = false, 
$activities = array())
                {
-                       return $this->so->find_building_users($building_id, 
$this->build_default_read_params());
+                       return $this->so->find_building_users($building_id, 
$this->build_default_read_params(), $split, $activities);
                }
        }

Modified: branches/stavangerkommune/booking/inc/class.soorganization.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soorganization.inc.php  
2014-10-16 12:06:33 UTC (rev 12187)
+++ branches/stavangerkommune/booking/inc/class.soorganization.inc.php  
2014-10-16 12:16:05 UTC (rev 12188)
@@ -49,7 +49,7 @@
                                        ),
                                )
                        );
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->account = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
                function get_metainfo($id)
@@ -83,27 +83,95 @@
             $results = $groups->read(array("filters" => 
array("organization_id" => $organization_id)));
             return $results;
         }
-               
-               /**
-                * Returns the organizations who've used the building with the 
specified id
-                * within the last 300 days.
-                *
-                * @param int $building_id
-                * @param array $params Parameters to pass to socommon->read
-                *
-                * @return array (in socommon->read format)
-                */
-               function find_building_users($building_id, $params = array()) { 
                        
+
+        function get_resource_activity($resources)
+        {
+//            print_r($resources);
+            $resource_ids = implode(',',$resources);
+            $results = array();
+            $sql  = "SELECT activity_id FROM bb_resource where id in 
(".$resource_ids.")";
+            $this->db->query($sql, __LINE__, __FILE__);
+            while ($this->db->next_record())
+            {
+                $results[] = $this->db->f('activity_id', false);
+            }
+            return $results;
+
+        }
+
+        /**
+                 Returns the organizations who've used the building with the 
specified id
+                 within the last 300 days.
+
+                 @param int $building_id
+                 @param array $params Parameters to pass to socommon->read
+          @param bool $split Parameter
+          @param array $activities Parameters
+
+                 @return array (in socommon->read format)
+                **/
+               function find_building_users($building_id, $params = array(), 
$split = false, $activities = array()) {
+            $config    = CreateObject('phpgwapi.config','booking');
+            $config->read();
+            $test = '';
+
+            $pools = $config->config_data['split_pool_ids'];
+            $halls = $config->config_data['split_pool2_ids'];
+            $meeting = $config->config_data['split_pool3_ids'];
+            $excluded = $config->config_data['split_pool4_ids'];
+
+            if ($split) {
+                if (count($activities) > 1) {
+                    if (array_intersect($activities, explode(',', $pools)) && 
array_intersect($activities, explode(',', $halls))) {
+                        $test = " AND r.activity_id not in (".$excluded.") ";
+                    } elseif (array_intersect($activities, explode(',', 
$pools))) {
+                        $test = " AND r.activity_id not in (" . $pools . "," . 
$excluded . ") ";
+                    } elseif (array_intersect($activities, explode(',', 
$halls))) {
+                        $test = " AND r.activity_id not in (" . $halls . "," . 
$excluded . ") ";
+                    } elseif (array_intersect($activities, explode(',', 
$excluded))) {
+                        $test = " AND r.activity_id not in (" . $halls . "," . 
$pools . "," . $meeting . "," . $excluded . ") ";
+                    } else {
+                        $test = " AND r.activity_id not in (".$excluded.") ";
+                    }
+                } else {
+                    $activity = $activities[0];
+                    if (in_array($activity, explode(',', $pools))) {
+                        $test = " AND r.activity_id not in (" . $halls . ",". 
$meeting . "," . $excluded . ") ";
+                    } elseif (in_array($activity, explode(',', $halls))) {
+                        $test = " AND r.activity_id not in (" . $pools . "," . 
$excluded . ") ";
+                    } elseif (in_array($activity, explode(',', $excluded))) {
+                        $test = " AND r.activity_id not in (" . $halls . "," . 
$pools . "," . $meeting . "," . $excluded . ") ";
+                    } else {
+                        $test = " AND r.activity_id not in (".$excluded.") ";
+                    }
+                }
+            }
                        if (!isset($params['filters'])) { $params['filters'] = 
array(); }
                        if (!isset($params['filters']['where'])) { 
$params['filters']['where'] = array(); }
-                       
-                       $params['filters']['where'][] = '%%table%%.id IN ('.
-                               'SELECT o.id FROM bb_resource r '.
-                               'JOIN bb_allocation_resource ar ON 
ar.resource_id = r.id AND r.building_id = '.$this->_marshal($building_id, 
'int').' '.
-                               'JOIN bb_allocation a ON a.id = 
ar.allocation_id AND (a.from_ - \'now\'::timestamp < \'300 days\')'.
-                               'JOIN bb_organization o ON o.id = 
a.organization_id '.
-                       ')';
-                       
+            if ($config->config_data['mail_users_season'] == 'yes')
+            {
+                $params['filters']['where'][] = '%%table%%.id IN ('.
+                    'SELECT DISTINCT o.id FROM bb_resource r '.
+                    'JOIN bb_allocation_resource ar ON ar.resource_id = r.id 
AND r.building_id = '.$this->_marshal($building_id, 'int').' '.
+                    'JOIN bb_allocation a ON a.id = ar.allocation_id '.
+                    'JOIN bb_organization o ON o.id = a.organization_id '.
+                    'JOIN bb_season s ON s.building_id = r.building_id '.
+                    'WHERE s.active = 1 '.
+                    'AND s.from_ <= \'now\'::timestamp '.
+                    'AND s.to_ >= \'now\'::timestamp '.
+                    'AND a.from_ >= s.from_ '.
+                    'AND a.to_ <= s.to_ '.$test.' ORDER BY o.id ASC'.
+                    ')';
+            }
+            else
+            {
+                $params['filters']['where'][] = '%%table%%.id IN ('.
+                    'SELECT DISTINCT o.id FROM bb_resource r '.
+                    'JOIN bb_allocation_resource ar ON ar.resource_id = r.id 
AND r.building_id = '.$this->_marshal($building_id, 'int').' '.
+                    'JOIN bb_allocation a ON a.id = ar.allocation_id AND 
(a.from_ - \'now\'::timestamp < \'300 days\') '.
+                    'JOIN bb_organization o ON o.id = a.organization_id 
'.$test.' ORDER BY o.id ASC'.
+                    ')';
+            }
                        return $this->read($params);
                }
        }

Modified: branches/stavangerkommune/booking/templates/base/settings.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/settings.xsl       
2014-10-16 12:06:33 UTC (rev 12187)
+++ branches/stavangerkommune/booking/templates/base/settings.xsl       
2014-10-16 12:16:05 UTC (rev 12188)
@@ -1,120 +1,263 @@
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
     <div id="content">
 
-    <xsl:call-template name="msgbox"/>
-       <xsl:call-template name="yui_booking_i18n"/>
+        <xsl:call-template name="msgbox"/>
+        <xsl:call-template name="yui_booking_i18n"/>
 
-       <dl class="form">
-               <dt class="heading"><xsl:value-of select="php:function('lang', 
'Booking system settings')"/></dt>
-       </dl>
+        <dl class="form">
+            <dt class="heading">
+                <xsl:value-of select="php:function('lang', 'Booking system 
settings')"/>
+            </dt>
+        </dl>
 
-    <form action="" method="POST">
+        <form action="" method="POST">
 
-       <dl class="form">
-            <dt><label for="field_user_can_delete_bookings"><xsl:value-of 
select="php:function('lang', 'Frontend users can delete 
bookings/events')"/></label></dt>
-                       <dd>
-                               <select id="field_user_can_delete_bookings" 
name="config_data[user_can_delete_bookings]">
-                    <option value="no">
-                        <xsl:if 
test="config_data/user_can_delete_bookings='no'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'No')" />
-                    </option>
-                    <option value="yes">
-                        <xsl:if 
test="config_data/user_can_delete_bookings='yes'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'Yes')" />
-                          </option>
-                       </select>
-                       </dd>
-           <dd><xsl:value-of select="php:function('lang', 'Events is deleted 
from database')"/></dd>
-           <dd>
-               <select id="field_user_can_delete_events" 
name="config_data[user_can_delete_events]">
-                   <option value="no">
-                       <xsl:if test="config_data/user_can_delete_events='no'">
-                           <xsl:attribute 
name="selected">checked</xsl:attribute>
-                       </xsl:if>
-                       <xsl:value-of select="php:function('lang', 'No')" />
-                   </option>
-                   <option value="yes">
-                       <xsl:if test="config_data/user_can_delete_events='yes'">
-                           <xsl:attribute 
name="selected">checked</xsl:attribute>
-                       </xsl:if>
-                       <xsl:value-of select="php:function('lang', 'Yes')" />
-                   </option>
-               </select>
-           </dd>
-            <dt><label for="field_user_can_delete_allocations"><xsl:value-of 
select="php:function('lang', 'Frontend users can delete 
allocations')"/></label></dt>
-                       <dd>
-                               <select id="field_user_can_delete_allocations" 
name="config_data[user_can_delete_allocations]">
-                    <option value="no">
-                        <xsl:if 
test="config_data/user_can_delete_allocations='no'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'No')" />
-                    </option>
-                    <option value="yes">
-                        <xsl:if 
test="config_data/user_can_delete_allocations='yes'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'Yes')" />
-                          </option>
-                    <option value="never">
-                        <xsl:if 
test="config_data/user_can_delete_allocations='never'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'No 
action')" />
-                    </option>
-                       </select>
-                       </dd>
-            <dt><label for="field_extra_schedule"><xsl:value-of 
select="php:function('lang', 'Activate extra kalendar field on 
building')"/></label></dt>
-                       <dd>
-                               <select id="field_extra_schedule" 
name="config_data[extra_schedule]">
-                    <option value="no">
-                        <xsl:if test="config_data/extra_schedule='no'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'No')" />
-                    </option>
-                    <option value="yes">
-                        <xsl:if test="config_data/extra_schedule='yes'">
-                            <xsl:attribute 
name="selected">checked</xsl:attribute>
-                        </xsl:if>
-                        <xsl:value-of select="php:function('lang', 'Yes')" />
-                          </option>
-                       </select>
-                       </dd>
+            <dl class="form">
+                <dt>
+                    <label for="field_user_can_delete_bookings">
+                        <xsl:value-of select="php:function('lang', 'Frontend 
users can delete bookings/events')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <select id="field_user_can_delete_bookings" 
name="config_data[user_can_delete_bookings]">
+                        <option value="no">
+                            <xsl:if 
test="config_data/user_can_delete_bookings='no'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'No')"/>
+                        </option>
+                        <option value="yes">
+                            <xsl:if 
test="config_data/user_can_delete_bookings='yes'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Yes')"/>
+                        </option>
+                    </select>
+                </dd>
+                <dd>
+                    <xsl:value-of select="php:function('lang', 'Events is 
deleted from database')"/>
+                </dd>
+                <dd>
+                    <select id="field_user_can_delete_events" 
name="config_data[user_can_delete_events]">
+                        <option value="no">
+                            <xsl:if 
test="config_data/user_can_delete_events='no'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'No')"/>
+                        </option>
+                        <option value="yes">
+                            <xsl:if 
test="config_data/user_can_delete_events='yes'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Yes')"/>
+                        </option>
+                    </select>
+                </dd>
+                <dt>
+                    <label for="field_user_can_delete_allocations">
+                        <xsl:value-of select="php:function('lang', 'Frontend 
users can delete allocations')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <select id="field_user_can_delete_allocations" 
name="config_data[user_can_delete_allocations]">
+                        <option value="no">
+                            <xsl:if 
test="config_data/user_can_delete_allocations='no'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'No')"/>
+                        </option>
+                        <option value="yes">
+                            <xsl:if 
test="config_data/user_can_delete_allocations='yes'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Yes')"/>
+                        </option>
+                        <option value="never">
+                            <xsl:if 
test="config_data/user_can_delete_allocations='never'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'No 
action')"/>
+                        </option>
+                    </select>
+                </dd>
+                <dt>
+                    <label for="field_extra_schedule">
+                        <xsl:value-of select="php:function('lang', 'Activate 
extra kalendar field on building')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <select id="field_extra_schedule" 
name="config_data[extra_schedule]">
+                        <option value="no">
+                            <xsl:if test="config_data/extra_schedule='no'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'No')"/>
+                        </option>
+                        <option value="yes">
+                            <xsl:if test="config_data/extra_schedule='yes'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Yes')"/>
+                        </option>
+                    </select>
+                </dd>
 
-            <dt><label for="field_extra_schedule_ids"><xsl:value-of 
select="php:function('lang', 'Ids that should be included in the 
calendar')"/></label></dt>
-                       <dd>
-                               <input id="field_extra_schedule_ids" 
type="text" name="config_data[extra_schedule_ids]">
-                                       <xsl:attribute 
name="value"><xsl:value-of 
select="config_data/extra_schedule_ids"/></xsl:attribute>
-                               </input>
-                       </dd>
-           <dt class="heading"><xsl:value-of select="php:function('lang', 
'Email warnings')"/></dt>
-           <dt><label for="field_cancelation_email_addresses"><xsl:value-of 
select="php:function('lang', 'Cancelation Email Addresses')" /></label></dt>
-           <dd>
-               <textarea id="field_emails" class="full-width" 
name="config_data[emails]"><xsl:value-of 
select="config_data/emails"/></textarea>
-           </dd>
+                <dt>
+                    <label for="field_extra_schedule_ids">
+                        <xsl:value-of select="php:function('lang', 'Ids that 
should be included in the calendar')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <input id="field_extra_schedule_ids" type="text" 
name="config_data[extra_schedule_ids]">
+                        <xsl:attribute name="value">
+                            <xsl:value-of 
select="config_data/extra_schedule_ids"/>
+                        </xsl:attribute>
+                    </input>
+                </dd>
+                <dt class="heading">
+                    <xsl:value-of
+                            select="php:function('lang', 'Split mail if 
building contains swiming pools resources')"/>
+                </dt>
+                <dt>
+                    <label for="field_split_pool">
+                        <xsl:value-of select="php:function('lang', 'Split mail 
when building has swiming pool')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <select id="field_split_pool" 
name="config_data[split_pool]">
+                        <option value="no">
+                            <xsl:if test="config_data/split_pool='no'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'No')"/>
+                        </option>
+                        <option value="yes">
+                            <xsl:if test="config_data/split_pool='yes'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Yes')"/>
+                        </option>
+                    </select>
+                </dd>
+                <dt>
+                    <label for="field_split_pool_ids">
+                        <xsl:value-of select="php:function('lang', 'activities 
that uses swimming pools')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <input id="field_split_pool_ids" type="text" 
name="config_data[split_pool_ids]">
+                        <xsl:attribute name="value">
+                            <xsl:value-of select="config_data/split_pool_ids"/>
+                        </xsl:attribute>
+                    </input>
+                </dd>
+                <dt>
+                    <label for="fieldsplit_pool2_ids">
+                        <xsl:value-of select="php:function('lang', 'other 
activities')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <input id="field_split_pool2_ids" type="text" 
name="config_data[split_pool2_ids]">
+                        <xsl:attribute name="value">
+                            <xsl:value-of 
select="config_data/split_pool2_ids"/>
+                        </xsl:attribute>
+                    </input>
+                </dd>
+                <dt>
+                    <label for="fieldsplit_pool3_ids">
+                        <xsl:value-of select="php:function('lang', 'activities 
that all should get except those in the next field.')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <input id="field_split_pool3_ids" type="text" 
name="config_data[split_pool3_ids]">
+                        <xsl:attribute name="value">
+                            <xsl:value-of 
select="config_data/split_pool3_ids"/>
+                        </xsl:attribute>
+                    </input>
+                </dd>
+                <dt>
+                    <label for="fieldsplit_pool4_ids">
+                        <xsl:value-of select="php:function('lang', 'activities 
that never should get mail')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <input id="field_split_pool4_ids" type="text" 
name="config_data[split_pool4_ids]">
+                        <xsl:attribute name="value">
+                            <xsl:value-of 
select="config_data/split_pool4_ids"/>
+                        </xsl:attribute>
+                    </input>
+                </dd>
+                <dt class="heading">
+                    <xsl:value-of
+                            select="php:function('lang', 'Who get cancelation 
mails')"/>
+                </dt>
+                <dt>
+                    <label for="field_mail_users_season">
+                        <xsl:value-of select="php:function('lang', 'Users of 
current season or users the last 300 days')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <select id="field_mail_users_season" 
name="config_data[mail_users_season]">
+                        <option value="no">
+                            <xsl:if test="config_data/mail_users_season='no'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 'Last 
300 days')"/>
+                        </option>
+                        <option value="yes">
+                            <xsl:if test="config_data/mail_users_season='yes'">
+                                <xsl:attribute 
name="selected">checked</xsl:attribute>
+                            </xsl:if>
+                            <xsl:value-of select="php:function('lang', 
'Season')"/>
+                        </option>
+                    </select>
+                </dd>
+                <dt class="heading">
+                    <xsl:value-of select="php:function('lang', 'Email 
warnings')"/>
+                </dt>
+                <dt>
+                    <label for="field_cancelation_email_addresses">
+                        <xsl:value-of select="php:function('lang', 
'Cancelation Email Addresses')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <xsl:value-of
+                            select="php:function('lang', 'One e-mail pr. 
line.')"/>
+                </dd>
+                <dd>
+                    <textarea id="field_emails" class="full-width" 
name="config_data[emails]">
+                        <xsl:value-of select="config_data/emails"/>
+                    </textarea>
+                </dd>
 
-               <dt class="heading"><xsl:value-of select="php:function('lang', 
'Billing sequence numbers')"/></dt>
-                       <dd>
-                               <xsl:value-of select="php:function('lang', 'Do 
not change these values unless you know what they are.')"/>
-                       </dd>
-                       <dt><label 
for="field_internal_billing_sequence_number"><xsl:value-of 
select="php:function('lang', 'Current internal billing sequence number')" 
/></label></dt>
-                       <dd>
-                               <input type="number" name="billing[internal]">
-                                       <xsl:attribute 
name="value"><xsl:value-of select="billing/internal"/></xsl:attribute>
-                               </input>
-                       </dd>
-       </dl>
+                <dt class="heading">
+                    <xsl:value-of select="php:function('lang', 'Billing 
sequence numbers')"/>
+                </dt>
+                <dd>
+                    <xsl:value-of
+                            select="php:function('lang', 'Do not change these 
values unless you know what they are.')"/>
+                </dd>
+                <dt>
+                    <label for="field_internal_billing_sequence_number">
+                        <xsl:value-of select="php:function('lang', 'Current 
internal billing sequence number')"/>
+                    </label>
+                </dt>
+                <dd>
+                    <input type="number" name="billing[internal]">
+                        <xsl:attribute name="value">
+                            <xsl:value-of select="billing/internal"/>
+                        </xsl:attribute>
+                    </input>
+                </dd>
+            </dl>
 
-               <div class="form-buttons">
-                       <input type="submit">
-                       <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Save')"/></xsl:attribute>
-                       </input>
-               </div>
-    </form>
+            <div class="form-buttons">
+                <input type="submit">
+                    <xsl:attribute name="value">
+                        <xsl:value-of select="php:function('lang', 'Save')"/>
+                    </xsl:attribute>
+                </input>
+            </div>
+        </form>
     </div>
 </xsl:template>

Modified: 
branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php    
2014-10-16 12:06:33 UTC (rev 12187)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php    
2014-10-16 12:16:05 UTC (rev 12188)
@@ -20,12 +20,9 @@
                        $this->booking_bo = CreateObject('booking.bobooking');
        }
 
-               public function building_users($building_id) {
-
+               public function building_users($building_id, $type=false, 
$activities=array() ) {
             $contacts = array();
-#            $building = $this->building_bo->so->read_single($building_id);
-            
-                       $organizations = 
$this->organization_bo->find_building_users($building_id);
+                       $organizations = 
$this->organization_bo->find_building_users($building_id, $type, $activities);
             foreach($organizations['results'] as $org)
             {
                 if ($org['email'] != '' && strstr($org['email'], '@')) {
@@ -128,9 +125,17 @@
                    $errors = array();
                                $invalid_dates = array();
                                $valid_dates = array();
-       
-                $mailadresses = 
$this->building_users($allocation['building_id'],$allocation['organization_id']);
 
+                if ($config->config_data['split_pool'] == 'yes')
+                {
+                    $split = 1;
+                } else {
+                    $split = 0;
+                }
+                $resources = $allocation['resources'];
+                
$activity=$this->organization_bo->so->get_resource_activity($resources);
+                $mailadresses = 
$this->building_users($allocation['building_id'], $split, $activity);
+
                 $maildata = array();
                 $maildata['outseason'] = $outseason;           
                 $maildata['recurring'] = $recurring;           

Modified: branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php       
2014-10-16 12:06:33 UTC (rev 12187)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php       
2014-10-16 12:16:05 UTC (rev 12188)
@@ -592,12 +592,9 @@
                                        );
                }
 
-               public function building_users($building_id, $group_id, 
$delete_allocation) {
-
+               public function building_users($building_id, $group_id, 
$type=false, $activities=array()) {
             $contacts = array();
-#            $building = $this->building_bo->so->read_single($building_id);
-            
-                       $organizations = 
$this->organization_bo->find_building_users($building_id);
+                       $organizations = 
$this->organization_bo->find_building_users($building_id, $type, $activities);
             foreach($organizations['results'] as $org)
             {
                 if ($org['email'] != '' && strstr($org['email'], '@')) {
@@ -716,7 +713,15 @@
                    $allocation_delete = array();
                    $allocation_keep = array();
 
-                $mailadresses = 
$this->building_users($booking['building_id'],$booking['group_id'], 
$delete_allocation);
+                if ($config->config_data['split_pool'] == 'yes')
+                {
+                    $split = 1;
+                } else {
+                    $split = 0;
+                }
+                $resources = $booking['resources'];
+                
$activity=$this->organization_bo->so->get_resource_activity($resources);
+                $mailadresses = 
$this->building_users($booking['building_id'],$booking['group_id'], $split, 
$activity);
 
                 $maildata = array();
                 $maildata['outseason'] = $outseason;           

Modified: branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php 
2014-10-16 12:06:33 UTC (rev 12187)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uievent.inc.php 
2014-10-16 12:16:05 UTC (rev 12188)
@@ -31,7 +31,6 @@
             $bouser = CreateObject('bookingfrontend.bouser');
             $config    = CreateObject('phpgwapi.config','booking');
             $config->read();
-
             $errors = array();
             $customer = array();
 
@@ -53,7 +52,15 @@
                 $customer['customer_organization_number'] = 
$organization['organization_number'];
                 $customer['customer_internal'] = 
$organization['customer_internal'];
             }
-            $mailadresses = 
$this->building_users($event['building_id'],$event['organization_id']);
+            if ($config->config_data['split_pool'] == 'yes')
+            {
+                $split = 1;
+            } else {
+                $split = 0;
+            }
+            $resources = $event['resources'];
+            
$activity=$this->organization_bo->so->get_resource_activity($resources);
+            $mailadresses = $this->building_users($event['building_id'], 
$split, $activity);
 
             
if(!$bouser->is_organization_admin($customer['customer_organization_id'])) {
                 $date = substr($event['from_'], 0, 10);
@@ -139,7 +146,6 @@
             $config    = CreateObject('phpgwapi.config','booking');
             $config->read();
 
-
             $event = $this->bo->read_single(intval(phpgw::get_var('id', 
'GET')));
             $bouser = CreateObject('bookingfrontend.bouser');
             $errors = array();
@@ -160,7 +166,17 @@
                 $event['customer_organization_name'] = $orginfo['name'];
             }
 
-            $mailadresses = 
$this->building_users($event['building_id'],$event['organization_id']);
+            if ($config->config_data['split_pool'] == 'yes')
+            {
+                $split = 1;
+            } else {
+                $split = 0;
+            }
+
+            $resources = $event['resources'];
+            
$activity=$this->organization_bo->so->get_resource_activity($resources);
+            $mailadresses = $this->building_users($event['building_id'], 
$split, $activity);
+
             if($_SERVER['REQUEST_METHOD'] == 'POST')
             {
                 if($cdate < $event['to_']) {
@@ -196,9 +212,9 @@
             self::render_template('event_delete', array('event' => $event, 
'activities' => $activities, 'can_delete_events' => $can_delete_events));
         }
 
-        public function building_users($building_id) {
+        public function building_users($building_id, $type=false, 
$activities=array()) {
             $contacts = array();
-            $organizations = 
$this->organization_bo->find_building_users($building_id);
+            $organizations = 
$this->organization_bo->find_building_users($building_id, $type, $activities);
             foreach($organizations['results'] as $key => $org)
             {
                 if ($org['email'] != '' && strstr($org['email'], '@')) {




reply via email to

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