@@ -, +, @@ - Special holidays - Exception holidays --- .../data/mysql/de-DE/optional/sample_holidays.sql | 2 + .../data/mysql/de-DE/optional/sample_holidays.txt | 4 ++ .../data/mysql/en/optional/sample_holidays.sql | 2 + .../data/mysql/en/optional/sample_holidays.txt | 6 +++- .../data/mysql/es-ES/optional/sample_holidays.sql | 2 + .../data/mysql/es-ES/optional/sample_holidays.txt | 6 +++- .../mysql/fr-FR/2-Optionel/sample_holidays.sql | 6 ++++ .../mysql/fr-FR/2-Optionel/sample_holidays.txt | 8 +++++ .../data/mysql/it-IT/necessari/sample_holidays.sql | 4 ++- .../data/mysql/it-IT/necessari/sample_holidays.txt | 4 ++ .../mysql/nb-NO/2-Valgfritt/sample_holidays.sql | 2 + .../mysql/nb-NO/2-Valgfritt/sample_holidays.txt | 7 ++++ .../data/mysql/pl-PL/optional/sample_holidays.sql | 2 + .../data/mysql/pl-PL/optional/sample_holidays.txt | 4 ++ installer/data/mysql/ru-RU/optional/holidays.sql | 2 + installer/data/mysql/ru-RU/optional/holidays.txt | 9 +++++- installer/data/mysql/uk-UA/optional/holidays.sql | 6 ++++ installer/data/mysql/uk-UA/optional/holidays.txt | 8 +++++ t/db_dependent/Holidays.t | 32 +++++++++++++++++++- 19 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt --- a/installer/data/mysql/de-DE/optional/sample_holidays.sql +++ a/installer/data/mysql/de-DE/optional/sample_holidays.sql @@ -3,3 +3,5 @@ INSERT INTO `repeatable_holidays` VALUES (3,'',NULL,1,1,'','Neujahr'), (4,'',NULL,25,12,'','1. Weihnachtsfeiertag'), (5,'',NULL,26,12,'','2. Weihnachtsfeiertag'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/de-DE/optional/sample_holidays.txt +++ a/installer/data/mysql/de-DE/optional/sample_holidays.txt @@ -2,3 +2,7 @@ Beispiele für Schließtage: Sonntag 1. und 2. Weihnachtsfeiertag Neujahr +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/en/optional/sample_holidays.sql +++ a/installer/data/mysql/en/optional/sample_holidays.sql @@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES (2,'MPL',0,NULL,NULL,'','Sundays'), (3,'MPL',NULL,1,1,'','New Year\'s Day'), (4,'MPL',NULL,25,12,'','Christmas'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/en/optional/sample_holidays.txt +++ a/installer/data/mysql/en/optional/sample_holidays.txt @@ -1,4 +1,8 @@ -Sample holidays: +Sample repeatable holidays: Sundays Christmas New Year's +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/es-ES/optional/sample_holidays.sql +++ a/installer/data/mysql/es-ES/optional/sample_holidays.sql @@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES (2,'',0,NULL,NULL,'','Sundays'), (3,'',NULL,1,1,'','New Year\'s Day'), (4,'',NULL,25,12,'','Christmas'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/es-ES/optional/sample_holidays.txt +++ a/installer/data/mysql/es-ES/optional/sample_holidays.txt @@ -1,4 +1,8 @@ -Feriados de ejemplo: +Feriados repetibles de ejemplo: Domingos Navidad Año nuevo +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql +++ a/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql @@ -0,0 +1,6 @@ +INSERT INTO `repeatable_holidays` VALUES +(2,'MPL',0,NULL,NULL,'','Sundays'), +(3,'MPL',NULL,1,1,'','New Year\'s Day'), +(4,'MPL',NULL,25,12,'','Christmas'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt +++ a/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt @@ -0,0 +1,8 @@ +Sample repeatable holidays: + Sundays + Christmas + New Year's +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/it-IT/necessari/sample_holidays.sql +++ a/installer/data/mysql/it-IT/necessari/sample_holidays.sql @@ -4,5 +4,7 @@ INSERT INTO `repeatable_holidays` VALUES (2,'',0,NULL,NULL,'','Domenica'), (3,'',NULL,1,1,'','Nuovo anno'), (4,'',NULL,25,12,'','Natale'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); -SET FOREIGN_KEY_CHECKS=1; +SET FOREIGN_KEY_CHECKS=1;INSERT INTO `repeatable_holidays` VALUES --- a/installer/data/mysql/it-IT/necessari/sample_holidays.txt +++ a/installer/data/mysql/it-IT/necessari/sample_holidays.txt @@ -2,3 +2,7 @@ Esempio vacanze: Domenica Natale Nuovo anno +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql +++ a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql @@ -26,3 +26,5 @@ INSERT INTO `repeatable_holidays` VALUES (5,'',NULL,17,5,'','17. mai'), (6,'',NULL,25,12,'','1. juledag'), (7,'',NULL,26,12,'','2. juledag'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt +++ a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt @@ -1, +1,8 @@ Eksempler på fridager. + Sundays + Christmas + New Year's +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/pl-PL/optional/sample_holidays.sql +++ a/installer/data/mysql/pl-PL/optional/sample_holidays.sql @@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES (2,'',0,NULL,NULL,'','Niedziele'), (3,'',NULL,1,1,'','Nowy Rok'), (4,'',NULL,25,12,'','Boże Narodzenie'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/pl-PL/optional/sample_holidays.txt +++ a/installer/data/mysql/pl-PL/optional/sample_holidays.txt @@ -2,3 +2,7 @@ Przykładowe dni wolne: Niedziele Boże Narodzenie Nowy Rok +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/ru-RU/optional/holidays.sql +++ a/installer/data/mysql/ru-RU/optional/holidays.sql @@ -21,3 +21,5 @@ VALUES (7, '',NULL,2,5,'','День Труда'); INSERT INTO `repeatable_holidays` (`id`, `branchcode`, `weekday`, `day`, `month`, `title`, `description`) VALUES (8, '',NULL,9,5,'','День Победы'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/ru-RU/optional/holidays.txt +++ a/installer/data/mysql/ru-RU/optional/holidays.txt @@ -1, +1,8 @@ -Повторяемые праздники. +Повторяемые праздники.: + Sundays + Christmas + New Year's +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/installer/data/mysql/uk-UA/optional/holidays.sql +++ a/installer/data/mysql/uk-UA/optional/holidays.sql @@ -22,3 +22,9 @@ INSERT INTO `repeatable_holidays` (`branchcode`, `weekday`, `day`, `month`, `tit ('LNSL', NULL, 28, 6, '', 'День Конституції'), ('LNSL', NULL, 24, 8, '', 'День Незалежності'); +INSERT INTO `repeatable_holidays` VALUES +('','MPL',0,NULL,NULL,'','Sundays'), +('','MPL',NULL,1,1,'','New Year\'s Day'), +('','MPL',NULL,25,12,'','Christmas'); +INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); +INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); --- a/installer/data/mysql/uk-UA/optional/holidays.txt +++ a/installer/data/mysql/uk-UA/optional/holidays.txt @@ -1, +1,9 @@ Офіційні повторювальні свята в Україні. +Sample repeatable holidays: + Sundays + Christmas + New Year's +Sample single holidays: + 16-11-2012 +Sample holiday exceptions: + 11-11-2012 (Sunday exception) --- a/t/db_dependent/Holidays.t +++ a/t/db_dependent/Holidays.t @@ -5,7 +5,7 @@ use DateTime; use DateTime::TimeZone; use C4::Context; -use Test::More tests => 8; +use Test::More tests => 11; BEGIN { use_ok('Koha::Calendar'); } BEGIN { use_ok('C4::Calendar'); } @@ -39,7 +39,37 @@ my $newyear = DateTime->new( day => 1, ); +my $special_holiday = DateTime->new( + year => 2012, + month => 11, + day => 16 +); + +my $exception_sunday = DateTime->new( + year => 2012, + month => 11, + day => 11 +); + is( $koha_calendar->is_holiday($sunday), 1, 'Sunday is a closed day' ); is( $koha_calendar->is_holiday($monday), 0, 'Monday is not a closed day' ); is( $koha_calendar->is_holiday($christmas), 1, 'Christmas is a closed day' ); is( $koha_calendar->is_holiday($newyear), 1, 'New Years day is a closed day' ); +is( $koha_calendar->is_holiday($special_holiday), 1, 'Sample single holiday is a closed day' ); +is( $koha_calendar->is_holiday($exception_sunday), 0, 'Sample sunday exception is not a closed day' ); + + +# is_holiday truncates the date to day as that's +# how they are stored/retreived from db. This is a +# regression test for a bug introduced by 8966, fixed in 8800 +my $special_holiday_time = DateTime->new( + year => 2012, + month => 11, + day => 16, + hour => 11, + minute => 2 +); + +is( $koha_calendar->is_holiday($special_holiday_time), + $koha_calendar->is_holiday($special_holiday) , + 'is_holiday should truncate the date for holiday validation' ); --