Bugzilla – Attachment 44696 Details for
Bug 13930
Add supporting service svc/ncip for xnciptoolkit driver
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13931 - Fixed Licence & Copyright statements & refactored the code
Bug-13931---Fixed-Licence--Copyright-statements--r.patch (text/plain), 25.02 KB, created by
Josef Moravec
on 2015-11-10 12:44:47 UTC
(
hide
)
Description:
Bug 13931 - Fixed Licence & Copyright statements & refactored the code
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2015-11-10 12:44:47 UTC
Size:
25.02 KB
patch
obsolete
>From 6d77702504eb12d29af2d14da396b419fe61249b Mon Sep 17 00:00:00 2001 >From: jirislav <mail@jkozlovsky.cz> >Date: Fri, 17 Apr 2015 14:51:32 +0200 >Subject: [PATCH] Bug 13931 - Fixed Licence & Copyright statements & refactored > the code > >http://bugs.koha-community.org/show_bug.cgi?id=13930 >Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> >--- > C4/NCIP/CancelRequestItem.pm | 24 +++++----- > C4/NCIP/LookupItem.pm | 46 +++++++++--------- > C4/NCIP/LookupItemSet.pm | 33 +++++++------ > C4/NCIP/LookupRequest.pm | 51 +++++++++++++++----- > C4/NCIP/LookupUser.pm | 29 +++++------ > C4/NCIP/NcipUtils.pm | 112 ++++++++++++++++++++++++++++++++++++++----- > C4/NCIP/RenewItem.pm | 53 ++++++++++---------- > C4/NCIP/RequestItem.pm | 47 +++++++++++------- > svc/ncip | 30 ++++++------ > 9 files changed, 280 insertions(+), 145 deletions(-) > >diff --git a/C4/NCIP/CancelRequestItem.pm b/C4/NCIP/CancelRequestItem.pm >index 3cbe755..e5b4cc0 100644 >--- a/C4/NCIP/CancelRequestItem.pm >+++ b/C4/NCIP/CancelRequestItem.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::CancelRequestItem; > >diff --git a/C4/NCIP/LookupItem.pm b/C4/NCIP/LookupItem.pm >index 79ead12..737d4aa 100644 >--- a/C4/NCIP/LookupItem.pm >+++ b/C4/NCIP/LookupItem.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::LookupItem; > >@@ -150,17 +150,17 @@ sub parseItem { > > return 'SQL query failed' unless $result; > >- $result->{itemId} = $itemId; >- $result->{bibId} = $bibId; >- $result->{barcode} = $item->{barcode}; >- $result->{location} = $item->{location}; >- $result->{homebranch} = $item->{homebranch}; >- $result->{restricted} = $item->{restricted}; >- $result->{holdingbranch} = $item->{holdingbranch}; >- $result->{mediumtype} = $item->{itype}; >- $result->{copynumber} = $item->{copynumber}; >- $result->{callnumber} = $item->{itemcallnumber}; >- $result->{ccode} = $item->{ccode}; >+ $result->{itemnumber} = $itemId; >+ $result->{biblionumber} = $bibId; >+ $result->{barcode} = $item->{barcode}; >+ $result->{location} = $item->{location}; >+ $result->{homebranch} = $item->{homebranch}; >+ $result->{restricted} = $item->{restricted}; >+ $result->{holdingbranch} = $item->{holdingbranch}; >+ $result->{itype} = $item->{itype}; >+ $result->{copynumber} = $item->{copynumber}; >+ $result->{itemcallnumber} = $item->{itemcallnumber}; >+ $result->{ccode} = $item->{ccode}; > > return C4::NCIP::NcipUtils::clearEmptyKeys($result); > } >diff --git a/C4/NCIP/LookupItemSet.pm b/C4/NCIP/LookupItemSet.pm >index 298bee1..b82198c 100644 >--- a/C4/NCIP/LookupItemSet.pm >+++ b/C4/NCIP/LookupItemSet.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::LookupItemSet; > >@@ -116,8 +116,8 @@ sub lookupItemSet { > } > my $desiredSomething > = $holdQueueDesired >- or $itemRestrictsDesired >- or $circStatusDesired; >+ || $itemRestrictsDesired >+ || $circStatusDesired; > > $result->{bibInfo} = parseBiblio($bibId) > unless $desiredSomething and defined $query->param('notBibInfo'); >@@ -159,8 +159,10 @@ sub parseBiblio { > WHERE biblioitems.biblionumber = ?"); > $sth->execute($bibId); > my $data = C4::NCIP::NcipUtils::clearEmptyKeys($sth->fetchrow_hashref); >+ return 'SQL query failed..' unless $data; > >- return $data || 'SQL query failed..'; >+ $data->{'biblionumber'} = $bibId; >+ return $data; > } > > =head2 parseItems >@@ -185,6 +187,7 @@ sub parseItems { > location, > ccode, > materials, >+ itype, > copynumber"; > if ($circStatusDesired) { > $query .= ", >diff --git a/C4/NCIP/LookupRequest.pm b/C4/NCIP/LookupRequest.pm >index ee861fc..cf098a4 100644 >--- a/C4/NCIP/LookupRequest.pm >+++ b/C4/NCIP/LookupRequest.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::LookupRequest; > >@@ -78,8 +78,35 @@ sub lookupRequest { > C4::NCIP::NcipUtils::print404($query, "Request not found..") > unless $result; > >+ my $onLoanUntil = parseDateDue($result->{'itemnumber'}); >+ $result->{'onloanuntil'} = $onLoanUntil if $onLoanUntil; >+ > C4::NCIP::NcipUtils::clearEmptyKeys($result); > > C4::NCIP::NcipUtils::printJson($query, $result); > } >+ >+=head2 parseDateDue >+ >+ parseDateDue($itemnumber) >+ >+ Returns item's date_due if exists .. else undef >+ >+=cut >+ >+sub parseDateDue { >+ >+ my ($itemId) = @_; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare(" >+ SELECT date_due >+ FROM issues >+ WHERE itemnumber = ?"); >+ $sth->execute($itemId); >+ >+ my $issue = $sth->fetchrow_hashref; >+ return unless $issue; >+ >+ return $issue->{date_due}; >+} > 1; >diff --git a/C4/NCIP/LookupUser.pm b/C4/NCIP/LookupUser.pm >index dfd7206..c0403b1 100644 >--- a/C4/NCIP/LookupUser.pm >+++ b/C4/NCIP/LookupUser.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2013 BibLibre >+# This file is part of Koha. > # >-# This file is part of Koha >+# Copyright (C) 2015 JiÅà Kozlovský > # >-# 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 2 of the License, or (at your option) any later >-# version. >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::LookupUser; > >@@ -131,6 +131,8 @@ sub parseUserData { > B_country, > B_email, > B_phone, >+ dateofbirth, >+ branchcode, > categorycode, > dateenrolled, > dateexpiry >@@ -178,8 +180,7 @@ sub parseUserFiscalAccount { > itemnumber, > date, > amount, >- description, >- note >+ description > FROM accountlines > WHERE borrowernumber = ? > ORDER BY date desc,timestamp DESC"); >diff --git a/C4/NCIP/NcipUtils.pm b/C4/NCIP/NcipUtils.pm >index d2cb254..2340cb5 100644 >--- a/C4/NCIP/NcipUtils.pm >+++ b/C4/NCIP/NcipUtils.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::NcipUtils; > >@@ -38,6 +38,94 @@ C4::NCIP::NcipUtils - NCIP Common subroutines used in most of C4::NCIP modules > > =head1 METHODS > >+=cut >+ >+=head2 canBeRenewed >+ >+ canBeRenewed($cgiInput) >+ >+=cut >+ >+sub canBeRenewed { >+ my $query = shift; >+ my $userId = $query->param('userId'); >+ my $itemId = $query->param('itemId'); >+ my $response; >+ >+ my ($okay, $error) >+ = C4::Circulation::CanBookBeRenewed($userId, $itemId, '0'); >+ >+ $response->{allowed} = $okay ? 'y' : 'n'; >+ >+ printJson($query, $response) unless $okay; >+ >+ my $maxDateDueDesired = $query->param('maxDateDueDesired'); >+ >+ if (defined $maxDateDueDesired) { >+ my $dbh = C4::Context->dbh; >+ # Find the issues record for this book >+ my $sth = $dbh->prepare( >+ "SELECT branchcode FROM issues WHERE itemnumber = ?"); >+ $sth->execute($itemId); >+ my $issueBranchCode = $sth->fetchrow_array; >+ unless ($issueBranchCode) { >+ print $query->header( >+ -type => 'text/plain', >+ -status => '404 Not Found' >+ ); >+ print 'Checkout wasn\'t found .. Nothing to renew..'; >+ exit 0; >+ } >+ >+ my $biblio = C4::Biblio::GetBiblioFromItemNumber($itemId); >+ my $itemtype >+ = (C4::Context->preference('item-level_itypes')) >+ ? $biblio->{'itype'} >+ : $biblio->{'itemtype'}; >+ >+ my $now = DateTime->now(time_zone => C4::Context->tz()); >+ my $borrower = C4::Members::GetMember(borrowernumber => $userId); >+ unless ($borrower) { >+ print $query->header( >+ -type => 'text/plain', >+ -status => '404 Not Found' >+ ); >+ print 'User wasn\'t found ..'; >+ exit 0; >+ } >+ >+ my $maxDateDue >+ = C4::Circulation::CalcDateDue($now, $itemtype, $issueBranchCode, >+ $borrower, 'is a renewal'); >+ $response->{maxDateDue} >+ = Koha::DateUtils::format_sqldatetime($maxDateDue); >+ } >+ printJson($query, $response); >+} >+ >+=head2 canBeRequested >+ >+ canBeRequested($cgiInput) >+ >+=cut >+ >+sub canBeRequested { >+ my ($query) = @_; >+ my $userId = $query->param('userId'); >+ my $itemId = $query->param('itemId'); >+ >+ my $userExists = C4::Members::GetBorrowerCategorycode($userId); >+ >+ print404($query, "User doesn't exist") unless $userExists; >+ >+ my $canReserve = C4::Reserves::CanItemBeReserved($userId, $itemId); >+ >+ my $response; >+ $response->{allowed} = $canReserve eq 'OK' ? 'y' : 'n'; >+ >+ printJson($query, $response); >+} >+ > =head2 clearEmptyKeys > > clearEmptyKeys($hashref) >diff --git a/C4/NCIP/RenewItem.pm b/C4/NCIP/RenewItem.pm >index 634d35b..5cc9c56 100644 >--- a/C4/NCIP/RenewItem.pm >+++ b/C4/NCIP/RenewItem.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::RenewItem; > >@@ -120,28 +120,27 @@ sub renewItem { > $dateDue = Koha::DateUtils::dt_from_string($dateDue); > $dateDue->set_hour(23); > $dateDue->set_minute(59); >- if ($dateDue > $maxDateDue) { >- $dateDue = $maxDateDue; >- } # Here is the restriction done .. >- >+ if ($dateDue > $maxDateDue || $dateDue < $now) { >+ $dateDue = $maxDateDue; # Here is the restriction done .. >+ } > } > my ($okay, $error) > = C4::Circulation::CanBookBeRenewed($userId, $itemId, '0'); > >+ C4::NCIP::NcipUtils::print409($query, $error) unless $okay; >+ >+ $dateDue >+ = C4::Circulation::AddRenewal($userId, $itemId, $branch, $dateDue); >+ > my $result; >- if ($okay) { >- $dateDue = C4::Circulation::AddRenewal($userId, $itemId, $branch, >- $dateDue); >- $result->{'dateDue'} = Koha::DateUtils::output_pref( >- {dt => $dateDue, as_due_date => 1}); >- } else { >- $result->{'error'} = $error; >- } >+ $result->{'itemId'} = $itemId; >+ $result->{'userId'} = $userId; >+ $result->{'branchcode'} = $branch; > >- print $query->header(-type => 'text/plain', -charset => 'utf-8',); >- print to_json($result); >+ $result->{'dateDue'} >+ = Koha::DateUtils::output_pref({dt => $dateDue, as_due_date => 1}); > >- exit 0; >+ C4::NCIP::NcipUtils::printJson($query, $result); > } > > 1; >diff --git a/C4/NCIP/RequestItem.pm b/C4/NCIP/RequestItem.pm >index 7eb2070..278e882 100644 >--- a/C4/NCIP/RequestItem.pm >+++ b/C4/NCIP/RequestItem.pm >@@ -1,21 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2014 ByWater Solutions >-# > # This file is part of Koha. > # >-# 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. >+# Copyright (C) 2015 JiÅà Kozlovský >+# >+# 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. >+# 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. > > package C4::NCIP::RequestItem; > >@@ -122,7 +122,7 @@ sub requestItem { > {biblionumber => $bibId, itemnumber => $itemId, all_dates => 1}); > > foreach my $res (@$reserves) { >- C4::NCIP::NcipUtils::print403($query, >+ C4::NCIP::NcipUtils::print409($query, > "User already has item requested") > if $res->{borrowernumber} eq $userId; > } >@@ -133,12 +133,27 @@ sub requestItem { > "Loan not possible .. holdqueuelength exists") > if $requestType ne 'Hold' and $rank != 0; > >- my $expirationdate = $query->param('pickupExpiryDate'); >- my $startdate = $query->param('earliestDateNeeded'); >- my $notes = $query->param('notes') || 'Placed by svc/ncip'; >+ my $now = DateTime->now(time_zone => C4::Context->tz()); >+ >+ my $expirationdate >+ = Koha::DateUtils::dt_from_string($query->param('pickupExpiryDate')); >+ $expirationdate >+ = $expirationdate < $now ? undef : $query->param('pickupExpiryDate'); >+ >+ my $startdate = Koha::DateUtils::dt_from_string( >+ $query->param('earliestDateNeeded')); >+ $startdate >+ = $startdate < $now ? undef : $query->param('earliestDateNeeded'); >+ >+ my $notes = $query->param('notes') || 'Placed by svc/ncip'; > my $pickupLocation = $query->param('pickupLocation') > || C4::Context->userenv->{'branch'}; > >+ my $branchExists = C4::Branch::GetBranchName($pickupLocation); >+ C4::NCIP::NcipUtils::print409($query, >+ "Specified pickup location doesn't exist") >+ unless $branchExists; >+ > if ($itemLevelHold) { > placeHold( > $query, $bibId, $itemId, $userId, >diff --git a/svc/ncip b/svc/ncip >index 0a9efc4..6cda7fd 100755 >--- a/svc/ncip >+++ b/svc/ncip >@@ -1,23 +1,21 @@ > #!/usr/bin/perl > >-# Copyright 2007 LibLime >-# Copyright 2012 software.coop and MJ Ray >-# > # This file is part of Koha. > # >-# 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 2 of the License, or (at your option) any later >-# version. >+# Copyright (C) 2015 JiÅà Kozlovský > # >-# 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. >+# 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. > # >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# 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 strict; > use warnings; >@@ -39,7 +37,7 @@ binmode STDOUT, ':encoding(UTF-8)'; > my ($status, undef, undef) > = check_api_auth($query, {editcatalogue => 'edit_catalogue'}); > >-C4::NCIP::NcipUtils::print403($query, $status) >+C4::NCIP::NcipUtils::print403($query, "Auth failed: " . $status) > unless ($status eq "ok"); > > # do initial validation >@@ -56,6 +54,10 @@ if ($query->request_method eq "GET") { > C4::NCIP::LookupItemSet::lookupItemSet($query); > } elsif ($service eq 'lookup_user') { > C4::NCIP::LookupUser::lookupUser($query); >+ } elsif ($service eq 'can_be_renewed') { >+ C4::NCIP::NcipUtils::canBeRenewed($query); >+ } elsif ($service eq 'can_be_requested') { >+ C4::NCIP::NcipUtils::canBeRequested($query); > } elsif ($service eq 'lookup_request') { > C4::NCIP::LookupRequest::lookupRequest($query); > } elsif ($service eq 'request_item') { >-- >2.1.4
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 13930
:
37719
|
38047
|
40490
|
40629
|
40630
|
40631
|
40632
|
40633
|
44695
| 44696 |
44697
|
44698