Bugzilla – Attachment 104234 Details for
Bug 23185
Koha::Objects supports passing through 'update' which means we can side step 'set' + 'store'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23185: (QA follow-up) Semantics, split fields and options
Bug-23185-QA-follow-up-Semantics-split-fields-and-.patch (text/plain), 2.34 KB, created by
Victor Grousset/tuxayo
on 2020-05-03 21:02:31 UTC
(
hide
)
Description:
Bug 23185: (QA follow-up) Semantics, split fields and options
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-05-03 21:02:31 UTC
Size:
2.34 KB
patch
obsolete
>From ae7e70a31e15f37bf667b95caea70c50247419f6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 1 May 2020 14:12:09 +0100 >Subject: [PATCH] Bug 23185: (QA follow-up) Semantics, split fields and options > >This patch improves the semantics of the update routine to more clearly >separate the 'fields' we're modifying from the 'options' we wish to >apply to the modification. > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > Koha/Objects.pm | 8 ++++---- > t/db_dependent/Koha/Objects.t | 2 +- > 2 files changed, 5 insertions(+), 5 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 7512f2616f..94271928b1 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -199,9 +199,9 @@ sub delete { > =cut > > sub update { >- my ($self, $params) = @_; >+ my ($self, $fields, $options) = @_; > >- my $no_triggers = delete $params->{no_triggers}; >+ my $no_triggers = $options->{no_triggers}; > > if ( > !$no_triggers >@@ -212,14 +212,14 @@ sub update { > my $objects_updated; > $self->_resultset->result_source->schema->txn_do( sub { > while ( my $o = $self->next ) { >- $o->update($params); >+ $o->update($fields); > $objects_updated++; > } > }); > return $objects_updated; > } > >- return $self->_resultset->update($params); >+ return $self->_resultset->update($fields); > } > > =head3 single >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index beeac1ba66..96a6bc6d30 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -995,7 +995,7 @@ subtest 'Return same values as DBIx::Class' => sub { > $patrons_us->update({ surname => 'foo' }); # Koha::Patron->store is supposed to uppercase the surnames > is( $patrons_us->search({ surname => 'FOO' })->count, 2, 'Koha::Patron->store is hit' ); > >- $patrons_us->update({ surname => 'foo', no_triggers => 1 }); # The surnames won't be uppercase as we won't hit Koha::Patron->store >+ $patrons_us->update({ surname => 'foo' }, { no_triggers => 1 }); # The surnames won't be uppercase as we won't hit Koha::Patron->store > is( $patrons_us->search({ surname => 'foo' })->count, 2, 'Koha::Patron->store is not hit'); > > }; >-- >2.26.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 23185
:
103867
|
103868
|
103946
|
103947
|
104087
|
104088
|
104089
|
104232
|
104233
|
104234
|
104271
|
104272
|
104273
|
104276
|
104537
|
104538
|
104541