1

Topic: Verification 3 form error

Good day,
i'm doing the migration from a Drupal 6.30 and warehouse 0.81 to a Drupal 7.36 and warehouse 0.90 (all on a debian 7, postgres 8.4). I'm having big problems to make it work the verificaion 3 form. My problem is that if i use the verification 3 (or also 4), i can see the occurrences to validate but if i try to validate i don't have success because the response json says it misses "data.Record". So i tried to use the old 0.81 verification_3.php file and i can validate but if i click on a row to see on the map, map is not update... i get this for example this json, example:

http://xxx.xxx/iform/ajax/verification_ … ce_id=5341

{
    "content": "<table>\n<tr><td class=\"caption\">Status<\/td><td class=\"status status-\">Unknown<\/td
><\/tr>\n<tr><td colspan=\"2\" class=\"header\">Sample<\/td><\/tr>\n<tr><td class=\"caption\">Tipo di
segnalazione<\/td><td>Trovato morto su strada<\/td><\/tr>\n<tr><td class=\"caption\">Numero individui
<\/td><td>1<\/td><\/tr>\n<tr><td class=\"caption\">Sesso<\/td><td>Maschio<\/td><\/tr>\n<tr><td class
=\"caption\">Email<\/td><td>yyyyy@yy.yy<\/td><\/tr>\n<tr><td class=\"caption\">CMS Username
<\/td><td>abc cde<\/td><\/tr>\n<\/table>\n",
    "data": {
        "Sample": [
            {
                "caption": "Tipo di segnalazione",
                "value": "Trovato morto su strada"
            },
            {
                "caption": "Numero individui",
                "value": "1"
            },
            {
                "caption": "Sesso",
                "value": "Maschio"
            },
            {
                "caption": "Email",
                "value": "yyyyy@yy.yy"
            },
            {
                "caption": "CMS Username",
                "value": "abc cde"
            }
        ]
    },
    "additional": {
        "wkt": null,
        "taxon": null,
        "sample_id": null,
        "date": null,
        "entered_sref": null,
        "taxon_external_key": null,
        "taxon_meaning_id": null,
        "recorder_email": "yyyyy@yy.yy"
    }
}

it misses the data from "additional"...
Is there a way to make it work?? i have tried to update the verification_3,php with the 0.91 or to upgrade ifrom to the latest and warehouse 0.91 too... nothing works...
thanks

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

2

Re: Verification 3 form error

Hi Carlo,

I am trying verification 3 using the latest version of the IForm module from the repository and warehouse version 0.9.1, the same as you. I have accepted all the default settings for the form.

Attached is a screen shot showing a table of records on the left, details of a record on the right, and, at the bottom, the success response from verifying the record. It all seems to work.

If I understand correctly, your problem is that, when you click on a row in the table on the left, you do not see the details on the right appear.

I think you are getting a JavaScript error about data.Record missing. We can see there is no data.Record section in your json response.

The json response is built in client_helpers/prebuilt_forms/verification_3.php::ajax_details() using the results from two reports run on the warehouse which are selected when you edit the form.

The default "Report for record details" is Reports for prebuilt forms / Verification 3 / Record data for verification.
The default for "Report for record attributes" is Reports for prebuilt forms / Verification 3 / Record attributes for verification.

Are these the reports that you have selected?

Jim Bacon

Post's attachments

verification3.jpg 238.83 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

3

Re: Verification 3 form error

Hi Jim,
yes i use the default too as you...
i have tried to use other verification form but the same problem...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

4

Re: Verification 3 form error

This is what i see with 0.9.0 iform on verification_3 form page...
as you can see, i get an error in console and no box where i can click to verify... (i have only customized the page as i had on drupal 6 version)

Post's attachments

nsm_ver.jpg 257.5 kb, 1 downloads since 2015-06-10 

You don't have the permssions to download the attachments of this post.
Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

5

Re: Verification 3 form error

..and the same record as seen using verification_3,php (and verification_3.js) from old drupal6 installation...
you can see it misses the "status", saying it's unknown...

i will post what i see from the old drupal 6 installation too in the next post

Post's attachments

nsm_ver_old_over_D7.jpg 222.89 kb, 1 downloads since 2015-06-10 

You don't have the permssions to download the attachments of this post.
Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

6

Re: Verification 3 form error

and the same seen from Drupal 6 installation. here the record is complete, as i click the map is zoomed to the exact point and there are so much more info in the JSON...

The server is the same, as the DB (postgres and mysql), only different location for installation (D7 is in a subdomain and D6 in the main). PHP is 5.3 and OS is a Debian 6

Post's attachments

nsm_ver_d6.jpg 242.13 kb, 1 downloads since 2015-06-10 

You don't have the permssions to download the attachments of this post.
Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

7

Re: Verification 3 form error

Could you give me the name of the xml used by warehouse to build the json? just to see if they are corrupted or what...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

8

Re: Verification 3 form error

Hi Carlo,

First, you need to get the latest version of the IForm module from the code repository.
https://code.google.com/p/indicia/sourc … runk/iform
There is no point debugging old versions.

