Add a tool to calculate static fine. For example, 7 days left = 1€ fixed fine
Created attachment 5378 [details] [review] Bug 6858: Adds staticfines.pl for static fines processing
Updating Version : This ENH will be for Koha 3.8
Bug versionned for master. entries will be made against rel_3_8 once the patch has been applied (see thread about that on koha-devel yesterday)
Created attachment 6197 [details] [review] Bug 6858: Adds staticfines.pl for static fines processing Add a tool to calculate static fine. For example, 7 days left = 1€ fixed fine
$ git bz apply 6858 Bug 6858 - Adds staticfines.pl for static fines processing Bug 6858: Adds staticfines.pl for static fines processing Apply? [yn] y Applying: Bug 6858: Adds staticfines.pl for static fines processing /home/claire/dev/community_repo/koha/.git/rebase-apply/patch:175: trailing whitespace. error: misc/cronjobs/staticfines.pl: already exists in index Patch failed at 0001 Bug 6858: Adds staticfines.pl for static fines processing When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". Patch left in /tmp/Bug-6858-Adds-staticfinespl-for-static-fines-proce-LGi2ve.patch
Forget it, applies well with a 3-way merge in git bz (In reply to comment #5)
Patches both apply - which patch is obsolete? Can you explain a bit more about how this works? How often should this be run?
Hi Katrin, The two attached patches are the same, only the "from" md5 differs, so I guess we can safely get rid of one of them. This patch allows to apply only one fine for a given borrower, no matter how many items are late, based on a given delay, which applies to the most late item. The script bypasses overdue rules already defined in koha. Example : staticfines.pl --category CAT1, 10 --category CAT2, 20 --library LIB1 --library LIB2 --delay 20 This will charge a 10€ fine for borrowers of category CAT1 and a 20€ fine for borrowers of category CAT2 for libraries LIB1 and LIB2, after a 20 days overdue delay for their most late item. This script is typically used on a daily cronjob basis.
the 9 march 2012 in the sandbox test1 I apply the patch I test the command : perl staticfines.pl -category J14,10 -library MAURES -delay 2 for the borrwernumber 5103 borrowernumber | categorycode | date_due | +----------------+--------------+------------+ | 5103 | J14 | 2012-03-07 | but nothing in the borrower account i test with all the option in the system preference finmode...but nothing.... mistake with finemode ?
I don't really understand how to test this patch... Can you propose a test plan ?
OK testing with : syspref : finesMode on "calculate and bill" ("calculer et facturer" in french) and run "misc/cronjobs/fines.pl"
For a user (of a given category and library) with several overdues, launch the script : staticfines.pl --category CAT,AMOUNT --library LIB --delay DELAY Then, check that the user has been charged of AMOUNT if the due date of the most late item plus the delay is *before* today. One day later, re-execute the script with the same parameters and check that the fine has not been charged twice. Eventually, try to execute the script with various combinations of categories, amounts, libraries and delays, and check that it applies to the right patrons. You may edit the $debug and $bigdebug variables in the script to make it more verbose, and check what it does during its execution. Do you need more informations ?
MathildeF, the script to execute is staticfines.pl (fines.pl is the "standard" way of applying fines)
QA comment: * good test plan in comment 12, thanks * not PERLCRITIC compliant: "require" statement with library name as string at line 38, column 12. Use a bareword instead. (Severity: 5) Bareword file handle opened at line 143, column 1. See pages 202,204 of PBP. (Severity: 5) Two-argument "open" used at line 143, column 1. See page 207 of PBP. (Severity: 5) (I think the 1st one can't be avoided, but the 2 others should) * this script is completely new, and: - will have to be documented/advertised - can't break anything if not used, so will pass QA once the perlcritic stuff is OK * Mathilde, I feel you haven't successfully tested that it work. Am I wrong ? If i'm not, it mean the patch is not signed off for now
(In reply to comment #14) > * Mathilde, I feel you haven't successfully tested that it work. Am I wrong > ? If i'm not, it mean the patch is not signed off for now I make the test before the test plan. (In reply to comment #14) I took the test before the test-plan. the result was good, but with the sandbox, I have not been able to test again the next day.
i test and it's good th escrit add record in accountlines Note : the scrip don't work if the date in caldenar is closed.
Created attachment 8516 [details] [review] Bug 6858: Adds staticfines.pl for static fines processing Add a tool to calculate static fine. For example, 7 days left = 1€ fixed fine
This new patch : - updates documentation (about fines not applied on holidays) - corrects typos in documentation (option --use-borrower-library) - adds a message (when debug mode is enabled) to tell that the fine will not be applied if we're currently on a holiday - fixes two deprecated "use hashref as a reference" - fixes the two fixable errors raised by perlcritic This patch does not modify the script's behaviour, but might be re-tested though.
Created attachment 8521 [details] [review] Bug 6858: Adds staticfines.pl for static fines processing Add a tool to calculate static fine. For example, 7 days left = 1€ fixed fine Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
Created attachment 8522 [details] [review] Bug-6858-Adds-staticfinespl-for-static-fines-proce.patch
QA comment: * new and isolated script, that can't harm anything outside from the script itself * passed perlcritic * a few tabs, i've replaced by spaces * if run with --help, I get the documentation, it's OK * if run without any parameters, the script seems to do some work, start writing a report file (in /tmp), that, at the end is empty. An improvement would be to show doc & quit when the script is run without any parameters, but, if I understand well, it's not supposed to be, so won't fail QA for that overall = passed QA, and if you want to provide a follow-up to die when no parameters are given, it will be welcomed !
Warning = we have found some (complex) cases where this script make wrong calculations. A follow-up will be sent in a few days
Created attachment 9772 [details] [review] Bug 6858: Adds staticfines.pl for static fines processing Add a tool to calculate static fine. For example, 7 days left = 1€ fixed fine Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
This new patch : - Fixes calculation bugs - Removes -o option for logs (which wasn't working anyway) - Adds a --borrower <borrowernumber> option for applying the fine only to one given borrower
QA comments: * requires +use Modern::Perl;, good point * passes perlcricit * independant script that can't harm the rest of Koha if it's bugguy * clean some code passes QA SIDE COMMENT: Matthias, I see that you compare dues dates. Have you seen Jonathan comment on koha-devel about the due_date now being a date AND time column in the database (to handle hourly loans) ? Have you tested there's no possible side effect ? (I don't think so, but sharing just to be sure you haven't missed a test case)
This patch has been pushed on 3.10, and should be backported on 3.8 because it fixes a problem on the script available in 3.8
Paul is right, this script exists in 3.8.0, (and 3.8.1) so will push this bugfix to it for 3.8.2
Side note, I have updated the commit message to be a little more informative, Matthias you wrote really good comments on the bug, if you put that in the commit message that would have been even more awesome :) http://git.koha-community.org/gitweb/?p=koha.git;a=commit;h=484f4a999827d9fad8320b876921052310be299e
This one sounds just like what I will need for migrating a library I have coming up. But is it possible already to separate so that overdue loans get charged right away if there are holds on them - while loans with no holds get charged after say a week? And if that can be done - can I also set separate rules for rental media? I know this question is a bit OT with all the testing discussions going on, but I´d love to know how much can be done with this patch and what we´d have to expand the functionality.
Hi Viktor, Perhaps you could create another ticket for the enhancements you'd like to have, so we can close this ticket, as the patch has already been pushed ?