1 (edited by dieter 25-05-2015 15:30:04)

Topic: Drupal 7 error

Hi guys,

I has been a while since I looked into this system so my installation was really outdated so I decided to start from scratch. Warehouse installed without problem, next I installed the latest drupal and all required modules downloaded from the latest files in the trunk directory on the project page. But when I want to add an Indicia page I get this:

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\test_web\sites\all\modules\iform\client_helpers\prebuilt_forms\verification_5.php on line 973

Any ideas?

Dieter

2

Re: Drupal 7 error

Hi Dieter
There was a dependency on PHP 5.4+ in the code - now fixed. You just need to update the verification_5.php file.
Best wishes
John

John van Breda
Biodiverse IT

3

Re: Drupal 7 error

For info, I've seen other PHP 5.4+ dependencies in splash_extensions.php.
We stay away from PHP 5.3 now as it is past End of Life so it hasn't been a problem to me.
Jim Bacon.

4

Re: Drupal 7 error

i have the same problems with "unexpected" variables. so for the last version of drupal/indicia, is required PHP 5.4?

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: Drupal 7 error

When i try to use validation 3, i get this error when i click on element on table:

TypeError: data.data.Record is undefined

The JSON response is missing the Record element, i see only 'content, data (with "sample" inside) and extra'
Is because i use PHP5.3?

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: Drupal 7 error

Would you like to post the full error message regarding the "unexpected" variables?

There is no intentional move to PHP >= 5.4 but probably none of the developers use or test on 5.3.

Jim Bacon.

7

Re: Drupal 7 error

mmm ok but for the moment the most important problem is when i try to validate and i get error. this is what i see in console of my Firefox browser:

GET http://www.yyyy.it/iform/ajax/verificat … ce_id=5328

and in console i see: TypeError: data.data.Record is undefined

The JSON is this:




{
    "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>Avvistato<\/td><\/tr>\n<tr><td class=\"caption\">Numero individui<\/td><td>1<
\/td><\/tr>\n<tr><td class=\"caption\">CMS Username<\/td><td>xxxx<\/td><\/tr>\n<tr><td class=\"caption
\">Email<\/td><td>xxx@yyyy.it<\/td><\/tr>\n<tr><td class=\"caption\">Sesso<\/td><td
>Indeterminato<\/td><\/tr>\n<\/table>\n",
    "data": {
        "Sample": [
            {
                "caption": "Tipo di segnalazione",
                "value": "Avvistato"
            },
            {
                "caption": "Numero individui",
                "value": "1"
            },
            {
                "caption": "CMS Username",
                "value": "xxxx"
            },
            {
                "caption": "Email",
                "value": "xxx@yyyyy.it"
            },
            {
                "caption": "Sesso",
                "value": "Indeterminato"
            }
        ]
    },
    "extra": {
        "wkt": null,
        "taxon": null,
        "recorder": null,
        "sample_id": null,
        "created_by_id": null,
        "survey_title": null,
        "survey_id": null,
        "date": null,
        "entered_sref": null,
        "taxon_external_key": null,
        "taxon_meaning_id": null,
        "recorder_email": "xxxx@yyyy.it",
        "taxon_group": null,
        "taxon_group_id": null,
        "localities": null,
        "locality_ids": null
    }
}

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 (edited by carlo_politi 03-06-2015 22:55:14)

Re: Drupal 7 error

I'm getting this other error, when i try to use the map explorer form:

Notice: Undefined index: explore-ownData in iform_map_explorer::get_form() (line 230 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/prebuilt_forms/map_explorer.php)

i get error when i try to set "ownData=1"...


and setting this params, i get also:

general_errors.There was an SQL error: ERROR: syntax error at or near "ORDER" LINE 36: ORDER BY o.id DESC LIMIT 3000 ^ - SELECT o.id as occurrence_id, w.title || ' | ' || o.survey_title as source, o.sample_id as sample_id, CASE WHEN o.preferred_taxon=o.default_common_name then o.preferred_taxon ELSE o.preferred_taxon || COALESCE(' | ' || o.default_common_name, '') END as taxon, o.taxon_group as taxon_group, o.taxa_taxon_list_id as taxa_taxon_list_id, o.location_name as location_name, regexp_replace(o.public_entered_sref, ',[^ ]', ', ', 'g') as entered_sref, o.date_start as date_start, o.date_end as date_end, o.date_type as date_type, CASE WHEN w.id IN (2) THEN '' ELSE w.title || '-> ' END || CASE WHEN LENGTH(o.recorders)>30 THEN 'Recorder' ELSE o.recorders END as recorder, o.zero_abundance as zero_abundance, o.record_status as record_status, CASE WHEN CAST(o.created_by_id AS character varying) = '' AND o.website_id IN (2) THEN true ELSE false END as belongs_to_user, o.certainty as certainty, round(length(o.public_entered_sref) / 24.0, 2) as fo, case o.record_status when 'C' then case o.certainty when 'C' then 'green' when 'L' then 'orange' when 'U' then 'red' else 'blue' end when 'V' then 'green' when 'D' then 'orange' when 'R' then 'red' else 'black' end as sc, case o.record_status when 'V' then 'green' when 'D' then 'orange' when 'R' then 'red' else 'blue' end as fc, length(o.public_entered_sref) as zi, st_astext(o.public_geom) as geom, o.images as images, case when o.input_form is null then '' else o.input_form end as input_form FROM cache_occurrences o JOIN websites w on w.id=o.website_id JOIN users privacyusers ON privacyusers.id=o.created_by_id WHERE (o.training=false OR o.training IS NULL) AND (o.website_id in (2) OR privacyusers.allow_share_for_reporting=true OR privacyusers.allow_share_for_reporting IS NULL) AND o.website_id in (2) AND o.record_status not in ('I','T') AND (1=1 OR o.record_status not in ('D','R')) AND (''='' OR st_intersects(o.public_geom, st_geomfromtext('',900913))) AND o.created_by_id= ORDER BY o.id DESC LIMIT 3000

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

