Bug 31517

Summary: C4::Tags should use Koha::Tags objects instead of raw SQL
Product: Koha Reporter: Joonas Kylmälä <joonas.kylmala>
Component: Architecture, internals, and plumbingAssignee: Joonas Kylmälä <joonas.kylmala>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Attachments: Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses
Bug 31517: Remove unused get_tag function
Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses
Bug 31517: Remove unused get_tag function
Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses
Bug 31517: Remove unused get_tag function
Bug 31517: (QA follow-up) Fix indentation

Description Joonas Kylmälä 2022-09-02 19:53:23 UTC
C4::Tags module does currently a lot of raw SQL queries. We should use the Koha object methods for these instead (Koha::Tags and so on).
Comment 1 Joonas Kylmälä 2022-09-02 20:48:14 UTC
Created attachment 140187 [details] [review]
Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses

To test:
 1) Create a few new tags to any biblio by visiting the biblio's detail
 page on OPAC
 2) The visit http://localhost:8080/cgi-bin/koha/opac-tags.pl and try
 deleting those tags.
Comment 2 Joonas Kylmälä 2022-09-02 20:48:18 UTC
Created attachment 140188 [details] [review]
Bug 31517: Remove unused get_tag function
Comment 3 Joonas Kylmälä 2022-09-02 20:50:06 UTC
Please ignore the following failure from the QA script:

> forbidden pattern: tab char (line 130)

C4/Tags.pl already uses tabs so it doesn't make sense to change format part of the file with spaces as it will look strange on editors.
Comment 4 David Nind 2022-11-01 01:02:34 UTC
Created attachment 142847 [details] [review]
Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses

To test:
 1) Create a few new tags to any biblio by visiting the biblio's detail
 page on OPAC
 2) The visit http://localhost:8080/cgi-bin/koha/opac-tags.pl and try
 deleting those tags.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2022-11-01 01:02:38 UTC
Created attachment 142848 [details] [review]
Bug 31517: Remove unused get_tag function

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 Katrin Fischer 2022-11-02 22:28:53 UTC
Created attachment 143046 [details] [review]
Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses

To test:
 1) Create a few new tags to any biblio by visiting the biblio's detail
 page on OPAC
 2) The visit http://localhost:8080/cgi-bin/koha/opac-tags.pl and try
 deleting those tags.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2022-11-02 22:28:58 UTC
Created attachment 143047 [details] [review]
Bug 31517: Remove unused get_tag function

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2022-11-02 22:29:02 UTC
Created attachment 143048 [details] [review]
Bug 31517: (QA follow-up) Fix indentation

Also removes commented out Data::Dumper.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi 2022-11-04 23:21:10 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!