[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11876] bkbooking: stavanger update info screen, adde
From: |
Kjell Arne Espedal |
Subject: |
[Fmsystem-commits] [11876] bkbooking: stavanger update info screen, added email to admin |
Date: |
Fri, 28 Mar 2014 13:32:28 +0000 |
Revision: 11876
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11876
Author: kjell
Date: 2014-03-28 13:32:26 +0000 (Fri, 28 Mar 2014)
Log Message:
-----------
bkbooking: stavanger update info screen, added email to admin
Modified Paths:
--------------
branches/stavangerkommune/booking/inc/class.boallocation.inc.php
branches/stavangerkommune/booking/inc/class.bobooking.inc.php
branches/stavangerkommune/booking/inc/class.bodocument_view.inc.php
branches/stavangerkommune/booking/inc/class.soapplication.inc.php
branches/stavangerkommune/booking/inc/class.sobooking.inc.php
branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
branches/stavangerkommune/booking/setup/phpgw_no.lang
branches/stavangerkommune/booking/setup/setup.inc.php
branches/stavangerkommune/booking/setup/tables_current.inc.php
branches/stavangerkommune/booking/setup/tables_update.inc.php
branches/stavangerkommune/booking/templates/base/application.xsl
branches/stavangerkommune/booking/templates/base/application_edit.xsl
branches/stavangerkommune/booking/templates/base/application_new.xsl
branches/stavangerkommune/booking/templates/base/application_settings.xsl
branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php
branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php
branches/stavangerkommune/bookingfrontend/inc/class.uibuilding.inc.php
branches/stavangerkommune/bookingfrontend/setup/setup.inc.php
branches/stavangerkommune/bookingfrontend/templates/stavanger/application_new.xsl
Modified: branches/stavangerkommune/booking/inc/class.boallocation.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.boallocation.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/inc/class.boallocation.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -85,6 +85,86 @@
}
+ function send_admin_notification($allocation, $maildata,
$system_message)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $mailadresses = $config->config_data['emails'];
+ $mailadresses = explode("\n",$mailadresses);
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $subject = $system_message['title'];
+ $body = '<b>Beksjed fra '.$system_message['name'].'</b><br
/>'.$system_message['message'].'<br /><br /><b>Epost som er sendt til brukere
av Hallen:</b><br />';
+
+
+ if ($config->config_data['user_can_delete_allocations'] == 'yes') {
+ if($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on')
+ {
+ $res_names = '';
+ foreach ($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($allocation['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/?menuaction=booking.uiapplication.add&building_id=';
+ $link .=
$allocation['building_id'].'&building_name='.urlencode($allocation['building_name']).'&from_[]=';
+ $link .=
urlencode($allocation['from_']).'&to_[]='.urlencode($allocation['to_']).'&resource='.$allocation['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$allocation['organization_name'].' har
avbestilt tid i '.$allocation['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } else {
+ $res_names = '';
+ foreach ($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .=
pretty_timestamp($valid_date['from_'])." - ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/?menuaction=booking.uiapplication.add&building_id=';
+ $link .=
$allocation['building_id'].'&building_name='.urlencode($allocation['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$allocation['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply
for time').'</a><br />';
+ }
+
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$allocation['organization_name'].' har
avbestilt tid i '.$allocation['building_name'];
+ $body .= $info_deleted.'</p>';
+ }
+ } else {
+ $body .= "<p>Det er ikke sendt noen beskjed til brukere.</p>";
+ }
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '',
$from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+
+ }
+
+
/**
* @see bocommon_authorized
*/
Modified: branches/stavangerkommune/booking/inc/class.bobooking.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.bobooking.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/inc/class.bobooking.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -74,8 +74,8 @@
$info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
$info_deleted .= pretty_timestamp($valid_date['to_']);
$link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
- $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
- $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']);
+ $link .=
'&from_[]='.urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
$info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
}
@@ -124,14 +124,15 @@
$res_names =
$res_names.$this->so->get_resource($res)." ";
}
$info_deleted = ':<p>';
- $info_deleted = $info_deleted."".$res_names." -
";
- $info_deleted .= pretty_timestamp($allocation['from_'])." - ";
- $info_deleted .= pretty_timestamp($allocation['to_']);
- $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
- $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
- $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
- $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
-
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted =
$info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($allocation['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
$subject =
$config->config_data['allocation_canceled_mail_subject'];
$body = "<p>".$config->config_data['allocation_canceled_mail'];
$body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
@@ -153,6 +154,125 @@
}
}
+ function send_admin_notification($booking, $maildata, $system_message,
$allocation, $valid_dates=null)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $subject = $system_message['title'];
+ $body = '<b>Beksjed fra '.$system_message['name'].'</b><br
/>'.$system_message['message'].'<br /><br /><b>Epost som er sendt til brukere
av Hallen:</b><br />';
+ $mailadresses = $config->config_data['emails'];
+ $mailadresses = explode("\n",$mailadresses);
+
+ if(($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on' && $maildata['delete_allocation'] != 'on') ||
+ ($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on' && $maildata['delete_allocation'] == 'on' &&
+ $maildata['allocation'] == 0))
+ {
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($booking['from_']).'&to_[]='.urlencode($booking['to_']).'&resource='.$booking['resources'][0];
+
+ $body .= "<p>".$config->config_data['booking_canceled_mail'];
+ $body .= '</p><p>'.$booking['group_name'].' har avbestilt tid
i '.$booking['building_name'].':<br />';
+ $body .= $this->so->get_resource($booking['resources'][0]).'
den '.pretty_timestamp($booking['from_']);
+ $body .=' til '.pretty_timestamp($booking['to_']);
+ $body .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a></p>';
+
+ } elseif (($maildata['outseason'] == 'on' ||
$maildata['recurring'] == 'on') && $maildata['delete_allocation'] != 'on') {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names = $res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($valid_dates as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']);
+ $link .=
'&from_[]='.urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+ $body .= "<p>".$config->config_data['booking_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } elseif (($maildata['outseason'] == 'on' ||
$maildata['recurring'] == 'on') && $maildata['delete_allocation'] == 'on') {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names = $res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($valid_dates as $valid_date) {
+ if (!in_array($valid_date,$maildata['delete'])) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .=
pretty_timestamp($valid_date['from_'])." - ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply
for time').'</a><br />';
+ }
+ }
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } else {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names = $res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($allocation['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']);
+ $link .=
'&from_[]='.urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+ }
+
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '',
$from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+ }
+
+
/**
* @see bocommon_authorized
*/
@@ -303,7 +423,6 @@
function building_schedule($building_id, $date)
{
-
$from = clone $date;
$from->setTime(0, 0, 0);
// Make sure $from is a monday
@@ -374,7 +493,7 @@
return array('total_records'=>count($results),
'results'=>$results);
}
- function building_infoscreen_schedule($building_id, $date)
+ function building_infoscreen_schedule($building_id, $date, $res
= False)
{
$from = clone $date;
$from->setTime(0, 0, 0);
@@ -385,11 +504,18 @@
}
$to = clone $from;
$to->modify('+7 days');
+ echo "<pre>";
+ if ($res != False){
+ $resources = $this->so->get_screen_resources($building_id,
$res);
+ if (count($resources) > 0)
+ $resources = "AND bb_resource.id IN (".implode(",",
$resources).")";
+ else
+ $resources = '';
+ }
+ $allocations = $this->so->get_screen_allocation($building_id,
$from, $to, $resources);
+ $bookings = $this->so->get_screen_booking($building_id, $from,
$to, $resources);
+ $events = $this->so->get_screen_event($building_id, $from, $to,
$resources);
- $allocations = $this->so->get_screen_allocation($building_id,
$from, $to);
- $bookings = $this->so->get_screen_booking($building_id, $from,
$to);
- $events = $this->so->get_screen_event($building_id, $from, $to);
-
$results = array();
foreach($allocations as &$allocation)
Modified: branches/stavangerkommune/booking/inc/class.bodocument_view.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.bodocument_view.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/inc/class.bodocument_view.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -12,11 +12,10 @@
public function read_regulations() {
$params = $this->build_default_read_params();
!isset($params['filters']) AND $params['filters'] =
array();
-
- $params['filters']['category'] =
array(booking_sodocument::CATEGORY_REGULATION,
booking_sodocument::CATEGORY_HMS_DOCUMENT);
-
+ $params['filters']['category'] =
array(booking_sodocument::CATEGORY_REGULATION,
+ booking_sodocument::CATEGORY_HMS_DOCUMENT,
+ booking_sodocument::CATEGORY_PRICE_LIST);
$where_filter = array();
-
if ($owner_filters = phpgw::get_var('owner', 'string'))
{
foreach($owner_filters as $filter) {
list($owner_type, $owner_id) =
explode('::', $filter);
@@ -25,9 +24,7 @@
$where_filter[] =
"(%%table%%.type=$owner_type AND %%table%%.owner_id = $owner_id)";
}
}
-
$params['filters']['where'] =
array('('.join($where_filter, ' OR ').')');
-
return $this->so->read($params);
}
}
\ No newline at end of file
Modified: branches/stavangerkommune/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soapplication.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/inc/class.soapplication.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -40,6 +40,7 @@
'column' =>
'name'
)),
'description' => array('type' =>
'string', 'query' => true, 'required' => true),
+ 'equipment' => array('type' => 'string', 'query' =>
true, 'required' => false),
'contact_name' => array('type' =>
'string', 'query' => true, 'required'=> true),
'contact_email' => array('type' =>
'string', 'required'=> true, 'sf_validator' =>
createObject('booking.sfValidatorEmail', array(), array('invalid' => '%field%
is invalid'))),
'contact_phone' => array('type' =>
'string'),
Modified: branches/stavangerkommune/booking/inc/class.sobooking.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.sobooking.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/inc/class.sobooking.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -336,9 +336,6 @@
public function get_booking_id($booking)
{
- $table_name = $this->table_name;
- $db = $this->db;
-
$from = "'".$booking['from_']."'";
$to = "'".$booking['to_']."'";
$gid = $booking['group_id'];
@@ -357,9 +354,6 @@
public function check_allocation($id)
{
- $table_name = $this->table_name;
- $db = $this->db;
-
$sql = "SELECT allocation_id as aid FROM bb_booking WHERE
allocation_id = ( SELECT allocation_id FROM bb_booking WHERE id = ($id) ) GROUP
BY allocation_id HAVING count(id) < 2";
$this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
@@ -545,7 +539,33 @@
$db->query($sql, __LINE__, __FILE__);
}
- function get_screen_allocation($building_id, $start, $end)
+
+ function get_screen_resources($building_id, $res = False){
+ $building_id = intval($building_id);
+ if (intval($res) == 1) {
+ $type = "AND ba.name IN ('Idrett','Friidrett','Svømming')";
+ } elseif (intval($res) == 2){
+ $type = "AND ba.name IN ('Barnehage','Styrkerom','Møterom')";
+ } else {
+ $type = '';
+ }
+ $results = array();
+ $sql = "SELECT br.id
+ FROM bb_resource br, bb_activity ba
+ WHERE ba.id = br.activity_id ".$type."
+ AND br.building_id = ".$building_id."
+ AND br.active = 1
+ ORDER by br.sort";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = $this->db->f('id', false);
+ }
+ return $results;
+ }
+
+ function get_screen_allocation($building_id, $start, $end, $resources
= False)
{
$start = $start->format('Y-m-d H:i');
$end = $end->format('Y-m-d H:i');
@@ -569,8 +589,11 @@
INNER JOIN bb_organization ON (bb_organization.id =
bb_allocation.organization_id)
WHERE bb_allocation.from_ > '".$start."' AND
bb_allocation.to_ < '".$end."'
AND bb_resource.building_id = (".$building_id.")
+ ".$resources."
AND bb_allocation.active = 1
- ORDER BY building_name,sort, from_;";
+ ORDER BY building_name, sort, from_;";
+// print_r($sql);
+// exit;
$this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record())
{
@@ -589,11 +612,13 @@
}
return $results;
}
- function get_screen_booking($building_id, $start, $end)
+
+ function get_screen_booking($building_id, $start, $end, $resources =
False)
{
$start = $start->format('Y-m-d H:i');
$end = $end->format('Y-m-d H:i');
$building_id = intval($building_id);
+
$results = array();
$sql = "SELECT
bb_booking.id AS id,
@@ -614,6 +639,7 @@
INNER JOIN bb_group ON (bb_group.id = bb_booking.group_id)
WHERE bb_booking.from_ > '".$start."' AND bb_booking.to_ <
'".$end."'
AND bb_resource.building_id = (".$building_id.")
+ ".$resources."
AND bb_booking.active = 1
ORDER BY building_name,sort, from_;";
$this->db->query($sql, __LINE__, __FILE__);
@@ -636,7 +662,7 @@
return $results;
}
- function get_screen_event($building_id, $start, $end)
+ function get_screen_event($building_id, $start, $end, $resources = '')
{
$start = $start->format('Y-m-d H:i');
$end = $end->format('Y-m-d H:i');
@@ -657,6 +683,7 @@
INNER JOIN bb_resource ON (bb_resource.id =
bb_event_resource.resource_id)
WHERE bb_event.from_ > '".$start."' AND bb_event.to_ <
'".$end."'
AND bb_resource.building_id = (".$building_id.")
+ ".$resources."
AND bb_event.active = 1
ORDER BY building_name,sort,from_;";
$this->db->query($sql, __LINE__, __FILE__);
Modified: branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -32,7 +32,7 @@
$this->resource_bo = CreateObject('booking.boresource');
$this->document_bo =
CreateObject('booking.bodocument_building');
self::set_active_menu('booking::applications');
- $this->fields = array('description', 'resources',
'activity_id',
+ $this->fields = array('description', 'equipment',
'resources', 'activity_id',
'building_id', 'building_name', 'contact_name',
'contact_email', 'contact_phone', 'audience',
'active',
'accepted_documents');
@@ -584,6 +584,7 @@
$timestamp = strtotime($from);
$from = date("Y-m-d H:i:s",$timestamp);
}
+
foreach ($_POST['to_'] as &$to) {
$timestamp = strtotime($to);
$to = date("Y-m-d H:i:s",$timestamp);
@@ -591,6 +592,7 @@
$application['dates'] = array_map(array(self,
'_combine_dates'), $_POST['from_'], $_POST['to_']);
+
if(!$errors)
{
$receipt =
$this->bo->update($application);
Modified: branches/stavangerkommune/booking/setup/phpgw_no.lang
===================================================================
--- branches/stavangerkommune/booking/setup/phpgw_no.lang 2014-03-26
13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/setup/phpgw_no.lang 2014-03-28
13:32:26 UTC (rev 11876)
@@ -112,6 +112,7 @@
day of the week booking no Ukedag
dec booking no desember
description booking no Beskrivelse
+Extra information booking no Ekstra informasjon om arrangement
district booking no Bydel
document booking no Dokument
document name booking no Dokumentnavn
@@ -642,3 +643,4 @@
Frontend users can delete allocations booking no Frontend bruker kan
slette tildelinger
Activate extra kalendar field on building booking no Aktiver ekstra
kalender felt på bygg
Ids that should be included in the calendar booking no Id som skal
brukes i ekstra kalender
+Extra information for the event booking no Ekstra informasjon på
arrangement
\ No newline at end of file
Modified: branches/stavangerkommune/booking/setup/setup.inc.php
===================================================================
--- branches/stavangerkommune/booking/setup/setup.inc.php 2014-03-26
13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/setup/setup.inc.php 2014-03-28
13:32:26 UTC (rev 11876)
@@ -1,6 +1,6 @@
<?php
$setup_info['booking']['name'] = 'booking';
- $setup_info['booking']['version'] = '0.2.15';
+ $setup_info['booking']['version'] = '0.2.16';
$setup_info['booking']['app_order'] = 9;
$setup_info['booking']['enable'] = 1;
$setup_info['booking']['app_group'] = 'office';
Modified: branches/stavangerkommune/booking/setup/tables_current.inc.php
===================================================================
--- branches/stavangerkommune/booking/setup/tables_current.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/setup/tables_current.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -186,6 +186,7 @@
'building_name' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'activity_id' => array('type' =>
'int','precision' => '4','nullable' => False),
'description' => array('type' => 'text',
'nullable' => False),
+ 'equipment' => array('type' => 'text', 'nullable' => True),
'contact_name' => array('type' => 'text',
'nullable' => False),
'contact_email' => array('type' => 'text',
'nullable' => False),
'contact_phone' => array('type' => 'text',
'nullable' => False),
Modified: branches/stavangerkommune/booking/setup/tables_update.inc.php
===================================================================
--- branches/stavangerkommune/booking/setup/tables_update.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/setup/tables_update.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -2760,3 +2760,22 @@
}
}
+$test[] = '0.2.15';
+/**
+ * Update booking version from 0.2.15 to 0.2.16
+ * add another tilsynsvakt to buidling
+ *
+ */
+function booking_upgrade0_2_15()
+{
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE bb_application
ADD COLUMN equipment text DEFAULT NULL");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE bb_application SET
equipment = NULL");
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['booking']['currentver'] = '0.2.16';
+ return $GLOBALS['setup_info']['booking']['currentver'];
+ }
+}
Modified: branches/stavangerkommune/booking/templates/base/application.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/application.xsl
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/templates/base/application.xsl
2014-03-28 13:32:26 UTC (rev 11876)
@@ -115,6 +115,8 @@
<dd><xsl:value-of select="application/activity_name"/></dd>
<dt><xsl:value-of select="php:function('lang', 'Description')"
/></dt>
<dd><div style="width: 80%;"><xsl:value-of
select="application/description"/></div></dd>
+ <dt><xsl:value-of select="php:function('lang', 'Extra
information')" /></dt>
+ <dd><div style="width: 80%;"><xsl:value-of
select="application/equipment"/></div></dd>
</dl>
<dl class="proplist-col">
<dt class="heading">3. <xsl:value-of select="php:function('lang',
'Where?')" /></dt>
Modified: branches/stavangerkommune/booking/templates/base/application_edit.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/application_edit.xsl
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/templates/base/application_edit.xsl
2014-03-28 13:32:26 UTC (rev 11876)
@@ -46,6 +46,10 @@
<dd>
<textarea id="field_description"
class="full-width" name="description"><xsl:value-of
select="application/description"/></textarea>
</dd>
+ <dt><label for="field_equipment"><xsl:value-of
select="php:function('lang', 'Equipment')" /></label></dt>
+ <dd>
+ <textarea id="field_equipment" class="full-width"
name="equipment"><xsl:value-of select="application/equipment"/></textarea>
+ </dd>
</dl>
<div class="clr"/>
<dl class="form-col">
Modified: branches/stavangerkommune/booking/templates/base/application_new.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/application_new.xsl
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/templates/base/application_new.xsl
2014-03-28 13:32:26 UTC (rev 11876)
@@ -47,6 +47,16 @@
<dd>
<textarea id="field_description"
class="full-width" name="description"><xsl:value-of
select="application/description"/></textarea>
</dd>
+ <dt>
+ <xsl:if test="config/application_equipment">
+ <p>
+ <xsl:value-of select="config/application_equipment"/>
+ </p>
+ </xsl:if>
+ </dt>
+ <dd>
+ <textarea id="field_equipment" class="full-width"
name="equipment"><xsl:value-of select="application/equipment"/></textarea>
+ </dd>
</dl>
<dl class="form-col">
<div class="heading">2. <xsl:value-of
select="php:function('lang', 'How many?')" /></div>
Modified:
branches/stavangerkommune/booking/templates/base/application_settings.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/application_settings.xsl
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/booking/templates/base/application_settings.xsl
2014-03-28 13:32:26 UTC (rev 11876)
@@ -25,6 +25,12 @@
<dd class="yui-skin-sam">
<textarea id="field_application_description"
name="application_description" class="full-width settings"
type="text"><xsl:value-of
select="config_data/application_description"/></textarea>
</dd>
+ <dt>
+ <label for="field_application_equipment"><xsl:value-of
select="php:function('lang', 'Extra information for the event')" /></label>
+ </dt>
+ <dd class="yui-skin-sam">
+ <textarea id="field_application_equipment"
name="application_equipment" class="full-width settings"
type="text"><xsl:value-of
select="config_data/application_equipment"/></textarea>
+ </dd>
<dt><label for="field_application_howmany"><xsl:value-of
select="php:function('lang', 'How many?')" /></label></dt>
<dd class="yui-skin-sam">
<textarea id="field_application_howmany"
name="application_howmany" class="full-width settings"
type="text"><xsl:value-of select="config_data/application_howmany"/></textarea>
Modified:
branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uiallocation.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -59,19 +59,25 @@
$config->read();
if ($config->config_data['user_can_delete_allocations']
!= 'yes') {
-
+
$allocation =
$this->bo->read_single(intval(phpgw::get_var('allocation_id', 'GET')));
$organization =
$this->organization_bo->read_single($allocation['organization_id']);
$errors = array();
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
-
+
$outseason = $_POST['outseason'];
$recurring = $_POST['recurring'];
$repeat_until = $_POST['repeat_until'];
$field_interval = $_POST['field_interval'];
-
-
date_default_timezone_set("Europe/Oslo");
+
+ $maildata = array();
+ $maildata['outseason'] = $outseason;
+ $maildata['recurring'] = $recurring;
+ $maildata['repeat_until'] = $repeat_until;
+ $maildata['field_interval'] = $field_interval;
+
+ date_default_timezone_set("Europe/Oslo");
$date = new
DateTime(phpgw::get_var('date'));
$system_message = array();
$system_message['building_id'] =
intval($allocation['building_id']);
@@ -86,7 +92,9 @@
$system_message['title'] =
lang('Cancelation of allocation from')." ".$allocation['organization_name'];
$link = self::link(array('menuaction' =>
'booking.uiallocation.delete','allocation_id' => $allocation['id'], 'outseason'
=> $outseason, 'recurring' => $recurring, 'repeat_until' => $repeat_until,
'field_interval' => $field_interval));
$link = mb_strcut($link,16,strlen($link));
- $system_message['message'] =
$system_message['message']."\n\n".lang('To cancel allocation use this link')."
- <a href='".$link."'>".lang('Delete')."</a>";
+ $system_message['link'] = $link;
+ $system_message['message'] =
$system_message['message']."<br /><br />".lang('To cancel allocation use this
link')." - <a href='".$link."'>".lang('Delete')."</a>";
+ $this->bo->send_admin_notification($allocation, $maildata,
$system_message);
$this->system_message_bo->add($system_message);
$this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id' => $system_message['building_id']));
@@ -116,7 +124,7 @@
$invalid_dates = array();
$valid_dates = array();
- $mailadresses =
$this->building_users($allocation['building_id'],$allocation['organization_id']);
+ $mailadresses =
$this->building_users($allocation['building_id'],$allocation['organization_id']);
$maildata = array();
$maildata['outseason'] = $outseason;
@@ -157,8 +165,8 @@
}
$info_deleted =
lang("Allocation deleted on")." ".$system_message['building_name'].":<br
/>".$res_names." - ".pretty_timestamp($allocation['from_'])." -
".pretty_timestamp($allocation['to_']);
$system_message['message'] =
$system_message['message']."<br />".$info_deleted;
-
$this->system_message_bo->add($system_message);
-
+ $this->system_message_bo->add($system_message);
+ $this->bo->send_admin_notification($allocation,
$maildata, $system_message);
$this->bo->send_notification($allocation,
$maildata, $mailadresses);
$this->bo->so->delete_allocation($id);
$this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id'=>$allocation['building_id']));
@@ -246,9 +254,9 @@
$info_deleted =
$info_deleted."<br />".$res_names." -
".pretty_timestamp($valid_date['from_'])." -
".pretty_timestamp($valid_date['to_']);
}
$system_message['message'] =
$system_message['message']."<br />".$info_deleted;
+ $this->bo->send_admin_notification($allocation,
$maildata, $system_message);
$this->bo->send_notification($allocation,
$maildata, $mailadresses);
$this->system_message_bo->add($system_message);
-
$this->redirect(array('menuaction' => 'bookingfrontend.uibuilding.schedule',
'id'=>$allocation['building_id']));
}
}
Modified: branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uibooking.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -372,6 +372,10 @@
if (!$errors)
{
+ $max_dato = strtotime($_POST['to_']); // highest date
from input
+
+ $season =
$this->season_bo->read_single($booking['season_id']);
+
if ($_POST['recurring'] ==
'on') {
$repeat_until =
strtotime($_POST['repeat_until'])+60*60*24;
}
@@ -381,10 +385,6 @@
$_POST['repeat_until']
= $season['to_'];
}
- $max_dato =
strtotime($_POST['to_']); // highest date from input
-
- $season =
$this->season_bo->read_single($booking['season_id']);
-
$where_clauses[] =
sprintf("bb_booking.from_ >= '%s 00:00:00'", date('Y-m-d',
strtotime($_POST['from_'])));
if ($_POST['recurring'] ==
'on') {
$where_clauses[] =
sprintf("bb_booking.to_ < '%s 00:00:00'", date('Y-m-d', $repeat_until));
@@ -635,7 +635,7 @@
{
$config = CreateObject('phpgwapi.config','booking');
$config->read();
-
+
if ($config->config_data['user_can_delete_bookings'] !=
'yes') {
$booking =
$this->bo->read_single(intval(phpgw::get_var('id', 'GET')));
@@ -651,8 +651,16 @@
$repeat_until = $_POST['repeat_until'];
$field_interval = $_POST['field_interval'];
$delete_allocation = $_POST['delete_allocation'];
-
-
date_default_timezone_set("Europe/Oslo");
+ $allocation =
$this->allocation_bo->read_single($booking['allocation_id']);
+
+ $maildata = array();
+ $maildata['outseason'] = $outseason;
+ $maildata['recurring'] = $recurring;
+ $maildata['repeat_until'] = $repeat_until;
+ $maildata['delete_allocation'] = $delete_allocation;
+
+
+ date_default_timezone_set("Europe/Oslo");
$date = new
DateTime(phpgw::get_var('date'));
$system_message = array();
$system_message['building_id'] =
intval($booking['building_id']);
@@ -661,7 +669,7 @@
$system_message =
array_merge($system_message, extract_values($_POST, array('message')));
$system_message['type'] = 'cancelation';
$system_message['status'] = 'NEW';
- $system_message['name'] = ' ';
+ $system_message['name'] =
$booking['group_name'];
$system_message['phone'] = ' ';
$system_message['email'] = ' ';
$system_message['title'] =
lang('Cancelation of booking from')." ".$booking['group_name'];
@@ -669,6 +677,7 @@
$link = self::link(array('menuaction' =>
'booking.uibooking.delete','id' => $booking['id'], 'outseason' => $outseason,
'recurring' => $recurring, 'repeat_until' => $repeat_until, 'field_interval' =>
$field_interval, 'delete_allocation' => $delete_allocation));
$link = mb_strcut($link,16,strlen($link));
$system_message['message'] =
$system_message['message']."\n\n".lang('To cancel booking use this link')." -
<a href='".$link."'>".lang('Delete')."</a>";
+ $this->bo->send_admin_notification($booking, $maildata,
$system_message, $allocation);
$receipt =
$this->system_message_bo->add($system_message);
$this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id' => $system_message['building_id']));
@@ -698,13 +707,12 @@
$allocation_delete = array();
$allocation_keep = array();
- $mailadresses =
$this->building_users($booking['building_id'],$booking['group_id'],
$delete_allocation);
-# $grp = $this->organization_users($booking['group_id']);
+ $mailadresses =
$this->building_users($booking['building_id'],$booking['group_id'],
$delete_allocation);
$maildata = array();
$maildata['outseason'] = $outseason;
$maildata['recurring'] = $recurring;
- $maildata['repeat_until'] = $field_until;
+ $maildata['repeat_until'] = $repeat_until;
$maildata['delete_allocation'] = $delete_allocation;
if($_SERVER['REQUEST_METHOD'] == 'POST')
@@ -753,7 +761,7 @@
$system_message =
array_merge($system_message, extract_values($_POST, array('message')));
$system_message['type'] = 'cancelation';
$system_message['status'] =
'NEW';
- $system_message['name'] = ' ';
+ $system_message['name'] =
$booking['group_name'];
$system_message['phone'] = ' ';
$system_message['email'] = ' ';
$system_message['title'] =
lang("Cancelation of ".$inf_del." from")."
".$this->bo->so->get_organization($booking['group_id'])." -
".$booking['group_name'];
@@ -761,9 +769,8 @@
$res_names =
$res_names.$this->bo->so->get_resource($res)." ";
}
$info_deleted = lang($inf_del."
deleted on")." ".$system_message['building_name'].":<br />".$res_names." -
".pretty_timestamp($booking['from_'])." - ".pretty_timestamp($booking['to_']);
-
+ $this->bo->send_admin_notification($booking,
$maildata, $system_message, $allocation);
$this->bo->send_notification($booking, $allocation,
$maildata, $mailadresses);
-
$system_message['message'] =
$system_message['message']."<br />".$info_deleted;
$receipt =
$this->system_message_bo->add($system_message);
@@ -810,7 +817,7 @@
if ($step == 3)
{
$inf_del = "Bookings";
- $stat =
$this->bo->so->delete_booking($id);
+ $stat =
$this->bo->so->delete_booking($id);
}
}
if ($_POST['delete_allocation'] == 'on')
{
@@ -826,7 +833,7 @@
if ($step == 3)
{
$inf_del = "Bookings and
allocations";
- $stat =
$this->bo->so->delete_allocation($aid);
+ $stat =
$this->bo->so->delete_allocation($aid);
}
}
}
@@ -852,7 +859,7 @@
$system_message =
array_merge($system_message, extract_values($_POST, array('message')));
$system_message['type'] = 'cancelation';
$system_message['status'] = 'NEW';
- $system_message['name']
= ' ';
+ $system_message['name']
= $booking['group_name'];
$system_message['phone'] = ' ';
$system_message['email'] = ' ';
$system_message['title'] = lang("Cancelation of ".$inf_del." from")."
".$this->bo->so->get_organization($booking['group_id'])." -
".$booking['group_name'];
@@ -864,9 +871,8 @@
$info_deleted =
$info_deleted."<br />".$res_names." -
".pretty_timestamp($valid_date['from_'])." -
".pretty_timestamp($valid_date['to_']);
}
$system_message['message'] =
$system_message['message']."<br />".$info_deleted;
-
+ $this->bo->send_admin_notification($booking,
$maildata, $system_message, $allocation, $valid_dates);
$this->bo->send_notification($booking,
$allocation, $maildata, $mailadresses, $valid_dates);
-
$receipt =
$this->system_message_bo->add($system_message);
$this->redirect(array('menuaction' => 'bookingfrontend.uibuilding.schedule',
'id'=>$allocation['building_id']));
}
Modified: branches/stavangerkommune/bookingfrontend/inc/class.uibuilding.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.uibuilding.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/bookingfrontend/inc/class.uibuilding.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -27,7 +27,10 @@
$building = $this->bo->read_single(phpgw::get_var('id', 'GET'));
$start = phpgw::get_var('start', 'GET');
+ $res = phpgw::get_var('res', 'GET');
+ $timestart = 8.0;
+ $timeend = 16.0;
if ($start == 0) {
$timestart = 0.0;
$timeend = 8.0;
@@ -49,7 +52,7 @@
"Sun" => "Søndag"
);
- $bookings =
$this->booking_bo->building_infoscreen_schedule(phpgw::get_var('id',
'GET'),$date);
+ $bookings =
$this->booking_bo->building_infoscreen_schedule(phpgw::get_var('id', 'GET'),
$date, $res);
$from = clone $date;
$from->setTime(0, 0, 0);
Modified: branches/stavangerkommune/bookingfrontend/setup/setup.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/setup/setup.inc.php
2014-03-26 13:02:36 UTC (rev 11875)
+++ branches/stavangerkommune/bookingfrontend/setup/setup.inc.php
2014-03-28 13:32:26 UTC (rev 11876)
@@ -21,7 +21,7 @@
$setup_info['bookingfrontend']['depends'][] = array(
'appname' => 'booking',
- 'versions' =>
Array('0.2.06','0.2.07','0.2.08','0.2.09','0.2.10',
'0.2.11','0.2.12','0.2.13','0.2.14','0.2.15')
+ 'versions' =>
Array('0.2.06','0.2.07','0.2.08','0.2.09','0.2.10',
'0.2.11','0.2.12','0.2.13','0.2.14','0.2.15','0.2.16')
);
$setup_info['bookingfrontend']['depends'][] = array(
Modified:
branches/stavangerkommune/bookingfrontend/templates/stavanger/application_new.xsl
===================================================================
---
branches/stavangerkommune/bookingfrontend/templates/stavanger/application_new.xsl
2014-03-26 13:02:36 UTC (rev 11875)
+++
branches/stavangerkommune/bookingfrontend/templates/stavanger/application_new.xsl
2014-03-28 13:32:26 UTC (rev 11876)
@@ -45,8 +45,21 @@
</xsl:if>
</dt>
<dd>
- <textarea id="field_description"
class="full-width" name="description"><xsl:value-of
select="application/description"/></textarea>
+ <input id="field_description" class="full-width" size="72"
name="description" type="text">
+ <xsl:attribute name="value"><xsl:value-of
select="application/description"/></xsl:attribute>
+ </input>
+ <!--<textarea id="field_description"
class="full-width" name="description"><xsl:value-of
select="application/description"/></textarea>-->
</dd>
+ <dt>
+ <xsl:if test="config/application_equipment">
+ <p>
+ <xsl:value-of select="config/application_equipment"/>
+ </p>
+ </xsl:if>
+ </dt>
+ <dd>
+ <textarea id="field_equipment" class="full-width"
name="equipment"><xsl:value-of select="application/equipment"/></textarea>
+ </dd>
</dl>
<dl class="form-col">
<div class="heading">2. <xsl:value-of
select="php:function('lang', 'How many?')" /></div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11876] bkbooking: stavanger update info screen, added email to admin,
Kjell Arne Espedal <=