From 735d9b15ba056636d4244916d7e69022954b1afe 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 | 62 ++++ circ/request-article.pl | 74 ++++ koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 6 +- .../prog/en/includes/biblio-view-menu.inc | 84 +++-- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 4 + .../en/modules/admin/preferences/circulation.pref | 43 +++ .../prog/en/modules/admin/smart-rules.tt | 21 ++ .../prog/en/modules/catalogue/detail.tt | 19 + .../prog/en/modules/catalogue/results.tt | 3 + .../prog/en/modules/circ/article-requests.tt | 407 +++++++++++++++++++++ .../prog/en/modules/circ/circulation-home.tt | 5 + .../prog/en/modules/circ/request-article.tt | 371 +++++++++++++++++++ .../intranet-tmpl/prog/en/modules/intranet-main.tt | 9 + .../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 | 62 ++++ opac/opac-request-article.pl | 52 +++ opac/opac-user.pl | 3 +- svc/article_request | 63 ++++ tools/letter.pl | 4 + 29 files changed, 1769 insertions(+), 40 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 969077d..8d91aef 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -149,7 +149,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 11a5637..01a46dd 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -148,6 +148,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"; @@ -178,6 +179,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..6a7087d --- /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_SLIP', + 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..d0c2805 --- /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 = defined( $query->param('branchcode') ) ? $query->param('branchcode') : C4::Context->userenv->{'branch'}; + +$template->param( + branchcode => $branchcode, + article_requests_pending => scalar Koha::ArticleRequests->pending($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..66fd3c5 --- /dev/null +++ b/circ/request-article-do.pl @@ -0,0 +1,62 @@ +#!/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; + +checkauth( $cgi, 0, { circulate => 'circulate_remaining_permissions' }, 'intranet' ); + +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..448cac8 --- /dev/null +++ b/circ/request-article.pl @@ -0,0 +1,74 @@ +#!/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 C4::Output; +use C4::Auth; +use C4::Utils::DataTables::Members; +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 $patron_id = $input->param('patron_id'); + +my $biblio = Koha::Biblios->find($biblionumber); +my $patron = Koha::Borrowers->find( $patron_id ? $patron_id : { cardnumber => $patron_cardnumber } ); + +if (!$patron && $patron_cardnumber) { + my $results = C4::Utils::DataTables::Members::search( + { + searchmember => $patron_cardnumber, + dt_params => { iDisplayLength => -1 }, + } + ); + + my $patrons = $results->{patrons}; + + if ( scalar @$patrons == 1 ) { + $patron = Koha::Borrowers->find( $patrons->[0]->{borrowernumber} ); + } + elsif (@$patrons) { + $template->param( patrons => $patrons ); + } + else { + $template->param( no_patrons_found => $patron_cardnumber ); + } +} + +$template->param( + biblio => $biblio, + patron => $patron, +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css index 35fa6f8..c26a88c 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -1708,8 +1708,8 @@ ul.budget_hierarchy li:first-child:after { .child_fund_amount { font-style: italic; } -.holdcount { font-size : 105%; line-height : 200%; } -.holdcount a { +.number_box { font-size : 105%; line-height : 200%; } +.number_box a { border : 1px solid #a4bedd; background-color : #e4ecf5; font-weight : bold; @@ -1718,7 +1718,7 @@ ul.budget_hierarchy li:first-child:after { padding : .1em .4em; text-decoration : none; } -.holdcount a:hover { background-color : #ebeff7; } +.number_box a:hover { background-color : #ebeff7; } .container { border : 1px solid #EEE; padding : 1em; 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..474b596 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,38 +1,56 @@ +[% USE Koha %] [% USE Biblio %] [% SET biblio_object_id = object || biblionumber %] + diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index 68aeefa..6e6d1b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -263,6 +263,10 @@ CAN_user_serials_create_subscription ) %] [% END %] [% END %] +[% IF Koha.Preference('ArticleRequests') %] + +[% END %] + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 9a37608..9b1d0ab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -762,3 +762,46 @@ Circulation: - "Patron categories allowed to checkout in a batch" - pref: BatchCheckoutsValidCategories - "(list of patron categories separated with a pipe '|')" + Article Requests: + - + - pref: ArticleRequests + choices: + yes: Enable + no: "Don't enable" + - patrons to place article requests. + - + - For records that are record level or item level requestable, make the following fields mandatory + - pref: ArticleRequestsMandatoryFields + multiple: + title: Title + author: Author + volume: Volume + issue: Issue + date: Date + pages: Pages + chapters: Chapters + - + - + - For records that are only record level requestable, make the following fields mandatory + - pref: ArticleRequestsMandatoryFieldsRecordOnly + multiple: + title: Title + author: Author + volume: Volume + issue: Issue + date: Date + pages: Pages + chapters: Chapters + - + - + - For records that are only item level requestable, make the following fields mandatory + - pref: ArticleRequestsMandatoryFieldsItemOnly + multiple: + title: Title + author: Author + volume: Volume + issue: Issue + date: Date + pages: Pages + chapters: Chapters + - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index fea01f3..55899e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -178,6 +178,7 @@ for="tobranch">Clone these rules to: Clone these rules to: Edit @@ -342,6 +354,14 @@ for="tobranch">Clone these rules to: Force + + + @@ -373,6 +393,7 @@ for="tobranch">Clone these rules to:   diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index fee31d8..488611e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -2,6 +2,7 @@ [% USE KohaDates %] [% USE AuthorisedValues %] [% USE Branches %] +[% USE Biblio %] [% ShowCourseReserves = 0 %] [% IF UseCourseReserves %] @@ -384,6 +385,24 @@ function verify_images() { [% END %] MARC Preview: Show + [% IF ( holdcount ) %] + + Holds: + + [% holdcount %] + + + [% END %] + + [% IF ( article_requests_count = Biblio.ArticleRequestsActiveCount( biblionumber ) ) %] + + Article requests: + + [% article_requests_count %] + + + [% END %] + [% IF ( AmazonCoverImages || LocalCoverImages ) %]
[% IF ( LocalCoverImages ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 6e71a41..a824d56 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -559,6 +559,9 @@ var holdForPatron = function () { Holds [% IF ( holdfor ) %] | Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])[% END %] [% END %] + [% IF Koha.Preference('ArticleRequests') %] + | Request article + [% END %] [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] | Edit record [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt new file mode 100644 index 0000000..073aad5 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt @@ -0,0 +1,407 @@ +[% USE KohaDates %] +[% USE ItemTypes %] +[% USE Branches %] +[% USE AuthorisedValues %] + +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Article requests +[% INCLUDE 'doc-head-close.inc' %] + + + + + [% INCLUDE 'header.inc' %] + [% INCLUDE 'cat-search.inc' %] + + + + + +
+
+
+
+ +

Article requests

+ +
+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + [% FOREACH ar IN article_requests_pending %] + + + + + + + + + + + + + + [% END %] + +
TitleRequested articleCollectionItem typeCall numberCopy numberEnumerationBarcodePatronDateActions
+ There are no pending article requests at this time. +
+

+ + [% ar.biblio.title | html %] + [% FOREACH s IN itemsloo.subtitle %] [% s %][% END %] + +

+ +

+

[% ar.biblionumber %]
+
[% ar.biblio.author %]
+
+ [% ar.biblio.biblioitem.publishercode %] + + [% IF ar.biblio.biblioitem.publicationyear %] + , [% ar.biblio.biblioitem.publicationyear %] + [% ELSIF ar.biblio.copyrightdate %] + , [% ar.biblio.copyrightdate %] + [% END %] + + [% IF ar.biblio.biblioitem.pages %] + : [% ar.biblio.biblioitem.pages %] + [% END %] + + [% r.biblio.biblioitem.size %] + + [% IF ar.biblio.biblioitem.isbn %] + ISBN: [% ar.biblio.biblioitem.isbn %] + [% END %] +
+

+
+ [% IF ar.title %]

Title: [% ar.title %]

[% END %] + [% IF ar.author %]

Author: [% ar.author %]

[% END %] + [% IF ar.volume %]

Volume: [% ar.volume %]

[% END %] + [% IF ar.issue %]

Issue: [% ar.issue %]

[% END %] + [% IF ar.date %]

Date: [% ar.date %]

[% END %] + [% IF ar.pages %]

Pages: [% ar.pages %]

[% END %] + [% IF ar.chapters %]

Chapters: [% ar.chapters %]

[% END %] +
[% AuthorisedValues.GetByCode( 'CCODE', ar.item.ccode ) %][% ItemTypes.GetDescription( ar.item.effective_itemtype ) %] + [% IF ar.item.location %] + [% AuthorisedValues.GetByCode( 'LOC', ar.item.location ) %] + [% END %] + + [% ar.item.itemcallnumber %] + [% ar.item.copynumber %][% ar.item.enumchron %][% ar.item.barcode %] +

+ + [% ar.borrower.surname %][% IF ar.borrower.firstname %], [% ar.borrower.firstname %][% END %] ([% ar.borrower.cardnumber %]) + +

+ +

[% ar.borrower.phone %]

+
[% ar.created_on | $KohaDates %] + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + [% FOREACH ar IN article_requests_processing %] + + + + + + + + + + + + + + [% END %] + +
TitleRequested articleCollectionItem typeCall numberCopy numberEnumerationBarcodePatronDateActions
+ There are no article requests in processing at this time. +
+

+ + [% ar.biblio.title | html %] + [% FOREACH s IN itemsloo.subtitle %] [% s %][% END %] + +

+ +

+

[% ar.biblionumber %]
+
[% ar.biblio.author %]
+
+ [% ar.biblio.biblioitem.publishercode %] + + [% IF ar.biblio.biblioitem.publicationyear %] + , [% ar.biblio.biblioitem.publicationyear %] + [% ELSIF ar.biblio.copyrightdate %] + , [% ar.biblio.copyrightdate %] + [% END %] + + [% IF ar.biblio.biblioitem.pages %] + : [% ar.biblio.biblioitem.pages %] + [% END %] + + [% r.biblio.biblioitem.size %] + + [% IF ar.biblio.biblioitem.isbn %] + ISBN: [% ar.biblio.biblioitem.isbn %] + [% END %] +
+

+
+ [% IF ar.title %]

Title: [% ar.title %]

[% END %] + [% IF ar.author %]

Author: [% ar.author %]

[% END %] + [% IF ar.volume %]

Volume: [% ar.volume %]

[% END %] + [% IF ar.issue %]

Issue: [% ar.issue %]

[% END %] + [% IF ar.date %]

Date: [% ar.date %]

[% END %] + [% IF ar.pages %]

Pages: [% ar.pages %]

[% END %] + [% IF ar.chapters %]

Chapters: [% ar.chapters %]

[% END %] +
[% AuthorisedValues.GetByCode( 'CCODE', ar.item.ccode ) %][% ItemTypes.GetDescription( ar.item.effective_itemtype ) %] + [% IF ar.item.location %] + [% AuthorisedValues.GetByCode( 'LOC', ar.item.location ) %] + [% END %] + + [% ar.item.itemcallnumber %] + [% ar.item.copynumber %][% ar.item.enumchron %][% ar.item.barcode %] +

+ + [% ar.borrower.surname %][% IF ar.borrower.firstname %], [% ar.borrower.firstname %][% END %] ([% ar.borrower.cardnumber %]) + +

+ +

[% ar.borrower.phone %]

+
[% ar.created_on | $KohaDates %] + +
+
+
+
+
+
+[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index fdd361f..48f4f8d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -42,6 +42,11 @@
  • Holds awaiting pickup
  • Hold ratios
  • Transfers to receive
  • + [% IF Koha.Preference('ArticleRequests') %] +
  • + Article requests +
  • + [% END %] [% IF ( CAN_user_circulate_overdues_report ) %]
  • Overdues - Warning: This report is very resource intensive on systems with large numbers of overdue items.
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt new file mode 100644 index 0000000..0ce2cc7 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt @@ -0,0 +1,371 @@ +[% USE KohaDates %] +[% USE Branches %] +[% SET article_requests_view = 1 %] +[% SET biblionumber = biblio.biblionumber %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Request article +[% INCLUDE 'doc-head-close.inc' %] + +[% INCLUDE 'datatables.inc' %] + + + + + + [% INCLUDE 'header.inc' %] + [% INCLUDE 'circ-search.inc' %] + + + +
    +
    +
    +
    + +

    Request article from [% biblio.title | html %]

    + [% IF no_patrons_found %] +
    +

    Patron not found

    +

    No patron with this name, please, try another

    +
    + [% ELSIF patrons %] +
    +
    + + + + + + + + + + + + + [% FOREACH patron IN patrons %] + + + + + + + + + [% END %] + +
    NameCardnumberCategoryLibraryAddress
    [% patron.surname %], [% patron.firstname %][% patron.cardnumber %][% patron.categorycode %][% patron.branchcode %][% patron.address %]
    + +
    +
    +
    + [% ELSIF !patron %] +
    +
    + +
    Enter patron card number or partial name:
    + + + +
    +
    + [% ELSE %] + [% IF biblio.can_article_request( patron ) %] + +
    + + + +
    + Place article request from [% biblio.title %] for [% patron.firstname %] [% patron.surname %] ( [% patron.cardnumber %] ) +

    +

      +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • +
    +
    + + [% SET article_request_type = biblio.article_request_type( patron ) %] + [% IF article_request_type != 'bib_only' %] + + + + + + + + + + + + + + + [% FOREACH item IN biblio.items %] + [% IF item.can_article_request( patron ) %] + + + + + + + + + [% END %] + [% END %] + + [% IF article_request_type != 'item_only' %] + + + + + [% END %] + +
    Select item:
     Item typeBarcodeHome libraryCall numberEnumeration
    + [% IF article_request_type == 'item_only' && !checked %] + [% SET checked = 1 %] + + [% ELSE %] + + [% END %] + + [% item.itype %] + + [% item.barcode %] + + [% item.homebranch %] + + [% item.itemcallnumber %] + + [% item.enumchron %] +
    + + + Any item +
    + [% END %] + +

    + +

    +
    + [% ELSE %] + No article requests can be made for this record. + [% END %] + + [% END %] + + [% IF biblio.article_requests_current && !patron %] +
    + Current article requests + + + + + + + + + + + + + + + + + + + [% FOREACH ar IN biblio.article_requests_current %] + + + + + + + + + + + + + + + + [% END %] +
    Placed onPatronTitleAuthorVolumeIssueDatePagesChaptersItemStatusPickup library 
    [% ar.created_on | $KohaDates %][% ar.borrower.firstname %] [% ar.borrower.surname %][% ar.title %][% ar.author %][% ar.volume %][% ar.issue %][% ar.date %][% ar.pages %][% ar.chapters %] + [% IF ar.item %] + [% ar.item.barcode %] + [% END %] + + [% IF ar.status == 'PENDING' %] + Pending + [% ELSIF ar.status == 'PROCESSING' %] + Processing + [% ELSIF ar.status == 'COMPLETED' %] + Completed + [% ELSIF ar.status == 'CANCELED' %] + Canceled + [% END %] + + + + + + + + +
    +
    + [% END %] +
    +
    + +
    + [% INCLUDE 'biblio-view-menu.inc' %] +
    +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index b251d9b..33e6259 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -124,8 +124,17 @@ var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This || ( CAN_user_borrowers && pending_borrower_modifications ) || ( CAN_user_acquisition && pendingsuggestions ) || ( CAN_user_borrowers && pending_discharge_requests ) + || pending_article_requests ) %]
    + [% IF pending_article_requests %] +
    + + Article requests: + [% pending_article_requests %] +
    + [% END %] + [% IF ( CAN_user_acquisition && pendingsuggestions ) %]
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc index d02b4c2..caafc9d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc @@ -1,3 +1,4 @@ +[% USE Biblio %]
      [% UNLESS ( norequests ) %] [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] @@ -8,6 +9,13 @@ [% END %] [% END %] [% END %] + + [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] + [% IF Koha.Preference('ArticleRequests') %] +
    • Request article
    • + [% END %] + [% END %] +
    • Print
    • [% IF Koha.Preference( 'virtualshelves' ) == 1 %] [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt new file mode 100644 index 0000000..7937292 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt @@ -0,0 +1,214 @@ +[% USE Koha %] +[% USE Branches %] +[% INCLUDE 'doc-head-open.inc' %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Request article +[% INCLUDE 'doc-head-close.inc' %] +[% BLOCK cssinclude %][% END %] + + +[% INCLUDE 'bodytag.inc' bodyid='opac-holds' %] +[% INCLUDE 'masthead.inc' %] + +
      + + +
      + [% IF biblio.can_article_request( patron ) %] + [% SET article_request_type = biblio.article_request_type( patron ) %] + + [% IF article_request_type == 'yes' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFields') %] [% END %] + [% IF article_request_type == 'bib_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsRecordOnly') %] [% END %] + [% IF article_request_type == 'item_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsItemOnly') %] [% END %] + +

      Place article request for [% biblio.title %]

      + +
      + + +
      +
        +
      • + [% IF mandatory_fields.search('title') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + [% IF mandatory_fields.search('author') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + [% IF mandatory_fields.search('volume') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + [% IF mandatory_fields.search('issue') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + [% IF mandatory_fields.search('date') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + [% IF mandatory_fields.search('pages') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + [% IF mandatory_fields.search('chapters') %] + + [% ELSE %] + + [% END %] + +
      • + +
      • + + +
      • +
      +
      + + [% IF article_request_type != 'bib_only' %] + + + + + + + + + + + + + + [% FOREACH item IN biblio.items %] + [% IF item.can_article_request( patron ) %] + + + + + + + + [% END %] + [% END %] + + [% IF article_request_type != 'item_only' %] + + + + + [% END %] + +
      Select a specific item:
       Item typeBarcodeHome libraryCall number
      + [% IF article_request_type == 'item_only' && !checked %] + [% SET checked = 1 %] + + [% ELSE %] + + [% END %] + + [% item.itype %] + + [% item.barcode %] + + [% item.homebranch %] + + [% item.itemcallnumber %] +
      + + + Any item +
      + [% END %] + + +
      + [% ELSE %] + No article requests can be made for this record. + [% END %] + +
      +
      + +[% INCLUDE 'opac-bottom.inc' %] + +[% BLOCK jsinclude %] + +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 7021638..c3cdd89 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -496,6 +496,12 @@ [% END # UNLESS SEARCH_RESULT.norequests %] [% END # IF RequestOnOpac %] + [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %] + [% IF Koha.Preference('ArticleRequests') %] + Request article + [% END %] + [% END %] + [% IF ( TagsInputEnabled ) %] [% IF ( loggedinusername ) %] Add tag diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index f31f47e..18507c5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -120,6 +120,7 @@ [% IF ( BORROWER_INFO.amountlessthanzero ) %]
    • Credits ([% BORROWER_INFO.amountoutstanding %])
    • [% END %] [% END %] [% IF ( RESERVES.count ) %]
    • Holds ([% RESERVES.count %])
    • [% END %] + [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current %]
    • Article requests ([% borrower.article_requests_current.count %])
    • [% END %]
    @@ -699,6 +700,100 @@ [% END %]
    [% END # / #RESERVES.count %] + + [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current.count %] +
    + + + + + + + + + + + + + + + + + + + + + + [% FOREACH ar IN borrower.article_requests_current %] + + + + + + + + + + + + + + + + + + + + + + + + + [% END %] + +
    Article requests ([% borrower.article_requests_current.count %] total)
    Record titlePlaced onTitleAuthorVolumeIssueDatePagesChaptersStatusPickup library 
    + + [% ar.biblio.title %] + [% ar.item.enumchron %] + + [% ar.biblio.author %] + [% IF ar.itemnumber %] (only [% ar.item.barcode %])[% END %] + + [% ar.created_on | $KohaDates %] + + [% ar.title %] + + [% ar.author %] + + [% ar.volume %] + + [% ar.issue %] + + [% ar.date %] + + [% ar.pages %] + + [% ar.chapters %] + + [% IF ar.status == 'PENDING' %] + Pending + [% ELSIF ar.status == 'PROCESSING' %] + Processing + [% ELSIF ar.status == 'COMPLETED' %] + Completed + [% ELSIF ar.status == 'CANCELED' %] + Canceled + [% END %] + + [% ar.branch.branchname %] + + Cancel: + Cancel + +
    +
    + [% END %] +
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less index 6d20cd0..87250a5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less +++ b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less @@ -266,6 +266,14 @@ td { padding-left : 21px; text-decoration : none; } + &.article_request { + background-image : url("../images/sprite.png"); /* Place hold small */ + background-position : -2px -26px; + background-repeat: no-repeat; + margin-right : 1em; + padding-left : 21px; + text-decoration : none; + } &.addtocart { background-image : url("../images/sprite.png"); /* Cart small */ background-position : -5px -572px; @@ -1338,6 +1346,7 @@ a.print-large, a.removeitems, a.removeitems.disabled, a.reserve, +a.article_request, a.send, a.tag_add, a.removefromlist, @@ -1466,6 +1475,11 @@ a.reserve { padding-left : 35px; } +a.article_request { + background-position: 0px -24px; /* Place article request */ + padding-left : 35px; +} + a.send { background-position : 2px -386px; /* Email */ text-decoration : none; @@ -2501,4 +2515,8 @@ a.reviewlink:visited { cursor: pointer; } +.btn-danger { + color: white !important; +} + @import "responsive.less"; diff --git a/mainpage.pl b/mainpage.pl index d9e01b7..eb2050e 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -30,6 +30,7 @@ use C4::Suggestions qw/CountSuggestion/; use C4::Tags qw/get_count_by_tag_status/; use Koha::Patron::Modifications; use Koha::Patron::Discharge; +use Koha::ArticleRequests; my $query = new CGI; @@ -65,9 +66,14 @@ my $branch = my $pendingcomments = numberofreviews(0); my $pendingtags = get_count_by_tag_status(0); my $pendingsuggestions = CountSuggestion("ASKED"); -my $pending_borrower_modifications = - Koha::Patron::Modifications->GetPendingModificationsCount( $branch ); +my $pending_borrower_modifications = Koha::Patron::Modifications->GetPendingModificationsCount( $branch ); my $pending_discharge_requests = Koha::Patron::Discharge::count({ pending => 1 }); +my $pending_article_requests = Koha::ArticleRequests->count( + { + status => Koha::ArticleRequest::Status::Pending, + $branch ? ( branchcode => $branch ) : (), + } +); $template->param( pendingcomments => $pendingcomments, @@ -75,6 +81,7 @@ $template->param( pendingsuggestions => $pendingsuggestions, pending_borrower_modifications => $pending_borrower_modifications, pending_discharge_requests => $pending_discharge_requests, + pending_article_requests => $pending_article_requests, ); # diff --git a/opac/opac-article-request-cancel.pl b/opac/opac-article-request-cancel.pl new file mode 100755 index 0000000..baaa0ae --- /dev/null +++ b/opac/opac-article-request-cancel.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl + +# Copyright 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::Output; +use C4::Auth; +use Koha::ArticleRequests; + +my $query = new CGI; + +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-account.tt", + query => $query, + type => "opac", + authnotrequired => 0, + debug => 1, + } +); + +my $id = $query->param('id'); + +if ( $id && $borrowernumber ) { + my $ar = Koha::ArticleRequests->find( $id ); + $ar->cancel() if $ar; +} + +print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests"); diff --git a/opac/opac-request-article-do.pl b/opac/opac-request-article-do.pl new file mode 100755 index 0000000..921b8fd --- /dev/null +++ b/opac/opac-request-article-do.pl @@ -0,0 +1,62 @@ +#!/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 ( $userid, $cookie, $sessionID ) = checkauth( $cgi, 0, {}, 'opac' ); +my $borrowernumber = C4::Context->userenv->{'number'}; + +my $biblionumber = $cgi->param('biblionumber'); +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/opac-user.pl#opac-user-article-requests"); diff --git a/opac/opac-request-article.pl b/opac/opac-request-article.pl new file mode 100755 index 0000000..a5b1b83 --- /dev/null +++ b/opac/opac-request-article.pl @@ -0,0 +1,52 @@ +#!/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::Biblios; +use Koha::Borrowers; + +my $cgi = new CGI; + +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-request-article.tt", + query => $cgi, + type => "opac", + authnotrequired => 0, + debug => 1, + } +); + +my $biblionumber = $cgi->param('biblionumber'); + +my $biblio = Koha::Biblios->find($biblionumber); +my $patron = Koha::Borrowers->find($borrowernumber); + +$template->param( + biblio => $biblio, + patron => $patron, +); + +output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 413c26d..dfa743c 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -39,6 +39,7 @@ use Koha::Patron::Debarments qw(IsDebarred); use Koha::Holds; use Koha::Database; use Koha::Patron::Messages; +use Koha::Patrons; use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; @@ -345,7 +346,7 @@ if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' } $template->param( - borrower => $borr, + borrower => Koha::Patrons->find($borrowernumber), patron_messages => $patron_messages, patronupdate => $patronupdate, OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"), diff --git a/svc/article_request b/svc/article_request new file mode 100755 index 0000000..8db68ff --- /dev/null +++ b/svc/article_request @@ -0,0 +1,63 @@ +#!/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 2 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, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +use Modern::Perl; + +use CGI; +use JSON qw(to_json); + +use C4::Auth qw(check_cookie_auth); +use Koha::ArticleRequests; + +my $cgi = new CGI; + +my ( $auth_status, $sessionID ) = + check_cookie_auth( $cgi->cookie('CGISESSID'), { circulate => 'circulate_remaining_permissions' } ); +if ( $auth_status ne "ok" ) { + exit 0; +} + +binmode STDOUT, ':encoding(UTF-8)'; +print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); + +my $id = $cgi->param('id'); +my $action = $cgi->param('action') || q{}; +my $notes = $cgi->param('notes'); + +my $ar = Koha::ArticleRequests->find($id); + +if ($ar) { + if ( $action eq 'cancel' ) { + $ar = $ar->cancel( $notes ); + } + elsif ( $action eq 'process' ) { + $ar = $ar->process(); + } + elsif ( $action eq 'complete' ) { + $ar = $ar->complete(); + } + elsif ( $action eq 'update_branchcode' ) { + my $branchcode = $cgi->param('branchcode'); + $ar->branchcode( $branchcode ) if $branchcode; + $ar = $ar->store(); + } +} + +print to_json( { success => $ar ? 1 : 0 } ); diff --git a/tools/letter.pl b/tools/letter.pl index 9f8ac95..f70fa7f 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -236,6 +236,10 @@ sub add_form { } else { push @{$field_selection}, add_fields('issues'); } + + if ( $module eq 'circulation' and $code =~ /^AR_/ ) { + push @{$field_selection}, add_fields('article_requests'); + } } $template->param( -- 2.1.4