Bugzilla – Attachment 163314 Details for
Bug 28762
Item status shows incorrectly on course-details.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28762: Update item-status include
Bug-28762-Update-item-status-include.patch (text/plain), 8.46 KB, created by
Martin Renvoize (ashimema)
on 2024-03-18 12:11:08 UTC
(
hide
)
Description:
Bug 28762: Update item-status include
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-03-18 12:11:08 UTC
Size:
8.46 KB
patch
obsolete
>From 0e7eca693aacf87d113f5c06478991689299f783 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 24 Sep 2021 08:39:52 +0100 >Subject: [PATCH] Bug 28762: Update item-status include > >This patch updates the item-status include so that it expects just an >item object making if simpler and more widely re-usable. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/item-status.inc | 113 +++++++++--------- > 1 file changed, 54 insertions(+), 59 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc >index ba7e9b97375..11adad376f3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc >@@ -1,72 +1,54 @@ >-[% USE Branches %] > [% USE AuthorisedValues %] >-[% SET itemavailable = 1 %] >+[% USE Branches %] >+[% USE Koha %] >+[% USE KohaDates %] > >-[%#- This include takes two parameters: an item structure -%] >-[%#- and an optional loan (issue) structure. The issue -%] >-[%#- structure is used by course reserves pages, which do -%] >-[%#- not use an API to fetch items that populates item.datedue. -%] >+[% SET itemavailable = 1 %] > > [% IF ( item.itemlost ) %] > [% SET itemavailable = 0 %] >- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %] >- [% IF ( av_lib_include ) %] >- <span class="item-status lost">[% av_lib_include | html %]</span> >+ [% itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %] >+ [% IF ( itemlost_description ) %] >+ <span class="item-status lost">[% itemlost_description | html %]</span> > [% ELSE %] >- <span class="item-status lost">Item lost</span> >+ <span class="item-status lost">Lost</span> > [% END %] > [% END %] > >-[% IF item.isa('Koha::Item') %] >- [% SET datedue = issue.date_due %] >- [% SET onsite_checkout = issue.onsite_checkout %] >-[% ELSE %] >- [% SET datedue = item.datedue || issue.date_due %] >- [% SET onsite_checkout = item.onsite_checkout %] >-[% END %] >-[% IF datedue %] >+[% checkout = item.checkout %] >+[% IF ( checkout ) %] > [% SET itemavailable = 0 %] >- [% IF onsite_checkout %] >- [% IF ( OPACShowCheckoutName ) %] >- <span class="item-status checkedout">Currently in local use by [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]</span> >- [% ELSE %] >- <span class="item-status checkedout">Currently in local use</span> >- [% END %] >+ [% IF checkout.onsite_checkout %] >+ <span class="item-status checkedout">Currently in local use by [% INCLUDE 'patron-title.inc' patron=checkout.patron hide_patron_infos_if_needed=1 %]</span> > [% ELSE %] >- [% IF ( OPACShowCheckoutName ) %] >- <span class="item-status checkedout">Checked out to [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]</span> >- [% ELSE %] >- <span class="item-status checkedout">Checked out</span> >- [% END %] >+ <span class="item-status checkedout">Checked out to [% INCLUDE 'patron-title.inc' patron=checkout.patron hide_patron_infos_if_needed=1 %]</span> > [% END %] >+ <span class="item-status due">Due: [% checkout.date_due | $KohaDates %]</span> > [% END %] > >-[% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %] >+[% transfer = item.get_transfer %] >+[% IF ( transfer.in_transit ) %] > [% SET itemavailable = 0 %] >- <span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) | html %] >- to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]</span> >-[% END %] >- >-[% IF NOT( item.isa('Koha::Item') ) AND item.waiting %] [%# Not sure where does come from this waiting flag %] >- [% SET itemavailable = 0 %] >- <span class="item-status onhold">On hold</span> >+ <span class="item-status intransit">In transit from [% Branches.GetName( transfer.frombranch ) | html %] >+ to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]</span> > [% END %] > > [% IF ( item.withdrawn ) %] > [% SET itemavailable = 0 %] >- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %] >- [% IF av_lib_include %] >- <span class="item-status withdrawn">[% av_lib_include | html %]</span> >+ [% withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %] >+ [% IF withdrawn_description %] >+ <span class="item-status withdrawn">[% withdrawn_description | html %]</span> > [% ELSE %] >- <span class="item-status withdrawn">Item withdrawn</span> >+ <span class="item-status withdrawn">Withdrawn</span> > [% END %] > [% END %] > >-[% IF ( item.notforloan ) %] >+[% IF ( item.notforloan || item.effective_itemtype.notforloan ) %] > [% SET itemavailable = 0 %] >- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %] >- [% IF av_lib_include %] >- <span class="item-status notforloan">[% av_lib_include | html %]</span> >+ [% SET notforloan = item.notforloan || item.effective_itemtype.notforloan %] >+ [% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => notforloan ) %] >+ [% IF notforloan_description %] >+ <span class="item-status notforloan">[% notforloan_description | html %]</span> > [% ELSE %] > <span class="item-status notforloan">Not for loan</span> > [% END %] >@@ -74,21 +56,11 @@ > > [% IF ( item.damaged ) %] > [% SET itemavailable = 0 %] >- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %] >- [% IF av_lib_include %] >- <span class="item-status damaged">[% av_lib_include | html %]</span> >- [% ELSE %] >- <span class="item-status damaged">Item damaged</span> >- [% END %] >-[% END %] >- >-[% IF ( item.restricted ) %] >- [% SET itemavailable = 0 %] >- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) %] >- [% IF av_lib_include %] >- <span class="item-status restricted">[% av_lib_include | html %]</span> >+ [% damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %] >+ [% IF damaged_description %] >+ <span class="item-status damaged">[% damaged_description | html %]</span> > [% ELSE %] >- <span class="item-status restricted">On order</span> >+ <span class="item-status damaged">Damaged</span> > [% END %] > [% END %] > >@@ -97,6 +69,29 @@ > <span class="item-status pendinghold">Pending hold</span> > [% END %] > >+[% hold = item.holds.next %] >+[% IF hold %] >+ [% IF hold.waitingdate %] >+ [% SET itemavailable = 0 %] >+ <span class="item-status holdwaiting">Waiting at [% Branches.GetName(hold.get_column('branchcode')) | html %] since [% hold.waitingdate | $KohaDates %].</span> >+ [% ELSE %] >+ <span class="item-status itemhold">Item-level hold (placed [% hold.reservedate | $KohaDates %]) for delivery at [% Branches.GetName(hold.get_column('branchcode')) | html %].</span> >+ [% END %] >+ [% IF Koha.Preference('canreservefromotherbranches') %] >+ <span class="item-status holdfor">Hold for: [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]</span> >+ [% END %] >+ </span> >+[% END %] >+ > [% IF ( itemavailable ) %] > <span class="item-status available">Available</span> > [% END %] >+ >+[% IF ( item.restricted ) %] >+ [% restricted_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) %] >+ [% IF restricted_description %] >+ <span class="item-status restricted">[% restricted_description | html %]</span> >+ [% ELSE %] >+ <span class="item-status restricted">Restricted</span> >+ [% END %] >+[% END %] >-- >2.44.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 28762
:
123233
|
123234
|
123236
|
123237
|
124661
|
124666
|
124667
|
124668
|
124744
|
125220
|
125228
|
125229
|
125233
|
161563
|
161564
|
161565
|
161566
|
161567
|
161568
|
161569
|
161570
|
161571
|
161572
|
161573
|
161574
|
161584
|
161585
|
161586
|
161587
|
161588
|
161589
|
161590
|
161591
|
163310
|
163311
|
163312
|
163313
|
163314
|
163315
|
163316
|
163317
|
165843
|
165844
|
165845
|
165846
|
165847
|
165848
|
165849
|
165850
|
169172
|
169273
|
169274
|
169275
|
169276
|
169277
|
169278
|
169279
|
169280
|
169281
|
169311
|
169312
|
169313
|
169314
|
169354
|
169355
|
169356
|
169357
|
169358
|
169359
|
169360
|
169361
|
169362
|
169363
|
169364
|
169365
|
169366
|
169367
|
169393