my (@out,@overdue);
for my $c (@$circs) {
- my $due_dt = $parser->parse_datetime( clense_ISO8601( $c->due_date ) );
+ my $due_dt = $parser->parse_datetime( cleanse_ISO8601( $c->due_date ) );
my $due = $due_dt->epoch;
if ($due < DateTime->today->epoch) {
my (@out,@overdue);
for my $c (@$circs) {
if( $c->due_date ) {
- my $due_dt = $parser->parse_datetime( clense_ISO8601( $c->due_date ) );
+ my $due_dt = $parser->parse_datetime( cleanse_ISO8601( $c->due_date ) );
my $due = $due_dt->epoch;
if ($due < DateTime->today->epoch) {
push @overdue, $c->id;
if( $backdate ) {
# make it look like the circ stopped at the cliams returned time
- $circ->stop_fines_time(clense_ISO8601($backdate));
+ $circ->stop_fines_time(cleanse_ISO8601($backdate));
my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($e, $circ, $backdate);
return $evt if $evt;
}
$backdate and $circ->checkin_time;
# update the checkin and stop_fines times to reflect the new backdate
- $circ->stop_fines_time(clense_ISO8601($backdate));
- $circ->checkin_time(clense_ISO8601($backdate));
+ $circ->stop_fines_time(cleanse_ISO8601($backdate));
+ $circ->checkin_time(cleanse_ISO8601($backdate));
$e->update_action_circulation($circ) or return $e->die_event;
# now void the overdues "erased" by the back-dating
or return $e->die_event;
return $e->die_event unless $e->allowed('CIRC_OVERRIDE_DUE_DATE', $circ->circ_lib);
- $date = clense_ISO8601($date);
+ $date = cleanse_ISO8601($date);
$circ->due_date($date);
$e->update_action_circulation($circ) or return $e->die_event;
$e->commit;
}
if( $use_time ne 'now' ) {
- $use_time = clense_ISO8601($use_time);
+ $use_time = cleanse_ISO8601($use_time);
$logger->debug("in_house_use setting use time to $use_time");
}
if($auto_renew_intvl) {
my $intvl_seconds = OpenSRF::Utils->interval_to_seconds($auto_renew_intvl);
- my $checkout_time = DateTime::Format::ISO8601->new->parse_datetime( clense_ISO8601($old_circ->xact_start) );
+ my $checkout_time = DateTime::Format::ISO8601->new->parse_datetime( cleanse_ISO8601($old_circ->xact_start) );
if(DateTime->now > $checkout_time->add(seconds => $intvl_seconds)) {
$payload->{auto_renew} = 1;
# if the user provided an overiding checkout time,
# (e.g. the checkout really happened several hours ago), then
# we apply that here. Does this need a perm??
- $circ->xact_start(clense_ISO8601($self->checkout_time))
+ $circ->xact_start(cleanse_ISO8601($self->checkout_time))
if $self->checkout_time;
# if a patron is renewing, 'requestor' will be the patron
return $self->bail_on_events($self->editor->event)
unless $self->editor->allowed('CIRC_OVERRIDE_DUE_DATE', $self->circ_lib);
- $circ->due_date(clense_ISO8601($self->due_date));
+ $circ->due_date(cleanse_ISO8601($self->due_date));
} else {
$booking_ses->disconnect;
my $dt_parser = DateTime::Format::ISO8601->new;
- my $due_date = $dt_parser->parse_datetime( clense_ISO8601($circ->due_date) );
+ my $due_date = $dt_parser->parse_datetime( cleanse_ISO8601($circ->due_date) );
for my $bid (@$bookings) {
my $booking = $self->editor->retrieve_booking_reservation( $bid );
- my $booking_start = $dt_parser->parse_datetime( clense_ISO8601($booking->start_time) );
- my $booking_end = $dt_parser->parse_datetime( clense_ISO8601($booking->end_time) );
+ my $booking_start = $dt_parser->parse_datetime( cleanse_ISO8601($booking->start_time) );
+ my $booking_end = $dt_parser->parse_datetime( cleanse_ISO8601($booking->end_time) );
return $self->bail_on_events( OpenILS::Event->new('COPY_RESERVED') )
if ($booking_start < DateTime->now);
$new_circ_duration++ if $new_circ_duration % 86400 == 0;
$circ->duration("$new_circ_duration seconds");
- $circ->due_date(clense_ISO8601($due_date->strftime('%FT%T%z')));
+ $circ->due_date(cleanse_ISO8601($due_date->strftime('%FT%T%z')));
$changed = 1;
}
return $self->bail_on_events($self->editor->event)
unless $self->editor->allowed('CIRC_OVERRIDE_DUE_DATE', $self->circ_lib);
- $circ->due_date(clense_ISO8601($self->due_date));
+ $circ->due_date(cleanse_ISO8601($self->due_date));
} else {
my $lib = $self->noncat_circ_lib || $self->editor->requestor->ws_ou;
my $count = $self->noncat_count || 1;
- my $cotime = clense_ISO8601($self->checkout_time) || "";
+ my $cotime = cleanse_ISO8601($self->checkout_time) || "";
$logger->info("circulator: circ creating $count noncat circs with checkout time $cotime");
my $transit = $e->search_action_hold_transit_copy({hold => $hold->id})->[0];
my $start_time = ($transit) ? $transit->dest_recv_time : $hold->capture_time;
- $start_time = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($start_time));
+ $start_time = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($start_time));
my $end_time = $start_time->add(seconds => OpenSRF::Utils::interval_to_seconds($hs_wait_interval));
return 5 if $end_time > DateTime->now;
my $otype = $e->retrieve_config_non_cataloged_type($circ->item_type)
or return $e->die_event;
- my $duedate = $_dt_parser->parse_datetime( clense_ISO8601($circ->circ_time) );
+ my $duedate = $_dt_parser->parse_datetime( cleanse_ISO8601($circ->circ_time) );
$duedate = $duedate
->add( seconds => interval_to_seconds($otype->circ_duration) )
->strftime('%FT%T%z');
unless $U->is_true($patron->card->active);
my $expire = DateTime::Format::ISO8601->new->parse_datetime(
- clense_ISO8601($patron->expire_date));
+ cleanse_ISO8601($patron->expire_date));
return OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED')
if( CORE::time > $expire->epoch ) ;
$log->info("Processing circ ".$c->id."...\n");
- my $due_dt = $parser->parse_datetime( clense_ISO8601( $c->$due_date_method ) );
+ my $due_dt = $parser->parse_datetime( cleanse_ISO8601( $c->$due_date_method ) );
my $due = $due_dt->epoch;
my $now = time;
my $last_fine;
if ($fine) {
- $client->respond( "Last billing time: ".$fine->billing_ts." (clensed fromat: ".clense_ISO8601( $fine->billing_ts ).")");
- $last_fine = $parser->parse_datetime( clense_ISO8601( $fine->billing_ts ) )->epoch;
+ $client->respond( "Last billing time: ".$fine->billing_ts." (clensed format: ".cleanse_ISO8601( $fine->billing_ts ).")");
+ $last_fine = $parser->parse_datetime( cleanse_ISO8601( $fine->billing_ts ) )->epoch;
} else {
$log->info( "Potential first billing for circ ".$c->id );
$last_fine = $due;
$_->delete for (@oldmaps);
if ($hold->expire_time) {
- my $ex_time = $parser->parse_datetime( clense_ISO8601( $hold->expire_time ) );
+ my $ex_time = $parser->parse_datetime( cleanse_ISO8601( $hold->expire_time ) );
if ( DateTime->compare($ex_time, DateTime->now) < 0 ) {
# cancel cause = un-targeted expiration
die "OK\n" if (!$bresv or $bresv->capture_time or $bresv->cancel_time);
- my $end_time = $parser->parse_datetime( clense_ISO8601( $bresv->end_time ) );
+ my $end_time = $parser->parse_datetime( cleanse_ISO8601( $bresv->end_time ) );
if (DateTime->compare($end_time, DateTime->now) < 0) {
# cancel cause = un-targeted expiration
if (@$circs) {
my $due_date = $circs->[0]->due_date;
- $due_date = $parser->parse_datetime( clense_ISO8601( $due_date ) );
- my $start_time = $parser->parse_datetime( clense_ISO8601( $bresv->start_time ) );
+ $due_date = $parser->parse_datetime( cleanse_ISO8601( $due_date ) );
+ my $start_time = $parser->parse_datetime( cleanse_ISO8601( $bresv->start_time ) );
next if (DateTime->compare($start_time, $due_date) < 0);
push @good_resources, $res;
}
$spanset = $spanset->union(
DateTime::Span->new(
- start => $_dt_parser->parse_datetime(clense_ISO8601($c->{close_start})),
- end => $_dt_parser->parse_datetime(clense_ISO8601($c->{close_end}))
+ start => $_dt_parser->parse_datetime(cleanse_ISO8601($c->{close_start})),
+ end => $_dt_parser->parse_datetime(cleanse_ISO8601($c->{close_end}))
)
);
}
LIMIT 1
SQL
- $date = clense_ISO8601($date);
+ $date = cleanse_ISO8601($date);
my $target_date = $_dt_parser->parse_datetime( $date );
my ($begin, $end) = ($target_date, $target_date);
$begin->subtract( minutes => 1 );
while ( my $_b = new_org_closed_overlap($self, $client, $ou, $begin->strftime('%FT%T%z'), -1, 1 ) ) {
- $begin = $_dt_parser->parse_datetime( clense_ISO8601($_b->{start}) );
+ $begin = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
}
}
$end->add( minutes => 1 );
while ( my $_a = new_org_closed_overlap($self, $client, $ou, $end->strftime('%FT%T%z'), 1, 1 ) ) {
- $end = $_dt_parser->parse_datetime( clense_ISO8601($_a->{end}) );
+ $end = $_dt_parser->parse_datetime( cleanse_ISO8601($_a->{end}) );
}
}
}
$begin->subtract( minutes => 1 );
while ( my $_b = new_org_closed_overlap($self, $client, $ou, $begin->strftime('%FT%T%z'), -1 ) ) {
- $begin = $_dt_parser->parse_datetime( clense_ISO8601($_b->{start}) );
+ $begin = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
}
}
while ( my $_b = new_org_closed_overlap($self, $client, $ou, $end->strftime('%FT%T%z'), -1 ) ) {
- $end = $_dt_parser->parse_datetime( clense_ISO8601($_b->{end}) );
+ $end = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{end}) );
}
}
}
LIMIT 1
SQL
- $date = clense_ISO8601($date);
+ $date = cleanse_ISO8601($date);
my ($begin, $end) = ($date,$date);
my $hoo = actor::org_unit::hours_of_operation->retrieve($ou);
if (my $closure = actor::org_unit::closed_date->db_Main->selectrow_hashref( $sql, {}, $date, $ou )) {
- $begin = clense_ISO8601($closure->{close_start});
- $end = clense_ISO8601($closure->{close_end});
+ $begin = cleanse_ISO8601($closure->{close_start});
+ $end = cleanse_ISO8601($closure->{close_end});
if ( $direction <= 0 ) {
$before = $_dt_parser->parse_datetime( $begin );
$before->subtract( minutes => 1 );
while ( my $_b = org_closed_overlap($self, $client, $ou, $before->strftime('%FT%T%z'), -1, 1 ) ) {
- $before = $_dt_parser->parse_datetime( clense_ISO8601($_b->{start}) );
+ $before = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
}
- $begin = clense_ISO8601($before->strftime('%FT%T%z'));
+ $begin = cleanse_ISO8601($before->strftime('%FT%T%z'));
}
if ( $direction >= 0 ) {
$after->add( minutes => 1 );
while ( my $_a = org_closed_overlap($self, $client, $ou, $after->strftime('%FT%T%z'), 1, 1 ) ) {
- $after = $_dt_parser->parse_datetime( clense_ISO8601($_a->{end}) );
+ $after = $_dt_parser->parse_datetime( cleanse_ISO8601($_a->{end}) );
}
- $end = clense_ISO8601($after->strftime('%FT%T%z'));
+ $end = cleanse_ISO8601($after->strftime('%FT%T%z'));
}
}
my $count = 1;
while ($hoo->$begin_open_meth eq '00:00:00' and $hoo->$begin_close_meth eq '00:00:00') {
- $begin = clense_ISO8601($_dt_parser->parse_datetime( $begin )->subtract( days => 1)->strftime('%FT%T%z'));
+ $begin = cleanse_ISO8601($_dt_parser->parse_datetime( $begin )->subtract( days => 1)->strftime('%FT%T%z'));
$begin_dow++;
$begin_dow %= 7;
$count++;
$before = $_dt_parser->parse_datetime( $begin );
$before->subtract( minutes => 1 );
while ( my $_b = org_closed_overlap($self, $client, $ou, $before->strftime('%FT%T%z'), -1 ) ) {
- $before = $_dt_parser->parse_datetime( clense_ISO8601($_b->{start}) );
+ $before = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
}
}
}
$count = 1;
while ($hoo->$end_open_meth eq '00:00:00' and $hoo->$end_close_meth eq '00:00:00') {
- $end = clense_ISO8601($_dt_parser->parse_datetime( $end )->add( days => 1)->strftime('%FT%T%z'));
+ $end = cleanse_ISO8601($_dt_parser->parse_datetime( $end )->add( days => 1)->strftime('%FT%T%z'));
$end_dow++;
$end_dow %= 7;
$count++;
$after->add( minutes => 1 );
while ( my $_a = org_closed_overlap($self, $client, $ou, $after->strftime('%FT%T%z'), 1 ) ) {
- $after = $_dt_parser->parse_datetime( clense_ISO8601($_a->{end}) );
+ $after = $_dt_parser->parse_datetime( cleanse_ISO8601($_a->{end}) );
}
- $end = clense_ISO8601($after->strftime('%FT%T%z'));
+ $end = cleanse_ISO8601($after->strftime('%FT%T%z'));
}
}
if (my $dfield = $def->delay_field) {
if ($target->$dfield()) {
- $date = DateTime::Format::ISO8601->new->parse_datetime( clense_ISO8601($target->$dfield) );
+ $date = DateTime::Format::ISO8601->new->parse_datetime( cleanse_ISO8601($target->$dfield) );
} else {
next;
}
if (my $dfield = $def->delay_field) {
if ($target->$dfield()) {
- $date = DateTime::Format::ISO8601->new->parse_datetime( clense_ISO8601($target->$dfield) );
+ $date = DateTime::Format::ISO8601->new->parse_datetime( cleanse_ISO8601($target->$dfield) );
} else {
next;
}
# turns a date into something TT can understand
format_date => sub {
my $date = shift;
- $date = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($date));
+ $date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($date));
return sprintf(
"%0.2d:%0.2d:%0.2d %0.2d-%0.2d-%0.4d",
$date->hour,
my $target = $env->{target};
my $delay_field = $env->{params}->{target_age_field} || $env->{event}->event_def->delay_field;
- my $delay_field_ts = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($target->$delay_field()));
+ my $delay_field_ts = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($target->$delay_field()));
# to get the minimum time that the target must have aged to, add the min age to the delay field
$delay_field_ts->add( seconds => interval_to_seconds( $env->{params}->{min_target_age} ) );
return 0 if (!$self->MinPassiveTargetAge($env));
}
- my $due_date = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($circ->due_date));
+ my $due_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($circ->due_date));
return 0 if $due_date > DateTime->now;
return 1;
return "" unless $date;
$date = DateTime::Format::ISO8601->new->
- parse_datetime(OpenSRF::Utils::clense_ISO8601($date));
+ parse_datetime(OpenSRF::Utils::cleanse_ISO8601($date));
my @time = localtime($date->epoch);
my $year = $time[5]+1900;
}
my $expire = DateTime::Format::ISO8601->new->parse_datetime(
- clense_ISO8601($u->expire_date));
+ cleanse_ISO8601($u->expire_date));
return $b if CORE::time > $expire->epoch;
# Now, now many seconds old is this copy
my $create_date = DateTime::Format::ISO8601
->new
- ->parse_datetime( OpenSRF::Utils::clense_ISO8601($copy->create_date) )
+ ->parse_datetime( OpenSRF::Utils::cleanse_ISO8601($copy->create_date) )
->epoch;
my $age = time - $create_date;
}
$node->id($item_tag);
- #$node->update_ts(clense_ISO8601($record->edit_date));
+ #$node->update_ts(cleanse_ISO8601($record->edit_date));
$node->link(alternate => $feed->unapi . "?id=$item_tag&format=htmlholdings-full" => 'text/html') if ($flesh);
$node->link(opac => $feed->unapi . "?id=$item_tag&format=opac") if ($flesh);
$node->link(unapi => $feed->unapi . "?id=$item_tag") if ($flesh);
# provides a date that Template::Plugin::Date can parse
sub parse_due_date {
my $circ = shift;
- my $due = DateTime::Format::ISO8601->new->parse_datetime(clense_ISO8601($circ->due_date));
+ my $due = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($circ->due_date));
return sprintf(
"%0.2d:%0.2d:%0.2d %0.2d-%0.2d-%0.4d",
$due->hour,