Bugzilla – Attachment 138663 Details for
Bug 31264
CalendarFirstDayOfWeek not taken into account when configuring curbside pickups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31264: Curbside pickups - Take CalendarFirstDayOfWeek into account
Bug-31264-Curbside-pickups---Take-CalendarFirstDay.patch (text/plain), 6.78 KB, created by
Martin Renvoize (ashimema)
on 2022-08-05 10:54:38 UTC
(
hide
)
Description:
Bug 31264: Curbside pickups - Take CalendarFirstDayOfWeek into account
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-05 10:54:38 UTC
Size:
6.78 KB
patch
obsolete
>From eada455870461cf872a3b459e3134585e2d4fa90 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 31 Jul 2022 09:16:13 +0200 >Subject: [PATCH] Bug 31264: Curbside pickups - Take CalendarFirstDayOfWeek > into account > >We need to take the pref CalendarFirstDayOfWeek into account to display >the days on the curbside pickups admin page. > >Test plan: >Turn on the CurbsidePickup pref >Set CalendarFirstDayOfWeek to Sunday >Go to the curbside pickups admin page, add new slots, and confirm that >Sunday is displayed first. >Try again with CalendarFirstDayOfWeek set to Monday and Saturday. > >Sponsored-by: Association KohaLa - https://koha-fr.org/ > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/modules/admin/curbside_pickup.tt | 60 ++++++++++--------- > 1 file changed, 32 insertions(+), 28 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt >index 4914aceb9b..1f4022963f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt >@@ -4,6 +4,7 @@ > [% USE Asset %] > [% SET footerjs = 1 %] > [% USE TablesSettings %] >+[% PROCESS 'i18n.inc' %] > [% INCLUDE 'doc-head-open.inc' %] > <title> > Curbside pickup › Administration › Koha >@@ -141,20 +142,19 @@ > <ol> > <li> > <label>New slot:</label> >+ [% days = { "0" = t("Sunday"), "1" = t("Monday"), "2" = t("Tuesday"), "3" = t("Wednesday"), "4" = t("Thursday"), "5" = t("Friday"), "6" = t("Saturday") } %] >+ [% SET CalendarFirstDayOfWeek = Koha.Preference("CalendarFirstDayOfWeek") %] > <div> > <select id="day-[% l.branchcode | html %]"> >- <option value="0">Sunday</option> >- <option value="1">Monday</option> >- <option value="2">Tuesday</option> >- <option value="3">Wednesday</option> >- <option value="4">Thursday</option> >- <option value="5">Friday</option> >- <option value="6">Saturday</option> >+ [% FOR i IN [0, 1, 2, 3, 4, 5, 6] %] >+ [% SET d = ( CalendarFirstDayOfWeek + i ) % 7 %] >+ <option value="[% d | html %]">[% days.$d | html %]</option> >+ [% END %] >+ </select> > <span> > From <input type="text" size="5" class="noEnterSubmit" id="new-start-[% l.branchcode | html %]" placeholder="00:00" /> > to <input type="text" size="5" class="noEnterSubmit" id="new-end-[% l.branchcode | html %]" placeholder="23:55" /> > </span> >- </select> > <input type="button" class="add-new-slot" data-branchcode="[% l.branchcode | html %]" value="Add" /> > <span id="invalid_slot_warning" style="display:none;">Invalid format for this new slot, must be '00:00 to 23:59'.</span> > </div> >@@ -228,43 +228,47 @@ > > $("#conf-"+branchcode).find(".pickup_hours li").remove(); > >- Object.keys(slots_per_day).forEach(function(day){ >- let li_node = $('<li><label>'+get_day_lib(day)+'<label></li>'); >- slots_per_day[day].forEach(function(slot) { >- let span_node = $('<span class="pickup-slot"></span>'); >- span_node.append('<input type="hidden" name="pickup-slot-'+branchcode+'" value="'+slot+'"/>'); >- span_node.append('<span>'+format_slot(slot)+'</span>'); >- >- let delete_link = $('<a href="#" on> <i class="fa fa-trash" aria-hidden="true" title="%s"></i>'.format(_("Remove this slot"))).on('click', function(e){ e.preventDefault(); delete_slot($(this).closest('li'), branchcode); }); >- span_node.append(delete_link); >- >- span_node.appendTo(li_node); >+ const CalendarFirstDayOfWeek = [% Koha.Preference("CalendarFirstDayOfWeek") || 0 | html %]; >+ [0, 1, 2, 3, 4, 5, 6] >+ .map(i => ( CalendarFirstDayOfWeek + i ) % 7) >+ .filter(d => d in slots_per_day) >+ .map( day => { >+ let li_node = $('<li><label>'+get_day_lib(day)+'<label></li>'); >+ slots_per_day[day].forEach(function(slot) { >+ let span_node = $('<span class="pickup-slot"></span>'); >+ span_node.append('<input type="hidden" name="pickup-slot-'+branchcode+'" value="'+slot+'"/>'); >+ span_node.append('<span>'+format_slot(slot)+'</span>'); >+ >+ let delete_link = $('<a href="#" on> <i class="fa fa-trash" aria-hidden="true" title="%s"></i>'.format(_("Remove this slot"))).on('click', function(e){ e.preventDefault(); delete_slot($(this).closest('li'), branchcode); }); >+ span_node.append(delete_link); >+ >+ span_node.appendTo(li_node); >+ }); >+ li_node.appendTo($("#conf-"+branchcode).find(".pickup_hours")); > }); >- li_node.appendTo($("#conf-"+branchcode).find(".pickup_hours")); >- }); > } > function get_day_lib(day){ > let lib; > switch(day){ >- case '0': >+ case 0: > lib = _("Sunday"); > break; >- case '1': >+ case 1: > lib = _("Monday"); > break; >- case '2': >+ case 2: > lib = _("Tuesday"); > break; >- case '3': >+ case 3: > lib = _("Wednesday"); > break; >- case '4': >+ case 4: > lib = _("Thursday"); > break; >- case '5': >+ case 5: > lib = _("Friday"); > break; >- case '6': >+ case 6: > lib = _("Saturday"); > break; > } >-- >2.20.1
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 31264
:
138404
|
138422
| 138663