MT#16777 Also fix start/end lnp handling in API

We only checked the csv part before. When individually creating
entries, it's borken as well.

Change-Id: Iaa04492c7beca757a499fa3705671304f77edfee
changes/74/5674/1
Andreas Granig 10 years ago
parent 3598a1dfc2
commit 7aecec0a9a

@ -222,8 +222,14 @@ sub POST :Allow {
resource => $resource,
form => $form,
);
$resource->{start} .= "T00:00:00";
$resource->{end} .= "T23:59:59";
$resource->{start} ||= undef;
if($resource->{start} && $resource->{start} =~ /^\d{4}-\d{2}-\d{2}$/) {
$resource->{start} .= 'T00:00:00';
}
$resource->{end} ||= undef;
if($resource->{end} && $resource->{end} =~ /^\d{4}-\d{2}-\d{2}$/) {
$resource->{end} .= 'T23:59:59';
}
my $carrier = $c->model('DB')->resultset('lnp_providers')->find($resource->{lnp_provider_id});
unless($carrier) {

@ -105,8 +105,15 @@ sub update_item {
return;
}
=cut
$resource->{start} .= "T00:00:00";
$resource->{end} .= "T23:59:59";
$resource->{start} ||= undef;
if($resource->{start} && $resource->{start} =~ /^\d{4}-\d{2}-\d{2}$/) {
$resource->{start} .= 'T00:00:00';
}
$resource->{end} ||= undef;
if($resource->{end} && $resource->{end} =~ /^\d{4}-\d{2}-\d{2}$/) {
$resource->{end} .= 'T23:59:59';
}
$item->update($resource);
$item->discard_changes; # agranig: otherwise start/end is not updated!?

Loading…
Cancel
Save