Bug 32814: Fix cataloguing/value_builder/callnumber-KU.pl
[koha-ffzg.git] / members / memberentry.pl
index ca43a1e..0193cc3 100755 (executable)
@@ -35,7 +35,7 @@ use C4::Form::MessagingPreferences;
 use Koha::AuthUtils;
 use Koha::AuthorisedValues;
 use Koha::Email;
-use Koha::Patron::Debarments qw( AddDebarment DelDebarment GetDebarments );
+use Koha::Patron::Debarments qw( AddDebarment DelDebarment );
 use Koha::Patron::Restriction::Types;
 use Koha::Cities;
 use Koha::DateUtils qw( dt_from_string );
@@ -118,8 +118,7 @@ foreach my $id ( @delete_guarantor ) {
 
 ## Deal with debarments
 $template->param(
-    debarments => scalar GetDebarments( { borrowernumber => $borrowernumber } ),
-    restriction_types => scalar Koha::Patron::Restriction::Types->keyed_on_code()
+    restriction_types => scalar Koha::Patron::Restriction::Types->search()
 );
 my @debarments_to_remove = $input->multi_param('remove_debarment');
 foreach my $d ( @debarments_to_remove ) {
@@ -659,7 +658,8 @@ my $patron_categories = Koha::Patron::Categories->search_with_library_limits(
 my $no_categories = ! $patron_categories->count;
 my $categories = {};
 my @patron_categories = $patron_categories->as_list;
-unless ( $patron_categories->find( $category->id ) ){
+# When adding a guarantor we don't have a category yet, and only want to choose from the eligible categories
+unless ( !$category || $patron_categories->find( $category->id ) ){
     $template->param( limited_category => 1 );
     push @patron_categories, $category;
 }