Skip to content

Commit 3b0dcab

Browse files
ndg63276Mark Williams
andauthored
Merge pre-release/2026-R2.2 into master (#1064)
* LIMS-2125: Allow use of shipping service for EU dispatches (#1049) * LIMS-2033: Fix count of autoprocessing errors (#1047) * LIMS-2037: Remove manual check for duplicate acronyms (#1034) * LIMS-2120: Hide courier fields if using facility account (#1050) * LIMS-2141: Suppress errors if visit directory has been replaced with a file (#1051) * I02-1 has 3 webcams --------- Co-authored-by: Mark Williams <mark.williams@diamond.ac.uk>
1 parent 277411a commit 3b0dcab

22 files changed

Lines changed: 331 additions & 192 deletions

File tree

api/config_sample.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261

262262
# Shipping service details
263263
$use_shipping_service = null;
264+
$use_shipping_service_nde = False;
264265
$use_shipping_service_incoming_shipments = null;
265266
$use_shipping_service_redirect = null;
266267
$use_shipping_service_redirect_incoming_shipments = null;

api/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function setupApplication($mode): Slim
7272
$visit_persist_storage_dir_segment, $dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone,
7373
$valid_components, $enabled_container_types, $synchweb_version, $redirects,
7474
$shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments,
75+
$use_shipping_service_nde,
7576
$dials_rest_url_rings, $closed_proposal_link, $ccp4_cloud_upload_url,
7677
$only_staff_can_assign, $industrial_prop_codes, $upstream_reprocessing_pipelines, $downstream_reprocessing_pipelines,
7778
$prop_codes_data_deleted, $container_types_with_parents, $bl_capacity;
@@ -99,8 +100,9 @@ function setupApplication($mode): Slim
99100
'enabled_container_types' => $enabled_container_types,
100101
'synchweb_version' => $synchweb_version,
101102
'redirects' => $redirects,
102-
'shipping_service_app_url' => $use_shipping_service_redirect || $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null,
103+
'shipping_service_app_url' => $use_shipping_service_redirect ? $shipping_service_app_url : null,
103104
'shipping_service_app_url_incoming' => $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null,
105+
'use_shipping_service_nde' => $use_shipping_service_nde,
104106
'dials_rest_url_rings' => $dials_rest_url_rings,
105107
'closed_proposal_link' => $closed_proposal_link,
106108
'ccp4_cloud_upload_url' => $ccp4_cloud_upload_url,

api/src/Page.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,11 @@ function argIfNotEmptyString($key)
654654
return $this->has_arg($key) && $this->arg($key) !== '' ? $this->arg($key) : null;
655655
}
656656

657+
function set_arg($key, $value)
658+
{
659+
$this->args[$key] = $value;
660+
}
661+
657662
# ------------------------------------------------------------------------
658663
# Misc Helpers
659664

api/src/Page/DC.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,6 @@ function _data_collections($single = null)
987987
$sample_joins[2]
988988
$extj[2]
989989
WHERE $sess[2] $where3
990-
991-
992990
ORDER BY sta DESC, id DESC";
993991

994992
$dcs = $this->db->paginate($q, $args);
@@ -1003,7 +1001,7 @@ function _data_collections($single = null)
10031001
$dc['VIS'] = $this->arg('prop') . '-' . $dc['VN'];
10041002

10051003
foreach (array('X1', 'X2', 'X3', 'X4') as $x) {
1006-
$dc[$x] = file_exists($dc[$x]) || file_exists($dc[$x].'.gz') ? 1 : 0;
1004+
$dc[$x] = @file_exists($dc[$x]) || @file_exists($dc[$x].'.gz') ? 1 : 0;
10071005
}
10081006

10091007
// Data collections
@@ -1127,7 +1125,7 @@ function _chk_image()
11271125
$sn = 0;
11281126
$images = array();
11291127
foreach (array('X1', 'X2', 'X3', 'X4') as $j => $im) {
1130-
$exists = file_exists($dc[$im]) || file_exists($dc[$im].'.gz');
1128+
$exists = @file_exists($dc[$im]) || @file_exists($dc[$im].'.gz');
11311129
array_push($images, $exists ? 1 : 0);
11321130
if ($im == 'X1' && $exists)
11331131
$sn = 1;
@@ -1142,7 +1140,7 @@ function _chk_image()
11421140

11431141
$this->profile('diffraction image');
11441142
$die = 0;
1145-
if (file_exists($di))
1143+
if (@file_exists($di))
11461144
$die = 1;
11471145
if ($this->staff && $this->has_arg('debug'))
11481146
$debug['diffraction_thumb'] = array('file' => $di, 'exists' => file_exists($di) ? 1 : 0);
@@ -1170,7 +1168,7 @@ function _edge($id)
11701168
$ch = str_replace('.png', '', $info[0]['PTH']);
11711169

11721170
$data = array(array(), array(), array());
1173-
if (file_exists($ch)) {
1171+
if (@file_exists($ch)) {
11741172
$dat = explode("\n", file_get_contents($ch));
11751173

11761174
foreach ($dat as $i => $d) {
@@ -1224,7 +1222,7 @@ function _mca($id)
12241222
$max_elements = 5;
12251223
$compton_cutoff = $info['ENERGY'] - 1100;
12261224

1227-
if (file_exists($results)) {
1225+
if (@file_exists($results)) {
12281226
$dat = explode("\n", file_get_contents($results));
12291227
foreach ($dat as $d) {
12301228
if (empty($d) || strpos($d, '#') === 0) {
@@ -1252,7 +1250,7 @@ function _mca($id)
12521250
}
12531251
}
12541252

1255-
if (file_exists($info['DAT'])) {
1253+
if (@file_exists($info['DAT'])) {
12561254
$dat = explode("\n", file_get_contents($info['DAT']));
12571255

12581256
foreach ($dat as $i => $d) {
@@ -1669,9 +1667,9 @@ function _rd($aid, $id)
16691667
$file = $info['FILEPATH'] . '/' . $info['FILENAME'];
16701668

16711669
$rows = array();
1672-
if (file_exists($file)) {
1670+
if (@file_exists($file)) {
16731671
$log = file_get_contents($file);
1674-
} elseif (file_exists($file.'.gz')) {
1672+
} elseif (@file_exists($file.'.gz')) {
16751673
$log = gzdecode(file_get_contents($file.'.gz'));
16761674
}
16771675
if (isset($log)) {
@@ -1838,7 +1836,7 @@ function _plot()
18381836
$pth = $info['DATFULLPATH'] ? $info['DATFULLPATH'] : str_replace($info['VISIT'], $info['VISIT'] . '/.ispyb', $this->ads($info['DIR']) . $info['IMP'] . '/' . $info['SCAN'] . '.dat');
18391837

18401838
$data = array();
1841-
if (file_exists($pth) && is_readable(($pth))) {
1839+
if (@file_exists($pth) && is_readable(($pth))) {
18421840
$dat = explode("\n", file_get_contents($pth));
18431841

18441842
foreach ($dat as $i => $d) {

api/src/Page/Processing.php

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -648,32 +648,53 @@ function _ap_message_status() {
648648

649649
$rows = $this->db->union(
650650
array(
651-
"SELECT app.autoprocprogramid, dc.datacollectionid as id, SUM(IF(appm.severity = 'ERROR', 1, 0)) as errors, SUM(IF(appm.severity = 'WARNING', 1, 0)) as warnings, SUM(IF(appm.severity = 'INFO', 1, 0)) as infos
651+
"SELECT DISTINCT dc.datacollectionid as id, dc.datacollectiongroupid as dcg, appm.autoprocprogrammessageid, appm.severity
652652
FROM autoprocprogrammessage appm
653653
INNER JOIN autoprocprogram app ON app.autoprocprogramid = appm.autoprocprogramid
654654
INNER JOIN autoprocintegration api ON api.autoprocprogramid = app.autoprocprogramid
655655
INNER JOIN datacollection dc ON dc.datacollectionid = api.datacollectionid
656656
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
657657
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
658-
WHERE $where
659-
GROUP BY dc.datacollectionid",
660-
"SELECT app.autoprocprogramid, dc.datacollectionid as id, SUM(IF(appm.severity = 'ERROR', 1, 0)) as errors, SUM(IF(appm.severity = 'WARNING', 1, 0)) as warnings, SUM(IF(appm.severity = 'INFO', 1, 0)) as infos
658+
WHERE $where",
659+
"SELECT DISTINCT dc.datacollectionid as id, dc.datacollectiongroupid as dcg, appm.autoprocprogrammessageid, appm.severity
661660
FROM autoprocprogrammessage appm
662661
INNER JOIN autoprocprogram app ON app.autoprocprogramid = appm.autoprocprogramid
663662
INNER JOIN processingjob pj ON pj.processingjobid = app.processingjobid
664663
INNER JOIN datacollection dc ON dc.datacollectionid = pj.datacollectionid
665664
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
666665
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
667-
WHERE $where
668-
GROUP BY dc.datacollectionid
669-
",
666+
WHERE $where",
670667
),
671668
$args,
672669
false,
673-
"SELECT autoprocprogramid, id, sum(errors) as errors, sum(warnings) as warnings, sum(infos) as infos FROM (:QUERY) inq GROUP BY id"
670+
"SELECT id, dcg, SUM(IF(severity = 'ERROR', 1, 0)) as errors, SUM(IF(severity = 'WARNING', 1, 0)) as warnings, SUM(IF(severity = 'INFO', 1, 0)) as infos FROM (:QUERY) inq GROUP BY id"
674671
);
675672

676-
$this->_output($rows);
673+
$ids = $this->has_arg('ids') ? (array)$this->arg('ids') : array();
674+
$dcgs = $this->has_arg('dcg') ? (array)$this->arg('dcg') : array();
675+
$grouped = array();
676+
677+
foreach ($rows as $row) {
678+
if (in_array($row['ID'], $ids)) {
679+
$groupKey = "ID_" . $row['ID'];
680+
unset($row['DCG']);
681+
} else if (in_array($row['DCG'], $dcgs)) {
682+
$groupKey = "DCG_" . $row['DCG'];
683+
unset($row['ID']);
684+
} else {
685+
continue;
686+
}
687+
688+
if (!isset($grouped[$groupKey])) {
689+
$grouped[$groupKey] = $row;
690+
} else {
691+
$grouped[$groupKey]['ERRORS'] += $row['ERRORS'];
692+
$grouped[$groupKey]['WARNINGS'] += $row['WARNINGS'];
693+
$grouped[$groupKey]['INFOS'] += $row['INFOS'];
694+
}
695+
}
696+
697+
$this->_output(array_values($grouped));
677698
}
678699

679700
/**

0 commit comments

Comments
 (0)