Bug 14520

Summary: Prevent to override the existing currency code.
Product: Koha Reporter: Amit Gupta <amitddng135>
Component: System AdministrationAssignee: Amit Gupta <amitddng135>
Status: CLOSED WORKSFORME QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: amitddng135, gmcharlt, mtompset, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 14520 - Prevent to override the existing currency code.
It is no longer possible to add currency with same code

Description Amit Gupta 2015-07-12 16:11:58 UTC
While creating a new currency, if currency already exists then it will override the existing currency without warning any error message to the user.
Comment 1 Amit Gupta 2015-07-12 16:18:24 UTC
Created attachment 40951 [details] [review]
Bug 14520 - Prevent to override the existing currency code.

On creating a currency, if it already exists, it will replace the existing one.
This patch prevent that and display a message to the user interface.
Test case
1. Create a currency new 'INR' with a symbol 'INR' and rate '1'.
2. Click on Edit and update the symbol with 'RS'.
3. Create a currency 'INR' with a symbol 'RUP' and rate '1'
   you should get a warning message "This currency already exists".
Comment 2 Mark Tompsett 2015-07-13 12:28:48 UTC
Currency is not item type.
Comment 3 Mark Tompsett 2015-07-13 12:34:22 UTC
You need to keep bug 7571 in perspective when writing your patch. This patch is attempting to put a bandage on a larger problem: currency is poorly handled in Koha. If you fix 7571, this bug should become unnecessary.
Comment 4 Amit Gupta 2015-07-15 03:30:23 UTC
It's giving only warning message to user. If currency code is already exists.
Comment 5 Mark Tompsett 2015-07-15 04:42:50 UTC
What is the point of giving a warning message if you already did the update? If you wish to give some kind of warning, I think it should be similar in style to the delete_confirm. This will allow them to click 'Update this currency' and update it, or 'Leave unchanged' and leave it unchanged. Exact phrases are left as an exercise for the reader.
Comment 6 Amit Gupta 2015-07-15 04:48:20 UTC
> What is the point of giving a warning message if you already did the update? If you wish to give some kind of warning, I think it should be similar in style to the delete_confirm. This will allow them to click 'Update this currency' and update it, or 'Leave unchanged' and leave it unchanged. Exact phrases are left as an exercise for the reader.

Hi Mark,
You mean to say at the time of saving the currency it will check whether currency already exists or not if exists give the alert message. I am right?
Comment 7 Mark Tompsett 2015-07-15 05:10:25 UTC
(In reply to Amit Gupta from comment #6)
> You mean to say at the time of saving the currency it will check whether
> currency already exists or not if exists give the alert message. I am right?

  Edit -> Save                --> Update
Delete -> Confirm -- YES      --> Delete
                  -- NO       --> No change
   New -> Save    -- IF EXIST --> Confirm Update -- YES --> Update
                                                 -- NO  --> No change
                  -- ELSE     --> Add

Hopefully formatting isn't ruined by a proportional font.
Comment 8 Amit Gupta 2015-07-15 07:25:21 UTC
Sure will do.
Comment 9 Marc VĂ©ron 2016-08-19 15:53:23 UTC
Created attachment 54652 [details]
It is no longer possible to add currency with same code

See attachment. Issue seems to be fixed.