Merge branch 'master' of git@github.com:plainblack/webgui
Conflicts: lib/WebGUI/Asset/EMSSubmission.pm lib/WebGUI/Asset/EMSSubmissionForm.pm lib/WebGUI/Asset/Wobject/EventManagementSystem.pm lib/WebGUI/Workflow/Activity/CleanupEMSSubmissions.pm lib/WebGUI/i18n/English/Asset_EMSSubmission.pm lib/WebGUI/i18n/English/Asset_EMSSubmissionForm.pm lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm t/lib/WebGUI/Test/Activity.pm
This commit is contained in:
commit
1e18313c81
34 changed files with 378 additions and 1965 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package WebGUI::Asset::Wobject::EventManagementSystem;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
|
@ -191,30 +190,6 @@ sub definition {
|
|||
hoverHelp => $i18n->get('print ticket template help'),
|
||||
namespace => 'EMS/PrintTicket',
|
||||
},
|
||||
eventSubmissionMainTemplateId => {
|
||||
fieldType => 'template',
|
||||
defaultValue => 'DoVNijm6lMDE0cYrtvEbDQ',
|
||||
tab => 'display',
|
||||
label => $i18n->get('event submission main template'),
|
||||
hoverHelp => $i18n->get('event submission main template help'),
|
||||
namespace => 'EMS/SubmissionMain',
|
||||
},
|
||||
eventSubmissionTemplateId => {
|
||||
fieldType => 'template',
|
||||
defaultValue => '8tqyQx-LwYUHIWOlKPjJrA',
|
||||
tab => 'display',
|
||||
label => $i18n->get('event submission template'),
|
||||
hoverHelp => $i18n->get('event submission template help'),
|
||||
namespace => 'EMS/Submission',
|
||||
},
|
||||
eventSubmissionQueueTemplateId => {
|
||||
fieldType => 'template',
|
||||
defaultValue => 'ktSvKU8riGimhcsxXwqvPQ',
|
||||
tab => 'display',
|
||||
label => $i18n->get('event submission queue template'),
|
||||
hoverHelp => $i18n->get('event submission queue template help'),
|
||||
namespace => 'EMS/SubmissionQueue',
|
||||
},
|
||||
printRemainingTicketsTemplateId => {
|
||||
fieldType => 'template',
|
||||
defaultValue => 'hreA_bgxiTX-EzWCSZCZJw',
|
||||
|
|
@ -225,8 +200,8 @@ sub definition {
|
|||
},
|
||||
badgeInstructions => {
|
||||
fieldType => 'HTMLArea',
|
||||
defaultValue => $i18n->get('default badge instructions'),
|
||||
tab => 'properties',
|
||||
defaultValue => $i18n->get('default badge instructions'),
|
||||
tab => 'properties',
|
||||
label => $i18n->get('badge instructions'),
|
||||
hoverHelp => $i18n->get('badge instructions help'),
|
||||
},
|
||||
|
|
@ -258,25 +233,6 @@ sub definition {
|
|||
label => $i18n->get('registration staff group'),
|
||||
hoverHelp => $i18n->get('registration staff group help'),
|
||||
},
|
||||
submittedLocationsList => {
|
||||
fieldType => 'text',
|
||||
tab => 'properties',
|
||||
defaultValue => '',
|
||||
label => $i18n->get('submitted location list label'),
|
||||
hoverHelp => $i18n->get('submitted location list help'),
|
||||
},
|
||||
eventSubmissionGroups => {
|
||||
fieldType => 'hidden',
|
||||
defaultValue => '',
|
||||
noFormPost => 1,
|
||||
},
|
||||
nextSubmissionId => {
|
||||
tab => "properties",
|
||||
fieldType => "integer",
|
||||
defaultValue => 1,
|
||||
label => $i18n->get("next submission id label"),
|
||||
hoverHelp => $i18n->get("next submission id label help")
|
||||
},
|
||||
);
|
||||
push(@{$definition}, {
|
||||
assetName=>$i18n->get('assetName'),
|
||||
|
|
@ -305,21 +261,6 @@ sub deleteEventMetaField {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 ems
|
||||
|
||||
this is called by the submission sub-system
|
||||
it is for compatability and ensures that the ems
|
||||
object is used for certain calls
|
||||
|
||||
=cut
|
||||
|
||||
sub ems {
|
||||
my $self = shift;
|
||||
return $self;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getBadges ()
|
||||
|
|
@ -418,7 +359,6 @@ sub getEventFieldsForImport {
|
|||
type => $field->{dataType},
|
||||
options => $field->{possibleValues},
|
||||
defaultValue => $field->{defaultValues},
|
||||
helpText => $field->{defaultValues},
|
||||
});
|
||||
}
|
||||
return \@fields;
|
||||
|
|
@ -435,7 +375,7 @@ may be SQL optimized for quick access
|
|||
|
||||
sub getLocations {
|
||||
my $self = shift;
|
||||
my $dateRef = shift;
|
||||
my $dateRef = shift || [ ];
|
||||
|
||||
my %hash;
|
||||
my %hashDate;
|
||||
|
|
@ -444,30 +384,13 @@ sub getLocations {
|
|||
# this is a really compact 'uniq' operation
|
||||
my @locations = map { $h{$_}++ == 0 ? $_ : () } ( map { $_->get('location') } ( @$tickets ) );
|
||||
# the dates have the time data removed with a pattern substitution
|
||||
if( $dateRef ) {
|
||||
push @$dateRef, map { s/\s*\d+:\d+(:\d+)?//; $h{$_}++ == 0 ? $_ : () } ( map { $_->get('startDate') } ( @$tickets ) );
|
||||
}
|
||||
push @$dateRef, map { s/\s*\d+:\d+(:\d+)?//; $h{$_}++ == 0 ? $_ : () } ( map { $_->get('startDate') } ( @$tickets ) );
|
||||
|
||||
return @locations;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getNextSubmissionId
|
||||
|
||||
get a sequence number for the submission id
|
||||
|
||||
=cut
|
||||
|
||||
sub getNextSubmissionId {
|
||||
my $self = shift;
|
||||
my ($submissionId) = $self->session->db->read('select nextSubmissionId from EventManagementSystem where assetId = ?', [ $self->getId ] )->array;
|
||||
$self->update( { nextSubmissionId => ($submissionId + 1) } );
|
||||
return $submissionId;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getRegistrant ( badgeId )
|
||||
|
||||
Returns a hash reference containing the properties of a registrant.
|
||||
|
|
@ -717,16 +640,9 @@ sub view {
|
|||
addBadgeUrl => $self->getUrl('func=add;class=WebGUI::Asset::Sku::EMSBadge'),
|
||||
buildBadgeUrl => $self->getUrl('func=buildBadge'),
|
||||
viewScheduleUrl => $self->getUrl('func=viewSchedule'),
|
||||
addSubmissionUrl => $self->getUrl('func=viewSubmissionQueue#addSubmission'),
|
||||
viewSubmissionQueueUrl => $self->getUrl('func=viewSubmissionQueue'),
|
||||
addSubmissionFormUrl => $self->getUrl('func=viewSubmissionQueue#addSubmissionForm'),
|
||||
manageBadgeGroupsUrl=> $self->getUrl('func=manageBadgeGroups'),
|
||||
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
|
||||
isRegistrationStaff => $self->isRegistrationStaff,
|
||||
canEdit => $self->canEdit,
|
||||
canSubmit => $self->canSubmit,
|
||||
hasSubmissions => $self->hasSubmissions,
|
||||
hasSubmissionForms => $self->hasSubmissionForms,
|
||||
canEdit => $self->canEdit,
|
||||
lookupRegistrantUrl => $self->getUrl('func=lookupRegistrant'),
|
||||
);
|
||||
|
||||
|
|
@ -1005,62 +921,6 @@ sub www_editBadgeGroupSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSubmission
|
||||
|
||||
use getLineage to find the item to edit based on submissionId
|
||||
then call www_editSubmission on it
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editSubmission {
|
||||
my $self = shift;
|
||||
my $submissionId = $self->session->form->get('submissionId');
|
||||
my $asset = $self->getLineage(['descendants'], { returnObjects => 1,
|
||||
joinClass => "WebGUI::Asset::EMSSubmission",
|
||||
whereClause => 'submissionId = ' . int($submissionId),
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
|
||||
} );
|
||||
return $asset->[0]->www_editSubmission;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSubmissionForm
|
||||
|
||||
calls editSubmissionForm in WebGUI::Asset::EMSSubmissionForm
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editSubmissionForm {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->isRegistrationStaff || $self->canEdit;
|
||||
return WebGUI::Asset::EMSSubmissionForm->www_editSubmissionForm($self,shift);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSubmissionFormSave
|
||||
|
||||
test and save data posted from editSubmissionForm...
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editSubmissionFormSave {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->isRegistrationStaff;
|
||||
my $formParams = WebGUI::Asset::EMSSubmissionForm->processForm($self);
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
$self->addSubmissionForm($formParams);
|
||||
return $self->www_viewSubmissionQueue;
|
||||
} else {
|
||||
return $self->www_editSubmissionForm($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editEventMetaField ( )
|
||||
|
||||
Displays the edit form for event meta fields.
|
||||
|
|
@ -1087,7 +947,6 @@ sub www_editEventMetaField {
|
|||
required => $self->session->form->process("required",'yesNo'),
|
||||
possibleValues => $self->session->form->process("possibleValues",'textarea'),
|
||||
defaultValues => $self->session->form->process("defaultValues",'textarea'),
|
||||
helpText => $self->session->form->process("helpText",'textarea'),
|
||||
};
|
||||
$f->readOnly(
|
||||
-name => 'error',
|
||||
|
|
@ -1144,12 +1003,6 @@ sub www_editEventMetaField {
|
|||
-hoverHelp => $i18n->get('488 description'),
|
||||
-value => $data->{defaultValues},
|
||||
);
|
||||
$f->textarea(
|
||||
-name => "helpText",
|
||||
-label => $i18n2->get('meta field help text'),
|
||||
-hoverHelp => $i18n2->get('meta field help text description'),
|
||||
-value => $data->{helpText},
|
||||
);
|
||||
$f->submit;
|
||||
return $self->processStyle($f->print);
|
||||
}
|
||||
|
|
@ -1182,7 +1035,6 @@ sub www_editEventMetaFieldSave {
|
|||
required => $self->session->form->process("required",'yesNo'),
|
||||
possibleValues => $self->session->form->process("possibleValues",'textarea'),
|
||||
defaultValues => $self->session->form->process("defaultValues",'textarea'),
|
||||
helpText => $self->session->form->process("helpText",'textarea'),
|
||||
},1,1);
|
||||
return $self->www_manageEventMetaFields();
|
||||
}
|
||||
|
|
@ -1267,90 +1119,6 @@ sub www_exportEvents {
|
|||
return "chunked";
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_getAllSubmissions ( )
|
||||
|
||||
Get a page of Asset Manager data, ajax style. Returns a JSON array to be
|
||||
formatted in a WebGUI submission queue data table.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_getAllSubmissions {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $datetime = $session->datetime;
|
||||
my $form = $session->form;
|
||||
my $tableInfo = {};
|
||||
|
||||
return $session->privilege->insufficient unless $self->canSubmit || $self->isRegistrationStaff;
|
||||
|
||||
my $orderByColumn = $form->get( 'orderByColumn' ) || $self->get("sortColumn");
|
||||
my $dir = $form->get('orderByDirection') || $self->get('sortOrder');
|
||||
my $orderByDirection = lc ($dir) eq "asc" ? "ASC" : "DESC";
|
||||
|
||||
my $whereClause ;
|
||||
if(!$self->isRegistrationStaff) {
|
||||
my $userId = $session->user->userId;
|
||||
$whereClause .= qq{ createdBy='$userId'};
|
||||
}
|
||||
|
||||
my $rules;
|
||||
$rules->{'joinClass' } = "WebGUI::Asset::EMSSubmission";
|
||||
$rules->{'whereClause' } = $whereClause;
|
||||
$rules->{'includeOnlyClasses'} = ['WebGUI::Asset::EMSSubmission'];
|
||||
$rules->{'orderByClause' } = $session->db->dbh->quote_identifier( $orderByColumn ) . ' ' . $orderByDirection if $orderByColumn;
|
||||
|
||||
my $sql = "";
|
||||
|
||||
$sql = $self->getLineageSql(['descendants'], $rules);
|
||||
|
||||
my $startIndex = $form->get( 'startIndex' ) || 1;
|
||||
my $rowsPerPage = $form->get( 'rowsPerPage' ) || 25;
|
||||
my $currentPage = int ( $startIndex / $rowsPerPage ) + 1;
|
||||
|
||||
my $p = WebGUI::Paginator->new( $session, '', $rowsPerPage, 'pn', $currentPage );
|
||||
$p->setDataByQuery($sql);
|
||||
|
||||
$tableInfo->{'recordsReturned'} = $rowsPerPage;
|
||||
$tableInfo->{'totalRecords' } = $p->getRowCount;
|
||||
$tableInfo->{'startIndex' } = $startIndex;
|
||||
$tableInfo->{'sort' } = $orderByColumn;
|
||||
$tableInfo->{'dir' } = $orderByDirection;
|
||||
$tableInfo->{'records' } = [];
|
||||
|
||||
for my $record ( @{ $p->getPageData } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $record->{assetId} );
|
||||
|
||||
my $lastReplyBy = $asset->get("lastReplyBy");
|
||||
if ($lastReplyBy) {
|
||||
$lastReplyBy = WebGUI::User->new($session,$lastReplyBy)->username;
|
||||
}
|
||||
|
||||
# Populate the required fields to fill in
|
||||
my $lastReplyDate = $asset->get("lastReplyDate");
|
||||
if($lastReplyDate) {
|
||||
$lastReplyDate = $datetime->epochToHuman($lastReplyDate,"%y-%m-%d @ %H:%n %p");
|
||||
}
|
||||
|
||||
my %fields = (
|
||||
submissionId => $asset->get("submissionId"),
|
||||
url => $asset->getQueueUrl,
|
||||
title => $asset->get( "title" ),
|
||||
createdBy => WebGUI::User->new($session,$asset->get( "createdBy" ))->username,
|
||||
creationDate => $datetime->epochToSet($asset->get( "creationDate" )),
|
||||
submissionStatus => $self->getSubmissionStatus($asset->get( "submissionStatus" ) || 'pending' ),
|
||||
lastReplyDate => $lastReplyDate || '',
|
||||
lastReplyBy => $lastReplyBy || '',
|
||||
);
|
||||
|
||||
push @{ $tableInfo->{ records } }, \%fields;
|
||||
}
|
||||
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
return JSON->new->encode( $tableInfo );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_getBadgesAsJson ()
|
||||
|
|
@ -1389,36 +1157,6 @@ sub www_getBadgesAsJson {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_getSubmissionById
|
||||
|
||||
returns a JSON dataset with info about the requested submission
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub www_getSubmissionById {
|
||||
my $self = shift;
|
||||
my $submissionId = $self->session->form->get('submissionId');
|
||||
my $result;
|
||||
my $res = $self->getLineage(['descendants'],{ limit => 1, returnObjects=>1,
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
|
||||
joinClass => "WebGUI::Asset::EMSSubmission",
|
||||
whereClause => q{submissionId='} . $submissionId . q/'/,
|
||||
} );
|
||||
if( scalar(@$res) == 0 ) {
|
||||
$result->{hasError} = 1;
|
||||
$result->{errors} = [ 'failed to load submission' ];
|
||||
} else {
|
||||
$result->{text} = $res->[0]->www_editSubmission;
|
||||
$result->{title} = $submissionId;
|
||||
$result->{id} = $submissionId;
|
||||
}
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return JSON->new->encode($result);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_getRegistrantAsJson ( )
|
||||
|
||||
Retrieves the properties of a specific badge and the items attached to it. Expects badgeId to be one of the form params.
|
||||
|
|
@ -1761,6 +1499,8 @@ sub www_getScheduleDataJSON {
|
|||
return JSON->new->encode(\%results);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_getTicketsAsJson ()
|
||||
|
|
@ -2640,6 +2380,7 @@ View the schedule table.
|
|||
sub www_viewSchedule {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canView;
|
||||
my $db = $self->session->db;
|
||||
my $rowsPerPage = 25;
|
||||
my $locationsPerPage = $self->get('scheduleColumnsPerPage');
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,10 @@ use WebGUI::Asset;
|
|||
use WebGUI::Asset::Wobject::Survey;
|
||||
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
|
||||
|
||||
# We need these as semi-globals so that utility subs (which are shared with the safe compartment)
|
||||
# We need these as file-scoped lexicals so that our utility subs (which are shared with the safe compartment)
|
||||
# can access them.
|
||||
# N.B. If you add any new ones, make sure you initialize them in L<run> otherwise they will be cached across
|
||||
# unrelated engine runs, which leads to bugs that are hairy to track down
|
||||
my $session;
|
||||
my $values;
|
||||
my $scores;
|
||||
|
|
@ -431,7 +433,7 @@ sub run {
|
|||
my ( $s, $expression, $opts )
|
||||
= validate_pos( @_, { isa => 'WebGUI::Session' }, { type => SCALAR }, { type => HASHREF, default => {} } );
|
||||
|
||||
# Init package globals
|
||||
# Initialize all file-scoped lexicals that our Safe utility subs have access to
|
||||
$session = $s;
|
||||
$values = $opts->{values} || {};
|
||||
$scores = $opts->{scores} || {};
|
||||
|
|
@ -439,6 +441,7 @@ sub run {
|
|||
$validate = $opts->{validate};
|
||||
$validTargets = $opts->{validTargets};
|
||||
$tags = $opts->{tags} || {};
|
||||
$otherInstances = {};
|
||||
|
||||
if ( !$session->config->get('enableSurveyExpressionEngine') ) {
|
||||
$session->log->debug('enableSurveyExpressionEngine config option disabled, skipping');
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ Sets a flag so that developers know whether to send notifications out on certain
|
|||
sub setSkipNotification {
|
||||
my $self = shift;
|
||||
$self->session->db->write("update assetData set skipNotification=1 where assetId=? and revisionDate=?", [$self->getId, $self->get("revisionDate")]);
|
||||
$self->{_properties}->{skipNotification} = 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -178,8 +178,9 @@ sub toHtml {
|
|||
my ($filename, $challenge) = $storage->addFileFromCaptcha;
|
||||
$self->set("size", 6);
|
||||
$self->set("maxlength", 6);
|
||||
$self->set("extras", 'class="wg-captchaForm"');
|
||||
$self->session->scratch->set("captcha_".$self->get("name"), $challenge);
|
||||
return $self->SUPER::toHtml.'<p style="display:inline;vertical-align:middle;"><img src="'.$storage->getUrl($filename).'" style="border-style:none;vertical-align:middle;" alt="captcha" /></p>';
|
||||
return $self->SUPER::toHtml.'<img src="'.$storage->getUrl($filename).'" class="wg-captchaImage" alt="captcha" />';
|
||||
}
|
||||
|
||||
=head2 getErrorMessage ( )
|
||||
|
|
|
|||
|
|
@ -1,114 +0,0 @@
|
|||
package WebGUI::Form::Div;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2009 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
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::Control';
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Form::Div
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
dreates a HTML div element with contents provided by caller
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::Control.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
The following methods are specifically available from this class. Check the superclass for additional methods.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 usage
|
||||
|
||||
$form->div({
|
||||
contentCallback => sub { $self->getDivContents(shift); }
|
||||
});
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 contentCallback
|
||||
|
||||
A code enclosure which returns the html text to insert into the div element. The divId is passed as parameter 0 when it is called. This function MUST return good html text, it is NOT processed here at all.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
contentCallback=>{
|
||||
defaultValue=> sub { return '' },
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ( session )
|
||||
|
||||
Returns the name of the form control.
|
||||
|
||||
=cut
|
||||
|
||||
sub getName {
|
||||
my ($class, $session) = @_;
|
||||
return WebGUI::International->new($session, "Form_Div")->get("topicName");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValue ( [ value ] )
|
||||
|
||||
Does some special processing.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValue {
|
||||
my $self = shift;
|
||||
return $self->get('contentCallback')->($self->get('id'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders an input tag of type text.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
return '<div id="'.$self->get('id').'" name="'.$self->get("name").'" '.$self->get("extras").'>' . $self->getValue . '</div>' ;
|
||||
}
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
|
|
@ -292,7 +292,7 @@ sub www_addGroupsToGroupSave {
|
|||
my $session = shift;
|
||||
return $session->privilege->adminOnly() unless (canEditGroup($session,$session->form->process("gid")) && $session->form->validToken);
|
||||
my $group = WebGUI::Group->new($session,$session->form->process("gid"));
|
||||
my @groups = $session->form->group('groups');
|
||||
my @groups = $session->form->process('groups', 'group', []);
|
||||
$group->addGroups(\@groups);
|
||||
return www_manageGroupsInGroup($session);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,17 +202,19 @@ sub www_editSettings {
|
|||
hoverHelp => $i18n->get("my purchases detail template help"),
|
||||
);
|
||||
$form->template(
|
||||
name => 'receiptEmailTemplateId',
|
||||
namespace => "Shop/EmailReceipt",
|
||||
label => $i18n->get("receipt email template"),
|
||||
hoverHelp => $i18n->get("receipt email template help"),
|
||||
defaultValue => 'bPz1yk6Y9uwMDMBcmMsSCg',
|
||||
name => 'shopReceiptEmailTemplateId',
|
||||
namespace => "Shop/EmailReceipt",
|
||||
label => $i18n->get("receipt email template"),
|
||||
hoverHelp => $i18n->get("receipt email template help"),
|
||||
defaultValue => 'bPz1yk6Y9uwMDMBcmMsSCg',
|
||||
value => $setting->get("shopReceiptEmailTemplateId"),
|
||||
);
|
||||
$form->group(
|
||||
name => 'saleNotificationGroupId',
|
||||
label => $i18n->get("sale notification group"),
|
||||
hoverHelp => $i18n->get("sale notification group help"),
|
||||
defaultValue => '3',
|
||||
name => 'shopSaleNotificationGroupId',
|
||||
label => $i18n->get("sale notification group"),
|
||||
hoverHelp => $i18n->get("sale notification group help"),
|
||||
defaultValue => '3',
|
||||
value => $setting->get("shopSaleNotificationGroupId"),
|
||||
);
|
||||
$form->submit;
|
||||
return $ac->render($form->print, $i18n->get("shop settings"));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Package WebGUI::Shop::ShipDriver::USPS
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Shipping driver for the United States Postal Service.
|
||||
Shipping driver for the United States Postal Service, domestic shipping services.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
|
@ -73,7 +73,10 @@ sub buildXML {
|
|||
$weight += $itemWeight;
|
||||
}
|
||||
my $pounds = int($weight);
|
||||
my $ounces = int(16 * ($weight - $pounds));
|
||||
my $ounces = sprintf '%3.1f', (16 * ($weight - $pounds));
|
||||
if ($pounds == 0 && $ounces eq '0.0' ) {
|
||||
$ounces = 0.1;
|
||||
}
|
||||
my $destination = $package->[0]->getShippingAddress;
|
||||
my $destZipCode = $destination->get('code');
|
||||
$packageData{ID} = $packageIndex;
|
||||
|
|
@ -127,6 +130,9 @@ sub calculate {
|
|||
if (! $self->get('userId')) {
|
||||
WebGUI::Error::InvalidParam->throw(error => q{Driver configured without a USPS userId.});
|
||||
}
|
||||
if ($cart->getShippingAddress->get('country') ne 'United States') {
|
||||
WebGUI::Error::InvalidParam->throw(error => q{Driver only handles domestic shipping});
|
||||
}
|
||||
my $cost = 0;
|
||||
##Sort the items into shippable bundles.
|
||||
my @shippableUnits = $self->_getShippableUnits($cart);
|
||||
|
|
@ -196,6 +202,9 @@ sub _calculateFromXML {
|
|||
if ($id < 0 || $id > $#shippableUnits) {
|
||||
WebGUI::Error::Shop::RemoteShippingRate->throw(error => "Illegal package index returned by USPS: $id");
|
||||
}
|
||||
if (exists $package->{Error}) {
|
||||
WebGUI::Error::Shop::RemoteShippingRate->throw(error => $package->{Description});
|
||||
}
|
||||
my $unit = $shippableUnits[$id];
|
||||
if ($unit->[0]->getSku->shipsSeparately) {
|
||||
##This is a single item due to ships separately. Since in reality there will be
|
||||
|
|
@ -428,6 +437,9 @@ sub _getShippableUnits {
|
|||
}
|
||||
else {
|
||||
my $zip = $item->getShippingAddress->get('code');
|
||||
if ($item->getShippingAddress->get('country') ne 'United States') {
|
||||
WebGUI::Error::InvalidParam->throw(error => q{Driver only handles domestic shipping});
|
||||
}
|
||||
push @{ $looseUnits{$zip} }, $item;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,123 +0,0 @@
|
|||
package WebGUI::Workflow::Activity::ProcessEMSApprovals;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::International;
|
||||
use WebGUI::VersionTag;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::ProcessEMSApprovals
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Uses the settings in the help desk to determine whether the resolved tickets should be closed or not.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmissionForm" );
|
||||
push(@{$definition}, {
|
||||
name => $i18n->get("activity title approve submissions"),
|
||||
properties => {}
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( )
|
||||
|
||||
See WebGUI::Workflow::Activity::execute() for details.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
# keep track of how much time it's taking
|
||||
my $start = time;
|
||||
my $limit = 2_500;
|
||||
my $timeLimit = 60;
|
||||
|
||||
my $list = $root->getLineage( ['descendants'], { returnObjects => 1,
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
|
||||
} );
|
||||
|
||||
for my $emsForm ( @$list ) {
|
||||
my $whereClause = q{ submissionStatus='approved' };
|
||||
my $res = $emsForm->getLineage(['children'],{ returnObjects => 1,
|
||||
joinClass => 'WebGUI::Asset::EMSSubmission',
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
|
||||
whereClause => $whereClause,
|
||||
} );
|
||||
for my $submission ( @$res ) {
|
||||
my $properties = { className => 'WebGUI::Asset::Sku::EMSTicket' };
|
||||
for my $name ( qw{title description seatsAvailable price vendorId
|
||||
synopsis location duration startDate sku relatedRibbons
|
||||
relatedBadgeGroups eventMetaData shipsSeparately} ) {
|
||||
$properties->{$name} = $submission->get($name);
|
||||
}
|
||||
$properties->{eventNumber} = $self->session->db->quickScalar(
|
||||
"select max(eventNumber)+1
|
||||
from EMSTicket left join asset using (assetId)
|
||||
where parentId=?",[$emsForm->ems->getId]) || 0;
|
||||
my $newAsset = $emsForm->ems->addChild( $properties );
|
||||
if( $newAsset ) {
|
||||
# TODO this should be addRevision
|
||||
$submission->update({ ticketId => $newAsset->getId, submissionStatus => 'created' });
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
|
||||
} else {
|
||||
$submission->addComment($@) if $@;
|
||||
$submission->update({ submissionStatus => 'failed' });
|
||||
}
|
||||
$limit--;
|
||||
last if ! $limit or time > $start + $timeLimit;
|
||||
}
|
||||
}
|
||||
return $self->WAITING(1) if ! $limit or time > $start + $timeLimit;
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -1897,178 +1897,7 @@ normal templates.|,
|
|||
context => q|help text for the columns per page field|,
|
||||
},
|
||||
|
||||
'edit submission form' => {
|
||||
message => q|Edit Submission Form|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the link to edit a submission form.|,
|
||||
},
|
||||
|
||||
'new submission form' => {
|
||||
message => q|New Submission Form|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the link to create a new submission form.|,
|
||||
},
|
||||
|
||||
'view submission queue' => {
|
||||
message => q|Submission Queue|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for link to view submission queue.|,
|
||||
},
|
||||
|
||||
'add submission' => {
|
||||
message => q|New|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|This is appended to the title of a submission form when user is submitting a new event.|,
|
||||
},
|
||||
|
||||
'new submission' => {
|
||||
message => q|New Submission|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for link to create a new submission for an event.|,
|
||||
},
|
||||
|
||||
'view my submissions' => {
|
||||
message => q|My Submissions|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for link to view submissions owned by current user.|,
|
||||
},
|
||||
|
||||
'event submission template' => {
|
||||
message => q|Event Submission Template|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Label for the template that is used to submit events.|
|
||||
},
|
||||
|
||||
'event submission template help' => {
|
||||
message => q|This template is used for event submission, most of its contents is composed by the submission form asset based on the description given by the admin who created it.|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Help text for the event submission form template.|
|
||||
},
|
||||
|
||||
'event submission queue template' => {
|
||||
message => q|Event Submission Queue Template|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Label for the Event Submission Queue template.|
|
||||
},
|
||||
|
||||
'event submission queue template help' => {
|
||||
message => q|This is the template used to display the Event Submission Queue, used for both submitters and admin.|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Help text for the Event SUbmission Queue Template.|
|
||||
},
|
||||
|
||||
'event submission main template' => {
|
||||
message => q|Event Submission Main Template|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Label for the event submission main template.|
|
||||
},
|
||||
|
||||
'event submission main template help' => {
|
||||
message => q|This template is used to describe main page of the submission module. It has a dynamic tabset on it which is used to hold one or more pieces of the submission interface.|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Help text for the event submission main template.|
|
||||
},
|
||||
|
||||
'select form to edit' => {
|
||||
message => q|Select a Form to Edit|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for list of submission forms; user must choose one to edit.|,
|
||||
},
|
||||
|
||||
'select form to submit' => {
|
||||
message => q|Select a Form to Submit|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for list of submission forms; user must choose one to proceed to a submission form.|,
|
||||
},
|
||||
|
||||
'pending' => {
|
||||
message => q|Pending|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for pending status on submission.|,
|
||||
},
|
||||
|
||||
'feedback' => {
|
||||
message => q|Feedback|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for feedback requested on a submission.|,
|
||||
},
|
||||
|
||||
'denied' => {
|
||||
message => q|Denied|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for denied status on a submission.|,
|
||||
},
|
||||
|
||||
'approved' => {
|
||||
message => q|Approved|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for approved status on a submission.|,
|
||||
},
|
||||
|
||||
'created' => {
|
||||
message => q|Created|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for status indicating ticket is created for submission.|,
|
||||
},
|
||||
|
||||
'failed' => {
|
||||
message => q|Failed|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label indicating ticket creation failed for submission.|,
|
||||
},
|
||||
|
||||
'meta field help text' => {
|
||||
message => q|Help Text|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|The label for the meta field help text field.|,
|
||||
},
|
||||
|
||||
'meta field help text description' => {
|
||||
message => q|This help text will be provided in the event submission interface.|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Describes the help text that is attached to meta fields.|,
|
||||
},
|
||||
|
||||
'default submitted location list' => {
|
||||
message => q||,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|This is the default value for the list of locations for event submission.|,
|
||||
},
|
||||
|
||||
'submitted location list label' => {
|
||||
message => q|Locations Available for Event Submissions|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the submitted location list|,
|
||||
},
|
||||
|
||||
'submitted location list help' => {
|
||||
message => q|Enter a listy of location names here, one name on a line. This list will be available on the event submission form in the location select box. If this field is filled in then only these locations will be available.|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|This is help text for the submitted location list field.|,
|
||||
},
|
||||
|
||||
'submission queue' => {
|
||||
message => q|Submission Queue|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the submission list tab for registration staff.|,
|
||||
},
|
||||
|
||||
'my submissions' => {
|
||||
message => q|My Submissions|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the submission list tab for event submitters.|,
|
||||
},
|
||||
|
||||
'next submission id label' => {
|
||||
message => q|Next Submission Id|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Label for the field which indicates the next id used to create a submission.|
|
||||
},
|
||||
'next submission id label help' => {
|
||||
message => q|This is the value that will be used to fill in the first submission, do not edit it.|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|This is the help text for the 'next submission id' field, the user should be reminded not to edit this field.|
|
||||
},
|
||||
'print remaining ticket template help' => {
|
||||
message => q|EMS Print Remaining Ticket Template|,
|
||||
lastUpdated => 1147050475,
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package WebGUI::i18n::English::Form_Div;
|
||||
|
||||
use strict; ##Required for all good Perl::Critic compliant code
|
||||
|
||||
our $I18N = {
|
||||
'topicName' => {
|
||||
message => q|Form Control Div Element|,
|
||||
lastUpdated => 1131394070, #seconds from the epoch
|
||||
context => q|Name of the form control that generates HTML Div elements|
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
|
|
@ -33,8 +33,8 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'usps instructions' => {
|
||||
lastUpdated => 1241028258,
|
||||
message => q|<p>In order to use the USPS Shipping Driver, you must first register with the United States Postal Service as a <a href="https://secure.shippingapis.com/registration/">USPS Web Tools User</a>. Fill out the form, submit it, and within a few days the USPS will send you a username and password to use this service. Enter your username and password in the form fields below.</p><p>This driver supports three kinds of shipping with one preset size for each kind. Package sizes, and shipping services outside of those choices, are currently not supported.</p><p>For the purpose of calculating weight, the weight property of a Product is considered to be in pounds.|,
|
||||
lastUpdated => 1257399744,
|
||||
message => q|<p>In order to use the USPS Shipping Driver, you must first register with the United States Postal Service as a <a href="https://secure.shippingapis.com/registration/">USPS Web Tools User</a>. Fill out the form, submit it, and within a few days the USPS will send you a username and password to use this service. After receiving your username, call 1-800-344-7779 to have the USPS authorize your username. Enter your username and password in the form fields below.</p><p>This driver supports three kinds of shipping with one preset size for each kind. Package sizes, and shipping services outside of those choices, are currently not supported.</p><p>For the purpose of calculating weight, the weight property of a Product is considered to be in pounds.|,
|
||||
},
|
||||
|
||||
'ship type' => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue