From 5ff5863d8b1d0129d8f8b1b0b2177de1c03d95b1 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Wed, 26 May 2021 16:00:32 -0300 Subject: [PATCH] Bug 27948: Add disclaimer to article request If ArticleRequestsDisclaimerText news is set, a disclaimer text will appear before an article request can be made To test: 1. apply patches 2. enable ArticleRequest syspref 3. in OPAC place an article request for a patron CHECK => No disclaimer text should appear before placing article request 4. add a text in ArticleRequestsDisclaimerText news 5. repeat step 3 SUCCESS => A disclaimer text is shown before you can place an article request Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- .../prog/en/modules/tools/koha-news.tt | 2 +- .../en/modules/opac-request-article.tt | 320 +++++++++--------- opac/opac-request-article.pl | 12 + 3 files changed, 180 insertions(+), 154 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt index ca7fa54df6..35d7177291 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt @@ -455,7 +455,7 @@ [% END %] [% FOREACH lang_lis IN lang_list %] - [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions'] %] + [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText'] %] [% IF ( location == '' ) %] [% SET location_lang = lang_lis.language %] [% location = BLOCK %]OPAC news[% END %] 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 index 69dd4f0b58..fe44076b1a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE raw %] [% USE Branches %] [% USE ItemTypes %] [% INCLUDE 'doc-head-open.inc' %] @@ -30,172 +31,185 @@
[% IF biblio.can_article_request( patron ) %] - [% SET article_request_type = biblio.article_request_type( patron ) %] +

Place article request for [% biblio.title | html %]

+ [% IF disclaimer %] +
+ [% FOREACH disc IN disclaimer %] +

[% disc.title | html %]

+

+ [% disc.content | $raw %] +

+ [% END %] + Accept +
+ [% ELSE %] + [% 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 %] + [% 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 | html %]

-
+ Place article request - - - -
-
    -
  • - [% 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 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 != 'bib_only' %] -
    Select a specific item:
     Item typeBarcodeHome libraryCall numberEnumeration
    + [% IF article_request_type == 'item_only' && !checked %] + [% SET checked = 1 %] + + [% ELSE %] + + [% END %] + + [% ItemTypes.GetDescription( item.itype ) | html %] + + [% item.barcode | html %] + + [% Branches.GetName( item.homebranch ) | html %] + + [% item.itemcallnumber | html %] + + [% item.enumchron | html %] +
    - - - - - - - - - - - - - - [% FOREACH item IN biblio.items %] - [% IF item.can_article_request( patron ) %] + + [% IF article_request_type != 'item_only' %] - - - - - [% 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 ) | html %] - - [% item.barcode | html %] + - [% Branches.GetName( item.homebranch ) | html %] - - [% item.itemcallnumber | html %] - - [% item.enumchron | html %] + + Any item
    - - - Any item -
    - [% END %] + + + [% END %] - -
  • + + + [% END %] [% ELSE %]

    [% biblio.title | html %]

    diff --git a/opac/opac-request-article.pl b/opac/opac-request-article.pl index 6dc9189ef8..18cc70ef7f 100755 --- a/opac/opac-request-article.pl +++ b/opac/opac-request-article.pl @@ -23,6 +23,8 @@ use CGI qw ( -utf8 ); use C4::Auth; use C4::Output; +use C4::Context; +use C4::NewsChannels; use Koha::Biblios; use Koha::Patrons; @@ -39,6 +41,15 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $action = $cgi->param('action') || q{}; my $biblionumber = $cgi->param('biblionumber'); +my $homebranch = C4::Context->userenv->{'branch'} || ""; +my $location = 'ArticleRequestsDisclaimerText_'; +my $disclaimer; +if ( !$action ) { + $disclaimer = GetNewsToDisplay( $location . $template->lang, $homebranch ); + $disclaimer = GetNewsToDisplay( $location . "en", $homebranch ) + if !scalar(@$disclaimer); +} + if ( $action eq 'create' ) { my $branchcode = $cgi->param('branchcode'); @@ -80,6 +91,7 @@ my $patron = Koha::Patrons->find($borrowernumber); $template->param( biblio => $biblio, patron => $patron, + disclaimer => $disclaimer ); output_html_with_http_headers $cgi, $cookie, $template->output, undef, { force_no_caching => 1 }; -- 2.39.5