<event code='7027' textcode='PATRON_PASSWORD_WAS_NOT_STRONG'>
<desc xml:lang='en-US'>The user attempted to set their password to a weak value.</desc>
</event>
+ <event code='7028' textcode='DUE_DATE_EXCEEDS_PATRON_EXPIRY'>
+ <desc xml:lang='en-US'>The patron account expires before the circulation due date.</desc>
+ </event>
<!-- ================================================================ -->
$self->apply_modified_due_date($modify_to_start);
return if $self->bail_out;
+ $self->limit_to_expire_date();
+ return if $self->bail_out;
+
return $self->bail_on_events($self->editor->event)
unless $self->editor->create_action_circulation($self->circ);
+sub limit_to_expire_date {
+ my $self = shift;
+ my $due_date = DateTime::Format::ISO8601
+ ->new
+ ->parse_datetime( OpenSRF::Utils::clense_ISO8601($self->circ->due_date) )
+ ->epoch;
+ my $expire_date = DateTime::Format::ISO8601
+ ->new
+ ->parse_datetime( OpenSRF::Utils::clense_ISO8601($self->patron->expire_date) )
+ ->epoch;
+
+ if ($expire_date < $due_date) {
+
+ # does this circ lib want to limit due date by expiry date? check settings to find out...
+ my $do_limit = $U->ou_ancestor_setting_value($self->circ->circ_lib, 'circ.limit_to_patron_expire_date');
+ my $warn_on_limit = $U->ou_ancestor_setting_value($self->circ->circ_lib, 'circ.warn_on_limit_by_expire_date');
+
+ # TODO: handle ($do_limit && $warn_on_limit)
+ if ($do_limit) {
+ $self->circ->due_date($self->patron->expire_date);
+ } elsif ($warn_on_limit) {
+ # TODO: permit override, don't just throw an error
+ $self->bail_on_events(OpenILS::Event->new('DUE_DATE_EXCEEDS_PATRON_EXPIRY'));
+ }
+ }
+}
+
+
+
sub create_due_date {
my( $self, $duration, $date_ceiling, $force_date ) = @_;
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type (
+ name, label, grp, datatype
+) VALUES (
+ 'circ.limit_to_patron_expire_date',
+ 'Limit due date by patron expire date',
+ 'circ',
+ 'bool'
+),
+(
+ 'circ.warn_on_limit_by_expire_date',
+ 'Warn when limiting due date by patron expire date',
+ 'circ',
+ 'bool'
+);
+
+COMMIT;