Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix value for monthly quantity if unit type is hours #200

Merged
merged 2 commits into from Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/logic/bill/MonthlyQuantity.php
Expand Up @@ -31,9 +31,12 @@ class MonthlyQuantity extends DefaultQuantityFormatter implements ContextAwareQu
*/
public function format(): string
{
$text = Yii::t('hipanel:finance', '{quantity, plural, one{# day} other{# days}}', ['quantity' => $this->getClientValue()]);
$unitName = $this->getQuantity()->getUnit()->getName();
if ($unitName === 'hour') {
return Yii::t('hipanel:finance', '{quantity, plural, one{# hour} few{# hours} other{# hours}}', ['quantity' => $this->getQuantity()->getQuantity()]);
}

return $text;
return Yii::t('hipanel:finance', '{quantity, plural, one{# day} other{# days}}', ['quantity' => $this->getClientValue()]);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/messages/ru/hipanel:finance.php
Expand Up @@ -63,6 +63,7 @@
'{quantity, plural, one{# day} other{# days}}' => '{quantity, plural, one{# день} few{# дня} other{# дней}}',
'{quantity, plural, one{# year} other{# years}}' => '{quantity, plural, one{# год} few{# года} other{# лет}}',
'{quantity, time, HH:mm} hour(s)' => '{quantity, time, HH:mm} час(ов)',
'{quantity, plural, one{# hour} few{# hours} other{# hours}}' => '{quantity, plural, one{# час} few{# часа} other{# часов}}',
'{quantity} IP' => '{quantity} IP',
'Held payments' => 'Ожидающие платежи',
'Provided services' => 'Предоставленные услуги',
Expand Down