Skip to content

Add ACF investment report field for pension fund pages#69

Open
taavipertman-glitch wants to merge 3 commits into
masterfrom
acf-investment-report-fields
Open

Add ACF investment report field for pension fund pages#69
taavipertman-glitch wants to merge 3 commits into
masterfrom
acf-investment-report-fields

Conversation

@taavipertman-glitch

Copy link
Copy Markdown
Contributor

Summary

  • Add investment_report_file ACF field to TUK75, TUK00, TUV100 fund pages (matching TKF100's existing pattern)
  • Templates use ACF field when set, fall back to current hardcoded URL when not set

Safe to deploy immediately — no behavior change until someone sets the ACF field on a fund page.

What this enables

Changes

  • helpers/acf/fund-pension.php — new ACF field group with investment_report_file for page templates page_fund-stocks.php, page_fund-bonds.php, page_fund-third.php
  • helpers/acf/init.php — include the new file
  • fund-stocks-details.php — use get_field('investment_report_file') with hardcoded fallback
  • fund-bonds-details.php — same
  • fund-third-details.php — same

After merging

Once the ACF fields are set on each fund page (either manually or via REST API), the hardcoded fallback URLs can be removed in a follow-up cleanup.

🤖 Generated with Claude Code

taavipertman-glitch and others added 3 commits May 28, 2026 15:06
Add investment_report_file ACF field to the stocks, bonds, and third
pillar fund page templates, matching the pattern TKF100 already uses.

When the ACF field is set (via wp-admin or REST API), it overrides the
hardcoded report URL. When not set, the current hardcoded URL remains
as fallback — safe to deploy without setting the fields first.

This enables:
- Manual report updates from wp-admin (same as TKF100 today)
- Automated updates via WordPress REST API from onboarding-service

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add esc_url() and esc_html() to prevent potential XSS via
ACF-managed URLs. Guard preg_match before accessing $matches
to avoid PHP notices when URL has no /YYYY/MM/ date segment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
generate_report_link() previously discarded the URL host and rebuilt the link
against get_site_url(), which breaks ACF-supplied media URLs served from a CDN
or dedicated media host. Absolute URLs now pass through with their host intact;
only site-relative paths are resolved against the site.

The date label was derived from the WordPress upload-folder month minus one,
which is wrong when a report is uploaded in a different month than the period it
covers. The investment report pipeline encodes the period directly in the
filename as YYYY-MM, so parse that when present and fall back to the legacy
folder-month heuristic only for the old hardcoded report URLs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant