X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=reports%2Fguided_reports.pl;h=4b45f953252a5f5f6bf54d484d6bfd0df0c734cc;hb=51e3e31627c38f88671f8ab399b470ec4a02aaec;hp=6a03e11dc10b38f84bc8715e7d8a08716d1758d2;hpb=639ccd469f4e00e1737e0dec6ee914d845907938;p=koha.git diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 6a03e11dc1..4b45f95325 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -28,11 +28,13 @@ use C4::Reports::Guided; use C4::Auth qw/:DEFAULT get_session/; use C4::Output; use C4::Debug; -use C4::Branch; # XXX subfield_is_koha_internal_p -use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/; +use C4::Koha qw/GetFrameworksLoop/; +use C4::Branch; use C4::Context; use C4::Log; use Koha::DateUtils qw/dt_from_string output_pref/; +use Koha::AuthorisedValue; +use Koha::AuthorisedValues; =head1 NAME @@ -47,7 +49,7 @@ Script to control the guided report creation my $input = new CGI; my $usecache = C4::Context->ismemcached; -my $phase = $input->param('phase'); +my $phase = $input->param('phase') // ''; my $flagsrequired; if ( $phase eq 'Build new' or $phase eq 'Delete Saved' ) { $flagsrequired = 'create_reports'; @@ -705,7 +707,7 @@ elsif ($phase eq 'Run this report'){ #---- "true" authorised value } else { - if ( IsAuthorisedValueCategory($authorised_value) ) { + if ( Koha::AuthorisedValues->search({ category => $authorised_value })->count ) { my $query = ' SELECT authorised_value,lib FROM authorised_values @@ -998,12 +1000,21 @@ sub create_non_existing_group_and_subgroup { my $report_groups = C4::Reports::Guided::get_report_groups; if (not exists $report_groups->{$group}) { my $groupdesc = $input->param('groupdesc') // $group; - C4::Koha::AddAuthorisedValue('REPORT_GROUP', $group, $groupdesc); + Koha::AuthorisedValue->new({ + category => 'REPORT_GROUP', + authorised_value => $group, + lib => $groupdesc, + })->store; } if (defined $subgroup and $subgroup ne '') { if (not exists $report_groups->{$group}->{subgroups}->{$subgroup}) { my $subgroupdesc = $input->param('subgroupdesc') // $subgroup; - C4::Koha::AddAuthorisedValue('REPORT_SUBGROUP', $subgroup, $subgroupdesc, $group); + Koha::AuthorisedValue->new({ + category => 'REPORT_SUBGROUP', + authorised_value => $subgroup, + lib => $subgroupdesc, + lib_opac => $group, + })->store; } } }