Main Koha release repository
https://koha-community.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.5 KiB
59 lines
1.5 KiB
#!/usr/bin/perl
|
|
|
|
# This file is part of Koha.
|
|
#
|
|
# Copyright 2014 BibLibre
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use C4::Service;
|
|
use C4::Letters qw( GetLetters );
|
|
|
|
=head1 NAME
|
|
|
|
svc/letters/get - Web service for getting letters
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
GET /svc/letters/get
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
For the moment, this service is only used to get a letter from a letter code.
|
|
|
|
=head1 METHODS
|
|
|
|
=cut
|
|
|
|
=head2 get_letters
|
|
|
|
Used to get letters with a given letter code.
|
|
|
|
=cut
|
|
|
|
our ( $query, $response ) = C4::Service->init( tools => 'edit_notices' );
|
|
|
|
sub get_letters {
|
|
my $code = scalar $query->param('code');
|
|
my $branchcode = scalar $query->param('branchcode');
|
|
my $letters = GetLetters({ code => $code, branchcode => $branchcode });
|
|
$response->param( letters => $letters );
|
|
C4::Service->return_success( $response );
|
|
}
|
|
|
|
C4::Service->dispatch(
|
|
[ 'GET /', [ 'code' ], \&get_letters ],
|
|
);
|
|
|