Fatal error: Call to undefined function drupal_set_header() in /mywebsite.com/sites/all/modules/ubercart/uc_reports/uc_reports.module on line 270

I got this error on site: /admin/store/reports/getcsv/uc_sales_yearly/1
When I clicked to generate csv.

CommentFileSizeAuthor
#4 1101500.patch3.22 KBtr
#2 1101500.patch4.93 KBtr

Comments

tomas.teicher’s picture

replacing "drupal_set_header" to "drupal_add_http_header" solves the problem. drupal_set_header is not more in D7.

tr’s picture

Status: Active » Fixed
StatusFileSize
new4.93 KB

Thanks. There were a number of other calls to drupal_set_header() scattered throughout the code - this function was renamed in Drupal 7 core and evidently it wasn't changed everywhere in Ubercart. Patch attached and committed to 7.x-3.x.

tomas.teicher’s picture

Thank you very much. It works! I just don't understand that dpm() function is added in shipping/uc_ups/uc_ups.module file . I think it should be commented, it is only for testing and needs Devel module.

tr’s picture

StatusFileSize
new3.22 KB

Oh sorry, that shouldn't have been part of the patch. That was something else I was working on at the time. I only committed the changes to uc_googlecheckout.module, uc_googlecheckout.pages.inc, uc_cybersource.module, and uc_reports.module. Here's the correct patch as committed:

longwave’s picture

Status: Fixed » Needs work

Looking at the documentation I think this needs work - the function takes two parameters, you need to include "Status" as the first parameter when setting the HTTP response code.

http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal...

tr’s picture

Status: Needs work » Fixed

@longwave: Yup, you're right. Fixed (again). I didn't read that API doc - I just read the Converting 6.x modules to 7.x changelog, which had the wrong information. I'm editing that now ...

Status: Fixed » Closed (fixed)

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