Bug 12285

Summary: Allow easy printing of patron's fines
Product: Koha Reporter: paxed <pasi.kallinen>
Component: Staff interfaceAssignee: Emmi Takkinen <emmi.takkinen>
Status: RESOLVED DUPLICATE QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: barton, emmi.takkinen, gmcharlt, josef.moravec, katrin.fischer, kelly, kyle, lisettepalouse+koha, m.de.rooy, marjorie.barry-vila, martin.renvoize, nkeener, sandboxes, veron
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=1232
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10708
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31713
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31714
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Add a printing option to the staff client patron details page to print a slip of patron's fines.
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Fix QA issues
Bug 12285: Fix QA issues
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Fix QA issues
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Fix QA issues
Bug 12285: Use accountlines date if issue is not found
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Fix QA issues
Bug 12285: Use accountlines date if issue is not found
Bug 12285: (follow-up) Correct extra quote in yml file
Bug 12285: Don't print fines with undef amountoutstanding
Bug 12285: Determine patrons preferred languge
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Fix QA issues
Bug 12285: Use accountlines date if issue is not found
Bug 12285: (follow-up) Correct extra quote in yml file
Bug 12285: Don't print fines with undef amountoutstanding
Bug 12285: Determine patrons preferred languge
Bug 12285: Allow easy printing of patron's fines.
Bug 12285: Fix QA issues
Bug 12285: Use accountlines date if issue is not found
Bug 12285: (follow-up) Correct extra quote in yml file
Bug 12285: Don't print fines with undef amountoutstanding
Bug 12285: Determine patrons preferred languge

