Skip to content

Remove unused Sales language keys #4586

Closed

Description

@objecttothis

Summary

Audit of app/Language/en/Sales.php found ~45 keys with zero references anywhere in the codebase (controllers, views, models, libraries, JS files). These should be removed to reduce translation burden across all locale files.

Verified Unused Keys

Searched via lang('Sales.<key>') pattern across all PHP, JS, and view files.

Definitely unused (no hits anywhere)

Key Current value
cash_1 (empty)
cash_2 (empty)
cash_3 (empty)
cash_4 (empty)
close (empty)
complete (empty)
current_table (empty)
customer_total_spent (empty)
customers_available_points "Points Available"
daily_sales (empty)
date_type "Date is a required field."
delete_entire_sale "Delete Entire Sale"
discard_quote (empty)
discount_short "%"
edit_sale "Edit Sale"
giftcard_filter (empty)
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_update "Recount"
mc (empty)
no_filter "All"
no_sales_to_display "No Sales to display."
remove_discount (empty)
rewards_balance "Reward Points Balance"
rewards_package "Rewards"
sale_by_invoice "Sale by Invoice"
sale_for_customer "Customer:"
sales_total (empty)
service_charge (empty)
show_due (empty)
visa (empty)
wholesale (empty)

Possibly dynamic — verify before removing

These keys follow a pattern that could be constructed dynamically (e.g. lang('Sales.' . $result ? 'x_sent' : 'x_unsent')). A search for the literal lang('Sales.key_name') form returns no hits, but check for string concatenation or variable key lookups before deleting.

Key Current value Pattern concern
delete_successful "Sale delete successful." success/fail pair
delete_unsuccessful "Sale delete failed." success/fail pair
invoice_sent "Invoice sent to" sent/unsent pair
invoice_unsent "Invoice failed to be sent to" sent/unsent pair
quote_sent "Quote sent to" sent/unsent pair
quote_unsent "Quote failed to be sent to" sent/unsent pair
work_order_sent "Work Order sent to" sent/unsent pair
work_order_unsent "Work Order failed to be sent to" sent/unsent pair
payment_not_cover_total "Payment Amount must be greater than or equal to Total." may be in JS

Note: receipt_sent / receipt_unsent ARE used — Sales.php:1007 uses a ternary lang($result ? 'Sales.receipt_sent' : 'Sales.receipt_unsent'). The invoice/quote/work_order equivalents show no such pattern currently but may have existed or be planned.

Scope

Each removed key must also be removed from all locale files under app/Language/*/Sales.php (30+ locales). Recommend a script or find-replace pass rather than manual edits.

Verification Method

# Check for any usage of a key before removing:
grep -r "Sales\.key_name" app/ public/

False Positives (confirmed used — do NOT remove)

These appeared unused in initial scan but are referenced:

  • taxed_ind / nontaxed_ind → app/Libraries/Tax_lib.php:158-160
  • quantity_less_than_reorder_level / quantity_less_than_zero → app/Libraries/Sale_lib.php:1204-1206
  • item_out_of_stock / item_insufficient_of_stock → app/Libraries/Sale_lib.php
  • group_by_type / group_by_category → app/Libraries/Sale_lib.php:74-75
  • show_invoice / show_receipt → app/Helpers/tabular_helper.php:122,129
  • account_number / wallet / upi → app/Helpers/locale_helper.php, app/Controllers/Sales.php
  • invoice_total → app/Views/sales/quote.php, app/Views/sales/invoice.php
  • receipt_sent / receipt_unsent → app/Controllers/Sales.php:1007

Activity

  1. objecttothis commented on Jun 29, 2026

    @objecttothis
    MemberAuthor

    Similar audits of the other language files should be done and these should be removed from other languages as well.

  2. changed the issue type fromtoon Jun 29, 2026
  3. objecttothis commented on Jul 2, 2026

    @objecttothis
    MemberAuthor

    TODO: Sync selected_customer key across locale Sales.php files

    Follow-up from a CodeRabbit review comment on #4587 (requested by @objecttothis), flagged as out of scope for that PR.

    Context

    The selected_customer translation key exists in app/Language/en/Sales.php (and possibly a couple of other locales) but is missing from most app/Language/*/Sales.php files. Locales without this key will silently fall back to the default English string instead of showing a translated label.

    Required change

    • Add the selected_customer key to all app/Language/*/Sales.php files that are currently missing it, using locale-appropriate wording consistent with neighboring customer-related keys (e.g., selected_customer, select_customer).

    Links

    Acceptance criteria

    • selected_customer key present with a translated (or intentionally empty, per project convention) value in every app/Language/*/Sales.php file.
  4. objecttothis commented on Oct 22, 2026

    @objecttothis
    MemberAuthor

    Claude Issue Checker Agent (cc @objecttothis)

    Investigated against current master.

    Status: Still present (cleanup not merged).

    app/Language/en/Sales.php still contains essentially all of the keys flagged as unused in this issue, e.g. cash_1/cash_2/cash_3/cash_4, close, complete, current_table, customer_total_spent, customers_available_points, daily_sales, date_type, delete_entire_sale, discard_quote, discount_short, edit_sale, giftcard_filter, invoice_type_custom_invoice, invoice_type_custom_tax_invoice, invoice_type_invoice, invoice_type_tax_invoice, invoice_update, mc, no_filter, no_sales_to_display, remove_discount, rewards_balance, rewards_package, sale_by_invoice, sale_for_customer, sales_total, service_charge, show_due, visa, wholesale — all still defined verbatim in the file.

    This lines up with the issue's linked PR #4637 "chore: remove unused Sales language keys" still being open/unmerged as of this check.

  5. added a commit that references this issue on Oct 27, 2026
    b07f5e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions