From f57b4d375c9d3f95e46b726423e9bddbd8c21d0a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 30 May 2023 10:26:55 -0300 Subject: [PATCH] Bug 33864: Set default date in all acqcreateitem scenarios On b0aab2aeef9a025d3907d0b723b5ea71eaf94542 the flatpickr default to 'today' was restored, but only for acqcreateitem='ordering'. This patch moves the initialization to a different stop for broader reach. To test: 1. Have 3 baskets on with each setting: - create_item = 'cateloguing' - create_item = 'ordering' - create_item = 'receiving' 2. Close those baskets 3. Go to 'Receive shipments' 4. Choose things from the 3 baskets and then 'Receive selected' 5. Navigate through the different orders => FAIL: Only the one that has items created on ordering has the date filled by default 6. Apply this patch 7. Reload the page 8. Repeat 5 => SUCCESS: Dates are pre-filled! 9. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Andrew Nugged https://bugs.koha-community.org/show_bug.cgi?id=33846 --- .../intranet-tmpl/prog/en/modules/acqui/orderreceive.tt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 9f006ad862..6c78dd45e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -475,9 +475,6 @@ tr.append(''+display_string( 'item_type_id', item._strings, item.item_type_id )+''); tr.append(''+display_string( 'materials_notes', item._strings, item.materials_notes )+''); tr.append(''+(item.public_notes||'')+''); - - const fp = document.querySelector("#datereceived")._flatpickr; - fp.setDate(new Date()); }; var items_columns = [null, null, 'external_id', 'home_library_id', @@ -1138,7 +1135,10 @@ } var effective_create_items = row.basket.create_items || AcqCreateItem; - $("#datereceived").val(row.date_received||$date(new Date().toISOString())); + + // set today if no date_received in row + document.querySelector("#datereceived")._flatpickr.setDate(row.date_received||new Date()); + // restore the full tree $("#bookfund").html($funds_tree); $("#selected_bookfund") -- 2.40.1