[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16177] more on eventplanner
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16177] more on eventplanner |
Date: |
Sat, 21 Jan 2017 09:31:13 -0500 (EST) |
Revision: 16177
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16177
Author: sigurdne
Date: 2017-01-21 09:31:12 -0500 (Sat, 21 Jan 2017)
Log Message:
-----------
more on eventplanner
Modified Paths:
--------------
trunk/eventplanner/inc/class.bobooking.inc.php
trunk/eventplanner/inc/class.sobooking.inc.php
trunk/eventplanner/inc/class.uiapplication.inc.php
trunk/eventplanner/inc/class.uibooking.inc.php
trunk/eventplanner/inc/model/class.booking.inc.php
trunk/eventplanner/js/portico/application.edit.js
trunk/eventplanner/setup/phpgw_no.lang
trunk/phpgwapi/inc/class.uicommon.inc.php
Added Paths:
-----------
trunk/eventplanner/inc/hook_config.inc.php
Modified: trunk/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bobooking.inc.php 2017-01-21 14:30:47 UTC
(rev 16176)
+++ trunk/eventplanner/inc/class.bobooking.inc.php 2017-01-21 14:31:12 UTC
(rev 16177)
@@ -106,7 +106,59 @@
public function update_active_status( $ids, $action )
{
- return
eventplanner_sobooking::get_instance()->update_active_status($ids, $action);
+ if($action == 'enable' && $ids)
+ {
+ $_ids = array();
+ $application_id =
eventplanner_sobooking::get_instance()->read_single($ids[0],
true)->application_id;
+
+ $application =
createObject('eventplanner.boapplication')->read_single($application_id);
+ $params = array();
+ $params['filters']['active'] = 1;
+ $params['filters']['application_id'] =
$application_id;
+
+ $bookings =
eventplanner_sobooking::get_instance()->read($params);
+
+ $number_of_active =
(int)$bookings['total_records'];
+ $limit = (int)$application->num_granted_events;
+
+
+ foreach ($ids as $id)
+ {
+ if($limit > $number_of_active)
+ {
+ $_ids[] = $id;
+ $number_of_active ++;
+ }
+ else
+ {
+ $message = lang('maximum of
granted events are reached');
+
phpgwapi_cache::message_set($message, 'error');
+ break;
+ }
+ }
+ }
+ else if ($action == 'delete' && $ids)
+ {
+ foreach ($ids as $id)
+ {
+ $booking =
eventplanner_sobooking::get_instance()->read_single($id, true);
+ if(!$booking->customer_id)
+ {
+ $_ids[] = $id;
+ }
+ else
+ {
+ $message = lang('can not delete
booking with customer');
+
phpgwapi_cache::message_set($message, 'error');
+ }
+ }
+ }
+ else
+ {
+ $_ids = $ids;
+ }
+
+ return
eventplanner_sobooking::get_instance()->update_active_status($_ids, $action);
}
public function update_schedule( $id, $from_ )
Modified: trunk/eventplanner/inc/class.sobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.sobooking.inc.php 2017-01-21 14:30:47 UTC
(rev 16176)
+++ trunk/eventplanner/inc/class.sobooking.inc.php 2017-01-21 14:31:12 UTC
(rev 16177)
@@ -139,18 +139,25 @@
{
case 'disable':
$sql = "UPDATE eventplanner_booking SET
active = 0";
+ $where = 'WHERE';
break;
case 'enable':
$sql = "UPDATE eventplanner_booking SET
active = 1";
+ $where = 'WHERE';
break;
+ case 'delete':
+ $sql = "DELETE FROM
eventplanner_booking WHERE customer_id IS NULL";
+ $where = 'AND';
+ break;
+
default:
throw new Exception("action {$action}
not supported");
break;
}
- $sql .= 'WHERE id IN(' . implode(',', $ids) . ')';
+ $sql .= " {$where} id IN('". implode(',', $ids) . ')';
$this->db->transaction_begin();
$this->db->query($sql,__LINE__,__FILE__);
Modified: trunk/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uiapplication.inc.php 2017-01-21 14:30:47 UTC
(rev 16176)
+++ trunk/eventplanner/inc/class.uiapplication.inc.php 2017-01-21 14:31:12 UTC
(rev 16177)
@@ -316,6 +316,13 @@
onActionsClick('disable');"
),
array(
+ 'my_name' => 'delete',
+ 'text' => lang('delete'),
+ 'type' => 'custom',
+ 'custom_code' => "
+
onActionsClick('delete');"
+ ),
+ array(
'my_name' => 'edit',
'text' => lang('edit'),
'type' => 'custom',
Modified: trunk/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uibooking.inc.php 2017-01-21 14:30:47 UTC
(rev 16176)
+++ trunk/eventplanner/inc/class.uibooking.inc.php 2017-01-21 14:31:12 UTC
(rev 16177)
@@ -344,11 +344,11 @@
}
else
{
- return array
- (
+ $messages = phpgwapi_cache::message_get(true);
+ return array(
'status_kode' => 'error',
'status' => lang('error'),
- 'msg' => lang('messages_form_error')
+ 'msg' => $messages ? $messages :
lang('did not validate')
);
}
}
Added: trunk/eventplanner/inc/hook_config.inc.php
===================================================================
--- trunk/eventplanner/inc/hook_config.inc.php (rev 0)
+++ trunk/eventplanner/inc/hook_config.inc.php 2017-01-21 14:31:12 UTC (rev
16177)
@@ -0,0 +1,44 @@
+<?php
+ /**
+ * Eventplanner - configuration hook
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2000-2009 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package phpgroupware
+ * @subpackage eventplanner
+ * @category hooks
+ * @version $Id: hook_config.inc.php 15466 2016-08-15 17:36:10Z
sigurdne $
+ */
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ /**
+ * Get HTML listbox with categories that are candidates for the dimb
responsibility_1
+ *
+ * @param $config
+ * @return string HTML listbox to be placed in a table
+ */
+ function default_application_category( $config )
+ {
+ $cats = CreateObject('phpgwapi.categories', -1, 'eventplanner',
'.application');
+ $cats->supress_info = true;
+
+ $selected = isset($config['default_application_category']) ?
$config['default_application_category'] : null;
+ $cat_select = '<option value="">' . lang('none selected') .
'</option>' . "\n";
+ $cat_select .= $cats->formatted_list(array('selected' =>
$selected));
+ return $cat_select;
+ }
+
Modified: trunk/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.booking.inc.php 2017-01-21 14:30:47 UTC
(rev 16176)
+++ trunk/eventplanner/inc/model/class.booking.inc.php 2017-01-21 14:31:12 UTC
(rev 16177)
@@ -259,6 +259,30 @@
}
+ protected function doValidate( $entity, &$errors )
+ {
+ $application =
createObject('eventplanner.boapplication')->read_single($entity->application_id);
+ $params = array();
+ $params['filters']['active'] = 1;
+ $params['filters']['application_id'] =
$entity->application_id;
+
+ $bookings =
eventplanner_sobooking::get_instance()->read($params);
+
+ if((int)$bookings['total_records'] >=
(int)$application->num_granted_events)
+ {
+ $errors['num_granted_events'] = lang('maximum
of granted events are reached');
+ }
+
+ $date_start = date('Ymd',$application->date_start);
+ $date_end = date('Ymd',$application->date_end);
+ $from_ = date('Ymd',$entity->from_);
+
+ if($from_ < $date_start || $from_ > $date_end)
+ {
+ $errors['from_'] = lang('date is outside the
scope');
+ }
+ }
+
protected function generate_secret( $length = 10 )
{
return substr(base64_encode(rand(1000000000,
9999999999)), 0, $length);
Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js 2017-01-21 14:30:47 UTC
(rev 16176)
+++ trunk/eventplanner/js/portico/application.edit.js 2017-01-21 14:31:12 UTC
(rev 16177)
@@ -22,7 +22,7 @@
}
var id = $("#application_id").val();
- if(id > 0)
+ if (id > 0)
{
document.form.submit();
return;
@@ -159,7 +159,7 @@
}
else if (tab === 'first_tab')
{
- if(id > 0)
+ if (id > 0)
{
$("#save_button").val(lang['save']);
$("#save_button_bottom").val(lang['save']);
@@ -231,7 +231,7 @@
var requestUrl = phpGWLink('index.php', oArgs, true);
var htmlString = '';
$("#receipt").html("");
- var data = {from_: from_, active: 1};
+ var data = {from_: from_, active: 1};
JqueryPortico.execute_ajax(requestUrl,
function (result)
@@ -240,12 +240,23 @@
{
$("#from_").val('');
htmlString += "<div class=\"msg_good\">";
+ htmlString += result.msg;
}
else
{
htmlString += "<div class=\"error\">";
+ var msg = result.msg;
+ if (typeof (msg) == 'object')
+ {
+ htmlString += msg['error'][0]['msg'];
+ }
+ else
+ {
+ htmlString += result.msg;
+ }
}
- htmlString += result.msg;
+
+
htmlString += '</div>';
$("#receipt").html(htmlString);
@@ -252,7 +263,7 @@
JqueryPortico.updateinlineTableHelper('datatable-container_1');
}, data, "POST", "json"
- );
+ );
};
@@ -290,7 +301,7 @@
JqueryPortico.updateinlineTableHelper('datatable-container_1');
}, data, "POST", "json"
- );
+ );
};
@@ -349,12 +360,21 @@
{
$("#from_").val('');
htmlString += "<div
class=\"msg_good\">";
+ htmlString += result.msg;
}
else
{
htmlString += "<div class=\"error\">";
+ var msg = result.msg;
+ if (typeof (msg) == 'object')
+ {
+ htmlString +=
msg['error'][0]['msg'];
+ }
+ else
+ {
+ htmlString += result.msg;
+ }
}
- htmlString += result.msg;
htmlString += '</div>';
$("#receipt").html(htmlString);
@@ -361,6 +381,6 @@
JqueryPortico.updateinlineTableHelper('datatable-container_1');
}, data, "POST", "json"
- );
+ );
}
};
Modified: trunk/eventplanner/setup/phpgw_no.lang
===================================================================
--- trunk/eventplanner/setup/phpgw_no.lang 2017-01-21 14:30:47 UTC (rev
16176)
+++ trunk/eventplanner/setup/phpgw_no.lang 2017-01-21 14:31:12 UTC (rev
16177)
@@ -90,4 +90,8 @@
account number eventplanner no Kontonummer
history eventplanner no Endringslogg
user eventplanner no Bruker
-proceedings eventplanner no Saksbehandling
\ No newline at end of file
+proceedings eventplanner no Saksbehandling
+maximum of granted events are reached eventplanner no Maksimalt
antall arrangement er nådd
+did not validate eventplanner no Feil med datasettet
+date is outside the scope eventplanner no Dato ligger utenfor
tillat tidsrom
+can not delete booking with customer eventplanner no Kan ikke slette
booking som er koplet med mottakersted
\ No newline at end of file
Modified: trunk/phpgwapi/inc/class.uicommon.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.uicommon.inc.php 2017-01-21 14:30:47 UTC (rev
16176)
+++ trunk/phpgwapi/inc/class.uicommon.inc.php 2017-01-21 14:31:12 UTC (rev
16177)
@@ -187,11 +187,11 @@
{
if($ajax)
{
-
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+ $messages =
phpgwapi_cache::message_get(true);
return array(
'status_kode' => 'error',
'status' => lang('error'),
- 'msg' => lang('Did not
validate')
+ 'msg' => $messages ? $messages
: lang('did not validate')
);
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16177] more on eventplanner,
sigurdne <=