29 Commits

Author SHA1 Message Date
chaim e7d901be29 chore: bump version to 2.1.0 (CaseFiles dual-backend integration — P5/P6/P7)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v2.1.0
2026-06-21 11:15:47 +00:00
chaim 3178904b28 feat: place generated report in the CaseFiles case folder (P7)
DirectAccessReportGenerator now, when CaseFilesCore is installed (soft-detected,
no hard dependency), sets the generated Document's folderId to the case
"מסמכים" folder via CaseFolderService so it shows in the CaseDocs panel. The
existing Case link + best-effort NetworkStorage upload are unchanged.

Verified on dev (P7_OK): php -l clean; Case.documents relate is visible via
Document.cases (shared junction); folder placement works.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 10:53:23 +00:00
chaim c1535e744f fix: subject-only report naming (tight hyphen) and correct case-folder upload
The direct-access report now follows rule N1 canonical naming:
- The document name uses a tight ASCII hyphen ("דוח גישה ישירה-{contact}") instead of
  an em-dash, and is sanitized via NetworkStorageIntegration's shared sanitizer.
- The report is now uploaded explicitly to the case folder after the Case link is set
  (the AfterSave hook fired before the link existed, so reports previously landed in the
  generic fallback folder). The Document and Attachment names are realigned to the
  canonical stored name.

Adds build.sh (was missing) so the package can be built locally if needed.

Refs Task Master #1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.10
2026-06-03 08:17:43 +00:00
chaim 15602a976f chore: remove ai-gateway plugin deployment from install scripts
Legal tools (generate_initial_report) are now built into shira-hermes
(mcp_server/tools/legal_tools.py). The AfterInstall no longer needs to
deploy tools.json and prompts.json to ai-gateway's plugins/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 19:47:30 +00:00
chaim ffc60a6c0f fix: regex was matching w:tbl, w:tc, w:tr — corrupting DOCX XML
The previous regex /<w:t(?!...)/ matched any tag starting with <w:t
including <w:tbl>, <w:tc>, <w:tr>. Added lookahead (?=[ >/]) to only
match <w:t> elements (followed by space, > or /).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.9
2026-04-09 21:44:22 +00:00
chaim 53844ace9a fix: add xml:space=preserve to all w:t elements in generated DOCX
PHPWord's TemplateProcessor strips whitespace from <w:t> elements that
lack xml:space="preserve". Post-process the output DOCX to add this
attribute, preventing words from sticking together (e.g. בהולמועדים,
לקוחנחוץ).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.8
2026-04-09 21:38:21 +00:00
chaim f8022279ad fix: change date format from dd/mm/yyyy to dd.mm.yyyy
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.7
2026-04-09 21:24:18 +00:00
chaim 763638abd5 fix: add non-breaking space after checkbox characters
PHPWord's TemplateProcessor loses regular spaces between placeholder
replacement values and adjacent text in RTL documents. Using NBSP
(\u00A0) after ☑/☐ ensures Word preserves the spacing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.6
2026-04-09 21:21:44 +00:00
chaim 99bc442495 fix: handle stdClass legalAnalysis in DirectAccessReportGenerator
When legalAnalysis arrives as a stdClass (from JSON decode), cast it to
array before using array access. Prevents fatal error in PHP 8.x.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.5
2026-04-09 20:59:14 +00:00
chaim 61fe16a0ea fix: enforce legal analysis step and correct recommendation selection
- Prompt: CRITICAL instruction — must complete all 7 steps before generating report
- Step 5 (legal analysis) is mandatory, cannot be skipped even if user asks
- Step 6: explicit instruction to use "המשך ייצוג" when user is filing/continuing
- Prevent AI from choosing "עדיין לא ניתן להחליט" when user has already decided

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.4
2026-04-09 16:49:44 +00:00
chaim 14979dba4b fix: direct access report placeholder mismatches and missing recommendation option
- Fix cLegalAidNumber placeholder key mismatch (template expects cLegalAidNumber, code sent legalAidNumber)
- Add fallback for flat legalAnalysis fields (AI may send them outside the nested object)
- Improve assignedUserName resolution: prefer case assignee, filter out system/API user names
- Add "המשך ייצוג" positive recommendation option to enum, checkboxes, prompt, and DOCX template

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.3
2026-04-09 16:30:19 +00:00
chaim 015586a9df fix: resolve report template from WebDAV when not found locally
DirectAccessReportGenerator now downloads the template from NetworkStorage
(WebDAV) if it's not found in data/document-templates/. This means template
updates via WebDAV are picked up automatically without manual file copy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.2
2026-04-09 13:41:26 +00:00
chaim 3992384d96 fix: correct tool name in prompts from generate_initial_report to generate_direct_access_report
The AI prompt referenced the old tool name (generate_initial_report) but the
metadata and handler were registered as generate_direct_access_report, causing
404 errors when Shira tried to generate direct access reports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.1
2026-04-09 11:06:06 +00:00
chaim cf523cbd86 fix: resolve template path and PHPWord autoload in DirectAccessReportGenerator
- Fix resolveTemplatePath to check data/document-templates/ prefix
- Add PHPWord autoloader fallback when not in composer autoload
- Fix Document-Case linking (use Case.documents relation side)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 19:24:17 +00:00
chaim 21cf570cbc feat!: v2.0.0 — replace LegalAid entity with direct JSON-to-DOCX generation
Breaking change: LegalAid entity removed entirely. Reports are now
generated directly from JSON params to DOCX without any intermediate
entity or database table.

New:
- DirectAccessReportGenerator: takes JSON from Shira, generates DOCX
  via PHPWord, attaches as Document to Case (single PHP file)
- AfterUninstall: full cleanup script (drops tables, columns, templates)
- docs/examples/entity-reference-legalaid.md: full reference for future
  entity creation