Description paxed 2014-05-19 10:29:26 UTC
There should be an easy way to print a slip of patron's fines.
Comment 1 paxed 2014-05-19 10:34:44 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2014-06-09 19:18:59 UTC
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?
Comment 3 Nicole C. Engard 2014-06-20 19:00:34 UTC
Changing status so Marc's concerns are addressed in a new patch.
Comment 4 Marc Véron 2014-06-22 14:21:10 UTC Comment hidden (obsolete)
Comment 5 Biblibre Sandboxes 2014-07-15 01:51:39 UTC
Patch tested with a sandbox, by Aleisha <aleishaamohia@hotmail.com>
Comment 6 Biblibre Sandboxes 2014-07-15 01:51:57 UTC
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 7 Katrin Fischer 2014-07-20 18:48:42 UTC
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.
Comment 8 NancyK. 2016-09-06 17:32:25 UTC
Hi, is anyone still considering his bug.  I have had a request from staff for this very feature.
Comment 9 Katrin Fischer 2017-02-23 10:36:13 UTC
Pasi, is this still on your todo list or would it be ok to reset the Assignee?
Comment 10 Emmi Takkinen 2021-07-27 10:19:46 UTC
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>
Comment 11 Emmi Takkinen 2021-07-27 10:20:22 UTC
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
Comment 12 Owen Leonard 2021-07-27 11:28:51 UTC
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
Comment 13 Emmi Takkinen 2021-07-28 07:57:09 UTC
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
Comment 14 Kelly McElligott 2021-08-10 16:34:09 UTC
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!
Comment 15 Emmi Takkinen 2022-01-24 13:56:11 UTC
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>
Comment 16 Emmi Takkinen 2022-01-24 13:56:42 UTC
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
Comment 17 Owen Leonard 2022-01-25 14:38:24 UTC
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.
Comment 18 Emmi Takkinen 2022-01-28 11:48:24 UTC
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>
Comment 19 Emmi Takkinen 2022-01-28 11:49:00 UTC
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
Comment 20 Emmi Takkinen 2022-01-28 11:53:16 UTC
(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).
Comment 21 Owen Leonard 2022-01-28 12:24:46 UTC
> >  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.
Comment 22 Emmi Takkinen 2022-01-28 13:32:55 UTC
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
Comment 23 Owen Leonard 2022-01-28 14:00:43 UTC
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>
Comment 24 Owen Leonard 2022-01-28 14:04:57 UTC
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>
Comment 25 Owen Leonard 2022-01-28 14:05:03 UTC
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>
Comment 26 Owen Leonard 2022-01-28 14:05:10 UTC
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>
Comment 27 Owen Leonard 2022-01-28 14:05:16 UTC
Created attachment 129947 [details] [review]
Bug 12285: (follow-up) Correct extra quote in yml file

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 28 Kyle M Hall 2022-03-31 15:12:22 UTC
t/db_dependent/Members/FineSlip.t is failing
Comment 29 Emmi Takkinen 2022-04-01 05:47:48 UTC
(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?
Comment 30 Emmi Takkinen 2022-04-08 09:53:05 UTC
Just noticed that accountlines with undefined amountoutstanding are printed in fineslip.
Comment 31 Emmi Takkinen 2022-04-08 10:06:26 UTC
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
Comment 32 Emmi Takkinen 2022-04-11 10:40:55 UTC
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
Comment 33 Lisette Scheer 2022-08-11 16:09:26 UTC
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] "]}
Comment 34 Emmi Takkinen 2022-08-12 06:06:01 UTC
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>
Comment 35 Emmi Takkinen 2022-08-12 06:06:26 UTC
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>
Comment 36 Emmi Takkinen 2022-08-12 06:06:54 UTC
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>
Comment 37 Emmi Takkinen 2022-08-12 06:07:32 UTC
Created attachment 139040 [details] [review]
Bug 12285: (follow-up) Correct extra quote in yml file

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 38 Emmi Takkinen 2022-08-12 06:08:03 UTC
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
Comment 39 Emmi Takkinen 2022-08-12 06:08:28 UTC
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
Comment 40 Emmi Takkinen 2022-08-12 06:08:43 UTC
Rebased patches.
Comment 41 ByWater Sandboxes 2022-09-20 16:58:18 UTC
Created attachment 140795 [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>

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Comment 42 ByWater Sandboxes 2022-09-20 16:58:23 UTC
Created attachment 140796 [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>

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Comment 43 ByWater Sandboxes 2022-09-20 16:58:28 UTC
Created attachment 140797 [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>

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Comment 44 ByWater Sandboxes 2022-09-20 16:58:33 UTC
Created attachment 140798 [details] [review]
Bug 12285: (follow-up) Correct extra quote in yml file

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Comment 45 ByWater Sandboxes 2022-09-20 16:58:38 UTC
Created attachment 140799 [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

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Comment 46 ByWater Sandboxes 2022-09-20 16:58:42 UTC
Created attachment 140800 [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

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Comment 47 Lisette Scheer 2022-09-20 16:59:10 UTC
Worked as expected.
Comment 48 Martin Renvoize 2022-10-10 11:21:39 UTC
Please see my simplified and modernized alternative in bug 31713 and bug 31714.
Comment 49 Marcel de Rooy 2022-10-28 09:09:00 UTC
I am blocking this report now in favor of bug 31713.

Please communicate about things you might miss from this patch set.
Comment 50 Marcel de Rooy 2022-10-28 09:33:18 UTC
In the meantime 31713 moved to FQA. So we might give this a chance again unless it moves quickly.
Comment 51 Katrin Fischer 2022-11-14 21:59:46 UTC
Hi Emmi, bug 31713 has been pushed now. I think it makes this probably a duplicate, but could you have a look if it covers all your requirements?

*** This bug has been marked as a duplicate of bug 31713 ***
Comment 52 Emmi Takkinen 2022-11-25 06:18:23 UTC
(In reply to Katrin Fischer from comment #51)
> Hi Emmi, bug 31713 has been pushed now. I think it makes this probably a
> duplicate, but could you have a look if it covers all your requirements?
> 
> *** This bug has been marked as a duplicate of bug 31713 ***

I'm gonna ask one our librarians to test this next week, they have better understanding if something is missing :)