From bedd94072db3b3b14a7b7b22f6703100c5e7f35a Mon Sep 17 00:00:00 2001 From: delcroip Date: Sun, 26 Nov 2023 14:31:52 +0100 Subject: [PATCH] remove old versoin checks --- htdocs/timesheet/Timesheet.php | 7 +------ htdocs/timesheet/TimesheetFavouriteAdmin.php | 6 +----- htdocs/timesheet/TimesheetProjectInvoice.php | 15 +++++---------- htdocs/timesheet/TimesheetUserTasksAdmin.php | 6 +----- htdocs/timesheet/class/TimesheetReport.class.php | 6 +----- htdocs/timesheet/class/TimesheetTask.class.php | 6 +----- .../timesheet/core/modules/modtimesheet.class.php | 2 +- 7 files changed, 11 insertions(+), 37 deletions(-) diff --git a/htdocs/timesheet/Timesheet.php b/htdocs/timesheet/Timesheet.php index 13d6eb0..a48417f 100644 --- a/htdocs/timesheet/Timesheet.php +++ b/htdocs/timesheet/Timesheet.php @@ -197,12 +197,7 @@ $ref = dol_sanitizeFileName($object->ref); $upload_dir = $conf->timesheet->dir_output.'/users/' .get_exdir($object->id, 2, 0, 0, $object, 'timesheet').$ref; - if (version_compare(DOL_VERSION, "4.0") >= 0) { - include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; - } else{ - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; - //require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; - } + include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; } /*************************************************** * VIEW diff --git a/htdocs/timesheet/TimesheetFavouriteAdmin.php b/htdocs/timesheet/TimesheetFavouriteAdmin.php index 526fe2f..e173c4e 100644 --- a/htdocs/timesheet/TimesheetFavouriteAdmin.php +++ b/htdocs/timesheet/TimesheetFavouriteAdmin.php @@ -245,11 +245,7 @@ case 'create': default: //document handling - if (version_compare(DOL_VERSION, "4.0") >= 0) { - include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; - } else{ - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; - } + include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; if (isset($_GET['urlfile'])) $action = 'viewdoc'; break; } diff --git a/htdocs/timesheet/TimesheetProjectInvoice.php b/htdocs/timesheet/TimesheetProjectInvoice.php index 229ef91..77eb78a 100644 --- a/htdocs/timesheet/TimesheetProjectInvoice.php +++ b/htdocs/timesheet/TimesheetProjectInvoice.php @@ -464,7 +464,6 @@ // End of object creation, we show it if (1) { - if (version_compare(DOL_VERSION, "4.9.9") >= 0) { foreach ($task_time_array AS $idLine => $task_time_list) { //dol_syslog("ProjectInvoice::setnvoice".$idLine.' '.$task_time_list, LOG_DEBUG); Update_task_time_invoice($id, $idLine, $task_time_list); @@ -473,7 +472,6 @@ //dol_syslog("ProjectInvoice::setnvoice".$idLine.' '.$task_time_list, LOG_DEBUG); Update_task_time_invoice(-1, -1, $task_time_list); } - } ob_start(); header('Location: ' . $object->getNomUrl(0, '', 0, 1, '')); ob_end_flush(); @@ -594,14 +592,11 @@ $Form .= ($ts2Invoice == "all"?"checked":"").'> ' .$langs->trans("All").""; // not alreqdy invoice - if (version_compare(DOL_VERSION, "4.9.9") >= 0) { - $Form .= '' - .$langs->trans('TimesheetNotInvoiced'); - $Form .= '' - .''; - } else{ - $Form .= ''; - } + $Form .= '' + .$langs->trans('TimesheetNotInvoiced'); + $Form .= '' + .''; + //$invoicabletaskOnly $Form .= ''.$langs->trans('InvoicableOnly'); $Form .= 'ref); $upload_dir = $conf->timesheet->dir_output.'/tasks/' .get_exdir($object->id, 2, 0, 0, $object, 'timesheet').$ref; - if (version_compare(DOL_VERSION, "4.0") >= 0) { - include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; - } else{ - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; - } + include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; } //Removing the $token array so the order can't be submitted two times if (isset($_SESSION['timesheet'][$token])) { diff --git a/htdocs/timesheet/class/TimesheetReport.class.php b/htdocs/timesheet/class/TimesheetReport.class.php index c556c29..2397911 100644 --- a/htdocs/timesheet/class/TimesheetReport.class.php +++ b/htdocs/timesheet/class/TimesheetReport.class.php @@ -235,11 +235,7 @@ public function getReportArray($forceGroup = false) $first = true; $sql = 'SELECT tsk.fk_projet as projectid, ptt.fk_user as userid, tsk.rowid as taskid, '; - if (version_compare(DOL_VERSION, "4.9.9") >= 0) { - $sql .= ' (ptt.invoice_id > 0 or ptt.invoice_line_id>0) AS invoiced,'; - }else{ - $sql .= ' 0 AS invoiced,'; - } + $sql .= ' (ptt.invoice_id > 0 or ptt.invoice_line_id>0) AS invoiced,'; if ($forceGroup == 1){ if ($this->db->type!='pgsql') { $sql .= " MAX(ptt.rowid) as id, GROUP_CONCAT(ptt.note SEPARATOR '. ') as note, MAX(tske.invoiceable) as invoicable, "; diff --git a/htdocs/timesheet/class/TimesheetTask.class.php b/htdocs/timesheet/class/TimesheetTask.class.php index cdd5159..aa6d29a 100644 --- a/htdocs/timesheet/class/TimesheetTask.class.php +++ b/htdocs/timesheet/class/TimesheetTask.class.php @@ -562,11 +562,7 @@ public function getActuals($timeStart = 0, $timeEnd = 0, $userid = 0) $dayelapsed = getDayInterval($timeStart, $timeEnd); if ($dayelapsed<1)return -1; $sql = "SELECT ptt.rowid, ptt.element_duration, DATE(ptt.element_datehour) AS element_date, ptt.note"; - if (version_compare(DOL_VERSION, "4.9.9") >= 0) { - $sql .= ', (ptt.invoice_id > 0 or ptt.invoice_line_id>0) AS invoiced'; - }else{ - $sql .= ', 0 AS invoiced'; - } + $sql .= ', (ptt.invoice_id > 0 or ptt.invoice_line_id>0) AS invoiced'; $sql .= " FROM ".MAIN_DB_PREFIX."element_time AS ptt"; $sql .= " WHERE "; if ($this->id == -1 && is_array($this->exclusionlist)){ diff --git a/htdocs/timesheet/core/modules/modtimesheet.class.php b/htdocs/timesheet/core/modules/modtimesheet.class.php index 4357e6d..8827bac 100644 --- a/htdocs/timesheet/core/modules/modtimesheet.class.php +++ b/htdocs/timesheet/core/modules/modtimesheet.class.php @@ -100,7 +100,7 @@ public function __construct($db) $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->conflictwith = array(); // List of modules id this module is in conflict with $this->phpmin = array(5, 0); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(3, 5); // Minimum version of Dolibarr required by module + $this->need_dolibarr_version = array(18, 0); // Minimum version of Dolibarr required by module $this->langfiles = array("timesheet@timesheet"); // Constants // List of particular constants to add when module is enabled(key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)