Bug 26505: Suspend hold modal broken in the OPAC
[koha.git] / svc / split_callnumbers
blob7fc9deefd34f92891217fd5fb37a6263daeaa874
1 #!/usr/bin/perl
3 use Modern::Perl;
4 use JSON qw( from_json );
5 use C4::Service;
6 use C4::ClassSplitRoutine::RegEx;
8 our ( $query, $response ) = C4::Service->init( parameters => 'parameters_remaining_permissions' );
10 sub get_split_callnumbers {
11 my $regexs = from_json( $query->param('regexs') );
12 my $c = $query->param('callnumbers');
13 my @callnumbers = split "\n", $c;
14 my @callnumbers_split;
15 for my $callnumber ( @callnumbers ) {
16 my @lines = C4::ClassSplitRoutine::RegEx::split_callnumber($callnumber, $regexs);
17 push @callnumbers_split, { inline => $callnumber, split => \@lines };
19 $response->param( split_callnumbers => \@callnumbers_split );
20 C4::Service->return_success( $response );
23 C4::Service->dispatch(
24 [ 'GET /', [ 'callnumbers', 'regexs' ], \&get_split_callnumbers ],