Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digibib
deichman
Commits
1c6c56bc
Commit
1c6c56bc
authored
Jan 23, 2019
by
Benjamin Rokseth
Browse files
koha: expose picklist in new API
parent
d79f8295
Changes
3
Hide whitespace changes
Inline
Side-by-side
koha/Deichman/Exception.pm
View file @
1c6c56bc
...
...
@@ -7,7 +7,10 @@ use Modern::Perl;
use
Exception::
Class
(
"
Deichman::Exception
",
"
Deichman::Exception::File::NotFound
"
=>
{
description
=>
"
File not found
",
isa
=>
"
Deichman::Exception
",
},
"
Deichman::Exception::Patron
",
"
Deichman::Exception::Patron::NotFound
"
=>
{
description
=>
"
Patron not found
",
...
...
koha/api/RESTAPI.pm
View file @
1c6c56bc
...
...
@@ -52,6 +52,7 @@ use RESTAPI::Patron::Dooraccess;
use
RESTAPI::Patron::
Favourites
;
use
RESTAPI::Patron::
LoansAndReservations
;
use
RESTAPI::Patron::
PasswordRecovery
;
use
RESTAPI::
PickList
;
use
RESTAPI::
PrintSlip
;
use
RESTAPI::
Session
;
...
...
@@ -62,6 +63,7 @@ mount "RESTAPI::Patron::Dooraccess";
mount
"
RESTAPI::Patron::Favourites
";
mount
"
RESTAPI::Patron::LoansAndReservations
";
mount
"
RESTAPI::Patron::PasswordRecovery
";
mount
"
RESTAPI::PickList
";
mount
"
RESTAPI::PrintSlip
";
mount
"
RESTAPI::Session
";
...
...
koha/api/RESTAPI/PickList.pm
0 → 100644
View file @
1c6c56bc
package
RESTAPI::
PickList
;
# Simply expose plukkliste.json in api, to be moved later
use
strict
;
use
warnings
;
use
Raisin::
API
;
use
HTTP::
Status
qw(:constants)
;
use
Types::
Standard
qw(HashRef Any Int Str)
;
use
Try::
Tiny
;
use
Deichman::
Exception
;
binmode
STDOUT
,
"
:utf8
";
use
utf8
;
use
JSON
;
desc
"
Print slip operations
";
resource
picklist
=>
sub
{
summary
"
Get list of items to pick
";
get
sub
{
try
{
# an extra roundtrip of decode-encode json never hurts...
my
$json
;
local
$/
;
#Enable 'slurp' mode
open
my
$fh
,
"
<
",
"
/koha/holdsqueue/plukkliste.json
"
or
Deichman::Exception::File::
NotFound
->
throw
();
$json
=
<
$fh
>
;
close
$fh
;
my
$data
=
decode_json
(
$json
);
{
$data
}
}
catch
{
if
(
$_
->
isa
("
Deichman::Exception::File::NotFound
"))
{
res
->
status
(
HTTP_NOT_FOUND
);
}
else
{
app
->
log
(
error
=>
$_
->
description
);
res
->
status
(
HTTP_INTERNAL_SERVER_ERROR
);
}
undef
;
}
};
};
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment