Bug 20941: Add Illrequest->getType method
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Thu, 14 Jun 2018 13:26:02 +0000 (14:26 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 31 Oct 2018 13:45:55 +0000 (13:45 +0000)
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 <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha/Illrequest.pm
koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt

index cc8e321..a46158f 100644 (file)
@@ -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 : '<span>N/A</span>';
+};
+
 #### Illrequests Imports
 
 =head3 check_limits
index bc6f40a..a8ed6eb 100644 (file)
                                 </li>
                                 <li class="medium">
                                     <label class="medium">Request type:</label>
-                                    [% request.medium | html %]
+                                    [% request.getType | html %]
                                 </li>
                                 <li class="cost">
                                     <label class="cost">Cost:</label>
                                 </div>
                                 <div class="medium">
                                     <span class="label medium">Request type:</span>
-                                    [% request.medium | html %]
+                                    [% request.getType | html %]
                                 </div>
                                 <div class="cost">
                                     <span class="label cost">Cost:</span>
index 0c678ee..e9ad1b9 100644 (file)
                                         [% IF request.metadata.Title %][% request.metadata.Title | html %][% ELSE %]<span>N/A</span>[% END %]
                                     </td>
                                     <td>[% request.backend | html %]</td>
-                                    <td>[% request.medium | html %]</td>
+                                    <td>[% request.getType | html %]</td>
                                     <td>[% request.capabilities.$status.name | html %]</td>
                                     <td><span title="[% request.placed | html %]">[% request.placed | $KohaDates %]</span></td>
                                     <td><span title="[% request.updated | html %]">[% request.updated | $KohaDates %]</span></td>
                                     </li>
                                     <li>
                                         <label for="medium">Request type:</label>
-                                        [% request.medium | html %]
+                                        [% request.getType | html %]
                                     </li>
                                     <li>
                                         <label for="placed">Request placed:</label>