Bug 33236 - Move C4::Suggestions::NewSuggestion to Koha namespace
Summary: Move C4::Suggestions::NewSuggestion to Koha namespace
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Nick Clemens
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks: 23990 36122
  Show dependency treegraph
 
Reported: 2023-03-15 15:25 UTC by Nick Clemens
Modified: 2024-02-20 20:46 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.01


Attachments
Bug 33236: Move NewSuggestion to Koha::Suggestion->store (18.02 KB, patch)
2023-03-15 15:29 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33236: Move NewSuggestion to Koha::Suggestion->store (18.08 KB, patch)
2023-04-03 17:31 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 33236: (follow-up) Handle new suggestion in ReNewSubscription (4.62 KB, patch)
2023-04-14 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33236: (follow-up) Remove export of NewSuggestion (626 bytes, patch)
2023-04-14 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33236: Move NewSuggestion to Koha::Suggestion->store (18.06 KB, patch)
2023-04-15 22:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33236: (follow-up) Handle new suggestion in ReNewSubscription (4.68 KB, patch)
2023-04-15 22:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33236: (follow-up) Remove export of NewSuggestion (683 bytes, patch)
2023-04-15 22:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33236: (follow-up) Add use statements (598 bytes, patch)
2023-05-02 10:58 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2023-03-15 15:25:52 UTC

    
Comment 1 Nick Clemens 2023-03-15 15:29:12 UTC
Created attachment 148221 [details] [review]
Bug 33236: Move NewSuggestion to Koha::Suggestion->store

The NewSuggestion routine saved the suggestion to the DB
and returned the id

This patch moves the code to Koha::Suggestion->store and
handles emailing upon creation, this adds that functionality to
suggestions added via api

To test:
1 - Apply patch
2 - Test adding a suggestion on the opac and staff client
3 - Confirm the suggestions are added correctly
Comment 2 ByWater Sandboxes 2023-04-03 17:31:12 UTC
Created attachment 149103 [details] [review]
Bug 33236: Move NewSuggestion to Koha::Suggestion->store

The NewSuggestion routine saved the suggestion to the DB
and returned the id

This patch moves the code to Koha::Suggestion->store and
handles emailing upon creation, this adds that functionality to
suggestions added via api

To test:
1 - Apply patch
2 - Test adding a suggestion on the opac and staff client
3 - Confirm the suggestions are added correctly

Signed-off-by: Andrew Auld <andrew.auld@ptfs-europe.com>
Comment 3 Andrew Auld 2023-04-03 17:32:38 UTC
Tested on OPAC and Staff side on sandbox successfully. Suggestions functionality all works as it should.

Only thing I couldn't verify was the actual sending of emails relating to suggestions.
Comment 4 Katrin Fischer 2023-04-10 17:31:13 UTC
Hi Nick,

this looks quite good, but I think we need some more clean-up:

1) Serials

C4/Serials.pm:  

    if ( C4::Context->preference("RenewSerialAddsSuggestion") ) {
        require C4::Suggestions;
        C4::Suggestions::NewSuggestion(
            {   'suggestedby'   => $user,
                'title'         => $subscription->{bibliotitle},
                'author'        => $biblio->{author},
                'publishercode' => $biblio->{publishercode},
                'note'          => $note,
                'biblionumber'  => $subscription->{biblionumber},
                'branchcode'    => $branchcode,
            }
        );
    }

2) Export list

C4/Suggestions.pm:  NewSuggestion

Method is still in the list of exports.


I would have fixed 2) but I think it would be better if you check on 1).
Comment 5 Nick Clemens 2023-04-14 13:45:01 UTC
Created attachment 149679 [details] [review]
Bug 33236: (follow-up) Handle new suggestion in ReNewSubscription
Comment 6 Nick Clemens 2023-04-14 13:45:03 UTC
Created attachment 149680 [details] [review]
Bug 33236: (follow-up) Remove export of NewSuggestion
Comment 7 Katrin Fischer 2023-04-15 22:21:54 UTC
Created attachment 149714 [details] [review]
Bug 33236: Move NewSuggestion to Koha::Suggestion->store

The NewSuggestion routine saved the suggestion to the DB
and returned the id

This patch moves the code to Koha::Suggestion->store and
handles emailing upon creation, this adds that functionality to
suggestions added via api

To test:
1 - Apply patch
2 - Test adding a suggestion on the opac and staff client
3 - Confirm the suggestions are added correctly

Signed-off-by: Andrew Auld <andrew.auld@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2023-04-15 22:21:57 UTC
Created attachment 149715 [details] [review]
Bug 33236: (follow-up) Handle new suggestion in ReNewSubscription

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2023-04-15 22:21:59 UTC
Created attachment 149716 [details] [review]
Bug 33236: (follow-up) Remove export of NewSuggestion

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Jonathan Druart 2023-05-02 09:46:04 UTC
The only thing I am seeing here is that we are passing the suggestion to generate the letter without the one from the DB (we don't get_from_storage).

For now the downside is that suggestion.date won't be filled in with the default timestamp, but that should not be a problem.

No idea if it's better to add a fetch.
Comment 11 Jonathan Druart 2023-05-02 09:47:15 UTC
ha, you forgot the use statements for C4::Context and C4::Letters from Koha::Suggestion.
Comment 12 Nick Clemens 2023-05-02 10:58:41 UTC
Created attachment 150510 [details] [review]
Bug 33236: (follow-up) Add use statements
Comment 13 Tomás Cohen Arazi 2023-06-06 13:17:59 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 14 Matt Blenkinsop 2023-06-12 08:47:16 UTC
Enhancement - not backporting to 22.11.x
Comment 15 Fridolin Somers 2023-08-03 21:07:00 UTC
Enhancement, not backporting to 23.05.x
Comment 16 Caroline Cyr La Rose 2024-02-16 20:56:44 UTC
(In reply to Fridolin Somers from comment #15)
> Enhancement, not backporting to 23.05.x

These commits are in 23.05.01.

https://git.koha-community.org/Koha-community/Koha/commits/branch/23.05.x/search?q=33236

Should we edit the "Version released in"?
Comment 17 Fridolin Somers 2024-02-19 10:29:11 UTC
Indeed, I see it has been pushed in 23.05.x by Tomás on Jun 9 2023

My job has RMaint add not started yet.

"Version released in" fixed
Comment 18 Caroline Cyr La Rose 2024-02-20 20:46:42 UTC
Thanks Frido!