Bugzilla – Attachment 80699 Details for
Bug 11708
Display all basketgroups on one page, and new column aqbasketgroups.closeddate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11708: Fix QA issues
Bug-11708-Fix-QA-issues.patch (text/plain), 17.18 KB, created by
Julian Maurice
on 2018-10-17 11:41:33 UTC
(
hide
)
Description:
Bug 11708: Fix QA issues
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-10-17 11:41:33 UTC
Size:
17.18 KB
patch
obsolete
>From ed79b8e461968a01ae8cbae9325c3d03f7c6a6c3 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 14 Sep 2018 17:26:14 +0200 >Subject: [PATCH] Bug 11708: Fix QA issues > >- Change how closedate is set in database update >- Reword bookseller to vendor in Koha::Acquisition::Basketgroup >- Do not "cache" baskets in Koha::Acquisition::Basketgroup >- Remove useless IF in basketgroup.tt >- Move JS to bottom in basketgroups.tt >- Fix some links to basketgroup.pl >- Remove useless use in acqui/basketgroup.pl >- Remove useless sub displaybasketgroups in acqui/basketgroup.pl >- Remove useless code in C4::Acquisition >--- > C4/Acquisition.pm | 8 +- > Koha/Acquisition/Basketgroup.pm | 12 +- > acqui/basketgroup.pl | 41 ------- > .../data/mysql/atomicupdate/bug_11708.perl | 9 +- > .../prog/en/modules/acqui/basket.tt | 2 +- > .../prog/en/modules/acqui/basketgroup.tt | 10 +- > .../prog/en/modules/acqui/basketgroups.tt | 104 +++++++++--------- > .../prog/en/modules/acqui/parcel.tt | 4 +- > 8 files changed, 76 insertions(+), 114 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 40389ed4e4..4f761d2de2 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1512,9 +1512,7 @@ sub ModReceiveOrder { > $order->{datereceived} = $datereceived; > $order->{invoiceid} = $invoice->{invoiceid}; > $order->{orderstatus} = 'complete'; >- my @columns = Koha::Acquisition::Orders->columns; >- my %filtered_order = map { exists $order->{$_} ? ($_ => $order->{$_}) : () } @columns; >- $new_ordernumber = Koha::Acquisition::Order->new(\%filtered_order)->store->ordernumber; >+ $new_ordernumber = Koha::Acquisition::Order->new($order)->store->ordernumber; > > if ($received_items) { > foreach my $itemnumber (@$received_items) { >@@ -2012,9 +2010,7 @@ sub TransferOrder { > delete $order->{parent_ordernumber}; > $order->{'basketno'} = $basketno; > >- my @columns = Koha::Acquisition::Orders->columns; >- my %filtered_order = map { exists $order->{$_} ? ($_ => $order->{$_}) : () } @columns; >- my $newordernumber = Koha::Acquisition::Order->new(\%filtered_order)->store->ordernumber; >+ my $newordernumber = Koha::Acquisition::Order->new($order)->store->ordernumber; > > $query = q{ > UPDATE aqorders_items >diff --git a/Koha/Acquisition/Basketgroup.pm b/Koha/Acquisition/Basketgroup.pm >index 26df6b94d8..b65d5ed5ba 100644 >--- a/Koha/Acquisition/Basketgroup.pm >+++ b/Koha/Acquisition/Basketgroup.pm >@@ -31,15 +31,15 @@ Koha::Acquisition::Basketgroup > > =head2 Methods > >-=head3 bookseller >+=head3 vendor > >-Returns the basketgroup's bookseller (Koha::Acquisition::Bookseller) >+Returns the basketgroup's vendor (Koha::Acquisition::Bookseller) > >- my $bookseller = $basketgroup->bookseller; >+ my $vendor = $basketgroup->vendor; > > =cut > >-sub bookseller { >+sub vendor { > my ($self) = @_; > > return scalar Koha::Acquisition::Booksellers->find($self->booksellerid); >@@ -57,9 +57,9 @@ Returns the basketgroup's baskets > sub baskets { > my ($self) = @_; > >- $self->{_baskets} ||= Koha::Acquisition::Baskets->search({ basketgroupid => $self->id }); >+ my $baskets = Koha::Acquisition::Baskets->search({ basketgroupid => $self->id }); > >- return wantarray ? $self->{_baskets}->as_list : $self->{_baskets}; >+ return wantarray ? $baskets->as_list : $baskets; > } > > =head3 baskets_count >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index ed9c38d714..70c3e5cccf 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -58,8 +58,6 @@ use Koha::Acquisition::Booksellers; > use Koha::ItemTypes; > use Koha::Patrons; > >-use List::MoreUtils qw/uniq/; >- > our $input=new CGI; > > our ($template, $loggedinuser, $cookie) >@@ -87,40 +85,6 @@ sub BasketTotal { > return $total; > } > >-#displays all basketgroups and all closed baskets (in their respective groups) >-sub displaybasketgroups { >- my ($basketgroups, $bookseller, $baskets, $template) = @_; >- if (scalar @$basketgroups != 0) { >- foreach my $basketgroup (@$basketgroups){ >- my $i = 0; >- my $basketsqty = 0; >- while($i < scalar(@$baskets)){ >- my $basket = @$baskets[$i]; >- if($basket->{'basketgroupid'} && $basket->{'basketgroupid'} == $basketgroup->{'id'}){ >- $basket->{total} = BasketTotal($basket->{basketno}, $bookseller); >- push(@{$basketgroup->{'baskets'}}, $basket); >- splice(@$baskets, $i, 1); >- ++$basketsqty; >- --$i; >- } >- ++$i; >- } >- $basketgroup -> {'basketsqty'} = $basketsqty; >- } >- $template->param(basketgroups => $basketgroups); >- } >- for(my $i=0; $i < scalar @$baskets; ++$i) { >- if( ! @$baskets[$i]->{'closedate'} ) { >- splice(@$baskets, $i, 1); >- --$i; >- }else{ >- @$baskets[$i]->{total} = BasketTotal(@$baskets[$i]->{basketno}, $bookseller); >- } >- } >- $template->param(baskets => $baskets); >- $template->param( booksellername => $bookseller->name); >-} >- > sub printbasketgrouppdf{ > my ($basketgroupid) = @_; > >@@ -425,9 +389,4 @@ $deliveryplace = $deliveryplace || $borrower->branchcode; > > $template->param( booksellerid => $booksellerid ); > >-# the template will display a unique basketgroup >-my $basketgroups = &GetBasketgroups($booksellerid); >-my $baskets = &GetBasketsByBookseller($booksellerid); >-displaybasketgroups($basketgroups, $bookseller, $baskets, $template); >- > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/installer/data/mysql/atomicupdate/bug_11708.perl b/installer/data/mysql/atomicupdate/bug_11708.perl >index 35543cdac5..54d7e72f8b 100644 >--- a/installer/data/mysql/atomicupdate/bug_11708.perl >+++ b/installer/data/mysql/atomicupdate/bug_11708.perl >@@ -8,9 +8,16 @@ if( CheckVersion( $DBversion ) ) { > } > > if (column_exists('aqbasketgroups', 'closed')) { >+ # Set basketgroup's close date to the latest close date of its baskets, >+ # or NOW() if it has no baskets > $dbh->do(q{ > UPDATE aqbasketgroups >- SET closeddate = CAST(NOW() AS DATE) >+ LEFT JOIN ( >+ SELECT basketgroupid, MAX(closedate) AS closedate >+ FROM aqbasket >+ GROUP BY basketgroupid >+ ) AS aqbasket ON (aqbasketgroups.id = aqbasket.basketgroupid) >+ SET aqbasketgroups.closeddate = COALESCE(aqbasket.closedate, CAST(NOW() AS DATE)) > WHERE closed = 1 > AND closeddate IS NULL > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index ab91cb2c70..a027de736e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -807,7 +807,7 @@ > $(document).ready(function(){ > $("#basketgroupid").change(function(){ > if($(this).val() == "new"){ >- location.href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]"; >+ location.href="/cgi-bin/koha/acqui/basketgroups.pl?op=add&booksellerid=[% booksellerid | html %]"; > } > }); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >index 90becdfb32..e470411dc6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >@@ -4,11 +4,7 @@ > [% USE Price %] > [% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] >-[% IF booksellerid %] >- <title>Koha › Basket groups for [% booksellername |html %]</title> >-[% ELSE %] >- <title>Koha › Basket groups</title> >-[% END %] >+<title>Koha › Basket groups for [% booksellername |html %]</title> > [% Asset.css("css/datatables.css") | $raw %] > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'datatables.inc' %] >@@ -120,7 +116,7 @@ function submitForm(form) { > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › > <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> > › >- <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]">Basket groups</a> >+ <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% booksellerid | html %]">Basket groups</a> > › > Add basket group for [% booksellername | html %] > </div> >@@ -276,7 +272,7 @@ function submitForm(form) { > <input type="hidden" name="basketgroupid" value="[% basketgroupid | html %]" /> > [% END %] > <input type="hidden" name="op" value="attachbasket" /> >- <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]" class="cancel">Cancel</a> >+ <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroups.pl?booksellerid=[% booksellerid | html %]" class="cancel">Cancel</a> > </fieldset> > [% END %] > </form> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt >index e9258a9f23..67e7cb0b67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt >@@ -2,61 +2,15 @@ > [% USE Branches %] > [% USE KohaDates %] > >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > [% IF bookseller %] > <title>Koha › Basket groups for [% bookseller.name |html %]</title> > [% ELSE %] > <title>Koha › Basket groups</title> > [% END %] >- >- [% Asset.css('css/datatables.css') %] >- [% INCLUDE 'doc-head-close.inc' %] >- [% INCLUDE 'datatables.inc' %] >- [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') %] >- <script type="text/javascript"> >- $(document).ready(function() { >- var options = { >- "paging": false, >- "autoWidth": false, >- "columnDefs": [ >- { "visible": false, "targets": 1 }, >- { "orderable": false, "targets": -1 } >- ], >- "orderFixed": [[ 1, 'asc' ]] >- }; >- [% UNLESS bookseller %] >- options.drawCallback = function(settings) { >- var api = this.api(); >- var rows = api.rows({page: 'current'}).nodes(); >- var last = null; >- >- api.column(1, {page: 'current'}).data().each(function(group, i) { >- if (last !== group) { >- $(rows).eq(i).before( >- '<tr><td class="group" colspan="8">' + group + '</td></tr>' >- ); >- last = group; >- } >- }); >- }; >- [% END %] >- $("#basketgroups-table").kohaDataTable(options); >- >- $('#basketgroups-table').on('click', '.closeandprint', function(e) { >- e.preventDefault(); >- var w = window.open($(this).attr('href')); >- var timer = setInterval(function() { >- if (w.closed === true) { >- clearInterval(timer); >- window.location.reload(true); >- } >- }, 1000); >- }); >- $('#basketgroups-table').on('click', '.delete', function() { >- return confirm(_("Are you sure you want to delete this basketgroup ?")); >- }); >- }); >- </script> >+[% INCLUDE 'doc-head-close.inc' %] >+[% Asset.css('css/datatables.css') %] > </head> > <body id="acq_basketgroup" class="acq"> > [% INCLUDE 'header.inc' %] >@@ -113,7 +67,7 @@ > Basket group no. [% basketgroup.id %] > [% END %] > </td> >- <td>[% basketgroup.bookseller.name %]</td> >+ <td>[% basketgroup.vendor.name %]</td> > <td>[% Branches.GetName(basketgroup.billingplace) %]</td> > <td> > [% IF (basketgroup.freedeliveryplace) %] >@@ -160,4 +114,54 @@ > [% INCLUDE 'acquisitions-menu.inc' %] > </div> > </div> >+ >+ [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') %] >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ var options = { >+ "paging": false, >+ "autoWidth": false, >+ "columnDefs": [ >+ { "visible": false, "targets": 1 }, >+ { "orderable": false, "targets": -1 } >+ ], >+ "orderFixed": [[ 1, 'asc' ]] >+ }; >+ [% UNLESS bookseller %] >+ options.drawCallback = function(settings) { >+ var api = this.api(); >+ var rows = api.rows({page: 'current'}).nodes(); >+ var last = null; >+ >+ api.column(1, {page: 'current'}).data().each(function(group, i) { >+ if (last !== group) { >+ $(rows).eq(i).before( >+ '<tr><td class="group" colspan="8">' + group + '</td></tr>' >+ ); >+ last = group; >+ } >+ }); >+ }; >+ [% END %] >+ $("#basketgroups-table").kohaDataTable(options); >+ >+ $('#basketgroups-table').on('click', '.closeandprint', function(e) { >+ e.preventDefault(); >+ var w = window.open($(this).attr('href')); >+ var timer = setInterval(function() { >+ if (w.closed === true) { >+ clearInterval(timer); >+ window.location.reload(true); >+ } >+ }, 1000); >+ }); >+ $('#basketgroups-table').on('click', '.delete', function() { >+ return confirm(_("Are you sure you want to delete this basketgroup ?")); >+ }); >+ }); >+ </script> >+ [% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index 7b3e958045..06d9a499d4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -133,7 +133,7 @@ > <td class="basketfilterclass">[% loop_order.basketname | html %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno | html %]">[% loop_order.basketno | html %]</a>)</td> > <td> > [% IF loop_order.basketgroupid %] >- [% loop_order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% loop_order.booksellerid | html %]">[% loop_order.basketgroupid | html %]</a>) >+ [% loop_order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% loop_order.booksellerid | html %]&basketgroupid=[% loop_order.basketgroupid | html %]">[% loop_order.basketgroupid | html %]</a>) > [% ELSE %] > No basket group > [% END %] >@@ -280,7 +280,7 @@ > <td>[% order.basketname | html %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | html %]">[% order.basketno | html %]</a>)</td> > <td> > [% IF order.basketgroupid %] >- [% order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% order.booksellerid | html %]">[% order.basketgroupid | html %]</a>) >+ [% order.basketgroupname | html %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% order.booksellerid | html %]&basketgroupid=[% order.basketgroupid | html %]">[% order.basketgroupid | html %]</a>) > [% ELSE %] > No basket group > [% END %] >-- >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 11708
:
25115
|
25116
|
25117
|
26003
|
26004
|
26006
|
28868
|
28869
|
28870
|
28871
|
28872
|
31305
|
31306
|
31307
|
31308
|
31309
|
31530
|
31531
|
31532
|
31533
|
31534
|
31535
|
31536
|
31537
|
31538
|
31539
|
31540
|
31541
|
31542
|
31543
|
31544
|
31702
|
31703
|
31704
|
31705
|
31748
|
31749
|
31750
|
31751
|
31752
|
31753
|
32909
|
32910
|
32911
|
32912
|
32913
|
32914
|
33308
|
33309
|
33310
|
33311
|
33312
|
33313
|
34936
|
34937
|
34938
|
34939
|
34940
|
34941
|
34977
|
35748
|
35749
|
35750
|
35751
|
35752
|
35753
|
35754
|
35755
|
35756
|
35971
|
35972
|
35973
|
35974
|
35975
|
35976
|
35977
|
35978
|
35979
|
40260
|
40261
|
40262
|
40263
|
40264
|
40265
|
40266
|
40267
|
40268
|
40272
|
48992
|
48993
|
48994
|
48995
|
48996
|
52417
|
52418
|
52419
|
52420
|
52421
|
55277
|
55278
|
55279
|
58770
|
58771
|
58772
|
58773
|
58774
|
58775
|
58776
|
58777
|
58778
|
59301
|
59302
|
59303
|
59304
|
59305
|
59306
|
59307
|
59308
|
59309
|
61018
|
61019
|
61020
|
61021
|
61022
|
61023
|
61024
|
61025
|
61026
|
71260
|
71261
|
71262
|
71263
|
71264
|
71265
|
71266
|
71267
|
71268
|
72069
|
72070
|
72071
|
72072
|
72073
|
72074
|
72075
|
72076
|
72077
|
72691
|
72692
|
72693
|
72694
|
72695
|
72696
|
72697
|
72698
|
72699
|
74213
|
74214
|
74215
|
74216
|
74217
|
74218
|
74219
|
74220
|
74221
|
74222
|
74302
|
74303
|
74304
|
74305
|
74306
|
74307
|
74308
|
74309
|
74310
|
74311
|
74349
|
74350
|
74351
|
74352
|
74353
|
74354
|
74355
|
74356
|
74357
|
74358
|
75003
|
75004
|
75908
|
75909
|
78662
|
78663
|
78664
|
80697
|
80698
|
80699
|
80700
|
80979
|
80980
|
80981
|
80982
|
85786
|
85787
|
91285
|
91286
|
92378
|
92379
|
92380
|
92381
|
92382
|
93460
|
93461
|
93462
|
93463
|
93464
|
93482
|
93483
|
93484
|
93485
|
93487
|
104928
|
104929
|
104930
|
104931
|
104932
|
104933
|
104934
|
104935