Bug 15635: Koha::Patron::Images - Remove GetPatronImage
[srvgit] / members / member-flags.pl
index ca8c9d0..5bd2d07 100755 (executable)
@@ -7,7 +7,7 @@
 use strict;
 use warnings;
 
-use CGI;
+use CGI qw ( -utf8 );
 use C4::Output;
 use C4::Auth qw(:DEFAULT :EditPermissions);
 use C4::Context;
@@ -17,6 +17,7 @@ use C4::Members::Attributes qw(GetBorrowerAttributes);
 #use C4::Acquisitions;
 
 use C4::Output;
+use Koha::Patron::Images;
 
 my $input = new CGI;
 
@@ -26,14 +27,14 @@ my $bor = GetMemberDetails( $member,'');
 if( $bor->{'category_type'} eq 'S' )  {
        $flagsrequired->{'staffaccess'} = 1;
 }
-my ($template, $loggedinuser, $cookie)
-       = get_template_and_user({template_name => "members/member-flags.tmpl",
-                               query => $input,
-                               type => "intranet",
-                               authnotrequired => 0,
-                               flagsrequired => $flagsrequired,
-                               debug => 1,
-                               });
+my ($template, $loggedinuser, $cookie) = get_template_and_user({
+        template_name   => "members/member-flags.tt",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => $flagsrequired,
+        debug           => 1,
+});
 
 
 my %member2;
@@ -89,10 +90,10 @@ if ($input->param('newflags')) {
     my $dbh=C4::Context->dbh();
     my $all_perms  = get_all_subpermissions();
     my $user_perms = get_user_subpermissions($bor->{'userid'});
-    my $sth=$dbh->prepare("SELECT bit,flag,flagdesc FROM userflags ORDER BY bit");
+    my $sth=$dbh->prepare("SELECT bit, flag FROM userflags ORDER BY bit");
     $sth->execute;
     my @loop;
-    while (my ($bit, $flag, $flagdesc) = $sth->fetchrow) {
+    while (my ($bit, $flag) = $sth->fetchrow) {
            my $checked='';
            if ($accessflags->{$flag}) {
                $checked= 1;
@@ -101,7 +102,7 @@ if ($input->param('newflags')) {
            my %row = ( bit => $bit,
                    flag => $flag,
                    checked => $checked,
-                   flagdesc => $flagdesc );
+        );
 
         my @sub_perm_loop = ();
         my $expand_parent = 0;
@@ -113,7 +114,6 @@ if ($input->param('newflags')) {
                         id => "${flag}_$sub_perm",
                         perm => "$flag:$sub_perm",
                         code => $sub_perm,
-                        description => $all_perms->{$flag}->{$sub_perm},
                         checked => 1
                     };
                 }
@@ -127,7 +127,6 @@ if ($input->param('newflags')) {
                         id => "${flag}_$sub_perm",
                         perm => "$flag:$sub_perm",
                         code => $sub_perm,
-                        description => $all_perms->{$flag}->{$sub_perm},
                         checked => 1
                     };
                 }
@@ -139,7 +138,6 @@ if ($input->param('newflags')) {
                         id => "${flag}_$sub_perm",
                         perm => "$flag:$sub_perm",
                         code => $sub_perm,
-                        description => $all_perms->{$flag}->{$sub_perm},
                         checked => 0
                     } unless exists $user_perms->{$flag} and exists $user_perms->{$flag}->{$sub_perm};
                 }
@@ -160,8 +158,8 @@ if ($input->param('newflags')) {
     }
        
 $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
-    my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'});
-    $template->param( picture => 1 ) if $picture;
+    my $patron_image = Koha::Patron::Images->find($bor->{borrowernumber});
+    $template->param( picture => 1 ) if $patron_image;
 
 if (C4::Context->preference('ExtendedPatronAttributes')) {
     my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'});
@@ -176,22 +174,28 @@ $template->param(
     cardnumber => $bor->{'cardnumber'},
                surname => $bor->{'surname'},
                firstname => $bor->{'firstname'},
+        othernames => $bor->{'othernames'},
                categorycode => $bor->{'categorycode'},
                category_type => $bor->{'category_type'},
                categoryname => $bor->{'description'},
-               address => $bor->{'address'},
+        address => $bor->{address},
                address2 => $bor->{'address2'},
+        streettype => $bor->{streettype},
                city => $bor->{'city'},
         state => $bor->{'state'},
                zipcode => $bor->{'zipcode'},
                country => $bor->{'country'},
                phone => $bor->{'phone'},
+        phonepro => $bor->{'phonepro'},
+        mobile => $bor->{'mobile'},
                email => $bor->{'email'},
+        emailpro => $bor->{'emailpro'},
                branchcode => $bor->{'branchcode'},
                branchname => GetBranchName($bor->{'branchcode'}),
                loop => \@loop,
                is_child        => ($bor->{'category_type'} eq 'C'),
                activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
+        RoutingSerials => C4::Context->preference('RoutingSerials'),
                );
 
     output_html_with_http_headers $input, $cookie, $template->output;