add number_format_ja(Japan Format) for number_format - #1485
kusanaginoturugi wants to merge 66 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughA new Japanese number format configuration has been added to the application's number formats settings. The configuration introduces a new public entry with label "number_format_ja" and comma thousands separator without modifying existing format definitions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@application/config/number_formats.php`:
- Around line 53-56: The new number_format_ja array entry is missing the
required 'decimal_point' key so code in Settings.php that does
$number_formats[$value]['decimal_point'] will throw an undefined index error;
update the 'number_format_ja' configuration (the 'number_format_ja' array) to
include a 'decimal_point' key with an explicit value (for example '.' or an
empty string if you prefer no decimals) so the lookup in Settings.php and any
consumers of $number_formats always find the key.
- Around line 53-56: Add a translation entry for the new config key
'number_format_ja' so the settings dropdown (which uses _trans($value['label']))
shows a human-friendly label; update the language files to include a mapping for
'number_format_ja' following the existing pattern used by other number formats
(e.g., the same style as other entries in the language arrays) so the label is
translated instead of showing the raw key.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 359d5ef1-4843-4612-9924-aac1b412c1e7
📒 Files selected for processing (1)
application/config/number_formats.php
| 'number_format_ja' => [ | ||
| 'label' => 'number_format_ja', | ||
| 'thousands_separator' => ',', | ||
| ], |
There was a problem hiding this comment.
Missing decimal_point key will cause runtime error.
The new number_format_ja entry is missing the decimal_point key that all other format entries have. When this format is selected, application/modules/settings/controllers/Settings.php (lines 101-105) directly accesses $number_formats[$value]['decimal_point'] without an isset() check, which will cause an "Undefined index" error.
Even if Japanese Yen doesn't use decimals, a value must be provided for the application to function correctly.
🐛 Proposed fix to add the missing decimal_point key
'number_format_ja' => [
'label' => 'number_format_ja',
+ 'decimal_point' => '.',
'thousands_separator' => ',',
],🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@application/config/number_formats.php` around lines 53 - 56, The new
number_format_ja array entry is missing the required 'decimal_point' key so code
in Settings.php that does $number_formats[$value]['decimal_point'] will throw an
undefined index error; update the 'number_format_ja' configuration (the
'number_format_ja' array) to include a 'decimal_point' key with an explicit
value (for example '.' or an empty string if you prefer no decimals) so the
lookup in Settings.php and any consumers of $number_formats always find the key.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Search for number_format_ja translation key in language files
# Search for the translation key in all language files
rg -n "number_format_ja" --glob "*_lang.php"Repository: InvoicePlane/InvoicePlane
Length of output: 51
🏁 Script executed:
# Check if number_format_ja is referenced/used anywhere in the codebase
rg -n "number_format_ja" --type php --type htmlRepository: InvoicePlane/InvoicePlane
Length of output: 231
🏁 Script executed:
# Examine the referenced language file to see the existing format translations
head -400 application/language/english/ip_lang.php | tail -30Repository: InvoicePlane/InvoicePlane
Length of output: 2641
🏁 Script executed:
# Search for how number_format labels are used in views/templates
rg -n "number_format" --glob "*.html" --glob "*.php" -A 2 | head -50Repository: InvoicePlane/InvoicePlane
Length of output: 5585
Add missing translation key for the new number format.
The label 'number_format_ja' lacks a corresponding translation entry in the language files. When displayed in the settings dropdown (via _trans($value['label']) at application/modules/settings/views/partial_settings_general.php:217), it will show the raw key "number_format_ja" instead of a human-readable label. Follow the existing pattern from other number formats:
'number_format_ja' => '1,000,000 (Japanese format)',🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@application/config/number_formats.php` around lines 53 - 56, Add a
translation entry for the new config key 'number_format_ja' so the settings
dropdown (which uses _trans($value['label'])) shows a human-friendly label;
update the language files to include a mapping for 'number_format_ja' following
the existing pattern used by other number formats (e.g., the same style as other
entries in the language arrays) so the label is translated instead of showing
the raw key.
There was a problem hiding this comment.
Pull request overview
This PR adds a Japanese number format option (1,000,000 — no decimal places) to InvoicePlane's number format configuration. It also includes an unrelated fix to the release workflow's language directory check and removes an old analysis document.
Changes:
- Added
number_format_jaentry to the number formats config - Updated the release workflow to check
application/language/englishinstead ofresources/lang/en - Deleted the
.junie/PR-1441-security-dry-analysis.mddocument
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| application/config/number_formats.php | Adds Japanese number format with thousands separator but missing decimal_point key |
| .github/workflows/release.yml | Fixes language directory path check from Laravel-style to CodeIgniter-style path |
| .junie/PR-1441-security-dry-analysis.md | Removes old security/DRY analysis document for a previous PR |
| 'thousands_separator' => '', | ||
| ], | ||
| 'number_format_ja' => [ | ||
| 'label' => 'number_format_ja', |
|
@kusanaginoturugi thanks for the PR, man!
You might want to consider this format: It's the US/UK format. |
d314f64 to
5b927da
Compare
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/8c81a4f8-e3a1-4c1d-86c4-585cf1c118fd Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…afety, dead code, DOM sanitizer Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/bf2724e4-678b-4ed5-9c24-3a3758d28493 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…er entry point Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/bf2724e4-678b-4ed5-9c24-3a3758d28493 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/bf2724e4-678b-4ed5-9c24-3a3758d28493 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…ed as HTML' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ate CHANGELOG and UPGRADE guide Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/d48e22c6-b03a-42e2-86e9-941490936d14 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…ENTS.md Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/f9be7229-f85e-423e-9683-9ea095e6bd74 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…ADME Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/ef8eee14-a7f4-4753-be32-4afd75e6a563 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
… in vendor/codeigniter/framework/system/language/english/custom_lang.php
…provements (#1536) * Initial plan * fix: apply PR review feedback - security hardening and code quality fixes - entrypoint.sh: add sanitize_config_value() to reject newline/CR in env vars - XSS_Protection_Trait: load file_security helper before sanitize_for_logging() calls - Admin_Controller: remove duplicate sanitize_array() override (log-injection risk) - Mdl_reports: fix (int) cast on db->escape() result (always yielded 0) - ip_lang.php: split duplicate invalid_file_path into two distinct keys; update call sites - Settings.php: remove duplicate remove_logo() function; use specific lang key per error type - e-invoice_helper.php: remove 3 duplicate XML config ID validation blocks - Mdl_settings.php: use WHERE IN for relevant keys only + wrap in transaction - invoice_helper.php: html_escape() logo URL in img tag - Payments.php: replace two-query PHP prefetch with single INNER JOIN - Mdl_templates.php: replace directory_map() scanning with explicit config allowlisting - ipconfig.php.example + AGENTS.md: document new CUSTOM_*_TEMPLATES_* constants Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/ccca80d5-c9da-4358-af01-52310274a459 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/73a6da7a-9fef-4ad8-89ec-754c9c8ffd48 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…lic invoices Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/73a6da7a-9fef-4ad8-89ec-754c9c8ffd48 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/73a6da7a-9fef-4ad8-89ec-754c9c8ffd48 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/73a6da7a-9fef-4ad8-89ec-754c9c8ffd48 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
… linked issues, and security advisories for v1.7.2 Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/50dae12d-9bca-485a-9940-647dd39915e6 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
… & Improvements table Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/81c673d8-27ee-48b6-9584-574d147805df Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
… v1.7.2 security Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/18c11ad2-5e8e-4410-b8f0-2073d2b920a8 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…rt alphabetically; add mpldr and PatrickGTR Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/a2315ff2-9d6b-44f9-88d7-6e4caf729a16 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
…stants Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/019719ab-2c8d-4df8-a76f-4703ead57e64 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Added logic to determine recipient based on priority from QR code settings and invoice details.
Indeed, missed this when editing the fork Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Agent-Logs-Url: https://github.com/InvoicePlane/InvoicePlane/sessions/9c86af9e-0258-4492-ab27-0c2e89a38e55 Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Pull Request Checklist
Please check the following steps before submitting your PR. If any items are incomplete, consider marking it as
[WIP](Work in Progress).Checklist
Description
Provide a brief description of the changes made in this pull request.
Related Issue(s)
List any related issues or discussions. If applicable, link to an accompanying thread on the forums.
Fixes # (example)
Motivation and Context
Why was this change necessary? Does it solve a problem or improve an existing feature? If this PR fixes an open issue, link to it here.
Issue Type (Check one or more)
Screenshots (If Applicable)
Attach relevant screenshots that demonstrate your changes.
Thank you for your contribution to InvoicePlane! We appreciate your time and effort.
Summary by CodeRabbit
Release Notes