← All changes
|
includes/admin/reports/class-charitable-export-donations.php
+16
-1
1.8.11
→
1.8.13
View file →
| @@ -117,9 +117,24 @@ | ||
| 117 | 117 | */ |
| 118 | 118 | public function suppliment_charitable_export_data( $custom_field_data = false, $key = false, $data = array() ) { |
| 119 | 119 | |
| 120 | 120 | if ( in_array( $key, $this->format_money_fields, true ) ) { |
| 121 | - return html_entity_decode( trim( charitable_format_money( $custom_field_data ) ) ); | |
| 121 | + /* | |
| 122 | + * Core 'subtotal' and 'total' have no value_callback, so they arrive here as | |
| 123 | + * raw database amounts (period as the decimal separator, e.g. "101.78"). Other | |
| 124 | + * money fields ('amount', and addon-provided totals such as Fee Relief's | |
| 125 | + * 'total_donation_with_fees') arrive already localized. On comma-decimal locales, | |
| 126 | + * running a raw DB amount through charitable_format_money() without the db_format | |
| 127 | + * flag makes the "." read as a thousands separator and get stripped | |
| 128 | + * (101.78 -> "10 178,00"). So pass db_format = true only for the raw DB amounts. | |
| 129 | + */ | |
| 130 | + $db_format_fields = apply_filters( | |
| 131 | + 'charitable_export_donations_db_format_money_fields', | |
| 132 | + array( 'subtotal', 'total' ) | |
| 133 | + ); | |
| 134 | + $db_format = in_array( $key, $db_format_fields, true ); | |
| 135 | + | |
| 136 | + return html_entity_decode( trim( charitable_format_money( $custom_field_data, false, $db_format ) ) ); | |
| 122 | 137 | } |
| 123 | 138 | |
| 124 | 139 | return $custom_field_data; |
| 125 | 140 | } |