Koha/svc/split_callnumbers
Marcel de Rooy 909755e5f6 Bug 26251: Remove unused routines from svc/split_callnumbers
This is just a copy and paste from svc/localization

Test plan:
Read the code.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-20 10:23:56 +02:00

25 lines
831 B
Perl
Executable file

#!/usr/bin/perl
use Modern::Perl;
use JSON qw( from_json );
use C4::Service;
use C4::ClassSplitRoutine::RegEx;
our ( $query, $response ) = C4::Service->init( parameters => 'parameters_remaining_permissions' );
sub get_split_callnumbers {
my $regexs = from_json( $query->param('regexs') );
my $c = $query->param('callnumbers');
my @callnumbers = split "\n", $c;
my @callnumbers_split;
for my $callnumber ( @callnumbers ) {
my @lines = C4::ClassSplitRoutine::RegEx::split_callnumber($callnumber, $regexs);
push @callnumbers_split, { inline => $callnumber, split => \@lines };
}
$response->param( split_callnumbers => \@callnumbers_split );
C4::Service->return_success( $response );
}
C4::Service->dispatch(
[ 'GET /', [ 'callnumbers', 'regexs' ], \&get_split_callnumbers ],
);