Bug 29062: (follow-up) Adjust SendCirculationAlert
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
814789f8cb
commit
0138d09109
1 changed files with 19 additions and 11 deletions
|
@ -2259,6 +2259,7 @@ sub AddReturn {
|
||||||
item => $item->unblessed,
|
item => $item->unblessed,
|
||||||
borrower => $patron->unblessed,
|
borrower => $patron->unblessed,
|
||||||
branch => $branch,
|
branch => $branch,
|
||||||
|
issue => $issue
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3453,8 +3454,8 @@ B<Example>:
|
||||||
|
|
||||||
sub SendCirculationAlert {
|
sub SendCirculationAlert {
|
||||||
my ($opts) = @_;
|
my ($opts) = @_;
|
||||||
my ($type, $item, $borrower, $branch) =
|
my ($type, $item, $borrower, $branch, $issue) =
|
||||||
($opts->{type}, $opts->{item}, $opts->{borrower}, $opts->{branch});
|
($opts->{type}, $opts->{item}, $opts->{borrower}, $opts->{branch}, $opts->{issue});
|
||||||
my %message_name = (
|
my %message_name = (
|
||||||
CHECKIN => 'Item_Check_in',
|
CHECKIN => 'Item_Check_in',
|
||||||
CHECKOUT => 'Item_Checkout',
|
CHECKOUT => 'Item_Checkout',
|
||||||
|
@ -3464,7 +3465,21 @@ sub SendCirculationAlert {
|
||||||
borrowernumber => $borrower->{borrowernumber},
|
borrowernumber => $borrower->{borrowernumber},
|
||||||
message_name => $message_name{$type},
|
message_name => $message_name{$type},
|
||||||
});
|
});
|
||||||
my $issues_table = ( $type eq 'CHECKOUT' || $type eq 'RENEWAL' ) ? 'issues' : 'old_issues';
|
|
||||||
|
|
||||||
|
my $tables = {
|
||||||
|
items => $item->{itemnumber},
|
||||||
|
biblio => $item->{biblionumber},
|
||||||
|
biblioitems => $item->{biblionumber},
|
||||||
|
borrowers => $borrower,
|
||||||
|
branches => $branch,
|
||||||
|
};
|
||||||
|
|
||||||
|
if( $type eq 'CHECKIN' ){
|
||||||
|
$tables->{old_issues} = $issue->issue_id;
|
||||||
|
} else {
|
||||||
|
$tables->{issues} = $item->{itemnumber};
|
||||||
|
}
|
||||||
|
|
||||||
my $schema = Koha::Database->new->schema;
|
my $schema = Koha::Database->new->schema;
|
||||||
my @transports = keys %{ $borrower_preferences->{transports} };
|
my @transports = keys %{ $borrower_preferences->{transports} };
|
||||||
|
@ -3482,14 +3497,7 @@ sub SendCirculationAlert {
|
||||||
branchcode => $branch,
|
branchcode => $branch,
|
||||||
message_transport_type => $mtt,
|
message_transport_type => $mtt,
|
||||||
lang => $borrower->{lang},
|
lang => $borrower->{lang},
|
||||||
tables => {
|
tables => $tables,
|
||||||
$issues_table => $item->{itemnumber},
|
|
||||||
'items' => $item->{itemnumber},
|
|
||||||
'biblio' => $item->{biblionumber},
|
|
||||||
'biblioitems' => $item->{biblionumber},
|
|
||||||
'borrowers' => $borrower,
|
|
||||||
'branches' => $branch,
|
|
||||||
}
|
|
||||||
) or next;
|
) or next;
|
||||||
|
|
||||||
C4::Context->dbh->do(q|LOCK TABLE message_queue READ|) unless $do_not_lock;
|
C4::Context->dbh->do(q|LOCK TABLE message_queue READ|) unless $do_not_lock;
|
||||||
|
|
Loading…
Reference in a new issue