From 81a04af27804621609004dc370284413baa5caa2 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 Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- Koha/Item.pm | 2 +- admin/smart-rules.pl | 2 + circ/article-request-slip.pl | 67 +++ circ/article-requests.pl | 47 ++ circ/request-article.pl | 111 +++++ .../intranet-tmpl/prog/css/staff-global.css | 6 +- .../prog/en/includes/biblio-view-menu.inc | 7 + .../prog/en/includes/cat-toolbar.inc | 4 + .../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 | 4 + .../prog/en/modules/circ/article-requests.tt | 409 ++++++++++++++++++ .../prog/en/modules/circ/circulation-home.tt | 5 + .../prog/en/modules/circ/request-article.tt | 380 ++++++++++++++++ .../prog/en/modules/intranet-main.tt | 9 + .../en/includes/opac-detail-sidebar.inc | 11 + .../en/modules/opac-request-article.tt | 225 ++++++++++ .../bootstrap/en/modules/opac-results.tt | 6 + .../bootstrap/en/modules/opac-user.tt | 100 +++++ koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 18 + mainpage.pl | 8 + opac/opac-article-request-cancel.pl | 47 ++ opac/opac-request-article.pl | 87 ++++ opac/opac-user.pl | 3 +- svc/article_request | 63 +++ tools/letter.pl | 4 + 27 files changed, 1703 insertions(+), 5 deletions(-) create mode 100755 circ/article-request-slip.pl create mode 100755 circ/article-requests.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.pl create mode 100755 svc/article_request diff --git a/Koha/Item.pm b/Koha/Item.pm index 758d19ce23..51a5ac0794 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -164,7 +164,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 1aa6b895c8..2ceda62f88 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -152,6 +152,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"; @@ -183,6 +184,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 0000000000..6a7087d449 --- /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 0000000000..d0c2805250 --- /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.pl b/circ/request-article.pl new file mode 100755 index 0000000000..ea33b3ee5a --- /dev/null +++ b/circ/request-article.pl @@ -0,0 +1,111 @@ +#!/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::Patrons; +use Koha::ArticleRequests; + +my $cgi = new CGI; + +my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/request-article.tt", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => 'circulate_remaining_permissions' }, + } +); + +my $action = $cgi->param('action') || q{}; +my $biblionumber = $cgi->param('biblionumber'); +my $patron_cardnumber = $cgi->param('patron_cardnumber'); +my $patron_id = $cgi->param('patron_id'); + +my $biblio = Koha::Biblios->find($biblionumber); +my $patron = + $patron_id ? Koha::Patrons->find($patron_id) + : $patron_cardnumber ? Koha::Patrons->find( { cardnumber => $patron_cardnumber } ) + : undef; + +if ( $action eq 'create' ) { + 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 $patron_notes = $cgi->param('patron_notes') || 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, + patron_notes => $patron_notes, + } + )->store(); + +} + +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::Patrons->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 $cgi, $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 52ee8d47b6..c8921f9557 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -1725,8 +1725,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; @@ -1735,7 +1735,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 76c52f8010..95c0ee4640 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,5 +1,7 @@ +[% USE Koha %] [% USE Biblio %] [% SET biblio_object_id = object || biblionumber %] + 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 81c087672d..22ea57a870 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 @@ -782,3 +782,46 @@ Circulation: yes: Enable no: Disable - "housebound module" + 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 9e87404d0b..e0b92eb9ec 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 @@ -189,6 +189,7 @@ $(document).ready(function() { Holds per record (count) On shelf holds allowed Item level holds + Article requests Rental discount (%) Actions @@ -275,6 +276,17 @@ $(document).ready(function() { If any unavailable [% END %] [% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %] + + [% IF rule.article_requests == 'no' %] + No + [% ELSIF rule.article_requests == 'yes' %] + Yes + [% ELSIF rule.article_requests == 'bib_only' %] + Record only + [% ELSIF rule.article_requests == 'item_only' %] + Item only + [% END %] + [% rule.rentaldiscount %] Edit @@ -355,6 +367,14 @@ $(document).ready(function() { + + + @@ -387,6 +407,7 @@ $(document).ready(function() { Holds per record (count) On shelf holds allowed Item level holds + Article requests Rental discount (%)   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 c33463d649..2b6583bb2e 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 %] @@ -408,6 +409,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 3cecf8ac4c..031c1f8edb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -599,6 +599,10 @@ var holdForPatron = function () { [% END %] [% END # / IF intranetbookbag %] + [% 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 0000000000..7a93511e56 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt @@ -0,0 +1,409 @@ +[% 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 %] + [% IF ar.patron_notes %]

Patron notes: [% ar.patron_notes %]

[% 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 %] + [% IF ar.patron_notes %]

Patron notes: [% ar.patron_notes %]

[% 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 fdd361fbb1..48f4f8d43b 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 0000000000..9aa40d073f --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt @@ -0,0 +1,380 @@ +[% USE KohaDates %] +[% USE Branches %] +[% USE ItemTypes %] +[% 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 %] + + [% ItemTypes.GetDescription( item.itype ) %] + + [% item.barcode %] + + [% Branches.GetName( 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 onPatronTitleAuthorVolumeIssueDatePagesChaptersPatron notesItemStatusPickup 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 %][% ar.patron_notes %] + [% 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 b251d9b465..33e6259cea 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 3c14bea690..17fd0e8468 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,12 +9,21 @@ [% END %] [% END %] [% END %] +
    • Print
    • + + [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] + [% IF Koha.Preference('ArticleRequests') %] +
    • Request article
    • + [% END %] + [% END %] + [% IF Koha.Preference( 'virtualshelves' ) == 1 %] [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %]
    • Save to your lists
    • [% END %] [% END %] + [% IF Koha.Preference( 'opacbookbag' ) == 1 %] [% IF ( incart ) %]
    • In your cart (remove)
    • @@ -21,6 +31,7 @@
    • Add to your cart
    • [% END %] [% END %] + [% IF ( OpacHighlightedWords && query_desc ) %]
    • Unhighlight 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 0000000000..18036a8640 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt @@ -0,0 +1,225 @@ +[% USE Koha %] +[% USE Branches %] +[% USE ItemTypes %] +[% 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 numberEnumeration
      + [% IF article_request_type == 'item_only' && !checked %] + [% SET checked = 1 %] + + [% ELSE %] + + [% END %] + + [% ItemTypes.GetDescription( item.itype ) %] + + [% item.barcode %] + + [% Branches.GetName( item.homebranch ) %] + + [% item.itemcallnumber %] + + [% item.enumchron %] +
      + + + 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 7cd6b7a8a5..2d85671953 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -508,6 +508,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 b7ac6f93ce..a242d44a13 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -134,6 +134,7 @@ Using this account is not recommended because some parts of Koha will not functi [% IF ( BORROWER_INFO.amountlessthanzero ) %]
    • Credits ([% BORROWER_INFO.amountoutstanding | $Price %])
    • [% 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 %]
    @@ -716,6 +717,105 @@ Using this account is not recommended because some parts of Koha will not functi [% 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 onTitleAuthorVolumeIssueDatePagesChaptersNotesStatusPickup 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 %] + + [% ar.patron_notes %] + + [% 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 0bd32b45de..8fc5da43b4 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; @@ -2503,4 +2517,8 @@ a.reviewlink:visited { cursor: pointer; } +.btn-danger { + color: white !important; +} + @import "responsive.less"; diff --git a/mainpage.pl b/mainpage.pl index 258a9d5039..7410247b1d 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -30,6 +30,7 @@ use C4::Tags qw/get_count_by_tag_status/; use Koha::Patron::Modifications; use Koha::Patron::Discharge; use Koha::Reviews; +use Koha::ArticleRequests; my $query = new CGI; @@ -67,6 +68,12 @@ my $pendingtags = get_count_by_tag_status(0); my $pendingsuggestions = CountSuggestion("ASKED"); my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count( $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, @@ -74,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 0000000000..baaa0ae7c9 --- /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.pl b/opac/opac-request-article.pl new file mode 100755 index 0000000000..b7621dcf3d --- /dev/null +++ b/opac/opac-request-article.pl @@ -0,0 +1,87 @@ +#!/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::Patrons; + +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 $action = $cgi->param('action') || q{}; +my $biblionumber = $cgi->param('biblionumber'); + +if ( $action eq 'create' ) { + 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 $patron_notes = $cgi->param('patron_notes') || 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, + patron_notes => $patron_notes, + } + )->store(); + + print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests"); + exit; +} + +my $biblio = Koha::Biblios->find($biblionumber); +my $patron = Koha::Patrons->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 0ac78deccb..838a573234 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -38,6 +38,7 @@ use Koha::Holds; use Koha::Database; use Koha::Patron::Messages; use Koha::Patron::Discharge; +use Koha::Patrons; use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; @@ -324,7 +325,7 @@ if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' } $template->param( - borrower => $borr, + borrower => Koha::Patrons->find($borrowernumber), patron_messages => $patron_messages, opacnote => $borr->{opacnote}, patronupdate => $patronupdate, diff --git a/svc/article_request b/svc/article_request new file mode 100755 index 0000000000..8db68ffdec --- /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 2e5c03755c..441a05fbfb 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -234,6 +234,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.39.5