Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/AccessSystem/Schema/Result/Allowed.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ __PACKAGE__->add_columns(
},
is_admin => {
data_type => 'boolean',
default_value => 'false',
},
pending_acceptance => {
data_type => 'boolean',
Expand Down
21 changes: 11 additions & 10 deletions lib/AccessSystem/Schema/Result/Person.pm
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,7 @@ sub create_payment {
$self->create_communication('Your Swindon Makerspace membership has started', 'first_payment');
}

if($valid_date && $valid_date < $now) {
# renewed payments - force this one, should happen everytime
$self->create_communication('Your Swindon Makerspace membership has restarted', 'rejoin_payment', {}, 1);
# rejoined, so remove any "reminder" email, so that if they
# subsequently stop paying again, they get a new reminder (!)
my $r_email = $self->communications_rs->find({type => 'reminder_email'});
$r_email->delete if $r_email;
}
my $is_rejoining = $valid_date && $valid_date < $now ? 1 : 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ? 1 : 0 to is unnecessary and (potentially) confusing here. It's only being used as a bool, so exactly what true value and false value get used is irrelevant.


# Only add $OVERLAP extra days if a first or renewal payment - these
# ensure member remains valid if standing order is not an
Expand Down Expand Up @@ -705,7 +698,15 @@ sub create_payment {
paid_on_date => $now,
expires_on_date => $expires_on,
amount_p => $payment_size,
});
});
if ($is_rejoining) {
# renewed payments - force this one, should happen everytime
$self->create_communication('Your Swindon Makerspace membership has restarted', 'rejoin_payment', {}, 1);
# rejoined, so remove any "reminder" email, so that if they
# subsequently stop paying again, they get a new reminder (!)
my $r_email = $self->communications_rs->find({type => 'reminder_email'});
$r_email->delete if $r_email;
}
});
return 1;
}
Expand Down Expand Up @@ -954,7 +955,7 @@ sub update_door_access {

# This entry should exist, but covid policy may have removed it..
my $door = $self->result_source->schema->the_door();
my $door_allowed = $self->allowed->find_or_create({ tool_id => $door->id });
my $door_allowed = $self->allowed->find_or_create({ tool_id => $door->id, is_admin => 0 });
$door_allowed->update({ pending_acceptance => 'false', accepted_on => DateTime->now()});
}

Expand Down
Loading