Compare commits

...

6 Commits

Author SHA1 Message Date
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>
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>
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>
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>
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>
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>
2026-04-09 16:49:44 +00:00
3 changed files with 17 additions and 5 deletions
@@ -150,6 +150,8 @@ class DirectAccessReportGenerator
$legalAnalysis = $params['legalAnalysis'] ?? [];
if (is_string($legalAnalysis)) {
$legalAnalysis = json_decode($legalAnalysis, true) ?? [];
} elseif (is_object($legalAnalysis)) {
$legalAnalysis = (array) $legalAnalysis;
}
// Fallback: if AI sent legalAnalysis fields flat (not nested), pick them up
@@ -214,8 +216,8 @@ class DirectAccessReportGenerator
private function addCheckboxData(array &$data, array $params): void
{
$CHK = '☑';
$UNCHK = '☐';
$CHK = "\u{00A0}";
$UNCHK = "\u{00A0}";
$urgency = $params['urgencyLevel'] ?? '';
$data['chk_urgency_regular'] = ($urgency === 'רגיל') ? $CHK : $UNCHK;
@@ -372,6 +374,16 @@ class DirectAccessReportGenerator
}
$processor->saveAs($outputPath);
// Fix space preservation: PHPWord strips whitespace from <w:t> elements
// that lack xml:space="preserve", causing words to stick together in RTL docs.
$zip = new \ZipArchive();
if ($zip->open($outputPath) === true) {
$xml = $zip->getFromName('word/document.xml');
$xml = preg_replace('/<w:t(?=[ >\/])(?![^>]*xml:space)/', '<w:t xml:space="preserve"', $xml);
$zip->addFromString('word/document.xml', $xml);
$zip->close();
}
}
private function normalizeDate(?string $value): ?string
@@ -390,7 +402,7 @@ class DirectAccessReportGenerator
{
if (!$date) return '';
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $date, $m)) {
return "{$m[3]}/{$m[2]}/{$m[1]}";
return "{$m[3]}.{$m[2]}.{$m[1]}";
}
return $date;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "LegalAssistance",
"version": "2.0.3",
"version": "2.0.9",
"acceptableVersions": [">=8.0.0"],
"php": [">=8.1"],
"releaseDate": "2026-04-09",
File diff suppressed because one or more lines are too long