Skip to content

Commit

Permalink
Evarisk#3752 [Core] fix: remove creation of custom odt document
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Mar 21, 2024
1 parent a35fcef commit 8891c21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
3 changes: 2 additions & 1 deletion core/modules/modDigiriskDolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ public function __construct($db)
$i++ => ['DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_SMALL', 'integer', 480, '', 0, 'current'],
$i++ => ['DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_SMALL', 'integer', 270, '', 0, 'current'],
$i++ => ['DIGIRISKDOLIBARR_DISPLAY_NUMBER_MEDIA_GALLERY', 'integer', 8, '', 0, 'current'],
$i++ => ['DIGIRISKDOLIBARR_CUSTOM_DOCUMENTS_SET', 'integer', 0, '', 0, 'current'],
// -- Deprecated conf, was used to generate custom template, we can now download default template to customize it
//$i++ => ['DIGIRISKDOLIBARR_CUSTOM_DOCUMENTS_SET', 'integer', 0, '', 0, 'current'],
$i++ => ['DIGIRISKDOLIBARR_MANUAL_INPUT_NB_EMPLOYEES', 'integer', 0, '', 0, 'current'],
$i++ => ['DIGIRISKDOLIBARR_MANUAL_INPUT_NB_WORKED_HOURS', 'integer', 0, '', 0, 'current'],
$i++ => ['DIGIRISKDOLIBARR_SHOW_PATCH_NOTE', 'integer', 1, '', 0, 'current'],
Expand Down
41 changes: 0 additions & 41 deletions core/tpl/digiriskdolibarr_projectcreation_action.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,47 +922,6 @@
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_ENCODE_BACKWARD_COMPATIBILITY', 1, 'integer', 0, '', $conf->entity);
}

if ($conf->global->DIGIRISKDOLIBARR_CUSTOM_DOCUMENTS_SET == 0) {
require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';

$ecmfile = new EcmFiles($db);

$types = array(
'LegalDisplay' => 'legaldisplay',
'InformationsSharing' => 'informationssharing',
'ListingRisksAction' => 'listingrisksaction',
'ListingRisksPhoto' => 'listingrisksphoto',
'GroupmentDocument' => 'groupmentdocument',
'WorkUnitDocument' => 'workunitdocument',
'RiskAssessmentDocument' => 'riskassessmentdocument',
'PreventionPlan' => 'preventionplandocument',
'FirePermit' => 'firepermitdocument',
'Ticket' => 'ticketdocument'
);

foreach ($types as $documentType) {
dolibarr_get_const($db, 'DIGIRISKDOLIBARR_' . strtoupper($documentType) . '_CUSTOM_ADDON_ODT_PATH');
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_' . strtoupper($documentType) . '_CUSTOM_ADDON_ODT_PATH', 'DOL_DATA_ROOT' . (($conf->entity == 1 ) ? '/' : '/' . $conf->entity . '/') . 'ecm/digiriskdolibarr/'. $documentType . '/', 'chaine', 0, '', $conf->entity);

$srcfullpath = DOL_DOCUMENT_ROOT . '/custom/digiriskdolibarr/documents/doctemplates/' . $documentType . '/template_' . $documentType . '.odt';
$ecmdir = $conf->ecm->multidir_output[$conf->entity?:1];
$destfullpath = $ecmdir . '/digiriskdolibarr/' . $documentType . '/template_' . $documentType . '_custom.odt';

$result = dol_copy($srcfullpath, $destfullpath, 0, 0);
if ($result > 0) {
$ecmfile->label = md5_file(dol_osencode($destfullpath));
$ecmfile->filepath = (($conf->entity == 1 ) ? '' : $conf->entity . '/') . 'ecm/digiriskdolibarr/' . $documentType;
$ecmfile->filename = 'template_' . $documentType . '_custom.odt';
$ecmfile->fullpath_orig = 'template_' . $documentType . '_custom.odt';
$ecmfile->gen_or_uploaded = 'uploaded';
$ecmfile->create($user);
}
}

dolibarr_set_const($db, 'DIGIRISKDOLIBARR_CUSTOM_DOCUMENTS_SET', 1, 'integer', 0, '', $conf->entity);
}

if ($conf->global->DIGIRISKDOLIBARR_SECURITY_SOCIAL_CONF_UPDATED == 0) {
// Security conf
if (empty(dolibarr_get_const($db, 'DIGIRISKDOLIBARR_LOCATION_OF_DETAILED_INSTRUCTION'))) {
Expand Down

0 comments on commit 8891c21

Please sign in to comment.