Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The attached patch allows you to 'copy' the hours from the previous day to the selected day (e.g. Tuesday hours are same as Monday). Comes in handy when you have several blocks per day.
Note: the enhancement is only available in Office hours (week) widget.
Comments
Comment #2
abrlam CreditAttribution: abrlam commentedComment #4
johnvThanks, I committed your version. It has 1 flaw, however: the 2nd and later entries are not 'unhidden', after copying the values.
Comment #7
abrlam CreditAttribution: abrlam commentedThank you johnv for the commit! I'll see what I can do with the 'unhidden' issue.
Comment #8
abrlam CreditAttribution: abrlam commentedThe attached patch should fix the 'unhidden' issue in #4. If it looks good to you, could you commit it? Thanks.
Comment #9
abrlam CreditAttribution: abrlam commentedComment #11
johnvThanks, works perfectly.
Comment #13
carl@west-tec.com CreditAttribution: carl@west-tec.com as a volunteer commentedThe copy-button "Same as above" is hidden for day=0 --> Sunday.
The issue is that Sunday is shown as last day in the list; on the first row we see Monday.
Many shops have opening hours in the week, and different in the weekend. In these cases the logical way of working is :
1. Encode opening hours on Monday and copy them till friday
2. Encode opening hours on saterday and copy them for sunday.
in the patch you find altering code on the patch to make this happen.
Comment #14
johnvCarl, your patch is not against the latest dev version. See commit #6, which already addresses (part of) your issue . Your usability problem can be addressed by setting the 'first day of week' to monday or Saturday in the Field Settings. (Formatter and Widget have separate settings in D7).
Perhaps it is a good idea to change the 'same as above' link to 'same as yesterday/previous day' and let day 1 copy from day 7.
Comment #17
johnvAbove commits implement the idea from carl #13.
Comment #20
myha CreditAttribution: myha commentedAdded functionality to copy also comment values if comment field exists.
Comment #21
johnv@myha, please add the patch to a new issue, or the patch will be lost. The issue is alrady closed for a long time.
Comment #22
SRizo CreditAttribution: SRizo commentedCase once we want to prepopulate first day(Monday/Sunday) for rest days with one click. Patch attached.
Comment #23
SRizo CreditAttribution: SRizo commented