From d1f62a665405b4463544b4d4ff0e954ab97baa8f Mon Sep 17 00:00:00 2001 From: John van Breda Date: Fri, 14 Jul 2017 14:08:10 +0100 Subject: [PATCH 01/15] Errors output to stdout rather than just log Allows review of errors emitted under Travis CI --- .../tests/controllers/services/reportTest.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/indicia_svc_data/tests/controllers/services/reportTest.php b/modules/indicia_svc_data/tests/controllers/services/reportTest.php index 96626fea69..dc13a86e65 100644 --- a/modules/indicia_svc_data/tests/controllers/services/reportTest.php +++ b/modules/indicia_svc_data/tests/controllers/services/reportTest.php @@ -267,7 +267,7 @@ public function testRequestReportGetJson() { $response = self::getResponse($url); // valid json response will decode $response = json_decode($response, true); - $this->assertFalse(isset($response['error']), "testRequestReportGetJson returned error. See log for details"); + $this->assertFalse(isset($response['error']), "testRequestReportGetJson returned error. $response[error]"); $this->assertNotCount(0, $response, "Database contains no records to report on"); $this->assertTrue(isset($response[0]['title']), 'Report get JSON response not as expected'); } @@ -285,7 +285,7 @@ public function testRequestReportPostJson() { $response = self::getResponse($url, TRUE, $params); // valid json response will decode $response = json_decode($response, true); - $this->assertFalse(isset($response['error']), "testRequestReportPostJson returned error. See log for details"); + $this->assertFalse(isset($response['error']), "testRequestReportPostJson returned error. $response[error]"); $this->assertTrue(isset($response[0]['title']), 'Report post JSON response not as expected'); } @@ -302,7 +302,7 @@ public function testRequestReportGetXML() { $response = self::getResponse($url); // valid xml response will decode $response = new SimpleXmlElement($response, true); - $this->assertFalse(isset($response->error), "testRequestReportGetXML returned error. See log for details"); + $this->assertFalse(isset($response->error), "testRequestReportGetXML returned error. $response->"); $this->assertTrue(isset($response->record[0]->title), 'Report get XML response not as expected'); } @@ -319,7 +319,7 @@ public function testRequestReportPostXML() { $response = self::getResponse($url, TRUE, $params); // valid xml response will decode $response = new SimpleXmlElement($response, true); - $this->assertFalse(isset($response->error), "testRequestReportPostXML returned error. See log for details"); + $this->assertFalse(isset($response->error), "testRequestReportPostXML returned error. $response->error"); $this->assertTrue(isset($response->record[0]->title), 'Report post XML response not as expected'); } @@ -340,7 +340,7 @@ public function testAdvancedReport() { $response = self::getResponse($url, TRUE, $params); // valid json response will decode $response = json_decode($response, true); - $this->assertFalse(isset($response['error']), "testAdvancedReport returned error. See log for details"); + $this->assertFalse(isset($response['error']), "testAdvancedReport returned error. $response[error]"); $this->assertCount(1, $response, 'Advanced report response should only include 1 record'); $this->assertTrue(isset($response[0]['name']), 'Advanced report did not return a name column'); $this->assertEquals('Test location', $response[0]['name'], @@ -366,7 +366,7 @@ public function testAdvancedReportByAttrId() { $response = self::getResponse($url, TRUE, $params); // valid json response will decode $response = json_decode($response, true); - $this->assertFalse(isset($response['error']), "testAdvancedReportByAttrId returned error. See log for details"); + $this->assertFalse(isset($response['error']), "testAdvancedReportByAttrId returned error. $response[error]"); $this->assertTrue(array_key_exists('attr_location_1', $response[0]), 'Advanced report should return column for test_text by ID'); } @@ -384,7 +384,7 @@ public function testReportRequestsParams() { $response = self::getResponse($url, TRUE, $params); // valid json response will decode $response = json_decode($response, true); - $this->assertFalse(isset($response['error']), "testReportRequestsParams returned error. See log for details"); + $this->assertFalse(isset($response['error']), "testReportRequestsParams returned error. $response[error]"); $this->assertTrue(isset($response['parameterRequest']), 'Report should request parameters'); } @@ -408,7 +408,7 @@ public function testLookupCustomAttrs() { Kohana::log('debug', "Running unit test, Controllers_Services_Report_Test::testLookupCustomAttrs"); $response = $this->getReportResponse( 'library/locations/locations_list.xml', array('locattrs' => 'Test lookup', 'location_type_id' => 2)); - $this->assertFalse(isset($response['error']), "testLookupCustomAttrs returned error. See log for details"); + $this->assertFalse(isset($response['error']), "testLookupCustomAttrs returned error. $response[error]"); $this->assertCount(1, $response, 'Report response should only include 1 record'); $this->assertTrue(array_key_exists('attr_location_test_lookup', $response[0]), 'Locations report should return column for test_lookup'); @@ -425,7 +425,7 @@ public function testReportLibraryLocationsFilterableRecordCountsLeague() { 'library/locations/filterable_record_counts_league.xml', array('location_type_id' => 2)); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), - "testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details"); + "testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]"); } public function testReportLibraryLocationsFilterableRecordCountsLeagueLinked() { @@ -435,7 +435,7 @@ public function testReportLibraryLocationsFilterableRecordCountsLeagueLinked() { 'library/locations/filterable_record_counts_league_linked.xml', array('location_type_id' => 2)); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), - "testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details"); + "testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]"); } public function testReportLibraryLocationsFilterableSpeciesCountsLeague() { @@ -445,7 +445,7 @@ public function testReportLibraryLocationsFilterableSpeciesCountsLeague() { 'library/locations/filterable_species_counts_league.xml', array('location_type_id' => 2)); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), - "testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details"); + "testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]"); } public function testReportLibraryLocationsFilterableSpeciesCountsLeagueLinked() { @@ -455,7 +455,7 @@ public function testReportLibraryLocationsFilterableSpeciesCountsLeagueLinked() 'library/locations/filterable_species_counts_league_linked.xml', array('location_type_id' => 2)); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), - "testReportLibraryLocationsFilterableRecordCountsLeague returned error. See log for details"); + "testReportLibraryLocationsFilterableRecordCountsLeague returned error. $response[error]"); } public function testReportLibraryLocationsLocationsList() { @@ -465,7 +465,7 @@ public function testReportLibraryLocationsLocationsList() { 'library/locations/locations_list.xml', array('location_type_id' => 2, 'locattrs' => '')); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), 'testReportLibraryLocationsLocationsList returned error ' . - 'when passed integer location type id. See log for details'); + "when passed integer location type id. $response[error]"); $this->assertCount(1, $response, 'Report response should only include 1 record'); $this->assertEquals($response[0]['name'], 'Test location', 'Locations list report returned incorrect location name.'); @@ -473,7 +473,7 @@ public function testReportLibraryLocationsLocationsList() { 'library/locations/locations_list.xml', array('location_type_id' => 'Test location type', 'locattrs' => '')); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), 'testReportLibraryLocationsLocationsList returned error ' . - 'when passed a string location type id. See log for details'); + "when passed a string location type id. $response[error]"); $this->assertCount(1, $response, 'Report response should only include 1 record'); $this->assertEquals($response[0]['name'], 'Test location', 'Locations list report returned incorrect location name.'); @@ -486,7 +486,7 @@ public function testReportLibraryLocationsLocationsList2() { 'library/locations/locations_list_2.xml', array('location_type_id' => 2, 'locattrs' => '')); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), - "testReportLibraryLocationsLocationsList2 returned an error. See log for details"); + "testReportLibraryLocationsLocationsList2 returned an error. $response[error]"); $this->assertCount(1, $response, 'Report response should only include 1 record'); $this->assertEquals($response[0]['name'], 'Test location', 'Locations list report returned incorrect location name.'); @@ -494,7 +494,7 @@ public function testReportLibraryLocationsLocationsList2() { 'library/locations/locations_list_2.xml', array('location_type_id' => 99999, 'locattrs' => '')); // Simply testing that the report parses and the SQL runs $this->assertFalse(isset($response['error']), 'testReportLibraryLocationsLocationsList2 returned an error '. - 'when filtering for a missing location type ID. See log for details'); + "when filtering for a missing location type ID. $response[error]"); $this->assertCount(0, $response, 'Report response be empty, location type filter failed'); } From 0b676e60e354797c2b3c9501d4e2574b79016477 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Mon, 17 Jul 2017 17:09:32 +0100 Subject: [PATCH 02/15] Vague date output column correctly positioned in report Rather than adding the vague date processed output column to the end of each row, a null value is inserted into the query making the columns keep their correct order. --- application/libraries/XMLReportReader.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/libraries/XMLReportReader.php b/application/libraries/XMLReportReader.php index 177ba3b9d0..724fe07e8a 100644 --- a/application/libraries/XMLReportReader.php +++ b/application/libraries/XMLReportReader.php @@ -419,6 +419,8 @@ private function autogenColumns() { $countSql[] = $def['internal_sql']; } } + } elseif ($col === 'date' && $def['datatype'] === 'date' && $this->vagueDateProcessing) { + $sql[] = 'null as date'; } } if (count($distinctSql)>0) { From 9bd55b2563fea1d234157d5a52c77e8ef769dd76 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Mon, 17 Jul 2017 17:13:11 +0100 Subject: [PATCH 03/15] Date from and to columns included in downloads Also renamed existing date to Interpreted date. Fixes https://github.com/BiologicalRecordsCentre/iRecord/issues/248 --- .../occurrences/filterable_occurrences_download.xml | 8 ++++---- .../occurrences/filterable_occurrences_download_gis.xml | 8 ++++---- ...lterable_occurrences_download_gis_without_locality.xml | 8 ++++---- .../filterable_occurrences_download_parent_samples.xml | 8 ++++---- .../filterable_occurrences_download_sensitive.xml | 8 ++++---- .../filterable_occurrences_download_without_locality.xml | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/reports/library/occurrences/filterable_occurrences_download.xml b/reports/library/occurrences/filterable_occurrences_download.xml index 5701b589c6..d55ab0ebc8 100644 --- a/reports/library/occurrences/filterable_occurrences_download.xml +++ b/reports/library/occurrences/filterable_occurrences_download.xml @@ -61,10 +61,10 @@ - - - - + + + + diff --git a/reports/library/occurrences/filterable_occurrences_download_gis.xml b/reports/library/occurrences/filterable_occurrences_download_gis.xml index 09f60a65eb..40af321125 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis.xml @@ -59,10 +59,10 @@ - - - - + + + + diff --git a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml index 0ab39f61ff..34997e7469 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml @@ -57,10 +57,10 @@ - - - - + + + + diff --git a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml index adf318b027..707e981aca 100644 --- a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml +++ b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml @@ -64,10 +64,10 @@ - - - - + + + + diff --git a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml index 469a9e23b9..efbb5ae2fa 100644 --- a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml +++ b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml @@ -63,10 +63,10 @@ - - - - + + + + diff --git a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml index 228466c414..d06082a003 100644 --- a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml @@ -60,10 +60,10 @@ - - - - + + + + From b7bb645cbbd95f2e740cebbf3166f830ea6f7a81 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 08:14:29 +0100 Subject: [PATCH 04/15] Update record details reports to include 3 versions of species name See https://github.com/BiologicalRecordsCentre/iRecord/issues/228 --- .../record_details_2/record_data.xml | 84 ++++++++++--------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/reports/reports_for_prebuilt_forms/record_details_2/record_data.xml b/reports/reports_for_prebuilt_forms/record_details_2/record_data.xml index 1439b3a8f6..2d811df589 100644 --- a/reports/reports_for_prebuilt_forms/record_details_2/record_data.xml +++ b/reports/reports_for_prebuilt_forms/record_details_2/record_data.xml @@ -4,66 +4,70 @@ > select #columns# - from cache_occurrences co - join occurrences o on o.id=co.id and o.deleted=false - join samples s on s.id=o.sample_id and s.deleted=false - join cache_taxa_taxon_lists cttl on cttl.id=co.preferred_taxa_taxon_list_id + from cache_occurrences_functional o + join cache_occurrences_nonfunctional onf on onf.id=o.id + join cache_samples_nonfunctional snf on snf.id=o.sample_id + join cache_taxa_taxon_lists cttl on cttl.id=o.taxa_taxon_list_id join users u on u.id=o.created_by_id join people p on p.id=u.person_id - left join licences l on l.id=s.licence_id and l.deleted=false + left join licences l on l.id=o.licence_id and l.deleted=false #agreements_join# #joins# - where co.id=#occurrence_id# + where o.id=#occurrence_id# - join map_squares msq on msq.id = co.map_sq_#geom_precision#km_id - join map_squares msq on msq.id = co.map_sq_1km_id + join map_squares msq on msq.id = o.map_sq_#geom_precision#km_id + join map_squares msq on msq.id = o.map_sq_1km_id - - - + + + + + + + - - + + - - - - - + || CASE WHEN o.query='Q' AND o.query IS NOT NULL AND o.record_status<>'V' THEN '<br/>Queried.' ELSE '' END"/> + + + + + - - - - - + + + + + - - - - - + + + + + From ef19351350edf2cfa97761bf9baf6fb330fa06fc Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 08:38:20 +0100 Subject: [PATCH 05/15] Updates .gitignore to skip all NetBeans files --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0c996b3753..cb02868d7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .idea/* -/nbproject/private/ +/nbproject/* .DS_Store \ No newline at end of file From 25d6189c82417b08412854df9c0383c438b3c8b1 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 08:39:35 +0100 Subject: [PATCH 06/15] Version bump --- application/config/version.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config/version.php b/application/config/version.php index 290ba6a554..b397641215 100644 --- a/application/config/version.php +++ b/application/config/version.php @@ -26,7 +26,7 @@ /** * @var string The application files version number. */ -$config['version'] = '1.36.2'; -$config['release_date'] = '2017-07-17'; +$config['version'] = '1.37.0'; +$config['release_date'] = '2017-07-19'; $config['repository'] = 'https://github.com/Indicia-Team/warehouse/releases'; From 7f3cee4dc99944cdba3b95c998c7b633e828fd00 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 08:42:33 +0100 Subject: [PATCH 07/15] Adds a new output_sref_system field --- .../db/version_1_37_0/201707190840_output_sref_system.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 modules/cache_builder/db/version_1_37_0/201707190840_output_sref_system.sql diff --git a/modules/cache_builder/db/version_1_37_0/201707190840_output_sref_system.sql b/modules/cache_builder/db/version_1_37_0/201707190840_output_sref_system.sql new file mode 100644 index 0000000000..dad19f4ae3 --- /dev/null +++ b/modules/cache_builder/db/version_1_37_0/201707190840_output_sref_system.sql @@ -0,0 +1 @@ +ALTER TABLE cache_occurrences_nonfunctional ADD COLUMN output_sref_system character varying; \ No newline at end of file From 791fbdc8033b4a6a2dccf58c2fe131f082865969 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 08:52:07 +0100 Subject: [PATCH 08/15] Initial population of the new output_sref_system field --- .../201707190841_output_sref_system_data.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 modules/cache_builder/db/version_1_37_0/201707190841_output_sref_system_data.sql diff --git a/modules/cache_builder/db/version_1_37_0/201707190841_output_sref_system_data.sql b/modules/cache_builder/db/version_1_37_0/201707190841_output_sref_system_data.sql new file mode 100644 index 0000000000..9a44c14811 --- /dev/null +++ b/modules/cache_builder/db/version_1_37_0/201707190841_output_sref_system_data.sql @@ -0,0 +1,13 @@ +-- #slow script# + +UPDATE cache_occurrences_nonfunctional onf +SET output_sref_system=get_output_system( + reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision), + case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end), + case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end, + '4326' +) +FROM occurrences o +JOIN samples s ON s.id=o.sample_id AND s.deleted=false +LEFT JOIN locations l ON l.id=s.location_id AND l.deleted=false +WHERE onf.id=o.id; \ No newline at end of file From eed3848719d56cad13d1637973480139b739c381 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 08:57:29 +0100 Subject: [PATCH 09/15] Cache builder populates new output_sref_system field --- modules/cache_builder/config/cache_builder.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/cache_builder/config/cache_builder.php b/modules/cache_builder/config/cache_builder.php index 316b7edb7a..cb69fba10c 100644 --- a/modules/cache_builder/config/cache_builder.php +++ b/modules/cache_builder/config/cache_builder.php @@ -1342,6 +1342,12 @@ ), reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision), case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end) ), + output_sref_system=get_output_system( + reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision), + case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end), + case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end, + '4326' + ), verifier=pv.surname || ', ' || pv.first_name, licence_code=li.code, attr_sex_stage=CASE a_sex_stage.data_type @@ -1545,7 +1551,7 @@ $config['occurrences']['insert']['nonfunctional'] = " INSERT INTO cache_occurrences_nonfunctional( - id, comment, sensitivity_precision, privacy_precision, output_sref, licence_code) + id, comment, sensitivity_precision, privacy_precision, output_sref, output_sref_system, licence_code) SELECT o.id, o.comment, o.sensitivity_precision, s.privacy_precision, @@ -1584,6 +1590,12 @@ ), reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision), case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end) ), + get_output_system( + reduce_precision(coalesce(s.geom, l.centroid_geom), o.confidential, greatest(o.sensitivity_precision, s.privacy_precision), + case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end), + case when s.entered_sref_system is null then l.centroid_sref_system else s.entered_sref_system end, + '4326' + ), li.code FROM occurrences o #join_needs_update# From e2cc34199a74cf279e555915eee1475c188559de Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 09:05:21 +0100 Subject: [PATCH 10/15] Download reports include output_sref_system --- .../library/occurrences/filterable_occurrences_download.xml | 3 ++- .../occurrences/filterable_occurrences_download_gis.xml | 3 ++- .../filterable_occurrences_download_gis_without_locality.xml | 3 ++- .../filterable_occurrences_download_parent_samples.xml | 3 ++- .../occurrences/filterable_occurrences_download_sensitive.xml | 3 ++- .../filterable_occurrences_download_without_locality.xml | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/reports/library/occurrences/filterable_occurrences_download.xml b/reports/library/occurrences/filterable_occurrences_download.xml index d55ab0ebc8..462ddd995b 100644 --- a/reports/library/occurrences/filterable_occurrences_download.xml +++ b/reports/library/occurrences/filterable_occurrences_download.xml @@ -58,7 +58,8 @@ datatype="text" /> - + + diff --git a/reports/library/occurrences/filterable_occurrences_download_gis.xml b/reports/library/occurrences/filterable_occurrences_download_gis.xml index 40af321125..3d5ecef25f 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis.xml @@ -56,7 +56,8 @@ datatype="text" /> - + + diff --git a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml index 34997e7469..fd2b9b6237 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml @@ -56,7 +56,8 @@ datatype="text" /> - + + diff --git a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml index 707e981aca..a7ba921151 100644 --- a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml +++ b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml @@ -61,7 +61,8 @@ datatype="text" /> - + + diff --git a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml index efbb5ae2fa..21cf85d754 100644 --- a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml +++ b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml @@ -60,7 +60,8 @@ datatype="text" /> - + + diff --git a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml index d06082a003..6da1b29590 100644 --- a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml @@ -59,7 +59,8 @@ datatype="text" /> - + + From 7b483c6efcbb709f2f38459119fbc543bf939f21 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 10:10:17 +0100 Subject: [PATCH 11/15] Column reordering work See https://github.com/BiologicalRecordsCentre/iRecord/issues/250 --- .../filterable_occurrences_download.xml | 14 ++++++++------ .../filterable_occurrences_download_gis.xml | 14 ++++++++------ ...e_occurrences_download_gis_without_locality.xml | 12 +++++++----- ...terable_occurrences_download_parent_samples.xml | 14 ++++++++------ .../filterable_occurrences_download_sensitive.xml | 13 +++++++------ ...rable_occurrences_download_without_locality.xml | 12 +++++++----- 6 files changed, 45 insertions(+), 34 deletions(-) diff --git a/reports/library/occurrences/filterable_occurrences_download.xml b/reports/library/occurrences/filterable_occurrences_download.xml index 462ddd995b..c4b1ea6134 100644 --- a/reports/library/occurrences/filterable_occurrences_download.xml +++ b/reports/library/occurrences/filterable_occurrences_download.xml @@ -48,7 +48,6 @@ - @@ -60,12 +59,12 @@ sql="get_sref_precision(snf.public_entered_sref, snf.entered_sref_system, snf.attr_sref_precision)" /> + - + - @@ -73,10 +72,14 @@ sql="CASE WHEN onf.attr_det_full_name IS NULL THEN CASE WHEN onf.attr_det_last_name IS NULL THEN NULL ELSE onf.attr_det_last_name || COALESCE(', ' || onf.attr_det_first_name, '') END ELSE onf.attr_det_full_name END" /> + + + + + + - - - - @@ -58,12 +57,12 @@ sql="get_sref_precision(snf.public_entered_sref, snf.entered_sref_system, snf.attr_sref_precision)" /> + - + - @@ -71,9 +70,13 @@ sql="CASE WHEN onf.attr_det_full_name IS NULL THEN CASE WHEN onf.attr_det_last_name IS NULL THEN NULL ELSE onf.attr_det_last_name || COALESCE(', ' || onf.attr_det_first_name, '') END ELSE onf.attr_det_full_name END" /> - - + + + + + + - - @@ -58,10 +57,10 @@ sql="get_sref_precision(snf.public_entered_sref, snf.entered_sref_system, snf.attr_sref_precision)" /> + - @@ -69,9 +68,13 @@ sql="CASE WHEN onf.attr_det_full_name IS NULL THEN CASE WHEN onf.attr_det_last_name IS NULL THEN NULL ELSE onf.attr_det_last_name || COALESCE(', ' || onf.attr_det_first_name, '') END ELSE onf.attr_det_full_name END" /> - - + + + + + + - - @@ -63,12 +62,12 @@ sql="get_sref_precision(s.entered_sref, s.entered_sref_system, null)" /> + - + - @@ -76,10 +75,14 @@ sql="CASE WHEN o.attr_det_full_name IS NULL THEN CASE WHEN o.attr_det_last_name IS NULL THEN NULL ELSE o.attr_det_last_name || COALESCE(', ' || o.attr_det_first_name, '') END ELSE o.attr_det_full_name END" /> + + + + + + - - - - @@ -62,12 +61,12 @@ sql="get_sref_precision(s.entered_sref, s.entered_sref_system, null)" /> + - + - @@ -75,10 +74,13 @@ sql="CASE WHEN o.attr_det_full_name IS NULL THEN CASE WHEN o.attr_det_last_name IS NULL THEN NULL ELSE o.attr_det_last_name || COALESCE(', ' || o.attr_det_first_name, '') END ELSE o.attr_det_full_name END" /> + + + + + - - - - @@ -61,10 +60,10 @@ sql="get_sref_precision(snf.public_entered_sref, snf.entered_sref_system, snf.attr_sref_precision)" /> + - @@ -72,10 +71,14 @@ sql="CASE WHEN onf.attr_det_full_name IS NULL THEN CASE WHEN onf.attr_det_last_name IS NULL THEN NULL ELSE onf.attr_det_last_name || COALESCE(', ' || onf.attr_det_first_name, '') END ELSE onf.attr_det_full_name END" /> + + + + + + - - - - + + CASE o.record_substatus WHEN 4 THEN 'Unable to verify' WHEN 5 THEN 'Incorrect' ELSE NULL END + ELSE NULL + END" /> diff --git a/reports/library/occurrences/filterable_occurrences_download_gis.xml b/reports/library/occurrences/filterable_occurrences_download_gis.xml index 3e0ee9bae8..3bc64c8811 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis.xml @@ -77,18 +77,26 @@ - + + CASE o.record_substatus WHEN 4 THEN 'Unable to verify' WHEN 5 THEN 'Incorrect' ELSE NULL END + ELSE NULL + END" /> diff --git a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml index de0c44c20e..22b9b5d26d 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml @@ -75,18 +75,26 @@ - + + CASE o.record_substatus WHEN 4 THEN 'Unable to verify' WHEN 5 THEN 'Incorrect' ELSE NULL END + ELSE NULL + END" /> diff --git a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml index cfe280c1dd..f700f56c5a 100644 --- a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml +++ b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml @@ -83,18 +83,26 @@ - + + CASE o.record_substatus WHEN 4 THEN 'Unable to verify' WHEN 5 THEN 'Incorrect' ELSE NULL END + ELSE NULL + END" /> diff --git a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml index b6333b69f8..af66f4a028 100644 --- a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml +++ b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml @@ -81,18 +81,26 @@ - + + CASE o.record_substatus WHEN 4 THEN 'Unable to verify' WHEN 5 THEN 'Incorrect' ELSE NULL END + ELSE NULL + END" /> diff --git a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml index 08cc05c79c..d0ef1f50ca 100644 --- a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml @@ -79,18 +79,26 @@ - + + CASE o.record_substatus WHEN 4 THEN 'Unable to verify' WHEN 5 THEN 'Incorrect' ELSE NULL END + ELSE NULL + END" /> From 89172e90d0e350f107ca3992d0f13a87d7c0f551 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 12:30:15 +0100 Subject: [PATCH 13/15] Column changes in download reports Also involved switching 2 download reports to correct cache structure rather than accessing via a view. --- .../filterable_occurrences_download.xml | 3 +- .../filterable_occurrences_download_gis.xml | 3 +- ...urrences_download_gis_without_locality.xml | 3 +- ...le_occurrences_download_parent_samples.xml | 57 ++++++++++--------- ...terable_occurrences_download_sensitive.xml | 55 +++++++++--------- ..._occurrences_download_without_locality.xml | 3 +- 6 files changed, 65 insertions(+), 59 deletions(-) diff --git a/reports/library/occurrences/filterable_occurrences_download.xml b/reports/library/occurrences/filterable_occurrences_download.xml index 5726f14829..02c458832f 100644 --- a/reports/library/occurrences/filterable_occurrences_download.xml +++ b/reports/library/occurrences/filterable_occurrences_download.xml @@ -59,6 +59,7 @@ sql="get_sref_precision(snf.public_entered_sref, snf.entered_sref_system, snf.attr_sref_precision)" /> + @@ -91,7 +92,7 @@ ELSE o.record_status END" /> + @@ -88,7 +89,7 @@ ELSE o.record_status END" /> + @@ -86,7 +87,7 @@ ELSE o.record_status END" /> SELECT #columns# - FROM cache_occurrences o - JOIN occurrences occ on occ.id=o.id and occ.deleted=false -- to get sensitivity_precision + FROM cache_occurrences_functional o + JOIN cache_occurrences_nonfunctional onf on onf.id=o.id + JOIN cache_samples_nonfunctional snf on snf.id=o.sample_id JOIN cache_taxa_taxon_lists cttl on cttl.id=o.taxa_taxon_list_id JOIN samples s on s.id=o.sample_id AND s.deleted=false LEFT JOIN (index_locations_samples ils JOIN cache_termlists_terms ctt on ctt.id=ils.location_type_id AND ctt.term='Vice County' ) on ils.sample_id=o.sample_id and ils.contains=true LEFT JOIN locations vc on vc.id=ils.location_id and coalesce(vc.code, '') not like '%+%' - JOIN websites w on w.id=o.website_id JOIN users u ON u.id=o.created_by_id JOIN people p ON p.id=u.person_id #agreements_join# @@ -36,23 +36,23 @@ - - - + + + + sql="cttl.preferred_taxon" datatype='species' /> - + sql="cttl.default_common_name" datatype='text' /> + - - + + - - + + + - - - + + + + sql="CASE WHEN onf.attr_det_full_name IS NULL THEN + CASE WHEN onf.attr_det_last_name IS NULL THEN NULL ELSE onf.attr_det_last_name || COALESCE(', ' || onf.attr_det_first_name, '') END + ELSE onf.attr_det_full_name END" /> - + - + - - - - + + + + \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml index af66f4a028..0199658a27 100644 --- a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml +++ b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml @@ -5,15 +5,15 @@ SELECT #columns# - FROM cache_occurrences o - JOIN occurrences occ on occ.id=o.id and occ.deleted=false -- to get occurrence comment + FROM cache_occurrences_functional o + JOIN cache_occurrences_nonfunctional onf on onf.id=o.id + JOIN cache_samples_nonfunctional snf on snf.id=o.sample_id JOIN cache_taxa_taxon_lists cttl on cttl.id=o.taxa_taxon_list_id - JOIN samples s on s.id=o.sample_id AND s.deleted=false + JOIN samples s on s.id=o.sample_id LEFT JOIN (index_locations_samples ils JOIN cache_termlists_terms ctt on ctt.id=ils.location_type_id AND ctt.term='Vice County' ) on ils.sample_id=o.sample_id and ils.contains=true LEFT JOIN locations vc on vc.id=ils.location_id and coalesce(vc.code, '') not like '%+%' - JOIN websites w on w.id=o.website_id JOIN users u ON u.id=o.created_by_id JOIN people p ON p.id=u.person_id #agreements_join# @@ -36,15 +36,15 @@ - - + + + sql="cttl.preferred_taxon" datatype='species' /> - + sql="cttl.default_common_name" datatype='text' /> + @@ -59,27 +59,28 @@ datatype="text" /> - - + + + - - - + + + + sql="CASE WHEN onf.attr_det_full_name IS NULL THEN + CASE WHEN onf.attr_det_last_name IS NULL THEN NULL ELSE onf.attr_det_last_name || COALESCE(', ' || onf.attr_det_first_name, '') END + ELSE onf.attr_det_full_name END" /> - + - + - - - - - + + + + + \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml index d0ef1f50ca..1e6ec63ea4 100644 --- a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml @@ -60,6 +60,7 @@ sql="get_sref_precision(snf.public_entered_sref, snf.entered_sref_system, snf.attr_sref_precision)" /> + @@ -90,7 +91,7 @@ ELSE o.record_status END" /> Date: Wed, 19 Jul 2017 12:52:48 +0100 Subject: [PATCH 14/15] Column re-ordering work for downloads Fixes https://github.com/BiologicalRecordsCentre/iRecord/issues/250 --- .../filterable_occurrences_download.xml | 20 ++++++++++-------- .../filterable_occurrences_download_gis.xml | 19 ++++++++++------- ...urrences_download_gis_without_locality.xml | 21 ++++++++++++------- ...le_occurrences_download_parent_samples.xml | 20 ++++++++++-------- ...terable_occurrences_download_sensitive.xml | 19 ++++++++++------- ..._occurrences_download_without_locality.xml | 21 ++++++++++--------- 6 files changed, 68 insertions(+), 52 deletions(-) diff --git a/reports/library/occurrences/filterable_occurrences_download.xml b/reports/library/occurrences/filterable_occurrences_download.xml index 02c458832f..ca6e945383 100644 --- a/reports/library/occurrences/filterable_occurrences_download.xml +++ b/reports/library/occurrences/filterable_occurrences_download.xml @@ -66,21 +66,21 @@ - - - - + + + - - + + + - + + + + - - + \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_gis.xml b/reports/library/occurrences/filterable_occurrences_download_gis.xml index 0484c806cc..355dc81af7 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis.xml @@ -64,20 +64,21 @@ - - - - + + + - + + + - + + + + - + - \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml index 285edaa9a6..01ee357973 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis_without_locality.xml @@ -62,20 +62,23 @@ - - - - + + + - + + + + + - + + + + - + - \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml index ed6c22e07e..3713d6716a 100644 --- a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml +++ b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml @@ -69,21 +69,21 @@ - - - - + + + - - + + + - + + + + - - + \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml index 0199658a27..e186565bed 100644 --- a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml +++ b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml @@ -68,20 +68,21 @@ - - - + + + - - + + + - + + + + - - + \ No newline at end of file diff --git a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml index 1e6ec63ea4..db27f963bd 100644 --- a/reports/library/occurrences/filterable_occurrences_download_without_locality.xml +++ b/reports/library/occurrences/filterable_occurrences_download_without_locality.xml @@ -65,21 +65,21 @@ - - - - + + + - - + + + - + + + + - - + or snf.recorders = onf.attr_det_full_name then cast(p.id as varchar(20)) else 'unknown' end" /> \ No newline at end of file From 6d3eaba4643dd83f2bad8796ee38aa6543969075 Mon Sep 17 00:00:00 2001 From: John van Breda Date: Wed, 19 Jul 2017 14:25:17 +0100 Subject: [PATCH 15/15] Update submodule tree positions --- client_helpers | 2 +- media | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client_helpers b/client_helpers index 6e6a5f119d..be1f138b82 160000 --- a/client_helpers +++ b/client_helpers @@ -1 +1 @@ -Subproject commit 6e6a5f119d2738c8e6180289be15ff61c549b5cd +Subproject commit be1f138b82180d85dbb4f8c3d2c1a5c6414ca341 diff --git a/media b/media index e7dcbe5c72..1717d66f9a 160000 --- a/media +++ b/media @@ -1 +1 @@ -Subproject commit e7dcbe5c72208a1cecb44d1b7a0fa15e8198a659 +Subproject commit 1717d66f9a86a43e32ff5f9170041ded5e23e18d