Skip to content

Commit fde6b7b

Browse files
committed
Update minor units of historical currencies
See: #109
1 parent 3f68a5c commit fde6b7b

1 file changed

Lines changed: 150 additions & 134 deletions

File tree

‎import-currencies.php‎

Lines changed: 150 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -308,148 +308,164 @@
308308

309309
/**
310310
* Minor units of historical currencies are not listed within list-three file. They have to be reconstructed manually from additional sources.
311-
* This list has to be up to date, otherwise import will fail. Use null for undefined minor units.
311+
* This list has to be exhaustive, otherwise import will fail. Use null when minor units are unknown.
312+
*
313+
* The data sources used for minor unit values in this list are archived copies of the following URLs:
314+
*
315+
* http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
316+
* https://www.currency-iso.org/dam/downloads/lists/list_one.xml
317+
* https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/amendments/lists/list_one.xml
318+
* https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
319+
* http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
320+
*
321+
* The official ISO sources are currency-iso.org (old website) and six-group.com (new website).
322+
* The URL of the XML file changed several times over the years.
323+
*
324+
* The tig90x.doc file is an old file (the last archived copy is from 2004) from the British Standards Institution.
325+
* BSI is a member body of ISO, and SAP cites tig90x.doc as a reference in publicly available documentation, so we consider this list authoritative.
326+
*
327+
* See: https://github.com/brick/money/issues/109
312328
*
313329
* @var array<string, int|null> $historicalMinorUnits
314330
*/
315331
$historicalMinorUnits = [
316-
'ADP' => 0,
317-
'AFA' => 2,
318-
'ALK' => 2,
319-
'ANG' => 2,
320-
'AOK' => 2,
321-
'AON' => 0,
322-
'AOR' => 0,
323-
'ARA' => 2,
324-
'ARP' => 2,
325-
'ARY' => 2,
326-
'ATS' => 2,
327-
'AYM' => 2,
328-
'AZM' => 2,
329-
'BAD' => 2,
330-
'BEC' => 2,
331-
'BEF' => 2,
332-
'BEL' => 2,
333-
'BGJ' => 2,
334-
'BGK' => 2,
335-
'BGN' => 2,
336-
'BGL' => 2,
337-
'BOP' => 2,
338-
'BRB' => 2,
339-
'BRC' => 2,
340-
'BRE' => 2,
341-
'BRN' => 2,
342-
'BRR' => 2,
343-
'BUK' => 2,
344-
'BYB' => 2,
345-
'BYR' => 2,
346-
'CHC' => 2,
347-
'CSD' => 2,
348-
'CSJ' => 2,
349-
'CSK' => 2,
350-
'CUC' => 2,
351-
'CYP' => 3,
352-
'DDM' => 2,
353-
'DEM' => 2,
354-
'ECS' => 2,
355-
'ECV' => 2,
356-
'EEK' => 2,
357-
'ESA' => 2,
358-
'ESB' => 2,
359-
'ESP' => 2,
360-
'EUR' => 2,
361-
'FIM' => 2,
362-
'FRF' => 2,
363-
'GEK' => 0,
364-
'GHC' => 2,
365-
'GHP' => 2,
366-
'GNE' => 2,
367-
'GNS' => 2,
368-
'GQE' => 2,
369-
'GRD' => 2,
370-
'GWE' => 2,
371-
'GWP' => 2,
372-
'HRD' => 2,
373-
'HRK' => 2,
374-
'IDR' => 2,
375-
'IEP' => 2,
376-
'ILP' => 3,
377-
'ILR' => 2,
378-
'ISJ' => 2,
379-
'ITL' => 2,
380-
'LAJ' => 2,
381-
'LSM' => 2,
382-
'LTL' => 2,
383-
'LTT' => 2,
384-
'LUC' => 2,
385-
'LUF' => 2,
386-
'LUL' => 2,
387-
'LVL' => 2,
388-
'LVR' => 2,
389-
'MGF' => 2,
390-
'MLF' => 2,
391-
'MRO' => 2,
392-
'MTL' => 3,
393-
'MTP' => 2,
394-
'MVQ' => 2,
395-
'MWK' => 2,
396-
'MXP' => 2,
397-
'MZE' => 2,
398-
'MZM' => 2,
399-
'NIC' => 2,
400-
'NLG' => 2,
401-
'PEH' => 2,
402-
'PEI' => 2,
403-
'PEN' => 2,
404-
'PES' => 2,
405-
'PLZ' => 2,
406-
'PTE' => 2,
407-
'RHD' => 2,
408-
'ROK' => 2,
409-
'ROL' => 2,
410-
'RON' => 2,
411-
'RUR' => 2,
412-
'SDD' => 2,
413-
'SDG' => 2,
414-
'SDP' => 2,
415-
'SIT' => 2,
416-
'SKK' => 2,
417-
'SLL' => 2,
418-
'SRG' => 2,
419-
'STD' => 2,
420-
'SUR' => 2,
421-
'SZL' => 2,
422-
'TJR' => 2,
423-
'TMM' => 2,
424-
'TPE' => 2,
425-
'TRL' => 2,
426-
'TRY' => 2,
427-
'UAK' => 2,
428-
'UGS' => 2,
429-
'UGW' => 2,
430-
'USS' => 2,
431-
'UYN' => 2,
432-
'UYP' => 2,
433-
'VEB' => 2,
434-
'VEF' => 2,
435-
'VNC' => 2,
332+
'ADP' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
333+
'AFA' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
334+
'ALK' => null,
335+
'ANG' => 2, // https://web.archive.org/web/20250324115248/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
336+
'AOK' => null,
337+
'AON' => null,
338+
'AOR' => null,
339+
'ARA' => null,
340+
'ARP' => null,
341+
'ARY' => null,
342+
'ATS' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
343+
'AYM' => null,
344+
'AZM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
345+
'BAD' => null,
346+
'BEC' => null,
347+
'BEF' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
348+
'BEL' => null,
349+
'BGJ' => null,
350+
'BGK' => null,
351+
'BGN' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
352+
'BGL' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
353+
'BOP' => null,
354+
'BRB' => null,
355+
'BRC' => null,
356+
'BRE' => null,
357+
'BRN' => null,
358+
'BRR' => null,
359+
'BUK' => null,
360+
'BYB' => null,
361+
'BYR' => 0, // https://web.archive.org/web/20161201195250/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
362+
'CHC' => null,
363+
'CSD' => null,
364+
'CSJ' => null,
365+
'CSK' => null,
366+
'CUC' => 2, // https://web.archive.org/web/20250128081422/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
367+
'CYP' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
368+
'DDM' => null,
369+
'DEM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
370+
'ECS' => null,
371+
'ECV' => null,
372+
'EEK' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
373+
'ESA' => null,
374+
'ESB' => null,
375+
'ESP' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
376+
'EUR' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
377+
'FIM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
378+
'FRF' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
379+
'GEK' => null,
380+
'GHC' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
381+
'GHP' => null,
382+
'GNE' => null,
383+
'GNS' => null,
384+
'GQE' => null,
385+
'GRD' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
386+
'GWE' => null,
387+
'GWP' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
388+
'HRD' => null,
389+
'HRK' => 2, // https://web.archive.org/web/20221107144009/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
390+
'IDR' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
391+
'IEP' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
392+
'ILP' => null,
393+
'ILR' => null,
394+
'ISJ' => null,
395+
'ITL' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
396+
'LAJ' => null,
397+
'LSM' => null,
398+
'LTL' => 2, // https://web.archive.org/web/20130703061233/http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
399+
'LTT' => null,
400+
'LUC' => null,
401+
'LUF' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
402+
'LUL' => null,
403+
'LVL' => 2, // https://web.archive.org/web/20130703061233/http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
404+
'LVR' => null,
405+
'MGF' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
406+
'MLF' => null,
407+
'MRO' => 2, // https://web.archive.org/web/20170912004601/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
408+
'MTL' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
409+
'MTP' => null,
410+
'MVQ' => null,
411+
'MWK' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
412+
'MXP' => null,
413+
'MZE' => null,
414+
'MZM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
415+
'NIC' => null,
416+
'NLG' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
417+
'PEH' => null,
418+
'PEI' => null,
419+
'PEN' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
420+
'PES' => null,
421+
'PLZ' => null,
422+
'PTE' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
423+
'RHD' => null,
424+
'ROK' => null,
425+
'ROL' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
426+
'RON' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
427+
'RUR' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
428+
'SDD' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
429+
'SDG' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
430+
'SDP' => null,
431+
'SIT' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
432+
'SKK' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
433+
'SLL' => 2, // https://web.archive.org/web/20230605125714/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
434+
'SRG' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
435+
'STD' => 2, // https://web.archive.org/web/20170912004601/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
436+
'SUR' => null,
437+
'SZL' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
438+
'TJR' => null,
439+
'TMM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
440+
'TPE' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
441+
'TRL' => 0, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
442+
'TRY' => 2, // https://web.archive.org/web/20250928170142/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
443+
'UAK' => null,
444+
'UGS' => null,
445+
'UGW' => null,
446+
'USS' => 2, // https://web.archive.org/web/20130703061233/http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml
447+
'UYN' => null,
448+
'UYP' => null,
449+
'VEB' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
450+
'VEF' => 2, // https://web.archive.org/web/20180511154730/https://www.currency-iso.org/dam/downloads/lists/list_one.xml
451+
'VNC' => null,
436452
'XEU' => null,
437453
'XFO' => null,
438454
'XFU' => null,
439455
'XRE' => null,
440-
'YDD' => 2,
441-
'YUD' => 2,
442-
'YUM' => 2,
443-
'YUN' => 2,
444-
'ZAL' => 2,
445-
'ZMK' => 2,
446-
'ZRN' => 2,
447-
'ZRZ' => 2,
448-
'ZWC' => 2,
449-
'ZWD' => 2,
450-
'ZWL' => 2,
451-
'ZWN' => 2,
452-
'ZWR' => 2,
456+
'YDD' => null,
457+
'YUD' => null,
458+
'YUM' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
459+
'YUN' => null,
460+
'ZAL' => null,
461+
'ZMK' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
462+
'ZRN' => null,
463+
'ZRZ' => null,
464+
'ZWC' => null,
465+
'ZWD' => 2, // https://web.archive.org/web/20040702015452/http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90x.doc
466+
'ZWL' => 2, // https://web.archive.org/web/20240722165054/https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
467+
'ZWN' => null,
468+
'ZWR' => null,
453469
];
454470

455471
$currentCurrencyDatafile = file_get_contents('https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml');

0 commit comments

Comments
 (0)