Bugzilla – Attachment 143048 Details for
Bug 31517
C4::Tags should use Koha::Tags objects instead of raw SQL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31517: (QA follow-up) Fix indentation
Bug-31517-QA-follow-up-Fix-indentation.patch (text/plain), 2.82 KB, created by
Katrin Fischer
on 2022-11-02 22:29:02 UTC
(
hide
)
Description:
Bug 31517: (QA follow-up) Fix indentation
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-11-02 22:29:02 UTC
Size:
2.82 KB
patch
obsolete
>From 296a9c64d0b289359023d06d4dfafd798ef35bac Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Wed, 2 Nov 2022 22:27:11 +0000 >Subject: [PATCH] Bug 31517: (QA follow-up) Fix indentation > >Also removes commented out Data::Dumper. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Tags.pm | 45 ++++++++++++++++++++++----------------------- > 1 file changed, 22 insertions(+), 23 deletions(-) > >diff --git a/C4/Tags.pm b/C4/Tags.pm >index 348f33536e..7f94da4d0e 100644 >--- a/C4/Tags.pm >+++ b/C4/Tags.pm >@@ -28,7 +28,6 @@ use Module::Load::Conditional qw( check_install ); > use Koha::Tags; > use Koha::Tags::Approvals; > use Koha::Tags::Indexes; >-#use Data::Dumper; > use constant TAG_FIELDS => qw(tag_id borrowernumber biblionumber term language date_created); > use constant TAG_SELECT => "SELECT " . join(',', TAG_FIELDS) . "\n FROM tags_all\n"; > >@@ -115,28 +114,28 @@ sub get_count_by_tag_status { > } > > sub remove_tag { >- my $tag_id = shift or return; >- my $user_id = (@_) ? shift : undef; >- my $rows = (defined $user_id) ? >- get_tag_rows({tag_id=>$tag_id, borrowernumber=>$user_id}) : >- get_tag_rows({tag_id=>$tag_id}) ; >- $rows or return 0; >- (scalar(@$rows) == 1) or return; # should never happen (duplicate ids) >- my $row = shift(@$rows); >- ($tag_id == $row->{tag_id}) or return 0; >- my $tags = get_tags({term=>$row->{term}, biblionumber=>$row->{biblionumber}}); >- my $index = shift(@$tags); >- if ($index->{weight} <= 1) { >- Koha::Tags::Indexes->search({ term => $row->{term}, biblionumber => $row->{biblionumber} })->delete; >- } else { >- decrement_weight($row->{term},$row->{biblionumber}); >- } >- if ($index->{weight_total} <= 1) { >- Koha::Tags::Approvals->search({ term => $row->{term} })->delete; >- } else { >- decrement_weight_total($row->{term}); >- } >- Koha::Tags->search({ tag_id => $tag_id })->delete; >+ my $tag_id = shift or return; >+ my $user_id = (@_) ? shift : undef; >+ my $rows = (defined $user_id) ? >+ get_tag_rows({tag_id=>$tag_id, borrowernumber=>$user_id}) : >+ get_tag_rows({tag_id=>$tag_id}) ; >+ $rows or return 0; >+ (scalar(@$rows) == 1) or return; # should never happen (duplicate ids) >+ my $row = shift(@$rows); >+ ($tag_id == $row->{tag_id}) or return 0; >+ my $tags = get_tags({term=>$row->{term}, biblionumber=>$row->{biblionumber}}); >+ my $index = shift(@$tags); >+ if ($index->{weight} <= 1) { >+ Koha::Tags::Indexes->search({ term => $row->{term}, biblionumber => $row->{biblionumber} })->delete; >+ } else { >+ decrement_weight($row->{term},$row->{biblionumber}); >+ } >+ if ($index->{weight_total} <= 1) { >+ Koha::Tags::Approvals->search({ term => $row->{term} })->delete; >+ } else { >+ decrement_weight_total($row->{term}); >+ } >+ Koha::Tags->search({ tag_id => $tag_id })->delete; > } > > sub get_tag_rows { >-- >2.30.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 31517
:
140187
|
140188
|
142847
|
142848
|
143046
|
143047
| 143048