Bugzilla – Attachment 35216 Details for
Bug 10855
Custom fields for subscriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10855: Search subscriptions by additional fields on the claim page
Bug-10855-Search-subscriptions-by-additional-field.patch (text/plain), 10.50 KB, created by
Jonathan Druart
on 2015-01-14 15:32:20 UTC
(
hide
)
Description:
Bug 10855: Search subscriptions by additional fields on the claim page
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-01-14 15:32:20 UTC
Size:
10.50 KB
patch
obsolete
>From 3dafa679549a4687f3b5a435a0d7c876c2a27eb6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 29 Aug 2013 14:04:32 +0200 >Subject: [PATCH] Bug 10855: Search subscriptions by additional fields on the > claim page > >Test plan: >- create some serials in late. >- go on serials/claims.pl. >- choose a vendor. >- verify that additional fields are displayed in new columns. >- try filters on columns. >- verify there is no regression on this page. >--- > C4/Serials.pm | 8 ++ > .../prog/en/modules/serials/claims.tt | 107 +++++++-------------- > serials/claims.pl | 10 ++ > 3 files changed, 53 insertions(+), 72 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index d8b5477..5d612e1 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2015,6 +2015,7 @@ sub GetLateOrMissingIssues { > return unless ( $supplierid or $serialid ); > > my $dbh = C4::Context->dbh; >+ > my $sth; > my $byserial = ''; > if ($serialid) { >@@ -2073,6 +2074,13 @@ sub GetLateOrMissingIssues { > $line->{claimdate} = format_date( $line->{claimdate} ); > } > $line->{"status".$line->{status}} = 1; >+ >+ my $additional_field_values = Koha::AdditionalField->fetch_all_values({ >+ record_id => $line->{subscriptionid}, >+ tablename => 'subscription' >+ }); >+ %$line = ( %$line, additional_fields => $additional_field_values->{$line->{subscriptionid}} ); >+ > push @issuelist, $line; > } > return @issuelist; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >index f20b486..c3c9277 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >@@ -1,6 +1,7 @@ > [% USE Branches %] > > [% INCLUDE 'doc-head-open.inc' %] >+[% USE KohaAuthorisedValues %] > <title>Koha › Serials › Claims</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >@@ -8,8 +9,9 @@ > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > //<![CDATA[ >+ var sTable; > $(document).ready(function() { >- var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', > "aoColumnDefs": [ > { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >@@ -18,6 +20,7 @@ > ], > "bPaginate": false > })); >+ sTable.fnAddFilters("filter", "200"); > $('#supplierid').change(function() { > $('#claims').submit(); > }); >@@ -50,13 +53,6 @@ > return false; > }); > >- $("#titlefilter").keyup( function () { >- sTable.fnFilter( this.value, 3 ); // 3 is position of title column >- } ); >- >- $("#branchfilter").keyup(function() { >- sTable.fnFilter( this.value, 2 ); // 2 is the position of the author column >- }); > }); > > // Checks if the form can be sent (at least one checkbox must be checked) >@@ -67,36 +63,6 @@ > } > } > >- // Filter by status >- function filterByStatus() { >- selectedStatus = $("#statusfilter").val(); >- if (selectedStatus == "all") { >- clearFilters(); >- } else { >- $("table#claimst tbody tr").hide(); >- $("table#claimst tbody tr").each( function() { >- if ( $(this).find("span.status-" + selectedStatus).size() > 0 ) { >- $(this).show(); >- } >- }); >- } >- } >- >- // Filter by branch >- function filterByBranch() { >- selectedBranch = $("#branchfilter").val(); >- if (selectedBranch == "all") { >- clearFilters(); >- } else { >- $("table#claimst tbody tr").hide(); >- $("table#claimst tbody tr").each( function() { >- if ( $(this).find("span.branch-" + selectedBranch).size() > 0 ) { >- $(this).show(); >- } >- }); >- } >- } >- > // Filter by date > function filterByDate() { > var beginDate = Date_from_syspref($("#from").val()).getTime(); >@@ -144,6 +110,7 @@ > // Clears filters : shows everything > function clearFilters() { > $("table#claimst tbody tr").show(); >+ > } > > //]]> >@@ -209,43 +176,14 @@ > > <ol> > <li> >- <label for="statusfilter">Status : </label> >- <select id="statusfilter" onchange="filterByStatus();"> >- <option value="all" selected="selected">(All)</option> >- <option value="expected">Expected</option> >- <option value="late">Late</option> >- <option value="missing">Missing</option> >- <option value="missing_never_received">Missing (never received)</option> >- <option value="missing_sold_out">Missing (sold out)</option> >- <option value="missing_damaged">Missing (damaged)</option> >- <option value="missing_lost">Missing (lost)</option> >- <option value="claimed">Claimed</option> >- </select> >- </li> >- >- <li> >- <label for="titlefilter">Title : </label> >- <input id="titlefilter" type="text" /> >- </li> >- <li> >- <label for="branchfilter">Library: </label> >- <select id="branchfilter" onchange="filterByBranch();"> >- <option value="all" selected="selected">(All)</option> >- [% FOREACH branchloo IN branchloop %] >- <option value="[% branchloo.value %]">[% branchloo.branchname %]</option> >- [% END %] >- </select> >- </li> >- >- <li> > <label for="from">From:</label> > <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" /> > <label for="to" style="float:none;">To:</label> > <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" /> > <span class="hint">[% INCLUDE 'date-format.inc' %]</span> > <input type="button" value="OK" onclick="filterByDate();" /> >- </li> >- >+ </li> >+ > <li> > <input type="reset" value="Clear filters" onclick="clearFilters();" /> > </li> >@@ -268,13 +206,31 @@ > <th class="title-string">Since</th> > <th>Claims count</th> > <th class="title-string">Claim date</th> >+ [% FOR field IN additional_fields_for_subscription %] >+ <th>[% field.name %]</th> >+ [% END %] > </tr> > </thead> >+ <tfoot> >+ <tr> >+ <td></td> >+ <td><input type="text" class="filter" data-column_num="1" placeholder="Search vendor" /></td> >+ <td><input type="text" class="filter" data-column_num="2" placeholder="Search library" /></td> >+ <td><input type="text" class="filter" data-column_num="3" placeholder="Search title" /></td> >+ <td><input type="text" class="filter" data-column_num="4" placeholder="Search ISSN" /></td> >+ <td><input type="text" class="filter" data-column_num="5" placeholder="Search issue number" /></td> >+ <td><input type="text" class="filter" data-column_num="6" placeholder="Search status" /></td> >+ <td><input type="text" class="filter" data-column_num="7" placeholder="Search since" /></td> >+ <td><input type="text" class="filter" data-column_num="8" placeholder="Search claim count" /></td> >+ <td><input type="text" class="filter" data-column_num="9" placeholder="Search claim date" /></td> >+ [% FOR field IN additional_fields_for_subscription %] >+ <td><input type="text" class="filter" data-column_num="[% loop.count + 9 %]" placeholder="Search [% field.name %]" /></td> >+ [% END %] >+ </tr> >+ </tfoot> > <tbody>[% FOREACH missingissue IN missingissues %] > <tr> >- <td> >- <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" /> >- </td> >+ <td><input type="checkbox" name="serialid" value="[% missingissue.serialid %]" /></td> > <td>[% missingissue.name %]</td> > <td> > <span class="branch-[% missingissue.branchcode %]">[% Branches.GetName( missingissue.branchcode ) %]</span> >@@ -309,6 +265,13 @@ > <span title="0000-00-00"></span> > [% END %] > </td> >+ [% FOR field IN additional_fields_for_subscription %] >+ [% IF field.authorised_value_category %] >+ <td>[% KohaAuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) %]</td> >+ [% ELSE %] >+ <td>[% missingissue.additional_fields.${field.name} %]</td> >+ [% END %] >+ [% END %] > </tr> > [% END %]</tbody> > </table> >diff --git a/serials/claims.pl b/serials/claims.pl >index 89150a1..178092e 100755 >--- a/serials/claims.pl >+++ b/serials/claims.pl >@@ -27,6 +27,8 @@ use C4::Output; > use C4::Context; > use C4::Letters; > use C4::Branch; # GetBranches GetBranchesLoop >+use C4::Koha qw( GetAuthorisedValues ); >+use Koha::AdditionalField; > use C4::Csv qw( GetCsvProfiles ); > > my $input = CGI->new; >@@ -56,6 +58,13 @@ for my $s (@{$supplierlist} ) { > } > } > >+my $additional_fields = Koha::AdditionalField->all( { table => 'subscription', searchable => 1 } ); >+for my $field ( @$additional_fields ) { >+ if ( $field->{authorised_value_category} ) { >+ $field->{authorised_value_choices} = GetAuthorisedValues( $field->{authorised_value_category} ); >+ } >+} >+ > my $branchloop = GetBranchesLoop(); > > my @serialnums=$input->param('serialid'); >@@ -93,6 +102,7 @@ $template->param( > supplierid => $supplierid, > claimletter => $claimletter, > branchloop => $branchloop, >+ additional_fields_for_subscription => $additional_fields, > csv_profiles => C4::Csv::GetCsvProfiles( "sql" ), > letters => $letters, > (uc(C4::Context->preference("marcflavour"))) => 1 >-- >2.1.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 10855
:
20937
|
20938
|
20939
|
20940
|
20941
|
20942
|
20943
|
20944
|
21184
|
21185
|
21186
|
21187
|
21188
|
21189
|
21190
|
21191
|
21663
|
22049
|
22050
|
22051
|
22052
|
22053
|
22054
|
22055
|
22056
|
22057
|
22359
|
22360
|
22600
|
22601
|
22602
|
22603
|
22604
|
22605
|
22606
|
22607
|
22608
|
22616
|
22698
|
22699
|
22700
|
22701
|
22702
|
22703
|
22722
|
22768
|
22769
|
22869
|
23052
|
23053
|
23142
|
23143
|
23301
|
23302
|
23594
|
23595
|
23596
|
23597
|
23598
|
23599
|
23600
|
23601
|
23602
|
23774
|
23775
|
23961
|
23962
|
23963
|
23964
|
24452
|
24453
|
24454
|
24455
|
24456
|
24457
|
24569
|
24570
|
26091
|
26092
|
26093
|
26094
|
26095
|
26096
|
26097
|
26254
|
26255
|
26256
|
26257
|
26258
|
26259
|
26260
|
26276
|
26651
|
26655
|
28929
|
28930
|
28931
|
28932
|
28933
|
28934
|
28935
|
28936
|
28937
|
28938
|
28939
|
28940
|
28941
|
29095
|
29161
|
35211
|
35212
|
35213
|
35214
|
35215
|
35216
|
35217
|
35218
|
35219
|
35220
|
35221
|
35309
|
35310
|
35369
|
35556
|
36359
|
36362
|
36363
|
36364
|
36365
|
36366
|
36367
|
36368
|
36369
|
36370
|
36371
|
36372
|
36373
|
36374
|
38549
|
38550
|
38551
|
38552
|
38553
|
38554
|
38555
|
38556
|
38557
|
38558
|
38559
|
38560
|
38561
|
42296
|
42297
|
42298
|
42299
|
42300
|
42301
|
42302
|
42303
|
42304
|
42305
|
42306
|
42307
|
42308
|
42309
|
42310
|
42332
|
42333
|
43076