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
16 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' => 'מצב Mailchimp',
'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' => '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' => 'מספר החשבונית חייב להיות ייחודי.',
'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' => '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' => 'מצב הרשמה',
'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' => 'בחר לקוח',
'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' => '',
'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' => 'הזמנת עבודה לא נשלחה אל',
];