From 39925c4224f271cf650d56d64d6bf6f956a058bd Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Thu, 14 Jun 2018 14:26:02 +0100 Subject: [PATCH] Bug 20941: Add Illrequest->getType method This patch adds a method to the Illrequest object enabling it to return its type, which is stored as an Illrequestattribute object To observe broken state: - Do not apply patch - Ensure you have at least one Interlibrary loan created - In OPAC view, go to "your interlibrary loan requests" - => TEST: Observe that the "Request type" column is not populated - Click on "View" for one of the requests - => TEST: Observer that the "Request type" row is not populated - In Staff view, go to "ILL requests" - Click on "Manage request" on a request - => TEST: Observer that the "Request type" row is not populated To Test: - Apply patch - In OPAC view, go to "your interlibrary loan requests" - => TEST: Observe that the "Request type" column IS populated - Click on "View" for one of the requests - => TEST: Observer that the "Request type" row IS populated - In Staff view, go to "ILL requests" - Click on "Manage request" on a request - => TEST: Observer that the "Request type" row IS populated --- Koha/Illrequest.pm | 14 ++++++++++++++ .../intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 4 ++-- .../opac-tmpl/bootstrap/en/modules/opac-illrequests.tt | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 99b97bdbe4..104df11683 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -724,6 +724,20 @@ sub getPrefix { || ""; # "the empty prefix" } +=head3 getType + + my $type = $abstract->getType(); + +Return a string representing the material type of this request + +=cut + +sub getType { + my ($self) = @_; + my $attr = $self->illrequestattributes->find({ type => 'type'}); + return $attr ? $attr->value : 'N/A'; +}; + #### Illrequests Imports =head3 check_limits diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index 70f31cad16..b721b6c7bf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -436,7 +436,7 @@
  • - [% request.medium %] + [% request.getType %]
  • @@ -534,7 +534,7 @@
    Request type: - [% request.medium %] + [% request.getType %]
    Cost: diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt index 6f6d749ac2..6781fd618e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt @@ -127,7 +127,7 @@ [% request.metadata.Author || 'N/A' %] [% request.metadata.Title || 'N/A' %] [% request.backend %] - [% request.medium %] + [% request.getType %] [% request.capabilities.$status.name %] [% request.placed %] [% request.updated %] @@ -166,7 +166,7 @@
  • - [% request.medium %] + [% request.getType %]
  • -- 2.11.0