From 8fa88f3e98e7b56fd456557634ca886bb25263b3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 21 Oct 2022 12:00:22 +0200 Subject: [PATCH] Bug 32030: Fix date handling - conflicts with bug 30718 Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../prog/js/vue/components/ERM/AgreementPeriods.vue | 11 ----------- .../js/vue/components/ERM/AgreementsFormAdd.vue | 6 ------ .../prog/js/vue/components/ERM/AgreementsList.vue | 4 ++-- .../components/ERM/EHoldingsLocalTitlesFormAdd.vue | 5 ----- .../ERM/EHoldingsLocalTitlesFormAddResources.vue | 8 -------- .../prog/js/vue/components/ERM/LicensesFormAdd.vue | 13 +------------ 6 files changed, 3 insertions(+), 44 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementPeriods.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementPeriods.vue index a9d52a7eb7..ca425a5708 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementPeriods.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementPeriods.vue @@ -73,22 +73,11 @@ export default { data() { return { fp_config: flatpickr_defaults, - dates_fixed: 0, } }, props: { periods: Array }, - beforeCreate() { - if (!this.dates_fixed) { - this.periods.forEach(p => { - p.started_on = $date(p.started_on) - p.ended_on = $date(p.ended_on) - p.cancellation_deadline = $date(p.cancellation_deadline) - }) - this.dates_fixed = 1 - } - }, methods: { addPeriod() { this.periods.push({ diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue index 28e0fa92f3..98cd8829e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue @@ -304,12 +304,6 @@ export default { agreement.vendor_id = null } - agreement.periods.forEach(p => { - p.started_on = $date_to_rfc3339(p.started_on) - p.ended_on = p.ended_on ? $date_to_rfc3339(p.ended_on) : null - p.cancellation_deadline = p.cancellation_deadline ? $date_to_rfc3339(p.cancellation_deadline) : null - }) - agreement.periods = agreement.periods.map(({ agreement_id, agreement_period_id, ...keepAttrs }) => keepAttrs) agreement.user_roles = agreement.user_roles.map(({ patron, patron_str, ...keepAttrs }) => keepAttrs) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue index 432ed92ba9..b516e87661 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue @@ -60,7 +60,7 @@ export default { }, data: function () { return { - fp_config: flatpickr_defaults, dates_fixed: 0, + fp_config: flatpickr_defaults, agreements: [], initialized: false, filters: { @@ -84,7 +84,7 @@ export default { datatable_url() { let url = '/api/v1/erm/agreements' if (this.filters.by_expired) - url += '?max_expiration_date=' + $date_to_rfc3339(this.filters.max_expiration_date) + url += '?max_expiration_date=' + this.filters.max_expiration_date return url } }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAdd.vue index 9afea2ef56..e8e8e1fcc2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAdd.vue @@ -483,11 +483,6 @@ export default { delete title.title_id delete title.biblio_id - title.resources.forEach(r => { - r.started_on = r.started_on ? $date_to_rfc3339(r.started_on) : null - r.ended_on = r.ended_on ? $date_to_rfc3339(r.ended_on) : null - }) - // Cannot use the map/keepAttrs because of the reserved keywork 'package' title.resources.forEach(function (e) { delete e.package; delete e.resource_id }) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAddResources.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAddResources.vue index 07a5529760..4d8153f107 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAddResources.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormAddResources.vue @@ -107,18 +107,10 @@ export default { return { packages: [], fp_config: flatpickr_defaults, - dates_fixed: 0, } }, beforeCreate() { fetchLocalPackages().then((packages) => this.packages = packages) - if (!this.dates_fixed) { - this.resources.forEach(r => { - r.started_on = $date(r.started_on) - r.ended_on = $date(r.ended_on) - }) - this.dates_fixed = 1 - } }, methods: { addPackage() { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue index 9c453fc2b5..1d8c3d6cd0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue @@ -153,8 +153,7 @@ export default { }, data() { return { - fp_config: flatpickr_defaults, dates_fixed: 0, - + fp_config: flatpickr_defaults, license: { license_id: null, name: '', @@ -169,13 +168,6 @@ export default { initialized: false, } }, - beforeUpdate() { - if (!this.dates_fixed) { - this.license.started_on = $date(this.license.started_on) - this.license.ended_on = $date(this.license.ended_on) - this.dates_fixed = 1 - } - }, beforeRouteEnter(to, from, next) { next(vm => { if (to.params.license_id) { @@ -209,9 +201,6 @@ export default { license.vendor_id = null } - license.started_on = license.started_on ? $date_to_rfc3339(license.started_on) : null - license.ended_on = license.ended_on ? $date_to_rfc3339(license.ended_on) : null - license.documents = license.documents.map(({ file_type, uploaded_on, ...keepAttrs }) => keepAttrs) const options = { -- 2.39.5