Bugzilla – Attachment 146587 Details for
Bug 32949
Smart-rules prefills junk date on page load
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt
Bug-32949-Do-not-fill-form-with-wrong-shadow-value.patch (text/plain), 3.21 KB, created by
Owen Leonard
on 2023-02-13 15:51:34 UTC
(
hide
)
Description:
Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2023-02-13 15:51:34 UTC
Size:
3.21 KB
patch
obsolete
>From 897fb2de7267dd04525927f4c77d607fca6c3d74 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Sat, 8 Oct 2022 15:09:09 +0300 >Subject: [PATCH] Bug 32949: Do not fill form with wrong shadow value to avoid > data loss in smart-rules.tt > >When you edit the rule without initializing flatpickr plugin, if you >press the save button it will overwrite the date with an empty value, >making you lose the dates. This happens because flatpickr plugin's >shadow value is not loaded if it's not initialized with a click on that >date field. This patch fixes it. > >1st Code commit text: To reproduce: >1. Head over to the smart rules admin page and create/use existing rule > for certain item type/category. >2. Set "hard due date" and "No automatic renewal after (hard limit)" of > that rule to a certain date and save. >3. Edit that same rule again, but this time just save it without any > changes. The data for hard due date and hard limit will get lost and > will be set as "None defined". >4. Apply the patch. >5. Repeat steps 2 and 3. Ensure that the data loss is not happening > anymore. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 2fba8747e4..caf98393c4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -1484,13 +1484,18 @@ > }else { > input_value = itm.split(' ')[1]; > } >- $(current_column).find("input[type='text']").val(input_value); >+ const fp = $(current_column).find("input.flatpickr").get(0)._flatpickr; >+ fp.setDate(input_value, true, '[% IF ( dateformat == "us" ) %]m/d/Y[% ELSIF ( dateformat == "metric" ) %]d/m/Y[% ELSIF ( dateformat == "dmydot" ) %]d.m.Y[% ELSE %]Y-m-d[% END %]'); > $(current_column).find("select").val(select_value); > } else if ( i == 16 ) { > // specific processing for cap_fine_to_replacement_price > var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']"); > $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') ); > $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') ); >+ } else if ( i == 25 ) { >+ // specific processing for the hard limit for the automatic renewal after >+ const fp = $(current_column).find("input.flatpickr").get(0)._flatpickr; >+ fp.setDate(itm, true, '[% IF ( dateformat == "us" ) %]m/d/Y[% ELSIF ( dateformat == "metric" ) %]d/m/Y[% ELSIF ( dateformat == "dmydot" ) %]d.m.Y[% ELSE %]Y-m-d[% END %]'); > } else { > $(current_column).find("input[type='text']").val(itm); > // select the corresponding option >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32949
:
146584
|
146587
|
177678
|
177724
|
177925