Bug 31665: Set today date for date cataloguing plugin
dateaccessioned.pl must pick today's date when the input gets the focus
on.
Test plan:
Edit an item, or create a new one.
Confirm that today's date is prefilled into the date's input when it's
empty and that it gets the focus on
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Michael Adamyk <madamyk@ckls.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 140493faf7)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
parent
4efed95bd4
commit
565bb08b10
|
|
@ -21,24 +21,21 @@
|
|||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Koha::DateUtils qw( flatpickr_date_format );
|
||||
|
||||
my $builder = sub {
|
||||
my ( $params ) = @_;
|
||||
my $function_name = $params->{id};
|
||||
|
||||
my $dateformat = flatpickr_date_format();
|
||||
|
||||
my $res = <<END_OF_JS;
|
||||
<script>
|
||||
/* from: cataloguing/value_builder/dateaccessioned.pl */
|
||||
|
||||
\$(document).ready(function(){
|
||||
\$("#$function_name").flatpickr({
|
||||
altInput: true,
|
||||
altFormat: "$dateformat",
|
||||
altInputClass: "input_marceditor flatpickr-input",
|
||||
dateFormat: "Y-m-d"
|
||||
onOpen: function(selectedDates, dateStr, instance) {
|
||||
if (dateStr == '') {
|
||||
instance.setDate(new Date());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue