Bugzilla – Attachment 26091 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), 9.88 KB, created by
Jonathan Druart
on 2014-03-11 11:35:24 UTC
(
hide
)
Description:
Bug 10855: Search subscriptions by additional fields on the claim page
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-03-11 11:35:24 UTC
Size:
9.88 KB
patch
obsolete
>From cb26c0c5870927614819683e9951916ebdd9446a 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 | 105 +++++++------------- > serials/claims.pl | 10 ++ > 3 files changed, 53 insertions(+), 70 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 385d504..e12f885 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2046,6 +2046,7 @@ sub GetLateOrMissingIssues { > return unless ( $supplierid or $serialid ); > > my $dbh = C4::Context->dbh; >+ > my $sth; > my $byserial = ''; > if ($serialid) { >@@ -2101,6 +2102,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 288620b..c802aba 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' %] >@@ -11,15 +12,17 @@ > <script type="text/javascript"> > //<![CDATA[ > [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %] >+ var sTable; > $(document).ready(function() { > [% UNLESS ( preview ) %] >- var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', > "aoColumnDefs": [ >- { "aTargets": [ 0,1 ], "bSortable": false, "bSearchable": false } >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false } > ], > "bPaginate": false > })); >+ sTable.fnAddFilters("filter", "200"); > [% END %] > $('#supplierid').change(function() { > $('#claims').submit(); >@@ -53,13 +56,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) >@@ -70,36 +66,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(); >@@ -147,6 +113,7 @@ > // Clears filters : shows everything > function clearFilters() { > $("table#claimst tbody tr").show(); >+ > } > > function popup(supplierid,serialid){ >@@ -210,43 +177,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> >@@ -269,7 +207,27 @@ > <th>Status</th> > <th>Since</th> > <th>Claim date</th> >+ [% FOR field IN additional_fields_for_subscription %] >+ <th>[% field.name %]</th> >+ [% END %] > </tr></thead> >+ <tfoot> >+ <tr> >+ [% IF ( letter ) %] >+ <td></td> >+ [% END %] >+ <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 issue number" /></td> >+ <td><input type="text" class="filter" data-column_num="5" placeholder="Search status" /></td> >+ <td></td> >+ <td><input type="text" class="filter" data-column_num="7" placeholder="Search claim date" /></td> >+ [% FOR field IN additional_fields_for_subscription %] >+ <td><input type="text" class="filter" data-column_num="[% loop.count + 7 %]" placeholder="Search [% field.name %]" /></td> >+ [% END %] >+ </tr> >+ </tfoot> > <tbody>[% FOREACH missingissue IN missingissues %] > <tr> > [% IF ( letter ) %] >@@ -305,6 +263,13 @@ > <td> > [% missingissue.claimdate %] > </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 c826804..e3ff1f3 100755 >--- a/serials/claims.pl >+++ b/serials/claims.pl >@@ -28,6 +28,8 @@ use C4::Bookseller qw( GetBookSeller ); > 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; >@@ -58,6 +60,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 $letters = GetLetters('claimissues'); > my @letters; > foreach (keys %{$letters}){ >@@ -98,6 +107,7 @@ $template->param( > claimletter => $claimletter, > supplierloop => \@supplierinfo, > branchloop => $branchloop, >+ additional_fields_for_subscription => $additional_fields, > csv_profiles => C4::Csv::GetCsvProfiles( "sql" ), > (uc(C4::Context->preference("marcflavour"))) => 1 > ); >-- >1.7.10.4
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