Bug 21003: Removed warning and changed wording on add_items-step2.tt
authorHayley Mapley <hayleymapley@catalyst.net.nz>
Thu, 7 Mar 2019 02:50:12 +0000 (02:50 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Mon, 15 Apr 2019 17:42:54 +0000 (17:42 +0000)
When editing an item in a Course Reserve, the page displayed is the same
that is displayed when adding an item to a Course Reserve. This patch
removes the warning 'This course already has this item on reserve' when
the item is being edited, as well as changes the title, breadcrumbs, and
header of the div. This patch also Changes the header of the div to say
'Edit 'book_name' in 'course_name'' instead of 'Add 'book_name' to
'course_name'' when adding items to a course reserve if the item is
already present.

To test:
1) Create a new course in Course Reserves (you will need Course
    Reserves enabled in syspref)
2) Add an item by clicking the Add reserves button
3) Click the edit button on the right hand side of the item listing
under the Reserves heading
4) Observe that the warning 'The course already has this item on reserve' appears, and that the title, breadcrumbs and
header of the div all say Add/Reserve
5) Apply the patch
6) Repeat step 3 and observe that the title, breadcrumbs and header of
the div now say Edit
7) Also verify that when adding a reserve with a barcode that does not
yet exist in the course reserves that the warning 'The course already...' is not displayed and that the header of the div says Add
8) Finally verify that when adding a reserve with a barcode that DOES
exist in the course reserves that the warning 'The course already...' IS
displayed and the header of the div says Edit
9) Sign off!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3eee6f3091fcb621152af7f4db6441c98cb74558)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7c39ad305da2c337743fc5122c5a7b5220dea98f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

course_reserves/add_items.pl
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt

index ff398b9..42416b3 100755 (executable)
@@ -40,6 +40,7 @@ my $course_id    = $cgi->param('course_id')    || '';
 my $barcode      = $cgi->param('barcode')      || '';
 my $return       = $cgi->param('return')       || '';
 my $itemnumber   = ($cgi->param('itemnumber') && $action eq 'lookup') ? $cgi->param('itemnumber') : '';
+my $is_edit      = $cgi->param('is_edit')      || '';
 
 my $item = Koha::Items->find( { ( $itemnumber ? ( itemnumber => $itemnumber ) : ( barcode => $barcode ) ) } );
 my $title = ($item) ? $item->biblio->title : undef;
@@ -79,6 +80,7 @@ if ( $action eq 'lookup' and $item ) {
         biblio         => $item->biblio,
         course_item    => $course_item,
         course_reserve => $course_reserve,
+        is_edit        => $is_edit,
 
         ccodes    => GetAuthorisedValues('CCODE'),
         locations => GetAuthorisedValues('LOC'),
index 5f76eb5..522f4aa 100644 (file)
@@ -1,6 +1,6 @@
 [% USE Branches %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
+<title>Koha &rsaquo; Course reserves &rsaquo;[% IF is_edit %] Edit item[% ELSE %]Add items[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 
@@ -9,14 +9,14 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Reserve <i><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></i> for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo;[% IF is_edit %] Edit [% ELSE %] Reserve [% END %]<i><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | html %]">[% biblio.title | html %]</a></i> for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | html %]">[% course.course_name | html %]</a></i></div>
 
 <div class="main container-fluid">
     <div class="row">
         <div class="col-md-8 col-md-offset-2">
 
-        [% IF course_reserve %]<div class="dialog message" id="already_on_reserve_this">This course already has this item on reserve.</div>[% END %]
-        [% IF course_item %]<div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.size %]</div>[% END %]
+        [% IF course_reserve && !is_edit%]<div class="dialog message" id="already_on_reserve_this">This course already has this item on reserve.</div>[% END %]
+        [% IF course_item %]<div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.size | html %]</div>[% END %]
 
         <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
             <input type="hidden" name="course_id" value="[% course.course_id %]" />
             <input type="hidden" name="action" value="add" />
 
             <fieldset class="rows">
-                <legend>Add <i>[% biblio.title %]</i> to <i>[% course.course_name %]</i></legend>
+                [% IF is_edit || course_reserve %]
+                    <legend>Edit <i>[% biblio.title | html %]</i> in <i>[% course.course_name | html %]</i></legend>
+                [% ELSE %]
+                    <legend>Add <i>[% biblio.title | html %]</i> to <i>[% course.course_name | html %]</i></legend>
+                [% END %]
                 <ol>
                     <li>
                         <span class="label">Barcode:</span>
index f17c19a..83061f8 100644 (file)
                             [% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
                                 <td class="actions">
                                     [% IF CAN_user_coursereserves_add_reserves %]
-                                        <a class="btn btn-default btn-xs" href="add_items.pl?course_id=[% course.course_id %]&amp;itemnumber=[% cr.item.itemnumber %]&amp;action=lookup&amp;return=[% course.course_id %]"><i class="fa fa-pencil"></i> Edit</a>
+                                        <a class="btn btn-default btn-xs" href="add_items.pl?course_id=[% course.course_id | html %]&amp;itemnumber=[% cr.item.itemnumber | html %]&amp;action=lookup&amp;return=[% course.course_id | html %]&amp;is_edit=1"><i class="fa fa-pencil"></i> Edit</a>
                                     [% END %]
 
                                     [% IF CAN_user_coursereserves_delete_reserves %]