+if ($op and $op eq "send_alert"){
+ my @ordernums = $input->param("claim_for");# FIXME: Fallback values?
+ my $err;
+ eval {
+ $err = SendAlerts( 'claimacquisition', \@ordernums, $input->param("letter_code") ); # FIXME: Fallback value?
+ if ( not ref $err or not exists $err->{error} ) {
+ AddClaim ( $_ ) for @ordernums;
+ }
+ };
+ if ( $@ ) {
+ $template->param(error_claim => $@);
+ } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) {
+ $template->{VARS}->{'error_claim'} = "no_email";
+ } else {
+ $template->{VARS}->{'info_claim'} = 1;
+ }
+}
+
+my @parameters = ( $delay, $branch );
+push @parameters, $estimateddeliverydatefrom_dt
+ ? $estimateddeliverydatefrom_dt->ymd()
+ : undef;
+
+push @parameters, $estimateddeliverydateto_dt
+ ? $estimateddeliverydateto_dt->ymd()
+ : undef;
+
+my %supplierlist = GetBooksellersWithLateOrders(@parameters);
+
+my (@sloopy); # supplier loop
+foreach (keys %supplierlist){
+ push @sloopy, (($booksellerid and $booksellerid eq $_ ) ?
+ {id=>$_, name=>$supplierlist{$_}, selected=>1} :
+ {id=>$_, name=>$supplierlist{$_}} ) ;
+}
+$template->param(SUPPLIER_LOOP => \@sloopy);
+
+$template->param(Supplier=>$supplierlist{$booksellerid}) if ($booksellerid);
+$template->param(booksellerid=>$booksellerid) if ($booksellerid);
+
+@parameters =
+ ( $delay, $booksellerid, $branch );
+if ($estimateddeliverydatefrom_dt) {
+ push @parameters, $estimateddeliverydatefrom_dt->ymd();
+}
+else {
+ push @parameters, undef;
+}
+if ($estimateddeliverydateto_dt) {
+ push @parameters, $estimateddeliverydateto_dt->ymd();
+}
+my @lateorders = GetLateOrders( @parameters );