Skip to content

Commit

Permalink
Fix extension of document expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
abeverley committed Aug 8, 2024
1 parent 3f0ce09 commit d52d8ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions lib/Brass.pm
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,9 @@ any ['get', 'post'] => '/doc/view/:id' => require_role doc => sub {
my $id = param 'id';
my $schema = schema('doc');
my $doc = Brass::Doc->new(
id => $id,
schema => $schema,
id => $id,
schema => $schema,
schema_brass => schema,
);

$doc->user_can('read')
Expand Down
19 changes: 11 additions & 8 deletions lib/Brass/Doc.pm
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,18 @@ sub write
else {
$self->schema->resultset('Doc')->create($values);
}
$self->schema_brass->resultset('DocDocreadtype')->search({
doc_id => $self->id,
})->delete;
foreach my $docreadtype_id (@{$self->docreadtypes})
if ($self->docreadtypes)
{
$self->schema_brass->resultset('DocDocreadtype')->create({
doc_id => $self->id,
docreadtype_id => $docreadtype_id,
});
$self->schema_brass->resultset('DocDocreadtype')->search({
doc_id => $self->id,
})->delete;
foreach my $docreadtype_id (@{$self->docreadtypes})
{
$self->schema_brass->resultset('DocDocreadtype')->create({
doc_id => $self->id,
docreadtype_id => $docreadtype_id,
});
}
}
}

Expand Down

0 comments on commit d52d8ee

Please sign in to comment.