Bug 6261 [Revised] Consolidate patron toolbar include files
[koha.git] / members / moremember.pl
index c2f0d53..3928286 100755 (executable)
@@ -85,7 +85,9 @@ my $quickslip = 0;
 my $flagsrequired;
 if ($print eq "page") {
     $template_name = "members/moremember-print.tmpl";
-    $flagsrequired = { borrowers => 1 };
+    # circ staff who process checkouts but can't edit
+    # patrons still need to be able to access print view
+    $flagsrequired = { circulate => "circulate_remaining_permissions" };
 } elsif ($print eq "slip") {
     $template_name = "members/moremember-receipt.tmpl";
     # circ staff who process checkouts but can't edit
@@ -251,7 +253,7 @@ if ( @borrowernumbers ) {
 }
 my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
 my $today       = DateTime->now( time_zone => C4::Context->tz);
-$today->truncate(to => 'days');
+$today->truncate(to => 'day');
 my @borrowers_with_issues;
 my $overdues_exist = 0;
 my $totalprice = 0;
@@ -320,6 +322,8 @@ if ($borrowernumber) {
             $getreserv{biblionumber}  = $num_res->{'biblionumber'};    
         }
         $getreserv{waitingposition} = $num_res->{'priority'};
+        $getreserv{suspend} = $num_res->{'suspend'};
+        $getreserv{suspend_until} = $num_res->{'suspend_until'};
 
         push( @reservloop, \%getreserv );
     }
@@ -362,11 +366,29 @@ my $branch=C4::Context->userenv->{'branch'};
 $template->param(%$data);
 
 if (C4::Context->preference('ExtendedPatronAttributes')) {
-    my $attributes = GetBorrowerAttributes($borrowernumber);
+    my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber);
+    my @classes = uniq( map {$_->{class}} @$attributes );
+    @classes = sort @classes;
+
+    my @attributes_loop;
+    for my $class (@classes) {
+        my @items;
+        for my $attr (@$attributes) {
+            push @items, $attr if $attr->{class} eq $class
+        }
+        my $lib = GetAuthorisedValueByCode( 'PA_CLASS', $class ) || $class;
+        push @attributes_loop, {
+            class => $class,
+            items => \@items,
+            lib   => $lib,
+        };
+    }
+
     $template->param(
         ExtendedPatronAttributes => 1,
-        extendedattributes => $attributes
+        attributes_loop => \@attributes_loop
     );
+
     my @types = C4::Members::AttributeTypes::GetAttributeTypes();
     if (scalar(@types) == 0) {
         $template->param(no_patron_attribute_types => 1);
@@ -378,6 +400,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) {
     $template->param(messaging_form_inactive => 1);
     $template->param(SMSSendDriver => C4::Context->preference("SMSSendDriver"));
     $template->param(SMSnumber     => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'});
+    $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
 }
 
 # in template <TMPL_IF name="I"> => instutitional (A for Adult, C for children) 
@@ -401,7 +424,6 @@ $template->param(
     relissueloop    => @relissuedata,
     overdues_exist  => $overdues_exist,
     error           => $error,
-    $error          => 1,
     StaffMember     => ($category_type eq 'S'),
     is_child        => ($category_type eq 'C'),
 #   reserveloop     => \@reservedata,
@@ -409,8 +431,11 @@ $template->param(
     "dateformat_" . (C4::Context->preference("dateformat") || '') => 1,
     samebranch     => $samebranch,
     quickslip            => $quickslip,
-       activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
+    activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
+    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
+    SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
 );
+$template->param( $error => 1 ) if $error;
 
 output_html_with_http_headers $input, $cookie, $template->output;
 
@@ -434,6 +459,7 @@ sub build_issue_data {
         $issue->{date_due}  = output_pref( $issue->{date_due} );
         $issue->{issuedate} = output_pref( $issue->{issuedate} ) if defined $issue->{issuedate};
         my $biblionumber = $issue->{biblionumber};
+        $issue->{issuingbranchname} = GetBranchName($issue->{branchcode});
         my %row          = %{$issue};
         $totalprice += $issue->{replacementprice};
 
@@ -471,7 +497,7 @@ sub build_issue_data {
             $row{red} = 1;
         }
         if ($issuedate) {
-            $issuedate->truncate( to => 'days' );
+            $issuedate->truncate( to => 'day' );
             if ( DateTime->compare( $issuedate, $today ) == 0 ) {
                 $row{today} = 1;
             }