bug 341: Use the Right Branch
authorJohn Beppu <john.beppu@liblime.com>
Tue, 3 Feb 2009 22:02:14 +0000 (16:02 -0600)
committerGalen Charlton <galen.charlton@liblime.com>
Wed, 4 Feb 2009 20:00:46 +0000 (14:00 -0600)
When sending circulation alerts, use the branch that the
event happened on instead of $item->{homebranch}.

Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/Circulation.pm

index d22e28c..e4019a4 100644 (file)
@@ -1032,6 +1032,7 @@ sub AddIssue {
                 type     => 'CHECKOUT',
                 item     => $item,
                 borrower => $borrower,
+                branch   => $branch,
             });
         }
     }
@@ -1531,6 +1532,7 @@ sub AddReturn {
                 type     => 'CHECKIN',
                 item     => $iteminformation,
                 borrower => $borrower,
+                branch   => $branch,
             });
         }
         
@@ -2380,6 +2382,10 @@ Hashref of information about the item being checked in or out.
 
 Hashref of information about the borrower of the item.
 
+=item branch
+
+The branchcode from where the checkout or check-in took place.
+
 =back
 
 B<Example>:
@@ -2388,13 +2394,15 @@ B<Example>:
         type     => 'CHECKOUT',
         item     => $item,
         borrower => $borrower,
+        branch   => $branch,
     });
 
 =cut
 
 sub SendCirculationAlert {
     my ($opts) = @_;
-    my ($type, $item, $borrower) = ($opts->{type}, $opts->{item}, $opts->{borrower});
+    my ($type, $item, $borrower, $branch) =
+        ($opts->{type}, $opts->{item}, $opts->{borrower}, $opts->{branch});
     my %message_name = (
         CHECKIN  => 'Item Check-in',
         CHECKOUT => 'Item Checkout',
@@ -2407,7 +2415,7 @@ sub SendCirculationAlert {
     C4::Letters::parseletter($letter, 'biblio',      $item->{biblionumber});
     C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber});
     C4::Letters::parseletter($letter, 'borrowers',   $borrower->{borrowernumber});
-    C4::Letters::parseletter($letter, 'branches',    $item->{homebranch});
+    C4::Letters::parseletter($letter, 'branches',    $branch);
     my @transports = @{ $borrower_preferences->{transports} };
     # warn "no transports" unless @transports;
     for (@transports) {