hi guys

any ideas why im getting this error on the page im displaying my views calc?
the views outputs the correct information but im getting this error aswell

Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /modules/views/handlers/views_handler_field.inc).
Notice: Undefined variable: decimal in views_calc_table_total() (line 311 of /modules/views_calc/theme.inc).
Notice: Undefined variable: decimal in views_calc_table_total() (line 319 of /modules/views_calc/theme.inc).
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /modules/views/handlers/views_handler_field.inc).
Notice: Undefined variable: decimal in views_calc_table_total() (line 311 of /modules/views_calc/theme.inc).
Notice: Undefined variable: decimal in views_calc_table_total() (line 319 of /modules/views_calc/theme.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ironbuilt’s picture

subscribing...

prezaeis’s picture

Anyone?

vthirteen’s picture

exactly the same here

prezaeis’s picture

Im assuming its got something to do with the decimal point in the integer field

jorgecsilva’s picture

Hi,

I think is an extra $ in line 311 of theme.inc file of the module. At least it solved for me.

Jorge

uaparac’s picture

Hi

The post of Jorge solved some errors but there are still some unresolved.

Notice: Undefined property: view :: $ row_index in views_handler_field-> get_render_tokens () (line 1355 of / home / centrof / public_html / sites / all / modules / views / handlers / views_handler_field.inc).

Notice: Undefined property: view :: $ row_index in views_handler_field-> get_render_tokens () (line 1355 of / home / centrof / public_html / sites / all / modules / views / handlers / views_handler_field.inc).

Thanks Pedro

KarenS’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Undefined variable notices are not critical errors.

I don't see any of these errors. I need steps to reproduce (and be sure you are using the very latest code).

ayang’s picture

FileSize
39.67 KB

Hi Karen,

I am also getting the errors related to the views_handler_field.inc. I have included the exported view as an attachment. Hopefully this can help you in reproducing and debugging the problem.

Thanks,
Andrew

joseph.muennich’s picture

I get a similar set of error messages.

Below are details for two examples with slightly different error output.
note: In each case the Views Calc Table below the error messages looked to be rendered correctly.

Modules / versions in use:
Views Calc / 7.x-1.0
Views / 7.x-3.3

Example 1:
I constructed a page display using 3 visible fields from a content type (Title and two integer fields)
Format: Views Calc Table
Used "Sum" calculation in Views Calc Table > Settings for 2nd integer field

Recieved 1 iteration of the following error message for each node processed in the display: "Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /my_site.com/modules/views/handlers/views_handler_field.inc)."

Followed by 2 error messages:
"Notice: Undefined variable: decimal in views_calc_table_total() (line 310 of /my_site.com/modules/views_calc/theme.inc)."
"Notice: Undefined variable: decimal in views_calc_table_total() (line 318 of /my_site.com/modules/views_calc/theme.inc)."

Example 2:
I constructed a page display using 3 visible fields from a content type (Title and two integer fields) and 1 node reference field that was excluded from display
Format: Views Calc Table
Used "Sum" calculation in Views Calc Table > Settings for 2nd integer field
Set Grouping field Nr.1 to the node reference field.

For each grouping:

I received 2 iterations of the following error message for each node processed in the display: "Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /my_site.com/modules/views/handlers/views_handler_field.inc)."

Followed by 2 error messages:
"Notice: Undefined variable: decimal in views_calc_table_total() (line 310 of /my_site.com/modules/views_calc/theme.inc)."
"Notice: Undefined variable: decimal in views_calc_table_total() (line 318 of /my_site.com/modules/views_calc/theme.inc)."

amagdy’s picture

FileSize
2.07 KB

same here, i created a patch for it

prezaeis’s picture

can u tell us what the problem was?

amagdy’s picture

the module is working, but it would give me three pages full of warnings because of undefined variables, it is a simple thing, but not acceptable by my client :).

mainly there was four issues

  • $view->row_index is required, i set it to null
  • i had a field rewritten, it throw an single (i show up a tid, and turned it to some/link/tid) it threw an error till i made this check $baserow->{$query_alias} = isset($totals->{$query_alias}) ? $totals->{$query_alias} : '';
  • third one is that i had $$decimal where $decimal is undefined, i changed it to $decimal
  • and there was a php syntax error in a statement
