Smart Rules enhancements
[koha_fer] / opac / opac-user.pl
index 708ba7f..b61ad37 100755 (executable)
@@ -66,14 +66,21 @@ $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} );
 if ( $borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
     $borr->{'flagged'} = 1;
 }
-# $make flagged available everywhere in the template
-my $patron_flagged = $borr->{'flagged'};
+
 if ( $borr->{'amountoutstanding'} > 5 ) {
     $borr->{'amountoverfive'} = 1;
 }
 if ( 5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
     $borr->{'amountoverzero'} = 1;
 }
+
+if ( $borr->{'amountoutstanding'} > C4::Context->preference( 'OPACFineNoRenewals' ) ) {
+    $borr->{'flagged'} = 1;
+    $template->param(
+        renewal_blocked_fines => sprintf( "%.02f", C4::Context->preference( 'OPACFineNoRenewals' ) ),
+    );
+}
+
 if ( $borr->{'amountoutstanding'} < 0 ) {
     $borr->{'amountlessthanzero'} = 1;
     $borr->{'amountoutstanding'} = -1 * ( $borr->{'amountoutstanding'} );
@@ -86,7 +93,7 @@ $bordat[0] = $borr;
 
 $template->param(   BORROWER_INFO  => \@bordat,
                     borrowernumber => $borrowernumber,
-                    patron_flagged => $patron_flagged,
+                    patron_flagged => $borr->{flagged},
                 );
 
 #get issued items ....
@@ -171,7 +178,7 @@ for my $branch_hash (sort keys %$branches ) {
         selected => $selected
       };
 }
-$template->param( branchloop => \@branch_loop, "mylibraryfirst"=>C4::Context->preference("SearchMyLibraryFirst"));
+$template->param( branchloop => \@branch_loop );
 
 # now the reserved items....
 my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
@@ -259,7 +266,19 @@ if (C4::Context->preference("OPACAmazonCoverImages") or
         $template->param(JacketImages=>1);
 }
 
+if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
+       $template->param( bor_messages => 1 );
+}
+
+if ( $borr->{'opacnote'} ) {
+  $template->param( 
+    bor_messages => 1,
+    opacnote => $borr->{'opacnote'},
+  );
+}
+
 $template->param(
+    bor_messages_loop  => GetMessages( $borrowernumber, 'B', 'NONE' ),
     waiting_count      => $wcount,
     textmessaging      => $borr->{textmessaging},
     patronupdate => $patronupdate,