Bugzilla – Attachment 116240 Details for
Bug 14237
Allow bibs to be added to course without items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14237: Add individual bibliographic records to course reserves
Bug-14237-Add-individual-bibliographic-records-to-.patch (text/plain), 37.16 KB, created by
Aleisha Amohia
on 2021-02-03 01:12:57 UTC
(
hide
)
Description:
Bug 14237: Add individual bibliographic records to course reserves
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2021-02-03 01:12:57 UTC
Size:
37.16 KB
patch
obsolete
>From f99fa0f7c5185992fc38444a63174be6950466e7 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 3 Feb 2021 13:03:31 +1300 >Subject: [PATCH] Bug 14237: Add individual bibliographic records to course > reserves > >--- > C4/CourseReserves.pm | 107 ++++++++----- > course_reserves/add_items.pl | 48 +++++- > .../en/modules/course_reserves/add_items-step1.tt | 14 +- > .../en/modules/course_reserves/add_items-step2.tt | 41 ++++- > .../en/modules/course_reserves/course-details.tt | 174 +++++++++++---------- > t/db_dependent/CourseReserves/CourseItems.t | 8 + > 6 files changed, 261 insertions(+), 131 deletions(-) > >diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm >index 1c08ad4d5e..c944886471 100644 >--- a/C4/CourseReserves.pm >+++ b/C4/CourseReserves.pm >@@ -298,7 +298,7 @@ sub EnableOrDisableCourseItem { > > my $course_item = GetCourseItem( ci_id => $ci_id ); > >- my $info = GetItemCourseReservesInfo( itemnumber => $course_item->{itemnumber} ); >+ my $info = $course_item->{itemnumber} ? GetItemCourseReservesInfo( itemnumber => $course_item->{itemnumber} ) : GetItemCourseReservesInfo( biblionumber => $course_item->{biblionumber} ); > > my $enabled = any { $_->{course}->{enabled} eq 'yes' } @$info; > $enabled = $enabled ? 'yes' : 'no'; >@@ -424,11 +424,21 @@ sub GetCourseItem { > > my $ci_id = $params{'ci_id'}; > my $itemnumber = $params{'itemnumber'}; >+ my $biblionumber = $params{'biblionumber'}; > >- return unless ( $itemnumber || $ci_id ); >+ return unless ( $itemnumber || $biblionumber || $ci_id ); > >- my $field = ($itemnumber) ? 'itemnumber' : 'ci_id'; >- my $value = ($itemnumber) ? $itemnumber : $ci_id; >+ my ( $field, $value ); >+ if ( $itemnumber ) { >+ $field = 'itemnumber'; >+ $value = $itemnumber; >+ } elsif ( $biblionumber ) { >+ $field = 'biblionumber'; >+ $value = $biblionumber; >+ } else { >+ $field = 'ci_id'; >+ $value = $ci_id; >+ } > > my $query = "SELECT * FROM course_items WHERE $field = ?"; > my $dbh = C4::Context->dbh; >@@ -462,10 +472,16 @@ sub ModCourseItem { > warn identify_myself(%params) if $DEBUG; > > my $itemnumber = $params{'itemnumber'}; >+ my $biblionumber = $params{'biblionumber'}; > >- return unless ($itemnumber); >+ return unless ($itemnumber || $biblionumber); > >- my $course_item = GetCourseItem( itemnumber => $itemnumber ); >+ my $course_item = $itemnumber ? GetCourseItem( itemnumber => $itemnumber ) : GetCourseItem( biblionumber => $biblionumber ); >+ >+ if ( $itemnumber and !$biblionumber ) { >+ $biblionumber = Koha::Items->find( $itemnumber )->biblionumber; >+ $params{biblionumber} = $biblionumber; >+ } > > my $ci_id; > >@@ -504,6 +520,7 @@ sub _AddCourseItem { > my $ci = Koha::Course::Item->new( > { > itemnumber => $params{itemnumber}, >+ biblionumber => $params{biblionumber}, > %data, > %enabled, > } >@@ -535,36 +552,39 @@ sub _UpdateCourseItem { > my %data = map { $_ => $params{$_} } @FIELDS; > my %enabled = map { $_ . "_enabled" => $params{ $_ . "_enabled" } } @FIELDS; > >- my $item = Koha::Items->find( $course_item->itemnumber ); >- >- # Handle updates to changed fields for a course item, both adding and removing >- if ( $course_item->is_enabled ) { >- my $item_fields = {}; >- >- for my $field ( @FIELDS ) { >- >- my $field_enabled = $field . '_enabled'; >- my $field_storage = $field . '_storage'; >- >- # Find newly enabled field and add item value to storage >- if ( $params{$field_enabled} && !$course_item->$field_enabled ) { >- $enabled{$field_storage} = $item->$field; >- $item_fields->{$field} = $params{$field}; >- } >- # Find newly disabled field and copy the storage value to the item, unset storage value >- elsif ( !$params{$field_enabled} && $course_item->$field_enabled ) { >- $item_fields->{$field} = $course_item->$field_storage; >- $enabled{$field_storage} = undef; >- } >- # The field was already enabled, copy the incoming value to the item. >- # The "original" ( when not on course reserve ) value is already in the storage field >- elsif ( $course_item->$field_enabled) { >- $item_fields->{$field} = $params{$field}; >+ if ( $course_item->itemnumber ) { >+ # biblio-level course items don't store any of these fields >+ my $item = Koha::Items->find( $course_item->itemnumber ); >+ >+ # Handle updates to changed fields for a course item, both adding and removing >+ if ( $course_item->is_enabled ) { >+ my $item_fields = {}; >+ >+ for my $field ( @FIELDS ) { >+ >+ my $field_enabled = $field . '_enabled'; >+ my $field_storage = $field . '_storage'; >+ >+ # Find newly enabled field and add item value to storage >+ if ( $params{$field_enabled} && !$course_item->$field_enabled ) { >+ $enabled{$field_storage} = $item->$field; >+ $item_fields->{$field} = $params{$field}; >+ } >+ # Find newly disabled field and copy the storage value to the item, unset storage value >+ elsif ( !$params{$field_enabled} && $course_item->$field_enabled ) { >+ $item_fields->{$field} = $course_item->$field_storage; >+ $enabled{$field_storage} = undef; >+ } >+ # The field was already enabled, copy the incoming value to the item. >+ # The "original" ( when not on course reserve ) value is already in the storage field >+ elsif ( $course_item->$field_enabled) { >+ $item_fields->{$field} = $params{$field}; >+ } > } >- } > >- $item->set( $item_fields )->store >- if keys %$item_fields; >+ $item->set( $item_fields )->store >+ if keys %$item_fields; >+ } > } > > $course_item->update( { %data, %enabled } ); >@@ -850,7 +870,7 @@ sub GetCourseReserves { > my $value = ($course_id) ? $course_id : $ci_id; > > my $query = " >- SELECT cr.*, ci.itemnumber >+ SELECT cr.*, ci.itemnumber, ci.biblionumber > FROM course_reserves cr, course_items ci > WHERE cr.$field = ? > AND cr.ci_id = ci.ci_id >@@ -864,7 +884,7 @@ sub GetCourseReserves { > if ($include_items) { > foreach my $cr (@$course_reserves) { > my $item = Koha::Items->find( $cr->{itemnumber} ); >- my $biblio = $item->biblio; >+ my $biblio = $cr->{itemnumber} ? $item->biblio : Koha::Biblios->find( $cr->{biblionumber} ); > my $biblioitem = $biblio->biblioitem; > $cr->{'course_item'} = GetCourseItem( ci_id => $cr->{'ci_id'} ); > $cr->{'item'} = $item; >@@ -882,7 +902,7 @@ sub GetCourseReserves { > > if ($include_courses) { > foreach my $cr (@$course_reserves) { >- $cr->{'courses'} = GetCourses( itemnumber => $cr->{'itemnumber'} ); >+ $cr->{'courses'} = $cr->{itemnumber} ? GetCourses( itemnumber => $cr->{'itemnumber'} ) : GetCourses( biblionumber => $cr->{biblionumber} ); > } > } > >@@ -924,6 +944,7 @@ sub DelCourseReserve { > =head2 GetItemCourseReservesInfo > > my $arrayref = GetItemCourseReservesInfo( itemnumber => $itemnumber ); >+ my $arrayref = GetItemCourseReservesInfo( biblionumber => $biblionumber ); > > For a given item, returns an arrayref of reserves hashrefs, > with a course hashref under the key 'course' >@@ -935,10 +956,11 @@ sub GetItemCourseReservesInfo { > warn identify_myself(%params) if $DEBUG; > > my $itemnumber = $params{'itemnumber'}; >+ my $biblionumber = $params{'biblionumber'}; > >- return unless ($itemnumber); >+ return unless ($itemnumber || $biblionumber); > >- my $course_item = GetCourseItem( itemnumber => $itemnumber ); >+ my $course_item = $itemnumber ? GetCourseItem( itemnumber => $itemnumber ) : GetCourseItem( biblionumber => $biblionumber ); > > return unless ( keys %$course_item ); > >@@ -958,6 +980,8 @@ sub GetItemCourseReservesInfo { > ci_id - course_item id > OR > itemnumber - course_item itemnumber >+ OR >+ biblionumber - course_item biblionumber > > enabled = 'yes' or 'no' > Optional, if not supplied, counts reserves >@@ -972,10 +996,11 @@ sub CountCourseReservesForItem { > my $ci_id = $params{'ci_id'}; > my $itemnumber = $params{'itemnumber'}; > my $enabled = $params{'enabled'}; >+ my $biblionumber = $params{'biblionumber'}; > >- return unless ( $ci_id || $itemnumber ); >+ return unless ( $ci_id || ( $itemnumber || $biblionumber ) ); > >- my $course_item = GetCourseItem( ci_id => $ci_id, itemnumber => $itemnumber ); >+ my $course_item = $itemnumber ? GetCourseItem( ci_id => $ci_id, itemnumber => $itemnumber ) : GetCourseItem( ci_id => $ci_id, biblionumber => $biblionumber ); > > my @params = ( $course_item->{'ci_id'} ); > push( @params, $enabled ) if ($enabled); >diff --git a/course_reserves/add_items.pl b/course_reserves/add_items.pl >index 7c16a143f5..8fc8553b4a 100755 >--- a/course_reserves/add_items.pl >+++ b/course_reserves/add_items.pl >@@ -41,15 +41,27 @@ my $barcode = $cgi->param('barcode') || ''; > my $return = $cgi->param('return') || ''; > my $itemnumber = $cgi->param('itemnumber') || ''; > my $is_edit = $cgi->param('is_edit') || ''; >+my $biblionumber = $cgi->param('biblionumber') || ''; > > $barcode =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace >+$biblionumber =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace >+ >+my ( $item, $biblio ); >+ >+if ( $barcode || $itemnumber ) { >+ # adding an item to course items >+ $item = $itemnumber ? Koha::Items->find( $itemnumber ) : Koha::Items->find({ barcode => $barcode }); >+ $itemnumber = $item->id; >+ $biblio = $item->biblio; >+ $biblionumber = $biblio->biblionumber; >+} else { >+ # adding a biblio to course items >+ $biblio = Koha::Biblios->find( $biblionumber ); >+} > >-my $item = Koha::Items->find( { ( $itemnumber ? ( itemnumber => $itemnumber ) : ( barcode => $barcode ) ) } ); >-$itemnumber = $item->id if $item; >- >-my $title = ($item) ? $item->biblio->title : undef; >+my $title = $biblio->title if $biblio; > >-my $step = ( $action eq 'lookup' && $item ) ? '2' : '1'; >+my $step = ( $action eq 'lookup' && ( $item or $biblio ) ) ? '2' : '1'; > > my $tmpl = ($course_id) ? "add_items-step$step.tt" : "invalid-course.tt"; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -60,9 +72,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-if ( !$item && $action eq 'lookup' ){ >+if ( !$item && !$biblio && $action eq 'lookup' ){ > $template->param( ERROR_ITEM_NOT_FOUND => 1 ); > $template->param( UNKNOWN_BARCODE => $barcode ) if $barcode; >+ $template->param( UNKNOWN_BIBLIONUMBER => $biblionumber ) if $biblionumber; > } > > $template->param( course => GetCourse($course_id) ); >@@ -80,7 +93,7 @@ if ( $action eq 'lookup' and $item ) { > my $itemtypes = Koha::ItemTypes->search; > $template->param( > item => $item, >- biblio => $item->biblio, >+ biblio => $biblio, > course_item => $course_item, > course_reserve => $course_reserve, > is_edit => $is_edit, >@@ -91,6 +104,26 @@ if ( $action eq 'lookup' and $item ) { > return => $return, > ); > >+} elsif ( $action eq 'lookup' and $biblio ) { >+ my $course_item = Koha::Course::Items->find({ biblionumber => $biblio->biblionumber }); >+ my $course_reserve = >+ ($course_item) >+ ? GetCourseReserve( >+ course_id => $course_id, >+ ci_id => $course_item->ci_id, >+ ) >+ : undef; >+ >+ my $itemtypes = Koha::ItemTypes->search; >+ $template->param( >+ biblio => $biblio, >+ course_item => $course_item, >+ course_reserve => $course_reserve, >+ is_edit => $is_edit, >+ >+ return => $return, >+ ); >+ > } elsif ( $action eq 'add' ) { > my $itype = scalar $cgi->param('itype'); > my $ccode = scalar $cgi->param('ccode'); >@@ -106,6 +139,7 @@ if ( $action eq 'lookup' and $item ) { > > my $ci_id = ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype => $itype, > ccode => $ccode, > homebranch => $homebranch, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt >index 428e293713..9426067738 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt >@@ -16,8 +16,10 @@ > [% IF ERROR_ITEM_NOT_FOUND %] > [% IF UNKNOWN_BARCODE %] > <div class="dialog alert">No item found with barcode [% UNKNOWN_BARCODE | html %]</div> >+ [% ELSIF UNKNOWN_BIBLIONUMBER %] >+ <div class="dialog alert">No bibliographic record found with biblionumber [% UNKNOWN_BIBLIONUMBER | html %]</div> > [% ELSE %] >- <div class="dialog alert">No item found</div> >+ <div class="dialog alert">No item or bibliographic record found</div> > [% END %] > [% END %] > >@@ -35,6 +37,16 @@ > </ol> > </fieldset> > >+ <fieldset class="rows"> >+ <legend>Or use biblionumber of a bibliographic record</legend> >+ <ol> >+ <li> >+ <label class="required" for="biblionumber">Biblionumber:</label> >+ <input id="biblionumber" name="biblionumber" type="text" /> >+ </li> >+ </ol> >+ </fieldset> >+ > <fieldset class="action"> > <input type="submit" value="Submit" class="submit" /> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt >index 9c12bc05db..e1ed6363e3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt >@@ -17,13 +17,21 @@ > <div class="col-md-8 col-md-offset-2"> > > [% 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.count | html %]</div>[% END %] >+ [% IF course_item %] >+ [% IF item %] >+ <div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.count | html %]</div> >+ [% ELSE %] >+ <div class="dialog message" id="already_on_reserve">Number of courses reserving this bibliographic record: [% course_item.course_reserves.count | html %]</div> >+ [% END %] >+ [% END %] > > <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl"> > <input type="hidden" name="course_id" value="[% course.course_id | html %]" /> > <input type="hidden" name="return" value="[% return | html %]" /> > <input type="hidden" name="action" value="add" /> > >+ [% IF item # adding an item to course items %] >+ > <fieldset class="rows"> > [% IF is_edit || course_reserve %] > <legend>Edit <em>[% biblio.title | html %]</em> in <em>[% course.course_name | html %]</em></legend> >@@ -35,6 +43,7 @@ > <span class="label">Barcode:</span> > <span id="barcode">[% item.barcode | html %]</span> > <input type="hidden" name="itemnumber" value="[% item.itemnumber | html %]" /> >+ <input type="hidden" name="biblionumber" value="[% item.biblionumber | html %]" /> > </li> > > [% IF item_level_itypes %] >@@ -185,6 +194,36 @@ > Checking the box next to the field label will enable changes to that field. Leave boxes unchecked to make no change.<br> > Any items with existing course reserves will have their <em>on reserve</em> values updated. > </p> >+ >+ [% ELSE # adding a biblio to course items %] >+ >+ <fieldset class="rows"> >+ [% IF is_edit || course_reserve %] >+ <legend>Edit <em>[% biblio.title | html %]</em> in <em>[% course.course_name | html %]</em></legend> >+ [% ELSE %] >+ <legend>Add <em>[% biblio.title | html %]</em> to <em>[% course.course_name | html %]</em></legend> >+ [% END %] >+ <ol> >+ <li> >+ <span class="label">Biblionumber:</span> >+ <span id="biblionumber">[% biblio.biblionumber | html %]</span> >+ <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" /> >+ </li> >+ >+ <li> >+ <label for="staff_note">Staff note:</label> >+ <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note | html %]</textarea> >+ </li> >+ >+ <li> >+ <label for="public_note">Public note:</label> >+ <textarea name="public_note" id="public_note">[% course_reserve.public_note | html %]</textarea> >+ </li> >+ >+ </ol> >+ </fieldset> >+ >+ [% END %] > <fieldset class="action"> > <input type="submit" id="submit" value="Save" class="submit focus" /> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt >index 2ea511a363..3d7db4abba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt >@@ -102,106 +102,118 @@ > <tr> > <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=cr.biblio %]</a></td> > <td>[% cr.biblio.author | html %]</td> >- <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber | uri %]&biblionumber=[% cr.biblio.biblionumber | uri %]&bi=[% cr.biblioitem.biblioitemnumber | uri %]">[% cr.item.barcode | html %]</a></td> >- <td>[% cr.item.itemcallnumber | html %]</td> >- [% IF item_level_itypes %] >- <td> >- [% IF cr.course_item.itype_enabled %] >- [% IF cr.course_item.enabled == 'yes' %] >- <strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype ) | html %]</strong> >- ([% ItemTypes.GetDescription( cr.course_item.itype_storage ) | html %]) >+ >+ [% IF cr.item %] >+ <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber | uri %]&biblionumber=[% cr.biblio.biblionumber | uri %]&bi=[% cr.biblioitem.biblioitemnumber | uri %]">[% cr.item.barcode | html %]</a></td> >+ <td>[% cr.item.itemcallnumber | html %]</td> >+ [% IF item_level_itypes %] >+ <td> >+ [% IF cr.course_item.itype_enabled %] >+ [% IF cr.course_item.enabled == 'yes' %] >+ <strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype ) | html %]</strong> >+ ([% ItemTypes.GetDescription( cr.course_item.itype_storage ) | html %]) >+ [% ELSE %] >+ [% ItemTypes.GetDescription( cr.course_item.itype ) | html %] >+ (<strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype) | html %]</strong>) >+ [% END %] > [% ELSE %] >- [% ItemTypes.GetDescription( cr.course_item.itype ) | html %] >- (<strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype) | html %]</strong>) >+ <em>Unchanged</em> >+ [% IF cr.item.itype %] >+ ([% ItemTypes.GetDescription( cr.item.itype ) | html %]) >+ [% END %] > [% END %] >- [% ELSE %] >- <em>Unchanged</em> >- [% IF cr.item.itype %] >- ([% ItemTypes.GetDescription( cr.item.itype ) | html %]) >- [% END %] >+ </td> > [% END %] >- </td> >- [% END %] >- <td> >- [% IF cr.course_item.ccode_enabled %] >- [% IF cr.course_item.enabled == 'yes' %] >- <strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong> >- [% IF cr.item.ccode %] >- ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode_storage ) | html %]) >- [% END %] >- [% ELSE %] >- [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode ) | html %] >- [% IF cr.item.ccode %] >- (<strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>) >- [% END %] >- [% END %] >- [% ELSE %] >- <em>Unchanged</em> >- [% IF cr.item.ccode %] >- ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]) >- [% END %] >- [% END %] >- </td> >- <td> >- [% IF cr.course_item.location_enabled %] >- [% IF cr.course_item.enabled == 'yes' %] >- <strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong> >- [% IF cr.item.permanent_location %] >- ([% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location_storage ) | html %]) >+ <td> >+ [% IF cr.course_item.ccode_enabled %] >+ [% IF cr.course_item.enabled == 'yes' %] >+ <strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong> >+ [% IF cr.item.ccode %] >+ ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode_storage ) | html %]) >+ [% END %] >+ [% ELSE %] >+ [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode ) | html %] >+ [% IF cr.item.ccode %] >+ (<strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>) >+ [% END %] >+ [% END %] >+ [% ELSE %] >+ <em>Unchanged</em> >+ [% IF cr.item.ccode %] >+ ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]) >+ [% END %] >+ [% END %] >+ </td> >+ <td> >+ [% IF cr.course_item.location_enabled %] >+ [% IF cr.course_item.enabled == 'yes' %] >+ <strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong> >+ [% IF cr.item.permanent_location %] >+ ([% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location_storage ) | html %]) >+ [% END %] >+ [% ELSE %] >+ [% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) | html %] >+ [% IF cr.item.permanent_location %] >+ (<strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>) >+ [% END %] > [% END %] > [% ELSE %] >- [% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) | html %] >+ <em>Unchanged</em> > [% IF cr.item.permanent_location %] >- (<strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>) >+ ([% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]) > [% END %] > [% END %] >- [% ELSE %] >- <em>Unchanged</em> >- [% IF cr.item.permanent_location %] >- ([% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]) >- [% END %] >- [% END %] >- </td> >- <td> >- [% IF cr.course_item.homebranch_enabled %] >- [% IF cr.course_item.enabled == 'yes' %] >- <strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong> >- [% IF cr.item.homebranch %] >- ([% Branches.GetName( cr.course_item.homebranch_storage ) | html %]) >+ </td> >+ <td> >+ [% IF cr.course_item.homebranch_enabled %] >+ [% IF cr.course_item.enabled == 'yes' %] >+ <strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong> >+ [% IF cr.item.homebranch %] >+ ([% Branches.GetName( cr.course_item.homebranch_storage ) | html %]) >+ [% END %] >+ [% ELSE %] >+ [% Branches.GetName( cr.course_item.homebranch ) | html %] >+ [% IF cr.item.homebranch %] >+ (<strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>) >+ [% END %] > [% END %] > [% ELSE %] >- [% Branches.GetName( cr.course_item.homebranch ) | html %] >+ <em>Unchanged</em> > [% IF cr.item.homebranch %] >- (<strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>) >+ ([% Branches.GetName( cr.item.homebranch ) | html %]) > [% END %] > [% END %] >- [% ELSE %] >- <em>Unchanged</em> >- [% IF cr.item.homebranch %] >- ([% Branches.GetName( cr.item.homebranch ) | html %]) >- [% END %] >- [% END %] >- </td> >- <td> >- [% IF cr.course_item.holdingbranch_enabled %] >- [% IF cr.course_item.enabled == 'yes' %] >- <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong> >- [% IF cr.item.holdingbranch %] >- ([% Branches.GetName( cr.course_item.holdingbranch_storage ) | html %]) >+ </td> >+ <td> >+ [% IF cr.course_item.holdingbranch_enabled %] >+ [% IF cr.course_item.enabled == 'yes' %] >+ <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong> >+ [% IF cr.item.holdingbranch %] >+ ([% Branches.GetName( cr.course_item.holdingbranch_storage ) | html %]) >+ [% END %] >+ [% ELSE %] >+ [% Branches.GetName( cr.course_item.holdingbranch ) | html %] >+ [% IF cr.item.holdingbranch %] >+ (<strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>) >+ [% END %] > [% END %] > [% ELSE %] >- [% Branches.GetName( cr.course_item.holdingbranch ) | html %] >+ <em>Unchanged</em> > [% IF cr.item.holdingbranch %] >- (<strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>) >+ ([% Branches.GetName( cr.item.holdingbranch ) | html %]) > [% END %] > [% END %] >+ </td> >+ [% ELSE # record-level course reserve %] >+ [% IF ( item_level_itypes ) %] >+ <td colspan="7"> > [% ELSE %] >- <em>Unchanged</em> >- [% IF cr.item.holdingbranch %] >- ([% Branches.GetName( cr.item.holdingbranch ) | html %]) >- [% END %] >+ <td colspan="6"> > [% END %] >- </td> >+ <em>Information not available for record-level course reserve</em> >+ </td> >+ [% END %] >+ > <td>[% IF (cr.staff_note) %] > [% cr.staff_note | html %] > [% ELSIF (cr.item.itemnotes_nonpublic) %] >@@ -250,7 +262,7 @@ > [% 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 | html %]&itemnumber=[% cr.item.itemnumber | html %]&action=lookup&return=[% course.course_id | html %]&is_edit=1"><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 %]&itemnumber=[% cr.item.itemnumber | html %]&biblionumber=[% cr.biblio.biblionumber | html %]&action=lookup&return=[% course.course_id | html %]&is_edit=1"><i class="fa fa-pencil"></i> Edit</a> > [% END %] > > [% IF CAN_user_coursereserves_delete_reserves %] >diff --git a/t/db_dependent/CourseReserves/CourseItems.t b/t/db_dependent/CourseReserves/CourseItems.t >index b34da74a7d..6cf0fcdbc9 100755 >--- a/t/db_dependent/CourseReserves/CourseItems.t >+++ b/t/db_dependent/CourseReserves/CourseItems.t >@@ -39,6 +39,7 @@ my ($biblionumber, $itemnumber) = create_bib_and_item(); > > my $ci_id = ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype_enabled => 1, > ccode_enabled => 1, > homebranch_enabled => 1, >@@ -82,6 +83,7 @@ is($item->location, 'TH', 'Item location in course should be TH'); > > ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype_enabled => 1, > ccode_enabled => 1, > homebranch_enabled => 1, >@@ -158,6 +160,7 @@ is($course_item2->{ccode_storage}, '', 'Course item ccode storage should be empt > > ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype_enabled => 1, > ccode_enabled => 1, > homebranch_enabled => 1, >@@ -182,6 +185,7 @@ is($item->ccode, 'DVD', 'Item ccode should be DVD'); > > ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype_enabled => 1, > ccode_enabled => 1, > homebranch_enabled => 0, # LEAVE UNCHANGED >@@ -208,6 +212,7 @@ subtest 'Ensure modifying fields on existing course items updates the item and c > my ($biblionumber, $itemnumber) = create_bib_and_item(); > my $ci_id = ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype_enabled => 0, > ccode_enabled => 0, > homebranch_enabled => 0, >@@ -299,6 +304,7 @@ subtest 'Ensure modifying fields on existing course items updates the item and c > # Test removing fields from an active course item > ModCourseItem( > itemnumber => $itemnumber, >+ biblionumber => $biblionumber, > itype_enabled => 0, > ccode_enabled => 0, > homebranch_enabled => 0, >@@ -346,6 +352,7 @@ subtest 'Ensure item info is preserved' => sub { > #Add course item but change nothing > my $course_item_id = ModCourseItem( > itemnumber => $item->itemnumber, >+ biblionumber => $biblionumber, > itype => '', > ccode => '', > holdingbranch => '', >@@ -376,6 +383,7 @@ subtest 'Ensure item info is preserved' => sub { > #Add course item but change nothing > $course_item_id = ModCourseItem( > itemnumber => $item->itemnumber, >+ biblionumber => $biblionumber, > itype => '', > ccode => '', > holdingbranch => '', >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14237
:
116236
|
116237
|
116238
|
116239
|
116240
|
116535
|
116619
|
116638
|
116652
|
116653
|
116654
|
118220
|
118221
|
118222
|
118223
|
120128
|
120129
|
120130
|
120131
|
120132
|
120652
|
120659
|
121876
|
121877
|
121878
|
121879
|
121880
|
121881