Summary: | Silence warns in Patroncard.pm when layout values are empty | ||
---|---|---|---|
Product: | Koha | Reporter: | Lucas Gass (lukeg) <lucas> |
Component: | Label/patron card printing | Assignee: | Lucas Gass (lukeg) <lucas> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | normal | ||
Priority: | P5 - low | CC: | fridolin.somers, m.de.rooy, madamyk, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
23.11.00,23.05.04,22.11.11
|
|
Circulation function: | |||
Attachments: |
Bug 34532: Silence warns in Patroncard.pm
Bug 34532: Silence warns in Patroncard.pm Bug 34532: Silence warns in Patroncard.pm Bug 34532: Silence warns in Patroncard.pm Bug 34532: (follow-up) Fix typos llx => lly Bug 34532: Silence warns in Patroncard.pm |
Description
Lucas Gass (lukeg)
2023-08-14 21:10:23 UTC
Created attachment 154415 [details] [review] Bug 34532: Silence warns in Patroncard.pm To test: 1. Go to patron card creator and make a patron card batch, card layout, and card template. 2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate. 3. Now go create a card batch while tailing the plack-intranet-error log/ 4. Notice in the logs: [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249. 5. Apply patch, restart_all 6. Try again and notice the WARNS should be gone from the logs now. 7. Make sure you can still create patron cards and the PDF's the generate look right. Created attachment 154416 [details] [review] Bug 34532: Silence warns in Patroncard.pm To test: 1. Go to patron card creator and make a patron card batch, card layout, and card template. 2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate. 3. Now go create a card batch while tailing the plack-intranet-error log/ 4. Notice in the logs: [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249. 5. Apply patch, restart_all 6. Try again and notice the WARNS should be gone from the logs now. 7. Make sure you can still create patron cards and the PDF's the generate look right. Created attachment 154680 [details] [review] Bug 34532: Silence warns in Patroncard.pm To test: 1. Go to patron card creator and make a patron card batch, card layout, and card template. 2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate. 3. Now go create a card batch while tailing the plack-intranet-error log/ 4. Notice in the logs: [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249. 5. Apply patch, restart_all 6. Try again and notice the WARNS should be gone from the logs now. 7. Make sure you can still create patron cards and the PDF's the generate look right. Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Sorry (no tidy fan either): WARN tidiness The file is less tidy than before (bad/messy lines before: 175, now: 180) Created attachment 155119 [details] [review] Bug 34532: Silence warns in Patroncard.pm To test: 1. Go to patron card creator and make a patron card batch, card layout, and card template. 2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate. 3. Now go create a card batch while tailing the plack-intranet-error log/ 4. Notice in the logs: [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249. 5. Apply patch, restart_all 6. Try again and notice the WARNS should be gone from the logs now. 7. Make sure you can still create patron cards and the PDF's the generate look right. Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Thanks Lucas, more extract variable refactoring :) Thanks Marcel to also look at this, I started to look at this yesterday and wondered if there was a reason to have the $llx & $lly default values set in the method instead of the constructor: https://git.koha-community.org/Koha-community/Koha/src/commit/e26d7c783eb8c70d318e402e3a90930afcff44cd/C4/Patroncards/Patroncard.pm#L74 Currently there are likely the same warns in the other functions if llx & lly are undef. And now I notice it's actually done twice, once in each method, so there is duplication. And one occurrence is `my $lly = $self->{'llx'} || 0;` which very likely should be $self->{'lly'} lly => $llx + $llx_layout * $self->{'unitvalue'}, Typo Created attachment 155630 [details] [review] Bug 34532: (follow-up) Fix typos llx => lly Created attachment 155638 [details] [review] Bug 34532: Silence warns in Patroncard.pm To test: 1. Go to patron card creator and make a patron card batch, card layout, and card template. 2. In the card layout leave some values blank for Lower left X coordinate and Lower left Y coordinate. 3. Now go create a card batch while tailing the plack-intranet-error log/ 4. Notice in the logs: [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 109. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 248. [2023/08/14 20:50:54] [WARN] Argument "" isn't numeric in multiplication (*) at /kohadevbox/koha/C4/Patroncards/Patroncard.pm line 249. 5. Apply patch, restart_all 6. Try again and notice the WARNS should be gone from the logs now. 7. Make sure you can still create patron cards and the PDF's the generate look right. Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Merged both patches Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.04 Nice work everyone! Pushed to oldstable for 22.11.x |