From 924340106f858227f408a27ff6ddc1165543b8e7 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 19 Jul 2018 16:10:34 +0200 Subject: [PATCH] Allow to save entries with due date in the past --- infolog/inc/class.infolog_bo.inc.php | 1 + infolog/inc/class.infolog_ui.inc.php | 10 +++++++++- infolog/lang/egw_de.lang | 4 +++- infolog/lang/egw_en.lang | 4 +++- infolog/templates/default/config.xet | 7 +++++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php index 2bcfe63175..55b332c2f4 100644 --- a/infolog/inc/class.infolog_bo.inc.php +++ b/infolog/inc/class.infolog_bo.inc.php @@ -213,6 +213,7 @@ class infolog_bo ); if (($config_data = Api\Config::read('infolog'))) { + $this->allow_past_due_date = $config_data['allow_past_due_date'] === null ? 1 : $config_data['allow_past_due_date']; if (isset($config_data['status']) && is_array($config_data['status'])) { foreach(array_keys($config_data['status']) as $key) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index e9e2946f38..a7a4025c2f 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1797,6 +1797,14 @@ class infolog_ui $status_only = $this->bo->is_responsible($old); $undelete = $this->bo->check_access($old,infolog_bo::ACL_UNDELETE); } + // enddate in the past gives warning + if (isset($content['info_enddate']) + && $content['info_enddate'] < $this->bo->user_time_now + && !$this->bo->allow_past_due_date && !($content['info_status'] == 'done' + || $content['info_status'] == 'archive')) + { + $this->tmpl->set_validation_error('info_enddate', lang('Due date must be in the future!!!')); + } } if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete)) { @@ -2492,7 +2500,7 @@ class infolog_ui Api\Config::save_value('history', $this->bo->history = $content['history'], 'infolog'); Api\Config::save_value('index_load_cfs', implode(',', (array)$content['index_load_cfs']), 'infolog'); Api\Config::save_value('sub_prefix', $content['sub_prefix'], 'infolog'); - + Api\Config::save_value('allow_past_due_date', $content['allow_past_due_date'], 'infolog'); // Notifications $notifications =& $config[infolog_tracking::CUSTOM_NOTIFICATION]; $notifications[$content['notification_type']] = $content['notification']; diff --git a/infolog/lang/egw_de.lang b/infolog/lang/egw_de.lang index e527629cb4..32ad9c1df7 100644 --- a/infolog/lang/egw_de.lang +++ b/infolog/lang/egw_de.lang @@ -52,6 +52,7 @@ all infolog de alle all links and attachments infolog de alle Verknüpfungen und Anhänge all other %1 fields are valid infolog de Alle anderen %1 Felder sind gültig all projects infolog de Alle Projekte +allow to save entries with due date in the past infolog de Erlaubt speichern von Einträgen mit Fälligkeitsdatum in der Vergangenheit allows to set the status of an entry, eg. set a todo to done if it's finished (values depend on entry-typ) infolog de erlaubt den Status eines Eintrags zu setzen, z.B. eine Aufgabe auf erledigt wenn sie beendet ist (Werte hängen vom Type des Eintrags ab) alternatives infolog de Alternativen always show them infolog de Immer anzeigen @@ -168,6 +169,7 @@ done infolog de geschlossen download infolog de Datei laden download url for links infolog de Download Link für Verknüpfungen due %1 infolog de %1 fällig +due date must be in the future!!! de Das Fälligkeitsdatum muss in der Zukunft liegen. duration infolog de Dauer e-mail: infolog de E-Mail each value is a line like [=