From: Lebbeous Fogle-Weekley Date: Mon, 25 Jul 2011 20:21:48 +0000 (-0400) Subject: YAOUS to limit OPAC payment history display to configured interval X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7543a1b496eea1950df72c8414260ebfed45994b;p=evergreen%2Fequinox.git YAOUS to limit OPAC payment history display to configured interval Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index a715ab34de..213965d7f6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -797,6 +797,17 @@ sub load_myopac_payments { $args->{limit} = $limit if $limit; $args->{offset} = $offset if $offset; + if (my $max_age = $self->ctx->{get_org_setting}->( + $e->requestor->home_ou, "opac.payment_history_age_limit" + )) { + my $min_ts = DateTime->now( + "time_zone" => DateTime::TimeZone->new("name" => "local"), + )->subtract("seconds" => interval_to_seconds($max_age))->iso8601(); + + $logger->info("XXX min_ts: $min_ts"); + $args->{"where"} = {"payment_ts" => {">=" => $min_ts}}; + } + $self->ctx->{payments} = $U->simplereq( 'open-ils.actor', 'open-ils.actor.user.payments.retrieve.atomic', diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 9d85859e84..b54a62d1bf 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2719,7 +2719,13 @@ INSERT into config.org_unit_setting_type ( 'opac.fully_compressed_serial_holdings', oils_i18n_gettext('opac.fully_compressed_serial_holdings', 'OPAC: Use fully compressed serial holdings', 'coust', 'label'), oils_i18n_gettext('opac.fully_compressed_serial_holdings', 'Show fully compressed serial holdings for all libraries at and below the current context unit', 'coust', 'description'), - 'bool') + 'bool'), + +( 'opac.payment_history_age_limit', + oils_i18n_gettext( 'opac.payment_history_age_limit', 'OPAC: Payment History Age Limit', 'coust', 'label'), + oils_i18n_gettext( 'opac.payment_history_age_limit', 'The OPAC should not display payments by patrons that are older than any interval defined here.', 'coust', 'label'), + 'interval') + ; UPDATE config.org_unit_setting_type diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.opac_payment_history_age_limit.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.opac_payment_history_age_limit.sql new file mode 100644 index 0000000000..f8790ef2bd --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.opac_payment_history_age_limit.sql @@ -0,0 +1,17 @@ +-- Evergreen DB patch XXXX.data.opac_payment_history_age_limit.sql + +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +INSERT into config.org_unit_setting_type (name, label, description, datatype) +VALUES ( + 'opac.payment_history_age_limit', + oils_i18n_gettext('opac.payment_history_age_limit', + 'OPAC: Payment History Age Limit', 'coust', 'label'), + oils_i18n_gettext('opac.payment_history_age_limit', + 'The OPAC should not display payments by patrons that are older than any interval defined here.', 'coust', 'label'), + 'interval' +); + +COMMIT;