Bugzilla – Attachment 152889 Details for
Bug 33667
'Copy to all libraries' doesn't work on editing holidays
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33667: Allow copying holidays to all libraries when editing
Bug-33667-Allow-copying-holidays-to-all-libraries-.patch (text/plain), 7.17 KB, created by
Marcel de Rooy
on 2023-06-30 08:25:57 UTC
(
hide
)
Description:
Bug 33667: Allow copying holidays to all libraries when editing
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-06-30 08:25:57 UTC
Size:
7.17 KB
patch
obsolete
>From 4674b767e45b632fb6a2b6fc6a64251cc6367f49 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Tue, 23 May 2023 15:29:12 +0300 >Subject: [PATCH] Bug 33667: Allow copying holidays to all libraries when > editing >Content-Type: text/plain; charset=utf-8 > >When editing an existing holiday and checking the >"copy to all libraires" checkbox, the other calendars won't >get updates. Allow this by first checking if holiday exists >in target calendar and if not, add it. > >To test: >1. Add unique holiday to branch A. >2. Don't check checkbox "Copy to all libraries". >3. Save. >4. Verify the holidays shows on all calendars as >a green box. >5. Edit the holiday, now check "Copy to all libraries" >and save. >=> Verify nothing has changed in other calendars: >only the green box, no holiday in list on the right >6. Edit again, make a change to description, >check checkbox, save. >=> Verify it's still not showing in the other >calendars. >9. Apply this patch. >10. Edit holiday again, check "Copy to all libraries" >and save. >=> Verify holiday is now added to other calendars. >11. Edit again, this time do not copy and save. >=> Verify holiday was edited just in branch A. >12. Again edit, check and save. >=> Verify holiday was edited in all libraries. > >Sponsored-by: Koha-Suomi Oy >Signed-off-by: Sam Lau <samalau@gmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/tools/holidays.tt | 2 +- > tools/exceptionHolidays.pl | 98 +++++++++++++++---- > 2 files changed, 78 insertions(+), 22 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index 0cade7a1c6..f03db0c0ff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -123,7 +123,7 @@ > <input type="checkbox" name="allBranches" id="allBranches" /> > <label for="allBranches">Copy changes to all libraries</label>. > <a href="#" class="helptext">[?]</a> >- <div class="hint">If checked, changes for this holiday will be copied to all libraries. If the holiday doesn't exists for a library, no change is made.</div> >+ <div class="hint">If checked, changes for this holiday will be copied to all libraries. If the holiday doesn't exists for a library, holiday is added to calendar. NOTE! This might overwrite existing holidays in other calendars.</div> > </li> > </ol> > <fieldset class="action"> >diff --git a/tools/exceptionHolidays.pl b/tools/exceptionHolidays.pl >index a96b1d0ebb..bdfd6d2313 100755 >--- a/tools/exceptionHolidays.pl >+++ b/tools/exceptionHolidays.pl >@@ -86,27 +86,83 @@ sub edit_holiday { > } > } > } elsif ($showoperation eq 'edit') { >- if($holidaytype eq 'weekday') { >- $calendar->ModWeekdayholiday(weekday => $weekday, >- title => $title, >- description => $description); >- } elsif ($holidaytype eq 'daymonth') { >- $calendar->ModDaymonthholiday(day => $day, >- month => $month, >- title => $title, >- description => $description); >- } elsif ($holidaytype eq 'ymd') { >- $calendar->ModSingleholiday(day => $day, >- month => $month, >- year => $year, >- title => $title, >- description => $description); >- } elsif ($holidaytype eq 'exception') { >- $calendar->ModExceptionholiday(day => $day, >- month => $month, >- year => $year, >- title => $title, >- description => $description); >+ if ( $holidaytype eq 'weekday' ) { >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ if ($isHoliday) { >+ $calendar->ModWeekdayholiday( >+ weekday => $weekday, >+ title => $title, >+ description => $description >+ ); >+ } >+ else { >+ $calendar->insert_week_day_holiday( >+ weekday => $weekday, >+ title => $title, >+ description => $description >+ ); >+ } >+ } >+ elsif ( $holidaytype eq 'daymonth' ) { >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ if ($isHoliday) { >+ $calendar->ModDaymonthholiday( >+ day => $day, >+ month => $month, >+ title => $title, >+ description => $description >+ ); >+ } >+ else { >+ $calendar->insert_day_month_holiday( >+ day => $day, >+ month => $month, >+ title => $title, >+ description => $description >+ ); >+ } >+ } >+ elsif ( $holidaytype eq 'ymd' ) { >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ if ($isHoliday) { >+ $calendar->ModSingleholiday( >+ day => $day, >+ month => $month, >+ year => $year, >+ title => $title, >+ description => $description >+ ); >+ } >+ else { >+ $calendar->insert_single_holiday( >+ day => $day, >+ month => $month, >+ year => $year, >+ title => $title, >+ description => $description >+ ); >+ } >+ } >+ elsif ( $holidaytype eq 'exception' ) { >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ if ($isHoliday) { >+ $calendar->ModExceptionholiday( >+ day => $day, >+ month => $month, >+ year => $year, >+ title => $title, >+ description => $description >+ ); >+ } >+ else { >+ $calendar->insert_exception_holiday( >+ day => $day, >+ month => $month, >+ year => $year, >+ title => $title, >+ description => $description >+ ); >+ } > } > } elsif ($showoperation eq 'delete') { > $calendar->delete_holiday(weekday => $weekday, >-- >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 33667
:
151562
|
151602
| 152889