Bugzilla – Attachment 18706 Details for
Bug 7684
inventory : datatable fix actions etc.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7684: QA Followup
Bug-7684-QA-Followup.patch (text/plain), 11.71 KB, created by
Jonathan Druart
on 2013-06-06 12:40:47 UTC
(
hide
)
Description:
Bug 7684: QA Followup
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-06-06 12:40:47 UTC
Size:
11.71 KB
patch
obsolete
>From 9f7148138b01a57d35a9373b15f44432a50cc312 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 6 Jun 2013 14:37:19 +0200 >Subject: [PATCH] Bug 7684: QA Followup > >This followup: > >- replaces the MySQLism SQL_CALC_FOUND_ROWS >- uses Koha::DateUtils instead of C4::Dates >- replaces "branch" and "location" with "library" >- fixes wrong capitalisation on "Clear all" and "Select all" >--- > C4/Items.pm | 21 +++++++++++------- > .../prog/en/modules/tools/inventory.tt | 23 ++++++++++---------- > tools/ajax-inventory.pl | 22 +------------------ > tools/inventory.pl | 18 +++++++++------ > 4 files changed, 37 insertions(+), 47 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index d53adaa..0b81efb 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -992,12 +992,15 @@ sub GetItemsForInventory { > my $dbh = C4::Context->dbh; > my ( @bind_params, @where_strings ); > >- my $query = <<'END_SQL'; >-SELECT SQL_CALC_FOUND_ROWS items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, stocknumber >-FROM items >- LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber >- LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber >-END_SQL >+ my $select_columns = q{ >+ SELECT SQL_CALC_FOUND_ROWS items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, stocknumber >+ }; >+ my $select_count = q{SELECT COUNT(*)}; >+ my $query = q{ >+ FROM items >+ LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber >+ LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber >+ }; > if ($statushash){ > for my $authvfield (keys %$statushash){ > if ( scalar @{$statushash->{$authvfield}} > 0 ){ >@@ -1052,14 +1055,16 @@ END_SQL > $query .= join ' AND ', @where_strings; > } > $query .= ' ORDER BY items.cn_sort, itemcallnumber, title'; >+ my $count_query = $select_count . $query; > $query .= " LIMIT $offset, $size" if ($offset and $size); >+ $query = $select_columns . $query; > my $sth = $dbh->prepare($query); > $sth->execute( @bind_params ); > > my @results; > my $tmpresults = $sth->fetchall_arrayref({}); >- $sth = $dbh->prepare("SELECT FOUND_ROWS()"); >- $sth->execute(); >+ $sth = $dbh->prepare( $count_query ); >+ $sth->execute( @bind_params ); > my ($iTotalRecords) = $sth->fetchrow_array(); > > foreach my $row (@$tmpresults) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >index 1052714..77d840b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Inventory</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -16,8 +17,8 @@ $(document).ready(function(){ > } )); > > >- $("#continuewithoutmarkingbutton").click(function(){ >- inventorydt.fnPageChange( 'next' ); >+ $("#continuewithoutmarkingbutton").click(function(){ >+ inventorydt.fnPageChange( 'next' ); > return false; > }); > >@@ -82,7 +83,7 @@ $(document).ready(function(){ > <div id="yui-main"> > <div class="yui-b"> > <h1>Inventory/Stocktaking</h1> >- [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date %]</div>[% END %] >+ [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>[% END %] > [% IF (errorfile) %]<div class="dialog alert">[% errorfile %] can't be opened</div>[% END %] > [% FOREACH error IN errorloop %] > <div class="dialog alert"> >@@ -100,7 +101,7 @@ $(document).ready(function(){ > <legend>Use a barcode file</legend> > <ol> > <li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes" /></li> >- <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today %]" class="datepickerfrom" /> >+ <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepickerfrom" /> > </li> > </ol> > </fieldset> >@@ -109,10 +110,10 @@ $(document).ready(function(){ > <ol><li> > <label for="branch">Library: </label> > <input type="radio" name="branch" value="homebranch"> Home library</input> >- <input type="radio" name="branch" value="holdingbranch"> Current location</input> >+ <input type="radio" name="branch" value="holdingbranch"> Current library</input> > </li><li> > <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;"> >- <option value="">All locations</option> >+ <option value="">All libraries</option> > [% FOREACH branchloo IN branchloop %] > [% IF ( branchloo.selected ) %] > <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> >@@ -172,7 +173,7 @@ $(document).ready(function(){ > [% END %] > > <li><label for="datelastseen">Inventory date:</label> >- <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen %]" class="datepickerfrom" /> >+ <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="datepickerfrom" /> > </li> > <li><label for="ignoreissued">Skip copies on loan: </label> > [% IF (ignoreissued) %] >@@ -206,13 +207,13 @@ $(document).ready(function(){ > <input type="hidden" name="datelastseen" value="[% datelastseen %]" /> > <input type="hidden" name="pagesize" value="[% pagesize %]" /> > <input type="hidden" name="offset" value="[% offset %]" /> >- <div><a href="#" class="checkall">[Select All]</a> <a href="#" class="clearall">[Clear All]</a></div> >+ <div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div> > <table id="inventoryt"> > <thead> > <tr> > <th>Seen</th> > <th>Barcode</th> >- <th>Location</th> >+ <th>Library</th> > <th>Title</th> > <th>Status</th> > <th>Lost</th> >@@ -246,7 +247,7 @@ $(document).ready(function(){ > [% result.damaged | html %] > </td> > <td> >- [% result.datelastseen | html %] >+ [% result.datelastseen | html | $KohaDates%] > </td> > <td> > [% IF (result.wrongplace) %]<p>Item should not have been scanned</p>[% ELSIF (result.missingitem) %]<p>Item missing</p>[% ELSIF (result.changestatus) %]<p>Change item status</p>[% END %] >@@ -257,7 +258,7 @@ $(document).ready(function(){ > </table> > <div class="spacer"></div> > <p style="display:block;"><span class="exportSelected"></span></p> >- <div style="padding : .3em 0"><a href="#" class="checkall">[Select All]</a> <a href="#" class="clearall">[Clear All]</a></div> >+ <div style="padding : .3em 0"><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div> > <input type="submit" id="markseenandquit" value="Mark seen and quit" /> > <input type="submit" value="Mark Seen and Continue >>" id="markseenandcontinuebutton" /> > <input type="submit" value="Continue without Marking >>" id="continuewithoutmarkingbutton" class="submit" /> >diff --git a/tools/ajax-inventory.pl b/tools/ajax-inventory.pl >index 24739b9..63f371a 100755 >--- a/tools/ajax-inventory.pl >+++ b/tools/ajax-inventory.pl >@@ -1,27 +1,9 @@ > #!/usr/bin/perl >-# > > use Modern::Perl; >- > use CGI; >-use JSON; >- > use C4::Auth; >-use C4::Circulation qw/CanBookBeRenewed/; >-use C4::Context; >-use C4::Koha qw/getitemtypeimagelocation/; >-use C4::Reserves qw/CheckReserves/; >-use C4::Utils::DataTables; >-use C4::Output; >-use C4::Biblio; >-use C4::Items; >-use C4::Dates qw/format_date format_date_in_iso/; >-use C4::Koha; >-use C4::Branch; # GetBranches >-use C4::Reports::Guided; #_get_column_defs >-use C4::Charset; >-use List::MoreUtils qw /none/; >- >+use C4::Items qw( ModDateLastSeen ); > > my $input = new CGI; > >@@ -38,6 +20,4 @@ foreach ( @seent ) { > /SEEN-(.+)/ and &ModDateLastSeen($1); > } > >- > print $input->header('application/json'); >- >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 1518dc9..c1ba03f 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -31,12 +31,12 @@ use C4::Context; > use C4::Output; > use C4::Biblio; > use C4::Items; >-use C4::Dates qw/format_date format_date_in_iso/; > use C4::Koha; > use C4::Branch; # GetBranches > use C4::Circulation; > use C4::Reports::Guided; #_get_column_defs > use C4::Charset; >+use Koha::DateUtils; > use List::MoreUtils qw/none/; > > >@@ -134,7 +134,7 @@ $statussth =~ s, and $,,g; > $template->param( > branchloop => \@branch_loop, > authorised_values => \@authorised_value_list, >- today => C4::Dates->today(), >+ today => dt_from_string, > minlocation => $minlocation, > maxlocation => $maxlocation, > location => $location, >@@ -160,7 +160,8 @@ my $barcodelist; > my @errorloop; > if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { > my $dbh = C4::Context->dbh; >- my $date = format_date_in_iso( $input->param('setdate') ) || C4::Dates->today('iso'); >+ my $date = dt_from_string( $input->param('setdate') ); >+ $date = output_pref( $date, 'iso' ); > > my $strsth = "select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =?"; > my $qonloan = $dbh->prepare($strsth); >@@ -197,7 +198,7 @@ if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { > } > $qonloan->finish; > $qwthdrawn->finish; >- $template->param( date => format_date($date), Number => $count ); >+ $template->param( date => $date, Number => $count ); > $template->param( errorloop => \@errorloop ) if (@errorloop); > > >@@ -220,7 +221,11 @@ if ( $markseen or $op ) { > } > > # set "missing" flags for all items with a datelastseen before the choosen datelastseen >-foreach (@$res) { $_->{missingitem}=1 if C4::Dates->new($_->{datelastseen})->output('iso') lt C4::Dates->new($datelastseen)->output('iso'); } >+foreach my $r ( @$res ) { >+ $r->{missingitem} = 1 >+ if output_pref( dt_from_string( $_->{datelastseen} ), 'iso' ) >+ lt output_pref( dt_from_string( $datelastseen ), 'iso' ); >+} > > # removing missing items from loop if "Compare barcodes list to results" has not been checked > @$res = grep {!$_->{missingitem} == 1 } @$res if (!$input->param('compareinv2barcd')); >@@ -254,7 +259,6 @@ foreach my $temp (@brcditems) { > my $biblio = C4::Biblio::GetBiblioData($temp->{biblionumber}); > $temp->{title} = $biblio->{title}; > $temp->{author} = $biblio->{author}; >- $temp->{datelastseen} = format_date($temp->{datelastseen}); > push @$res, $temp; > > } >@@ -264,7 +268,7 @@ foreach my $temp (@brcditems) { > my $biblio = C4::Biblio::GetBiblioData($temp->{biblionumber}); > $temp2->{title} = $biblio->{title}; > $temp2->{author} = $biblio->{author}; >- $temp2->{datelastseen} = format_date($temp->{datelastseen}); >+ $temp2->{datelastseen} = $temp->{datelastseen}; > push @$res, $temp2; > } > } >-- >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 7684
:
9412
|
10413
|
11793
|
11843
|
12387
|
13097
|
16212
|
16483
|
16484
|
16524
|
16541
|
16594
|
16598
|
17841
|
17844
|
18705
|
18706
|
19215
|
20467
|
20468
|
21112
|
21113
|
21206
|
21331
|
21332
|
21440
|
21441
|
21968
|
21970
|
21971
|
21972
|
22208
|
22209
|
22210