<event code='8010' textcode='OFFLINE_SESSION_COMPLETE'>
<desc xml:lang="en-US"> No org id was provided </desc>
</event>
+ <event code='8011' textcode='SKIP_ASSET_CHANGED'>
+ <desc xml:lang="en-US"> Asset status was changed since the offline transaction was recorded</desc>
+ </event>
<event code='9000' textcode='REPORT_TEMPLATE_EXISTS'>
<desc xml:lang="en-US"> A report template with the given name and folder already exists</desc>
return $e if $e;
my $barcode = $args->{barcode};
- # Have to have this config option & a status_changed_time for skippage
- if ( ($config{skip_late}) && (length($c->status_changed_time())) ) {
+ # Have to have this config option (or org setting) and a
+ # status_changed_time for skippage
+ if ((
+ ol_get_org_setting(
+ 'circ.offline.skip_checkout_if_newer_status_changed_time'
+ )
+ || $config{skip_late}
+ )
+ && length($c->status_changed_time())
+ ) {
my $cts = DateTime::Format::ISO8601->parse_datetime( cleanse_ISO8601($c->status_changed_time()) )->epoch();
my $xts = $command->{timestamp}; # Transaction Time Stamp
$logger->activity("offline: ol_handle_checkout: barcode=$barcode, cts=$cts, xts=$xts");
# Asset has changed after this transaction, ignore
if ($cts >= $xts) {
return OpenILS::Event->new(
- 'SKIP_ASSET_CHANGED',
- payload => 'The Asset has been update since this transaction, so it will be ignored'
+ 'SKIP_ASSET_CHANGED'
);
}
# $logger->activity("offline: fetch_copy_by_barcode: " . Dumper($c->real_fields()));
my $command = shift;
my $args = ol_circ_args_from_command($command);
my $t = time;
+
+ if( $args->{barcode} ) {
+
+ # $c becomes the Copy
+ # $e possibily becomes the Exception
+ my( $c, $e ) = $U->fetch_copy_by_barcode($args->{barcode});
+ return $e if $e;
+
+ my $barcode = $args->{barcode};
+ # Have to have this config option (or org setting) and a
+ # status_changed_time for skippage
+ if ((
+ ol_get_org_setting(
+ 'circ.offline.skip_renew_if_newer_status_changed_time'
+ )
+ || $config{skip_late}
+ )
+ && length($c->status_changed_time())
+ ) {
+ my $cts = DateTime::Format::ISO8601->parse_datetime( cleanse_ISO8601($c->status_changed_time()) )->epoch();
+ my $xts = $command->{timestamp}; # Transaction Time Stamp
+ $logger->activity("offline: ol_handle_renew: barcode=$barcode, cts=$cts, xts=$xts");
+
+ # Asset has changed after this transaction, ignore
+ if ($cts >= $xts) {
+ return OpenILS::Event->new(
+ 'SKIP_ASSET_CHANGED'
+ );
+ }
+ }
+ }
+
return $U->simplereq(
'open-ils.circ', 'open-ils.circ.renew.override', $authtoken, $args );
}
$logger->activity("offline: checkin : requestor=". $requestor->id.
", realtime=$realtime, ". "workstation=$ws, barcode=$barcode, backdate=$backdate");
+ if( $barcode ) {
+
+ # $c becomes the Copy
+ # $e possibily becomes the Exception
+ my( $c, $e ) = $U->fetch_copy_by_barcode($barcode);
+ return $e if $e;
+
+ # Have to have this config option (or org setting) and a
+ # status_changed_time for skippage
+ if ((
+ ol_get_org_setting(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time'
+ )
+ || $config{skip_late}
+ )
+ && length($c->status_changed_time())
+ ) {
+ my $cts = DateTime::Format::ISO8601->parse_datetime( cleanse_ISO8601($c->status_changed_time()) )->epoch();
+ my $xts = $command->{timestamp}; # Transaction Time Stamp
+ $logger->activity("offline: ol_handle_checkin: barcode=$barcode, cts=$cts, xts=$xts");
+
+ # Asset has changed after this transaction, ignore
+ if ($cts >= $xts) {
+ return OpenILS::Event->new(
+ 'SKIP_ASSET_CHANGED'
+ );
+ }
+ }
+ }
+
return $U->simplereq(
'open-ils.circ',
'open-ils.circ.checkin', $authtoken,
),
'bool'
)
+,(
+ 'circ.offline.skip_checkout_if_newer_status_changed_time',
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkout_if_newer_status_changed_time',
+ 'Offline: Skip offline checkout if newer item Status Changed Time.',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkout_if_newer_status_changed_time',
+ 'Skip offline checkout transaction (raise exception when'
+ || ' processing) if item Status Changed Time is newer than the'
+ || ' recorded transaction time. WARNING: The Reshelving to'
+ || ' Available status rollover will trigger this.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ )
+,(
+ 'circ.offline.skip_renew_if_newer_status_changed_time',
+ oils_i18n_gettext(
+ 'circ.offline.skip_renew_if_newer_status_changed_time',
+ 'Offline: Skip offline renewal if newer item Status Changed Time.',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.offline.skip_renew_if_newer_status_changed_time',
+ 'Skip offline renewal transaction (raise exception when'
+ || ' processing) if item Status Changed Time is newer than the'
+ || ' recorded transaction time. WARNING: The Reshelving to'
+ || ' Available status rollover will trigger this.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ )
+,(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time',
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time',
+ 'Offline: Skip offline checkin if newer item Status Changed Time.',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time',
+ 'Skip offline checkin transaction (raise exception when'
+ || ' processing) if item Status Changed Time is newer than the'
+ || ' recorded transaction time. WARNING: The Reshelving to'
+ || ' Available status rollover will trigger this.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ )
;
UPDATE config.org_unit_setting_type
--- /dev/null
+-- Evergreen DB patch XXXX.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql
+--
+-- New org setting circ.offline.skip_checkout_if_newer_status_changed_time
+-- New org setting circ.offline.skip_renew_if_newer_status_changed_time
+-- New org setting circ.offline.skip_checkin_if_newer_status_changed_time
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+ VALUES (
+ 'circ.offline.skip_checkout_if_newer_status_changed_time',
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkout_if_newer_status_changed_time',
+ 'Offline: Skip offline checkout if newer item Status Changed Time.',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkout_if_newer_status_changed_time',
+ 'Skip offline checkout transaction (raise exception when'
+ || ' processing) if item Status Changed Time is newer than the'
+ || ' recorded transaction time. WARNING: The Reshelving to'
+ || ' Available status rollover will trigger this.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ ),(
+ 'circ.offline.skip_renew_if_newer_status_changed_time',
+ oils_i18n_gettext(
+ 'circ.offline.skip_renew_if_newer_status_changed_time',
+ 'Offline: Skip offline renewal if newer item Status Changed Time.',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.offline.skip_renew_if_newer_status_changed_time',
+ 'Skip offline renewal transaction (raise exception when'
+ || ' processing) if item Status Changed Time is newer than the'
+ || ' recorded transaction time. WARNING: The Reshelving to'
+ || ' Available status rollover will trigger this.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ ),(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time',
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time',
+ 'Offline: Skip offline checkin if newer item Status Changed Time.',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.offline.skip_checkin_if_newer_status_changed_time',
+ 'Skip offline checkin transaction (raise exception when'
+ || ' processing) if item Status Changed Time is newer than the'
+ || ' recorded transaction time. WARNING: The Reshelving to'
+ || ' Available status rollover will trigger this.',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+ );
+
+COMMIT;