|
Lines 153-183
sub store {
Link Here
|
| 153 |
|
153 |
|
| 154 |
my $is_modification = $self->in_storage; |
154 |
my $is_modification = $self->in_storage; |
| 155 |
my $old_booking = $self->get_from_storage; |
155 |
my $old_booking = $self->get_from_storage; |
| 156 |
if ( $self = |
156 |
if ( $self = $self->SUPER::store ) { |
| 157 |
$self->SUPER::store |
157 |
if ( $is_modification |
| 158 |
and $is_modification |
158 |
and any { $old_booking->$_ ne $self->$_ } qw(pickup_library_id start_date end_date) ) |
| 159 |
and any { $old_booking->$_ ne $self->$_ } qw(pickup_library_id start_date end_date) ) |
159 |
{ |
| 160 |
{ |
160 |
my $patron = $self->patron; |
| 161 |
my $patron = $self->patron; |
161 |
my $pickup_library = $self->pickup_library; |
| 162 |
my $pickup_library = $self->pickup_library; |
162 |
|
| 163 |
|
163 |
my $letter = C4::Letters::GetPreparedLetter( |
| 164 |
my $letter = C4::Letters::GetPreparedLetter( |
164 |
module => 'bookings', |
| 165 |
module => 'bookings', |
165 |
letter_code => 'BOOKING_MODIFICATION', |
| 166 |
letter_code => 'BOOKING_MODIFICATION', |
166 |
message_transport_type => 'email', |
| 167 |
message_transport_type => 'email', |
167 |
branchcode => $pickup_library->branchcode, |
| 168 |
branchcode => $pickup_library->branchcode, |
168 |
lang => $patron->lang, |
| 169 |
lang => $patron->lang, |
169 |
objects => { booking => $self }, |
| 170 |
objects => { booking => $self }, |
170 |
); |
| 171 |
); |
|
|
| 172 |
|
171 |
|
| 173 |
if ($letter) { |
172 |
if ($letter) { |
| 174 |
C4::Letters::EnqueueLetter( |
173 |
C4::Letters::EnqueueLetter( |
| 175 |
{ |
174 |
{ |
| 176 |
letter => $letter, |
175 |
letter => $letter, |
| 177 |
borrowernumber => $patron->borrowernumber, |
176 |
borrowernumber => $patron->borrowernumber, |
| 178 |
message_transport_type => 'email', |
177 |
message_transport_type => 'email', |
| 179 |
} |
178 |
} |
|
|
179 |
); |
| 180 |
} |
| 181 |
} elsif ( !$is_modification ) { |
| 182 |
my $patron = $self->patron; |
| 183 |
my $pickup_library = $self->pickup_library; |
| 184 |
|
| 185 |
my $letter = C4::Letters::GetPreparedLetter( |
| 186 |
module => 'bookings', |
| 187 |
letter_code => 'BOOKING_CONFIRMATION', |
| 188 |
message_transport_type => 'email', |
| 189 |
branchcode => $pickup_library->branchcode, |
| 190 |
lang => $patron->lang, |
| 191 |
objects => { booking => $self }, |
| 180 |
); |
192 |
); |
|
|
193 |
|
| 194 |
if ($letter) { |
| 195 |
C4::Letters::EnqueueLetter( |
| 196 |
{ |
| 197 |
letter => $letter, |
| 198 |
borrowernumber => $patron->borrowernumber, |
| 199 |
message_transport_type => 'email', |
| 200 |
} |
| 201 |
); |
| 202 |
} |
| 181 |
} |
203 |
} |
| 182 |
} |
204 |
} |
| 183 |
} |
205 |
} |