Bug 36758: (follow-up) Fix unit tests

We do two things here..

* We're making the improvement to C4::Letters that sets librarian to a
  patron object more resilient by testing for the userenv first.
* We correct the logic in Koha::Ticket such that we always store changes
  when there's a ticket update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-08-12 10:15:20 +01:00 committed by Katrin Fischer
parent 88500ccef4
commit f55519b505
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 4 additions and 2 deletions

View File

@ -626,7 +626,8 @@ sub GetPreparedLetter {
return;
my $want_librarian = $params{want_librarian};
if ($want_librarian) {
$objects->{librarian} = Koha::Patrons->find( C4::Context->userenv->{number} );
my $userenv = C4::Context->userenv;
$objects->{librarian} = Koha::Patrons->find( C4::Context->userenv->{number} ) if ($userenv);
}
# Best guess at language 'default' notice is written for include handling

View File

@ -176,7 +176,8 @@ sub store {
}
} else {
my %updated_columns = $self->_result->get_dirty_columns;
return $self->SUPER::store unless %updated_columns;
$self->SUPER::store;
$self->discard_changes;
$assignee = ( exists $updated_columns{assignee_id} ) ? $self->assignee : undef;
}