When visiting the subscription local menu item for a "Product" content type (http://example.com/node//edit/subscription) I get an Internal 500 error.

PHP Fatal error: Call to undefined function uc_referer_uri() in /home/www/example.com/sites/all/modules/uc_recurring/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc on line 335, referer: http://example.com/node//edit

Am I missing a required a dependency?

here is line 335 from uc_recurring/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc:

    return confirm_form($form, '', uc_referer_uri(), t('This product is not a subscription product, saving this form will convert this product to a subscription product, which could result in data being lost if you have specified custom fields.'), t('Save product and convert to a subscription'), t('Cancel'));

Comments

citricguy’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha3
petarb’s picture

I just ran into this issue as well.
:(
Hope to hear some ideas.

monish_deb’s picture

The uc_referer_uri() is not being defined anywhere in the module. The function overrides the core function referer_uri() in D6, removed in D7 and replaced with global variable $_SERVER['HTTP_REFERER'], check here

So I replaced the function with global variable $_SERVER['HTTP_REFERER'] returns URI of the referring page (http://drupal.org/node/302763 #8)

    return confirm_form($form, '', $_SERVER['HTTP_REFERER'], t('This product is not a subscription product, saving this form will convert this product to a subscription product, which could result in data being lost if you have specified custom fields.'), t('Save product and convert to a subscription'), t('Cancel'));

Also tested in my local and it works for me .

citricguy’s picture

There seems to be a difference when creating a product using example.com/admin/store/subscriptions/create vs example.com/node/add/product

They both create products, but the subscription section is only available when using example.com/admin/store/subscriptions/create

I'll try to confirm this on a clean install when I can, but hopefully this will help with debugging.

rc2020’s picture

I can confirm this issue as well, fresh install.

Get fatal error: : Call to undefined function uc_referer_uri() in [syspath]/sites/all/modules/uc_recurring/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc on line 335

When accessing the edit functionality on two seperate pages:

http://prf.tripodcreative.com/node/2/edit/subscription

and

http://prf.tripodcreative.com/node/2/edit/subscription#overlay-context=n...

ericwongcm’s picture

I noticed this happens ONLY to existing product nodes BEFORE recurring module is activated.

If you create a new product AFTER recurring module is activated, there is no such error.

Hope this helps..

M. George Hansen’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.22 KB

This is a problem still in 7.x-2.x-dev. I've attached a patch with monish_deb's changes from #3 above. I've tested this against 7.x-2.x-dev on my localhost and it seems to solve the problem.

jsibley’s picture

Any chance of getting this committed?

Thanks.

univate’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

matthewo256’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha3
Status: Closed (fixed) » Patch (to be ported)

I ran into the same issue with uc_recurring 7.x-2.0-alpha3

I applied this fix manually, perhaps this could be added to the core?

Thanks!

TygrLili’s picture

This patch is throwing errors for me...

matthewo256 (and all) I'm running into this issue with uc_recurring 7.x-2.0-alpha3. Trying to apply the patch through terminal, no dice. I keep getting the following error:

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc b/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc
|index f3b8db2..e5d3201 100644
|--- a/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc
|+++ b/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc
--------------------------

So I took a look and noticed that the file paths are incorrect -- my module has the file path as modules/uc_recurring/uc_recurring.admin.inc (no 'subscription' anywhere in the path). So I changed the paths in the patch file accordingly, but got a similar error upon retrying (with the new paths).

So, then I figured I'd try what matthewo did and apply the patch manually -- but then I ran into another problem entirely, which is that I can't seem to see the lines that the patch indicates should be in uc_recurring.admin.inc already. The patch says -332,7 +332,7 but I can't find the provided reference lines anywhere in that area. This is what my lines 332 - 344 look like:

* @see http://drupal.org/node/1354
 */
function uc_recurring_admin_edit_form_validate($form, &$form_state) {
  //dpm($form_state);
  if (($form_state['values']['unlimited_intervals'] == 0 || empty($form_state['values']['unlimited_intervals'])) && intval($form_state['values']['number_intervals']) < 1) {
    form_set_error('number_intervals', t('Only positive whole number values are accepted for the number of billing periods.'));
  }
}

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */

So I'm not really sure whether I'm doing something wrong or maybe I'm just clueless? Can someone please help me...?? This is driving me nuts and I really need the recurring payment function...Is this module stable enough for production environments or should I be looking for something else to use on my client site?

I'm not sure whether perhaps I'm creating subscriptions wrong and that's why I'm running into issues? Should I be creating a product through the regular UC /add product form and then adding the subscription info from there, or going to /admin/store/subscriptions/create and doing it there. Neither way is working (adding a product is what got me this particular error, but adding a subscription gave me different errors because when I did that and went to test, after trying to check out, it said that the products in my cart were no longer available).

Anyway, hope this is detailed enough for some rapid help...I'm desperate. ;)

Thanks!

tadpoleskat’s picture

I had the same problem trying to locate the file to manually change then realised the path was /modules/uc_recurring/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc - silly me!

stewart.adam’s picture

Status: Patch (to be ported) » Closed (fixed)

As per #11, it's been committed to the repo - setting status to closed again.

Only the latest dev release will include the fix; if you're on alpha3, please apply the patch manually or copy that code segment from the dev release.

Michael-IDA’s picture

Same issue in latest build 7.x-2.0-alpha3 , so the patch apparently didn't make it to an actual release. This needs to be re-opened.

[07-Mar-2018 19:18:47 America/Chicago] PHP Fatal error:  Call to undefined function uc_referer_uri() in example.com/sites/all/modules/uc_recurring/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc on line 335