[Bug 15632] New: Move the messages related code to Koha::Patron::Messages
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 Bug ID: 15632 Summary: Move the messages related code to Koha::Patron::Messages Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org Blocks: 15449 There are 4 subroutines in C4::Messages which could be moved to their own package: - AddMessage - DeleteMessage - GetMessagesCount - GetMessages With Koha::Patron::Message[s] based on Koha::Object[s], it will be easy to move them. Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15449 [Bug 15449] Move stuffs to the Koha namespace -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47091 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47091&action=edit Bug 15632: Koha::Patron::Messages - Add new classes The following 4 CRUD subroutines in C4::Members: - AddMessage - DeleteMessage - GetMessagesCount - GetMessages could be replaced with a new package based on Koha::Objets. This patchset will add the 2 Koha::Patron::Message[s] classes, then use it to replace the different calls to these subroutine. It will slightly reduce the size of C4::Members -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47092 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47092&action=edit Bug 15632: Koha::Patron::Messages - Be sure add and delete will log If the pref BorrowersLog is on, the store and delete method should log into the action_logs table. Easy to do by overloading them. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47093 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47093&action=edit Bug 15632: Koha::Patron::Messages - Remove AddMessage The AddMessage subroutine just 1. checked if all the parameters were passed 2. inserted the message in the DB 3. logged the action if needed These 3 jobs are now done by the overloaded store method of Koha::Patron::Message. Test plan: 1/ Go on the "check out" page of a patron 2/ Add different new messages -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47094 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47094&action=edit Bug 15632: Koha::Patron::Messages - Remove DeleteMessage The DeleteMessage just deleted and logged if needed. This is now be done by Koha::Patron::Message->delete. Test plan: 1/ Go on the "check out" page of a patron 2/ Delete some messages -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47095 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47095&action=edit Bug 15632: Koha::Patron::Messages - Remove GetMessagesCount The GetMessageCount subroutine was only used once, in opac-user.pl, to know if some messages will be displayed. Test plan: 1/ Create messages to display at the OPAC for a patron 2/ Logged this patron in at the OPAC, you should see the messages displayed. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47096 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47096&action=edit Bug 15632: Koha::Patron::Messages - Remove GetMessages This subroutine just retrieved the messages given some parameters. Some job should not have been done in this subroutine. It was called only 3 times, in circ/circulation.pl and opac-user.pl. Basically it was used to retrieved the message to displaye for a given patron ($borrowernumber) at the OPAC (B) or Staff (L). For the 3 calls, the 2 parameters $borrowernumber and $type (message_type) were passed, the "%" trick at the beginning of the subroutine was useless. Moreover, the date formatting should be done on the TT side, not in subroutine. The can_delete flag was set if the branchcode given in parameter was the same as the one of the message. This has been delegated to the template. Indeed the can_delete was not valid, since it must depend on the AllowAllMessageDeletion pref. The test is now: IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion'') There is not specific test plan for this patch, the changes have already been tested in previous patches. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 47097 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47097&action=edit Bug 15632: Koha::Patron::Messages - Remove tests The messages related tests in t/db_dependent/Members.t are not deprecated and can be removed. Test plan: git grep AddMessage git grep DeleteMessage git grep GetMessagesCount git grep GetMessages should not return any result. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15632 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=15548 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org