From 7d6f32a4f44a13e032f9bc29e28706be792aacbe Mon Sep 17 00:00:00 2001 From: Jonathan Druart 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. Signed-off-by: Fridolin Somers Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall --- 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 d158a6ce10..cec0ad99f0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -864,7 +864,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 dacb9d868a..facabce691 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 c5d4f2a17b..b27fdcbe59 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 ad242b59eb..0d3b6e0f77 100644 --- a/Koha/DateUtils.pm +++ b/Koha/DateUtils.pm @@ -143,7 +143,7 @@ sub dt_from_string { } # Add the faculative time part [hh:mm[:ss]] - my $time_re .= qr| + my $time_re = qr| ( \s* (?\d{2}) diff --git a/circ/circulation.pl b/circ/circulation.pl index 19d01029b5..79d42ae47c 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 40d1e7d289..c6db3c6681 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 3044a37d2e..eaf92e8e9c 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 76a6a41c66..baca48c134 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 bc13c3bf25..08aaaf101e 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.39.5