lots of work...
This commit is contained in:
parent
d0307d99c1
commit
10ddac6c58
11 changed files with 172 additions and 100 deletions
|
|
@ -440,12 +440,15 @@ dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
|
|||
|
||||
sub www_editSubmissionSave {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
my $formParams = WebGUI::Asset::EMSSubmission->processForm($self);
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
$self->update($formParams);
|
||||
return $self->getParent->getParent->www_viewSubmissionQueue;
|
||||
$self->addRevision($formParams);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
|
||||
$self = $self->cloneFromDb;
|
||||
return $self->www_view;
|
||||
} else {
|
||||
return $self->www_editSubmission($formParams);
|
||||
}
|
||||
|
|
@ -489,7 +492,7 @@ sub getEditForm {
|
|||
|
||||
=head2 getEditTabs ( )
|
||||
|
||||
Not to be modified, just defines 2 new tabs.
|
||||
defines 2 new tabs.
|
||||
the shop tab is created here to mimic the function of the sku-created
|
||||
shop tab. this class holds data like Sku assets so that they can be assigned
|
||||
in the future when the sku asset is created from this data.
|
||||
|
|
|
|||
|
|
@ -41,12 +41,6 @@ and then become EMSTicket's.
|
|||
|
||||
use WebGUI::Asset::EMSSubmissionForm;
|
||||
|
||||
=head1 TODO
|
||||
|
||||
add a lastSubmissionDate -- after that the submission form will be closed
|
||||
the link will still exist but the form will just say '<title> submissions closed as of <date>'
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
|
@ -75,7 +69,10 @@ sub addSubmission {
|
|||
$newParams->{className} = 'WebGUI::Asset::EMSSubmission';
|
||||
$newParams->{submissionStatus} = 'pending';
|
||||
$newParams->{submissionId} = $self->ems->getNextSubmissionId;
|
||||
$self->addChild($newParams);
|
||||
my $newAsset = $self->addChild($newParams);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { override => 1, allowComments => 0 });
|
||||
$self = $self->cloneFromDb;
|
||||
return $newAsset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -254,7 +251,7 @@ sub www_editSubmissionForm {
|
|||
return qq{<li><a href='$u' title='$d'>$n</a></li>} } ;
|
||||
my $listOfLinks = join '', ( map {
|
||||
$makeAnchorList->(
|
||||
$_->getUrl('func=editSubmissionForm' ),
|
||||
$_->getQueueUrl,
|
||||
$_->get('title'),
|
||||
WebGUI::HTML::filter($_->get('description'),'all')
|
||||
)
|
||||
|
|
@ -361,7 +358,9 @@ sub www_editSubmissionFormSave {
|
|||
my $formParams = $self->processForm();
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
$self->update($formParams);
|
||||
$self->addRevision($formParams);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
$self = $self->cloneFromDb;
|
||||
return $self->getParent->www_viewSubmissionQueue;
|
||||
} else {
|
||||
return $self->www_editSubmissionForm($formParams);
|
||||
|
|
@ -392,6 +391,19 @@ sub getFormDescription {
|
|||
return JSON->new->decode($self->get('formDescription'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
=head2 getQueueUrl
|
||||
|
||||
returns the URL for the submission queue page with the submisison id in the hash part
|
||||
|
||||
=cut
|
||||
|
||||
sub getQueueUrl {
|
||||
my $self = shift;
|
||||
return $self->ems->getUrl('func=viewSubmissionQueue#' . $self->getId );
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 indexContent ( )
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ sub addGroupToSubmitList {
|
|||
my @ids = split(' ', $self->get('eventSubmissionGroups'));
|
||||
my %h;
|
||||
@ids = map { $h{$_}++ == 0 ? $_ : () } ( $groupId, @ids );
|
||||
$self->addRevision({eventSubmissionGroups => join( ' ', @ids ) });
|
||||
$self->update({eventSubmissionGroups => join( ' ', @ids ) });
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -94,7 +94,10 @@ sub addSubmissionForm {
|
|||
$params->{className} = 'WebGUI::Asset::EMSSubmissionForm';
|
||||
$params->{canSubmitGroupId} ||= 2;
|
||||
$self->addGroupToSubmitList($params->{canSubmitGroupId});
|
||||
return $self->addChild($params);
|
||||
my $newAsset = $self->addChild($params);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
||||
$self = $self->cloneFromDb;
|
||||
return $newAsset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -434,7 +437,7 @@ sub getNextSubmissionId {
|
|||
my $self = shift;
|
||||
#my $submissionId = $self->get('nextSubmissionId');
|
||||
my ($submissionId) = $self->session->db->read('select nextSubmissionId from EventManagementSystem where assetId = ?', [ $self->getId ] )->array;
|
||||
$self->addRevision( { nextSubmissionId => ($submissionId + 1) } );
|
||||
$self->update( { nextSubmissionId => ($submissionId + 1) } );
|
||||
return $submissionId;
|
||||
}
|
||||
|
||||
|
|
@ -963,6 +966,27 @@ sub www_editBadgeGroupSave {
|
|||
return $self->www_manageBadgeGroups;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=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
|
||||
|
|
@ -2545,6 +2569,15 @@ sub www_viewSubmissionQueue {
|
|||
my $i18n = $self->i18n;
|
||||
return $self->session->privilege->insufficient() unless $canSubmit || $isRegistrationStaff;
|
||||
|
||||
# this map returns an array of hash refs with an id,url pair to describe the submissionForm assets
|
||||
my @submissionFormUrls = map { {
|
||||
id => $_->getId,
|
||||
url => $_->getUrl('func=editSubmissionForm')
|
||||
} } (
|
||||
@{$self->getLineage( ['children'],{ returnObjects => 1,
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
|
||||
} ) }
|
||||
);
|
||||
my $QueueTabData =
|
||||
$self->processTemplate({
|
||||
backUrl => $self->getUrl,
|
||||
|
|
@ -2555,8 +2588,10 @@ sub www_viewSubmissionQueue {
|
|||
hasSubmissionForms => $self->hasSubmissionForms,
|
||||
getSubmissionQueueDataUrl => $self->getUrl('func=getAllSubmissions'),
|
||||
addSubmissionFormUrl => $self->getUrl('func=addSubmissionForm'),
|
||||
editSubmissionUrl => $self->getUrl('func=editSubmission'),
|
||||
editSubmissionFormUrl => $self->getUrl('func=editSubmissionForm'),
|
||||
addSubmissionUrl => $self->getUrl('func=addSubmission'),
|
||||
submissionFormUrls => \@submissionFormUrls,
|
||||
},$self->get('eventSubmissionQueueTemplateId'));
|
||||
|
||||
return $self->processStyle(
|
||||
|
|
@ -2571,6 +2606,7 @@ sub www_viewSubmissionQueue {
|
|||
getSubmissionQueueDataUrl => $self->getUrl('func=getAllSubmissions'),
|
||||
addSubmissionFormUrl => $self->getUrl('func=addSubmissionForm'),
|
||||
editSubmissionFormUrl => $self->getUrl('func=editSubmissionForm'),
|
||||
editSubmissionUrl => $self->getUrl('func=editSubmission'),
|
||||
addSubmissionUrl => $self->getUrl('func=addSubmission'),
|
||||
},$self->get('eventSubmissionMainTemplateId')));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ A WebGUI::Session object
|
|||
|
||||
sub www_autoAddToGroup {
|
||||
my $session = shift;
|
||||
return $self->session->privilege->noAccess() if ($session->user->isVisitor);
|
||||
return $session->privilege->noAccess() if ($session->user->isVisitor);
|
||||
my $group = WebGUI::Group->new($session,$session->form->process("groupId"));
|
||||
if ($group && $group->autoAdd) {
|
||||
$group->addUsers([$session->user->userId],[$session->form->process("groupId")]);
|
||||
|
|
@ -361,7 +361,7 @@ A WebGUI::Session object
|
|||
|
||||
sub www_autoDeleteFromGroup {
|
||||
my $session = shift;
|
||||
return $self->session->privilege->noAccess() if ($session->user->isVisitor);
|
||||
return $session->privilege->noAccess() if ($session->user->isVisitor);
|
||||
my $group = WebGUI::Group->new($session,$session->form->process("groupId"));
|
||||
if ($group && $group->autoDelete) {
|
||||
$group->deleteUsers([$session->user->userId],[$session->form->process("groupId")]);
|
||||
|
|
|
|||
|
|
@ -68,10 +68,13 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
|
||||
=cut
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
dav::log __PACKAGE__ . " executing\n";
|
||||
|
||||
# keep track of how much time it's taking
|
||||
my $start = time;
|
||||
|
|
@ -83,12 +86,14 @@ sub execute {
|
|||
} );
|
||||
|
||||
for my $emsf ( @$list ) {
|
||||
my whereClause = q{ ( submissionStatus='denied' }
|
||||
my $daysBeforeCleanup = $emsf->get('daysBeforeCleanup') ;
|
||||
next if ! $daysBeforeCleanup;
|
||||
my $whereClause = q{ submissionStatus='denied' };
|
||||
if( $emsf->get('deleteCreatedItems') ) {
|
||||
$whereClause .= q{ or submissionStatus='created'};
|
||||
$whereClause = ' ( ' . $whereClause . q{ or submissionStatus='created' } . ' ) ';
|
||||
}
|
||||
my $checkDate = time - ( 60*60*24* $emsf->get('daysBeforeCleanup') );
|
||||
$whereClause .= q{ ) and lastModifiedDate < } . $checkDate;
|
||||
my $checkDate = time - ( 60*60*24* $daysBeforeCleanup );
|
||||
$whereClause .= q{ and lastModifiedDate < } . $checkDate;
|
||||
my $res = $emsf->getLineage(['children'],{
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
|
||||
whereClause => $whereClause,
|
||||
|
|
|
|||
|
|
@ -68,11 +68,13 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
|
||||
=cut
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
|
||||
dav::log __PACKAGE__ . " executing\n";
|
||||
# keep track of how much time it's taking
|
||||
my $start = time;
|
||||
my $limit = 2_500;
|
||||
|
|
@ -83,7 +85,7 @@ sub execute {
|
|||
} );
|
||||
|
||||
for my $emsf ( @$list ) {
|
||||
my whereClause = q{ ( submissionStatus='approved' }
|
||||
my $whereClause = q{ submissionStatus='approved' };
|
||||
my $res = $emsf->getLineage(['children'],{
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmission'],
|
||||
whereClause => $whereClause,
|
||||
|
|
@ -94,11 +96,15 @@ sub execute {
|
|||
delete $properties{submissionStatus};
|
||||
delete $properties{sendEmailOnChange};
|
||||
delete $properties{ticketId};
|
||||
my $ticketId = $emsf->ems->addChild(
|
||||
my $newAsset = $emsf->ems->addChild(
|
||||
className => 'WebGUI::Asset::Sku::EMSTicket',
|
||||
%properties;
|
||||
%properties,
|
||||
);
|
||||
$submission->update({ ticketId => $ticketId });
|
||||
if( defined $newAsset ) {
|
||||
$submission->update({ ticketId => $newAsset->getId, submissionStatus => 'created' });
|
||||
} else {
|
||||
$submission->update({ submissionStatus => 'failed' });
|
||||
}
|
||||
$limit--;
|
||||
return $self->WAITING(1) if ! $limit or time > $start + $timeLimit;
|
||||
}
|
||||
|
|
@ -106,33 +112,6 @@ sub execute {
|
|||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
return $self->ERROR;
|
||||
|
||||
my $sth = $session->db->read("select assetId from asset where className='WebGUI::Asset::Wobject::HelpDesk'");
|
||||
while (my ($assetId) = $sth->array) {
|
||||
my $hd = WebGUI::Asset->new($session,$assetId,"WebGUI::Asset::Wobject::HelpDesk");
|
||||
next unless defined $hd;
|
||||
|
||||
my $closeAfter = $hd->get("closeTicketsAfter");
|
||||
|
||||
my $rules = {};
|
||||
$rules->{'joinClass' } = "WebGUI::Asset::Ticket";
|
||||
$rules->{'whereClause' } = qq{Ticket.ticketStatus = 'resolved' and (Ticket.resolvedDate + $closeAfter <= UNIX_TIMESTAMP(NOW()))};
|
||||
$rules->{'includeOnlyClasses'} = ['WebGUI::Asset::Ticket'];
|
||||
$rules->{'returnObjects' } = 1;
|
||||
|
||||
my $tickets = $hd->getLineage(['children'], $rules);
|
||||
foreach my $ticket (@{$tickets}) {
|
||||
$ticket->setStatus("closed");
|
||||
}
|
||||
}
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,6 @@ our $I18N = { ##hashref of hashes
|
|||
lastUpdated => 1131394072,
|
||||
context => q|Then name of the Asset ( Event Management System - Event Submission Form ).|
|
||||
},
|
||||
'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.|
|
||||
},
|
||||
'can submit group label' => {
|
||||
message => q|User Group Allowed to create Submissions|,
|
||||
lastUpdated => 1131394072,
|
||||
|
|
|
|||
|
|
@ -2034,6 +2034,16 @@ normal templates.|,
|
|||
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.|
|
||||
},
|
||||
# 'TODO' => {
|
||||
# message => q|TODO|,
|
||||
# lastUpdated => 1147050475,
|
||||
|
|
|
|||
|
|
@ -69,8 +69,10 @@ sub logout { $session->user({userId => 1}); }
|
|||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
eval {
|
||||
my $use = use_ok 'WebGUI::Asset::EMSSubmissionForm';
|
||||
$use &&= use_ok 'WebGUI::Asset::EMSSubmission';
|
||||
my $use = use_ok( 'WebGUI::Asset::EMSSubmissionForm' )
|
||||
&& use_ok( 'WebGUI::Asset::EMSSubmission' )
|
||||
&& use_ok( 'WebGUI::Workflow::Activity::CleanupEMSSubmissions' )
|
||||
&& use_ok( 'WebGUI::Workflow::Activity::ProcessEMSApprovals' );
|
||||
|
||||
SKIP: { skip 'package compile failed!', 1 unless $use;
|
||||
|
||||
|
|
@ -120,13 +122,14 @@ my $ems = $node->addChild({
|
|||
},1,1);
|
||||
|
||||
my $i18n = $ems->i18n;
|
||||
|
||||
$versionTag->commit;
|
||||
$versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
|
||||
my $id1 = $ems->getNextSubmissionId;
|
||||
my $id2 = $ems->getNextSubmissionId;
|
||||
my $id3 = $ems->getNextSubmissionId;
|
||||
my $id4 = $ems->getNextSubmissionId;
|
||||
is( $id1 +3, $id4, ' test getNextSubmissionId' );
|
||||
is( $id1 +1, $id2, ' test getNextSubmissionId' );
|
||||
|
||||
# quick test of addGroupToSubmitList
|
||||
is($ems->get('eventSubmissionGroups'),'', 'event submission groups is blank');
|
||||
|
|
@ -139,13 +142,12 @@ is($ems->get('eventSubmissionGroups'),'joe frank', 'event submission groups stil
|
|||
$ems->update({eventSubmissionGroups => ''});
|
||||
is($ems->get('eventSubmissionGroups'),'', 'event submission groups is reset to blank');
|
||||
|
||||
|
||||
is_deeply($ems->getSubmissionLocations, \@submissionLocations, 'test getSubmissionLocations' );
|
||||
is_deeply( $ems->getSubmissionStatus, {
|
||||
map { $_ => $i18n->get($_) } ( qw/pending feedback failed approved created denied/ )
|
||||
}, 'test getSubmissionStatus' );
|
||||
|
||||
$versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
|
||||
loginRgstr;
|
||||
|
||||
|
|
@ -190,7 +192,7 @@ my $formBdesc = {
|
|||
my $frmB = $ems->addSubmissionForm({
|
||||
className => 'WebGUI::Asset::EMSSubmissionForm',
|
||||
title => 'test B -- short',
|
||||
daysBeforeCleanup => 0,
|
||||
daysBeforeCleanup => 1,
|
||||
canSubmitGroupId => $submitGroupB->getId,
|
||||
formDescription => $formBdesc,
|
||||
});
|
||||
|
|
@ -248,10 +250,10 @@ cmp_deeply( from_json($ems->www_getAllSubmissions), {
|
|||
records => [
|
||||
{
|
||||
lastReplyDate => '',
|
||||
submissionId => '5',
|
||||
submissionId => '3',
|
||||
creationDate => ignore(),
|
||||
createdBy => 'userA',
|
||||
url => '/test-ems?func=viewSubmissionQueue#5',
|
||||
url => '/test-ems?func=viewSubmissionQueue#3',
|
||||
submissionStatus => $i18n->get('pending'),
|
||||
title => 'my favorite thing to talk about',
|
||||
lastReplyBy => ''
|
||||
|
|
@ -262,10 +264,10 @@ cmp_deeply( from_json($ems->www_getAllSubmissions), {
|
|||
dir => 'DESC',
|
||||
}, 'test getAllSubmissions for UserA' );
|
||||
|
||||
$session->request->setup_body({submissionId => 5});
|
||||
$session->request->setup_body({submissionId => 3});
|
||||
cmp_deeply( from_json($ems->www_getSubmissionById), {
|
||||
submissionId => 5,
|
||||
itemText => ignore(),
|
||||
title => 3,
|
||||
text => ignore(),
|
||||
}, 'test getSubmissionById');
|
||||
|
||||
loginUserC;
|
||||
|
|
@ -287,20 +289,20 @@ cmp_deeply( from_json($ems->www_getAllSubmissions), {
|
|||
records => [
|
||||
{
|
||||
lastReplyDate => '',
|
||||
submissionId => '6',
|
||||
submissionId => '4',
|
||||
creationDate => ignore(),
|
||||
createdBy => 'userB',
|
||||
url => '/test-ems?func=viewSubmissionQueue#6',
|
||||
url => '/test-ems?func=viewSubmissionQueue#4',
|
||||
submissionStatus => $i18n->get('pending'),
|
||||
title => 'why i like to be important',
|
||||
lastReplyBy => ''
|
||||
},
|
||||
{
|
||||
lastReplyDate => '',
|
||||
submissionId => '5',
|
||||
submissionId => '3',
|
||||
creationDate => ignore(),
|
||||
createdBy => 'userA',
|
||||
url => '/test-ems?func=viewSubmissionQueue#5',
|
||||
url => '/test-ems?func=viewSubmissionQueue#3',
|
||||
submissionStatus => $i18n->get('pending'),
|
||||
title => 'my favorite thing to talk about',
|
||||
lastReplyBy => ''
|
||||
|
|
@ -353,34 +355,46 @@ my $cleanupSubmissions = WebGUI::Test::Activity->create( $session,
|
|||
|
||||
push @cleanup, sub { $approveSubmissions->delete; $cleanupSubmissions->delete; };
|
||||
|
||||
is($approveSubmissions->run, 'complete', 'approval complete');
|
||||
#is($approveSubmissions->run, 'complete', 'approval complete');
|
||||
is($approveSubmissions->run, 'done', 'approval done');
|
||||
|
||||
$sub1 = $sub1->cloneFromDb;
|
||||
is( $sub1->get('status'),'failed','submission failed to create');
|
||||
|
||||
# TODO fill in the rest of the data required by EMSTicket
|
||||
|
||||
is($approveSubmissions->run, 'complete', 'approval complete');
|
||||
print "1\n";
|
||||
$approveSubmissions->rerun;
|
||||
print "2\n";
|
||||
#is($approveSubmissions->run, 'complete', 'approval complete');
|
||||
is($approveSubmissions->run, 'done', 'approval done');
|
||||
|
||||
print "3\n";
|
||||
$sub1 = $sub1->cloneFromDb;
|
||||
print "4\n";
|
||||
is( $sub1->get('status'),'created','approval successfull');
|
||||
print "5\n";
|
||||
|
||||
my $ticket = WebGUI::Asset->newByDynamicClass($session, $sub1->get('ticketId'));
|
||||
isa_ok( $ticket, 'WebGUI::Asset::Sku::EMS_Ticket', 'approval created a ticket');
|
||||
print "6\n";
|
||||
isa_ok( $ticket, 'WebGUI::Asset::Sku::EMSTicket', 'approval created a ticket');
|
||||
print "7\n";
|
||||
push @cleanup, sub { $ticket->delete; };
|
||||
print "8\n";
|
||||
|
||||
$sub2->update({
|
||||
lastModified => time - ( 60 * 60 * 72 ), # last modified 3 days ago
|
||||
});
|
||||
my $submissionId = $sub2->get('assetId');
|
||||
|
||||
is($cleanupSubmissions->run, 'complete', 'cleanup complete');
|
||||
$cleanupSubmissions->rerun;
|
||||
#is($cleanupSubmissions->run, 'complete', 'cleanup complete');
|
||||
is($cleanupSubmissions->run, 'done', 'cleanup done');
|
||||
|
||||
$sub2 = WebGUI::Asset->newByDynamicClass($session, $submissionId);
|
||||
is( $sub2, undef, 'approval created a ticket');
|
||||
is( $sub2, undef, 'ticket deleted');
|
||||
|
||||
# TODO add a test to cleanup denied and created entries
|
||||
# TODO add a test to cleanup created entries
|
||||
|
||||
} # end of workflow skip
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,11 @@ sub create {
|
|||
skipSpectreNotification => 1,
|
||||
}
|
||||
);
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
WebGUI::Test->tagsToRollback($tag);
|
||||
|
||||
return bless { instance => $instance,
|
||||
session => $session,
|
||||
workflow => $workflow }, __PACKAGE__;
|
||||
|
|
@ -84,6 +89,10 @@ sub rerun {
|
|||
skipSpectreNotification => 1,
|
||||
}
|
||||
);
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
WebGUI::Test->tagsToRollback($tag);
|
||||
|
||||
}
|
||||
|
||||
sub delete {
|
||||
|
|
|
|||
|
|
@ -36,13 +36,14 @@ WebGUI.EMS = function (configs) {
|
|||
this._configs = {};
|
||||
if(configs) {
|
||||
this._configs = configs;
|
||||
WebGUI.EMS.url = configs.url;
|
||||
WebGUI.EMS.tabContent = configs.tabContent;
|
||||
}
|
||||
this.url = this._configs.url;
|
||||
WebGUI.EMS.Items = new Object();
|
||||
|
||||
if(!this._configs.initRequestString) {
|
||||
this._configs.initRequestString = ';startIndex=0';
|
||||
}
|
||||
WebGUI.EMS.Items = new Object();
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Internationalization
|
||||
|
|
@ -94,7 +95,7 @@ WebGUI.EMS = function (configs) {
|
|||
if( WebGUI.EMS.lastTab ) {
|
||||
WebGUI.EMS.Tabs.set('activeTab',WebGUI.EMS.lastTab);
|
||||
}
|
||||
window.location.hash = '';
|
||||
window.location.hash = "";
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
|
|
@ -172,7 +173,7 @@ WebGUI.EMS = function (configs) {
|
|||
WebGUI.EMS.Items[response.title] = new Object();
|
||||
WebGUI.EMS.Items[response.title].Tab = myTab;
|
||||
} else {
|
||||
myTab = WebGUI.EMS.Tickets[response.title].Tab;
|
||||
myTab = WebGUI.EMS.Items[response.title].Tab;
|
||||
myTab.set('content', response.text);
|
||||
}
|
||||
// make sure the script on the ticket has run
|
||||
|
|
@ -242,12 +243,24 @@ WebGUI.EMS = function (configs) {
|
|||
//***********************************************************************************
|
||||
// This method does the actual work of loading an item into a tab
|
||||
//
|
||||
WebGUI.EMS.loadItem = function ( submissionId, pathname ) {
|
||||
if( typeof(pathname) == "undefined" ) {
|
||||
pathname = WebGUI.EMS.url ;
|
||||
}
|
||||
var url = pathname + "?func=getSubmissionById;submissionId=" + submissionId;
|
||||
WebGUI.EMS.newTab(submissionId, url );
|
||||
WebGUI.EMS.loadItem = function ( contentId ) {
|
||||
var submissionId = parseInt( contentId, 10 );
|
||||
var url;
|
||||
// compare contentId with submissionId incase we get an assetId that starts with numeric chars
|
||||
if( contentId == submissionId ) {
|
||||
url = WebGUI.EMS.tabContent['editSubmission'] + ";submissionId=" + submissionId;
|
||||
} else {
|
||||
url = WebGUI.EMS.tabContent[contentId];
|
||||
}
|
||||
WebGUI.EMS.newTab(url);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// Load an item when the user clicks on an anchor html element
|
||||
//
|
||||
WebGUI.EMS.loadItemFromAnchor = function ( anchorObject ) {
|
||||
var tabContent = anchorObject.hash.substring(1);
|
||||
WebGUI.EMS.loadItem(tabContent);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
|
|
@ -270,12 +283,13 @@ WebGUI.EMS = function (configs) {
|
|||
var elCell = this.getTdEl(target);
|
||||
if(elCell) {
|
||||
var oRecord = this.getRecord(elCell);
|
||||
var submissionId = oRecord.getData('submissionId');
|
||||
|
||||
if( typeof( WebGUI.EMS.Items[oRecord.submissionId] ) != "undefined" ) {
|
||||
WebGUI.EMS.Tabs.set('activeTab',WebGUI.EMS.Items[oRecord.submissionId].Tab);
|
||||
if( typeof( WebGUI.EMS.Items[submissionId] ) != "undefined" ) {
|
||||
WebGUI.EMS.Tabs.set('activeTab',WebGUI.EMS.Items[submissionId].Tab);
|
||||
WebGUI.EMS.loadingIndicator.hide();
|
||||
} else {
|
||||
WebGUI.EMS.loadItem( oRecord.submissionId );
|
||||
WebGUI.EMS.loadItem( submissionId );
|
||||
}
|
||||
} else {
|
||||
alert("Could not get table cell for " + target);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue