Lines 690-703
sub copy_to_branch {
Link Here
|
690 |
my $today = sprintf ISO_DATE_FORMAT, $y,$m,$d; |
690 |
my $today = sprintf ISO_DATE_FORMAT, $y,$m,$d; |
691 |
|
691 |
|
692 |
my $wdh = $self->get_week_days_holidays; |
692 |
my $wdh = $self->get_week_days_holidays; |
693 |
$target_calendar->insert_week_day_holiday( weekday => $_, %{ $wdh->{$_} } ) |
693 |
my $target_wdh = $target_calendar->get_week_days_holidays; |
694 |
foreach keys %$wdh; |
694 |
foreach my $key (keys %$wdh) { |
695 |
$target_calendar->insert_day_month_holiday(%$_) |
695 |
unless (grep { $_ eq $key } keys %$target_wdh) { |
696 |
foreach values %{ $self->get_day_month_holidays }; |
696 |
$target_calendar->insert_week_day_holiday( weekday => $key, %{ $wdh->{$key} } ) |
697 |
$target_calendar->insert_exception_holiday(%$_) |
697 |
} |
698 |
foreach grep { $_->{date} gt $today } values %{ $self->get_exception_holidays }; |
698 |
} |
699 |
$target_calendar->insert_single_holiday(%$_) |
699 |
|
700 |
foreach grep { $_->{date} gt $today } values %{ $self->get_single_holidays }; |
700 |
my $dmh = $self->get_day_month_holidays; |
|
|
701 |
my $target_dmh = $target_calendar->get_day_month_holidays; |
702 |
foreach my $values (values %$dmh) { |
703 |
unless (grep { $_->{day} eq $values->{day} && $_->{month} eq $values->{month} } values %$target_dmh) { |
704 |
$target_calendar->insert_day_month_holiday(%{ $values }); |
705 |
} |
706 |
} |
707 |
|
708 |
my $exception_holidays = $self->get_exception_holidays; |
709 |
my $target_exceptions = $target_calendar->get_exception_holidays; |
710 |
foreach my $values ( grep {$_->{date} gt $today} values %{ $exception_holidays }) { |
711 |
unless ( grep { $_->{date} eq $values->{date} } values %$target_exceptions) { |
712 |
$target_calendar->insert_exception_holiday(%{ $values }); |
713 |
} |
714 |
} |
715 |
|
716 |
my $single_holidays = $self->get_single_holidays; |
717 |
my $target_singles = $target_calendar->get_single_holidays; |
718 |
foreach my $values ( grep {$_->{date} gt $today} values %{ $single_holidays }) { |
719 |
unless ( grep { $_->{date} eq $values->{date} } values %$target_singles){ |
720 |
$target_calendar->insert_single_holiday(%{ $values }); |
721 |
} |
722 |
} |
701 |
|
723 |
|
702 |
return 1; |
724 |
return 1; |
703 |
} |
725 |
} |
704 |
- |
|
|