Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIMS-1500: Set the dispatch request email recipients based on the dewar barcode #848

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ function _dispatch_dewar()
global $facility_country;
global $facility_courier_countries;
global $dispatch_email;
global $dispatch_email_regex;
global $dispatch_email_intl;
global $use_shipping_service;
global $shipping_service_links_in_emails;
Expand Down Expand Up @@ -1315,6 +1316,14 @@ function _dispatch_dewar()
$local_contact_email = $this->has_arg('LCEMAIL') ? $this->args['LCEMAIL'] : '';
if ($local_contact_email) $recpts .= ', ' . $local_contact_email;

if (!is_null($dispatch_email_regex)) {
foreach ($dispatch_email_regex as $address => $pattern) {
if (preg_match($pattern, $data['BARCODE'])) {
$recpts .= ', ' . $address;
}
}
}

$email->send($recpts);

// Update the dewar status and storage location
Expand Down Expand Up @@ -1343,6 +1352,7 @@ function _dispatch_dewar()
function _dispatch_dewar_confirmation()
{
global $dispatch_email;
global $dispatch_email_regex;
global $shipping_service_app_url;

if (!$this->has_arg('did'))
Expand Down Expand Up @@ -1405,6 +1415,14 @@ function _dispatch_dewar_confirmation()
$local_contact_email = $this->has_arg('LCEMAIL') ? $this->args['LCEMAIL'] : '';
if ($local_contact_email) $recpts .= ', ' . $local_contact_email;

if (!is_null($dispatch_email_regex)) {
foreach ($dispatch_email_regex as $address => $pattern) {
if (preg_match($pattern, $data['BARCODE'])) {
$recpts .= ', ' . $address;
}
}
}

$email->send($recpts);

// Also update the dewar status and storage location to keep it in sync with history...
Expand Down
Loading