Bugzilla – Attachment 130937 Details for
Bug 30110
Potential bug source: plenty of "my" declarations with conditional assignments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30110: Fix concatenation during assignements
Bug-30110-Fix-concatenation-during-assignements.patch (text/plain), 6.36 KB, created by
Jonathan Druart
on 2022-02-21 09:54:34 UTC
(
hide
)
Description:
Bug 30110: Fix concatenation during assignements
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-02-21 09:54:34 UTC
Size:
6.36 KB
patch
obsolete
>From 1f43a23b16b9a3ec718a13c02d9308d4af0d0087 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 21 Feb 2022 10:50:55 +0100 >Subject: [PATCH] Bug 30110: Fix concatenation during assignements > >There are several occurrences of `my $var += ` or .= in the code. >It should not cause problems but it's confusing. > >Test plan: >Read the patch and confirm that the changes make sense. >--- > C4/Circulation.pm | 2 +- > C4/Search.pm | 2 +- > C4/Utils/DataTables/VirtualShelves.pm | 2 +- > Koha/DateUtils.pm | 2 +- > circ/circulation.pl | 2 +- > t/Labels_split_ccn.t | 2 +- > t/Labels_split_ddcn.t | 2 +- > t/Labels_split_lccn.t | 2 +- > t/db_dependent/SIP/Message.t | 4 ++-- > 9 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 821e883f130..fa2052a72eb 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -856,7 +856,7 @@ sub CanBookBeIssued { > my $no_issues_charge_guarantors = C4::Context->preference("NoIssuesChargeGuarantorsWithGuarantees"); > $no_issues_charge_guarantors = undef unless looks_like_number( $no_issues_charge_guarantors ); > if ( defined $no_issues_charge_guarantors ) { >- my $guarantors_non_issues_charges += $patron->relationships_debt({ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 }); >+ my $guarantors_non_issues_charges = $patron->relationships_debt({ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 }); > > if ( $guarantors_non_issues_charges > $no_issues_charge_guarantors && !$inprocess && !$allowfineoverride) { > $issuingimpossible{DEBT_GUARANTORS} = $guarantors_non_issues_charges; >diff --git a/C4/Search.pm b/C4/Search.pm >index 18a2977a974..a69e5feb214 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -888,7 +888,7 @@ sub _build_weighted_query { > my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0; > $operand =~ s/"/ /g; # Bug 7518: searches with quotation marks don't work > >- my $weighted_query .= "(rk=("; # Specifies that we're applying rank >+ my $weighted_query = "(rk=("; # Specifies that we're applying rank > > # Keyword, or, no index specified > if ( ( $index eq 'kw' ) || ( !$index ) ) { >diff --git a/C4/Utils/DataTables/VirtualShelves.pm b/C4/Utils/DataTables/VirtualShelves.pm >index c5d4f2a17b6..b27fdcbe59e 100644 >--- a/C4/Utils/DataTables/VirtualShelves.pm >+++ b/C4/Utils/DataTables/VirtualShelves.pm >@@ -44,7 +44,7 @@ sub search { > my @args; > # private > if ( !$public ) { >- my $join_vs .= q| >+ my $join_vs = q| > LEFT JOIN virtualshelfshares sh ON sh.shelfnumber = vs.shelfnumber > AND sh.borrowernumber = ? > |; >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 58fec0bef97..222aa167547 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -143,7 +143,7 @@ sub dt_from_string { > } > > # Add the facultative time part including time zone offset; ISO8601 allows +02 or +0200 too >- my $time_re .= qr{ >+ my $time_re = qr{ > ( > [Tt]? > \s* >diff --git a/circ/circulation.pl b/circ/circulation.pl >index b98f1205031..93d368aad20 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -474,7 +474,7 @@ if ( $patron ) { > # Check the debt of this patrons guarantors *and* the guarantees of those guarantors > my $no_issues_charge_guarantors = C4::Context->preference("NoIssuesChargeGuarantorsWithGuarantees"); > if ( $no_issues_charge_guarantors ) { >- my $guarantors_non_issues_charges += $patron->relationships_debt({ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 }); >+ my $guarantors_non_issues_charges = $patron->relationships_debt({ include_guarantors => 1, only_this_guarantor => 0, include_this_patron => 1 }); > > if ( $guarantors_non_issues_charges > $no_issues_charge_guarantors ) { > $template->param( >diff --git a/t/Labels_split_ccn.t b/t/Labels_split_ccn.t >index 40d1e7d2894..c6db3c66810 100755 >--- a/t/Labels_split_ccn.t >+++ b/t/Labels_split_ccn.t >@@ -38,7 +38,7 @@ BEGIN { > } > my $test_num = 1; > foreach (keys(%$ccns)) { >- my $split_num += scalar(@{$ccns->{$_}}); >+ my $split_num = scalar(@{$ccns->{$_}}); > $test_num += 2 * $split_num; > $test_num += 4; > } >diff --git a/t/Labels_split_ddcn.t b/t/Labels_split_ddcn.t >index 3044a37d2ed..eaf92e8e9ce 100755 >--- a/t/Labels_split_ddcn.t >+++ b/t/Labels_split_ddcn.t >@@ -37,7 +37,7 @@ BEGIN { > } > my $test_num = 1; > foreach (keys(%$ddcns)) { >- my $split_num += scalar(@{$ddcns->{$_}}); >+ my $split_num = scalar(@{$ddcns->{$_}}); > $test_num += 2 * $split_num; > $test_num += 4; > } >diff --git a/t/Labels_split_lccn.t b/t/Labels_split_lccn.t >index 76a6a41c666..baca48c134c 100755 >--- a/t/Labels_split_lccn.t >+++ b/t/Labels_split_lccn.t >@@ -40,7 +40,7 @@ BEGIN { > } > my $test_num = 1; > foreach (keys(%$lccns)) { >- my $split_num += scalar(@{$lccns->{$_}}); >+ my $split_num = scalar(@{$lccns->{$_}}); > $test_num += 2 * $split_num; > $test_num += 4; > } >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index bc13c3bf25a..08aaaf101ef 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -124,7 +124,7 @@ subtest 'hold_patron_name() tests' => sub { > > is( $sip_item->hold_patron_name, q{}, "SIP item with no hold returns empty string for patron name" ); > >- my $resp .= C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_name, $server ); >+ my $resp = C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_name, $server ); > is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" ); > > $schema->storage->txn_rollback; >@@ -837,7 +837,7 @@ sub test_hold_patron_bcode { > > is( $sip_item->hold_patron_bcode, q{}, "SIP item with no hold returns empty string" ); > >- my $resp .= C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_bcode, $server ); >+ my $resp = C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_bcode, $server ); > is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" ); > } > >-- >2.25.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 30110
:
130937
|
132043
|
132188