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

240 lines
14 KiB
PHP

<?php
return [
'account_number' => '',
'add_payment' => 'Zahlung',
'amount_due' => 'fälliger Betrag',
'amount_due_not_covered' => 'Die Zahlungen decken den fälligen Betrag nicht.',
'amount_tendered' => 'Erhalten',
'authorized_signature' => '',
'cancel_sale' => 'Annullieren',
'cash' => 'Bar',
'cash_1' => '',
'cash_2' => '',
'cash_3' => '',
'cash_4' => '',
'cash_adjustment' => '',
'cash_deposit' => '',
'cash_filter' => 'Bar',
'change_due' => 'Wechselgeld',
'change_price' => '',
'check' => 'Scheck',
'check_balance' => 'Scheck-Differenz',
'check_filter' => '',
'close' => '',
'comment' => 'Bemerkung',
'comments' => 'Bemerkungen',
'company_name' => '',
'complete' => '',
'complete_sale' => 'Abschliessen',
'confirm_cancel_sale' => 'Wollen Sie diesen Verkauf abschliessen? Alle Artikeleinträge werden entfernt',
'confirm_delete' => 'Wollen Sie die gewählten Aufträge löschen?',
'confirm_restore' => '',
'credit' => 'Kreditkarte',
'credit_deposit' => '',
'credit_filter' => '',
'current_table' => '',
'customer' => 'Kunde',
'customer_address' => 'Customer Address',
'customer_discount' => 'Discount',
'customer_email' => 'Customer Email',
'customer_location' => 'Customer Location',
'customer_mailchimp_status' => '',
'customer_optional' => '',
'customer_required' => '',
'customer_total' => 'Total',
'customer_total_spent' => '',
'customers_available_points' => '',
'daily_sales' => '',
'date' => 'Datum',
'date_range' => 'Zeitrahmen',
'date_required' => 'Ein korrektas Datum ist erforderlich',
'date_type' => 'Datum ist erforderlich',
'debit' => 'Debitkarte',
'debit_filter' => '',
'delete' => '',
'delete_confirmation' => 'Wollen Sie diesen Auftrag löschen? Rückgängig unmöglich',
'delete_entire_sale' => 'Auftrag löschen',
'delete_successful' => 'Löschung erfolgreich',
'delete_unsuccessful' => 'Löschung nicht erfolgreich',
'description_abbrv' => 'Bez.',
'discard' => '',
'discard_quote' => '',
'discount' => '%',
'discount_exceeds_item_total' => '',
'discount_included' => 'Rabatt %',
'discount_percent_exceeds_100' => '',
'discount_short' => '%',
'due' => '',
'due_filter' => '',
'edit' => 'Ändern',
'edit_item' => 'Ändere Art.',
'edit_sale' => 'Auftrag ändern',
'email_receipt' => 'Quittung per Email',
'employee' => 'Mitarbeiter',
'entry' => '',
'error_editing_item' => 'Fehler beim Ändern des Artikels',
'find_or_scan_item' => 'Finde/Scanne Artikel',
'find_or_scan_item_or_receipt' => 'Finde/Scanne Artikel oder Quittung',
'giftcard' => 'Gutschein',
'giftcard_balance' => 'Gutschein Restwert',
'giftcard_filter' => '',
'giftcard_number' => 'Gutschein Nr.',
'group_by_category' => '',
'group_by_type' => '',
'hsn' => '',
'id' => 'ID',
'include_prices' => '',
'insufficient_giftcard_balance' => 'Unzureichendes Geschenkguthaben für diese Zahlung.',
'insufficient_reward_points' => 'Unzureichende Prämienpunkte für diese Zahlung.',
'invoice' => 'Rechnung',
'invoice_confirm' => 'Diese rechnung wird gesendet an',
'invoice_enable' => 'Erzeuge Rechnung',
'invoice_filter' => 'Rechnungen',
'invoice_no_email' => 'Dieser Kunde hat keine gültige Email Adresse',
'invoice_number' => 'Rechnungs-Nr.',
'invoice_number_duplicate' => 'Bitte geben Sie eine eindeutige Rechnungsnummer ein',
'invoice_sent' => 'Rechnung gesendet an',
'invoice_total' => '',
'invoice_type_custom_invoice' => '',
'invoice_type_custom_tax_invoice' => '',
'invoice_type_invoice' => '',
'invoice_type_tax_invoice' => '',
'invoice_unsent' => 'Rechnung nicht gesendet',
'invoice_update' => 'Aktualisieren',
'item_insufficient_of_stock' => 'Artikel hat Unterbestand',
'item_name' => 'Artikelname',
'item_number' => 'Artikel-Nr.',
'item_out_of_stock' => 'Artikel ist nicht am Lager',
'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' => 'Verkaufstyp',
'must_enter_numeric' => 'Eingabe muss eine Zahl sein',
'must_enter_numeric_giftcard' => 'Gutschein-Nr. muss eine Zahl sein',
'must_enter_reference_code' => 'Referenz-/Abrufnummer muss eingegeben werden.',
'negative_amount_tendered' => 'Der erhaltene Betrag darf nicht negativ sein.',
'negative_discount_invalid' => '',
'negative_price_invalid' => '',
'negative_quantity_invalid' => '',
'negative_total_invalid' => '',
'new_customer' => 'Neuer Kunde',
'new_item' => 'Neuer Artikel',
'no_description' => 'nichts',
'no_filter' => 'Alle',
'no_items_in_cart' => 'Warenkorb ist leer',
'no_sales_to_display' => 'Keine Artikel zum Anzeigen',
'none_selected' => 'Sie haben keinen Auftrag zum Löschen ausgewählt',
'nontaxed_ind' => '',
'not_authorized' => '',
'one_or_multiple' => 'Verkäufe',
'payment' => 'Zahlungsart',
'payment_amount' => 'Betrag',
'payment_not_cover_total' => 'Betrag deckt Rechnungsbetrag nicht',
'payment_type' => 'Typ',
'payments' => '',
'payments_total' => 'Zahlung Total',
'price' => 'Preis',
'print_after_sale' => 'Drucke Bon nach Verkauf',
'quantity' => 'Menge',
'quantity_less_than_reorder_level' => 'Warnung: Gewünschte Menge ist nicht verfügbar.',
'quantity_less_than_zero' => 'Warnung: Gewünschte Menge ist nicht verfügbar. Sie können den Verkauf fortsetzen, dennoch prüfen Sie bitte den Lagerbestand.',
'quantity_of_items' => '',
'quote' => '',
'quote_number' => '',
'quote_number_duplicate' => '',
'quote_sent' => '',
'quote_unsent' => '',
'receipt' => 'Quittung',
'receipt_no_email' => '',
'receipt_number' => 'Quittung Nr.',
'receipt_sent' => 'Quittung gesendet an',
'receipt_unsent' => 'Quittung nicht gesendet',
'reference_code' => 'Zahlungsreferenzcode',
'reference_code_invalid_characters' => 'Der Referenzcode darf nur Buchstaben und Zahlen enthalten.',
'reference_code_length_error' => 'Die Länge des Referenzcodes ist ungültig.',
'refund' => '',
'register' => 'Kasse',
'remove_customer' => 'Entferne Kunde',
'remove_discount' => '',
'return' => 'Retoure',
'rewards' => '',
'rewards_balance' => '',
'rewards_package' => '',
'rewards_remaining_balance' => '',
'sale' => 'Verkauf',
'sale_by_invoice' => '',
'sale_for_customer' => 'Kunde:',
'sale_time' => 'Zeit',
'sales_tax' => '',
'sales_total' => '',
'select_customer' => 'Wähle Kunde (optional)',
'send_invoice' => 'Sende Rechnung',
'send_quote' => '',
'send_receipt' => 'Sende Quittung',
'send_work_order' => '',
'serial' => 'Seriennummer',
'service_charge' => '',
'show_due' => '',
'show_invoice' => 'Rechnung',
'show_receipt' => 'Quittung',
'start_typing_customer_name' => 'Geben Sie den Kundennamen ein...',
'start_typing_item_name' => 'Geben Sie den Artikel ein oder scannen Sie ihn...',
'stock' => '',
'stock_location' => 'Lagerort',
'sub_total' => 'Zwischentotal',
'successfully_deleted' => 'Löschung erfolgreich',
'successfully_restored' => '',
'successfully_suspended_sale' => 'Auftrag wurde erfolgreich pendent gehalten',
'successfully_updated' => 'Änderung erfolgreich',
'suspend_sale' => '->Pendent',
'suspended_doc_id' => '',
'suspended_sale_id' => 'ID',
'suspended_sales' => 'Pendente Aufträge',
'table' => '',
'takings' => 'Einnahmen',
'tax' => 'MWSt',
'tax_id' => '',
'tax_invoice' => '',
'tax_percent' => 'MWSt %',
'taxed_ind' => '',
'total' => 'Total',
'total_tax_exclusive' => 'Total exkl. MWSt.',
'transaction_failed' => 'Verarbeitung fehlerhaft',
'unable_to_add_item' => 'Kann Artikel nicht zum Auftrag hinzufügen',
'unsuccessfully_deleted' => 'Löschung nicht erfolgreich',
'unsuccessfully_restored' => '',
'unsuccessfully_suspended_sale' => 'Auftrag wurde erfolgreich pendent gehalten',
'unsuccessfully_updated' => 'Änderung nicht erfolgreich',
'unsuspend' => 'Aktivieren',
'unsuspend_and_delete' => 'Aktivieren und löschen',
'update' => 'Ändern',
'upi' => '',
'visa' => '',
'wholesale' => '',
'work_order' => '',
'work_order_number' => '',
'work_order_number_duplicate' => '',
'work_order_sent' => '',
'work_order_unsent' => '',
];