X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=admin%2Fcategories.pl;h=358ef7d8c851782e350662bd26cc9d1173161446;hb=df97814f3034a3d5015546c4eca21f08ae951e37;hp=e439a62c31128eeada8e1a1f48c6b4f296e7167e;hpb=3691bd8419ee9a481b95af525bc7e0c08f4c4640;p=koha.git diff --git a/admin/categories.pl b/admin/categories.pl index e439a62c31..358ef7d8c8 100755 --- a/admin/categories.pl +++ b/admin/categories.pl @@ -23,13 +23,13 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Context; use C4::Auth; -use C4::Branch; use C4::Output; use C4::Form::MessagingPreferences; use Koha::Patrons; use Koha::Database; use Koha::DateUtils; use Koha::Patron::Categories; +use Koha::Libraries; my $input = new CGI; my $searchfield = $input->param('description') // q||; @@ -55,13 +55,13 @@ if ( $op eq 'add_form' ) { $selected_branches = $category->branch_limitations; } - my $branches = GetBranches; + my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; my @branches_loop; - foreach my $branchcode ( sort { uc( $branches->{$a}->{branchname} ) cmp uc( $branches->{$b}->{branchname} ) } keys %$branches ) { - my $selected = ( grep { $_ eq $branchcode } @$selected_branches ) ? 1 : 0; + foreach my $branch ( @$branches ) { + my $selected = ( grep { $_ eq $branch->{branchcode} } @$selected_branches ) ? 1 : 0; push @branches_loop, - { branchcode => $branchcode, - branchname => $branches->{$branchcode}->{branchname}, + { branchcode => $branch->{branchcode}, + branchname => $branch->{branchname}, selected => $selected, }; } @@ -90,13 +90,20 @@ elsif ( $op eq 'add_validate' ) { my $overduenoticerequired = $input->param('overduenoticerequired'); my $category_type = $input->param('category_type'); my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); + my $checkPrevCheckout = $input->param('checkprevcheckout'); my $default_privacy = $input->param('default_privacy'); - my @branches = grep { $_ ne q{} } $input->param('branches'); + my @branches = grep { $_ ne q{} } $input->multi_param('branches'); my $is_a_modif = $input->param("is_a_modif"); - if ( $enrolmentperioddate ) { - $enrolmentperioddate = output_pref({ dt => dt_from_string($enrolmentperioddate), dateformat => 'iso' }); + if ($enrolmentperioddate) { + $enrolmentperioddate = output_pref( + { + dt => dt_from_string($enrolmentperioddate), + dateformat => 'iso', + dateonly => 1, + } + ); } if ($is_a_modif) { @@ -113,6 +120,7 @@ elsif ( $op eq 'add_validate' ) { $category->overduenoticerequired($overduenoticerequired); $category->category_type($category_type); $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions); + $category->checkprevcheckout($checkPrevCheckout); $category->default_privacy($default_privacy); eval { $category->store; @@ -138,6 +146,7 @@ elsif ( $op eq 'add_validate' ) { overduenoticerequired => $overduenoticerequired, category_type => $category_type, BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, + checkprevcheckout => $checkPrevCheckout, default_privacy => $default_privacy, }); eval { @@ -154,7 +163,7 @@ elsif ( $op eq 'add_validate' ) { if ( C4::Context->preference('EnhancedMessagingPreferences') ) { C4::Form::MessagingPreferences::handle_form_action( $input, - { categorycode => $input->param('categorycode') }, $template ); + { categorycode => scalar $input->param('categorycode') }, $template ); } $searchfield = q||;