Using only TT plugin for authorised value description is a better code.
Test plan :
Part 1:
1.1) On a catalog with items.notforloan defined with authorized values category NOT_LOAN
1.2) Define in NOT_LOAN an authorized values 1 with description 'at the beach'
1.3) Define in NOT_LOAN an authorized values 2 with description empty
Part 2:
2.1) Set preference 'AllowNotForLoanOverride' to 'Don't allow'
2.2) Edit an item with notforloan=1
2.3) Checkout this item => You see 'Item not for loan (at the beach)'
2.4) Edit an item with notforloan=2
2.5) Checkout this item => You see 'Item not for loan'
Part 3:
3.1) Set preference 'AllowNotForLoanOverride' to 'Allow'
3.2) Edit an item with notforloan=1
3.3) Checkout this item => You see 'Item is normally not for loan (at the beach)'
3.4) Edit an item with notforloan=2
3.5) Checkout this item => You see 'Item is normally not for loan'
Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit
36df53ad8d4987e938e478d934d553b73e7450f2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit
30895e2c561215fa7c094c9838021a0095a578ba)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit
11abf890e9b0d4843b5594060987028817104589)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
$template_params->{messages} = $messages;
my $item = Koha::Items->find({ barcode => $barcode });
- my ( $biblio, $mss );
+ my $biblio;
if ( $item ) {
$biblio = $item->biblio;
- my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
- $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef;
}
# Fix for bug 7494: optional checkout-time fallback search for a book
[% IF ( itemtype_notforloan ) %]
Item type is normally not for loan.
[% ELSIF ( item_notforloan ) %]
- [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
- Item is normally not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
+ [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
+ Item is normally not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib | html %])[% END %].
[% END %]
[% IF CAN_user_circulate_force_checkout %]
Check out anyway?
[% IF ( itemtype_notforloan ) %]
Item type not for loan.
[% ELSIF ( item_notforloan ) %]
- [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
- Item not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
+ [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
+ Item not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib | html %])[% END %].
[% END %]
</li>
[% END %]