From 4b1d99fce0c4a8bc15479c09d986219ac4053e4d Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 7 Oct 2015 12:26:14 -0400 Subject: [PATCH] Bug 14610 - Add and update scripts Signed-off-by: Jennifer Schmidt --- Koha/Item.pm | 2 +- admin/smart-rules.pl | 2 + circ/article-request-slip.pl | 67 ++++ circ/article-requests.pl | 47 +++ circ/request-article-do.pl | 70 ++++ circ/request-article.pl | 53 +++ .../prog/en/includes/biblio-view-menu.inc | 4 + .../en/modules/admin/preferences/circulation.pref | 43 +++ .../prog/en/modules/admin/smart-rules.tt | 21 ++ .../prog/en/modules/catalogue/results.tt | 3 + .../prog/en/modules/circ/article-requests.tt | 365 +++++++++++++++++++++ .../prog/en/modules/circ/circulation-home.tt | 5 + .../prog/en/modules/circ/request-article.tt | 336 +++++++++++++++++++ .../intranet-tmpl/prog/en/modules/intranet-main.tt | 9 + koha-tmpl/opac-tmpl/bootstrap/css/opac.css | 2 +- .../bootstrap/en/includes/opac-detail-sidebar.inc | 8 + .../bootstrap/en/modules/opac-request-article.tt | 214 ++++++++++++ .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 6 + .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 95 ++++++ koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 18 + mainpage.pl | 11 +- opac/opac-article-request-cancel.pl | 47 +++ opac/opac-request-article-do.pl | 69 ++++ opac/opac-request-article.pl | 52 +++ opac/opac-user.pl | 3 +- svc/article_request | 63 ++++ 26 files changed, 1610 insertions(+), 5 deletions(-) create mode 100755 circ/article-request-slip.pl create mode 100755 circ/article-requests.pl create mode 100755 circ/request-article-do.pl create mode 100755 circ/request-article.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt create mode 100755 opac/opac-article-request-cancel.pl create mode 100755 opac/opac-request-article-do.pl create mode 100755 opac/opac-request-article.pl create mode 100755 svc/article_request diff --git a/Koha/Item.pm b/Koha/Item.pm index 17526ea..6a69d37 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -146,7 +146,7 @@ sub article_request_type { : undef; my $borrowertype = $borrower->categorycode; my $itemtype = $self->effective_itemtype(); - my $rules = GetIssuingRule( $borrowertype, $itemtype, $branchcode ); + my $rules = C4::Circulation::GetIssuingRule( $borrowertype, $itemtype, $branchcode ); return $rules->{article_requests} || q{}; } diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 9c903da..25b1507 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -144,6 +144,7 @@ elsif ($op eq 'add') { my $hardduedatecompare = $input->param('hardduedatecompare'); my $rentaldiscount = $input->param('rentaldiscount'); my $opacitemholds = $input->param('opacitemholds') || 0; + my $article_requests = $input->param('article_requests') || 'no'; my $overduefinescap = $input->param('overduefinescap') || undef; my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on'; $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price"; @@ -174,6 +175,7 @@ elsif ($op eq 'add') { opacitemholds => $opacitemholds, overduefinescap => $overduefinescap, cap_fine_to_replacement_price => $cap_fine_to_replacement_price, + article_requests => $article_requests, }; my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br}); diff --git a/circ/article-request-slip.pl b/circ/article-request-slip.pl new file mode 100755 index 0000000..9d4008b --- /dev/null +++ b/circ/article-request-slip.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl + +# Copyright 2015 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. +# +# 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 . + +use Modern::Perl; + +use CGI qw( -utf8 ); + +use C4::Context; +use C4::Output; +use C4::Auth; +use Koha::ArticleRequests; + +my $cgi = new CGI; + +my $id = $cgi->param('id'); + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/printslip.tt", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + } +); + +my $ar = Koha::ArticleRequests->find($id); + +$template->param( article_request => $ar ); + +my $slip = C4::Letters::GetPreparedLetter( + module => 'circulation', + letter_code => 'AR_PRINT', + message_transport_type => 'print', + tables => { + article_requests => $ar->id, + borrowers => $ar->borrowernumber, + biblio => $ar->biblionumber, + biblioitems => $ar->biblionumber, + items => $ar->itemnumber, + branches => $ar->branchcode, + }, +); + +$template->param( + slip => $slip->{content}, + caller => 'article-request', + plain => !$slip->{is_html}, +); + +output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/circ/article-requests.pl b/circ/article-requests.pl new file mode 100755 index 0000000..f716f53 --- /dev/null +++ b/circ/article-requests.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl + +# Copyright 2015 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. +# +# 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 . + +use Modern::Perl; + +use CGI qw ( -utf8 ); + +use C4::Auth; +use C4::Output; +use Koha::ArticleRequests; + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/article-requests.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + } +); + +my $branchcode = $query->param('branchcode') || C4::Context->userenv->{'branch'}; + +$template->param( + branchcode => $branchcode, + article_requests_open => scalar Koha::ArticleRequests->open($branchcode), + article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode), +); + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/circ/request-article-do.pl b/circ/request-article-do.pl new file mode 100755 index 0000000..f9a2693 --- /dev/null +++ b/circ/request-article-do.pl @@ -0,0 +1,70 @@ +#!/usr/bin/perl + +# Copyright ByWater Solutions 2015 +# +# 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. +# +# 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 . + +use Modern::Perl; + +use CGI qw ( -utf8 ); + +use C4::Auth; +use C4::Output; + +use Koha::ArticleRequest; + +my $cgi = new CGI; + +my ( $template, $librarian, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/request-article.tt", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => 'circulate_remaining_permissions' }, + } +); + +my $biblionumber = $cgi->param('biblionumber'); +my $borrowernumber = $cgi->param('borrowernumber'); +my $branchcode = $cgi->param('branchcode'); + +my $itemnumber = $cgi->param('itemnumber') || undef; +my $title = $cgi->param('title') || undef; +my $author = $cgi->param('author') || undef; +my $volume = $cgi->param('volume') || undef; +my $issue = $cgi->param('issue') || undef; +my $date = $cgi->param('date') || undef; +my $pages = $cgi->param('pages') || undef; +my $chapters = $cgi->param('chapters') || undef; + +my $ar = Koha::ArticleRequest->new( + { + borrowernumber => $borrowernumber, + biblionumber => $biblionumber, + branchcode => $branchcode, + itemnumber => $itemnumber, + title => $title, + author => $author, + volume => $volume, + issue => $issue, + date => $date, + pages => $pages, + chapters => $chapters, + } +)->store(); + +print $cgi->redirect("/cgi-bin/koha/circ/request-article.pl?biblionumber=$biblionumber"); diff --git a/circ/request-article.pl b/circ/request-article.pl new file mode 100755 index 0000000..dc84318 --- /dev/null +++ b/circ/request-article.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# Copyright 2015 ByWater Solutions +# Copyright 2000-2002 Katipo Communications +# Copyright 2011 Catalyst IT +# +# 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. +# +# 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 . + +use Modern::Perl; + +use C4::Output; +use C4::Auth; +use Koha::Biblios; +use Koha::Borrowers; +use Koha::ArticleRequests; + +my $input = new CGI; + +my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/request-article.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => 'circulate_remaining_permissions' }, + } +); + +my $biblionumber = $input->param('biblionumber'); +my $patron_cardnumber = $input->param('patron_cardnumber'); + +my $biblio = Koha::Biblios->find($biblionumber); +my $patron = $patron_cardnumber ? Koha::Borrowers->find( { cardnumber => $patron_cardnumber } ) : undef; + +$template->param( + biblio => $biblio, + patron => $patron, +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc index 4258aa3..645ccd6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE Biblio %] [% SET biblio_object_id = object || biblionumber %]