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>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
*.bak
|
||||
*.tmp
|
||||
/legal-docx-v3-fixed/
|
||||
@@ -0,0 +1,153 @@
|
||||
# מיפוי שדות — טופס דיווח ראשוני (ביטוח לאומי / סיוע משפטי)
|
||||
## Entity: Case + Contact
|
||||
|
||||
---
|
||||
|
||||
## חלק א' — כותרת ופרטי תיק
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע (EspoCRM) | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|----------------------|---------|-------------|-------|
|
||||
| 1 | מספר תיק סיוע | legalAidNumber | varchar | `${legalAidNumber}` | ✅ קיים |
|
||||
| 2 | שם פרטי לקוח | — (Contact) | — | `${contact.firstName}` | ✅ קיים |
|
||||
| 3 | שם משפחה לקוח | — (Contact) | — | `${contact.lastName}` | ✅ קיים |
|
||||
| 4 | דחיפות הליך | urgencyLevel | enum | `${urgencyLevel}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: רגיל / דחוף / בהול | | |
|
||||
| 5 | מועד אחרון להגשה | filingDeadline | date | `${filingDeadline}` | 🆕 להוסיף |
|
||||
| 6 | מועד קבלת המינוי | appointmentDate | date | `${appointmentDate}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ב' — מהות הסיוע
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 7 | מהות הסיוע | aidType | enum | `${aidType}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: הגשת ערעור / יעוץ והדרכה / סיוע נוסף ביטוח לאומי / סיוע נוסף תחום אחר / אי מתן סיוע | | |
|
||||
| 8 | דחיפות הליך נוסף | additionalUrgency | enum | `${additionalUrgency}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: רגיל / דחוף / בהול | | |
|
||||
| 9 | מועדים להליך נוסף | additionalDeadline | varchar | `${additionalDeadline}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ג' — קשר עם הלקוח
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 10 | תאריך יצירת קשר ראשוני | firstContactDate | date | `${firstContactDate}` | 🆕 להוסיף |
|
||||
| 11 | סיבת עיכוב (אם לא תוך 48 שעות) | contactDelayReason | text | `${contactDelayReason}` | 🆕 להוסיף |
|
||||
| 12 | תאריך פגישה עם הלקוח | meetingDate | date | `${meetingDate}` | 🆕 להוסיף |
|
||||
| 13 | סיבת עיכוב פגישה | meetingDelayReason | text | `${meetingDelayReason}` | 🆕 להוסיף |
|
||||
| 14 | נוכחים בפגישה | meetingAttendees | text | `${meetingAttendees}` | 🆕 להוסיף |
|
||||
| 15 | מצב קשר עם הלקוח | contactStatus | enum | `${contactStatus}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: תקין / לא תקין | | |
|
||||
| 16 | פירוט מצב קשר (אם לא תקין) | contactStatusDetail | text | `${contactStatusDetail}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ד' — החלטה על מתן סיוע (פרטי ההליך)
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 17 | מספר הליך | proceedingNumber | varchar | `${proceedingNumber}` | 🆕 להוסיף |
|
||||
| 18 | בית הדין | courtName | enum | `${courtName}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: בית הדין האזורי לעבודה ירושלים / תל אביב / חיפה / באר שבע / נצרת / בית הדין הארצי לעבודה | | |
|
||||
| 19 | עניין ההליך | proceedingSubject | enum | `${proceedingSubject}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: נכות כללית / נכות מעבודה / נכות איבה / ניידות / אי כושר / שירותים מיוחדים / סיעוד / גמלת הבטחת הכנסה / דמי אבטלה / אחר | | |
|
||||
| 20 | תמצית התביעה/הערעור | claimSummary | text | `${claimSummary}` | 🆕 להוסיף |
|
||||
| 21 | טענות ההגנה | defenseClaims | text | `${defenseClaims}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ה' — בחינת סיכוי משפטי (נכות כללית/מעבודה/איבה/ניידות)
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 22 | הוועדה התייחסה לכל המסמכים? | q1DocsReviewed | bool | `${q1DocsReviewed}` | 🆕 להוסיף |
|
||||
| 23 | פירוט מסמכים | q1DocsDetail | text | `${q1DocsDetail}` | 🆕 להוסיף |
|
||||
| 24 | ההחלטה מנומקת? | q2Reasoned | bool | `${q2Reasoned}` | 🆕 להוסיף |
|
||||
| 25 | פירוט הנמקה חסרה | q2ReasonDetail | text | `${q2ReasonDetail}` | 🆕 להוסיף |
|
||||
| 26 | הרכב תואם ליקויים? | q3PanelMatch | bool | `${q3PanelMatch}` | 🆕 להוסיף |
|
||||
| 27 | הרכב הוועדה / הרכב חסר | q4PanelComposition | text | `${q4PanelComposition}` | 🆕 להוסיף |
|
||||
| 28 | התייחסו לכל התלונות? | q5ComplaintsAddressed | bool | `${q5ComplaintsAddressed}` | 🆕 להוסיף |
|
||||
| 29 | פירוט תלונות חסרות | q6ComplaintsDetail | text | `${q6ComplaintsDetail}` | 🆕 להוסיף |
|
||||
| 30 | בדיקה קלינית נערכה? | q7ClinicalExam | bool | `${q7ClinicalExam}` | 🆕 להוסיף |
|
||||
| 31 | פער בדיקה קלינית vs מסמכים | q8ClinicalGap | text | `${q8ClinicalGap}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ו' — בחינת סיכוי משפטי (אי כושר)
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 32 | בחינת הלכת מוהרה (גיל, רקע, השכלה)? | q9MoharaApplied | bool | `${q9MoharaApplied}` | 🆕 להוסיף |
|
||||
| 33 | נתונים חסרים (מוהרה) | q9MoharaDetail | text | `${q9MoharaDetail}` | 🆕 להוסיף |
|
||||
| 34 | פער פקיד שיקום vs ועדה? | q10RehabGap | bool | `${q10RehabGap}` | 🆕 להוסיף |
|
||||
| 35 | פירוט הפער | q10RehabDetail | text | `${q10RehabDetail}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ז' — בחינת סיכוי משפטי (שירותים מיוחדים/סיעוד)
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 36 | פער ניקוד vs מצב ומסמכים? | q11ScoreGap | bool | `${q11ScoreGap}` | 🆕 להוסיף |
|
||||
| 37 | פירוט פער הניקוד | q11ScoreDetail | text | `${q11ScoreDetail}` | 🆕 להוסיף |
|
||||
| 38 | התייחסות להיבטים ייחודיים? | q12UniqueAspects | bool | `${q12UniqueAspects}` | 🆕 להוסיף |
|
||||
| 39 | פירוט היבטים ייחודיים | q12UniqueDetail | text | `${q12UniqueDetail}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ח' — המלצה/הודעה
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 40 | סוג ההמלצה | recommendationType | enum | `${recommendationType}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: ייעוץ והדרכה חלף ייצוג / ויתור הלקוח / החלפת ייצוג / לא נוצר קשר / לא התקיימה פגישה / עדיין לא ניתן להחליט / נדרשים מסמכים נוספים / המלצה לסירוב | | |
|
||||
| 41 | פירוט ההמלצה | recommendationDetail | text | `${recommendationDetail}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק ט' — מיצוי זכויות
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 42 | צורך בסיוע נוסף | additionalAidNeeded | enum | `${additionalAidNeeded}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: לא נחוץ / נחוץ בתחום ביטוח לאומי / נחוץ בתחום אחר | | |
|
||||
| 43 | פירוט סיוע נוסף (ביטוח לאומי) | additionalAidNIDetail | text | `${additionalAidNIDetail}` | 🆕 להוסיף |
|
||||
| 44 | פירוט סיוע נוסף (תחום אחר) | additionalAidOtherDetail | text | `${additionalAidOtherDetail}` | 🆕 להוסיף |
|
||||
| 45 | דחיפות הסיוע הנוסף | additionalAidUrgency | enum | `${additionalAidUrgency}` | 🆕 להוסיף |
|
||||
| | | | אפשרויות: רגיל / דחוף / בהול | | |
|
||||
| 46 | מועדים (סיוע נוסף) | additionalAidDeadlines | varchar | `${additionalAidDeadlines}` | 🆕 להוסיף |
|
||||
| 47 | בתחום התמחות + מעוניין לייצג? | willingToRepresent | bool | `${willingToRepresent}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## חלק י' — הערות
|
||||
|
||||
| # | שדה בטופס | שם שדה מוצע | סוג שדה | Placeholder | סטטוס |
|
||||
|---|-----------|------------|---------|-------------|-------|
|
||||
| 48 | הערות כלליות | notes | text | `${notes}` | 🆕 להוסיף |
|
||||
|
||||
---
|
||||
|
||||
## שדות מיוחדים (אוטומטיים)
|
||||
|
||||
| Placeholder | תיאור | מקור |
|
||||
|-------------|--------|------|
|
||||
| `${today}` | תאריך היום | אוטומטי |
|
||||
| `${currentUser}` | שם המשתמש (עורך הדין) | אוטומטי |
|
||||
|
||||
---
|
||||
|
||||
## סיכום
|
||||
|
||||
- **שדות קיימים:** 3 (מספר תיק סיוע, שם פרטי, שם משפחה)
|
||||
- **שדות חדשים להוספה:** 45
|
||||
- **סה"כ שדות בטופס:** 48
|
||||
|
||||
### סוגי שדות להוספה:
|
||||
- **enum:** 9 שדות (דחיפות, מהות, בית דין, עניין, מצב קשר, המלצה, סיוע נוסף...)
|
||||
- **bool:** 11 שדות (שאלות כן/לא של בחינת סיכוי משפטי)
|
||||
- **date:** 4 שדות (מועדים שונים)
|
||||
- **text:** 17 שדות (פירוטים ותיאורים)
|
||||
- **varchar:** 4 שדות (מספרים ומועדים קצרים)
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Espo\Modules\LegalAssistance\Hooks\Case;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Log;
|
||||
|
||||
class CreateDirectAccessTasks
|
||||
{
|
||||
public function __construct(
|
||||
private EntityManager $entityManager,
|
||||
private Log $log
|
||||
) {}
|
||||
|
||||
public function afterSave(Entity $entity, array $options): void
|
||||
{
|
||||
if (!empty($options['skipHooks'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$entity->isAttributeChanged('cLegalAidType')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$newValue = $entity->get('cLegalAidType');
|
||||
$oldValue = $entity->getFetched('cLegalAidType');
|
||||
|
||||
if ($newValue !== 'DirectAccess' || $oldValue === 'DirectAccess') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->log->info("LegalAssistance: Creating direct access tasks for case {$entity->getId()}");
|
||||
|
||||
$assignedUserId = $entity->get('assignedUserId');
|
||||
$now = new \DateTime('now', new \DateTimeZone('Asia/Jerusalem'));
|
||||
|
||||
$tasks = [
|
||||
[
|
||||
'name' => 'שיחת טלפון ראשונה עם הלקוח',
|
||||
'dateEnd' => (clone $now)->modify('+2 days')->format('Y-m-d'),
|
||||
'priority' => 'High',
|
||||
'description' => 'יש ליצור קשר ראשוני עם הלקוח תוך 48 שעות ממועד קבלת המינוי.',
|
||||
],
|
||||
[
|
||||
'name' => 'פגישה עם הלקוח',
|
||||
'dateEnd' => (clone $now)->modify('+7 days')->format('Y-m-d'),
|
||||
'priority' => 'Normal',
|
||||
'description' => 'לקבוע ולקיים פגישה ראשונה עם הלקוח. לתעד נוכחים ותוכן הפגישה.',
|
||||
],
|
||||
[
|
||||
'name' => 'שליחת דוח גישה ישירה',
|
||||
'dateEnd' => (clone $now)->modify('+14 days')->format('Y-m-d'),
|
||||
'priority' => 'High',
|
||||
'description' => 'למלא ולשלוח דוח דיווח ראשוני לסיוע המשפטי. ניתן לבקש משירה: "תיצרי דוח גישה ישירה".',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($tasks as $taskData) {
|
||||
$task = $this->entityManager->getNewEntity('Task');
|
||||
$task->set([
|
||||
'name' => $taskData['name'],
|
||||
'status' => 'Not Started',
|
||||
'priority' => $taskData['priority'],
|
||||
'dateEnd' => $taskData['dateEnd'],
|
||||
'description' => $taskData['description'],
|
||||
'parentType' => 'Case',
|
||||
'parentId' => $entity->getId(),
|
||||
'assignedUserId' => $assignedUserId,
|
||||
]);
|
||||
$this->entityManager->saveEntity($task, ['skipHooks' => false]);
|
||||
}
|
||||
|
||||
$this->log->info("LegalAssistance: Created 3 direct access tasks for case {$entity->getId()}");
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"scopeName": "Direct Access Report",
|
||||
"scopeNamesPlural": "Direct Access Reports",
|
||||
"labels": {
|
||||
"Create DirectAccessReport": "Create Direct Access Report"
|
||||
},
|
||||
"fields": {
|
||||
"name": "Report Name",
|
||||
"number": "Number",
|
||||
"status": "Status",
|
||||
"case": "Case",
|
||||
"aidType": "Aid Type",
|
||||
"urgencyLevel": "Urgency Level",
|
||||
"appointmentDate": "Appointment Date",
|
||||
"filingDeadline": "Filing Deadline",
|
||||
"additionalUrgency": "Additional Urgency",
|
||||
"additionalDeadline": "Additional Deadline",
|
||||
"firstContactDate": "First Contact Date",
|
||||
"contactDelayReason": "Contact Delay Reason",
|
||||
"meetingDate": "Meeting Date",
|
||||
"meetingDelayReason": "Meeting Delay Reason",
|
||||
"meetingAttendees": "Meeting Attendees",
|
||||
"contactStatus": "Contact Status",
|
||||
"contactStatusDetail": "Contact Status Detail",
|
||||
"proceedingNumber": "Proceeding Number",
|
||||
"courtName": "Court Name",
|
||||
"proceedingSubject": "Proceeding Subject",
|
||||
"claimSummary": "Claim Summary",
|
||||
"defenseClaims": "Defense Claims",
|
||||
"q1DocsReviewed": "Committee Reviewed All Documents?",
|
||||
"q1DocsDetail": "Documents Detail",
|
||||
"q2Reasoned": "Decision Reasoned?",
|
||||
"q2ReasonDetail": "Missing Reasoning Detail",
|
||||
"q3PanelMatch": "Panel Matches Impairments?",
|
||||
"q4PanelComposition": "Panel Composition",
|
||||
"q5ComplaintsAddressed": "All Complaints Addressed?",
|
||||
"q6ComplaintsDetail": "Missing Complaints Detail",
|
||||
"q7ClinicalExam": "Clinical Exam Performed?",
|
||||
"q8ClinicalGap": "Clinical vs Documents Gap",
|
||||
"q9MoharaApplied": "Mohara Doctrine Applied?",
|
||||
"q9MoharaDetail": "Missing Mohara Data",
|
||||
"q10RehabGap": "Rehab Officer vs Committee Gap?",
|
||||
"q10RehabDetail": "Gap Detail",
|
||||
"q11ScoreGap": "Score vs Condition Gap?",
|
||||
"q11ScoreDetail": "Score Gap Detail",
|
||||
"q12UniqueAspects": "Unique Aspects Addressed?",
|
||||
"q12UniqueDetail": "Unique Aspects Detail",
|
||||
"recommendationType": "Recommendation Type",
|
||||
"recommendationDetail": "Recommendation Detail",
|
||||
"additionalAidNeeded": "Additional Aid Needed",
|
||||
"additionalAidNIDetail": "Additional NI Aid Detail",
|
||||
"additionalAidOtherDetail": "Additional Other Aid Detail",
|
||||
"additionalAidUrgency": "Additional Aid Urgency",
|
||||
"additionalAidDeadlines": "Additional Aid Deadlines",
|
||||
"willingToRepresent": "Willing to Represent?",
|
||||
"notes": "General Notes",
|
||||
"assignedUser": "Assigned User",
|
||||
"teams": "Teams",
|
||||
"createdAt": "Created At",
|
||||
"modifiedAt": "Modified At",
|
||||
"createdBy": "Created By",
|
||||
"modifiedBy": "Modified By"
|
||||
},
|
||||
"options": {
|
||||
"status": {
|
||||
"Draft": "Draft",
|
||||
"Submitted": "Submitted",
|
||||
"Approved": "Approved",
|
||||
"Rejected": "Rejected"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"case": "Case"
|
||||
},
|
||||
"presetFilters": {
|
||||
"draft": "Draft",
|
||||
"submitted": "Submitted",
|
||||
"approved": "Approved"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"fields": {
|
||||
"cLegalAidType": "סוג מינוי סיוע משפטי",
|
||||
"cAppointmentDate": "מועד קבלת המינוי",
|
||||
"cAidType": "מהות הסיוע",
|
||||
"cUrgencyLevel": "דחיפות",
|
||||
"cFilingDeadline": "מועד אחרון להגשה"
|
||||
},
|
||||
"options": {
|
||||
"cLegalAidType": {
|
||||
"": "",
|
||||
"DirectAccess": "גישה ישירה",
|
||||
"Regular": "מינוי רגיל",
|
||||
"Duty": "תורנות"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"directAccessReports": "דוחות גישה ישירה"
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"scopeName": "דוח גישה ישירה",
|
||||
"scopeNamesPlural": "דוחות גישה ישירה",
|
||||
"labels": {
|
||||
"Create DirectAccessReport": "צור דוח גישה ישירה"
|
||||
},
|
||||
"fields": {
|
||||
"name": "שם הדוח",
|
||||
"number": "מספר",
|
||||
"status": "סטטוס",
|
||||
"case": "תיק",
|
||||
"aidType": "מהות הסיוע",
|
||||
"urgencyLevel": "דחיפות הליך",
|
||||
"appointmentDate": "מועד קבלת המינוי",
|
||||
"filingDeadline": "מועד אחרון להגשה",
|
||||
"additionalUrgency": "דחיפות הליך נוסף",
|
||||
"additionalDeadline": "מועדים להליך נוסף",
|
||||
"firstContactDate": "תאריך יצירת קשר ראשוני",
|
||||
"contactDelayReason": "סיבת עיכוב (אם לא תוך 48 שעות)",
|
||||
"meetingDate": "תאריך פגישה עם הלקוח",
|
||||
"meetingDelayReason": "סיבת עיכוב פגישה",
|
||||
"meetingAttendees": "נוכחים בפגישה",
|
||||
"contactStatus": "מצב קשר עם הלקוח",
|
||||
"contactStatusDetail": "פירוט מצב קשר",
|
||||
"proceedingNumber": "מספר הליך",
|
||||
"courtName": "בית הדין",
|
||||
"proceedingSubject": "עניין ההליך",
|
||||
"claimSummary": "תמצית התביעה/הערעור",
|
||||
"defenseClaims": "טענות ההגנה",
|
||||
"q1DocsReviewed": "הוועדה התייחסה לכל המסמכים?",
|
||||
"q1DocsDetail": "פירוט מסמכים",
|
||||
"q2Reasoned": "ההחלטה מנומקת?",
|
||||
"q2ReasonDetail": "פירוט הנמקה חסרה",
|
||||
"q3PanelMatch": "הרכב תואם ליקויים?",
|
||||
"q4PanelComposition": "הרכב הוועדה / הרכב חסר",
|
||||
"q5ComplaintsAddressed": "התייחסו לכל התלונות?",
|
||||
"q6ComplaintsDetail": "פירוט תלונות חסרות",
|
||||
"q7ClinicalExam": "בדיקה קלינית נערכה?",
|
||||
"q8ClinicalGap": "פער בדיקה קלינית vs מסמכים",
|
||||
"q9MoharaApplied": "בחינת הלכת מוהרה (גיל, רקע, השכלה)?",
|
||||
"q9MoharaDetail": "נתונים חסרים (מוהרה)",
|
||||
"q10RehabGap": "פער פקיד שיקום vs ועדה?",
|
||||
"q10RehabDetail": "פירוט הפער",
|
||||
"q11ScoreGap": "פער ניקוד vs מצב ומסמכים?",
|
||||
"q11ScoreDetail": "פירוט פער הניקוד",
|
||||
"q12UniqueAspects": "התייחסות להיבטים ייחודיים?",
|
||||
"q12UniqueDetail": "פירוט היבטים ייחודיים",
|
||||
"recommendationType": "סוג ההמלצה",
|
||||
"recommendationDetail": "פירוט ההמלצה",
|
||||
"additionalAidNeeded": "צורך בסיוע נוסף",
|
||||
"additionalAidNIDetail": "פירוט סיוע נוסף (ביטוח לאומי)",
|
||||
"additionalAidOtherDetail": "פירוט סיוע נוסף (תחום אחר)",
|
||||
"additionalAidUrgency": "דחיפות הסיוע הנוסף",
|
||||
"additionalAidDeadlines": "מועדים (סיוע נוסף)",
|
||||
"willingToRepresent": "בתחום התמחות + מעוניין לייצג?",
|
||||
"notes": "הערות כלליות",
|
||||
"assignedUser": "אחראי",
|
||||
"teams": "צוותים",
|
||||
"createdAt": "נוצר ב",
|
||||
"modifiedAt": "עודכן ב",
|
||||
"createdBy": "נוצר על ידי",
|
||||
"modifiedBy": "עודכן על ידי"
|
||||
},
|
||||
"options": {
|
||||
"status": {
|
||||
"Draft": "טיוטה",
|
||||
"Submitted": "נשלח",
|
||||
"Approved": "אושר",
|
||||
"Rejected": "נדחה"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"case": "תיק"
|
||||
},
|
||||
"presetFilters": {
|
||||
"draft": "טיוטות",
|
||||
"submitted": "נשלחו",
|
||||
"approved": "אושרו"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"tools": {
|
||||
"generate_initial_report": {
|
||||
"handler": "Espo\\Modules\\LegalAssistance\\SmartAssistant\\Tools\\GenerateInitialReport",
|
||||
"requiresCase": true
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"controller": "controllers/record",
|
||||
"boolFilterList": ["onlyMy"],
|
||||
"iconClass": "fas fa-file-alt",
|
||||
"color": "#6C3483",
|
||||
"kanbanViewMode": true,
|
||||
"statusField": "status",
|
||||
"filterList": [
|
||||
{
|
||||
"name": "draft",
|
||||
"style": "default"
|
||||
},
|
||||
{
|
||||
"name": "submitted",
|
||||
"style": "warning"
|
||||
},
|
||||
{
|
||||
"name": "approved",
|
||||
"style": "success"
|
||||
}
|
||||
],
|
||||
"menu": {
|
||||
"list": {
|
||||
"buttons": []
|
||||
},
|
||||
"detail": {
|
||||
"buttons": []
|
||||
}
|
||||
},
|
||||
"relationshipPanels": {
|
||||
"case": {
|
||||
"select": true,
|
||||
"create": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"fields": {
|
||||
"cLegalAidType": {
|
||||
"type": "enum",
|
||||
"options": ["", "DirectAccess", "Regular", "Duty"],
|
||||
"audited": true,
|
||||
"displayAsLabel": true,
|
||||
"style": {
|
||||
"DirectAccess": "primary",
|
||||
"Regular": "default",
|
||||
"Duty": "info"
|
||||
}
|
||||
},
|
||||
"cAppointmentDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"cAidType": {
|
||||
"type": "enum",
|
||||
"options": ["", "הגשת ערעור", "יעוץ והדרכה", "סיוע נוסף ביטוח לאומי", "סיוע נוסף תחום א��ר", "אי מתן סיוע"]
|
||||
},
|
||||
"cUrgencyLevel": {
|
||||
"type": "enum",
|
||||
"options": ["", "רגיל", "דחוף", "��הול"],
|
||||
"displayAsLabel": true,
|
||||
"style": {
|
||||
"רגיל": "default",
|
||||
"דחוף": "warning",
|
||||
"בהול": "danger"
|
||||
}
|
||||
},
|
||||
"cFilingDeadline": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"directAccessReports": {
|
||||
"type": "hasMany",
|
||||
"entity": "DirectAccessReport",
|
||||
"foreign": "case",
|
||||
"layoutRelationshipsDisabled": false
|
||||
}
|
||||
}
|
||||
}
|
||||
+269
@@ -0,0 +1,269 @@
|
||||
{
|
||||
"fields": {
|
||||
"name": {
|
||||
"type": "varchar",
|
||||
"required": true,
|
||||
"pattern": "$noBadCharacters"
|
||||
},
|
||||
"number": {
|
||||
"type": "autoincrement",
|
||||
"index": true
|
||||
},
|
||||
"status": {
|
||||
"type": "enum",
|
||||
"options": ["Draft", "Submitted", "Approved", "Rejected"],
|
||||
"default": "Draft",
|
||||
"audited": true,
|
||||
"displayAsLabel": true,
|
||||
"style": {
|
||||
"Draft": "default",
|
||||
"Submitted": "warning",
|
||||
"Approved": "success",
|
||||
"Rejected": "danger"
|
||||
}
|
||||
},
|
||||
"case": {
|
||||
"type": "link",
|
||||
"required": true
|
||||
},
|
||||
|
||||
"aidType": {
|
||||
"type": "enum",
|
||||
"options": ["", "הגשת ערעור", "יעוץ והדרכה", "סיוע נוסף ביטוח לאומי", "סיוע נוסף תחום אחר", "אי מתן סיוע"],
|
||||
"audited": true
|
||||
},
|
||||
"urgencyLevel": {
|
||||
"type": "enum",
|
||||
"options": ["", "רגיל", "דחוף", "בהול"],
|
||||
"default": "רגיל",
|
||||
"displayAsLabel": true,
|
||||
"style": {
|
||||
"רגיל": "default",
|
||||
"דחוף": "warning",
|
||||
"בהול": "danger"
|
||||
}
|
||||
},
|
||||
"appointmentDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"filingDeadline": {
|
||||
"type": "date"
|
||||
},
|
||||
"additionalUrgency": {
|
||||
"type": "enum",
|
||||
"options": ["", "רגיל", "דחוף", "בהול"]
|
||||
},
|
||||
"additionalDeadline": {
|
||||
"type": "varchar",
|
||||
"maxLength": 150
|
||||
},
|
||||
|
||||
"firstContactDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"contactDelayReason": {
|
||||
"type": "text"
|
||||
},
|
||||
"meetingDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"meetingDelayReason": {
|
||||
"type": "text"
|
||||
},
|
||||
"meetingAttendees": {
|
||||
"type": "text"
|
||||
},
|
||||
"contactStatus": {
|
||||
"type": "enum",
|
||||
"options": ["", "תקין", "לא תקין"]
|
||||
},
|
||||
"contactStatusDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"proceedingNumber": {
|
||||
"type": "varchar",
|
||||
"maxLength": 50
|
||||
},
|
||||
"courtName": {
|
||||
"type": "enum",
|
||||
"options": ["", "בית הדין האזורי לעבודה ירושלים", "בית הדין האזורי לעבודה תל אביב", "בית הדין האזורי לעבודה חיפה", "בית הדין האזורי לעבודה באר שבע", "בית הדין האזורי לעבודה נצרת", "בית הדין הארצי לעבודה"]
|
||||
},
|
||||
"proceedingSubject": {
|
||||
"type": "enum",
|
||||
"options": ["", "נכות כללית", "נכות מעבודה", "נכות איבה", "ניידות", "אי כושר", "שירותים מיוחדים", "סיעוד", "גמלת הבטחת הכנסה", "דמי אבטלה", "אחר"]
|
||||
},
|
||||
"claimSummary": {
|
||||
"type": "text"
|
||||
},
|
||||
"defenseClaims": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"q1DocsReviewed": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q1DocsDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"q2Reasoned": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q2ReasonDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"q3PanelMatch": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q4PanelComposition": {
|
||||
"type": "text"
|
||||
},
|
||||
"q5ComplaintsAddressed": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q6ComplaintsDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"q7ClinicalExam": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q8ClinicalGap": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"q9MoharaApplied": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q9MoharaDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"q10RehabGap": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q10RehabDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"q11ScoreGap": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q11ScoreDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"q12UniqueAspects": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
"q12UniqueDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"recommendationType": {
|
||||
"type": "enum",
|
||||
"options": ["", "ייעוץ והדרכה חלף ייצוג", "ויתור הלקוח", "החלפת ייצוג", "לא נוצר קשר", "לא התקיימה פגישה", "עדיין לא ניתן להחליט", "נדרשים מסמכים נוספים", "המלצה לסירוב"]
|
||||
},
|
||||
"recommendationDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"additionalAidNeeded": {
|
||||
"type": "enum",
|
||||
"options": ["", "לא נחוץ", "נחוץ בתחום ביטוח לאומי", "נחוץ בתחום אחר"]
|
||||
},
|
||||
"additionalAidNIDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"additionalAidOtherDetail": {
|
||||
"type": "text"
|
||||
},
|
||||
"additionalAidUrgency": {
|
||||
"type": "enum",
|
||||
"options": ["", "רגיל", "דחוף", "בהול"]
|
||||
},
|
||||
"additionalAidDeadlines": {
|
||||
"type": "varchar",
|
||||
"maxLength": 150
|
||||
},
|
||||
"willingToRepresent": {
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
|
||||
"notes": {
|
||||
"type": "text"
|
||||
},
|
||||
|
||||
"createdAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"modifiedAt": {
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "link",
|
||||
"readOnly": true,
|
||||
"view": "views/fields/user"
|
||||
},
|
||||
"modifiedBy": {
|
||||
"type": "link",
|
||||
"readOnly": true,
|
||||
"view": "views/fields/user"
|
||||
},
|
||||
"assignedUser": {
|
||||
"type": "link",
|
||||
"view": "views/fields/assigned-user"
|
||||
},
|
||||
"teams": {
|
||||
"type": "linkMultiple",
|
||||
"view": "views/fields/teams"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"case": {
|
||||
"type": "belongsTo",
|
||||
"entity": "Case",
|
||||
"foreign": "directAccessReports"
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"modifiedBy": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"assignedUser": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"teams": {
|
||||
"type": "hasMany",
|
||||
"entity": "Team",
|
||||
"relationName": "entityTeam",
|
||||
"layoutRelationshipsDisabled": true
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
"orderBy": "createdAt",
|
||||
"order": "desc",
|
||||
"textFilterFields": ["name", "number"]
|
||||
},
|
||||
"indexes": {
|
||||
"status": {
|
||||
"columns": ["status", "deleted"]
|
||||
},
|
||||
"createdAt": {
|
||||
"columns": ["createdAt"]
|
||||
}
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
[
|
||||
{
|
||||
"label": "כותרת ופרטי תיק",
|
||||
"rows": [
|
||||
[{"name": "name"}, {"name": "number"}],
|
||||
[{"name": "case"}, {"name": "status"}],
|
||||
[{"name": "assignedUser"}, {"name": "teams"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "מהות הסיוע",
|
||||
"rows": [
|
||||
[{"name": "aidType"}, {"name": "urgencyLevel"}],
|
||||
[{"name": "appointmentDate"}, {"name": "filingDeadline"}],
|
||||
[{"name": "additionalUrgency"}, {"name": "additionalDeadline"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "קשר עם הלקוח",
|
||||
"rows": [
|
||||
[{"name": "firstContactDate"}, {"name": "contactDelayReason"}],
|
||||
[{"name": "meetingDate"}, {"name": "meetingDelayReason"}],
|
||||
[{"name": "meetingAttendees"}, {"name": "contactStatus"}],
|
||||
[{"name": "contactStatusDetail"}, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "פרטי ההליך",
|
||||
"rows": [
|
||||
[{"name": "proceedingNumber"}, {"name": "courtName"}],
|
||||
[{"name": "proceedingSubject"}, false],
|
||||
[{"name": "claimSummary", "fullWidth": true}],
|
||||
[{"name": "defenseClaims", "fullWidth": true}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "בחינת סיכוי משפטי — נכות",
|
||||
"rows": [
|
||||
[{"name": "q1DocsReviewed"}, {"name": "q1DocsDetail"}],
|
||||
[{"name": "q2Reasoned"}, {"name": "q2ReasonDetail"}],
|
||||
[{"name": "q3PanelMatch"}, {"name": "q4PanelComposition"}],
|
||||
[{"name": "q5ComplaintsAddressed"}, {"name": "q6ComplaintsDetail"}],
|
||||
[{"name": "q7ClinicalExam"}, {"name": "q8ClinicalGap"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "בחינת סיכוי משפטי — אי כושר",
|
||||
"rows": [
|
||||
[{"name": "q9MoharaApplied"}, {"name": "q9MoharaDetail"}],
|
||||
[{"name": "q10RehabGap"}, {"name": "q10RehabDetail"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "בחינת סיכוי משפטי — שירותים מיוחדים/סיעוד",
|
||||
"rows": [
|
||||
[{"name": "q11ScoreGap"}, {"name": "q11ScoreDetail"}],
|
||||
[{"name": "q12UniqueAspects"}, {"name": "q12UniqueDetail"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "המלצה",
|
||||
"rows": [
|
||||
[{"name": "recommendationType"}, false],
|
||||
[{"name": "recommendationDetail", "fullWidth": true}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "מיצוי זכויות",
|
||||
"rows": [
|
||||
[{"name": "additionalAidNeeded"}, {"name": "additionalAidUrgency"}],
|
||||
[{"name": "additionalAidNIDetail"}, {"name": "additionalAidOtherDetail"}],
|
||||
[{"name": "additionalAidDeadlines"}, {"name": "willingToRepresent"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "הערות",
|
||||
"rows": [
|
||||
[{"name": "notes", "fullWidth": true}]
|
||||
]
|
||||
}
|
||||
]
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"rows": [
|
||||
[{"name": "name"}],
|
||||
[{"name": "case"}],
|
||||
[{"name": "status"}],
|
||||
[{"name": "aidType"}],
|
||||
[{"name": "recommendationType"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{"name": "number", "width": 8},
|
||||
{"name": "name", "link": true},
|
||||
{"name": "case", "width": 20},
|
||||
{"name": "status", "width": 12},
|
||||
{"name": "aidType", "width": 15},
|
||||
{"name": "recommendationType", "width": 15},
|
||||
{"name": "createdAt", "width": 15},
|
||||
{"name": "assignedUser", "width": 15}
|
||||
]
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"entity": true,
|
||||
"object": true,
|
||||
"stream": true,
|
||||
"tab": false,
|
||||
"acl": true,
|
||||
"aclPortal": false,
|
||||
"disabled": false,
|
||||
"module": "LegalAssistance",
|
||||
"isCustom": false,
|
||||
"notifications": true,
|
||||
"calendar": false,
|
||||
"activity": false,
|
||||
"kanbanStatusIgnoreList": ["Approved", "Rejected"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"order": 25,
|
||||
"version": "1.0.0",
|
||||
"requires": {
|
||||
"espocrm": ">=8.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace Espo\Modules\LegalAssistance\Services;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Log;
|
||||
use Espo\Core\Utils\DateTime as DateTimeUtil;
|
||||
use Espo\Entities\User;
|
||||
|
||||
class DirectAccessReportService
|
||||
{
|
||||
public function __construct(
|
||||
private EntityManager $entityManager,
|
||||
private InjectableFactory $injectableFactory,
|
||||
private Log $log,
|
||||
private User $user,
|
||||
private DateTimeUtil $dateTimeUtil
|
||||
) {}
|
||||
|
||||
public function generateReport(string $caseId, string $userId, array $params): array
|
||||
{
|
||||
$case = $this->entityManager->getEntityById('Case', $caseId);
|
||||
if (!$case) {
|
||||
throw new Error("Case {$caseId} not found.");
|
||||
}
|
||||
|
||||
$contact = null;
|
||||
$contactId = $case->get('contactId');
|
||||
if ($contactId) {
|
||||
$contact = $this->entityManager->getEntityById('Contact', $contactId);
|
||||
}
|
||||
|
||||
// Build report name
|
||||
$contactName = $contact
|
||||
? ($contact->get('firstName') . ' ' . $contact->get('lastName'))
|
||||
: 'ללא איש קשר';
|
||||
$reportName = "דוח גישה ישיר�� — {$contactName}";
|
||||
|
||||
// Extract legal analysis from nested object
|
||||
$legalAnalysis = $params['legalAnalysis'] ?? [];
|
||||
if (is_string($legalAnalysis)) {
|
||||
$legalAnalysis = json_decode($legalAnalysis, true) ?? [];
|
||||
}
|
||||
|
||||
// Create DirectAccessReport entity
|
||||
$report = $this->entityManager->getNewEntity('DirectAccessReport');
|
||||
$report->set([
|
||||
'name' => $reportName,
|
||||
'status' => 'Draft',
|
||||
'caseId' => $caseId,
|
||||
'assignedUserId' => $userId,
|
||||
|
||||
// Section ב' �� מהות הסיוע
|
||||
'aidType' => $params['aidType'] ?? null,
|
||||
'urgencyLevel' => $params['urgencyLevel'] ?? null,
|
||||
'appointmentDate' => $this->normalizeDate($params['appointmentDate'] ?? null),
|
||||
'filingDeadline' => $this->normalizeDate($params['filingDeadline'] ?? null),
|
||||
'additionalUrgency' => $params['additionalUrgency'] ?? null,
|
||||
'additionalDeadline' => $params['additionalDeadline'] ?? null,
|
||||
|
||||
// Section ג' — קשר עם הלקוח
|
||||
'firstContactDate' => $this->normalizeDate($params['firstContactDate'] ?? null),
|
||||
'contactDelayReason' => $params['contactDelayReason'] ?? null,
|
||||
'meetingDate' => $this->normalizeDate($params['meetingDate'] ?? null),
|
||||
'meetingDelayReason' => $params['meetingDelayReason'] ?? null,
|
||||
'meetingAttendees' => $params['meetingAttendees'] ?? null,
|
||||
'contactStatus' => $params['contactStatus'] ?? null,
|
||||
'contactStatusDetail' => $params['contactStatusDetail'] ?? null,
|
||||
|
||||
// Section ד' — פרטי ההליך
|
||||
'proceedingNumber' => $params['proceedingNumber'] ?? $case->get('cCourtCaseNumber'),
|
||||
'courtName' => $params['courtName'] ?? null,
|
||||
'proceedingSubject' => $params['proceedingSubject'] ?? null,
|
||||
'claimSummary' => $params['claimSummary'] ?? null,
|
||||
'defenseClaims' => $params['defenseClaims'] ?? null,
|
||||
|
||||
// Section ה'-ז' — בחינת סיכוי משפטי
|
||||
'q1DocsReviewed' => $legalAnalysis['q1DocsReviewed'] ?? false,
|
||||
'q1DocsDetail' => $legalAnalysis['q1DocsDetail'] ?? null,
|
||||
'q2Reasoned' => $legalAnalysis['q2Reasoned'] ?? false,
|
||||
'q2ReasonDetail' => $legalAnalysis['q2ReasonDetail'] ?? null,
|
||||
'q3PanelMatch' => $legalAnalysis['q3PanelMatch'] ?? false,
|
||||
'q4PanelComposition' => $legalAnalysis['q4PanelComposition'] ?? null,
|
||||
'q5ComplaintsAddressed' => $legalAnalysis['q5ComplaintsAddressed'] ?? false,
|
||||
'q6ComplaintsDetail' => $legalAnalysis['q6ComplaintsDetail'] ?? null,
|
||||
'q7ClinicalExam' => $legalAnalysis['q7ClinicalExam'] ?? false,
|
||||
'q8ClinicalGap' => $legalAnalysis['q8ClinicalGap'] ?? null,
|
||||
'q9MoharaApplied' => $legalAnalysis['q9MoharaApplied'] ?? false,
|
||||
'q9MoharaDetail' => $legalAnalysis['q9MoharaDetail'] ?? null,
|
||||
'q10RehabGap' => $legalAnalysis['q10RehabGap'] ?? false,
|
||||
'q10RehabDetail' => $legalAnalysis['q10RehabDetail'] ?? null,
|
||||
'q11ScoreGap' => $legalAnalysis['q11ScoreGap'] ?? false,
|
||||
'q11ScoreDetail' => $legalAnalysis['q11ScoreDetail'] ?? null,
|
||||
'q12UniqueAspects' => $legalAnalysis['q12UniqueAspects'] ?? false,
|
||||
'q12UniqueDetail' => $legalAnalysis['q12UniqueDetail'] ?? null,
|
||||
|
||||
// Section ח' — המלצה
|
||||
'recommendationType' => $params['recommendationType'] ?? null,
|
||||
'recommendationDetail' => $params['recommendationDetail'] ?? null,
|
||||
|
||||
// Section ט' — מיצוי זכויות
|
||||
'additionalAidNeeded' => $params['additionalAidNeeded'] ?? null,
|
||||
'additionalAidNIDetail' => $params['additionalAidNIDetail'] ?? null,
|
||||
'additionalAidOtherDetail' => $params['additionalAidOtherDetail'] ?? null,
|
||||
'additionalAidUrgency' => $params['additionalAidUrgency'] ?? null,
|
||||
'additionalAidDeadlines' => $params['additionalAidDeadlines'] ?? null,
|
||||
'willingToRepresent' => $params['willingToRepresent'] ?? false,
|
||||
|
||||
// Section י' — הערות
|
||||
'notes' => $params['notes'] ?? null,
|
||||
]);
|
||||
|
||||
$this->entityManager->saveEntity($report);
|
||||
|
||||
$this->log->info("LegalAssistance: Created DirectAccessReport {$report->getId()} for case {$caseId}");
|
||||
|
||||
// Also update Case fields if provided
|
||||
$caseUpdated = false;
|
||||
if (!empty($params['appointmentDate']) && !$case->get('cAppointmentDate')) {
|
||||
$case->set('cAppointmentDate', $this->normalizeDate($params['appointmentDate']));
|
||||
$caseUpdated = true;
|
||||
}
|
||||
if (!empty($params['aidType']) && !$case->get('cAidType')) {
|
||||
$case->set('cAidType', $params['aidType']);
|
||||
$caseUpdated = true;
|
||||
}
|
||||
if (!empty($params['urgencyLevel']) && !$case->get('cUrgencyLevel')) {
|
||||
$case->set('cUrgencyLevel', $params['urgencyLevel']);
|
||||
$caseUpdated = true;
|
||||
}
|
||||
if (!empty($params['filingDeadline']) && !$case->get('cFilingDeadline')) {
|
||||
$case->set('cFilingDeadline', $this->normalizeDate($params['filingDeadline']));
|
||||
$caseUpdated = true;
|
||||
}
|
||||
if ($caseUpdated) {
|
||||
$this->entityManager->saveEntity($case, ['skipHooks' => true]);
|
||||
}
|
||||
|
||||
// Generate DOCX using template
|
||||
$docxResult = $this->generateDocx($report, $case, $contact, $userId);
|
||||
|
||||
$msg = "✅ דוח גישה ישירה נוצר בהצלחה: \"{$reportName}\"";
|
||||
if (!empty($docxResult['fileName'])) {
|
||||
$msg .= "\n📄 מסמך DOCX נוצר: {$docxResult['fileName']}";
|
||||
}
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'message' => $msg,
|
||||
'entityType' => 'DirectAccessReport',
|
||||
'entityId' => $report->getId(),
|
||||
];
|
||||
}
|
||||
|
||||
private function generateDocx($report, $case, $contact, string $userId): array
|
||||
{
|
||||
// Try to use LocalDocumentTemplateService if available
|
||||
try {
|
||||
$templateServiceClass = 'Espo\\Modules\\LocalDocuments\\Services\\LocalDocumentTemplateService';
|
||||
if (!class_exists($templateServiceClass)) {
|
||||
$templateServiceClass = 'Espo\\Modules\\NetworkStorageIntegration\\Services\\DocumentTemplateService';
|
||||
}
|
||||
|
||||
if (!class_exists($templateServiceClass)) {
|
||||
$this->log->warning("LegalAssistance: No template service available for DOCX generation");
|
||||
return ['success' => false, 'error' => 'No template service'];
|
||||
}
|
||||
|
||||
// Find the template
|
||||
$template = $this->entityManager
|
||||
->getRDBRepository('DocumentTemplate')
|
||||
->where(['name' => 'דוח גישה ישירה'])
|
||||
->findOne();
|
||||
|
||||
if (!$template) {
|
||||
$this->log->warning("LegalAssistance: Template 'דוח גישה ישירה' not found");
|
||||
return ['success' => false, 'error' => 'Template not found'];
|
||||
}
|
||||
|
||||
$templateService = $this->injectableFactory->create($templateServiceClass);
|
||||
|
||||
$result = $templateService->createFromTemplate(
|
||||
$template->getId(),
|
||||
'Case',
|
||||
$case->getId(),
|
||||
$report->get('name')
|
||||
);
|
||||
|
||||
return $result;
|
||||
} catch (\Throwable $e) {
|
||||
$this->log->error("LegalAssistance: DOCX generation failed: " . $e->getMessage());
|
||||
return ['success' => false, 'error' => $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
private function normalizeDate(?string $value): ?string
|
||||
{
|
||||
if (!$value) return null;
|
||||
|
||||
// Handle DD/MM/YYYY format
|
||||
if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/', $value, $m)) {
|
||||
return "{$m[3]}-{$m[2]}-{$m[1]}";
|
||||
}
|
||||
|
||||
// Handle YYYY-MM-DD format (already correct)
|
||||
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Espo\Modules\LegalAssistance\SmartAssistant\Tools;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Log;
|
||||
use Espo\Modules\LegalAssistance\Services\DirectAccessReportService;
|
||||
|
||||
class GenerateInitialReport
|
||||
{
|
||||
public function __construct(
|
||||
private EntityManager $entityManager,
|
||||
private InjectableFactory $injectableFactory,
|
||||
private Log $log
|
||||
) {}
|
||||
|
||||
public function execute(array $params, ?string $caseId, string $userId): array
|
||||
{
|
||||
if (!$caseId) {
|
||||
throw new Error('generate_initial_report requires a case context.');
|
||||
}
|
||||
|
||||
$this->log->info("LegalAssistance: Generating initial report for case {$caseId}");
|
||||
|
||||
$service = $this->injectableFactory->create(DirectAccessReportService::class);
|
||||
|
||||
$result = $service->generateReport($caseId, $userId, $params);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "LegalAssistance",
|
||||
"version": "1.0.0",
|
||||
"acceptableVersions": [">=8.0.0"],
|
||||
"php": [">=8.1"],
|
||||
"releaseDate": "2026-04-06",
|
||||
"author": "Marcus-Law",
|
||||
"description": "סיוע משפטי — דוח גישה ישירה, משימות אוטומטיות, אינטגרציה עם שירה",
|
||||
"scripts": {
|
||||
"afterInstall": "scripts/AfterInstall.php",
|
||||
"afterUninstall": "scripts/AfterUninstall.php"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"casePromptAppend": "=== DIRECT ACCESS REPORT (דוח גישה ישירה) ===\nWhen the user asks to create a direct access report (\"דוח גישה ישירה\", \"דיווח ראשוני\", \"דוח דיווח ראשוני\"), follow this structured conversation flow:\n\nIMPORTANT: Do NOT call generate_initial_report until you have collected ALL required information through conversation.\n\nStep 1 — AUTO-FILL from context:\n- Pull from case: מספר תיק סיוע (cLegalAidNumber), בית הדין (cCourt), מספר הליך (cCourtCaseNumber)\n- Pull from contact: שם פרטי, שם משפחה\n- Tell the user what you already have and what's missing\n\nStep 2 — ASK about the appointment:\n- מתי קיבלת את המינוי? (appointmentDate)\n- מה מהות הסיוע? (הגשת ערעור / יעוץ / סיוע נוסף / אי מתן סיוע)\n- מה דחיפות ההליך? (רגיל / דחוף / בהול)\n- מועד אחרון להגשה?\n\nStep 3 — ASK about client contact:\n- מתי יצרת קשר ראשוני עם הלקוח?\n- If > 48 hours from appointment: מה סיבת העיכוב?\n- מתי נפגשתם? מי נכח בפגישה?\n- If > 10 days from appointment: מה סיבת העיכוב?\n- הקשר עם הלקוח תקין? (if not, ask for details)\n\nStep 4 — ASK about the proceeding:\n- עניין ההליך? (נכות כללית/מעבודה/איבה/ניידות/אי כושר/שירותים מיוחדים/סיעוד/etc.)\n- תמצית התביעה/הערעור?\n- טענות ההגנה (אם הוגשו)?\n\nStep 5 — ASK legal evaluation questions (BASED ON SUBJECT TYPE):\n\nIf נכות כללית/מעבודה/איבה/ניידות:\n- הוועדה התייחסה לכל המסמכים הרפואיים? פרט\n- ההחלטה מנומקת? ניתן להתחקות אחר הלך הרוח? פרט חוסרים\n- הרכב הוועדה תואם ליקויים? הרכב חסר?\n- התייחסו לכל תלונות הלקוח? פרט חוסרים\n- בדיקה קלינית נערכה? פער בין בדיקה למסמכים?\n\nIf אי כושר (in addition):\n- בחינת הלכת מוהרה (גיל, רקע תעסוקתי, השכלה)? נתונים חסרים?\n- פער בין פקיד שיקום לוועדה?\n\nIf שירותים מיוחדים/סיעוד:\n- פער ניקוד vs מצב ומסמכים?\n- התייחסות להיבטים ייחודיים (נפילות, מצב קוגנטיבי, השגחה)?\n\nStep 6 — ASK for recommendation:\n- מה ההמלצה? (ייעוץ חלף ייצוג / ויתור / החלפת ייצוג / לא נוצר קשר / לא התקיימה פגישה / עוד לא ניתן להחליט / נדרשים מסמכים / המלצה לסירוב)\n- Generate detailed justification based on the answers\n\nStep 7 — ASK about additional rights:\n- הלקוח צריך סיוע נוסף? (לא / בביטוח לאומי / תחום אחר)\n- If yes: פרטים, דחיפות, מועדים\n- הסיוע בתחום התמחותך? מעוניין לייצג?\n- הערות נוספות?\n\nStep 8 — GENERATE:\n- Summarize all collected data to the user\n- Ask for confirmation\n- Call generate_initial_report with ALL collected data\n\nNOTES:\n- Ask questions in natural conversation style, not as a form\n- Group related questions together (2-3 per message)\n- Use the case context to pre-fill what you can\n- For the legal analysis, formulate the answers based on the lawyer's explanations\n- The recommendationDetail should be a well-written legal justification\n"
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"tools": {
|
||||
"generate_initial_report": {
|
||||
"description": "Generate Direct Access initial report (דוח דיווח ראשוני — גישה ישירה). Call ONLY after collecting ALL required data through conversation with the lawyer. This tool creates a DirectAccessReport entity and generates a DOCX document.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"aidType": {
|
||||
"type": "string",
|
||||
"enum": ["הגשת ערעור", "יעוץ והדרכה", "סיוע נוסף ביטוח לאומי", "סיוע נוסף תחום אחר", "אי מתן סיוע"],
|
||||
"description": "מהות הסיוע"
|
||||
},
|
||||
"urgencyLevel": {
|
||||
"type": "string",
|
||||
"enum": ["רגיל", "דחוף", "בהול"],
|
||||
"description": "דחיפות ההליך"
|
||||
},
|
||||
"filingDeadline": {
|
||||
"type": "string",
|
||||
"description": "מועד אחרון להגשה (YYYY-MM-DD)"
|
||||
},
|
||||
"appointmentDate": {
|
||||
"type": "string",
|
||||
"description": "מועד קבלת המינוי (YYYY-MM-DD)"
|
||||
},
|
||||
"additionalUrgency": {
|
||||
"type": "string",
|
||||
"enum": ["רגיל", "דחוף", "בהול"],
|
||||
"description": "דחיפות הליך נוסף (if applicable)"
|
||||
},
|
||||
"additionalDeadline": {
|
||||
"type": "string",
|
||||
"description": "מועדים להליך נוסף"
|
||||
},
|
||||
"firstContactDate": {
|
||||
"type": "string",
|
||||
"description": "תאריך יצירת קשר ראשוני (YYYY-MM-DD)"
|
||||
},
|
||||
"contactDelayReason": {
|
||||
"type": "string",
|
||||
"description": "סיבת עיכוב ביצירת קשר (if > 48 hours)"
|
||||
},
|
||||
"meetingDate": {
|
||||
"type": "string",
|
||||
"description": "תאריך פגישה עם הלקוח (YYYY-MM-DD)"
|
||||
},
|
||||
"meetingDelayReason": {
|
||||
"type": "string",
|
||||
"description": "סיבת עיכוב בפגישה (if > 10 days)"
|
||||
},
|
||||
"meetingAttendees": {
|
||||
"type": "string",
|
||||
"description": "נוכחים בפגישה (פרט לפונה)"
|
||||
},
|
||||
"contactStatus": {
|
||||
"type": "string",
|
||||
"enum": ["תקין", "לא תקין"],
|
||||
"description": "מצב הקשר עם הלקוח"
|
||||
},
|
||||
"contactStatusDetail": {
|
||||
"type": "string",
|
||||
"description": "פירוט מצב קשר (if לא תקין)"
|
||||
},
|
||||
"proceedingNumber": {
|
||||
"type": "string",
|
||||
"description": "מספר ההליך בבית הדין"
|
||||
},
|
||||
"courtName": {
|
||||
"type": "string",
|
||||
"description": "בית הדין"
|
||||
},
|
||||
"proceedingSubject": {
|
||||
"type": "string",
|
||||
"enum": ["נכות כללית", "נכות מעבודה", "נכות איבה", "ניידות", "אי כושר", "שירותים מיוחדים", "סיעוד", "גמלת הבטחת הכנסה", "דמי אבטלה", "אחר"],
|
||||
"description": "עניין ההליך"
|
||||
},
|
||||
"claimSummary": {
|
||||
"type": "string",
|
||||
"description": "תמצית התביעה/הערעור"
|
||||
},
|
||||
"defenseClaims": {
|
||||
"type": "string",
|
||||
"description": "טענות ההגנה (אם הוגשו)"
|
||||
},
|
||||
"legalAnalysis": {
|
||||
"type": "object",
|
||||
"description": "ניתוח הסיכוי המשפטי — מלא רק שדות רלוונטיים לסוג התביעה",
|
||||
"properties": {
|
||||
"q1DocsReviewed": { "type": "boolean" },
|
||||
"q1DocsDetail": { "type": "string" },
|
||||
"q2Reasoned": { "type": "boolean" },
|
||||
"q2ReasonDetail": { "type": "string" },
|
||||
"q3PanelMatch": { "type": "boolean" },
|
||||
"q4PanelComposition": { "type": "string" },
|
||||
"q5ComplaintsAddressed": { "type": "boolean" },
|
||||
"q6ComplaintsDetail": { "type": "string" },
|
||||
"q7ClinicalExam": { "type": "boolean" },
|
||||
"q8ClinicalGap": { "type": "string" },
|
||||
"q9MoharaApplied": { "type": "boolean" },
|
||||
"q9MoharaDetail": { "type": "string" },
|
||||
"q10RehabGap": { "type": "boolean" },
|
||||
"q10RehabDetail": { "type": "string" },
|
||||
"q11ScoreGap": { "type": "boolean" },
|
||||
"q11ScoreDetail": { "type": "string" },
|
||||
"q12UniqueAspects": { "type": "boolean" },
|
||||
"q12UniqueDetail": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"recommendationType": {
|
||||
"type": "string",
|
||||
"enum": ["ייעוץ והדרכה חלף ייצוג", "ויתור הלקוח", "החלפת ייצוג", "לא נוצר קשר", "לא התקיימה פגישה", "עדיין לא ניתן להחליט", "נדרשים מסמכים נוספים", "המלצה לסירוב"],
|
||||
"description": "סוג ההמלצה/ההודעה"
|
||||
},
|
||||
"recommendationDetail": {
|
||||
"type": "string",
|
||||
"description": "פירוט מנומק של ההמלצה"
|
||||
},
|
||||
"additionalAidNeeded": {
|
||||
"type": "string",
|
||||
"enum": ["לא נחוץ", "נחוץ בתחום ביטוח לאומי", "נחוץ בתחום אחר"],
|
||||
"description": "צורך בסיוע נוסף"
|
||||
},
|
||||
"additionalAidNIDetail": {
|
||||
"type": "string",
|
||||
"description": "פירוט סיוע נוסף בתחום ביטוח לאומי"
|
||||
},
|
||||
"additionalAidOtherDetail": {
|
||||
"type": "string",
|
||||
"description": "פירוט סיוע נוסף בתחום אחר"
|
||||
},
|
||||
"additionalAidUrgency": {
|
||||
"type": "string",
|
||||
"enum": ["רגיל", "דחוף", "בהול"]
|
||||
},
|
||||
"additionalAidDeadlines": {
|
||||
"type": "string",
|
||||
"description": "מועדים לסיוע נוסף"
|
||||
},
|
||||
"willingToRepresent": {
|
||||
"type": "boolean",
|
||||
"description": "הסיוע הנוסף בתחום התמחותי ומעוניין לייצג?"
|
||||
},
|
||||
"notes": {
|
||||
"type": "string",
|
||||
"description": "הערות כלליות"
|
||||
}
|
||||
},
|
||||
"required": ["aidType", "proceedingSubject", "recommendationType"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* LegalAssistance Extension — AfterInstall
|
||||
*
|
||||
* 1. Deploy plugin files to ai-gateway plugins/ directory
|
||||
* 2. Create DocumentTemplate for the direct access report
|
||||
* 3. Clear cache
|
||||
************************************************************************/
|
||||
|
||||
use Espo\Core\Container;
|
||||
use Espo\Core\DataManager;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Log;
|
||||
|
||||
class AfterInstall
|
||||
{
|
||||
public function run(Container $container): void
|
||||
{
|
||||
/** @var EntityManager $entityManager */
|
||||
$entityManager = $container->getByClass(EntityManager::class);
|
||||
/** @var Log $log */
|
||||
$log = $container->getByClass(Log::class);
|
||||
|
||||
$log->info('LegalAssistance: Running AfterInstall...');
|
||||
|
||||
// 1. Deploy ai-gateway plugin files
|
||||
$this->deployPluginFiles($log);
|
||||
|
||||
// 2. Create DocumentTemplate
|
||||
$this->createDocumentTemplate($entityManager, $log);
|
||||
|
||||
// 3. Clear cache
|
||||
try {
|
||||
$dataManager = $container->getByClass(DataManager::class);
|
||||
$dataManager->clearCache();
|
||||
$log->info('LegalAssistance: Cache cleared.');
|
||||
} catch (\Throwable $e) {
|
||||
$log->warning('LegalAssistance: Cache clear failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
$log->info('LegalAssistance: AfterInstall completed.');
|
||||
}
|
||||
|
||||
private function deployPluginFiles(Log $log): void
|
||||
{
|
||||
// Source: extension's plugins/ directory (relative to EspoCRM root after install)
|
||||
$sourceDir = 'custom/Espo/Modules/LegalAssistance/../../../../../../plugins/legal-assistance';
|
||||
|
||||
// Try common ai-gateway locations
|
||||
$gatewayPaths = [
|
||||
'/home/chaim/ai-gateway/plugins/legal-assistance',
|
||||
'/opt/ai-gateway/plugins/legal-assistance',
|
||||
];
|
||||
|
||||
// Find actual source files within the extension package
|
||||
$extPluginDir = __DIR__ . '/../plugins/legal-assistance';
|
||||
|
||||
if (!is_dir($extPluginDir)) {
|
||||
$log->warning("LegalAssistance: Plugin source directory not found at {$extPluginDir}");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($gatewayPaths as $targetDir) {
|
||||
$parentDir = dirname($targetDir);
|
||||
if (!is_dir($parentDir)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_dir($targetDir)) {
|
||||
mkdir($targetDir, 0755, true);
|
||||
}
|
||||
|
||||
$files = ['tools.json', 'prompts.json'];
|
||||
foreach ($files as $file) {
|
||||
$src = $extPluginDir . '/' . $file;
|
||||
$dst = $targetDir . '/' . $file;
|
||||
if (file_exists($src)) {
|
||||
copy($src, $dst);
|
||||
$log->info("LegalAssistance: Deployed {$file} to {$targetDir}");
|
||||
}
|
||||
}
|
||||
|
||||
$log->info("LegalAssistance: Plugin files deployed to {$targetDir}");
|
||||
return;
|
||||
}
|
||||
|
||||
$log->warning('LegalAssistance: Could not find ai-gateway plugins directory. Deploy manually.');
|
||||
}
|
||||
|
||||
private function createDocumentTemplate(EntityManager $entityManager, Log $log): void
|
||||
{
|
||||
// Check if template already exists
|
||||
$existing = $entityManager
|
||||
->getRDBRepository('DocumentTemplate')
|
||||
->where(['name' => 'דוח גישה ישירה'])
|
||||
->findOne();
|
||||
|
||||
if ($existing) {
|
||||
$log->info('LegalAssistance: DocumentTemplate already exists, skipping.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the template DOCX file
|
||||
$templateFile = __DIR__ . '/../templates/direct-access-report.docx';
|
||||
if (!file_exists($templateFile)) {
|
||||
$log->warning("LegalAssistance: Template file not found at {$templateFile}");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create attachment for the template file
|
||||
$contents = file_get_contents($templateFile);
|
||||
|
||||
$attachment = $entityManager->getNewEntity('Attachment');
|
||||
$attachment->set([
|
||||
'name' => 'direct-access-report.docx',
|
||||
'type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'role' => 'Attachment',
|
||||
'size' => strlen($contents),
|
||||
]);
|
||||
$entityManager->saveEntity($attachment);
|
||||
|
||||
// Write file to storage
|
||||
$filePath = 'data/upload/' . $attachment->getId();
|
||||
file_put_contents($filePath, $contents);
|
||||
|
||||
// Create DocumentTemplate entity
|
||||
$template = $entityManager->getNewEntity('DocumentTemplate');
|
||||
$template->set([
|
||||
'name' => 'דוח גישה ישירה',
|
||||
'entityType' => 'Case',
|
||||
'fileId' => $attachment->getId(),
|
||||
]);
|
||||
$entityManager->saveEntity($template);
|
||||
|
||||
$log->info("LegalAssistance: DocumentTemplate created: {$template->getId()}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* LegalAssistance Extension — AfterUninstall
|
||||
*
|
||||
* 1. Remove plugin files from ai-gateway
|
||||
* 2. Clear cache
|
||||
************************************************************************/
|
||||
|
||||
use Espo\Core\Container;
|
||||
use Espo\Core\DataManager;
|
||||
use Espo\Core\Utils\Log;
|
||||
|
||||
class AfterUninstall
|
||||
{
|
||||
public function run(Container $container): void
|
||||
{
|
||||
/** @var Log $log */
|
||||
$log = $container->getByClass(Log::class);
|
||||
|
||||
$log->info('LegalAssistance: Running AfterUninstall...');
|
||||
|
||||
// Remove ai-gateway plugin files
|
||||
$gatewayPaths = [
|
||||
'/home/chaim/ai-gateway/plugins/legal-assistance',
|
||||
'/opt/ai-gateway/plugins/legal-assistance',
|
||||
];
|
||||
|
||||
foreach ($gatewayPaths as $dir) {
|
||||
if (is_dir($dir)) {
|
||||
$files = glob($dir . '/*');
|
||||
foreach ($files as $file) {
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
$log->info("LegalAssistance: Removed plugin files from {$dir}");
|
||||
}
|
||||
}
|
||||
|
||||
// Clear cache
|
||||
try {
|
||||
$dataManager = $container->getByClass(DataManager::class);
|
||||
$dataManager->clearCache();
|
||||
} catch (\Throwable $e) {
|
||||
$log->warning('LegalAssistance: Cache clear failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
$log->info('LegalAssistance: AfterUninstall completed.');
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user