If you still experience a problem we then have to determine if the problem is because the warehouse is not returning the correct information or because the client side is not parsing it in to json correctly.

The two reports used are
https://code.google.com/p/indicia/sourc … d_data.xml
and
https://code.google.com/p/indicia/sourc … ibutes.xml

You can test these on your warehouse
.../index.php/report_viewer/load?report_name=reports_for_prebuilt_forms/verification_3/record_data
and
.../index.php/report_viewer/load?report_name=reports_for_prebuilt_forms/verification_3/record_data_attributes
by providing an occurrence id of a record.

You should see results like those attached.

Jim Bacon.

Post's attachments

record_data.jpg 84.29 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

9 (edited by Jim Bacon 11-06-2015 09:16:46)

Re: Verification 3 form error

record_data_attributes.xml report output.

Post's attachments

record_data_attributes.jpg 85.05 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

10

Re: Verification 3 form error

Hi Jim,
i have tried to call /index.php/report_viewer/load?report_name=reports_for_prebuilt_forms/verification_3/record_data

with occurrence id 5341

and i get this error...

general_errors.There was an SQL error: ERROR: relation "index_locations_samples" does not exist LINE 33: left join (index_locations_samples ils ^ - select co.id as occurrence_id, co.taxon as taxon, co.recorders as recorder, p.email_address as email, co.verifier as verifier, CASE co.preferred_taxon WHEN co.taxon THEN null ELSE co.preferred_taxon END as preferred_taxon, o.comment as occurrence_comment, s.id as sample_id, coalesce(s.entered_sref, l.centroid_sref) as entered_sref, s.date_start as date, case when co.location_name=s.location_name then co.location_name else co.location_name || COALESCE(' - ' || s.location_name, '') end as location_name, s.comment as sample_comment, co.survey_title as survey_title, co.taxa_taxon_list_external_key as taxon_external_key, co.taxon_meaning_id as taxon_meaning_id, o.record_status as record_status, co.zero_abundance as zero_abundance, st_astext(coalesce(s.geom, l.centroid_geom)) as wkt, co.created_by_id as created_by_id, p.first_name as input_by_first_name, p.surname as input_by_surname, co.survey_id as survey_id, co.taxon_group as taxon_group, co.taxon_group_id as taxon_group_id, array_to_string(array_agg(locality.name), '|') as localities, array_to_string(array_agg(locality.id), '|') as locality_ids 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 left join samples sparent on sparent.id=s.parent_id and sparent.deleted=false left join locations l on l.id=s.location_id and l.deleted=false left join (index_locations_samples ils join locations locality on locality.id=ils.location_id and locality.location_type_id=0 ) on ils.sample_id=s.id left join (users u join people p on p.id=u.person_id and p.deleted=false ) on u.id=o.created_by_id and u.id<>1 and u.deleted=false where co.id=5341 GROUP BY co.id, co.taxon, co.recorders, p.email_address, co.verifier, CASE co.preferred_taxon WHEN co.taxon THEN null ELSE co.preferred_taxon END, o.comment, s.id, coalesce(s.entered_sref, l.centroid_sref), s.date_start, case when co.location_name=s.location_name then co.location_name else co.location_name || COALESCE(' - ' || s.location_name, '') end, s.comment, co.survey_title, co.taxa_taxon_list_external_key, co.taxon_meaning_id, o.record_status, co.zero_abundance, st_astext(coalesce(s.geom, l.centroid_geom)), co.created_by_id, p.first_name, p.surname, co.survey_id, co.taxon_group, co.taxon_group_id LIMIT 21

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

11

Re: Verification 3 form error

Hi Carlo,

We may be getting closer to an answer!

That tells us you have a table missing from your warehouse database called index_locations_samples.

This is created by a module called the spatial_index_builder which has to be enabled.
http://indicia-docs.readthedocs.org/en/ … ilder.html

Look on your warehouse for the file application/config/config.php and add

MODPATH.'spatial_index_builder',

to the list of modules in the $config['modules'] array.
http://indicia-docs.readthedocs.org/en/ … index.html

Jim Bacon

12

Re: Verification 3 form error

Hi Jim,
i have installed the module on warehouse, ran the upgrade to update the db and finally i can see no error with the call /index.php/report_viewer/load?report_name=reports_for_prebuilt_forms/verification_3/record_data and i see a table of data.

then i have tried to see the json and with verification_3 i don't get any other information but if i use verification_4 the json is complete. the problem continue to be, i cannot click over an occurrence and see it on map..

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

13

Re: Verification 3 form error

Hi Carlo,

Sorry, I did not see your reply earlier.
Is this still causing a problem?

If there is still a problem try the following.
1. Clear your Drupal Indicia cache
2. Create a new Verification4 page using all the default settings.
3. Test the new page.
4. Post your JSON response.
5. Post any JavaScript error that you get.

Jim Bacon.

14

Re: Verification 3 form error

Hi Jim,
problems continue to be...
i have cleaned the Drupal cache, used the default values for Validation 4 and tested the page.

Here is the JSON when i click over an occurrence in the table:

{
    "content": "<table>\n<tr><td class=\"caption\">Status<\/td><td class=\"status status-C\">Awaiting verification
<\/td><\/tr>\n<tr><td colspan=\"2\" class=\"header\">Record<\/td><\/tr>\n<tr><td class=\"caption\">ID
<\/td><td>5218<\/td><\/tr>\n<tr><td class=\"caption\">Species<\/td><td>COCCINELLA<\/td><\/tr>\n<tr><td
class=\"caption\">Recorder<\/td><td>Sforzi, Andrea<\/td><\/tr>\n<tr><td colspan=\"2\" class=\"header
\">Sample<\/td><\/tr>\n<tr><td class=\"caption\">Georeference<\/td><td>42.818595277778N 11.0902525E<
\/td><\/tr>\n<tr><td class=\"caption\">Date<\/td><td>2014-04-01<\/td><\/tr>\n<tr><td class=\"caption
\">Survey<\/td><td>Parco Regionale della Maremma<\/td><\/tr>\n<tr><td class=\"caption\">Numero individui
<\/td><td>1<\/td><\/tr>\n<tr><td class=\"caption\">Sesso<\/td><td>Indeterminato<\/td><\/tr>\n<tr><td
class=\"caption\">CMS Username<\/td><td>Andrea<\/td><\/tr>\n<tr><td class=\"caption\">Tipo di segnalazione
<\/td><td>Avvistato<\/td><\/tr>\n<tr><td class=\"caption\">Email<\/td><td>asforzi@gol.grosseto.it<\/td
><\/tr>\n<\/table>\n",
    "data": {
        "Record": [
            {
                "caption": "ID",
                "value": "5218"
            },
            {
                "caption": "Species",
                "value": "COCCINELLA"
            },
            {
                "caption": "Recorder",
                "value": "Sforzi, Andrea"
            }
        ],
        "Sample": [
            {
                "caption": "Georeference",
                "value": "42.818595277778N 11.0902525E"
            },
            {
                "caption": "Date",
                "value": "2014-04-01"
            },
            {
                "caption": "Survey",
                "value": "Parco Regionale della Maremma"
            },
            {
                "caption": "Numero individui",
                "value": "1"
            },
            {
                "caption": "Sesso",
                "value": "Indeterminato"
            },
            {
                "caption": "CMS Username",
                "value": "Andrea"
            },
            {
                "caption": "Tipo di segnalazione",
                "value": "Avvistato"
            },
            {
                "caption": "Email",
                "value": "asforzi@gol.grosseto.it"
            }
        ]
    },
    "extra": {
        "wkt": "POINT(1234561.26106883 5284400.83341411)",
        "taxon": "COCCINELLA",
        "recorder": "Sforzi, Andrea",
        "sample_id": "10264",
        "created_by_id": "3",
        "input_by_first_name": "Andrea",
        "input_by_surname": "Sforzi",
        "survey_title": "Parco Regionale della Maremma",
        "survey_id": "8",
        "date": "2014-04-01",
        "entered_sref": "42.818595277778N 11.0902525E",
        "taxon_external_key": null,
        "taxon_meaning_id": "4894",
        "recorder_email": "asforzi@gol.grosseto.it",
        "taxon_group": "Invertebrati",
        "taxon_group_id": "7",
        "localities": "",
        "locality_ids": ""
    }
}

The call is this: http://xxx.it/iform/ajax/verification_4 … 6daa5e8465

I don't get any error in console... only occurrence is not zoomed on map. the only othe error i have is with my current template the map is over (as z-index over the occurrence table but it's only a problem of css)...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

