various fixes to EMS Submissin system

This commit is contained in:
daviddelikat 2009-11-22 20:32:17 -06:00
parent 31fb0886bc
commit e0b87268c5
8 changed files with 28 additions and 33 deletions

View file

@ -35,6 +35,22 @@ my $session = start(); # this line required
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
sub deleteFieldFromEMSSubmission {
my $session = shift;
print "\tDrop collumn from EMS Submission Table... " unless $quiet;
my $db = $session->db;
$db->write(<<ENDSQL);
ALTER TABLE EMSSubmission
DROP COLUMN sendEmailOnChange;
ENDSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {

View file

@ -60,6 +60,7 @@ send email when a comment is added
sub addComment {
my $self = shift;
$self->update(lastReplyBy => $self->session->user->userId);
$self->next::method(@_);
$self->sendEmailUpdate;
}
@ -207,13 +208,6 @@ sub definition {
fieldType => "hidden",
defaultValue => '{}',
},
sendEmailOnChange => {
tab => "properties",
fieldType => "yesNo",
defaultValue => 1,
label => $i18n->get("send email label"),
hoverHelp => $i18n->get("send email label help")
},
ticketId => {
noFormPost => 1,
fieldType => "hidden",
@ -355,15 +349,13 @@ sub sendEmailUpdate {
my $self = shift;
my $session = $self->session;
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmission" );
if( $self->get('sendEmailOnChange') ) {
WebGUI::Inbox->new($session)->addMessage( {
status => 'unread',
WebGUI::Inbox->new($session)->addMessage( {
status => 'unread',
message => $i18n->get('your submission has been updated') . "\n\n" .
$self->get('title'),
$self->get('title'),
userId => $self->get('createdBy'),
sentBy => $session->user->userId,
});
}
});
}
#-------------------------------------------------------------------
@ -410,7 +402,7 @@ sub www_editSubmission {
$newform->hidden(name => 'assetId', value => $assetId);
my $formDescription = $parent->getFormDescription;
my @defs = reverse @{__PACKAGE__->definition($session)};
my @fieldNames = qw/title submissionStatus sendEmailOnChange startDate duration seatsAvailable location description/;
my @fieldNames = qw/title submissionStatus startDate duration seatsAvailable location description/;
my $fields;
for my $def ( @defs ) {
my $properties = $def->{properties};
@ -462,7 +454,7 @@ sub www_editSubmission {
}
}
$newform->submit;
my $title = $assetId eq 'new' ? $i18n->get('new submission') : $asset->get('title');
my $title = $asset->get('title');
my $content =
$asset->processTemplate({
errors => $params->{errors} || [],

View file

@ -277,7 +277,7 @@ sub www_editSubmissionForm {
my $formDescription = $params->{formDescription} || $self ? $self->getFormDescription : { };
for my $fieldId ( @fieldNames ) {
next if $fieldId =~ /^(submissionStatus|sendEmailOnChange)$/;
next if $fieldId eq 'submissionStatus';
my $field = $fields->{$fieldId};
$newform->yesNo(
label => $field->{label},
@ -474,7 +474,6 @@ sub processForm {
my @fieldNames = split( ' ', $form->get('fieldNames') );
$params->{formDescription} = { map { $_ => $form->get($_ . '_yesNo') } ( @fieldNames ) };
$params->{formDescription}{submissionStatus} = 0;
$params->{formDescription}{sendEmailOnChange} = 1;
$params->{formDescription}{_fieldList} = [ map { $params->{formDescription}{$_} ? $_ : () } ( @fieldNames ) ];
if( scalar( @{$params->{formDescription}{_fieldList}} ) == 0 ) {
$params->{_isValid} = 0;

View file

@ -499,7 +499,7 @@ sub getSubmissionLocations {
my $self = shift;
my $text = $self->get('submittedLocationsList');
return undef if $text eq '';
return [ split( /[\s\n]+/, $text ) ];
return [ split( /[\n]+/, $text ) ];
}
#-------------------------------------------------------------------
@ -2737,8 +2737,8 @@ sub www_viewSubmissionQueue {
for my $tabSource ( @{$self->getSubmissionForms} ) {
push @{$params->{tabs}}, $tabSource->www_editSubmissionForm( { asHashRef => 1 } );
}
if( scalar( @{$params->{tabs}} ) == 1 ) { # there were no existing forms
push @{$params->{tabs}}, $self->www_addSubmissionForm( { asHashRef => 1 } );
push @{$params->{tabs}}, $self->www_addSubmissionForm( { asHashRef => 1 } );
if( scalar( @{$params->{tabs}} ) == 2 ) { # there were no existing forms
$params->{tabs}[1]{selected} = 1; # the new submission form tab
} else {
$params->{tabs}[0]{selected} = 1; # the submission queue tab
@ -2749,7 +2749,7 @@ sub www_viewSubmissionQueue {
next unless $tabSource->canSubmit;
push @{$params->{tabs}}, $tabSource->www_addSubmission( { asHashRef => 1 } );
}
$params->{tabs}[$#{$params->{tabs}}]{selected} = 1;
$params->{tabs}[0]{selected} = 1;
}
my $tabid = 'tab01';
for my $tab ( @{$params->{tabs}} ) { $tab->{id} = $tabid ++; }

View file

@ -9,16 +9,6 @@ our $I18N = { ##hashref of hashes
lastUpdated => 1131394072,
context => q|Then name of the Asset ( Event Management System - Event Submission ).|
},
'send email label' => {
message => q|Send Email when Submission Editted|,
lastUpdated => 1131394072,
context => q|This is the lable for the flag for setting the option to send email to the owner when the submission is edited.|
},
'send email label help' => {
message => q|Check this box if you would like to recieve email for all changes made to your submission|,
lastUpdated => 1131394072,
context => q|This is the help text for the 'send email' flag. If set to 'Yes', the user will recieve email for every change made to the submission.|
},
'comments' => {
message => q|Comments|,

View file

@ -419,7 +419,6 @@ my $expected = {
'startDate' => '1',
'description' => '1',
'submissionStatus' => '0',
sendEmailOnChange => 1,
'_fieldList' => [
'title',
'description',
@ -465,7 +464,6 @@ $expected = {
'formDescription' => {
'_fieldList' => [],
'submissionStatus' => 0,
sendEmailOnChange => 1,
},
'description' => undef,
'_isValid' => 0,