Skip to content

Commit

Permalink
Evarisk#3410 [Accident] fix: display and document generate issues
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Oct 12, 2023
1 parent 87ed3bc commit ca184c6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion class/accident.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Accident extends SaturneObject
'entity' => ['type' => 'integer', 'label' => 'Entity', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 0,],
'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 2,],
'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => 0,],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 2, 'index' => 0,],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 70, 'notnull' => 1, 'visible' => 2, 'index' => 0, 'arrayofkeyval' => [1 => 'InProgress', 2 => 'Locked']],
'label' => ['type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth200', 'help' => "Help text", 'showoncombobox' => '1',],
'fk_user_victim' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserVictim', 'enabled' => '1', 'position' => 81, 'notnull' => -1, 'visible' => 1,],
'fk_user_employer' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserEmployer', 'enabled' => '1', 'position' => 82, 'notnull' => -1, 'visible' => 1,],
Expand Down
2 changes: 1 addition & 1 deletion class/accidentinvestigation.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class AccidentInvestigation extends SaturneObject
'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 2,],
'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 0,],
'import_key' => ['type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'index' => 0],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'default' => 0, 'index' => 0,],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'default' => 0, 'index' => 0, 'arrayofkeyval' => [0 => 'InProgress', 1 => 'Validated', 3 => 'Classified']],
'seniority_in_position' => ['type' => 'varchar(255)', 'label' => 'SeniorityInPosition', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 1, 'css' => 'maxwidth200'],
'date_start' => ['type' => 'datetime', 'label' => 'StartDate', 'enabled' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1,],
'date_end' => ['type' => 'datetime', 'label' => 'EndDate', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 1,],
Expand Down
4 changes: 2 additions & 2 deletions core/modules/modDigiriskDolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,8 @@ public function init($options = '')
$extra_fields->addExtraField('fk_firepermit', $langs->transnoentities("FirePermitLinked"), 'sellist', 1030, '', 'projet_task', 0, 0, '', 'a:1:{s:7:"options";a:1:{s:56:"digiriskdolibarr_firepermit:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);
$extra_fields->update('fk_accident', $langs->transnoentities("AccidentLinked"), 'sellist', '', 'projet_task', 0, 0, 1040, 'a:1:{s:7:"options";a:1:{s:54:"digiriskdolibarr_accident:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);
$extra_fields->addExtraField('fk_accident', $langs->transnoentities("AccidentLinked"), 'sellist', 1040, '', 'projet_task', 0, 0, '', 'a:1:{s:7:"options";a:1:{s:54:"digiriskdolibarr_accident:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);
$extra_fields->update('fk_accidentinvestigation', $langs->transnoentities("AccidentInvestigationLinked"), 'sellist', '', 'projet_task', 0, 0, 1050, 'a:1:{s:7:"options";a:1:{s:68:"digiriskdolibarr_acciden_investigationt:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);
$extra_fields->addExtraField('fk_accidentinvestigation', $langs->transnoentities("AccidentInvestigationLinked"), 'sellist', 1050, '', 'projet_task', 0, 0, '', 'a:1:{s:7:"options";a:1:{s:68:"digiriskdolibarr_acciden_investigationt:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);
$extra_fields->update('fk_accidentinvestigation', $langs->transnoentities("AccidentInvestigationLinked"), 'sellist', '', 'projet_task', 0, 0, 1050, 'a:1:{s:7:"options";a:1:{s:68:"digiriskdolibarr_accident_investigation:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);
$extra_fields->addExtraField('fk_accidentinvestigation', $langs->transnoentities("AccidentInvestigationLinked"), 'sellist', 1050, '', 'projet_task', 0, 0, '', 'a:1:{s:7:"options";a:1:{s:68:"digiriskdolibarr_accident_investigation:ref:rowid::entity = $ENTITY$";N;}}', '', '', 1);

if (!$conf->global->DIGIRISKDOLIBARR_TICKET_EXTRAFIELDS_BACKWARD_COMPATIBILITY && (dolibarr_get_const($this->db, 'DIGIRISKDOLIBARR_TICKET_EXTRAFIELDS', 0) || dolibarr_get_const($this->db, 'DIGIRISKDOLIBARR_TICKET_EXTRAFIELDS', $conf->entity))) {
if ($conf->multicompany->enabled) {
Expand Down
9 changes: 3 additions & 6 deletions view/accident/accident_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@
// Print form confirm
print $formConfirm;

print '<div class="div-table-responsive">';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<table class="border centpercent tableforfield">';
Expand Down Expand Up @@ -1012,11 +1011,9 @@
print saturne_show_medias_linked('digiriskdolibarr', $pathPhotos, 'small', 0, 0, 0, 0, 50, 50, 0, 0, 0, 'accident/'. $object->ref . '/photos/', $object, 'photo', $permissiontoadd, $permissiontodelete && $object->status <= Accident::STATUS_VALIDATED);
print '</td></tr>';

print '</table>';
print '</div>';
print '</div>';

print dol_get_fiche_end();
print '</table></div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();

if ($object->id > 0) {
// Buttons for actions
Expand Down
5 changes: 2 additions & 3 deletions view/accidentinvestigation/accidentinvestigation_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
$action = 'view';
}

$upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity ?? 1];
$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1];

// Load object
require_once DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be included, not include_once.
Expand Down Expand Up @@ -198,8 +198,7 @@
$moreParams['object'] = $object;
$moreParams['user'] = $user;
$moreParams['zone'] = 'private';
$constName = get_class($object) . '::STATUS_LOCKED';
$moreParams['specimen'] = defined($constName) && $object->status < $object::STATUS_LOCKED;
$moreParams['specimen'] = 0;
$result = $document->generateDocument((!empty($models) ? $models[0] : ''), $langs, 0, 0, 0, $moreParams);

if ($result > 0) {
Expand Down

0 comments on commit ca184c6

Please sign in to comment.