Overview
Comment:Spell out number: don't include decimals if it's zero
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: 8b4975e5d66590a198bb1f95530b4e20e254d1584bb345934c1c96e80f3a9605
User & Date: bohwaz on 2023-05-16 13:27:29
Other Links: branch diff | manifest | tags
Context
2023-05-16
13:29
Implement fiscal receipt from transaction check-in: d84a8f7cac user: bohwaz tags: dev
13:27
Spell out number: don't include decimals if it's zero check-in: 8b4975e5d6 user: bohwaz tags: dev
12:28
Make it clear that you cannot know what is left to pay when accounting is disabled check-in: c63582a819 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/UserTemplate/Modifiers.php from [8664b492ae] to [c8cd86d9ec].

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		$number = str_replace(',', '.', $number);
		$number = strtok($number, '.');
		$decimals = strtok(false);

		$out = numfmt_create($locale, \NumberFormatter::SPELLOUT)->format((float) $number);
		$out .= ' ' . $currency;

		if ($decimals) {
			$out .= sprintf(' et %s cents', numfmt_create($locale, \NumberFormatter::SPELLOUT)->format((float) $decimals));
		}

		return trim($out);
	}

	static public function parse_date($value)







|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
		$number = str_replace(',', '.', $number);
		$number = strtok($number, '.');
		$decimals = strtok(false);

		$out = numfmt_create($locale, \NumberFormatter::SPELLOUT)->format((float) $number);
		$out .= ' ' . $currency;

		if ($decimals > 0) {
			$out .= sprintf(' et %s cents', numfmt_create($locale, \NumberFormatter::SPELLOUT)->format((float) $decimals));
		}

		return trim($out);
	}

	static public function parse_date($value)