There should be an easy way to print a slip of patron's fines.
Created attachment 28327 [details] [review] Add a printing option to the staff client patron details page to print a slip of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. --- Yes, the C4/Members.pm is missing docs. I'm just getting this out in case it's of any use.
I tested. After applying the patch the menu item appeared as expected, but the slip did not display properly. Ic checked FINESLIP in Home › Tools › Notices & Slips. It had missing angle brackets (<) at two places. After fixing it the slip printed as expected. The HTML in FINESLIP inserted by the patch was: <<borrowers.firstname>> <<borrowers.surname>><br> <<borrowers.cardnumber>><br> Fines: <<total.fines>> <ul> <fines> <li><<fines.date_due>>, 1001<fines.amount>><br> Bar code: <<items.barcode>><br> <<fines.description>> </fines> </ul> Total: 1001<total.amount>> If I look at the patch, the strange 1001's appear at the places where, in both SQL statemens, we have $<<fines.amount>> and $<<total.amount>> Could it be that the $ signes are superfluous?
Changing status so Marc's concerns are addressed in a new patch.
Created attachment 29144 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else.
Patch tested with a sandbox, by Aleisha <aleishaamohia@hotmail.com>
Created attachment 29692 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Comment on attachment 29692 [details] [review] Bug 12285: Allow easy printing of patron's fines. Review of attachment 29692 [details] [review]: ----------------------------------------------------------------- Hi Pasi, I have added my comments using Splinter review, hope everything is clear. Again, I really like the idea of this and hope you can provide a follow-up. Addition to Splinter comments: Please include the new notice template in the translated sample_notices.sql as well. Leaving them in English is fine. ::: C4/Members.pm @@ +2406,5 @@ > ); > } > > + > +sub GetBorrowerFines { I am not sure this one is needed - why not use GetMemberAccountRecords? If we are to keep this one, please point out why it's more useful and add unit tests and documentation (POD). @@ +2422,5 @@ > + my $data = $sth->fetchall_arrayref({}); > + return $data; > +} > + > +sub FineSlip { Needs unit tests. ::: installer/data/mysql/en/mandatory/sample_notices.sql @@ +143,5 @@ > Your library.' > ); > + > +INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) > +VALUES ( 'circulation', 'FINESLIP', '', 'Patron fines -slip', '1', 'Fines', '<<borrowers.firstname>> <<borrowers.surname>><br> I think 'Fines and fees slip' would maybe be better. @@ +149,5 @@ > +Fines: <<total.fines>> > +<ul> > +<fines> > +<li><<fines.date_due>>, <<fines.amount>><br> > +Bar code: <<items.barcode>><br> Small typo - barcode, please fix. ::: installer/data/mysql/updatedatabase.pl @@ +8573,5 @@ > +$DBversion = "3.17.00.XXX"; > +if ( CheckVersion($DBversion) ) { > + $dbh->do(" > +INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) > +VALUES ( 'circulation', 'FINESLIP', '', 'Patron fines -slip', '1', 'Fines', '<<borrowers.firstname>> <<borrowers.surname>><br> Please fix the name here too. @@ +8579,5 @@ > +Fines: <<total.fines>> > +<ul> > +<fines> > +<li><<fines.date_due>>, <<fines.amount>><br> > +Bar code: <<items.barcode>><br> Small typo, please fix. ::: koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ +129,4 @@ > [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %] > <li><a id="printslip" href="#">Print slip</a></li> > <li><a id="printquickslip" href="#">Print quick slip</a></li> > + <li><a id="printfineslip" href="#">Print fines</a></li> Maybe print fines and fees? Just a suggestion, not blocker.
Hi, is anyone still considering his bug. I have had a request from staff for this very feature.
Pasi, is this still on your todo list or would it be ok to reset the Assignee?
Created attachment 123202 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Rebased-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Created attachment 123203 [details] [review] Bug 12285: Fix QA issues This patch: - removes GetBorrowerFines and reworks Fineslip to use Koha objects - adds the new notice template in the translated sample_notices.sql files - adds unit tests To test follow test plan from previous patch and confirm everything works as intented. Also prove t/db_dependent/Members/FineSlip.t. Sponsored-by: Koha-Suomi Oy
The print slip page gives me an error: Can't call method "unblessed" on an undefined value at /kohadevbox/koha/C4/Members.pm line 692 QA tool reports the following failures: FAIL C4/Members.pm FAIL pod coverage POD is missing for FineSlip POD is missing for checkcardnumber FAIL t/db_dependent/Members/FineSlip.t FAIL file permissions File must have the exec flag
Created attachment 123243 [details] [review] Bug 12285: Fix QA issues This patch: - removes GetBorrowerFines and reworks Fineslip to use Koha objects - adds the new notice template in the translated sample_notices.sql files - adds unit tests Sponsored-by: Koha-Suomi Oy
Hi ! Tried to sign off on this bug and received this error: Can't call method "date_due" on an undefined value at /kohadevbox/koha/C4/Members.pm line 702 Thanks!
Created attachment 129723 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Rebased-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Created attachment 129724 [details] [review] Bug 12285: Fix QA issues This patch: - removes GetBorrowerFines and reworks Fineslip to use Koha objects - adds the new notice template in the translated sample_notices.sql files - adds unit tests Sponsored-by: Koha-Suomi Oy
I'm still getting warnings from the QA tool: FAIL installer/data/mysql/en/mandatory/sample_notices.yml FAIL yaml_valid ARRAY(0x55d88d804738) The change to sample_notices.yml also lacks a value for "module," which is required. After applying the patch and running "reset_all" in koha-testing-docker I see this error in the output: C4::Installer::load_sql returned the following errors while attempting to load /kohadevbox/koha/installer/data/mysql/en/mandatory/sample_notices.yml: DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`letter`, CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDA) at /kohadevbox/koha/C4/Installer.pm line 574.
Created attachment 129922 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Rebased-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Created attachment 129923 [details] [review] Bug 12285: Fix QA issues This patch: - removes GetBorrowerFines and reworks Fineslip to use Koha objects - adds the new notice template in the translated sample_notices.sql files - adds unit tests Sponsored-by: Koha-Suomi Oy
(In reply to Owen Leonard from comment #17) > I'm still getting warnings from the QA tool: > > FAIL installer/data/mysql/en/mandatory/sample_notices.yml > FAIL yaml_valid > ARRAY(0x55d88d804738) > > The change to sample_notices.yml also lacks a value for "module," which is > required. > > After applying the patch and running "reset_all" in koha-testing-docker I > see this error in the output: > > C4::Installer::load_sql returned the following errors while attempting to > load /kohadevbox/koha/installer/data/mysql/en/mandatory/sample_notices.yml: > DBD::mysql::db do failed: Cannot add or update a child row: a foreign key > constraint fails (`koha_kohadev`.`letter`, CONSTRAINT > `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) > REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE > CASCADE ON UPDA) at /kohadevbox/koha/C4/Installer.pm line 574. I was unable to produce these errors, but fixed invalid yaml syntax and missing "module" value to the first patch. Also fixed atomicupdate files name (there was cap between 12285 and -allow) and added IGNORE to INSERT statement (my wild guess is that this caused that last error).
> > FAIL installer/data/mysql/en/mandatory/sample_notices.yml > > FAIL yaml_valid > > ARRAY(0x55d88d804738) Line 1594 has an extra quote: - "<li>"" I get an error when printing a fine slip for a charge which isn't associated with a checkout: Can't call method "date_due" on an undefined value at /kohadevbox/koha/C4/Members.pm line 711 I triggered this by going to Accounting -> Create manual invoice and adding an arbitrary amount.
Created attachment 129937 [details] [review] Bug 12285: Use accountlines date if issue is not found Printing fines slip would raise error if patron has manually created invoice. In these cases use accountlines date instead of issues date_due. Also silence error: "Argument "" isn't numeric in numeric comparison (<=>)" Sponsored-by: Koha-Suomi Oy
Created attachment 129943 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Rebased-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 129944 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Rebased-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 129945 [details] [review] Bug 12285: Fix QA issues This patch: - removes GetBorrowerFines and reworks Fineslip to use Koha objects - adds the new notice template in the translated sample_notices.sql files - adds unit tests Sponsored-by: Koha-Suomi Oy Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 129946 [details] [review] Bug 12285: Use accountlines date if issue is not found Printing fines slip would raise error if patron has manually created invoice. In these cases use accountlines date instead of issues date_due. Also silence error: "Argument "" isn't numeric in numeric comparison (<=>)" Sponsored-by: Koha-Suomi Oy Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 129947 [details] [review] Bug 12285: (follow-up) Correct extra quote in yml file Signed-off-by: Owen Leonard <oleonard@myacpl.org>
t/db_dependent/Members/FineSlip.t is failing
(In reply to Kyle M Hall from comment #28) > t/db_dependent/Members/FineSlip.t is failing Tested and tests pass fine. Could you take a look where it exactly fails for you?
Just noticed that accountlines with undefined amountoutstanding are printed in fineslip.
Created attachment 133112 [details] [review] Bug 12285: Don't print fines with undef amountoutstanding Accountlines with undefined amountoutstading value are printed in fineslip. To test: 1) Find patron with credit type accountlines. 2) Edit some of those lines from database, set their amountoutstanding as NULL. 3) Print fineslip. => Note that edited credit lines are displayed in the fineslip. 4) Apply patch. 5) Print fineslip. => Note that lines are no longer displayed in the fineslip. Sponsored-by: Koha-Suomi Oy
Created attachment 133147 [details] [review] Bug 12285: Determine patrons preferred languge Fineslip is not printed by patrons preferred language choice. To test: 1) Add content to fineslip under "en" tab. 2) Find patron with fines. 3) Set patrons preferred language as "en". 4) Print fines. => Fineslip has default content. 5) Apply patch. 6) Print slip. => Fineslip has "en" content. Sponsored-by: Koha-Suomi Oy
Patch Failed to apply. TASK [Apply bug 12285 via git-bz in docker container] ************************** fatal: [localhost -> koha-fineprint]: FAILED! => {"changed": true, "cmd": "cd /kohadevbox/koha && yes | git bz apply 12285", "delta": "0:00:04.819270", "end": "2022-08-11 16:05:34.779629", "msg": "non-zero return code", "rc": 1, "start": "2022-08-11 16:05:29.960359", "stderr": "error: Failed to merge in the changes.\nhint: Use 'git am --show-current-patch=diff' to see the failed patch\nPatch left in /tmp/Bug-12285-Allow-easy-printing-of-patrons-fines-MrApna.patch", "stderr_lines": ["error: Failed to merge in the changes.", "hint: Use 'git am --show-current-patch=diff' to see the failed patch", "Patch left in /tmp/Bug-12285-Allow-easy-printing-of-patrons-fines-MrApna.patch"], "stdout": "Applying: Bug 12285: Allow easy printing of patron's fines.\nUsing index info to reconstruct a base tree...\nM\tC4/Members.pm\nM\tinstaller/data/mysql/en/mandatory/sample_notices.yml\nM\tkoha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc\nM\tkoha-tmpl/intranet-tmpl/prog/js/members-menu.js\nFalling back to patching base and 3-way merge...\nAuto-merging koha-tmpl/intranet-tmpl/prog/js/members-menu.js\nAuto-merging koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc\nAuto-merging installer/data/mysql/en/mandatory/sample_notices.yml\nCONFLICT (content): Merge conflict in installer/data/mysql/en/mandatory/sample_notices.yml\nAuto-merging C4/Members.pm\nPatch failed at 0001 Bug 12285: Allow easy printing of patron's fines.\nWhen you have resolved this problem run \"git bz apply --continue\".\nIf you would prefer to skip this patch, instead run \"git bz apply --skip\".\nTo restore the original branch and stop patching run \"git bz apply --abort\".\n\nBug 12285 - Allow easy printing of patron's fines\n\n129944 - Bug 12285: Allow easy printing of patron's fines.\n129945 - Bug 12285: Fix QA issues\n129946 - Bug 12285: Use accountlines date if issue is not found\n129947 - Bug 12285: (follow-up) Correct extra quote in yml file\n133112 - Bug 12285: Don't print fines with undef amountoutstanding\n133147 - Bug 12285: Determine patrons preferred languge\n\nApply? [(y)es, (n)o, (i)nteractive] ", "stdout_lines": ["Applying: Bug 12285: Allow easy printing of patron's fines.", "Using index info to reconstruct a base tree...", "M\tC4/Members.pm", "M\tinstaller/data/mysql/en/mandatory/sample_notices.yml", "M\tkoha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc", "M\tkoha-tmpl/intranet-tmpl/prog/js/members-menu.js", "Falling back to patching base and 3-way merge...", "Auto-merging koha-tmpl/intranet-tmpl/prog/js/members-menu.js", "Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc", "Auto-merging installer/data/mysql/en/mandatory/sample_notices.yml", "CONFLICT (content): Merge conflict in installer/data/mysql/en/mandatory/sample_notices.yml", "Auto-merging C4/Members.pm", "Patch failed at 0001 Bug 12285: Allow easy printing of patron's fines.", "When you have resolved this problem run \"git bz apply --continue\".", "If you would prefer to skip this patch, instead run \"git bz apply --skip\".", "To restore the original branch and stop patching run \"git bz apply --abort\".", "", "Bug 12285 - Allow easy printing of patron's fines", "", "129944 - Bug 12285: Allow easy printing of patron's fines.", "129945 - Bug 12285: Fix QA issues", "129946 - Bug 12285: Use accountlines date if issue is not found", "129947 - Bug 12285: (follow-up) Correct extra quote in yml file", "133112 - Bug 12285: Don't print fines with undef amountoutstanding", "133147 - Bug 12285: Determine patrons preferred languge", "", "Apply? [(y)es, (n)o, (i)nteractive] "]}
Created attachment 139037 [details] [review] Bug 12285: Allow easy printing of patron's fines. Add a printing option to the staff client patron details page to print a slip of patron's fines. To test: 1) Apply patch. 2) Check in tools > Notices & Slips that you have FINESLIP slip, and a print message there. If not, run updatedatabase.pl 3) Either create some fines for a patron, or look up a patron with existing fines. 4) From that patron's detail page, and the Print-menu in the toolbar, select "Print fines" 5) You should get a slip of the patron's fines. I removed superfluous $ signs in sample_notices.sql and updatedatabase.pl Patch works now as expected. However, it needs now a Sign-off by somebody else. Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Rebased-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 139038 [details] [review] Bug 12285: Fix QA issues This patch: - removes GetBorrowerFines and reworks Fineslip to use Koha objects - adds the new notice template in the translated sample_notices.sql files - adds unit tests Sponsored-by: Koha-Suomi Oy Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 139039 [details] [review] Bug 12285: Use accountlines date if issue is not found Printing fines slip would raise error if patron has manually created invoice. In these cases use accountlines date instead of issues date_due. Also silence error: "Argument "" isn't numeric in numeric comparison (<=>)" Sponsored-by: Koha-Suomi Oy Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 139040 [details] [review] Bug 12285: (follow-up) Correct extra quote in yml file Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 139041 [details] [review] Bug 12285: Don't print fines with undef amountoutstanding Accountlines with undefined amountoutstading value are printed in fineslip. To test: 1) Find patron with credit type accountlines. 2) Edit some of those lines from database, set their amountoutstanding as NULL. 3) Print fineslip. => Note that edited credit lines are displayed in the fineslip. 4) Apply patch. 5) Print fineslip. => Note that lines are no longer displayed in the fineslip. Sponsored-by: Koha-Suomi Oy
Created attachment 139042 [details] [review] Bug 12285: Determine patrons preferred languge Fineslip is not printed by patrons preferred language choice. To test: 1) Add content to fineslip under "en" tab. 2) Find patron with fines. 3) Set patrons preferred language as "en". 4) Print fines. => Fineslip has default content. 5) Apply patch. 6) Print slip. => Fineslip has "en" content. Sponsored-by: Koha-Suomi Oy
Rebased patches.