From 038555bbd666d905c7856b2c971f6046912475e7 Mon Sep 17 00:00:00 2001
From: simith <simith@inlibro.com>
Date: Thu, 13 Nov 2014 13:25:38 -0500
Subject: [PATCH] Bug 12505 - Variable aqorders.listprice from 'Tools' -
 'Notices and Slips'

---
 C4/Letters.pm                                               | 6 ++++++
 acqui/lateorders.pl                                         | 2 ++
 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/C4/Letters.pm b/C4/Letters.pm
index 7f2087c..d11bba4 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -322,6 +322,12 @@ sub SendAlerts {
             LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
             WHERE serial.serialid IN (
             };
+
+        if (!@$externalid){
+            carp "No Order seleted";
+            return { error => "no_order_seleted" };
+        }
+
         $strsth .= join( ",", @$externalid ) . ")";
         my $sthorders = $dbh->prepare($strsth);
         $sthorders->execute;
diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl
index d43dbbe..b68673f 100755
--- a/acqui/lateorders.pl
+++ b/acqui/lateorders.pl
@@ -116,6 +116,8 @@ if ($op and $op eq "send_alert"){
         $template->param(error_claim => $@);
     } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) {
         $template->{VARS}->{'error_claim'} = "no_email";
+    } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_order_seleted"){
+        $template->{VARS}->{'error_claim'} = "no_order_seleted";
     } else {
         $template->{VARS}->{'info_claim'} = 1;
     }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
index efa0db6..7fc7f1a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
@@ -83,6 +83,8 @@ $(document).ready(function() {
 [% IF error_claim %]
     [% IF ( error_claim == "no_email" ) %]
         <div class="error">This vendor has no email</div>
+	[% ELSIF ( error_claim == "no_order_seleted" ) %]
+        <div class="error">No order selected</div>
     [% ELSE %]
         <div class="error">[% error_claim %]</div>
     [% END %]
-- 
1.9.1