diff --git a/docs/upgrades/packages-7.5.3/root_import_ems.wgpkg b/docs/upgrades/packages-7.5.3/root_import_ems.wgpkg index 594f282f3..0b511e9b9 100644 Binary files a/docs/upgrades/packages-7.5.3/root_import_ems.wgpkg and b/docs/upgrades/packages-7.5.3/root_import_ems.wgpkg differ diff --git a/docs/upgrades/upgrade_7.5.2-7.5.3.pl b/docs/upgrades/upgrade_7.5.2-7.5.3.pl index c832dac8d..55caca4ed 100644 --- a/docs/upgrades/upgrade_7.5.2-7.5.3.pl +++ b/docs/upgrades/upgrade_7.5.2-7.5.3.pl @@ -71,6 +71,7 @@ sub upgradeEMS { $db->write("alter table EventManagementSystem add column timezone varchar(30) not null default 'America/Chicago'"); $db->write("alter table EventManagementSystem add column templateId varchar(22) binary not null"); $db->write("alter table EventManagementSystem add column badgeBuilderTemplateId varchar(22) binary not null default 'BMybD3cEnmXVk2wQ_qEsRQ'"); + $db->write("alter table EventManagementSystem add column lookupRegistrantTemplateId varchar(22) binary not null default 'OOyMH33plAy6oCj_QWrxtg'"); $db->write("alter table EventManagementSystem add column badgeInstructions mediumtext"); $db->write("alter table EventManagementSystem add column ribbonInstructions mediumtext"); $db->write("alter table EventManagementSystem add column ticketInstructions mediumtext"); @@ -333,6 +334,7 @@ sub migrateToNewCart { )"); $session->db->write("drop table shoppingCart"); $session->setting->add('shopCartTemplateId','aIpCmr9Hi__vgdZnDTz1jw'); + $session->config->addToHash("macros","ViewCart","ViewCart"); } #------------------------------------------------- diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index f5d12ec40..8b9733762 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -330,6 +330,7 @@ "#" : "Hash_userId", "/" : "Slash_gatewayUrl", "@" : "At_username", + "ViewCart" : "ViewCart", "AOIHits" : "AOIHits", "AOIRank" : "AOIRank", "AdminBar" : "AdminBar", @@ -358,8 +359,6 @@ "RandomThread" : "RandomThread", "RootTitle" : "RootTitle", "Spacer" : "Spacer", - "SubscriptionItem" : "SubscriptionItem", - "SubscriptionItemPurchaseUrl" : "SubscriptionItemPurchaseUrl", "Thumbnail" : "Thumbnail", "User" : "User", "a" : "a_account", @@ -401,7 +400,7 @@ "WebGUI::Workflow::Activity::CleanFileCache", "WebGUI::Workflow::Activity::CleanLoginHistory", "WebGUI::Workflow::Activity::ArchiveOldThreads", "WebGUI::Workflow::Activity::TrashExpiredEvents", "WebGUI::Workflow::Activity::CreateCronJob", "WebGUI::Workflow::Activity::DeleteExpiredSessions", "WebGUI::Workflow::Activity::ExpireGroupings", "WebGUI::Workflow::Activity::PurgeOldAssetRevisions", - "WebGUI::Workflow::Activity::ExpireSubscriptionCodes", "WebGUI::Workflow::Activity::PurgeOldTrash", + "WebGUI::Workflow::Activity::ExpireSubscriptionCodes", "WebGUI::Workflow::Activity::PurgeOldTrash", "WebGUI::Workflow::Activity::ExpireEmsCartItems", "WebGUI::Workflow::Activity::GetSyndicatedContent", "WebGUI::Workflow::Activity::ProcessRecurringPayments", "WebGUI::Workflow::Activity::SyncProfilesToLdap", "WebGUI::Workflow::Activity::SummarizePassiveProfileLog", "WebGUI::Workflow::Activity::SendQueuedMailMessages","WebGUI::Workflow::Activity::CleanDatabaseCache", diff --git a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm index fc84b3197..0280a20a5 100644 --- a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm +++ b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm @@ -18,7 +18,7 @@ use strict; use base 'WebGUI::Asset::Wobject'; use Tie::IxHash; use WebGUI::HTMLForm; -use JSON qw/ to_json /; +use JSON; use Digest::MD5; use WebGUI::Workflow::Instance; use WebGUI::Cache; @@ -63,9 +63,17 @@ sub definition { fieldType => 'template', defaultValue => 'BMybD3cEnmXVk2wQ_qEsRQ', tab => 'display', - label => $i18n->get('extras template'), - hoverHelp => $i18n->get('extras template help'), - namespace => 'EMS/Extras', + label => $i18n->get('badge builder template'), + hoverHelp => $i18n->get('badge builder template help'), + namespace => 'EMS/BadgeBuilder', + }, + lookupRegistrantTemplateId => { + fieldType => 'template', + defaultValue => 'OOyMH33plAy6oCj_QWrxtg', + tab => 'display', + label => $i18n->get('lookup registrant template'), + hoverHelp => $i18n->get('lookup registrant template help'), + namespace => 'EMS/LookupRegistrant', }, badgeInstructions => { fieldType => 'HTMLArea', @@ -274,7 +282,7 @@ sub view {

Add a badgeView Events - • View Cart + • ^ViewCart; • Badge Groups

|.$self->get('badgeInstructions').q|

@@ -588,7 +596,7 @@ sub www_getBadgesAsJson { $results{'sort'} = undef; $results{'dir'} = "asc"; $session->http->setMimeType('text/json'); - return JSON::to_json(\%results); + return JSON->new->encode(\%results); } #------------------------------------------------------------------- @@ -718,7 +726,7 @@ sub www_getRegistrantAsJson { $badgeInfo->{ribbons} = \@ribbons; # build json datasource - return JSON::to_json($badgeInfo); + return JSON->new->encode($badgeInfo); } #------------------------------------------------------------------- @@ -742,9 +750,7 @@ sub www_getRegistrantsAsJson { my @params = ($self->getId); # user or staff - my $isEventStaff = 1; unless ($self->isRegistrationStaff) { - $isEventStaff = 0; $sql .= " and userId=?"; push @params, $session->user->userId; } @@ -755,22 +761,24 @@ sub www_getRegistrantsAsJson { } # limit - $sql .= 'limit ?,?'; + $sql .= ' limit ?,?'; push(@params, $startIndex, $numberOfResults); # get badge info my @records = (); my %results = (); my $badges = $db->read($sql,\@params); + $results{'recordsReturned'} = $badges->rows()+0; + $results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric while (my $badgeInfo = $badges->hashRef) { my $badge = WebGUI::Asset::Sku::EMSBadge->new($session, $badgeInfo->{badgeAssetId}); $badgeInfo->{title} = $badge->getTitle; $badgeInfo->{sku} = $badge->get('sku'); $badgeInfo->{assetId} = $badge->getId; + $badgeInfo->{manageUrl} = $self->getUrl('func=manageRegistrant'); + $badgeInfo->{buildBadgeUrl} = $self->getUrl('func=buildBadge;badgeId='.$badgeInfo->{badgeId}); push(@records, $badgeInfo); } - $results{'recordsReturned'} = $badges->rows()+0; - $results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric $results{'records'} = \@records; $results{'startIndex'} = $startIndex; $results{'sort'} = undef; @@ -778,7 +786,7 @@ sub www_getRegistrantsAsJson { # build json datasource $session->http->setMimeType('text/json'); - return JSON::to_json(\%results); + return JSON->new->encode(\%results); } @@ -812,7 +820,7 @@ sub www_getRibbonsAsJson { $results{'sort'} = undef; $results{'dir'} = "asc"; $session->http->setMimeType('text/json'); - return JSON::to_json(\%results); + return JSON->new->encode(\%results); } @@ -864,12 +872,24 @@ sub www_getTicketsAsJson { @badgeGroups = split("\n",$badge->get('relatedBadgeGroups')) if (defined $badge); } + # get a list of tickets already associated with the badge + my @existingTickets = $db->buildArray("select ticketAssetId from EMSRegistrantTicket where badgeId=?",[$badgeId]); + # get assets my $counter = 0; my $totalTickets = scalar(@ids); my @records = (); foreach my $id (@ids) { + + # gotta get to the page we're working with next unless ($counter >= $startIndex); + + # skip tickets we already have + if (isIn($id, @existingTickets)) { + $totalTickets--; + next; + } + my $ticket = WebGUI::Asset->new($session, $id, 'WebGUI::Asset::Sku::EMSTicket'); # skip borked tickets @@ -925,6 +945,14 @@ sub www_getTicketsAsJson { $counter++; } + # humor + my $find = pack('u',$keywords); + chomp $find; + if ($find eq q|'2$%,,C`P,0``|) { + push(@records, {title=>unpack('u',q|022=M('-Ohttp->setMimeType('text/json'); - return JSON::to_json(\%results); + return JSON->new->encode(\%results); } @@ -967,21 +995,33 @@ sub www_getTokensAsJson { $results{'sort'} = undef; $results{'dir'} = "asc"; $session->http->setMimeType('text/json'); - return JSON::to_json(\%results); + return JSON->new->encode(\%results); } #------------------------------------------------------------------- =head2 www_lookupRegistrant () -Displays the +Displays the badges purchased by the current user, or all users if the user is part of the registration staff. =cut sub www_lookupRegistrant { - my $self = shift; - return $self->www_getRegistrantsAsJson; - return $self->processStyle("here you will be able to look up a registrant by name"); + my ($self) = @_; + my $session = $self->session; + return $session->privilege->noAccess() unless ($self->canView && $self->session->user->userId ne "1"); + + # set up template variables + my %var = ( + buyBadgeUrl => $self->getUrl, + viewEventsUrl => $self->getUrl('func=buildBadge'), + viewCartUrl => $self->getUrl('shop=cart'), + getRegistrantsUrl => $self->getUrl('func=getRegistrantsAsJson'), + isRegistrationStaff => $self->isRegistrationStaff, + ); + + # render the page + return $self->processStyle($self->processTemplate(\%var, $self->get('lookupRegistrantTemplateId'))); } #------------------------------------------------------------------- @@ -1872,7 +1912,7 @@ sub getBadgeSelector { }; } $js = ''; %options = (%options,%{$badges}); $output .= WebGUI::Form::selectBox($self->session,{ diff --git a/lib/WebGUI/Macro/ViewCart.pm b/lib/WebGUI/Macro/ViewCart.pm new file mode 100644 index 000000000..b75d65d62 --- /dev/null +++ b/lib/WebGUI/Macro/ViewCart.pm @@ -0,0 +1,47 @@ +package WebGUI::Macro::ViewCart; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2008 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::International; + +=head1 NAME + +Package WebGUI::Macro::ViewCart + +=head1 DESCRIPTION + +Displays a view cart link and image. + +=head2 process( $session, [ linktext ] ) + +Renders the macro. + +=head3 linktext + +Defaults to "View Cart". + +=cut + + +#------------------------------------------------------------------- +sub process { + my ($session, $text) = @_; + unless ($text) { + $text = WebGUI::International->new($session,"Shop")->get("view cart"); + } + my $url = $session->url->page("shop=cart"); + return ''.$text.' '.$text.''; +} + +1; + + diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm index 003bcaa3e..c49e7d30c 100644 --- a/lib/WebGUI/SQL.pm +++ b/lib/WebGUI/SQL.pm @@ -348,11 +348,11 @@ sub buildSearchQuery { else { $$sql .= ' where ('; } - $keywords = '%'.$keywords.'%'; + $keywords = lc('%'.$keywords.'%'); my $counter = 0; foreach my $field (@{ $columns }) { $$sql .= ' or' if ($counter > 0); - $$sql .= qq{ $field like ?}; + $$sql .= qq{ LOWER( $field ) like ?}; push(@{$placeHolders}, $keywords); $counter++; } diff --git a/lib/WebGUI/Shop/Pay.pm b/lib/WebGUI/Shop/Pay.pm index 6ee411ff9..7b7425b8c 100644 --- a/lib/WebGUI/Shop/Pay.pm +++ b/lib/WebGUI/Shop/Pay.pm @@ -352,12 +352,10 @@ sub www_selectPaymentGateway { } # All the output stuff below is just a placeholder until it's templated. - my $output .= $i18n->echo('Choose one of the following payment gateways to check out:'); - $output .= ''; + my $output .= $i18n->echo('How would you like to pay?'); foreach my $payOption ( values %{$self->getOptions( $cart )} ) { - $output .= ''; + $output .= $payOption->{button} . '
'; } - $output .= '
' . $payOption->{label} . '' . $payOption->{button} . '
'; return $session->style->userStyle( $output ); } diff --git a/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm b/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm index 5fef4d06f..5ccc88e3a 100644 --- a/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm +++ b/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm @@ -20,6 +20,12 @@ our $I18N = { context => q|help for a workflow activity field label|, }, + 'badge number' => { + message => q|Badge #|, + lastUpdated => 0, + context => q|a property label|, + }, + 'percentage discount' => { message => q|Percentage Discount|, lastUpdated => 0, @@ -62,12 +68,6 @@ our $I18N = { context => q|a link label|, }, - 'view cart' => { - message => q|View Cart|, - lastUpdated => 0, - context => q|a link label|, - }, - 'view tickets' => { message => q|View Tickets|, lastUpdated => 0, @@ -200,6 +200,42 @@ our $I18N = { context => q|a template label a tab in the badge builder|, }, + 'lookup registrant template' => { + message => q|Lookup Registrant|, + lastUpdated => 0, + context => q|a property label|, + }, + + 'lookup registrant template help' => { + message => q|Which template would you like to use for the lookup registrant screen?|, + lastUpdated => 0, + context => q|help for a property label|, + }, + + 'badge builder template' => { + message => q|Badge Builder Template|, + lastUpdated => 0, + context => q|a property label|, + }, + + 'badge builder template help' => { + message => q|Which template would you like to use for the badge builder screen?|, + lastUpdated => 0, + context => q|help for a property label|, + }, + + 'main template' => { + message => q|Main Template|, + lastUpdated => 0, + context => q|a property label|, + }, + + 'main template help' => { + message => q|Which template would you like to use for the main screen that lists the badges for purchase?|, + lastUpdated => 0, + context => q|help for a property label|, + }, + 'location' => { message => q|Location|, lastUpdated => 0, diff --git a/lib/WebGUI/i18n/English/Shop.pm b/lib/WebGUI/i18n/English/Shop.pm index c2430ff90..9c730da7f 100644 --- a/lib/WebGUI/i18n/English/Shop.pm +++ b/lib/WebGUI/i18n/English/Shop.pm @@ -3,6 +3,12 @@ package WebGUI::i18n::English::Shop; use strict; our $I18N = { + 'view cart' => { + message => q|View Cart|, + lastUpdated => 0, + context => q|a link label|, + }, + 'my purchases template' => { message => q|My Purchases Template|, lastUpdated => 0, diff --git a/www/extras/macro/ViewCart/cart.gif b/www/extras/macro/ViewCart/cart.gif new file mode 100644 index 000000000..b8d6556e5 Binary files /dev/null and b/www/extras/macro/ViewCart/cart.gif differ