Skip to content

Commit

Permalink
#160 [Trigger] fix: error trigger don't show on card
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Feb 10, 2023
1 parent db23f87 commit 208e039
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
48 changes: 17 additions & 31 deletions core/triggers/interface_99_modDoliMeet_DoliMeetTriggers.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,95 +96,81 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$now = dol_now();
$actioncomm = new ActionComm($this->db);

$actioncomm->elementtype = $object->type . '@dolimeet';
$actioncomm->elementtype = $object->element . '@dolimeet';
$actioncomm->type_code = 'AC_OTH_AUTO';
$actioncomm->datep = $now;
$actioncomm->fk_element = $object->id;
$actioncomm->userownerid = $user->id;
$actioncomm->percentage = -1;

switch ($action) {
// Meeting
case 'SESSION_CREATE' :
$actioncomm->code = 'AC_' . strtoupper($object->type) . '_CREATE';
$actioncomm->label = $langs->trans(ucfirst($object->type) . 'CreateTrigger');

case 'MEETING_CREATE' :
case 'TRAININGSESSION_CREATE' :
case 'AUDIT_CREATE' :
$actioncomm->code = 'AC_' . strtoupper($object->element) . '_CREATE';
$actioncomm->label = $langs->trans(ucfirst($object->element) . 'CreateTrigger');
$actioncomm->create($user);
break;
case 'SESSION_MODIFY' :
$actioncomm->code = 'AC_' . strtoupper($object->type) . '_MODIFY';
$actioncomm->label = $langs->trans(ucfirst($object->type) . 'ModifyTrigger');

case 'MEETING_MODIFY' :
case 'TRAININGSESSION_MODIFY' :
case 'AUDIT_MODIFY' :
$actioncomm->code = 'AC_' . strtoupper($object->element) . '_MODIFY';
$actioncomm->label = $langs->trans(ucfirst($object->element) . 'ModifyTrigger');
$actioncomm->create($user);
break;

case 'SESSION_DELETE' :
$actioncomm->code = 'AC_ ' . strtoupper($object->type) . '_DELETE';
$actioncomm->label = $langs->trans(ucfirst($object->type) . 'DeleteTrigger');

case 'MEETING_DELETE' :
case 'TRAININGSESSION_DELETE' :
case 'AUDIT_DELETE' :
$actioncomm->code = 'AC_ ' . strtoupper($object->element) . '_DELETE';
$actioncomm->label = $langs->trans(ucfirst($object->element) . 'DeleteTrigger');
$actioncomm->create($user);
break;

case 'SESSION_ADDATTENDANT' :
$actioncomm->elementtype = $object->object_type . '@dolimeet';
$actioncomm->code = 'AC_SESSION_ADDATTENDANT';
$actioncomm->label = $langs->transnoentities('AddAttendantTrigger', $object->firstname . ' ' . $object->lastname);

if ($object->element_type == 'socpeople') {
$actioncomm->socpeopleassigned = [$object->element_id => $object->element_id];
}

$actioncomm->create($user);
break;

case 'DOLIMEETSIGNATURE_SIGNED' :
$actioncomm->elementtype = $object->object_type . '@dolimeet';
$actioncomm->code = 'AC_DOLIMEETSIGNATURE_SIGNED';
$actioncomm->label = $langs->transnoentities($object->role . 'Signed') . ' : ' . $object->firstname . ' ' . $object->lastname;

if ($object->element_type == 'socpeople') {
$actioncomm->socpeopleassigned = [$object->element_id => $object->element_id];
}

$actioncomm->create($user);
break;

case 'DOLIMEETSIGNATURE_PENDING_SIGNATURE' :
$actioncomm->elementtype = $object->object_type . '@dolimeet';
$actioncomm->code = 'AC_DOLIMEETSIGNATURE_PENDING_SIGNATURE';
$actioncomm->label = $langs->transnoentities('DolimeetSignaturePendingSignatureTrigger') . ' : ' . $object->firstname . ' ' . $object->lastname;

if ($object->element_type == 'socpeople') {
$actioncomm->socpeopleassigned = [$object->element_id => $object->element_id];
}

$actioncomm->create($user);
break;

case 'DOLIMEETSIGNATURE_ABSENT' :
$actioncomm->elementtype = $object->object_type . '@dolimeet';
$actioncomm->code = 'AC_DOLIMEETSIGNATURE_ABSENT';
$actioncomm->label = $langs->transnoentities('DolimeetSignatureAbsentTrigger') . ' : ' . $object->firstname . ' ' . $object->lastname;

if ($object->element_type == 'socpeople') {
$actioncomm->socpeopleassigned = [$object->element_id => $object->element_id];
}

$actioncomm->create($user);
break;

case 'DOLIMEETSIGNATURE_DELETED' :
$actioncomm->elementtype = $object->object_type . '@dolimeet';
$actioncomm->code = 'AC_DOLIMEETSIGNATURE_DELETED';
$actioncomm->label = $langs->transnoentities('DolimeetSignatureDeletedTrigger') . ' : ' . $object->firstname . ' ' . $object->lastname;
if ($object->element_type == 'socpeople') {
$actioncomm->socpeopleassigned = [$object->element_id => $object->element_id];
}

$actioncomm->create($user);
break;
}

return 0;
}
}
}
2 changes: 1 addition & 1 deletion view/session/session_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, '', 1, '', $MAXEVENT, '', $morehtmlcenter);

print '</div></div>';
}
Expand Down

0 comments on commit 208e039

Please sign in to comment.