Skip to content
13 changes: 9 additions & 4 deletions admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@
$res = require_once __DIR__.'/../../../main.inc.php';
}
if (!$res) {
die('Include of main fails');
die('Include of main fails');
}

require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/cemailtemplate.class.php';
// EN: Load document helper functions required for model toggles.
// EN: Load email template class with backward compatibility for older Dolibarr versions.

if (floatval(DOL_VERSION) < 23) {
dol_include_once('/timesheetweek/core/class/cemailtemplate.class.php');
} else {
require_once DOL_DOCUMENT_ROOT.'/core/class/cemailtemplate.class.php';
}

require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
dol_include_once('/timesheetweek/lib/timesheetweek.lib.php');
dol_include_once('/timesheetweek/class/timesheetweek.class.php');
Expand Down
13 changes: 4 additions & 9 deletions class/timesheetweek_reminder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,10 @@ public function run($dbInstance = null, $limit = 0, $forcerun = 0, array $target
}
}

$emailTemplateClassFile = '';
if (is_readable(DOL_DOCUMENT_ROOT.'/core/class/cemailtemplate.class.php')) {
$emailTemplateClassFile = '/core/class/cemailtemplate.class.php';
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/core/class/emailtemplate.class.php')) {
$emailTemplateClassFile = '/core/class/emailtemplate.class.php';
}

if (!empty($emailTemplateClassFile)) {
dol_include_once($emailTemplateClassFile);
if (floatval(DOL_VERSION) < 23) {
dol_include_once('/timesheetweek/core/class/cemailtemplate.class.php');
} else {
require_once DOL_DOCUMENT_ROOT.'/core/class/cemailtemplate.class.php';
}

if (!class_exists('CEmailTemplate') && !class_exists('EmailTemplate')) {
Expand Down
Loading