15

Re: Verification 3 form error

Hi Carlo,

With Verification3, when I click on a record with

extra.wkt="POINT(-290199.136771356 6702146.23365589)"

I do not see the location highlighted. (I am expecting the location marker to turn red but I am not expecting the map to zoom.)

If I click a record for a grid square rather than a point, it does turn red.

extra.wkt="POLYGON((-399680.464424422 6540411.84821883,-399683.831237751 6540569.30886978,-399526.796457531 6540572.68343802,-399523.432626926 6540415.22261554,-399680.464424422 6540411.84821883))"

With Verification4 the location turns red whether it is a point or a polygon.

At the moment I have no idea where the code is that performs this action. The location is highlighted before the Ajax request is made to obtain the data about the record so it is nothing to do with the JSON.

May have just found it in iform/media/jquery.reportgrid.js around line 1105

      if (div.settings.rowId) {
        // Setup highlighting of features on an associated map when rows are clicked
        $(div).find('tbody').click(function(e) {
          if ($(e.target).hasClass('no-select')) {
            // clicked object might request no auto row selection

Unfortunately I have to go now and won't be back till Monday.
Regards,
Jim Bacon.

16

Re: Verification 3 form error

Hi Jim, i remember that with the old Verification3, the map was zoomed to the point...

So, the behaviour is right for Validation4?

I will check the line you have suggested...

Thanks

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit