-
- foreach my $impossible ( keys %$error ) {
- $template->param(
- $impossible => $$error{$impossible},
- IMPOSSIBLE => 1
- );
- $noerror = 0;
- }
- foreach my $needsconfirmation ( keys %$question ) {
- $template->param(
- $needsconfirmation => $$question{$needsconfirmation},
- getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
- NEEDSCONFIRMATION => 1
- );
- $noquestion = 0;
- }
- $template->param(
- itemhomebranch => $getmessageiteminfo->{'homebranch'} ,
- day => $day,
- month => $month,
- year => $year
+ if ($noerror) {
+ # only pass needsconfirmation to template if issuing is possible
+ foreach my $needsconfirmation ( keys %$question ) {
+ $template->param(
+ $needsconfirmation => $$question{$needsconfirmation},
+ getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
+ NEEDSCONFIRMATION => 1
+ );
+ $noquestion = 0;
+ }
+ # Because of the weird conditional structure (empty elsif block),
+ # if we reached here, $issueconfirmed must be false.
+ # Also, since we moved inside the if ($noerror) conditional,
+ # this old chunky conditional can be simplified:
+ # if ( $noerror && ( $noquestion || $issueconfirmed ) ) {
+ if ($noquestion) {
+ AddIssue( $borrower, $barcode, $datedue );
+ $inprocess = 1;
+ }
+ }
+ $template->param(
+ itemhomebranch => $getmessageiteminfo->{'homebranch'} ,
+ duedatespec => $duedatespec,