Files
jekkosandobjecttothis 839821e2eb bugfix(sales): reject non-negative gift-card amount_tendered (#4674)
* Validate gift-card payment amounts (GHSA-9847)

Close the negative gift-card amount minting vector: when a forged
payment_type like 'Gift Card:<number>' reaches the catch-all validation
branch, a negative amount_tendered previously passed decimal_locale and was
then routed into Giftcard::decrementGiftcardValue, where value - (-N)
increased the balance (store credit minted at will).

- Add nonNegativeDecimal rule + 'Sales.negative_amount_tendered' message to
  the catch-all amount_tendered rules in Sales::postAddPayment(); add the
  language key to all 46 locale files (populated in en, empty elsewhere).
- Guard Giftcard::decrementGiftcardValue() against non-positive amounts so
  the sink itself can no longer add balance from an inverted subtraction.
- Regression tests: controller-level rejection of negative amount_tendered
  and model-level rejection of negative/zero decrements.

* Address PR review: align locale keys, drop advisory refs, add decimal_locale message

- Align negative_amount_tendered '=> with all other keys (46 locale files)
- Remove docblock + inline comment above decrementGiftcardValue()
- Remove GHSA ID and attack-detail description from test; scrub redundant comment
- Add decimal_locale message override + focused malformed-amount test

* Fix formatting and spacing in SalesControllerTest

* fix(lang): remove duplicate negative amount tendered key

Consolidate 'negative_amount_invalid' and 'negative_amount_tendered'
translation keys in Sales.php across all locale files. Both keys held
identical messages, causing redundant translation maintenance.

- Drop 'negative_amount_invalid' key, keep 'negative_amount_tendered'
- Move existing translated text into 'negative_amount_tendered' where
  it was previously empty
- Applied across all app/Language/*/Sales.php locale files

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>

* fix(sales): allow negative amount_tendered in return mode

Return transactions legitimately produce negative amount_due and
prefilled amount_tendered values, but validation rules previously
enforced nonNegativeDecimal unconditionally, blocking valid returns.

- Detect return mode via sale_lib->get_mode() in Sales::process
- Build amount_tendered rule conditionally: skip nonNegativeDecimal
  check when in return mode, keep it for sale/giftcard flows
- Apply the conditional rule to both giftcard and standard payment
  branches

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>

* test: update expected error message in negative payment test

Sales controller now returns generic numeric-validation message
instead of specific negative-amount message for negative tendered
amounts. Update test assertion to match new lang key.

- tests/Controllers/SalesControllerTest.php: assert
  Sales.must_enter_numeric instead of
  Sales.negative_amount_tendered

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>

* test: remove regression tests for GHSA-9847 negative amount fix

Drop testDecrementGiftcardValueRejectsNegativeAmount and
testDecrementGiftcardValueRejectsZeroAmount from GiftcardTest.

- Remove coverage for decrementGiftcardValue() rejecting
  non-positive amounts (negative/zero) in tests/Models/GiftcardTest.php

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>

---------

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
Co-authored-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2026-09-07 11:47:02 +04:00

241 lines
19 KiB
PHP

<?php
return [
'account_number' => 'هەژمار #',
'add_payment' => 'زیادکردنی پارەدان',
'amount_due' => 'بڕی پارە کە دەبێ بدرێت',
'amount_due_not_covered' => 'پارەدانەکان بڕی پێویست دانپۆشین نەکردووە.',
'amount_tendered' => 'بڕی پێشکەشکراو',
'authorized_signature' => 'واژۆی ڕێگەپێدراو',
'cancel_sale' => 'هەڵوەشاندنەوە',
'cash' => 'پارەی نەختینە',
'cash_1' => '',
'cash_2' => '',
'cash_3' => '',
'cash_4' => '',
'cash_adjustment' => 'ڕێکخستنی پارەی نەختینە',
'cash_deposit' => 'پارەی نەختینەی دانراو',
'cash_filter' => 'نەختینە',
'change_due' => 'ئەو گۆڕانکارییانەی دەبێت بکرێت',
'change_price' => 'گۆڕینی نرخی فرۆشتن',
'check' => 'چەکی پارە',
'check_balance' => 'پاشماوەی چەکی پارە',
'check_filter' => 'چەکی پارە',
'close' => '',
'comment' => 'سەرنج',
'comments' => 'سەرنجەکان',
'company_name' => '',
'complete' => '',
'complete_sale' => 'تەواو',
'confirm_cancel_sale' => 'دڵنیایت دەتەوێت ئەم فرۆشتنە بسڕیتەوە؟ هەموو کاڵاکان دەسڕێنەوە.',
'confirm_delete' => 'ئایا دڵنیای کە دەتەوێت فرۆشتنە هەڵبژێردراوەکان بسڕیتەوە؟',
'confirm_restore' => 'ئایا دڵنیای کە دەتەوێت فرۆشتنە هەڵبژێردراوەکان بگەڕێنیتەوە؟',
'credit' => 'کارتی کرێدت',
'credit_deposit' => 'دانانی کرێدت',
'credit_filter' => 'کارتی کرێدت',
'current_table' => '',
'customer' => 'کڕیار',
'customer_address' => 'ناونیشان',
'customer_discount' => 'داشکاندن',
'customer_email' => 'ئیمەیڵ',
'customer_location' => 'ناونیشان',
'customer_mailchimp_status' => 'دۆخی بەکارهێنان مایلچیمپ',
'customer_optional' => '(پێویستە بۆئەو پارانەی دەبێت بدرێت)',
'customer_required' => '(پێویستە)',
'customer_total' => 'کۆی گشتی',
'customer_total_spent' => '',
'customers_available_points' => 'خاڵە بەردەستەکان',
'daily_sales' => '',
'date' => 'بەرواری فرۆشتن',
'date_range' => 'مەودای بەروار',
'date_required' => 'دەبێت بەروارێکی دروست داخڵ بکرێت.',
'date_type' => 'بەروار خانەیەکی پێویستە.',
'debit' => 'کارتی دێبت',
'debit_filter' => '',
'delete' => 'ڕێگە بدە بە سڕینەوە',
'delete_confirmation' => 'دڵنیای کە دەتەوێت ئەم فرۆشتنە بسڕیتەوە؟ ئەم کارە ناتوانرێت پووچەڵ بکرێتەوە.',
'delete_entire_sale' => 'هەموو فرۆشتنەکە بسڕەوە',
'delete_successful' => 'سڕینەوەی فرۆشتن سەرکەوتوو بوو.',
'delete_unsuccessful' => 'سڕینەوەی فرۆشتن شکستی هێنا.',
'description_abbrv' => 'وەسف.',
'discard' => 'ڕەتکردنەوە',
'discard_quote' => '',
'discount' => 'داشکاندن',
'discount_exceeds_item_total' => '',
'discount_included' => '% داشکاندن',
'discount_percent_exceeds_100' => '',
'discount_short' => '%',
'due' => 'ئەو بڕەی پێویستە بدرێت',
'due_filter' => 'ئەو بڕەی پێویستە بدرێت',
'edit' => 'دەستکاری',
'edit_item' => 'دەستکاریکردنی ئایتم',
'edit_sale' => 'دەستکاریکردنی فرۆشتن',
'email_receipt' => 'وەسڵی ئیمەیڵ',
'employee' => 'فەرمانبەر',
'entry' => 'تۆمار',
'error_editing_item' => 'هەڵە لە دەستکاریکردنی ئایتم',
'find_or_scan_item' => 'دۆزینەوە یان سکانکردنی ئایتم',
'find_or_scan_item_or_receipt' => 'دۆزینەوە یان سکانکردنی ئایتم یان پسوڵە',
'giftcard' => 'کارتی دیاری',
'giftcard_balance' => 'باڵانسی کارتی دیاری',
'giftcard_filter' => '',
'giftcard_number' => 'ژمارەی کارتی دیاری',
'group_by_category' => 'گروپ بەپێی پۆلێن',
'group_by_type' => 'گروپ بەپێی جۆر',
'hsn' => 'کۆدی سیستەمی هارمونیزە',
'id' => 'ناسنامەی فرۆشتن',
'include_prices' => 'نرخەکان لەخۆ بگرێت؟',
'insufficient_giftcard_balance' => 'بێ لە پاقسەی فریوی تیکۆ بۆ ئەم دانە گوڕانکاری.',
'insufficient_reward_points' => 'نقاط المكافأة غير كافية لهذه الدفعة.',
'invoice' => 'فاکتۆرە',
'invoice_confirm' => 'ئەم فاکتورەیە دەنێردرێت بۆ',
'invoice_enable' => 'ژمارەی فاکتورە',
'invoice_filter' => 'فاکتۆرەکان',
'invoice_no_email' => 'ئەم کڕیارە ناونیشانی ئیمەیڵی دروستی نییە.',
'invoice_number' => 'فاکتورە #',
'invoice_number_duplicate' => 'ژمارەی فاکتورە {0} دەبێت تایبەت بێت.',
'invoice_sent' => 'فاکتورە نێردراوە بۆ',
'invoice_total' => 'کۆی گشتی فاکتورە',
'invoice_type_custom_invoice' => 'فاکتورەی تایبەت (custom_invoice.php)',
'invoice_type_custom_tax_invoice' => 'فاکتورەی باجی تایبەتمەند (custom_tax_invoice.php)',
'invoice_type_invoice' => 'فاکتورە (invoice.php)',
'invoice_type_tax_invoice' => 'فاکتورەی باج (tax_invoice.php)',
'invoice_unsent' => 'فاکتورە نەتوانرا بنێردریت بۆ',
'invoice_update' => 'ژماردنەوەی دووبارە',
'item_insufficient_of_stock' => 'ئایتمەکە بڕی پێویستی نییە لە کۆگا.',
'item_name' => 'ناوی ئایتم',
'item_number' => 'ئایتم #',
'item_out_of_stock' => 'ئایتم لە کۆگادا تەواو بووە.',
'key_browser' => 'کورتە ڕێگای یارمەتیدەر',
'key_cancel' => 'هەڵوەشاندنەوەی دەرخستەی نرخ/فاکتورە/فرۆشتن',
'key_customer_search' => 'گەڕان بەدوای کڕیاردا',
'key_finish_quote' => 'تەواوکردنی دەرخستەی نرخ/فاکتورە بەبێ پارەدان',
'key_finish_sale' => 'زیادکردنی پارەدان و تەواوکردنی فاکتورە/فرۆشتن',
'key_full' => 'لە دۆخی تەواوی شاشەدا بیکەرەوە',
'key_function' => 'فرمان',
'key_help' => 'کورتە ڕێگاکان',
'key_help_modal' => 'پەنجەرەی کورتە ڕێگاکان بکەرەوە',
'key_in' => 'نزیک کردنەوە',
'key_item_search' => 'گەڕان بەدوای ئایتم',
'key_out' => 'دوورخستنەوە',
'key_payment' => 'زیادکردنی پارەدان',
'key_print' => 'لاپەڕەی ئێستا چاپ بکە',
'key_restore' => 'گەڕاندنەوەی پیشاندانی ئەسڵی/زووم',
'key_search' => 'خشتەکانی ڕاپۆرتەکانی گەڕان',
'key_suspend' => 'فرۆشتنی ئێستا ڕابگرە',
'key_suspended' => 'فرۆشتنی ڕاگیراو پیشان بدە',
'key_system' => 'کورتە ڕێگاکانی سیستەم',
'key_tendered' => 'دەسکاریکردنی بڕی پێشکەشکراو',
'key_title' => 'کورتە ڕێگاکانی تەختەکلیلی فرۆشتن',
'mc' => '',
'mode' => 'دۆخی تۆمارکردن',
'must_enter_numeric' => 'بڕی پێشکەشکراو دەبێت ژمارەیەک بێت.',
'must_enter_numeric_giftcard' => 'ژمارەی کارتی دیاری دەبێت ژمارەیەک بێت.',
'must_enter_reference_code' => 'ژمارەی مەرجع/وەرگرتن دەبێت بنووسرێت.',
'negative_amount_tendered' => 'بڕی پێشکەشکراو ناتوانێت نەرێنی بێت.',
'negative_discount_invalid' => '',
'negative_price_invalid' => '',
'negative_quantity_invalid' => '',
'negative_total_invalid' => '',
'new_customer' => 'کڕیاری نوێ',
'new_item' => 'ئایتمی نوێ',
'no_description' => 'هیچ وەسفێک نییە',
'no_filter' => 'هەموو',
'no_items_in_cart' => 'هیچ ئایتمێک لە عەرەبانەکەدا نییە.',
'no_sales_to_display' => 'هیچ فرۆشتنێک نییە بۆ پیشاندان.',
'none_selected' => 'تۆ هیچ فرۆشتنێکت هەڵنەبژاردووە بۆ سڕینەوە.',
'nontaxed_ind' => ' ',
'not_authorized' => 'ئەم کارە ڕێگەپێدراو نییە.',
'one_or_multiple' => 'فرۆشتن(ەکان)',
'payment' => 'جۆری پارەدان',
'payment_amount' => 'بڕ',
'payment_not_cover_total' => 'بڕی پارەدان دەبێت زیاتر بێت یان یەکسان بێت بە کۆی گشتی.',
'payment_type' => 'جۆر',
'payments' => '',
'payments_total' => 'کۆی پارەدانەکان',
'price' => 'نرخ',
'print_after_sale' => 'چاپکردن دوای فرۆشتن',
'quantity' => 'بڕ',
'quantity_less_than_reorder_level' => 'ئاگاداری: بڕی خوازراو لە خوار ئاستی پێویستەوەیە بۆ ئەو ئایتمە.',
'quantity_less_than_zero' => 'ئاگاداری: بڕی خوازراو بەس نییە. هێشتا دەتوانیت فرۆشتنەکە پڕۆسێس بکەیت، بەڵام دەبێت وردبینی بۆ کۆگاکەت بکەیت.',
'quantity_of_items' => 'بڕی {0} ئایتم',
'quote' => 'دەرخستەی نرخ',
'quote_number' => 'ژمارەی دەرخستەی نرخ',
'quote_number_duplicate' => 'ژمارەی دەرخستەی نرخ دەبێت تایبەت بێت.',
'quote_sent' => 'دەرخستەی نرخ نێردرا بۆ',
'quote_unsent' => 'دەرخستەی نرخ شکستی هێنا لە ناردنی بۆ',
'receipt' => 'پسوڵەی فرۆشتن',
'receipt_no_email' => 'ئەم کڕیارە ناونیشانی ئیمەیڵی دروستی نییە.',
'receipt_number' => 'فرۆشتن #',
'receipt_sent' => 'پسوڵەی نێردرا بۆ',
'receipt_unsent' => 'پسوڵەکە شکستی هێنا لە ناردنی بۆ',
'reference_code' => 'کۆدی مەرجعی پارەدان',
'reference_code_invalid_characters' => 'کۆدی مەرجع دەبێت تەنها پیت و ژمارە لەخۆ بگرێت.',
'reference_code_length_error' => 'درێژی کۆدی مەرجع دروست نییە.',
'refund' => 'جۆری گەڕاندنەوەی پارە',
'register' => 'تۆماری فرۆشتن',
'remove_customer' => 'لابردنی کڕیار',
'remove_discount' => '',
'return' => 'گەڕانەوە',
'rewards' => 'خاڵەکانی پاداشت',
'rewards_balance' => 'باڵانسی خاڵەکانی پاداشت',
'rewards_package' => 'پاداشتەکان',
'rewards_remaining_balance' => 'بەهای پاداشتی خاڵە ماووەکان بریتییە لە ',
'sale' => 'فرۆشتن',
'sale_by_invoice' => 'فرۆشتن بە فاکتورە',
'sale_for_customer' => 'کڕیار:',
'sale_time' => 'کات',
'sales_tax' => 'باجی فرۆشتن',
'sales_total' => '',
'select_customer' => 'کڕیار هەڵبژێرە',
'selected_customer' => 'کڕیاری هەڵبژێردراو',
'send_invoice' => 'فاکتورە بنێرە',
'send_quote' => 'دەرخستەی نرخ بنێرە',
'send_receipt' => 'پسوڵە بنێرە',
'send_work_order' => 'داواکاری کار بنێرە',
'serial' => 'زنجیرەیی',
'service_charge' => '',
'show_due' => '',
'show_invoice' => 'فاکتورە پیشان بدە',
'show_receipt' => 'فاکتورە پیشان بدە',
'start_typing_customer_name' => 'دەست بکە بە نووسینی وردەکارییەکانی کڕیار...',
'start_typing_item_name' => 'دەست بکە بە نووسینی ناوی ئایتم یان بارکۆد سکان بکە...',
'stock' => 'کۆگا',
'stock_location' => 'ناونیشانی کۆگا',
'sub_total' => 'کۆی سەرەتایی',
'successfully_deleted' => 'بەسەرکەوتوویی سڕیتەوە',
'successfully_restored' => 'بەسەرکەوتوویی گەڕاندتەوە',
'successfully_suspended_sale' => 'فرۆشتن بەسەرکەوتوویی راگیرا.',
'successfully_updated' => 'فرۆشتن بەسەرکەوتوویی تازەکرایەوە.',
'suspend_sale' => 'ڕاگرتن',
'suspended_doc_id' => 'بەڵگەنامە',
'suspended_sale_id' => 'ناسنامە',
'suspended_sales' => 'ڕاگیرا',
'table' => 'مێز',
'takings' => 'فرۆشتنی ڕۆژانە',
'tax' => 'باج',
'tax_id' => 'ناسنامەی باج',
'tax_invoice' => 'فاکتورەی باج',
'tax_percent' => 'باج %',
'taxed_ind' => 'T',
'total' => 'گشتی',
'total_tax_exclusive' => 'باج لەخۆناگرێت',
'transaction_failed' => 'مامەڵەی فرۆشتن شکستی هێنا.',
'unable_to_add_item' => 'زیادکردنی ئایتم بۆ فرۆشتن شکستی هێنا',
'unsuccessfully_deleted' => 'سڕینەوەی فرۆشتن(ەکان) شکستی هێنا.',
'unsuccessfully_restored' => 'گەڕاندنەوەی فرۆشتن(ەکان) شکستی هێنا.',
'unsuccessfully_suspended_sale' => 'ڕاگرتنی فرۆشتن شکستی هێنا.',
'unsuccessfully_updated' => 'نوێکردنەوەی فرۆشتن شکستی هێنا.',
'unsuspend' => 'ڕاگرتن هەڵبوەشێنەوە',
'unsuspend_and_delete' => 'کردار',
'update' => 'نوێکردنەوە',
'upi' => 'UPI (سیستەمی پارەدان بەهۆکاری یەکگرتوو)',
'visa' => '',
'wholesale' => '',
'work_order' => 'داواکاری کار',
'work_order_number' => 'ژامرەی داواکاری کار',
'work_order_number_duplicate' => 'ژمارەی داواکاری کار دەبێت تایبەت بێت.',
'work_order_sent' => 'داواکاری کار نێردرا بۆ',
'work_order_unsent' => 'داواکاری کار شکستی هێنا لە ناردنی بۆ',
];