Merge remote branch 'kc/new/bug_3319' into kcmaster
[koha.git] / circ / returns.pl
index 51ac9de..c05277c 100755 (executable)
@@ -208,6 +208,7 @@ if ($barcode) {
 #
     ( $returned, $messages, $issueinformation, $borrower ) =
       AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode);     # do the return
+    my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn') or 'homebranch';
 
     # get biblio description
     my $biblio = GetBiblioFromItemNumber($itemnumber);
@@ -217,7 +218,7 @@ if ($barcode) {
     $template->param(
         title            => $biblio->{'title'},
         homebranch       => $biblio->{'homebranch'},
-        homebranchname   => GetBranchName( $biblio->{'homebranch'} ),
+        homebranchname   => GetBranchName( $biblio->{$homeorholdingbranchreturn} ),
         author           => $biblio->{'author'},
         itembarcode      => $biblio->{'barcode'},
         itemtype         => $biblio->{'itemtype'},
@@ -240,6 +241,13 @@ if ($barcode) {
         $input{duedate}        = $duedate;
         $input{return_overdue} = 1 if ($duedate and $duedate lt $today->output('iso'));
         push( @inputloop, \%input );
+
+        my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrower->{'borrowernumber'} );
+        if ($fines) {
+            $template->param( fines => sprintf("%.2f",$fines) );
+            $template->param( fineborrowernumber => $borrower->{'borrowernumber'} );
+        }
+
     }
     elsif ( !$messages->{'BadBarcode'} ) {
         $input{duedate}   = 0;