Description
Martin Renvoize (ashimema)
2025-01-19 07:41:18 UTC
Initial proposed specification: https://docs.google.com/document/d/1YbEuWbt2ELNbFv36T0qlMscofhMI2wwyhjhhLYAM2X8/edit?usp=sharing Created attachment 178582 [details] [review] Bug 38924: Add patron_quotas table Add the new patron_quotas table for storing circulation quotas Created attachment 178583 [details] [review] Bug 38924: DBIC Schema DBIC update Created attachment 178584 [details] [review] Bug 38924: Add Koha::Patron::Quota(s) classes Add initial Koha::Patron::Quota(s) classes for working with circulation quotas, including an overloaded store method to prevent overlapping quota periods. Additionally added a definition for the custom exception for if you are trying to store a quota whos active period overlaps with another for this patron Created attachment 178585 [details] [review] Bug 38924: Add quotas permissions This patch adds the new quotas permissions to the system Created attachment 178586 [details] [review] Bug 38924: Add API endpoints for managing quotas This commit adds the api endpoints for administering circulation quotas Created attachment 178587 [details] [review] Bug 38924: Add patron quota management page Add a new patron quota management tab under the members area for patrons of the organization category type. FIXME: Tie into permissions for 'add', 'edit' Depending on permissions, we will need display only options including guarantor and guarantee usage against quotas and also the options to add and edit quota. Created attachment 178588 [details] [review] Bug 38924: Add patron_quota_usage table Add the new patron_quota_usage table for recording usage of quota allocations against user issues. Created attachment 178589 [details] [review] Bug 38924: DBIC Schema Created attachment 178590 [details] [review] Bug 38924: Add Koha::Patron::Quota::Usage(s) classes Add ::Usage(s) classes for working with quota allocation usage. We overload store to ensure data consistency for the checkout_id field which is linked to either the issue or old_issue table appropriatly. We include a checkout relationship that handles the lack of foreign key due to issues/old_issues. We also add the Usage relations to Quota objects Created attachment 178591 [details] [review] Bug 38924: Overload delete method in Koha::Old::Checkout This overloads the delete method for old::checkouts to ensure that the issue_id for quotas usage is nulled in the event that an old_checkout is deleted. Would like to make this the standard for all the tables we have had to handle issue/old_issues for but is currently just hard-coded for quotas as many of the other tables with issue_id columns are not nullable. Created attachment 178592 [details] [review] Bug 38924: Add AllowQuotaOverride and UseGuarantorQuota preferences Add a system preferences to allow/dissallow quota overflow at checkout and enable/disable the use of guarantor quotas against guarantees Created attachment 178593 [details] [review] Bug 38924: Add get_patron_quotas method This commit adds the ability to return the guarantor's quota when searching for a patron's quota at checkout. This will only occur if the related syspref is enabled "UseGuaratorQuota" and will return in this order or priority: guarantor's quota with availability patrons's quota with availability guarantor's quota with no availability patron's quota with no availibility null Created attachment 178594 [details] [review] Bug 38924: Hook quota check and allocation into checkout Created attachment 178595 [details] [review] Bug 38924: Hook quota check and allocation into renewals This adds the checks for quotas and allocates a usage for a renewal of a book, should a quota exist for this patron Created attachment 178596 [details] [review] Bug 38924: Add quota picker to checkout confirmation This patch adds the quota selector to the checkout confirmation for if multiple eligable quotas are available Bug 38924: Return all eligable quotas so that the staff user can pick This patch adds the logic to return multiple eligable quotas if there are more than 1, allowing the staff user to pick which to assign an item to. Bug 38924: Add searcher method for currently active quota for patron Bug 38924: amend circ logic to handle multiple eligable quotas This amends the circulations logic to handle the fact that we can return multiple eligable quotas now. This ensures that the same quotas as was used for the checkout will be used for the renewal (both check and assignment) and that we use the selected quota from our confirmation dropdown for checkout of new item Bug 38924: add better name display for quota select at checkout Created attachment 178597 [details] [review] Bug 38924: Add koha_object_class to Schema files Created attachment 178598 [details] [review] Bug 38924: Move from get_patron_quota to Koha::Patron relations Bug 38924: Deal with multiple quota options in QUOTA_EXCEEDED handling Bug 38924: Deal with using the same quota for renewals Created attachment 178599 [details] [review] Bug 38924: Add quotas available on circuation screen Created attachment 178600 [details] [review] Bug 38924: Add relations after the hash in DBIC This adds additional relations to our DBIC classes to allow relation traversal in our Koha::Objects Created attachment 178601 [details] [review] Bug 38924: Add type and timestamp to usage table This allows us to more easily audit what actions incremented the usage and when. We will use this later in display Created attachment 178602 [details] [review] Bug 38924: DBIC Dump Created attachment 178603 [details] [review] Bug 38924: Add quota accessor to Koha::Checkout and use on checkouts page Created attachment 178604 [details] [review] Bug 38924: Display quota used at checkout Use the quota relation added to Koha::Checkout to display an info alert message that quota allocation has been used by the checkout that just took place Created attachment 178605 [details] [review] Bug 38924: Add issue and old_issue relations to Schema Created attachment 178606 [details] [review] Bug 38924: Add quota usage api endpoint Created attachment 178607 [details] [review] Bug 38924: Add quota usage details modal Created attachment 178608 [details] [review] Bug 38924: Add option to enable/disable quotas This was a team effort between Jacob and I Created attachment 185631 [details] [review] Bug 38924: Add patron_quotas table Add the new patron_quotas table for storing circulation quotas Created attachment 185632 [details] [review] Bug 38924: DBIC Schema DBIC update Created attachment 185633 [details] [review] Bug 38924: Add Koha::Patron::Quota(s) classes Add initial Koha::Patron::Quota(s) classes for working with circulation quotas, including an overloaded store method to prevent overlapping quota periods. Additionally added a definition for the custom exception for if you are trying to store a quota whos active period overlaps with another for this patron Created attachment 185634 [details] [review] Bug 38924: Add quotas permissions This patch adds the new quotas permissions to the system Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 185635 [details] [review] Bug 38924: Add API endpoints for managing quotas This commit adds the api endpoints for administering circulation quotas Created attachment 185636 [details] [review] Bug 38924: Add patron quota management page Add a new patron quota management tab under the members area for patrons of the organization category type. FIXME: Tie into permissions for 'add', 'edit' Depending on permissions, we will need display only options including guarantor and guarantee usage against quotas and also the options to add and edit quota. Created attachment 185637 [details] [review] Bug 38924: Add patron_quota_usage table Add the new patron_quota_usage table for recording usage of quota allocations against user issues. Created attachment 185638 [details] [review] Bug 38924: DBIC Schema Created attachment 185639 [details] [review] Bug 38924: Add Koha::Patron::Quota::Usage(s) classes Add ::Usage(s) classes for working with quota allocation usage. We overload store to ensure data consistency for the checkout_id field which is linked to either the issue or old_issue table appropriatly. We include a checkout relationship that handles the lack of foreign key due to issues/old_issues. We also add the Usage relations to Quota objects Created attachment 185640 [details] [review] Bug 38924: Overload delete method in Koha::Old::Checkout This overloads the delete method for old::checkouts to ensure that the issue_id for quotas usage is nulled in the event that an old_checkout is deleted. Would like to make this the standard for all the tables we have had to handle issue/old_issues for but is currently just hard-coded for quotas as many of the other tables with issue_id columns are not nullable. Created attachment 185641 [details] [review] Bug 38924: Add AllowQuotaOverride and UseGuarantorQuota preferences Add a system preferences to allow/dissallow quota overflow at checkout and enable/disable the use of guarantor quotas against guarantees Created attachment 185642 [details] [review] Bug 38924: Add get_patron_quotas method This commit adds the ability to return the guarantor's quota when searching for a patron's quota at checkout. This will only occur if the related syspref is enabled "UseGuaratorQuota" and will return in this order or priority: guarantor's quota with availability patrons's quota with availability guarantor's quota with no availability patron's quota with no availibility null Created attachment 185643 [details] [review] Bug 38924: Hook quota check and allocation into checkout Created attachment 185644 [details] [review] Bug 38924: Hook quota check and allocation into renewals This adds the checks for quotas and allocates a usage for a renewal of a book, should a quota exist for this patron Created attachment 185645 [details] [review] Bug 38924: Add quota picker to checkout confirmation This patch adds the quota selector to the checkout confirmation for if multiple eligable quotas are available Bug 38924: Return all eligable quotas so that the staff user can pick This patch adds the logic to return multiple eligable quotas if there are more than 1, allowing the staff user to pick which to assign an item to. Bug 38924: Add searcher method for currently active quota for patron Bug 38924: amend circ logic to handle multiple eligable quotas This amends the circulations logic to handle the fact that we can return multiple eligable quotas now. This ensures that the same quotas as was used for the checkout will be used for the renewal (both check and assignment) and that we use the selected quota from our confirmation dropdown for checkout of new item Bug 38924: add better name display for quota select at checkout Created attachment 185646 [details] [review] Bug 38924: Add koha_object_class to Schema files Created attachment 185647 [details] [review] Bug 38924: Move from get_patron_quota to Koha::Patron relations Bug 38924: Deal with multiple quota options in QUOTA_EXCEEDED handling Bug 38924: Deal with using the same quota for renewals Created attachment 185648 [details] [review] Bug 38924: Add quotas available on circuation screen Created attachment 185649 [details] [review] Bug 38924: Add relations after the hash in DBIC This adds additional relations to our DBIC classes to allow relation traversal in our Koha::Objects Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 185650 [details] [review] Bug 38924: Add type and timestamp to usage table This allows us to more easily audit what actions incremented the usage and when. We will use this later in display Created attachment 185651 [details] [review] Bug 38924: DBIC Dump Created attachment 185652 [details] [review] Bug 38924: Add quota accessor to Koha::Checkout and use on checkouts page Created attachment 185653 [details] [review] Bug 38924: Display quota used at checkout Use the quota relation added to Koha::Checkout to display an info alert message that quota allocation has been used by the checkout that just took place Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 185654 [details] [review] Bug 38924: Add issue and old_issue relations to Schema Created attachment 185655 [details] [review] Bug 38924: Add quota usage api endpoint Created attachment 185656 [details] [review] Bug 38924: Add quota usage details modal Created attachment 185657 [details] [review] Bug 38924: Add option to enable/disable quotas Created attachment 185675 [details] [review] Bug 38924: Add patron_quotas table Add the new patron_quotas table for storing circulation quotas Created attachment 185676 [details] [review] Bug 38924: DBIC Schema DBIC update Created attachment 185677 [details] [review] Bug 38924: Add Koha::Patron::Quota(s) classes Add initial Koha::Patron::Quota(s) classes for working with circulation quotas, including an overloaded store method to prevent overlapping quota periods. Additionally added a definition for the custom exception for if you are trying to store a quota whos active period overlaps with another for this patron Created attachment 185678 [details] [review] Bug 38924: Add quotas permissions This patch adds the new quotas permissions to the system Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 185679 [details] [review] Bug 38924: Add API endpoints for managing quotas This commit adds the api endpoints for administering circulation quotas Created attachment 185680 [details] [review] Bug 38924: Add patron quota management page Add a new patron quota management tab under the members area for patrons of the organization category type. FIXME: Tie into permissions for 'add', 'edit' Depending on permissions, we will need display only options including guarantor and guarantee usage against quotas and also the options to add and edit quota. Created attachment 185681 [details] [review] Bug 38924: Add patron_quota_usage table Add the new patron_quota_usage table for recording usage of quota allocations against user issues. Created attachment 185682 [details] [review] Bug 38924: DBIC Schema Created attachment 185683 [details] [review] Bug 38924: Add Koha::Patron::Quota::Usage(s) classes Add ::Usage(s) classes for working with quota allocation usage. We overload store to ensure data consistency for the checkout_id field which is linked to either the issue or old_issue table appropriatly. We include a checkout relationship that handles the lack of foreign key due to issues/old_issues. We also add the Usage relations to Quota objects Created attachment 185684 [details] [review] Bug 38924: Overload delete method in Koha::Old::Checkout This overloads the delete method for old::checkouts to ensure that the issue_id for quotas usage is nulled in the event that an old_checkout is deleted. Would like to make this the standard for all the tables we have had to handle issue/old_issues for but is currently just hard-coded for quotas as many of the other tables with issue_id columns are not nullable. Created attachment 185685 [details] [review] Bug 38924: Add AllowQuotaOverride and UseGuarantorQuota preferences Add a system preferences to allow/dissallow quota overflow at checkout and enable/disable the use of guarantor quotas against guarantees Created attachment 185686 [details] [review] Bug 38924: Add get_patron_quotas method This commit adds the ability to return the guarantor's quota when searching for a patron's quota at checkout. This will only occur if the related syspref is enabled "UseGuaratorQuota" and will return in this order or priority: guarantor's quota with availability patrons's quota with availability guarantor's quota with no availability patron's quota with no availibility null Created attachment 185687 [details] [review] Bug 38924: Hook quota check and allocation into checkout Created attachment 185688 [details] [review] Bug 38924: Hook quota check and allocation into renewals This adds the checks for quotas and allocates a usage for a renewal of a book, should a quota exist for this patron Created attachment 185689 [details] [review] Bug 38924: Add quota picker to checkout confirmation This patch adds the quota selector to the checkout confirmation for if multiple eligable quotas are available Bug 38924: Return all eligable quotas so that the staff user can pick This patch adds the logic to return multiple eligable quotas if there are more than 1, allowing the staff user to pick which to assign an item to. Bug 38924: Add searcher method for currently active quota for patron Bug 38924: amend circ logic to handle multiple eligable quotas This amends the circulations logic to handle the fact that we can return multiple eligable quotas now. This ensures that the same quotas as was used for the checkout will be used for the renewal (both check and assignment) and that we use the selected quota from our confirmation dropdown for checkout of new item Bug 38924: add better name display for quota select at checkout Created attachment 185690 [details] [review] Bug 38924: Add koha_object_class to Schema files Created attachment 185691 [details] [review] Bug 38924: Move from get_patron_quota to Koha::Patron relations Bug 38924: Deal with multiple quota options in QUOTA_EXCEEDED handling Bug 38924: Deal with using the same quota for renewals Created attachment 185692 [details] [review] Bug 38924: Add quotas available on circuation screen Created attachment 185693 [details] [review] Bug 38924: Add relations after the hash in DBIC This adds additional relations to our DBIC classes to allow relation traversal in our Koha::Objects Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 185694 [details] [review] Bug 38924: Add type and timestamp to usage table This allows us to more easily audit what actions incremented the usage and when. We will use this later in display Created attachment 185695 [details] [review] Bug 38924: DBIC Dump Created attachment 185696 [details] [review] Bug 38924: Add quota accessor to Koha::Checkout and use on checkouts page Created attachment 185697 [details] [review] Bug 38924: Display quota used at checkout Use the quota relation added to Koha::Checkout to display an info alert message that quota allocation has been used by the checkout that just took place Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 185698 [details] [review] Bug 38924: Add issue and old_issue relations to Schema Created attachment 185699 [details] [review] Bug 38924: Add quota usage api endpoint Created attachment 185700 [details] [review] Bug 38924: Add quota usage details modal Created attachment 185701 [details] [review] Bug 38924: Add option to enable/disable quotas Created attachment 185702 [details] [review] Bug 38924: Remove duplicate sub It also made the tests fail Rebased. Compared old patches to new patches to ensure no unintended introduced changes. There are some differences. But it seems it's not from solving conflicts but more the other changes in Koha somehow causing a change generated schema code to move from one commit to another. Anyway, same final state. https://gitlab.com/tuxayo/Koha/-/commit/a8314615be7286edde4f00338f91d3143606cbca#31b1f86aafa41bf560774c2daa7af732818260e1_47_47 https://gitlab.com/tuxayo/Koha/-/commit/17092c96432275b77e8297a9e388e8a76e2f28f7#47 https://gitlab.com/tuxayo/Koha/-/commit/acedb3f90e07d6ed2b26ab0427ad8dadc86e3183#31b1f86aafa41bf560774c2daa7af732818260e1_0_47 https://gitlab.com/tuxayo/Koha/-/commit/49afbbcb06d0b19e35dc8c0df543c3594f9b4121#31b1f86aafa41bf560774c2daa7af732818260e1_0_47 Tests pass. Anything else to run than t/Koha/Auth/Permissions.t ? Doesn't mean everything works as on 2025-02-24. In case it's needed later, relevant branch: https://gitlab.com/tuxayo/Koha/-/commits/bug_38924-old-2025-02-24 Any test plan besides following the high level user stories of the document in comment 1? If it's that, at least that should be mentioned in a commit message in a test plan section. Or copy the user story there. There are 3 DBIC generation commits (which generate 3 times conflicts VS having one). And they don't have DO NOT PUSH in the name. https://wiki.koha-community.org/wiki/Database_updates#Files_to_change -- Since February, bug 39367 landed, providing that test: kohadev-koha@kohadevbox:koha(bug_38924-rebase-wip)$ time prove xt/author/pod_coverage.t xt/author/pod_coverage.t .. 864/1249 # Failed test 'POD coverage for Koha/Schema/Result/PatronQuota.pm' # at xt/author/pod_coverage.t line 35. # got: '1' # expected: '0' # koha_objects_class # Failed test 'POD coverage for Koha/Schema/Result/PatronQuotaUsage.pm' # at xt/author/pod_coverage.t line 35. # got: '2' # expected: '0' # koha_objects_class, koha_object_class xt/author/pod_coverage.t .. 1241/1249 # Looks like you failed 2 tests of 1249. xt/author/pod_coverage.t .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/1249 subtests Test Summary Report ------------------- xt/author/pod_coverage.t (Wstat: 512 (exited 2) Tests: 1249 Failed: 2) Failed tests: 1015-1016 Non-zero exit status: 2 Files=1, Tests=1249, 8 wallclock secs ( 0.23 usr 0.02 sys + 6.43 cusr 0.63 csys = 7.31 CPU) Result: FAIL |