Bug 32257: Fix capitalization - Patron Attribute
[koha-ffzg.git] / members / update-child.pl
index 42cfe27..765687f 100755 (executable)
 use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Context;
-use C4::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers output_and_exit_if_error output_and_exit );
 use Koha::Patrons;
 use Koha::Patron::Categories;
 use Koha::Patrons;
 
-# use Smart::Comments;
-
 my $dbh   = C4::Context->dbh;
-my $input = new CGI;
+my $input = CGI->new;
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
         template_name   => "members/update-child.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { borrowers => 'edit_borrowers' },
-        debug           => 1,
     }
 );
 
@@ -58,7 +54,7 @@ my $op             = $input->param('op');
 
 my $logged_in_user = Koha::Patrons->find( $loggedinuser );
 
-my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits({ category_type => 'A' }, {order_by => ['categorycode']});
 if ( $op eq 'multi' ) {
     # FIXME - what are the possible upgrade paths?  C -> A , C -> S ...
     #   currently just allowing C -> A
@@ -84,7 +80,7 @@ elsif ( $op eq 'update' ) {
     # But we should not hit that with a normal use of the interface
     die "You are doing something wrong updating this child" unless $adult_category;
 
-    $_->delete() for $patron->guarantor_relationships();
+    $_->delete() for $patron->guarantor_relationships->as_list;
 
     $patron->categorycode($adult_category->categorycode);
     $patron->store;