Bugzilla – Attachment 79206 Details for
Bug 15235
Add column filters to checkouts table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15235: Fix itemtype and branch filters
Bug-15235-Fix-itemtype-and-branch-filters.patch (text/plain), 5.47 KB, created by
Julian Maurice
on 2018-09-21 10:02:02 UTC
(
hide
)
Description:
Bug 15235: Fix itemtype and branch filters
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-09-21 10:02:02 UTC
Size:
5.47 KB
patch
obsolete
>From c48c87414bde593981ef9ccbae2a04ecdacfbf62 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 21 Sep 2018 11:57:02 +0200 >Subject: [PATCH] Bug 15235: Fix itemtype and branch filters > >Also: >- add a dropdown list of itemtypes to make it easier >- make the "from... to..." string translatable >--- > .../prog/en/includes/checkouts.js.inc | 4 ++++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 11 +++++++++-- > svc/checkouts | 16 ++++++++-------- > 3 files changed, 21 insertions(+), 10 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.js.inc >index fea263e555..a31e93d643 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.js.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts.js.inc >@@ -1,6 +1,8 @@ > [% USE Asset %] > [% USE Koha %] > [% USE raw %] >+[% USE ItemTypes %] >+[% USE To %] > > <script> > [% IF Koha.Preference('ServerSideCheckoutsTables') %] >@@ -10,8 +12,10 @@ > [% END %] > var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 %]; > var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride'))? 1 : 0 %]; >+ var itemtypes = [% To.json(ItemTypes.Get()) %]; > > var MSG_DT_LOADING_RECORDS = _("Loading... you may continue scanning."); >+ var MSG_COLUMN_FILTER_FROM_TO = _("From %s<br>to %s").format('{from}', '{to}'); > > var borrowernumber = "[% borrowernumber | $raw %]"; > var relatives_borrowernumbers = new Array(); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 8dacbb4d92..e72c857787 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -25,16 +25,23 @@ function disableGrouping(datatable) { > function enableFiltering(datatable) { > var oSettings = datatable.fnSettings(); > var filters_row = $(oSettings.nTable).find('thead tr.filters_row'); >+ var itemtypes_options = itemtypes.map(function (itemtype) { >+ return { >+ label: itemtype.translated_description.escapeHtml(), >+ value: itemtype.itemtype.escapeHtml(), >+ }; >+ }); > if (!filters_row.hasClass('columnFilter')) { > datatable.columnFilter({ > sPlaceHolder: "head:after", > bUseColVis: true, >- sRangeFormat: "From {from}<br>to {to}", >+ sRangeFormat: MSG_COLUMN_FILTER_FROM_TO, > aoColumns: [ > null, > null, > { type: "date-range" }, > { type: "text" }, >+ { type: "select", values: itemtypes_options }, > { type: "text" }, > { type: "text" }, > { type: "text" }, >@@ -593,7 +600,7 @@ $(document).ready(function() { > } > }, > { >- "data": "branchcode", >+ "data": "branchname", > "render": { > "display": renderers.branch > } >diff --git a/svc/checkouts b/svc/checkouts >index ee23887783..21e4ffb672 100755 >--- a/svc/checkouts >+++ b/svc/checkouts >@@ -71,8 +71,11 @@ if (!$orderby || $orderby =~ m/ORDER BY issued_today desc\s*$/) { > }; > } > >+my $item_level_itypes = C4::Context->preference('item-level_itypes'); >+my $itemtype_field = $item_level_itypes ? 'items.itype' : 'biblioitems.itemtype'; >+ > my @parameters; >-my $sql = ' >+my $sql = qq{ > SELECT SQL_CALC_FOUND_ROWS > issuedate, > date_due, >@@ -96,8 +99,7 @@ my $sql = ' > issues.branchcode, > branches.branchname, > >- items.itype, >- biblioitems.itemtype, >+ $itemtype_field AS itemtype, > > items.ccode AS collection, > >@@ -120,7 +122,7 @@ my $sql = ' > LEFT JOIN branches ON ( issues.branchcode = branches.branchcode ) > LEFT JOIN branches branches2 ON ( items.homebranch = branches2.branchcode ) > WHERE >-'; >+}; > > my $borrowernumber_sql = 'borrowernumber'; > if ( @borrowernumber == 1 ) { >@@ -148,8 +150,6 @@ my $sth = $dbh->prepare($sql); > $sth->execute(@parameters); > my ($iTotalDisplayRecords) = $dbh->selectrow_array('SELECT FOUND_ROWS()'); > >-my $item_level_itypes = C4::Context->preference('item-level_itypes'); >- > my @checkouts; > while ( my $c = $sth->fetchrow_hashref() ) { > my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} ); >@@ -170,7 +170,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { > my ( $renewals_count, $renewals_allowed, $renewals_remaining ) = > GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} ); > >- my $itemtype = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} ); >+ my $itemtype = Koha::ItemTypes->find( $c->{itemtype} ); > my $location; > if ( $c->{location} ) { > my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $c->{location} }); >@@ -196,7 +196,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { > title => $c->{title}, > author => $c->{author}, > barcode => $c->{barcode}, >- itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, >+ itemtype => $c->{itemtype}, > itemtype_description => $itemtype ? $itemtype->translated_description : q{}, > collection => $collection, > location => $location, >-- >2.17.1
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 15235
:
45096
|
60079
|
61160
|
72908
|
79205
| 79206