while ($result as $calc_field) { 
//.. i changed it to 
foreach ($result as $calc_field) {

review the patch for exact code changes, now there is zero warnings

prezaeis’s picture

wow ur amazing thanks a lot

dealancer’s picture

I have the same problem, but I could not apply patch #10.

frishaynes’s picture

#10 worked for me, thanks

laboratory.mike’s picture

I had trouble applying the patch in #10 also; there's a few parts where "a" is substituted for "views_calc" in the patch, and I had to go through and apply those parts of the patch manually. The errors were gone after manually applying the patch.

Richard_1618’s picture

This command was issued: /usr/bin/patch -p1 --verbose -d '/home/projectc/public_html/sites/all/modules/views_calc' -i '/home/projectc/public_html/sites/default/files/patches/views_calc[1].patch'

Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Naur a/theme.inc b/theme.inc
|--- a/theme.inc 2012-05-21 03:22:17.000000000 +0200
|+++ b/theme.inc 2012-06-13 22:27:51.540701849 +0200
--------------------------
Patching file theme.inc using Plan A...
Hunk #1 FAILED at 87.
Hunk #2 FAILED at 257.
Hunk #3 FAILED at 308.
3 out of 3 hunks FAILED -- saving rejects to file theme.inc.rej
Hmm... The next patch looks like a unified diff to me...
can't find file to patch at input line 33
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Naur a/a_handler_sort.inc b/a_handler_sort.inc
|--- a/a_handler_sort.inc 2012-05-21 03:22:17.000000000 +0200
|+++ b/a_handler_sort.inc 2012-06-13 22:04:05.017043022 +0200
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
Hunk #1 ignored at 6.
1 out of 1 hunk ignored
done

Please help (",)

sonictruth’s picture

FileSize
2.15 KB

As #16 pointed out: "a" is substituted for "views_calc" in the patch for some reason. I fixed it and just patched my copy and it looks like it's working great. I will attach my working patch.

p4s_help’s picture

FileSize
199.42 KB

I've tried your new patch, and I get the same errors as #17, which is what I recieved for the original patch.

Both the dev version and the 'proper' release produce the same errors, but the patch doesn't work on either.

Attached are the errors I recieve when using viewscalc.

Also, I don't undertand alot about the backend of Drupal, but why do these errors not show when previewing on the views page itself?

surf12’s picture

good...worked for me, thanks.....

Norberto Ostallo’s picture

Status: Postponed (maintainer needs more info) » Needs review

I had the same errors and patch in #18 (manually applied) solves the problem for me.
Setting the issue to "needs review".

DSN’s picture

Hi Jorge,

really it's good worked for me

Thank's
Deepak

mallezie’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch in #18 works.
Setting to ready

morenstrat’s picture

#18 works for me too.

KingSalibah’s picture

#18 worked for me. Thanks!

vivdrupal’s picture

#18 Works like a charm!

pmichelazzo’s picture

Patch #18 working. Thanks!

jdufaur’s picture

Patch #18 working well. Thanks!

j3ann0t’s picture

Patch #18 works perfect. Tx!

jaspm2004’s picture

#18 worked flawlessly!!! many thanks!

prezaeis’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Problem fixed

mallezie’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Reopening to allow maintainers to fix this. Issue should only be closed when patch is commited.

a.milkovsky’s picture

FileSize
1.77 KB

1st: I agree with #18 about "Notice: Undefined variable: decimal..." issue. There are two signs "$" before variable.
2nd: I have another solution that differs from #18 about "view::$row_index" issue.
If you compare the code of table layout in views with views_calc table you'll notice that they are rendered in little different way.
There is the comment in views table:

  // Fields must be rendered in order as of Views 2.3, so we will pre-render
  // everything.
  $renders = $handler->render_fields($result);

This patch also fixed another problem for me: that views bulk checkboxes doesn't appear.

mdelpozo’s picture

It worked for me!

johnlaine’s picture

#18 worked for me, Thanks!

windmaomao’s picture

need to include this to fix another bug on saving custom calc field

LINE 323,

  foreach ($edit as $delta => $item) {
    if (!is_array($item) || !is_numeric($delta) || $item['calc'] == '') {
      // remove blank fields, don't save them
      continue;
    }
KarenS’s picture

Status: Reviewed & tested by the community » Fixed

There are duplicate reports of these issues. I just committed a couple fixes on other issues which should solve these problems. The solution may not be the same.

ChrisValentine’s picture

Ref post #19 by p4s_help - same for me - I updated to the more recent dev release (no better) then applied the patch in #18 but I still get errors as below that do not appear in the view preview.

Notice: Undefined property: view::$sub_totals in template_preprocess_views_calc_table() (line 220 of /data/web/fns/drupal/sites/all/modules/views_calc/theme.inc).
Notice: Undefined property: view::$totals in template_preprocess_views_calc_table() (line 223 of /data/web/fns/drupal/sites/all/modules/views_calc/theme.inc).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

arantas’s picture

Thanks! it worked fine for me, :-)

presleyd’s picture

Status: Closed (fixed) » Reviewed & tested by the community

I don't see any releases which contain this patch, Karen can you please clarify where these fixes were committed?

alblez’s picture

#33 work for my, thanks
using patch

RdeBoer’s picture

Patch from #33 works a treat on Views Calc 7.x-1.0 with Views 7.x-3.7.
Or use 7.x-1.x-dev ... it works out of the box without the errors, no patch required.
Rik

ChrisValentine’s picture

The #18 patch fixed most of the errors but I still had one, which fixed in theme.inc line 225:

- if ($view->totals) {
+ if (isset($view->totals)) {

So now no errors - but I still need column summation to work with groups of rows.

jvandyk’s picture

The original issue remains in both 7.x-1.x-dev (line 311 of theme.inc) and 7.x-1.0 (line 310 of theme.inc).

The problem is that there are two dollar signs in the assignment instead of one.

$$decimal = ...

should be

$decimal = ...

This results in the following error:

Undefined variable: decimal in views_calc_table_total() (line 310 of sites/all/modules/views_calc/theme.inc).
Notice: Undefined variable: decimal in views_calc_table_total() (line 318 of sites/all/modules/views_calc/theme.inc).
loophole080’s picture

I was still getting a variety of undefined index/property etc type errors with latest dev version. This may be an edge case as I'm using time_tracker custom entities/views and various fields pulled in with relationships.

However, in case it helps anyone, the attached patch fixes for me (applied agains latest dev).

I don't think this patch fixes the root cause, it's basically a work around adding some checks in where fields are missing in the $options['info'] arrays and/or $totals object, although the module code is expecting the fields to be available... So, maybe something further up the line needs to be addressed as to why the fields are not getting into that array/object as expected?

loophole080’s picture

ps The above patch was developed against latest dev snapshot, which fixes "Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens()" separately, so...

If you apply this patch to 1.x-dev tarball version you will still get that one error, but if you apply it against the latest snapshot, should be all OK!

cameron prince’s picture

I can confirm that the patch in #46 does not resolve the double $ bug described in #45, regardless of version.

News4u’s picture

Great #10 worked

but remains one more error unsolved:
Notice: Undefined property: stdClass::$sum__unknown in views_calc_table_total() (line xxx of /[path]/modules/views_calc/theme.inc).

News4u’s picture

Great #10 worked

but remains one more error unsolved:
Notice: Undefined property: stdClass::$sum__unknown in views_calc_table_total() (line xxx of /[path]/modules/views_calc/theme.inc).

Note: I enabled the global Math expression in view to have a new column of field row

ssoulless’s picture

Please commit the patch in #10 this is an old issue.

ssoulless’s picture

Component: Miscellaneous » Code
Priority: Normal » Major
Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
1.89 KB

Well after apply #10 I saw other problems with undefined property notices...

So here is a new patch with a little modification, I have it working on my production site and all seems great! no more errors and the module is working great.

Please review it.

KarenS’s picture

The zip file for dev did not quite match the git checkout of dev, some of the latest fixes weren't in it. I have also made some additional fixes which I think cleans everything up. I can't reproduce any errors in the latest git checkout so I think this is all working now.

KarenS’s picture

Status: Needs review » Fixed
wismbuh’s picture

open line 310 on theme.inc
before:
$$decimal = !empty($fields[$field]

and after
$decimal = !empty($fields[$field]

it's work on me :-)

version = "7.x-1.0"
core = "7.x"
project = "views_calc"
datestamp = "1337564217"

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.