From 57cc273e395881dee7017b0728180105b8e0bf6c Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Fri, 27 Oct 2023 15:05:34 +0100 Subject: [PATCH 1/2] LIMS-768: Modify the values saved in database for Simple Sample Uploads --- api/src/Page/Sample.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php index b9f4bce38..a7bf0c432 100644 --- a/api/src/Page/Sample.php +++ b/api/src/Page/Sample.php @@ -355,8 +355,8 @@ function _add_simple_sample() $isCapillary = sizeof($crystals) > 1 ? true : false; foreach ($crystals as $sample) { - $c = array(); - foreach (array('SPACEGROUP', 'COMMENTS', 'NAME') as $f) + $c = array('NAME' => $protein->ACRONYM . '-sample'); + foreach (array('SPACEGROUP', 'COMMENTS') as $f) $c[$f] = array_key_exists($f, $sample) ? $sample->$f : ''; foreach (array('ABUNDANCE', 'THEORETICALDENSITY') as $f) $c[$f] = array_key_exists($f, $sample) ? $sample->$f : null; @@ -412,7 +412,7 @@ function _add_simple_sample() if (array_key_exists('CAPILLARYID', $ids[$model]) && $capillary->CRYSTALID == null && !$capillary->CONTAINERLESS) $blSamples['capillary'] = array('CONTAINERID' => $ids[$model]['CONTAINERID'], 'CRYSTALID' => $ids[$model]['CAPILLARYID'], 'PROTEINID' => $ids[$model]['CAPILLARYPHASEID'], 'LOCATION' => ++$maxLocation, 'NAME' => $capillary->NAME, 'PACKINGFRACTION' => 1, 'COMMENTS' => array_key_exists('COMMENTS', $capillary) ? $capillary->COMMENTS : '', 'DIMENSION1' => $capillary->OUTERDIAMETER, 'DIMENSION2' => $capillary->INNERDIAMETER, 'DIMENSION3' => $capillary->LENGTH, 'SHAPE' => $capillary->SHAPE, 'LOOPTYPE' => 1); - $blSamples['sample'] = array('CONTAINERID' => $ids[$model]['CONTAINERID'], 'CRYSTALID' => $ids[$model]['CRYSTALID'], 'PROTEINID' => $ids[$model]['PHASEID'], 'LOCATION' => ++$maxLocation, 'NAME' => $crystal->NAME, 'PACKINGFRACTION' => $attrs->PACKINGFRACTION ? $attrs->PACKINGFRACTION : null, 'COMMENTS' => array_key_exists('COMMENTS', $crystal) ? $crystal->COMMENTS : ''); + $blSamples['sample'] = array('CONTAINERID' => $ids[$model]['CONTAINERID'], 'CRYSTALID' => $ids[$model]['CRYSTALID'], 'PROTEINID' => $ids[$model]['PHASEID'], 'LOCATION' => ++$maxLocation, 'NAME' => $protein->ACRONYM, 'PACKINGFRACTION' => $attrs->PACKINGFRACTION ? $attrs->PACKINGFRACTION : null, 'COMMENTS' => array_key_exists('COMMENTS', $crystal) ? $crystal->COMMENTS : ''); foreach ($blSamples as $key => $blSample) { $a = $this->_prepare_sample_args($blSample); From f993556d3a1e285878a63239e769e0c57e6831d6 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Fri, 17 Nov 2023 09:53:27 +0000 Subject: [PATCH 2/2] LIMS-768: Use phase explicitly --- api/src/Page/Sample.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php index a7bf0c432..b602f47e5 100644 --- a/api/src/Page/Sample.php +++ b/api/src/Page/Sample.php @@ -355,7 +355,7 @@ function _add_simple_sample() $isCapillary = sizeof($crystals) > 1 ? true : false; foreach ($crystals as $sample) { - $c = array('NAME' => $protein->ACRONYM . '-sample'); + $c = array('NAME' => $phase->ACRONYM . '-sample'); foreach (array('SPACEGROUP', 'COMMENTS') as $f) $c[$f] = array_key_exists($f, $sample) ? $sample->$f : ''; foreach (array('ABUNDANCE', 'THEORETICALDENSITY') as $f) @@ -412,7 +412,7 @@ function _add_simple_sample() if (array_key_exists('CAPILLARYID', $ids[$model]) && $capillary->CRYSTALID == null && !$capillary->CONTAINERLESS) $blSamples['capillary'] = array('CONTAINERID' => $ids[$model]['CONTAINERID'], 'CRYSTALID' => $ids[$model]['CAPILLARYID'], 'PROTEINID' => $ids[$model]['CAPILLARYPHASEID'], 'LOCATION' => ++$maxLocation, 'NAME' => $capillary->NAME, 'PACKINGFRACTION' => 1, 'COMMENTS' => array_key_exists('COMMENTS', $capillary) ? $capillary->COMMENTS : '', 'DIMENSION1' => $capillary->OUTERDIAMETER, 'DIMENSION2' => $capillary->INNERDIAMETER, 'DIMENSION3' => $capillary->LENGTH, 'SHAPE' => $capillary->SHAPE, 'LOOPTYPE' => 1); - $blSamples['sample'] = array('CONTAINERID' => $ids[$model]['CONTAINERID'], 'CRYSTALID' => $ids[$model]['CRYSTALID'], 'PROTEINID' => $ids[$model]['PHASEID'], 'LOCATION' => ++$maxLocation, 'NAME' => $protein->ACRONYM, 'PACKINGFRACTION' => $attrs->PACKINGFRACTION ? $attrs->PACKINGFRACTION : null, 'COMMENTS' => array_key_exists('COMMENTS', $crystal) ? $crystal->COMMENTS : ''); + $blSamples['sample'] = array('CONTAINERID' => $ids[$model]['CONTAINERID'], 'CRYSTALID' => $ids[$model]['CRYSTALID'], 'PROTEINID' => $ids[$model]['PHASEID'], 'LOCATION' => ++$maxLocation, 'NAME' => $phase->ACRONYM, 'PACKINGFRACTION' => $attrs->PACKINGFRACTION ? $attrs->PACKINGFRACTION : null, 'COMMENTS' => array_key_exists('COMMENTS', $crystal) ? $crystal->COMMENTS : ''); foreach ($blSamples as $key => $blSample) { $a = $this->_prepare_sample_args($blSample);