Files
opensourcepos/app/Language/hr-HR/Sales.php
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

240 lines
14 KiB
PHP

<?php
return [
'account_number' => '',
'add_payment' => 'Dodaj plaćanje',
'amount_due' => 'Iznos duga',
'amount_due_not_covered' => 'Uplate ne pokrivaju dospjeli iznos.',
'amount_tendered' => 'Ponuđeni iznos',
'authorized_signature' => '',
'cancel_sale' => 'Otkaži',
'cash' => 'Novčanice',
'cash_1' => '',
'cash_2' => '',
'cash_3' => '',
'cash_4' => '',
'cash_adjustment' => '',
'cash_deposit' => '',
'cash_filter' => 'Novčanice',
'change_due' => 'Ostatak',
'change_price' => '',
'check' => 'Ček',
'check_balance' => 'Ostatak čeka',
'check_filter' => '',
'close' => '',
'comment' => 'Komentar',
'comments' => 'Komentari',
'company_name' => '',
'complete' => '',
'complete_sale' => 'Završeno',
'confirm_cancel_sale' => 'Želite li otkazati ovu prodaju? Svi artikli se brišu.',
'confirm_delete' => 'Želite li obrisati odabranu prodaju?',
'confirm_restore' => '',
'credit' => 'Kreditna kartica',
'credit_deposit' => '',
'credit_filter' => '',
'current_table' => '',
'customer' => 'Kupac',
'customer_address' => 'Adresa kupca',
'customer_discount' => 'Popust',
'customer_email' => 'e-mail kupca',
'customer_location' => 'Mjesto kupca',
'customer_mailchimp_status' => '',
'customer_optional' => '',
'customer_required' => '',
'customer_total' => 'Total',
'customer_total_spent' => '',
'customers_available_points' => '',
'daily_sales' => '',
'date' => 'Datum prodaje',
'date_range' => 'Period',
'date_required' => 'Morate unijeti ispravan datum',
'date_type' => 'Datum je potreban',
'debit' => 'Debitna kartica',
'debit_filter' => '',
'delete' => '',
'delete_confirmation' => 'Želite li obrisati ovu prodaju? Ova akcija ne može se vratiti.',
'delete_entire_sale' => 'Obrisati cjelokupnu prodaju',
'delete_successful' => 'Uspješno ste obrisali prodaju',
'delete_unsuccessful' => 'Neuspješno brisanje prodaje',
'description_abbrv' => 'Opis',
'discard' => '',
'discard_quote' => '',
'discount' => 'Popust %',
'discount_exceeds_item_total' => '',
'discount_included' => 'Popust %',
'discount_percent_exceeds_100' => '',
'discount_short' => '%',
'due' => '',
'due_filter' => '',
'edit' => 'Uredi',
'edit_item' => 'Uredi artikal',
'edit_sale' => 'Uredi prodaju',
'email_receipt' => 'e-mail potvrde',
'employee' => 'Radnik',
'entry' => '',
'error_editing_item' => 'Greška kod uređivanja artikla',
'find_or_scan_item' => 'Pronađi/Skaniraj artikal',
'find_or_scan_item_or_receipt' => 'Pronađi/Skaniraj artikal ili račun',
'giftcard' => 'Poklon bon',
'giftcard_balance' => 'Saldo poklon bona',
'giftcard_filter' => '',
'giftcard_number' => 'Poklon bon br.',
'group_by_category' => '',
'group_by_type' => '',
'hsn' => '',
'id' => 'Prodaja br.',
'include_prices' => '',
'insufficient_giftcard_balance' => 'Nedovoljan saldo dar-kartice za ovu uplatu.',
'insufficient_reward_points' => 'Nedovoljni bodovi nagrade za ovu uplatu.',
'invoice' => 'Faktura',
'invoice_confirm' => 'Poslati fakturu',
'invoice_enable' => 'Napravi fakturu',
'invoice_filter' => 'Fakturirati',
'invoice_no_email' => 'Kupac nema ispravan e-mail',
'invoice_number' => 'Faktura br.',
'invoice_number_duplicate' => 'Molim unesite jedinstven broj fakture',
'invoice_sent' => 'Faktura poslana',
'invoice_total' => '',
'invoice_type_custom_invoice' => '',
'invoice_type_custom_tax_invoice' => '',
'invoice_type_invoice' => '',
'invoice_type_tax_invoice' => '',
'invoice_unsent' => 'Faktura nije poslana',
'invoice_update' => 'Ponovno brojanje',
'item_insufficient_of_stock' => 'Artikla nema na zalihi',
'item_name' => 'Naziv artikla',
'item_number' => 'UPC/EAN/ISBN',
'item_out_of_stock' => 'Stavka je rasprodana',
'key_browser' => '',
'key_cancel' => 'Cancels Current Quote/Invoice/Sale',
'key_customer_search' => 'Customer Search',
'key_finish_quote' => 'Finish Quote/Invoice witdout payment',
'key_finish_sale' => 'Add Payment and Complete Invoice/Sale',
'key_full' => '',
'key_function' => 'Function',
'key_help' => 'Shortcuts',
'key_help_modal' => 'Open Shortcuts Window',
'key_in' => '',
'key_item_search' => 'Item Search',
'key_out' => '',
'key_payment' => 'Add Payment',
'key_print' => '',
'key_restore' => '',
'key_search' => '',
'key_suspend' => 'Suspend Current Sale',
'key_suspended' => 'Show Suspended Sales',
'key_system' => '',
'key_tendered' => 'Edit Amount Tendered',
'key_title' => 'Sales Keyboard Shortcuts',
'mc' => '',
'mode' => 'Mod registriranja',
'must_enter_numeric' => 'Morate unijeti numeričku vrijednost za količinu',
'must_enter_numeric_giftcard' => 'Morate unijeti numeričku vrijednost za poklon bon',
'must_enter_reference_code' => 'Referentni/broj za preuzimanje mora biti unesen.',
'negative_amount_tendered' => 'Ponuđeni iznos ne može biti negativan.',
'negative_discount_invalid' => '',
'negative_price_invalid' => '',
'negative_quantity_invalid' => '',
'negative_total_invalid' => '',
'new_customer' => 'Novi kupac',
'new_item' => 'Nova stavka',
'no_description' => 'Nema opisa',
'no_filter' => 'Svi',
'no_items_in_cart' => 'Nema artikala u košari',
'no_sales_to_display' => 'Nema prodaje za prikaz',
'none_selected' => 'Niste odabrali nijedu prodaju za brisanje',
'nontaxed_ind' => '',
'not_authorized' => '',
'one_or_multiple' => 'Prodaja(e)',
'payment' => 'Tip plaćanja',
'payment_amount' => 'Iznos',
'payment_not_cover_total' => 'Plaćeni iznos ne pokriva ukupni iznos',
'payment_type' => 'Tip',
'payments' => '',
'payments_total' => 'Ukupno plaćeno',
'price' => 'Cijena',
'print_after_sale' => 'Štampaj poslije prodaje',
'quantity' => 'Količina',
'quantity_less_than_reorder_level' => 'Upozorenje! Željena količina je ispod minimalne.',
'quantity_less_than_zero' => 'Upozorenje! Željena količina je nedovoljna. Možete nastaviti prodaju, ali provjerite svoju zalihu.',
'quantity_of_items' => '',
'quote' => '',
'quote_number' => '',
'quote_number_duplicate' => '',
'quote_sent' => '',
'quote_unsent' => '',
'receipt' => 'Račun',
'receipt_no_email' => '',
'receipt_number' => 'Račun br.',
'receipt_sent' => 'Račun poslana',
'receipt_unsent' => 'Račun nije poslana',
'reference_code' => 'Referentni kod plaćanja',
'reference_code_invalid_characters' => 'Referentni kod smije sadržavati samo slova i brojeve.',
'reference_code_length_error' => 'Duljina referentnog koda nije ispravna.',
'refund' => '',
'register' => 'Registracija prodaje',
'remove_customer' => 'Ukloni kupca',
'remove_discount' => '',
'return' => 'Povrat',
'rewards' => '',
'rewards_balance' => '',
'rewards_package' => '',
'rewards_remaining_balance' => '',
'sale' => 'Prodaja',
'sale_by_invoice' => '',
'sale_for_customer' => 'Kupac:',
'sale_time' => 'Vrijeme',
'sales_tax' => '',
'sales_total' => '',
'select_customer' => 'Odaberi kupca(neobaveno)',
'send_invoice' => 'Pošalji fakturu',
'send_quote' => '',
'send_receipt' => 'Pošalji račun',
'send_work_order' => '',
'serial' => 'Serijski broj',
'service_charge' => '',
'show_due' => '',
'show_invoice' => 'Pokaži fakturu',
'show_receipt' => 'Pokaži račun',
'start_typing_customer_name' => 'Počnite upisivati naziv kupca ...',
'start_typing_item_name' => 'Počnite upisivati naziv artikal ili skenirajte barkod',
'stock' => '',
'stock_location' => 'Skladište',
'sub_total' => 'Međuzbroj',
'successfully_deleted' => 'Uspješno ste obrisali prodaju',
'successfully_restored' => '',
'successfully_suspended_sale' => 'Neuspješno brisanje prodaje',
'successfully_updated' => 'Uspješno ste ažurirali prodaju',
'suspend_sale' => 'Obustavi',
'suspended_doc_id' => '',
'suspended_sale_id' => 'Broj obustave',
'suspended_sales' => 'Obustavljanje',
'table' => '',
'takings' => 'Prodano',
'tax' => 'Porez',
'tax_id' => '',
'tax_invoice' => '',
'tax_percent' => 'Porez %',
'taxed_ind' => '',
'total' => 'Ukupno',
'total_tax_exclusive' => 'Porez nije uključen',
'transaction_failed' => 'Greška kod prodaje',
'unable_to_add_item' => 'Artikal nije moguće dodati',
'unsuccessfully_deleted' => 'Prodaju(e) nije moguće izbrisati',
'unsuccessfully_restored' => '',
'unsuccessfully_suspended_sale' => 'Neuspješno brisanje prodaje',
'unsuccessfully_updated' => 'Prodaju(e) nije moguće ažurirati',
'unsuspend' => 'Ponovno uključeno',
'unsuspend_and_delete' => 'Uključeno i obrisano',
'update' => 'Ažuriraj',
'upi' => '',
'visa' => '',
'wholesale' => '',
'work_order' => '',
'work_order_number' => '',
'work_order_number_duplicate' => '',
'work_order_sent' => '',
'work_order_unsent' => '',
];