9

Re: Drupal 7 error

Hi

I can see the SQL error is caused by the 'AND o.created_by_id=' filter. The indicia user id is missing. If you edit your user account, under the system settings, is Indicia Warehouse User ID set to the correct value?

Jim Bacon.

10

Re: Drupal 7 error

Hi Jim
the user was not setted correctly... I have corrected but i get this error now:


    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Notice: Undefined variable: cookieParams in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_diff_key(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2238 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: array_merge(): Argument #1 is not an array in report_helper::get_report_grid_current_param_values() (line 2242 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).
    Warning: Invalid argument supplied for foreach() in report_helper::get_report_grid_current_param_values() (line 2255 of /var/www/drupal-7.36/sites/all/modules/iform/client_helpers/report_helper.php).


I see the map but also all other records, not only mine..

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: Drupal 7 error

i have tried now to replace 0.90 map_explorer.php with 0.81 and i continue to see the error but i see my own data now...

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

12

Re: Drupal 7 error

Hi

Rather than going back to an older version, I would suggest updating the whole IForm module from the code repository at https://code.google.com/p/indicia/ to get the latest development snapshot. It contains various bug fixes so could solve the problem.

For example, I can see the use of the $cookieParams variable is now wrapped up in

if (isset($cookieParams) && is_array($cookieParams)) {
}

which would prevent some of those errors you are seeing.

You'll need a subversion client to get the code from http://indicia.googlecode.com/svn/drupa … unk/iform.

Jim Bacon.

13

Re: Drupal 7 error

Hello again to everyone,
i don't know if exactly is a drupal 7 error or indicia but i'm trying to upload an image to an observation and in the upload of warehouse (0.9.0), i don't get the thumbfile, only the original. for example:

i see /IndiciaWarehouse090/upload/o_19n4ko1qo1a171llnm2al39p4b8.jpeg

but not /IndiciaWarehouse090/upload/thumb-o_19n4ko1qo1a171llnm2al39p4b8.jpeg

When the system was with drupal6 and warehouse 0.8 i had both files created... Is there a config file or settings to set to create the thumb? drupal 7 and warehouse 0.9.0 are fresh installations so maybe i have missed some setting...

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

14 (edited by dieter 06-06-2015 16:56:44)

Re: Drupal 7 error

You should install the latest version which is 0.9.1 which you can find on the google repository. Working with that version (0.9.0) is a bad idea.

But back to my topic. :P
That code did the trick. However when trying to load the vertification 4 form I get following error:

Notice: Undefined index: wms_base_title in iform_map_get_map_options() (line 277 of C:\xampp\htdocs\test_web\sites\all\modules\iform\client_helpers\prebuilt_forms\includes\map.php).
Notice: Undefined index: tile_cache_layers in iform_map_get_map_options() (line 286 of C:\xampp\htdocs\test_web\sites\all\modules\iform\client_helpers\prebuilt_forms\includes\map.php).
Notice: Undefined index: openlayers_options in iform_map_get_ol_options() (line 387 of C:\xampp\htdocs\test_web\sites\all\modules\iform\client_helpers\prebuilt_forms\includes\map.php).

PS: I took advantage to upgrade my php to 5.6+ and copying all my files in a new version of XAMPP

Dieter

15

Re: Drupal 7 error

I have tried to install 0.9.1 from SVN over 0.8 and then over 0.9.0 but i have the same problem, that's the thumb is not generated... i have tried to upload directly from the warehouse but nothing... the file "thumb-" is not generated...

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

16 (edited by dieter 06-06-2015 18:45:19)

Re: Drupal 7 error

I'll create a different topic.  Sorry but else two topics get mixed.

17

Re: Drupal 7 error

maybe i have solved... is it possible that ".jpeg" files are not correctly understood by system and not salved in the right way? if i use a ".jpg" file, thumb is created... using drupal 7 and warehouse 090

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

18

Re: Drupal 7 error

Hi Carlo, Did you implement any kind of fix for this, other than telling people to upload jpg and not jpeg files? I have the same issue...
Alice

19

Re: Drupal 7 error

Hi

How up to date is your warehouse code? A bug fix for a problem like this was committed over a year ago. https://github.com/Indicia-Team/warehou … a62cdac2b6

Jim Bacon.

20

Re: Drupal 7 error

Hi Jim, My warehouse files are older than that. Guess I need to take the plunge and upgrade! Thanks.

21 (edited by Jim Bacon 11-11-2016 10:07:41)

Re: Drupal 7 error

Good idea.

Note that the downloads page now points to Github so that it always yields the latest release. Our code management has improved so updates are now coming out much more frequently. However, this is not a fully packaged download so you also need to download the client_helpers and media repositories from Github too. Actually, I see our release process still leaves something to be desired... we have failed to mark the latest tagged versions as releases on Github. The latest tag is the best code to download.

The installation instructions have not been updated to describe this. If you are comfortable with Git then you might like to install a Git client to help track changes and easily pull them to keep your system updated. That is what we do but it has taken us a while to learn how to use it.

You'll be doing a substantial upgrade with a number of slow queries to run manually on the database. Testing it on a clone of your live system would be wise. Make sure you take backups and put the warehouse off line while you run the upgrade. Start a new thread if you need advice with the upgrade - we are a long way off the topic of the thread!

Jim Bacon.