diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 70a94a3ee5f3409023b46649e57e441f01d253ec..be9044be70b7bd2df0e33a0b13373e81b415c584 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2728,7 +2728,7 @@ class Form if (count($this->cache_currencies)) return 0; // Cache deja charge - $sql = "SELECT code_iso, label"; + $sql = "SELECT code_iso, label, unicode"; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies"; $sql.= " WHERE active = 1"; $sql.= " ORDER BY code_iso ASC"; @@ -2744,13 +2744,14 @@ class Form $obj = $this->db->fetch_object($resql); // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $this->cache_currencies[$obj->code_iso] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:'')); + $this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:'')); + $this->cache_currencies[$obj->code_iso]['unicode'] = (array) dol_json_decode($obj->unicode, true); + $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label']; $i++; } - // alphabetic order - asort($this->cache_currencies); - + array_multisort($label, SORT_ASC, $this->cache_currencies); + return $num; } else @@ -2779,7 +2780,7 @@ class Form if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite $out.= '<select class="flat" name="'.$htmlname.'">'; - foreach ($this->cache_currencies as $code_iso => $label) + foreach ($this->cache_currencies as $code_iso => $currency) { if ($selected && $selected == $code_iso) { @@ -2789,8 +2790,8 @@ class Form { $out.= '<option value="'.$code_iso.'">'; } - $out.= $label; - $out.= ' ('.$code_iso.')'; + $out.= $currency['label']; + $out.= ' ('.getCurrencySymbol($code_iso).')'; $out.= '</option>'; } $out.= '</select>'; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 8b444f5a0a97afa8a8953c65cf00a06634778f50..2a1f505161157cbd1614f03a126442763ce8161c 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -338,11 +338,7 @@ class Translate { global $db; $newstr=$key; - if (preg_match('/^CurrencySing([A-Z][A-Z][A-Z])$/i',$key,$reg)) - { - $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','labelsing'); - } - else if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) + if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) { $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label'); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 25bec4c1ccb9c2f54c875b6e19f537387cc90fdc..88a526edd482aa312fdf8e43772d8896b364051b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4112,6 +4112,48 @@ function printCommonFooter($zone='private') } +/** + * Convert unicode + * + * @param string $unicode Unicode + * @param string $encoding Encoding type + * @return string Unicode converted + */ +function unichr($unicode , $encoding = 'UTF-8') +{ + return mb_convert_encoding("&#{$unicode};", $encoding, 'HTML-ENTITIES'); +} + +/** + * Convert a currency code into its symbol + * + * @param string $currency_code Currency code + * @return string Currency symbol encoded into UTF8 + */ +function getCurrencySymbol($currency_code) +{ + global $form; + + $currency_sign = ''; + + if (! is_object($form)) $form = new Form($db); + + $form->load_cache_currencies(); + + if (is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode'])) + { + foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode) + { + $currency_sign.= unichr($unicode); + } + } + else + { + $currency_sign = $currency_code; + } + + return $currency_sign; +} if (! function_exists('getmypid')) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 19e2e935662cedd82c932f98386b54ca61848ce2..1b482063032de9a364e83224af6345675c870677 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1197,370 +1197,3 @@ function getSoapParams() } return $params; } - -/** - * Convert unicode - * - * @param string $unicode Unicode - * @param string $encoding Encoding type - * @return string Unicode converted - */ -function unichr($unicode , $encoding = 'UTF-8') -{ - return mb_convert_encoding("&#{$unicode};", $encoding, 'HTML-ENTITIES'); -} - -/** - * Convert a currency code into its symbol - * - * @param string $currency_code Currency code - * @return string Currency symbol encoded into UTF8 - */ -function getCurrencySymbol($currency_code) -{ - switch ($currency_code) { - case "ALL": - $currency_sign = " ".unichr(76).unichr(101).unichr(107); - break; - case "AFN": - $currency_sign = " ".unichr(1547); - break; - case "ARS": - $currency_sign = " ".unichr(36); - break; - case "AWG": - $currency_sign = " ".unichr(402); - break; - case "AUD": - $currency_sign = " ".unichr(36); - break; - case "AZN": - $currency_sign = " ".unichr(1084).unichr(1072).unichr(1085); - break; - case "BSD": - $currency_sign = " ".unichr(36); - break; - case "BBD": - $currency_sign = " ".unichr(36); - break; - case "BYR": - $currency_sign = " ".unichr(112).unichr(46); - break; - case "BZD": - $currency_sign = " ".unichr(66).unichr(90).unichr(36); - break; - case "BMD": - $currency_sign = " ".unichr(36); - break; - case "BOB": - $currency_sign = " ".unichr(36).unichr(98); - break; - case "BAM": - $currency_sign = " ".unichr(75).unichr(77); - break; - case "BWP": - $currency_sign = " ".unichr(80); - break; - case "BGN": - $currency_sign = " ".unichr(1083).unichr(1074); - break; - case "BRL": - $currency_sign = " ".unichr(82).unichr(36); - break; - case "BND": - $currency_sign = " ".unichr(36); - break; - case "KHR": - $currency_sign = " ".unichr(6107); - break; - case "CAD": - $currency_sign = " ".unichr(36); - break; - case "KYD": - $currency_sign = " ".unichr(36); - break; - case "CLP": - $currency_sign = " ".unichr(36); - break; - case "CNY": - $currency_sign = " ".unichr(165); - break; - case "COP": - $currency_sign = " ".unichr(36); - break; - case "CRC": - $currency_sign = " ".unichr(8353); - break; - case "HRK": - $currency_sign = " ".unichr(107).unichr(110); - break; - case "CUP": - $currency_sign = " ".unichr(8369); - break; - case "CZK": - $currency_sign = " ".unichr(75).unichr(269); - break; - case "DKK": - $currency_sign = " ".unichr(107).unichr(114); - break; - case "DOP": - $currency_sign = " ".unichr(82).unichr(68).unichr(36); - break; - case "XCD": - $currency_sign = " ".unichr(36); - break; - case "EGP": - $currency_sign = " ".unichr(163); - break; - case "SVC": - $currency_sign = " ".unichr(36); - break; - case "EEK": - $currency_sign = " ".unichr(107).unichr(114); - break; - case "EUR": - $currency_sign = " ".unichr(8364); - break; - case "FKP": - $currency_sign = " ".unichr(163); - break; - case "FJD": - $currency_sign = " ".unichr(36); - break; - case "GHC": - $currency_sign = " ".unichr(162); - break; - case "GIP": - $currency_sign = " ".unichr(163); - break; - case "GTQ": - $currency_sign = " ".unichr(81); - break; - case "GGP": - $currency_sign = " ".unichr(163); - break; - case "GYD": - $currency_sign = " ".unichr(36); - break; - case "HNL": - $currency_sign = " ".unichr(76); - break; - case "HKD": - $currency_sign = " ".unichr(36); - break; - case "HUF": - $currency_sign = " ".unichr(70).unichr(116); - break; - case "ISK": - $currency_sign = " ".unichr(107).unichr(114); - break; - case "INR": - $currency_sign = " ".unichr(8377); - break; - case "IDR": - $currency_sign = " ".unichr(82).unichr(112); - break; - case "IRR": - $currency_sign = " ".unichr(65020); - break; - case "IMP": - $currency_sign = " ".unichr(163); - break; - case "ILS": - $currency_sign = " ".unichr(8362); - break; - case "JMD": - $currency_sign = " ".unichr(74).unichr(36); - break; - case "JPY": - $currency_sign = " ".unichr(165); - break; - case "JEP": - $currency_sign = " ".unichr(163); - break; - case "KZT": - $currency_sign = " ".unichr(1083).unichr(1074); - break; - case "KPW": - $currency_sign = " ".unichr(8361); - break; - case "KRW": - $currency_sign = " ".unichr(8361); - break; - case "KGS": - $currency_sign = " ".unichr(1083).unichr(1074); - break; - case "LAK": - $currency_sign = " ".unichr(8365); - break; - case "LVL": - $currency_sign = " ".unichr(76).unichr(115); - break; - case "LBP": - $currency_sign = " ".unichr(163); - break; - case "LRD": - $currency_sign = " ".unichr(36); - break; - case "LTL": - $currency_sign = " ".unichr(76).unichr(116); - break; - case "MKD": - $currency_sign = " ".unichr(1076).unichr(1077).unichr(1085); - break; - case "MYR": - $currency_sign = " ".unichr(82).unichr(77); - break; - case "MUR": - $currency_sign = " ".unichr(8360); - break; - case "MXN": - $currency_sign = " ".unichr(36); - break; - case "MNT": - $currency_sign = " ".unichr(8366); - break; - case "MZN": - $currency_sign = " ".unichr(77).unichr(84); - break; - case "NAD": - $currency_sign = " ".unichr(36); - break; - case "NPR": - $currency_sign = " ".unichr(8360); - break; - case "ANG": - $currency_sign = " ".unichr(402); - break; - case "NZD": - $currency_sign = " ".unichr(36); - break; - case "NIO": - $currency_sign = " ".unichr(67).unichr(36); - break; - case "NGN": - $currency_sign = " ".unichr(8358); - break; - case "NOK": - $currency_sign = " ".unichr(107).unichr(114); - break; - case "OMR": - $currency_sign = " ".unichr(65020); - break; - case "PKR": - $currency_sign = " ".unichr(8360); - break; - case "PAB": - $currency_sign = " ".unichr(66).unichr(47).unichr(46); - break; - case "PYG": - $currency_sign = " ".unichr(71).unichr(115); - break; - case "PEN": - $currency_sign = " ".unichr(83).unichr(47).unichr(46); - break; - case "PHP": - $currency_sign = " ".unichr(8369); - break; - case "PLN": - $currency_sign = " ".unichr(122).unichr(322); - break; - case "QAR": - $currency_sign = " ".unichr(65020); - break; - case "RON": - $currency_sign = " ".unichr(108).unichr(101).unichr(105); - break; - case "RUB": - $currency_sign = " ".unichr(1088).unichr(1091).unichr(1073); - break; - case "SHP": - $currency_sign = " ".unichr(163); - break; - case "SAR": - $currency_sign = " ".unichr(65020); - break; - case "RSD": - $currency_sign = " ".unichr(1044).unichr(1080).unichr(1085).unichr(46); - break; - case "SCR": - $currency_sign = " ".unichr(8360); - break; - case "SGD": - $currency_sign = " ".unichr(36); - break; - case "SBD": - $currency_sign = " ".unichr(36); - break; - case "SOS": - $currency_sign = " ".unichr(83); - break; - case "ZAR": - $currency_sign = " ".unichr(82); - break; - case "LKR": - $currency_sign = " ".unichr(8360); - break; - case "SEK": - $currency_sign = " ".unichr(107).unichr(114); - break; - case "CHF": - $currency_sign = " ".unichr(67).unichr(72).unichr(70); - break; - case "SRD": - $currency_sign = " ".unichr(36); - break; - case "SYP": - $currency_sign = " ".unichr(163); - break; - case "TWD": - $currency_sign = " ".unichr(78).unichr(84).unichr(36); - break; - case "THB": - $currency_sign = " ".unichr(3647); - break; - case "TTD": - $currency_sign = " ".unichr(84).unichr(84).unichr(36); - break; - case "TRY": - $currency_sign = " ".unichr(84).unichr(76); - break; - case "TRL": - $currency_sign = " ".unichr(8356); - break; - case "TVD": - $currency_sign = " ".unichr(36); - break; - case "UAH": - $currency_sign = " ".unichr(8372); - break; - case "GBP": - $currency_sign = " ".unichr(163); - break; - case "USD": - $currency_sign = " ".unichr(36); - break; - case "UYU": - $currency_sign = " ".unichr(36).unichr(85); - break; - case "UZS": - $currency_sign = " ".unichr(1083).unichr(1074); - break; - case "VEF": - $currency_sign = " ".unichr(66).unichr(115); - break; - case "VND": - $currency_sign = " ".unichr(8363); - break; - case "YER": - $currency_sign = " ".unichr(65020); - break; - case "ZWD": - $currency_sign = " ".unichr(90).unichr(36); - break; - default: - $currency_sign = " ".$currency_code; - break; - } - return $currency_sign; -} \ No newline at end of file diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index db504ad3584ffd724e372570a63a949609e1c320..fd45ab441520b3ab1b02ecf97dab77b973fd0fe9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1291,350 +1291,26 @@ function pdf_getTotalQty($object,$type,$outputlangs,$hookmanager=false) */ function pdf_getCurrencySymbol(&$pdf, $currency_code) { - switch ($currency_code) { - case "ALL": - $currency_sign = " ".$pdf->unichr(76).$pdf->unichr(101).$pdf->unichr(107); - break; - case "AFN": - $currency_sign = " ".$pdf->unichr(1547); - break; - case "ARS": - $currency_sign = " ".$pdf->unichr(36); - break; - case "AWG": - $currency_sign = " ".$pdf->unichr(402); - break; - case "AUD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "AZN": - $currency_sign = " ".$pdf->unichr(1084).$pdf->unichr(1072).$pdf->unichr(1085); - break; - case "BSD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "BBD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "BYR": - $currency_sign = " ".$pdf->unichr(112).$pdf->unichr(46); - break; - case "BZD": - $currency_sign = " ".$pdf->unichr(66).$pdf->unichr(90).$pdf->unichr(36); - break; - case "BMD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "BOB": - $currency_sign = " ".$pdf->unichr(36).$pdf->unichr(98); - break; - case "BAM": - $currency_sign = " ".$pdf->unichr(75).$pdf->unichr(77); - break; - case "BWP": - $currency_sign = " ".$pdf->unichr(80); - break; - case "BGN": - $currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074); - break; - case "BRL": - $currency_sign = " ".$pdf->unichr(82).$pdf->unichr(36); - break; - case "BND": - $currency_sign = " ".$pdf->unichr(36); - break; - case "KHR": - $currency_sign = " ".$pdf->unichr(6107); - break; - case "CAD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "KYD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "CLP": - $currency_sign = " ".$pdf->unichr(36); - break; - case "CNY": - $currency_sign = " ".$pdf->unichr(165); - break; - case "COP": - $currency_sign = " ".$pdf->unichr(36); - break; - case "CRC": - $currency_sign = " ".$pdf->unichr(8353); - break; - case "HRK": - $currency_sign = " ".$pdf->unichr(107).$pdf->unichr(110); - break; - case "CUP": - $currency_sign = " ".$pdf->unichr(8369); - break; - case "CZK": - $currency_sign = " ".$pdf->unichr(75).$pdf->unichr(269); - break; - case "DKK": - $currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114); - break; - case "DOP": - $currency_sign = " ".$pdf->unichr(82).$pdf->unichr(68).$pdf->unichr(36); - break; - case "XCD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "EGP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "SVC": - $currency_sign = " ".$pdf->unichr(36); - break; - case "EEK": - $currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114); - break; - case "EUR": - $currency_sign = " ".$pdf->unichr(8364); - break; - case "FKP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "FJD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "GHC": - $currency_sign = " ".$pdf->unichr(162); - break; - case "GIP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "GTQ": - $currency_sign = " ".$pdf->unichr(81); - break; - case "GGP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "GYD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "HNL": - $currency_sign = " ".$pdf->unichr(76); - break; - case "HKD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "HUF": - $currency_sign = " ".$pdf->unichr(70).$pdf->unichr(116); - break; - case "ISK": - $currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114); - break; - case "INR": - $currency_sign = " ".$pdf->unichr(8377); - break; - case "IDR": - $currency_sign = " ".$pdf->unichr(82).$pdf->unichr(112); - break; - case "IRR": - $currency_sign = " ".$pdf->unichr(65020); - break; - case "IMP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "ILS": - $currency_sign = " ".$pdf->unichr(8362); - break; - case "JMD": - $currency_sign = " ".$pdf->unichr(74).$pdf->unichr(36); - break; - case "JPY": - $currency_sign = " ".$pdf->unichr(165); - break; - case "JEP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "KZT": - $currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074); - break; - case "KPW": - $currency_sign = " ".$pdf->unichr(8361); - break; - case "KRW": - $currency_sign = " ".$pdf->unichr(8361); - break; - case "KGS": - $currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074); - break; - case "LAK": - $currency_sign = " ".$pdf->unichr(8365); - break; - case "LVL": - $currency_sign = " ".$pdf->unichr(76).$pdf->unichr(115); - break; - case "LBP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "LRD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "LTL": - $currency_sign = " ".$pdf->unichr(76).$pdf->unichr(116); - break; - case "MKD": - $currency_sign = " ".$pdf->unichr(1076).$pdf->unichr(1077).$pdf->unichr(1085); - break; - case "MYR": - $currency_sign = " ".$pdf->unichr(82).$pdf->unichr(77); - break; - case "MUR": - $currency_sign = " ".$pdf->unichr(8360); - break; - case "MXN": - $currency_sign = " ".$pdf->unichr(36); - break; - case "MNT": - $currency_sign = " ".$pdf->unichr(8366); - break; - case "MZN": - $currency_sign = " ".$pdf->unichr(77).$pdf->unichr(84); - break; - case "NAD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "NPR": - $currency_sign = " ".$pdf->unichr(8360); - break; - case "ANG": - $currency_sign = " ".$pdf->unichr(402); - break; - case "NZD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "NIO": - $currency_sign = " ".$pdf->unichr(67).$pdf->unichr(36); - break; - case "NGN": - $currency_sign = " ".$pdf->unichr(8358); - break; - case "NOK": - $currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114); - break; - case "OMR": - $currency_sign = " ".$pdf->unichr(65020); - break; - case "PKR": - $currency_sign = " ".$pdf->unichr(8360); - break; - case "PAB": - $currency_sign = " ".$pdf->unichr(66).$pdf->unichr(47).$pdf->unichr(46); - break; - case "PYG": - $currency_sign = " ".$pdf->unichr(71).$pdf->unichr(115); - break; - case "PEN": - $currency_sign = " ".$pdf->unichr(83).$pdf->unichr(47).$pdf->unichr(46); - break; - case "PHP": - $currency_sign = " ".$pdf->unichr(8369); - break; - case "PLN": - $currency_sign = " ".$pdf->unichr(122).$pdf->unichr(322); - break; - case "QAR": - $currency_sign = " ".$pdf->unichr(65020); - break; - case "RON": - $currency_sign = " ".$pdf->unichr(108).$pdf->unichr(101).$pdf->unichr(105); - break; - case "RUB": - $currency_sign = " ".$pdf->unichr(1088).$pdf->unichr(1091).$pdf->unichr(1073); - break; - case "SHP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "SAR": - $currency_sign = " ".$pdf->unichr(65020); - break; - case "RSD": - $currency_sign = " ".$pdf->unichr(1044).$pdf->unichr(1080).$pdf->unichr(1085).$pdf->unichr(46); - break; - case "SCR": - $currency_sign = " ".$pdf->unichr(8360); - break; - case "SGD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "SBD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "SOS": - $currency_sign = " ".$pdf->unichr(83); - break; - case "ZAR": - $currency_sign = " ".$pdf->unichr(82); - break; - case "LKR": - $currency_sign = " ".$pdf->unichr(8360); - break; - case "SEK": - $currency_sign = " ".$pdf->unichr(107).$pdf->unichr(114); - break; - case "CHF": - $currency_sign = " ".$pdf->unichr(67).$pdf->unichr(72).$pdf->unichr(70); - break; - case "SRD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "SYP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "TWD": - $currency_sign = " ".$pdf->unichr(78).$pdf->unichr(84).$pdf->unichr(36); - break; - case "THB": - $currency_sign = " ".$pdf->unichr(3647); - break; - case "TTD": - $currency_sign = " ".$pdf->unichr(84).$pdf->unichr(84).$pdf->unichr(36); - break; - case "TRY": - $currency_sign = " ".$pdf->unichr(84).$pdf->unichr(76); - break; - case "TRL": - $currency_sign = " ".$pdf->unichr(8356); - break; - case "TVD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "UAH": - $currency_sign = " ".$pdf->unichr(8372); - break; - case "GBP": - $currency_sign = " ".$pdf->unichr(163); - break; - case "USD": - $currency_sign = " ".$pdf->unichr(36); - break; - case "UYU": - $currency_sign = " ".$pdf->unichr(36).$pdf->unichr(85); - break; - case "UZS": - $currency_sign = " ".$pdf->unichr(1083).$pdf->unichr(1074); - break; - case "VEF": - $currency_sign = " ".$pdf->unichr(66).$pdf->unichr(115); - break; - case "VND": - $currency_sign = " ".$pdf->unichr(8363); - break; - case "YER": - $currency_sign = " ".$pdf->unichr(65020); - break; - case "ZWD": - $currency_sign = " ".$pdf->unichr(90).$pdf->unichr(36); - break; - default: - $currency_sign = " ".$currency_code; - break; - } + global $form; + + $currency_sign = ''; + + if (! is_object($form)) $form = new Form($db); + + $form->load_cache_currencies(); + + if (is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode'])) + { + foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode) + { + $currency_sign.= $pdf->unichr($unicode); + } + } + else + { + $currency_sign = $currency_code; + } + return $currency_sign; } diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index 6e67bcb608678027a605fb1858edf0406d57d8ed..23854ed87be7c3d94d51d078feba378f91d32b6c 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -1,11 +1,12 @@ -- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> --- Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> +-- Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> -- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be> --- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> +-- Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> -- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> -- Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> +-- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or @@ -27,65 +28,147 @@ -- -- --- Devises (code secondaire - code ISO4217 - libelle fr) +-- Currencies (primary code - code ISO4217 - libelle us) -- -INSERT INTO llx_c_currencies ( code, code_iso, active, label ) VALUES ( 'BD', 'BBD', 1, 'Barbadian or Bajan Dollar'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'BT', 'THB', 1, 'Bath thailandais'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CD', 'DKK', 1, 'Couronnes dannoises'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CN', 'NOK', 1, 'Couronnes norvegiennes'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CS', 'SEK', 1, 'Couronnes suedoises'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CZ', 'CZK', 1, 'Couronnes tcheques'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'TD', 'TND', 1, 'Dinar tunisien'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DA', 'DZD', 1, 'Dinar algérien'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DH', 'MAD', 1, 'Dirham'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'AD', 'AUD', 1, 'Dollars australiens'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DC', 'CAD', 1, 'Dollars canadiens'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'HK', 'HKD', 1, 'Dollars hong kong'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DS', 'SGD', 1, 'Dollars singapour'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DU', 'USD', 1, 'Dollars us'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'EC', 'XEU', 1, 'Ecus'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'ES', 'PTE', 0, 'Escudos'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FB', 'BEF', 0, 'Francs belges'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FF', 'FRF', 0, 'Francs francais'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FL', 'LUF', 0, 'Francs luxembourgeois'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FO', 'NLG', 1, 'Florins'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FS', 'CHF', 1, 'Francs suisses'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LI', 'IEP', 1, 'Livres irlandaises'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LH', 'HNL', 1, 'Lempiras'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LR', 'ITL', 0, 'Lires'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LS', 'GBP', 1, 'Livres sterling'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MA', 'DEM', 0, 'Deutsch mark'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MF', 'FIM', 1, 'Mark finlandais'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MR', 'MRO', 1, 'Ouguiya Mauritanien'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PA', 'ARP', 1, 'Pesos argentins'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PC', 'CLP', 1, 'Pesos chilien'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PE', 'ESP', 1, 'Pesete'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'PL', 'PLN', 1, 'Zlotys polonais'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'SA', 'ATS', 1, 'Shiliing autrichiens'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'TW', 'TWD', 1, 'Dollar taiwanais'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'YE', 'JPY', 1, 'Yens'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'ZA', 'ZAR', 1, 'Rand africa'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'DR', 'GRD', 1, 'Drachme (grece)'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'EU', 'EUR', 1, 'Euros'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'RB', 'BRL', 1, 'Real bresilien'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'SK', 'SKK', 1, 'Couronnes slovaques'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'YC', 'CNY', 1, 'Yuang chinois'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'AE', 'AED', 1, 'Arabes emirats dirham'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CF', 'XAF', 1, 'Francs cfa beac'); --- insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'CF', 'XOF', 1, 'Francs cfa bceao'); doublon sur code court -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'EG', 'EGP', 1, 'Livre egyptienne'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'KR', 'KRW', 1, 'Won coree du sud'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'NZ', 'NZD', 1, 'Dollar neo-zelandais'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'TR', 'TRL', 1, 'Livre turque'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'ID', 'IDR', 1, 'Rupiahs d''indonesie'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'IN', 'INR', 1, 'Roupie indienne'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LT', 'LTL', 1, 'Litas'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'RU', 'SUR', 1, 'Rouble'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'UA', 'UAH', 1, 'Hryvnia'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FH', 'HUF', 1, 'Forint hongrois'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LK', 'LKR', 1, 'Roupies sri lanka'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'MU', 'MUR', 1, 'Roupies mauritiennes'); -insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'SR', 'SAR', 1, 'Saudi riyal'); -insert into llx_c_currencies ( code, code_iso, active, label ) VALUES ( 'MX', 'MXP', 1, 'Pesos Mexicans'); -insert into llx_c_currencies ( code, code_iso, active, label ) VALUES ( 'VE', 'VEF', 1, 'Venezuelan Bolívar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ALL', '[76,101,107]', 1, 'Albania Lek'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DZD', NULL, 1, 'Algeria Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AFN', '[1547]', 1, 'Afghanistan Afghani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARS', '[36]', 1, 'Argentino Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AWG', '[402]', 1, 'Aruba Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AUD', '[36]', 1, 'Australia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN', '[1084,1072,1085]', 1, 'Azerbaijan New Manat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BZD', '[66,90,36]', 1, 'Belize Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BOB', '[36,98]', 1, 'Bolivia Boliviano'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BAM', '[75,77]', 1, 'Bosnia and Herzegovina Convertible Marka'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BWP', '[80]', 1, 'Botswana Pula'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BGN', '[1083,1074]', 1, 'Bulgaria Lev'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BRL', '[82,36]', 1, 'Brazil Real'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BND', '[36]', 1, 'Brunei Darussalam Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KHR', '[6107]', 1, 'Cambodia Riel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CAD', '[36]', 1, 'Canada Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KYD', '[36]', 1, 'Cayman Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CLP', '[36]', 1, 'Chile Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CNY', '[165]', 1, 'China Yuan Renminbi'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'COP', '[36]', 1, 'Colombia Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CRC', '[8353]', 1, 'Costa Rica Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HRK', '[107,110]', 1, 'Croatia Kuna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CUP', '[8369]', 1, 'Cuba Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CZK', '[75,269]', 1, 'Czech Republic Koruna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DKK', '[107,114]', 1, 'Denmark Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DOP', '[82,68,36]', 1, 'Dominican Republic Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD', '[36]', 1, 'East Caribbean Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1, 'Ghana Cedis'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1, 'Gibraltar Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1, 'Guatemala Quetzal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1, 'Guernsey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GYD', '[36]', 1, 'Guyana Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HNL', '[76]', 1, 'Honduras Lempira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HKD', '[36]', 1, 'Hong Kong Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HUF', '[70,116]', 1, 'Hungary Forint'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ISK', '[107,114]', 1, 'Iceland Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'INR', NULL, 1, 'India Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IDR', '[82,112]', 1, 'Indonesia Rupiah'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IRR', '[65020]', 1, 'Iran Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IMP', '[163]', 1, 'Isle of Man Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS', '[8362]', 1, 'Israel Shekel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KZT', '[1083,1074]', 1, 'Kazakhstan Tenge'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KGS', '[1083,1074]', 1, 'Kyrgyzstan Som'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LAK', '[8365]', 1, 'Laos Kip'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL', '[76,115]', 1, 'Latvia Lat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MKD', '[1076,1077,1085]', 1, 'Macedonia Denar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MUR', '[8360]', 1, 'Mauritius Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXN', '[36]', 1, 'Mexico Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MNT', '[8366]', 1, 'Mongolia Tughrik'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MAD', NULL, 1, 'Morocco Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MZN', '[77,84]', 1, 'Mozambique Metical'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NAD', '[36]', 1, 'Namibia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NPR', '[8360]', 1, 'Nepal Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ANG', '[402]', 1, 'Netherlands Antilles Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NZD', '[36]', 1, 'New Zealand Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NIO', '[67,36]', 1, 'Nicaragua Cordoba'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NGN', '[8358]', 1, 'Nigeria Naira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NOK', '[107,114]', 1, 'Norway Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'OMR', '[65020]', 1, 'Oman Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PKR', '[8360]', 1, 'Pakistan Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PAB', '[66,47,46]', 1, 'Panama Balboa'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PYG', '[71,115]', 1, 'Paraguay Guarani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PEN', '[83,47,46]', 1, 'Peru Nuevo Sol'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PHP', '[8369]', 1, 'Philippines Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PLN', '[122,322]', 1, 'Poland Zloty'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'QAR', '[65020]', 1, 'Qatar Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RON', '[108,101,105]', 1, 'Romania New Leu'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RUB', '[1088,1091,1073]', 1, 'Russia Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SHP', '[163]', 1, 'Saint Helena Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SAR', '[65020]', 1, 'Saudi Arabia Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RSD', '[1044,1080,1085,46]', 1, 'Serbia Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SCR', '[8360]', 1, 'Seychelles Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SGD', '[36]', 1, 'Singapore Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SBD', '[36]', 1, 'Solomon Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SOS', '[83]', 1, 'Somalia Shilling'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZAR', '[82]', 1, 'South Africa Rand'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LKR', '[8360]', 1, 'Sri Lanka Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SEK', '[107,114]', 1, 'Sweden Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CHF', '[67,72,70]', 1, 'Switzerland Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SRD', '[36]', 1, 'Suriname Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SYP', '[163]', 1, 'Syria Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TWD', '[78,84,36]', 1, 'Taiwan New Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TTD', '[84,84,36]', 1, 'Trinidad and Tobago Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRL', '[84,76]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GBP', '[163]', 1, 'United Kingdom Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'USD', '[36]', 1, 'United States Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UYU', '[36,85]', 1, 'Uruguay Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UZS', '[1083,1074]', 1, 'Uzbekistan Som'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF', '[66,115]', 1, 'Venezuela Bolivar Fuerte'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); + +-- obsolete +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ATS', NULL, 0, 'Shiliing autrichiens'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BEF', NULL, 0, 'Francs belges'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DEM', NULL, 0, 'Deutsch mark'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ESP', NULL, 0, 'Pesete'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FIM', NULL, 0, 'Mark finlandais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FRF', NULL, 0, 'Francs francais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GRD', NULL, 0, 'Drachme (grece)'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IEP', NULL, 0, 'Livres irlandaises'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ITL', NULL, 0, 'Lires'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LUF', NULL, 0, 'Francs luxembourgeois'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NLG', NULL, 0, 'Florins'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PTE', NULL, 0, 'Escudos'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SKK', NULL, 0, 'Couronnes slovaques'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SUR', NULL, 0, 'Rouble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU', NULL, 0, 'Ecus'); + +-- invalid (for compatibility) +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXP', NULL, 0, 'Pesos Mexicans'); diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 9e255ed3137d21bfee09f897becded966fd13d28..d37e89e72c3e458455b0b53e1d8223927298f267 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -211,8 +211,8 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_author FOREIGN KEY (fk_u ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_cloture FOREIGN KEY (fk_user_cloture) REFERENCES llx_user (rowid); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); -ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code); ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_account; +ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency; ALTER TABLE llx_commande MODIFY fk_projet integer DEFAULT NULL; ALTER TABLE llx_commande ADD COLUMN fk_account integer AFTER facture; @@ -227,16 +227,16 @@ ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_user_author FOREIGN KEY ( ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_user_cloture FOREIGN KEY (fk_user_cloture) REFERENCES llx_user (rowid); ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); -ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code); ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_account; +ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency; ALTER TABLE llx_facture MODIFY fk_projet integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN fk_account integer AFTER fk_projet; ALTER TABLE llx_facture ADD COLUMN fk_currency varchar(2) AFTER fk_account; ALTER TABLE llx_facture ADD INDEX idx_facture_fk_account (fk_account); ALTER TABLE llx_facture ADD INDEX idx_facture_fk_currency (fk_currency); -ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code); ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_account; +ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_currency; ALTER TABLE llx_actioncomm DROP COLUMN propalrowid; ALTER TABLE llx_actioncomm DROP COLUMN fk_facture; @@ -253,4 +253,159 @@ ALTER TABLE llx_product_stock DROP COLUMN location; ALTER TABLE llx_adherent_extrafields ADD COLUMN import_key varchar(14); ALTER TABLE llx_product_extrafields ADD COLUMN import_key varchar(14); ALTER TABLE llx_societe_extrafields ADD COLUMN import_key varchar(14); + +DROP TABLE llx_c_currencies; +create table llx_c_currencies +( + code_iso varchar(3) PRIMARY KEY, + label varchar(64) NOT NULL, + unicode varchar(32) DEFAULT NULL, + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ALL', '[76,101,107]', 1, 'Albania Lek'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DZD', NULL, 1, 'Algeria Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AFN', '[1547]', 1, 'Afghanistan Afghani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARS', '[36]', 1, 'Argentino Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AWG', '[402]', 1, 'Aruba Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AUD', '[36]', 1, 'Australia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN', '[1084,1072,1085]', 1, 'Azerbaijan New Manat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BZD', '[66,90,36]', 1, 'Belize Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BOB', '[36,98]', 1, 'Bolivia Boliviano'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BAM', '[75,77]', 1, 'Bosnia and Herzegovina Convertible Marka'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BWP', '[80]', 1, 'Botswana Pula'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BGN', '[1083,1074]', 1, 'Bulgaria Lev'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BRL', '[82,36]', 1, 'Brazil Real'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BND', '[36]', 1, 'Brunei Darussalam Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KHR', '[6107]', 1, 'Cambodia Riel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CAD', '[36]', 1, 'Canada Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KYD', '[36]', 1, 'Cayman Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CLP', '[36]', 1, 'Chile Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CNY', '[165]', 1, 'China Yuan Renminbi'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'COP', '[36]', 1, 'Colombia Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CRC', '[8353]', 1, 'Costa Rica Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HRK', '[107,110]', 1, 'Croatia Kuna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CUP', '[8369]', 1, 'Cuba Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CZK', '[75,269]', 1, 'Czech Republic Koruna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DKK', '[107,114]', 1, 'Denmark Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DOP', '[82,68,36]', 1, 'Dominican Republic Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD', '[36]', 1, 'East Caribbean Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1, 'Ghana Cedis'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1, 'Gibraltar Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1, 'Guatemala Quetzal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1, 'Guernsey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GYD', '[36]', 1, 'Guyana Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HNL', '[76]', 1, 'Honduras Lempira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HKD', '[36]', 1, 'Hong Kong Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'HUF', '[70,116]', 1, 'Hungary Forint'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ISK', '[107,114]', 1, 'Iceland Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'INR', NULL, 1, 'India Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IDR', '[82,112]', 1, 'Indonesia Rupiah'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IRR', '[65020]', 1, 'Iran Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IMP', '[163]', 1, 'Isle of Man Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS', '[8362]', 1, 'Israel Shekel'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KZT', '[1083,1074]', 1, 'Kazakhstan Tenge'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KGS', '[1083,1074]', 1, 'Kyrgyzstan Som'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LAK', '[8365]', 1, 'Laos Kip'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL', '[76,115]', 1, 'Latvia Lat'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MKD', '[1076,1077,1085]', 1, 'Macedonia Denar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MUR', '[8360]', 1, 'Mauritius Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXN', '[36]', 1, 'Mexico Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MNT', '[8366]', 1, 'Mongolia Tughrik'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MAD', NULL, 1, 'Morocco Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MZN', '[77,84]', 1, 'Mozambique Metical'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NAD', '[36]', 1, 'Namibia Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NPR', '[8360]', 1, 'Nepal Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ANG', '[402]', 1, 'Netherlands Antilles Guilder'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NZD', '[36]', 1, 'New Zealand Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NIO', '[67,36]', 1, 'Nicaragua Cordoba'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NGN', '[8358]', 1, 'Nigeria Naira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NOK', '[107,114]', 1, 'Norway Krone'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'OMR', '[65020]', 1, 'Oman Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PKR', '[8360]', 1, 'Pakistan Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PAB', '[66,47,46]', 1, 'Panama Balboa'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PYG', '[71,115]', 1, 'Paraguay Guarani'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PEN', '[83,47,46]', 1, 'Peru Nuevo Sol'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PHP', '[8369]', 1, 'Philippines Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PLN', '[122,322]', 1, 'Poland Zloty'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'QAR', '[65020]', 1, 'Qatar Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RON', '[108,101,105]', 1, 'Romania New Leu'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RUB', '[1088,1091,1073]', 1, 'Russia Ruble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SHP', '[163]', 1, 'Saint Helena Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SAR', '[65020]', 1, 'Saudi Arabia Riyal'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'RSD', '[1044,1080,1085,46]', 1, 'Serbia Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SCR', '[8360]', 1, 'Seychelles Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SGD', '[36]', 1, 'Singapore Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SBD', '[36]', 1, 'Solomon Islands Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SOS', '[83]', 1, 'Somalia Shilling'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZAR', '[82]', 1, 'South Africa Rand'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LKR', '[8360]', 1, 'Sri Lanka Rupee'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SEK', '[107,114]', 1, 'Sweden Krona'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'CHF', '[67,72,70]', 1, 'Switzerland Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SRD', '[36]', 1, 'Suriname Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SYP', '[163]', 1, 'Syria Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TWD', '[78,84,36]', 1, 'Taiwan New Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TTD', '[84,84,36]', 1, 'Trinidad and Tobago Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRL', '[84,76]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GBP', '[163]', 1, 'United Kingdom Pound'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'USD', '[36]', 1, 'United States Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UYU', '[36,85]', 1, 'Uruguay Peso'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UZS', '[1083,1074]', 1, 'Uzbekistan Som'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF', '[66,115]', 1, 'Venezuela Bolivar Fuerte'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); + +-- obsolete +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ATS', NULL, 0, 'Shiliing autrichiens'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BEF', NULL, 0, 'Francs belges'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'DEM', NULL, 0, 'Deutsch mark'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ESP', NULL, 0, 'Pesete'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FIM', NULL, 0, 'Mark finlandais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FRF', NULL, 0, 'Francs francais'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GRD', NULL, 0, 'Drachme (grece)'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'IEP', NULL, 0, 'Livres irlandaises'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ITL', NULL, 0, 'Lires'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LUF', NULL, 0, 'Francs luxembourgeois'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'NLG', NULL, 0, 'Florins'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PTE', NULL, 0, 'Escudos'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SKK', NULL, 0, 'Couronnes slovaques'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SUR', NULL, 0, 'Rouble'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU', NULL, 0, 'Ecus'); + +-- invalid (for compatibility) +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXP', NULL, 0, 'Pesos Mexicans'); + +ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso); +ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso); +ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_c_currencies.sql b/htdocs/install/mysql/tables/llx_c_currencies.sql index 9a0296765b5f09e9e8046d2a1056ec674fa6d353..62f7a53610881dd34623a3408207ffc37dd46c51 100644 --- a/htdocs/install/mysql/tables/llx_c_currencies.sql +++ b/htdocs/install/mysql/tables/llx_c_currencies.sql @@ -1,5 +1,6 @@ -- ======================================================================== --- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +-- Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -18,10 +19,11 @@ create table llx_c_currencies ( - code varchar(2) PRIMARY KEY, - code_iso varchar(3) NOT NULL, - label varchar(64), - labelsing varchar(64), - active tinyint DEFAULT 1 NOT NULL + code varchar(2) PRIMARY KEY, + code_iso varchar(3) NOT NULL, + label varchar(64) NOT NULL, + unicode varchar(32) DEFAULT NULL, + active tinyint DEFAULT 1 NOT NULL + )ENGINE=innodb;