Removed:
- LegalAid entity (entityDefs, scopes, clientDefs, layouts, i18n, controller)
- GenerateInitialReport tool (replaced by DirectAccessReportGenerator)
- Custom JS field view for cLegalAidNumber
- update_legal_aid and get_legal_aid tools
- Case link to legalAids

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2.0.0
2026-04-07 19:12:28 +00:00
chaim 4c0586cce8 feat: remove DirectAccessReport, keep only LegalAid entity
Complete removal of the old DirectAccessReport entity and all related
files. LegalAid is now the sole entity for legal aid data management.

- Remove DirectAccessReport: controller, service, hooks, entity defs,
  scopes, clientDefs, layouts, i18n (all 3 locales)
- Remove directAccessReports link from Case
- Rewrite GenerateInitialReport tool to work directly with LegalAid
- Clean up Case i18n (remove old field translations)
- Bump version to 1.5.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.5.0
2026-04-07 17:44:24 +00:00
chaim b3c219aa57 feat: add LegalAid entity — centralized legal aid data management
Replace scattered Case fields with a dedicated LegalAid entity that
holds all legal aid data (aid type, urgency, client contact, proceeding
details, legal analysis, recommendation, etc.). DirectAccessReport now
pulls from LegalAid for DOCX generation with automatic checkbox mapping.

- Add LegalAid entity with controller, layouts, i18n (he/en/fa)
- Remove cAidType, cUrgencyLevel, cAppointmentDate, cFilingDeadline,
  cLegalAidType from Case (migrated to LegalAid)
- Add legalAidType field to LegalAid (DirectAccess/Regular/Duty)
- Update DirectAccessReportService to use LegalAid entity
- Add update_legal_aid and get_legal_aid SmartAssistant tools
- Fix AfterInstall template entityType to LegalAid

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.4.1
2026-04-07 15:27:23 +00:00
chaim 31e6359df4 fix: update direct access report template
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 10:41:55 +00:00
chaim d4008569ca fix: add missing DirectAccessReport controller class
EspoCRM requires an explicit controller class for every entity — without
it the API returns 404. Added a simple Record controller for DirectAccessReport.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.3.2
2026-04-06 22:31:00 +00:00
chaim 836594a863 chore: bump version to 1.3.1 for reinstall
Version 1.2.3 was installed on EspoCRM but DirectAccessReport entity
was returning 404. Bumped to 1.3.1 to allow clean upgrade install.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.3.1
2026-04-06 22:10:51 +00:00
chaim 19db7c1093 feat: AfterInstall creates custom i18n directories for all locales
Ensures custom/Espo/Custom/Resources/i18n/{locale}/ exists for
en_US, fa_IR, he_IL, and the system language. Without this, Label
Manager fails with 500 on fresh installs using fa_IR (Hebrew RTL
wrapper) because the directory doesn't exist and EspoCRM doesn't
create it automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.3.0
2026-04-06 14:27:44 +00:00
chaim ee55f1ecef fix: repair broken Unicode characters in entityDefs and PHP service
- Case.json: "תחום א��ר" → "תחום אחר", "��הול" → "בהול"
- DirectAccessReportService.php: "גישה ישיר��" → "גישה ישירה", broken em-dash

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.2.3
2026-04-06 13:20:29 +00:00
chaim 0cca55da0c fix: translate $LegalAssistance panel tab via "tabs" i18n key
Bottom panel tab labels with $ prefix resolve via translate(key, 'tabs', scope),
not 'labels'. Added "tabs" section to Case.json (fa_IR/he_IL/en_US).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.2.2
2026-04-06 13:07:51 +00:00
chaim ca3d5e7890 fix: add Hebrew translation for LegalAssistance panel tab label
Translates the bottom panel tab "$LegalAssistance" → "סיוע משפטי"
in Case detail view (fa_IR + he_IL + en_US).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.2.1
2026-04-06 12:54:14 +00:00
chaim be4de13618 fix: add fa_IR locale for Hebrew translations
The HebrewLanguage extension uses fa_IR as the locale code (RTL wrapper),
not he_IL. Without fa_IR translations, all labels show in English.
Copied he_IL → fa_IR. Bump to v1.2.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.2.0
2026-04-06 12:51:21 +00:00
chaim 682f13543e fix: improve Shira plugin — add feature awareness + courtName enum
- prompts.json: rewrite in Hebrew with general awareness of "גישה ישירה"
  concept, trigger keywords, and structured 8-step conversation flow
- tools.json: add courtName enum with 6 valid court names (was free string)

These changes match what was deployed to ai-gateway plugins/legal-assistance/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 12:47:01 +00:00
chaim c346642816 fix: add complete Hebrew & English i18n translations for all entities
- Add Global.json (he_IL + en_US) for scope names in navigation/menus
- Add en_US/Case.json for English field/option translations
- Add all enum option translations to DirectAccessReport (both languages)
- Bump version to 1.1.0
- Include updated extension ZIP package

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.1.0
2026-04-06 12:14:29 +00:00
chaim 807fbcdde2 chore: add v1.0.0 extension ZIP package
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 07:22:03 +00:00
chaim e3dfd5f960 feat: LegalAssistance extension v1.0.0 — Direct Access Report
- DirectAccessReport entity (48 fields, status lifecycle, Case relationship)
- Case fields: cLegalAidType, cAppointmentDate, cAidType, cUrgencyLevel, cFilingDeadline
- Auto-tasks hook: creates 3 tasks when case set to Direct Access
- DOCX template with 72 placeholders (converted from original form)
- Shira plugin: generate_initial_report tool with structured conversation flow
- AfterInstall/AfterUninstall scripts for plugin deployment
- Hebrew + English translations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v1.0.0
2026-04-06 05:03:21 +00:00