Index: trunk/extensions/ContributionReporting/ContributionHistory_body.php |
— | — | @@ -48,10 +48,7 @@ |
49 | 49 | $name .= '<br />' . htmlspecialchars($row['note']); |
50 | 50 | } |
51 | 51 | |
52 | | - $amount = htmlspecialchars($row['original_currency'] . ' ' . $row['original_amount']); |
53 | | - if (!$row['original_currency'] || !$row['original_amount']) { |
54 | | - $amount = 'USD ' . htmlspecialchars($row['converted_amount']); |
55 | | - } |
| 52 | + $amount = $this->formatAmount( $row ); |
56 | 53 | |
57 | 54 | $class = ''; |
58 | 55 | if ($alt) { |
— | — | @@ -73,4 +70,22 @@ |
74 | 71 | $wgOut->addHTML( $output ); |
75 | 72 | $wgOut->addWikiText('{{Template:Donate-footer/' . $language . '}}'); |
76 | 73 | } |
| 74 | + |
| 75 | + function formatAmount( $row ) { |
| 76 | + if( $row['original_currency'] ) { |
| 77 | + $currency = $row['original_currency']; |
| 78 | + $amount = $row['original_amount']; |
| 79 | + } else { |
| 80 | + $currency = 'USD'; |
| 81 | + $amount = $row['converted_amount']; |
| 82 | + } |
| 83 | + |
| 84 | + if( $currency == 'JPY' ) { |
| 85 | + // No decimals for yen |
| 86 | + $amount = intval( $amount ); |
| 87 | + } |
| 88 | + |
| 89 | + return htmlspecialchars( "$currency $amount" ); |
| 90 | + } |
| 91 | + |
77 | 92 | } |