Bugzilla – Attachment 66368 Details for
Bug 19130
K::A::Booksellers->search broken for attribute 'name'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19130: (followup) Controller scripts should preserve behaviour
Bug-19130-followup-Controller-scripts-should-prese.patch (text/plain), 4.00 KB, created by
Kyle M Hall (khall)
on 2017-08-22 18:19:58 UTC
(
hide
)
Description:
Bug 19130: (followup) Controller scripts should preserve behaviour
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-08-22 18:19:58 UTC
Size:
4.00 KB
patch
obsolete
>From 90e2b4b17c9fc195aa08a0cb7066e90785abd1fd Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 22 Aug 2017 13:11:56 -0300 >Subject: [PATCH] Bug 19130: (followup) Controller scripts should preserve > behaviour > >This patch is a followup to making >Koha::Acquisition::Booksellers->search work as any other Koha::Objects >(DBIC) query instead of having a different behaviour hardcoded. > >To achieve it, this patch makes the controller scripts add >wildcard/truncation chars as prefix and sufix for searches, and make the >default sorting for results be by 'name', ascending. > >To test: >- Just verify the behaviour remains unchanged by this patchset on the >controller scripts (re. searching). > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > acqui/basketheader.pl | 5 ++++- > acqui/booksellers.pl | 4 +++- > acqui/invoices.pl | 2 +- > acqui/transferorder.pl | 4 +++- > serials/acqui-search-result.pl | 4 +++- > 5 files changed, 14 insertions(+), 5 deletions(-) > >diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl >index 8cfde89..45e11e5 100755 >--- a/acqui/basketheader.pl >+++ b/acqui/basketheader.pl >@@ -110,7 +110,10 @@ if ( $op eq 'add_form' ) { > $template->param(contractloop => \@contractloop, > basketcontractnumber => $basket->{'contractnumber'}); > } >- my @booksellers = Koha::Acquisition::Booksellers->search; >+ my @booksellers = Koha::Acquisition::Booksellers->search( >+ undef, >+ { order_by => { -asc => 'name' } } ); >+ > $template->param( add_form => 1, > basketname => $basket->{'basketname'}, > basketnote => $basket->{'note'}, >diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl >index de39f67..8a35b04 100755 >--- a/acqui/booksellers.pl >+++ b/acqui/booksellers.pl >@@ -85,7 +85,9 @@ my @suppliers; > if ($booksellerid) { > push @suppliers, scalar Koha::Acquisition::Booksellers->find( $booksellerid ); > } else { >- @suppliers = Koha::Acquisition::Booksellers->search({ name => $supplier }); >+ @suppliers = Koha::Acquisition::Booksellers->search( >+ { name => { -like => "%$supplier%" } }, >+ { order_by => { -asc => 'name' } } ); > } > > my $supplier_count = @suppliers; >diff --git a/acqui/invoices.pl b/acqui/invoices.pl >index 2d11746..3c10e7a 100755 >--- a/acqui/invoices.pl >+++ b/acqui/invoices.pl >@@ -90,7 +90,7 @@ if ( $op and $op eq 'do_search' ) { > } > > # Build suppliers list >-my @suppliers = Koha::Acquisition::Booksellers->search; >+my @suppliers = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } ); > my $suppliers_loop = []; > my $suppliername; > foreach (@suppliers) { >diff --git a/acqui/transferorder.pl b/acqui/transferorder.pl >index 219fb32..6eeafdb 100755 >--- a/acqui/transferorder.pl >+++ b/acqui/transferorder.pl >@@ -117,7 +117,9 @@ if( $basketno && $ordernumber) { > # Search for booksellers to transfer from/to > $op = '' unless $op; > if( $op eq "do_search" ) { >- my @booksellers = Koha::Acquisition::Booksellers->search({ name => $query }); >+ my @booksellers = Koha::Acquisition::Booksellers->search( >+ { name => { -like => "%$query%" } }, >+ { order_by => { -asc => 'name' } } ); > $template->param( > query => $query, > do_search => 1, >diff --git a/serials/acqui-search-result.pl b/serials/acqui-search-result.pl >index c159d29..5e57288 100755 >--- a/serials/acqui-search-result.pl >+++ b/serials/acqui-search-result.pl >@@ -62,7 +62,9 @@ my ($template, $loggedinuser, $cookie) > }); > > my $supplier=$query->param('supplier'); >-my @suppliers = Koha::Acquisition::Booksellers->search({ name => $supplier }); >+my @suppliers = Koha::Acquisition::Booksellers->search( >+ { name => { -like => "%$supplier%" } }, >+ { order_by => { -asc => 'name' } } ); > > #build result page > my $loop_suppliers = []; >-- >2.10.2
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 19130
:
66348
|
66349
|
66350
|
66352
|
66365
|
66366
|
66367
|
66368
|
66480
|
66481
|
66482
|
66483