[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6500] bkbooking: added lookup organization on event.
From: |
Kjell Arne Espedal |
Subject: |
[Fmsystem-commits] [6500] bkbooking: added lookup organization on event. search on buildingname in list of events, added checking of shortname length on organiztion and group |
Date: |
Tue, 19 Oct 2010 13:23:18 +0000 |
Revision: 6500
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6500
Author: kjell
Date: 2010-10-19 13:23:17 +0000 (Tue, 19 Oct 2010)
Log Message:
-----------
bkbooking: added lookup organization on event.search on buildingname in list of
events, added checking of shortname length on organiztion and group
Modified Paths:
--------------
trunk/booking/inc/class.soevent.inc.php
trunk/booking/inc/class.uibooking.inc.php
trunk/booking/inc/class.uievent.inc.php
trunk/booking/inc/class.uigroup.inc.php
trunk/booking/inc/class.uiorganization.inc.php
trunk/booking/js/booking/event.js
trunk/booking/setup/phpgw_no.lang
trunk/booking/setup/tables_current.inc.php
trunk/booking/setup/tables_update.inc.php
trunk/booking/templates/base/event_edit.xsl
trunk/booking/templates/base/event_new.xsl
trunk/bookingfrontend/setup/phpgw_no.lang
Modified: trunk/booking/inc/class.soevent.inc.php
===================================================================
--- trunk/booking/inc/class.soevent.inc.php 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/inc/class.soevent.inc.php 2010-10-19 13:23:17 UTC (rev
6500)
@@ -12,6 +12,7 @@
'activity_id' => array('type' =>
'int', 'required' => true),
'application_id' => array('type'
=> 'int', 'required' => false),
'description' => array('type' =>
'string', 'required'=> true, 'query' => true),
+ 'building_name' => array('type' =>
'string', 'required'=> true, 'query' => true),
'from_' => array('type' =>
'string', 'required'=> true),
'to_' => array('type' =>
'string', 'required'=> true),
'cost' => array('type' =>
'decimal', 'required' => true),
@@ -23,8 +24,10 @@
'is_public' => array('type' =>
'int', 'required' => true, 'nullable' => false, 'default' => '1'),
'secret' => array('type' =>
'string', 'required' => true),
'sms_total' => array('type'
=> 'int', 'required' => false),
+ 'customer_organization_name' =>
array('type' => 'string', 'required' => False, 'query' => true),
+ 'customer_organization_id'
=> array('type' => 'int', 'required' => False),
'customer_identifier_type'
=> array('type' => 'string', 'required' => False),
- 'customer_ssn'
=> array('type' => 'string', 'sf_validator' =>
createObject('booking.sfValidatorNorwegianSSN'), 'required' => false),
+ 'customer_ssn'
=> array('type' => 'string', 'sf_validator' =>
createObject('booking.sfValidatorNorwegianSSN'), 'required' => false),
'customer_organization_number' =>
array('type' => 'string', 'sf_validator' =>
createObject('booking.sfValidatorNorwegianOrganizationNumber', array(),
array('invalid' => '%field% is invalid'))),
'customer_internal'
=> array('type' => 'int', 'required'=>true),
'activity_name' => array('type' =>
'string',
Modified: trunk/booking/inc/class.uibooking.inc.php
===================================================================
--- trunk/booking/inc/class.uibooking.inc.php 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/inc/class.uibooking.inc.php 2010-10-19 13:23:17 UTC (rev
6500)
@@ -119,7 +119,6 @@
$bookings = $this->bo->read();
foreach($bookings['results'] as &$booking) {
$building =
$this->building_bo->read_single($booking['building_id']);
- //print_r($building);
$booking['building_name'] = $building['name'];
$booking['from_'] =
pretty_timestamp($booking['from_']);
$booking['to_'] =
pretty_timestamp($booking['to_']);
Modified: trunk/booking/inc/class.uievent.inc.php
===================================================================
--- trunk/booking/inc/class.uievent.inc.php 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/inc/class.uievent.inc.php 2010-10-19 13:23:17 UTC (rev
6500)
@@ -22,6 +22,7 @@
$this->activity_bo = CreateObject('booking.boactivity');
$this->agegroup_bo = CreateObject('booking.boagegroup');
$this->audience_bo = CreateObject('booking.boaudience');
+ $this->organization_bo =
CreateObject('booking.boorganization');
self::set_active_menu('booking::applications::events');
$this->fields = array('activity_id', 'description',
'resources', 'cost', 'application_id',
@@ -108,8 +109,6 @@
foreach($events['results'] as &$event)
{
- $building_info =
$this->bo->so->get_building_info($event['id']);
- $event['building_name'] =
$building_info['name'];
$event['from_'] =
pretty_timestamp($event['from_']);
$event['to_'] = pretty_timestamp($event['to_']);
}
@@ -270,6 +269,30 @@
array_set_default($event, 'agegroups', array());
$event['secret'] = $this->generate_secret();
$event['is_public'] = 1;
+ $event['building_name'] =
$_POST['building_name'];
+
+ if ($_POST['organization_name']) {
+ $event['customer_organization_name'] =
$_POST['organization_name'];
+ $event['customer_organization_id'] =
$_POST['organization_id'];
+ $organization =
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id',
'POST')));
+ if ($organization['customer_internal']
== 0) {
+
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
+ $event['customer_internal'] =
$organization['customer_internal'];
+ if
(strlen($organization['customer_organization_number']) == 9) {
+
$event['customer_organization_number'] =
$organization['customer_organization_number'];
+ } else {
+
$errors['organization_number'] = lang('The organization number is wrong or not
present');
+ }
+ } else {
+
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
+ $event['customer_internal'] =
$organization['customer_internal'];
+ if
(strlen($organization['customer_number']) == 5) {
+
$event['customer_organization_number'] = $organization['customer_number'];
+ } else {
+
$errors['resource_number'] = lang('The resource number is wrong or not
present');
+ }
+ }
+ }
if (!$_POST['application_id'])
{
@@ -402,18 +425,54 @@
$event['building_name'] = $building_info['name'];
$errors = array();
$customer = array();
- if ($event['customer_organization_number'])
+ if ($event['customer_identifier_type'])
{
$customer['customer_identifier_type'] =
$event['customer_identifier_type'];
$customer['customer_ssn'] =
$event['customer_ssn'];
$customer['customer_organization_number'] =
$event['customer_organization_number'];
+ $customer['customer_internal'] =
$event['customer_internal'];
}
list($event, $errors) =
$this->extract_and_validate($event);
+
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
+ if (!$_POST['organization_name']) {
+ $event['customer_organization_name'] =
Null;
+ $event['customer_organization_id'] =
Null;
+ }
array_set_default($_POST, 'resources', array());
+
+ if ($_POST['organization_name']) {
+ $event['customer_organization_name'] =
$_POST['organization_name'];
+ $event['customer_organization_id'] =
$_POST['organization_id'];
+ $organization =
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id',
'POST')));
- if(!$errors['event'])
+ if ($organization['customer_internal']
== 0) {
+
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
+ $event['customer_internal'] =
$organization['customer_internal'];
+ if
(strlen($organization['customer_organization_number']) == 9) {
+
$event['customer_organization_number'] =
$organization['customer_organization_number'];
+ } else {
+
$errors['organization_number'] = lang('The organization number is wrong or not
present');
+ }
+ } else {
+
$event['customer_identifier_type'] = $organization['customer_identifier_type'];
+ $event['customer_internal'] =
$organization['customer_internal'];
+ if
(strlen($organization['customer_number']) == 5) {
+
$event['customer_organization_number'] = $organization['customer_number'];
+ } else {
+
$errors['resource_number'] = lang('The resource number is wrong or not
present');
+ }
+ }
+ } elseif ($_POST['customer_identifier_type'] ==
'ssn') {
+ $event['customer_identifier_type'] =
'ssn';
+ $event['customer_ssn'] =
$organization['customer_ssn'];
+
+ } elseif ($_POST['customer_identifier_type'] ==
'organization_number') {
+ $event['customer_identifier_type'] =
'organization_number';
+ $event['customer_organization_number']
= $organization['customer_organization_number'];
+ }
+ if(!$errors['event'] and
!$errors['resource_number'] and !$errors['organization_number'])
{
if (phpgw::get_var('mail', 'POST'))
{
@@ -472,12 +531,14 @@
$errors['booking'] = lang('Event created,
Overlaps with existing booking, Remember to send a notification');
}
$this->flash_form_errors($errors);
- if ($customer['customer_organization_number'])
+ if ($customer['customer_identifier_type'])
{
$event['customer_identifier_type'] =
$customer['customer_identifier_type'];
$event['customer_ssn'] =
$customer['customer_ssn'];
$event['customer_organization_number'] =
$customer['customer_organization_number'];
+ $event['customer_internal'] =
$customer['customer_internal'];
}
+
self::add_javascript('booking', 'booking', 'event.js');
$event['resources_json'] =
json_encode(array_map('intval', $event['resources']));
$event['application_link'] =
self::link(array('menuaction' => 'booking.uiapplication.show', 'id'=>
$event['application_id']));
Modified: trunk/booking/inc/class.uigroup.inc.php
===================================================================
--- trunk/booking/inc/class.uigroup.inc.php 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/inc/class.uigroup.inc.php 2010-10-19 13:23:17 UTC (rev
6500)
@@ -243,7 +243,11 @@
{
$group['active'] = '1';
}
+
$errors = $this->bo->validate($group);
+ if(strlen($_POST['shortname']) > 11){
+ $errors['shortname'] = lang('Lengt of
shortname is to long, max 11 characters long');
+ }
if(!$errors)
{
if ($id)
Modified: trunk/booking/inc/class.uiorganization.inc.php
===================================================================
--- trunk/booking/inc/class.uiorganization.inc.php 2010-10-19 10:17:49 UTC
(rev 6499)
+++ trunk/booking/inc/class.uiorganization.inc.php 2010-10-19 13:23:17 UTC
(rev 6500)
@@ -184,6 +184,9 @@
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
list($organization, $errors) =
$this->extract_and_validate(array('active' => 1));
+ if(strlen($_POST['shortname']) > 11){
+ $errors['shortname'] = lang('Lengt of
shortname is to long, max 11 characters long');
+ }
if(!$errors)
{
$receipt =
$this->bo->add($organization);
@@ -214,6 +217,9 @@
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
list($organization, $errors) =
$this->extract_and_validate($organization);
+ if(strlen($_POST['shortname']) > 11){
+ $errors['shortname'] = lang('Lengt of
shortname is to long, max 11 characters long');
+ }
if(!$errors)
{
$organization['shortname'] =
$_POST['shortname'];
Modified: trunk/booking/js/booking/event.js
===================================================================
--- trunk/booking/js/booking/event.js 2010-10-19 10:17:49 UTC (rev 6499)
+++ trunk/booking/js/booking/event.js 2010-10-19 13:23:17 UTC (rev 6500)
@@ -51,8 +51,9 @@
a.onclick = removeDateRow;
YAHOO.booking.setupDatePickers();
YAHOO.util.Event.stopEvent(e);
- });
-
+ });
+
YAHOO.booking.autocompleteHelper('index.php?menuaction=booking.uiorganization.index&phpgw_return_as=json&',
+ 'field_org_name', 'field_org_id',
'org_container');
});
Modified: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang 2010-10-19 10:17:49 UTC (rev 6499)
+++ trunk/booking/setup/phpgw_no.lang 2010-10-19 13:23:17 UTC (rev 6500)
@@ -463,3 +463,6 @@
E-mail address booking no E-postadresse
Confirm e-mail address booking no Bekreft e-postadressen
The e-mail addresses you entered do not match booking no E-postadressene
er ikke like
+Lengt of shortname is to long, max 11 characters long booking no
Kortnavn er for langt, maks 11 tegn
+The organization number is wrong or not present booking no Det er
ikke registrert et organisjonsnummer på denne organisasjonen
+The resource number is wrong or not present booking no Det er ikke
registert et ressursnummer på denne organisasjonen
Modified: trunk/booking/setup/tables_current.inc.php
===================================================================
--- trunk/booking/setup/tables_current.inc.php 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/setup/tables_current.inc.php 2010-10-19 13:23:17 UTC (rev
6500)
@@ -512,10 +512,13 @@
'from_' => array('type' =>
'timestamp','nullable' => False),
'to_' => array('type' => 'timestamp','nullable'
=> False),
'cost' => array('type' => 'decimal',
'precision' => 10, 'scale' => 2,'nullable' => False),
+ 'building_name' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'contact_name' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'contact_email' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'contact_phone' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'completed' => array('type' => 'int',
'precision' => 4,'nullable' => False,'default' => '0'),
+ 'customer_organization_name' => array('type' =>
'varchar', 'precision' => 50,'nullable' => True),
+ 'customer_organization_id' => array('type' =>
'int', 'precision' => 4,'nullable' => True),
'customer_identifier_type' => array('type' =>
'varchar', 'precision' => 255,'nullable' => True),
'customer_organization_number' => array('type'
=> 'varchar', 'precision' => 9,'nullable' => True),
'customer_ssn' => array('type' => 'varchar',
'precision' => 12,'nullable' => True),
Modified: trunk/booking/setup/tables_update.inc.php
===================================================================
--- trunk/booking/setup/tables_update.inc.php 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/setup/tables_update.inc.php 2010-10-19 13:23:17 UTC (rev
6500)
@@ -2332,4 +2332,21 @@
return $GLOBALS['setup_info']['booking']['currentver'];
}
}
+ $test[] = '0.1.97';
+ function booking_upgrade0_1_97()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE
bb_event ADD COLUMN customer_organization_id integer");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE
bb_event ADD COLUMN customer_organization_name varchar(50)");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE
bb_event ADD COLUMN building_name varchar(50) NOT NULL DEFAULT 'changeme'");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE bb_event
SET building_name = b2.name FROM bb_building b2 WHERE EXISTS (select 1 from
bb_event e,bb_event_resource er,bb_resource r,bb_building b WHERE
e.id=er.event_id AND er.resource_id=r.id AND r.building_id=b.id AND b2.id=b.id
AND bb_event.id=e.id)");
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['booking']['currentver'] =
'0.1.98';
+ return $GLOBALS['setup_info']['booking']['currentver'];
+ }
+ }
+
Modified: trunk/booking/templates/base/event_edit.xsl
===================================================================
--- trunk/booking/templates/base/event_edit.xsl 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/templates/base/event_edit.xsl 2010-10-19 13:23:17 UTC (rev
6500)
@@ -203,6 +203,20 @@
</dl>
<dl class="form-col">
<dt class="heading"><xsl:value-of
select="php:function('lang', 'Invoice information')" /></dt>
+
+ <dt><label for="field_org"><xsl:value-of
select="php:function('lang', 'Organization')" /></label></dt>
+ <dd>
+ <div class="autocomplete">
+ <input id="field_org_id" name="organization_id"
type="hidden">
+ <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_id"/></xsl:attribute>
+ </input>
+ <input id="field_org_name" name="organization_name"
type="text">
+ <xsl:attribute name="value"><xsl:value-of
select="event/customer_organization_name"/></xsl:attribute>
+ </input>
+ <div id="org_container"/>
+ </div>
+ </dd>
+
<xsl:copy-of
select="phpgw:booking_customer_identifier(event, '')"/>
<dt><label for="field_customer_internal"><xsl:value-of
select="php:function('lang', 'Internal Customer')"/></label></dt>
Modified: trunk/booking/templates/base/event_new.xsl
===================================================================
--- trunk/booking/templates/base/event_new.xsl 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/booking/templates/base/event_new.xsl 2010-10-19 13:23:17 UTC (rev
6500)
@@ -163,9 +163,25 @@
</dd>
</dl>
<dl class="form-col">
+
<dt class="heading"><xsl:value-of
select="php:function('lang', 'Invoice information')" /></dt>
+
+ <dt><label for="field_org"><xsl:value-of
select="php:function('lang', 'Organization')" /></label></dt>
+ <dd>
+ <div class="autocomplete">
+ <input id="field_org_id" name="organization_id"
type="hidden">
+ <xsl:attribute name="value"><xsl:value-of
select="event/organization_id"/></xsl:attribute>
+ </input>
+ <input id="field_org_name" name="organization_name"
type="text">
+ <xsl:attribute name="value"><xsl:value-of
select="event/organization_name"/></xsl:attribute>
+ </input>
+ <div id="org_container"/>
+ </div>
+ </dd>
+
<xsl:copy-of
select="phpgw:booking_customer_identifier(event, '')"/>
-
+
+
<dt><label for="field_customer_internal"><xsl:value-of
select="php:function('lang', 'Internal Customer')"/></label></dt>
<dd><xsl:copy-of
select="phpgw:option_checkbox(event/customer_internal,
'customer_internal')"/></dd>
</dl>
Modified: trunk/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/bookingfrontend/setup/phpgw_no.lang 2010-10-19 10:17:49 UTC (rev
6499)
+++ trunk/bookingfrontend/setup/phpgw_no.lang 2010-10-19 13:23:17 UTC (rev
6500)
@@ -319,3 +319,4 @@
E-mail address bookingfrontend no E-postadresse
Confirm e-mail address bookingfrontend no Bekreft e-postadressen
The e-mail addresses you entered do not match bookingfrontend no
E-postadressene er ikke like
+Lengt of shortname is to long, max 11 characters long bookingfrontend no
Kortnavn er for langt, maks 11 tegn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6500] bkbooking: added lookup organization on event. search on buildingname in list of events, added checking of shortname length on organiztion and group,
Kjell Arne Espedal <=