|
Lines 53-59
How to update a borrower's last checkout message:
Link Here
|
| 53 |
|
53 |
|
| 54 |
use C4::Message; |
54 |
use C4::Message; |
| 55 |
my $borrower = { borrowernumber => 1 }; |
55 |
my $borrower = { borrowernumber => 1 }; |
| 56 |
my $message = C4::Message->find_last_message($borrower, 'CHECKOUT', 'email'); |
56 |
my $message = C4::Message->find_last_messages($borrower, 'CHECKOUT', 'email'); |
| 57 |
$message->append("you also checked out some other book...."); |
57 |
$message->append("you also checked out some other book...."); |
| 58 |
$message->update; |
58 |
$message->update; |
| 59 |
|
59 |
|
|
Lines 110-126
sub find {
Link Here
|
| 110 |
} |
110 |
} |
| 111 |
} |
111 |
} |
| 112 |
|
112 |
|
| 113 |
=head3 C4::Message->find_last_message($borrower, $letter_code, $transport) |
113 |
=head3 C4::Message->find_last_messages($borrower, $letter_code, $transport) |
| 114 |
|
114 |
|
| 115 |
This method is used to get the borrower's most recent, pending, check-in or |
115 |
This method is used to get the borrower's most recent, pending, check-in or |
| 116 |
checkout message. (This makes it possible to add more information to the |
116 |
checkout messages. (This makes it possible to add more information to the |
| 117 |
message before it gets sent out.) |
117 |
message before it gets sent out.) |
| 118 |
|
118 |
|
| 119 |
=cut |
119 |
=cut |
| 120 |
|
120 |
|
| 121 |
# C4::Message->find_last_message($borrower, $letter_code, $transport) |
121 |
# C4::Message->find_last_messages($borrower, $letter_code, $transport) |
| 122 |
# -- get the borrower's most recent pending checkin or checkout notification |
122 |
# -- get the borrower's most recent pending checkin or checkout notifications |
| 123 |
sub find_last_message { |
123 |
sub find_last_messages { |
| 124 |
my ($class, $borrower, $letter_code, $transport) = @_; |
124 |
my ($class, $borrower, $letter_code, $transport) = @_; |
| 125 |
# $type is the message_transport_type |
125 |
# $type is the message_transport_type |
| 126 |
$transport ||= 'email'; |
126 |
$transport ||= 'email'; |
|
Lines 139-149
sub find_last_message {
Link Here
|
| 139 |
$letter_code, |
139 |
$letter_code, |
| 140 |
$transport, |
140 |
$transport, |
| 141 |
); |
141 |
); |
| 142 |
if (@$msgs) { |
142 |
|
| 143 |
return $class->new($msgs->[0]); |
143 |
return map { $class->new($_) } @$msgs; |
| 144 |
} else { |
|
|
| 145 |
return; |
| 146 |
} |
| 147 |
} |
144 |
} |
| 148 |
|
145 |
|
| 149 |
|
146 |
|
| 150 |
- |
|
|