Bugzilla – Attachment 77079 Details for
Bug 15836
Labels: Offer configuration option for splitting call numbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15836: Add missing svc script
Bug-15836-Add-missing-svc-script.patch (text/plain), 3.91 KB, created by
Jonathan Druart
on 2018-07-18 15:48:42 UTC
(
hide
)
Description:
Bug 15836: Add missing svc script
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-07-18 15:48:42 UTC
Size:
3.91 KB
patch
obsolete
>From a5616dbec7f10b5026de4d47e3fd2943448690b9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 18 Jul 2018 12:48:08 -0300 >Subject: [PATCH] Bug 15836: Add missing svc script > >--- > svc/split_callnumbers | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 98 insertions(+) > create mode 100644 svc/split_callnumbers > >diff --git a/svc/split_callnumbers b/svc/split_callnumbers >new file mode 100644 >index 0000000000..c52f4ed6a5 >--- /dev/null >+++ b/svc/split_callnumbers >@@ -0,0 +1,98 @@ >+#!/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; >+ use Data::Printer colored => 1; warn p $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 ); >+} >+ >+sub update_translation { >+ my $id = $query->param('id'); >+ my $translation = $query->param('translation'); >+ my $lang = $query->param('lang'); >+ >+ my $localization = Koha::Localizations->find( $id ); >+ if ( defined $lang and $localization->lang ne $lang ) { >+ $localization->lang( $lang ) >+ } >+ if ( defined $translation and $localization->translation ne $translation ) { >+ $localization->translation( $translation ) >+ } >+ my %params; >+ my $is_changed; >+ if ( $localization->is_changed ) { >+ $is_changed = 1; >+ unless ( Koha::Localizations->search( { entity => $localization->entity, code => $localization->code, lang => $lang, localization_id => { '!=' => $localization->localization_id }, } )->count ) { >+ $localization->store; >+ } else { >+ $params{error} = 1; >+ $params{error_code} = 'already_exists'; >+ } >+ } >+ $response->param( >+ %params, >+ id => $localization->localization_id, >+ entity => $localization->entity, >+ code => $localization->code, >+ lang => $localization->lang, >+ translation => $localization->translation, >+ is_changed => $is_changed, >+ ); >+ C4::Service->return_success( $response ); >+} >+ >+sub add_translation { >+ my $entity = $query->param('entity'); >+ my $code = $query->param('code'); >+ my $lang = $query->param('lang'); >+ my $translation = $query->param('translation'); >+ >+ unless ( Koha::Localizations->search({entity => $entity, code => $code, lang => $lang, })->count ) { >+ my $localization = Koha::Localization->new( >+ { >+ entity => $entity, >+ code => $code, >+ lang => $lang, >+ translation => $translation, >+ } >+ ); >+ $localization->store; >+ $response->param( >+ id => $localization->localization_id, >+ entity => $localization->entity, >+ code => $localization->code, >+ lang => $localization->lang, >+ translation => $localization->translation, >+ ); >+ >+ } else { >+ $response->param( error => 1, error_code => 'already_exists', ); >+ } >+ C4::Service->return_success( $response ); >+} >+ >+sub delete_translation { >+ my $id = $query->param('id'); >+ Koha::Localizations->find($id)->delete; >+ $response->param( id => $id ); >+ C4::Service->return_success( $response ); >+} >+ >+C4::Service->dispatch( >+ [ 'GET /', [ 'callnumbers', 'regexs' ], \&get_split_callnumbers ], >+); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15836
:
76691
|
76692
|
76693
|
76694
|
76695
|
76696
|
77061
|
77079
|
77306
|
78791
|
78793
|
78795
|
78796
|
78798
|
78799
|
79029
|
80339
|
80340
|
80341
|
80342
|
80343
|
80344
|
80345
|
80346
|
80347
|
80548
|
80549
|
80550
|
80551
|
80552
|
80553
|
80554
|
80555
|
80556
|
81033
|
81034
|
81035
|
81036
|
81037
|
81038
|
81039
|
81040
|
81041
|
81627
|
81628
|
81629
|
81630
|
81631
|
81632
|
81633
|
81634
|
81635
|
82110
|
82112
|
82113
|
82118
|
82119
|
82120
|
82289
|
82290
|
82291
|
82292
|
82293
|
82294
|
82295
|
82296
|
82297
|
82298
|
82299
|
82300
|
82301
|
82302
|
82317
|
82318
|
82319
|
82321