From cc12509c1e61c0648b57fc39b3428bb2169e303c 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 Signed-off-by: Niamh.Walker-Headon@it-tallaght.ie Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- Koha/Illrequest.pm | 14 ++++++++++++++ .../prog/en/modules/ill/ill-requests.tt | 4 ++-- .../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 cc8e321e86..a46158fa50 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -737,6 +737,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 bc6f40a936..a8ed6ebb07 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 @@ -449,7 +449,7 @@
  • - [% request.medium | html %] + [% request.getType | html %]
  • @@ -558,7 +558,7 @@
    Request type: - [% request.medium | html %] + [% request.getType | html %]
    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 0c678eedfd..e9ad1b9ff7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt @@ -135,7 +135,7 @@ [% IF request.metadata.Title %][% request.metadata.Title | html %][% ELSE %]N/A[% END %] [% request.backend | html %] - [% request.medium | html %] + [% request.getType | html %] [% request.capabilities.$status.name | html %] [% request.placed | $KohaDates %] [% request.updated | $KohaDates %] @@ -178,7 +178,7 @@
  • - [% request.medium | html %] + [% request.getType | html %]
  • -- 2.39.5