diff --git a/changelog/54_UNRELEASED_2019-xx-xx.md b/changelog/54_UNRELEASED_2019-xx-xx.md index ac047edd..e55edefd 100644 --- a/changelog/54_UNRELEASED_2019-xx-xx.md +++ b/changelog/54_UNRELEASED_2019-xx-xx.md @@ -5,7 +5,8 @@ - Fixed that recipes were displayed without ingredients if the total recipe count was > 100 ### Chores improvements -- Added a "period interval" option per chore to have more flexible schedules (possible for the daily/weekly/monthly schedules, means "schedule this chore only every x days/weeks/months" to have for example biweekly schedules) +- Added a new period type "yearly" (for yearly schedules) +- Added a "period interval" option per chore to have more flexible schedules (possible for the daily/weekly/monthly/yearly schedules, means "schedule this chore only every x days/weeks/months" to have for example biweekly schedules) ### General & other improvements - New Input shorthands for date fields to increase/decrease the date by 1 month/year (shift + arrow keys, see the full list [here](https://github.com/grocy/grocy#input-shorthands-for-date-fields)) diff --git a/localization/chore_period_types.pot b/localization/chore_period_types.pot index e80ef12d..07ce0035 100644 --- a/localization/chore_period_types.pot +++ b/localization/chore_period_types.pot @@ -26,3 +26,6 @@ msgstr "" msgid "monthly" msgstr "" + +msgid "yearly" +msgstr "" diff --git a/localization/strings.pot b/localization/strings.pot index af719145..c28da37f 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1558,3 +1558,9 @@ msgstr "" msgid "This means the next execution of this chore should only be scheduled every %s months" msgstr "" + +msgid "This means the next execution of this chore is scheduled 1 year after the last execution" +msgstr "" + +msgid "This means the next execution of this chore should only be scheduled every %s years" +msgstr "" diff --git a/migrations/0094.sql b/migrations/0094.sql index bba7340e..c903a5aa 100644 --- a/migrations/0094.sql +++ b/migrations/0094.sql @@ -34,6 +34,7 @@ SELECT WHEN period_config LIKE '%saturday%' THEN DATETIME(IFNULL(MAX(l.tracked_time), DATETIME('now', 'localtime')), '1 days', '+' || CAST((h.period_interval - 1) * 7 AS TEXT) || ' days', 'weekday 6') END WHEN 'monthly' THEN DATETIME(IFNULL(MAX(l.tracked_time), DATETIME('now', 'localtime')), '+' || CAST(h.period_interval AS TEXT) || ' month', 'start of month', '+' || CAST(h.period_days - 1 AS TEXT) || ' day') + WHEN 'yearly' THEN DATETIME(IFNULL(MAX(l.tracked_time), DATETIME('now', 'localtime')), '+' || CAST(h.period_interval AS TEXT) || ' years') END AS next_estimated_execution_time, h.track_date_only, h.rollover, diff --git a/public/viewjs/choreform.js b/public/viewjs/choreform.js index ee577e22..78ceba52 100644 --- a/public/viewjs/choreform.js +++ b/public/viewjs/choreform.js @@ -157,6 +157,11 @@ $('.input-group-chore-period-type').on('change', function(e) $("#period_days").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", "31")); $('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s months', periodInterval.toString())); } + else if (periodType === 'yearly') + { + $('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled 1 year after the last execution')); + $('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s years', periodInterval.toString())); + } Grocy.FrontendHelpers.ValidateForm('chore-form'); }); diff --git a/services/ChoresService.php b/services/ChoresService.php index c82cfe58..fef9e0a5 100644 --- a/services/ChoresService.php +++ b/services/ChoresService.php @@ -11,6 +11,7 @@ class ChoresService extends BaseService const CHORE_PERIOD_TYPE_DAILY = 'daily'; const CHORE_PERIOD_TYPE_WEEKLY = 'weekly'; const CHORE_PERIOD_TYPE_MONTHLY = 'monthly'; + const CHORE_PERIOD_TYPE_YEARLY = 'yearly'; const CHORE_ASSIGNMENT_TYPE_NO_ASSIGNMENT = 'no-assignment'; const CHORE_ASSIGNMENT_TYPE_WHO_LEAST_DID_FIRST = 'who-least-did-first'; diff --git a/views/choreform.blade.php b/views/choreform.blade.php index f4ca391e..aa3dee66 100644 --- a/views/choreform.blade.php +++ b/views/choreform.blade.php @@ -94,7 +94,7 @@ 'min' => '1', 'additionalCssClasses' => 'input-group-chore-period-type', 'invalidFeedback' => $__t('This cannot be lower than %s', '1'), - 'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly', + 'additionalGroupCssClasses' => 'period-type-input period-type-daily period-type-weekly period-type-monthly period-type-yearly', 'hintId' => 'chore-period-interval-info' ))