Files
opensourcepos/app/Language/en-GB/Sales.php
objecttothis 9c542efaf6 Feature: Payment reference code (#4587)
* Add `reference_code` to sale payment queries and group by statements

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Refactor `Sales` controller to improve payment handling readability and replace snake_case with camelCase variables

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Add missing translations for `Sales` language file and include new keys like `must_enter_rrn` and `reference_code`

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Refactor `Sales` payment handling to use camelCase and extend `addPayment` with `referenceCode` support

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Refactor `Sales` models, controllers, and libraries to adopt camelCase naming conventions and improve readability

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Add translations and updates for `must_enter_reference_code` and `reference_code` across language files and update `Sales` controller to replace `must_enter_rrn` with the new key

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* feat(sales): add reference code input and payment type helper

- Add `get_reference_code_payment_types()` to locale_helper as single
  source of truth for card-requiring payment types
- Add reference code row to register view, shown/hidden via JS based
  on selected payment type
- Fix payment type dropdown width to 100% for consistent layout
- Add min-width to payment buttons and right-padding to button group

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* feat(config): add payment reference code length configuration

- Add payment_reference_code_min and payment_reference_code_max fields
  to Config controller save logic
- Add translation keys for reference code length limits across all
  language files (min/max label + section header)
- Align array key formatting in Config controller for readability

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* style(lang): normalize string delimiters to single quotes across all language files

Convert double-quoted array keys and values to single quotes in all
app/Language/*/Config.php and app/Language/*/Sales.php variants.
No translation content changed — formatting only.

Also add Localization section to AGENTS.md documenting language file
conventions for new keys and fallback behavior.

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* feat(lang): add payment reference code length translations

Add localized strings for payment_reference_code_length_limits,
payment_reference_code_length_max_label, and
payment_reference_code_length_min_label across all supported locales.

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* test(config,sales): add payment reference code min/max validation tests

- Add baseLocalePayload() helper in ConfigTest for postSaveLocale tests
- Add testSaveLocale_AcceptsValidReferenceCodeMinMax and related boundary tests
- Add Sale_libPaymentTest for payment reference code validation in Sale_lib

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* fix(sales): add type-specific validation for amount_tendered

Gift card payments use amount_tendered as giftcard number (integer);
cash/other payments require decimal_locale format. Apply correct
validation rule per payment type instead of generic required.

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* fix(lang): replace self-closing </br> with <br> in all locales

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* fix(sales): use configurable precision in discount comparison

Replace hardcoded precision 2 with totals_decimals() when comparing
discount against item total via bccomp/bcmul, so discount validation
respects the configured decimal precision setting.

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* fix(lang): correct Azerbaijani translations in Config.php

Replace placeholder/mismatched strings with accurate translations:
- email_mailpath, email_smtp_pass, invoice_email_message
- number_locale_invalid/required, receipt_template
- reward_configuration, right, tax_decimals, theme

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* feat(sales): add reference code support to payment edit flow

- Add reference_code field to new payment row in sale edit form
- Persist reference_code on insert in Sale model
- Validate reference_code_new in Sales controller using configurable min/max length rules

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* feat(lang): add Georgian (ka) language stubs for Config and Sales

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Match the fallback maximum reference_code length to the maximum of the field in the db

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

* Bug fixes

- Add validation of UI settings to prevent overridden values from being passed.
- Correct maximum value in JS for payment_reference_code maximum length to 40.
- Fix bug causing copy_entire_sale() to incorrectly copy the reference code and cash_adjustment

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>

---------

Signed-off-by: Travis Garrison <travis@chiraqbookstore.com>
Co-authored-by: Travis Garrison <travis@chiraqbookstore.com>
2026-07-10 13:49:05 +04:00

239 lines
14 KiB
PHP

<?php
return [
'account_number' => 'Account #',
'add_payment' => 'Add Payment',
'amount_due' => 'Amount Due',
'amount_tendered' => 'Amount Tendered',
'authorized_signature' => 'Authorised Signature',
'bank_transfer' => 'Bank Transfer',
'cancel_sale' => 'Cancel',
'cash' => 'Cash',
'cash_1' => '',
'cash_2' => '',
'cash_3' => '',
'cash_4' => '',
'cash_adjustment' => 'Cash Adjustment',
'cash_deposit' => 'Cash Deposit',
'cash_filter' => 'Cash',
'change_due' => 'Change Due',
'change_price' => 'Change Selling Price',
'check' => 'Cheque',
'check_balance' => 'Cheque remainder',
'check_filter' => 'Cheque',
'close' => '',
'comment' => 'Comment',
'comments' => 'Comments',
'company_name' => '',
'complete' => '',
'complete_sale' => 'Complete',
'confirm_cancel_sale' => 'Are you sure you want to clear this sale? All items will be cleared.',
'confirm_delete' => 'Are you sure you want to delete the selected Sale(s)?',
'confirm_restore' => 'Are you sure you want to restore the selected Sale(s)?',
'credit' => 'Credit Card',
'credit_deposit' => 'Credit Deposit',
'credit_filter' => 'Credit Card',
'current_table' => '',
'customer' => 'Customer',
'customer_address' => 'Address',
'customer_discount' => 'Discount',
'customer_email' => 'Email',
'customer_location' => 'Location',
'customer_mailchimp_status' => 'MailChimp Status',
'customer_optional' => '(Required for Due Payments)',
'customer_required' => '(Required)',
'customer_total' => 'Total',
'customer_total_spent' => '',
'customers_available_points' => 'Points Available',
'daily_sales' => '',
'date' => 'Sale Date',
'date_range' => 'Date Range',
'date_required' => 'A correct date must be entered.',
'date_type' => 'Date is a required field.',
'debit' => 'Debit Card',
'debit_filter' => '',
'delete' => 'Allow Delete',
'delete_confirmation' => 'Are you sure you want to delete this sale? This action cannot be undone.',
'delete_entire_sale' => 'Delete Entire Sale',
'delete_successful' => 'Sale delete successful.',
'delete_unsuccessful' => 'Sale delete failed.',
'description_abbrv' => 'Desc.',
'discard' => 'Discard',
'discard_quote' => '',
'discount' => 'Disc',
'discount_exceeds_item_total' => 'Discount cannot exceed the item total.',
'discount_included' => '% Discount',
'discount_percent_exceeds_100' => 'Percentage discount cannot exceed 100%.',
'discount_short' => '%',
'due' => 'Due',
'due_filter' => 'Due',
'edit' => 'Edit',
'edit_item' => 'Edit Item',
'edit_sale' => 'Edit Sale',
'email_receipt' => 'Email Receipt',
'employee' => 'Employee',
'entry' => 'Entry',
'error_editing_item' => 'Error editing item',
'find_or_scan_item' => 'Find or Scan Item',
'find_or_scan_item_or_receipt' => 'Find or Scan Item or Receipt',
'giftcard' => 'Gift Card',
'giftcard_balance' => 'Gift Card Balance',
'giftcard_filter' => '',
'giftcard_number' => 'Gift Card Number',
'group_by_category' => 'Group by Category',
'group_by_type' => 'Group by Type',
'hsn' => 'HSN',
'id' => 'Sale ID',
'include_prices' => 'Include Prices?',
'invoice' => 'Invoice',
'invoice_confirm' => 'This invoice will be sent to',
'invoice_enable' => 'Invoice Number',
'invoice_filter' => 'Invoices',
'invoice_no_email' => 'This customer does not have a valid email address.',
'invoice_number' => 'Invoice #',
'invoice_number_duplicate' => 'Invoice Number {0} must be unique.',
'invoice_sent' => 'Invoice sent to',
'invoice_total' => 'Invoice Total',
'invoice_type_custom_invoice' => 'Custom Invoice (custom_invoice.php)',
'invoice_type_custom_tax_invoice' => 'Custom Tax Invoice (custom_tax_invoice.php)',
'invoice_type_invoice' => 'Invoice (invoice.php)',
'invoice_type_tax_invoice' => 'Tax Invoice (tax_invoice.php)',
'invoice_unsent' => 'Invoice failed to be sent to',
'invoice_update' => 'Recount',
'item_insufficient_of_stock' => 'Item has insufficient stock.',
'item_name' => 'Item Name',
'item_number' => 'Item #',
'item_out_of_stock' => 'Item is out of stock.',
'key_browser' => 'Helpful Shortcuts',
'key_cancel' => 'Cancels Current Quote/Invoice/Sale',
'key_customer_search' => 'Customer Search',
'key_finish_quote' => 'Finish Quote/Invoice without payment',
'key_finish_sale' => 'Add Payment and Complete Invoice/Sale',
'key_full' => 'Open in Full Screen Mode',
'key_function' => 'Function',
'key_help' => 'Shortcuts',
'key_help_modal' => 'Open Shortcuts Window',
'key_in' => 'Zoom in',
'key_item_search' => 'Item Search',
'key_out' => 'Zoom Out',
'key_payment' => 'Add Payment',
'key_print' => 'Print Current Page',
'key_restore' => 'Restore Original Display/Zoom',
'key_search' => 'Search Reports Tables',
'key_suspend' => 'Suspend Current Sale',
'key_suspended' => 'Show Suspended Sales',
'key_system' => 'System Shortcuts',
'key_tendered' => 'Edit Amount Tendered',
'key_title' => 'Sales Keyboard Shortcuts',
'mc' => '',
'mode' => 'Register Mode',
'must_enter_numeric' => 'Amount Tendered must be a number.',
'must_enter_numeric_giftcard' => 'Gift Card Number must be a number.',
'must_enter_reference_code' => 'Reference/Retrieval Number must be entered.',
'negative_discount_invalid' => 'Discount cannot be negative.',
'negative_price_invalid' => 'Price cannot be negative.',
'negative_quantity_invalid' => 'Quantity cannot be negative.',
'negative_total_invalid' => 'Sale total cannot be negative. Check item discounts and quantities.',
'new_customer' => 'New Customer',
'new_item' => 'New Item',
'no_description' => 'No description',
'no_filter' => 'All',
'no_items_in_cart' => 'There are no Items in the cart.',
'no_sales_to_display' => 'No Sales to display.',
'none_selected' => 'You have not selected any Sale(s) to delete.',
'nontaxed_ind' => ' ',
'not_authorized' => 'This action is not authorised.',
'one_or_multiple' => 'Sale(s)',
'payment' => 'Payment Type',
'payment_amount' => 'Amount',
'payment_not_cover_total' => 'Payment Amount does not cover Total.',
'payment_type' => 'Type',
'payments' => '',
'payments_total' => 'Payments Total',
'price' => 'Price',
'print_after_sale' => 'Print after Sale',
'quantity' => 'Qty',
'quantity_less_than_reorder_level' => 'Warning: Desired Quantity is below Reorder Level for that Item.',
'quantity_less_than_zero' => 'Warning: Desired Quantity is out of stock, audit your inventory.',
'quantity_of_items' => 'Quantity of {0} Items',
'quote' => 'Quote',
'quote_number' => 'Quote Number',
'quote_number_duplicate' => 'Quote Number must be unique.',
'quote_sent' => 'Quote sent to',
'quote_unsent' => 'Quote failed to be sent to',
'receipt' => 'Sales Receipt',
'receipt_no_email' => 'This customer does not have a valid email address.',
'receipt_number' => 'Sale #',
'receipt_sent' => 'Receipt sent to',
'receipt_unsent' => 'Receipt failed to be sent to',
'reference_code' => 'Payment Reference Code',
'reference_code_invalid_characters' => 'Reference code must contain only letters and numbers.',
'reference_code_length_error' => 'Reference code length is invalid.',
'refund' => 'Refund Type',
'register' => 'Sales Register',
'remove_customer' => 'Remove Customer',
'remove_discount' => '',
'return' => 'Return',
'rewards' => 'Reward Points',
'rewards_balance' => 'Reward Points Balance',
'rewards_package' => 'Rewards',
'rewards_remaining_balance' => 'Reward Points remaining value is ',
'sale' => 'Sale',
'sale_by_invoice' => 'Sale by Invoice',
'sale_for_customer' => 'Customer:',
'sale_time' => 'Time',
'sales_tax' => 'Sales Tax',
'sales_total' => '',
'select_customer' => 'Select Customer',
'selected_customer' => 'Selected Customer',
'send_invoice' => 'Send Invoice',
'send_quote' => 'Send Quote',
'send_receipt' => 'Send Receipt',
'send_work_order' => 'Send Work Order',
'serial' => 'Serial',
'service_charge' => '',
'show_due' => '',
'show_invoice' => 'Show Invoice',
'show_receipt' => 'Show Receipt',
'start_typing_customer_name' => 'Start typing customer details...',
'start_typing_item_name' => 'Start typing Item Name or scan Barcode...',
'stock' => 'Stock',
'stock_location' => 'Stock Location',
'sub_total' => 'Sub Total',
'successfully_deleted' => 'You have successfully deleted Sale',
'successfully_restored' => 'You have successfully restored',
'successfully_suspended_sale' => 'Sale suspend successful.',
'successfully_updated' => 'Sale update successful.',
'suspend_sale' => 'Suspend',
'suspended_doc_id' => 'Document',
'suspended_sale_id' => 'ID',
'suspended_sales' => 'Suspended',
'table' => 'Table',
'takings' => 'Transactions',
'tax' => 'Tax',
'tax_id' => 'Tax Id',
'tax_invoice' => 'Tax Invoice',
'tax_percent' => 'Tax %',
'taxed_ind' => 'T',
'total' => 'Total',
'total_tax_exclusive' => 'Tax excluded',
'transaction_failed' => 'Sales Transaction failed.',
'unable_to_add_item' => 'Item add to Sale failed',
'unsuccessfully_deleted' => 'Sale(s) delete failed.',
'unsuccessfully_restored' => 'Sale(s) restore failed.',
'unsuccessfully_suspended_sale' => 'Sale suspend failed.',
'unsuccessfully_updated' => 'Sale update failed.',
'unsuspend' => 'Unsuspend',
'unsuspend_and_delete' => 'Action',
'update' => 'Update',
'upi' => 'UPI',
'visa' => '',
'wallet' => 'Wallet',
'wholesale' => '',
'work_order' => 'Work Order',
'work_order_number' => 'Work Order Number',
'work_order_number_duplicate' => 'Work Order Number must be unique.',
'work_order_sent' => 'Work Order sent to',
'work_order_unsent' => 'Work Order failed to be sent to',
];