[Koha-bugs] [Bug 33028] Wrongly formatted monetary amounts in circulation rules break scripts and calculations

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 21 13:23:00 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33028

--- Comment #42 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
Adjusted test plan:

* Set CurrencyFormat to FR
* Enable UseRecalls
* Enable ArticleRequests
* Administration > circulation and fine rules
* Add a new rule:
* Fine amount: 0.10
* Fine charging interval: 1  
* Overdue fines cap: 1.50
* Recall overdue fine amount: 1.10
* Save rule
* Verify that both Overdue fines cap and recall overdue fine amount show 
formatted with comma as: 1,50, 1,10
* Edit rule
* Fine amount: 0.10 - OK!
* Fine charging interval: 1  
* Overdue fines cap: 1,50 - NOT OK!
* Recall overdue fine amount: 1,10 - NOT OK!
* Save rule
* With SQL:

select * from circulation_rules where rule_name in
("fine","overduefinescap","recall_overdue_fine","article_request_fee");

You should see the false values in the database:
+----+------------+--------------+----------+---------------------+----------
--+
| id | branchcode | categorycode | itemtype | rule_name           |
rule_value |
+----+------------+--------------+----------+---------------------+----------
--+
|  9 | NULL       | NULL         | NULL     | fine                | 0.10    
|
| 11 | NULL       | NULL         | NULL     | overduefinescap     | 1,50    
|
| 32 | NULL       | NULL         | NULL     | recall_overdue_fine | 1,10    
|
+----+------------+--------------+----------+---------------------+----------
--+

* Edit rule for Article request fee 
* Fee: 1,0
* Verify it's also wrong in the database with above SQL.

* Apply patch
* Run database update
* Verify your wrong values cause the update to stop
* Fix them (one or all at once)
* Verify the update now continues
* Repeat editing and adding rules actions from before, a pattern check will
prevent you now from saving false values.


------------------

Missing bits and pieces:

>Have to:
>* When a rule is edited, the input field will be set to the display value
>(1,00). I didn't find an "unformat" equivalent for JS. This now triggers the
>pattern check, so you need to edit all values before being able to save
>them. We could use the inputmode="decimal" on the input fields to select for
>unformatting.

I have decided that this could be a separate bug. The JS used for
editing/cloning the rules is quite complex and it's easier to make a step back
first to get this moving and into old versions. 

--> I have removed the Price formatting from the circulation rules table in the
last follow-up.

> * Edit rule for Article request fee 
>   * Fee: 1,0
> * Verify it's also wrong in the database with above SQL.
> --> This is already fixed by the patch set now, as we don't allow to edit
> the rules and the pattern check works.
>   
> Missing bits and pieces:
> 
> Have to:
> * When a rule is edited, the input field will be set to the display value
> (1,00). I didn't find an "unformat" equivalent for JS. This now triggers the
> pattern check, so you need to edit all values before being able to save
> them. We could use the inputmode="decimal" on the input fields to select for
> unformatting.

I have now fixed this by removing the Price formatting from all fields. I think
this can be filed separately but is the quickest fix now that can also be 
backported.


> * Should we be able to deactivate overduefinescap by leaving it empty?
> (Unlimited?)

Yes, definitely. But there is already a separate bug (and a duplicate) for
that:
Bug 32271 - Overdue fines cap (amount) set to 0.00 when editing rule

So I decided to split this issue out in hope to be able to move this forward
and
get help with the other issue.

> Would be nice:
> * It would be nice to provide more help in fixing wrong values or
> automatically fixing obvious ones like xx,xx.

I think we don't need that to move on here.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list