Skip to content

Commit

Permalink
Evarisk#3382 [SQL] fix: handle database rename
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Oct 12, 2023
1 parent 549cf80 commit 02f6467
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/modules/modDigiriskDolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2180,15 +2180,14 @@ public function init($options = '')

$documentsPath = DOL_DATA_ROOT . ($conf->entity > 1 ? '/' . $conf->entity : '');
$mediaPath = $documentsPath . '/digiriskdolibarr';
$ecmPath = $documentsPath . '/ecm/digiriskdolibarr';

if (is_dir($mediaPath . '/accident_investigation')) {
chmod($mediaPath . '/accident_investigation', 0755);
rename($mediaPath . '/accident_investigation', $mediaPath . '/accidentinvestigation');
}
if (is_dir($ecmPath . '/accident_investigationdocument')) {
chmod($ecmPath . '/accident_investigationdocument', 0755);
rename($ecmPath . '/accident_investigationdocument', $ecmPath . '/accidentinvestigationdocument');
if (is_dir($mediaPath . '/accident_investigationdocument')) {
chmod($mediaPath . '/accident_investigationdocument', 0755);
rename($mediaPath . '/accident_investigationdocument', $mediaPath . '/accidentinvestigationdocument');
}

return $this->_init($sql, $options);
Expand Down
4 changes: 4 additions & 0 deletions sql/update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,7 @@ DELETE FROM llx_c_digiriskdolibarr_action_trigger WHERE ref = 'ACCIDENT_INVESTIG

UPDATE `llx_const` SET `value` = 'mod_accidentinvestigation_standard' WHERE `llx_const`.`name` = 'DIGIRISKDOLIBARR_ACCIDENTINVESTIGATION_ADDON';
UPDATE `llx_const` SET `value` = 'mod_accidentinvestigationdocument_standard' WHERE `llx_const`.`name` = 'DIGIRISKDOLIBARR_ACCIDENTINVESTIGATIONDOCUMENT_ADDON';
INSERT INTO llx_c_accidentinvestigation_attendants_role SELECT * FROM llx_c_accident_investigation_attendants_role;
INSERT INTO llx_categorie_accidentinvestigation SELECT * FROM llx_categorie_accident_investigation;
DROP DATABASE llx_c_accident_investigation_attendants_role;
DROP DATABASE llx_categorie_accident_investigation;

0 comments on commit 02f6467

Please sign in to comment.