Commit decda6cf authored by Keith Jolley's avatar Keith Jolley
Browse files

Batch add isolates: Set sender to current user if submitter.

parent c5938f62
......@@ -192,6 +192,12 @@ HTML
sub _print_interface_sender_field {
my ($self) = @_;
my $q = $self->{'cgi'};
my $user_info = $self->{'datastore'}->get_user_info_from_username( $self->{'username'} );
if ( $user_info->{'status'} eq 'submitter' ) {
say $q->hidden(sender => $user_info->{'id'});
return;
}
my $qry = "select id,user_name,first_name,surname from users WHERE id>0 order by surname";
my $sql = $self->{'db'}->prepare($qry);
eval { $sql->execute };
......@@ -206,7 +212,7 @@ sub _print_interface_sender_field {
}
say "<div style=\"margin-bottom:1em\"><p>Please select the sender from the list below:</p>";
$usernames{-1} = 'Override with sender field';
say $self->{'cgi'}->popup_menu( -name => 'sender', -values => [ '', -1, @users ], -labels => \%usernames );
say $q->popup_menu( -name => 'sender', -values => [ '', -1, @users ], -labels => \%usernames );
say "<span class=\"comment\"> Value will be overridden if you include a sender field in your pasted data.</span>";
say "</div>";
return;
......
......@@ -151,6 +151,8 @@ sub _check {
my $q = $self->{'cgi'};
my $data = $q->param('data');
my @rows = split /\n/, $data;
#TODO Prevent submitter from changing sender to anyone outside the usergroup.
if ( @rows < 2 ) {
say qq(<div class="box" id="statusbad"><p>Nothing entered. Make sure you include a header line.</p>);
say qq(<p><a href="$self->{'system'}->{'script_name'}?db=$self->{'instance'}&amp;page=batchIsolateUpdate">Back</a></p></div>);
......@@ -405,7 +407,7 @@ sub _update {
my $match = $self->_get_match_criteria;
my $view = $self->{'system'}->{'view'};
foreach my $record ( @records ) {
foreach my $record (@records) {
my ( $id1, $id2, $field, $value ) = @$record;
my ( $isolate_id, $old_value );
$nochange = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment