UC credit module invalid argument

Project:Ubercart Contributions
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

I just upgraded from v1.5 to v1.6 and when I go to the Payment settings page then click on the Payment gateways tab, I get the following error:

warning: Invalid argument supplied for foreach() in /home/lambspun/public_html/modules/ubercart/payment/uc_credit/uc_credit.module on line 147.

I re-uploaded the uc_credit.module file to make sure it wasn't corrupt. The lines in uc_credit.module in that area are:

foreach ($form['gateways'] as $key => $value) {
        // Get the transaction types associated with this gateway.
        $gateway_types = uc_credit_gateway_txn_types($key);

        // Default to authorization plus capture if none are specified.
        if (empty($types) && !is_null(_payment_gateway_data($key, 'credit'))) {
          $types = array(UC_CREDIT_AUTH_CAPTURE);
        }

        // Loop through all the available transaction types.
        $options = array();

        $txn_types = array(
          UC_CREDIT_AUTH_ONLY => t('Authorization only'),
          UC_CREDIT_AUTH_CAPTURE => t('Authorize and capture immediately'),
        );

        foreach ($txn_types as $type => $title) {
          // Add the current one to the options if the gateway supports it.
          if (in_array($type, $gateway_types)) {
            $options[$type] = $title;
          }
        }

        $form['gateways'][$key]['uc_pg_'. $key .'_cc_txn_type'] = array(
          '#type' => 'radios',
          '#title' => t('Default credit transaction type'),
          '#description' => t('Only available transaction types are listed. The default will be used unless an administrator chooses otherwise through the terminal.'),
          '#options' => $options,
          '#default_value' => variable_get('uc_pg_'. $key .'_cc_txn_type', UC_CREDIT_AUTH_CAPTURE),
          '#weight' => -5,
        );
      }

TIA

Version: 
Ubercart 1.6
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: UC credit module invalid argument

Looks like you don't have any payment gateway modules enabled. I've updated the code to accommodate that, but at least it's not preventing you to get to any settings. Sticking out tongue

Thanks for the report.

lindsayo's picture
Offline
Bug Finder
Joined: 03/04/2008
Juice: 86
Re: Re: UC credit module invalid argument
Assigned to:Ryan» lindsayo

You say you've updated the code to accommodate, does that mean there is a new build as of this morning I should use to upgrade my current installation?

-----
Five Rings Web Design
www.fiveringswebdesign.com
Drupal site dev, graphic design, HTML/CSS layouts, site maintenance, ...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: UC credit module invalid argument
Assigned to:lindsayo» Ryan

Nah, I committed the fix to our Bazaar repository. It's where the latest code gets posted until it's moved as a release to drupal.org. Learn more at http://www.ubercart.org/bazaar.

lindsayo's picture
Offline
Bug Finder
Joined: 03/04/2008
Juice: 86
Re: Re: Re: Re: UC credit module invalid argument
Assigned to:Ryan» lindsayo

Muchas gracias

-----
Five Rings Web Design
www.fiveringswebdesign.com
Drupal site dev, graphic design, HTML/CSS layouts, site maintenance, ...

lindsayo's picture
Offline
Bug Finder
Joined: 03/04/2008
Juice: 86
Re: Re: Re: Re: Re: UC credit module invalid argument

I downloaded the package from Bazaar (I didn't install Bazaar and run commands, that's a bit over my head) and put it on my website, got rid of the older version from 11/3/08. I'm still getting the same error.

-----
Five Rings Web Design
www.fiveringswebdesign.com
Drupal site dev, graphic design, HTML/CSS layouts, site maintenance, ...

lindsayo's picture
Offline
Bug Finder
Joined: 03/04/2008
Juice: 86
Re: Re: Re: Re: Re: Re: UC credit module invalid argument

Alright....I'm getting around this problem by enabling the test gateway.

-----
Five Rings Web Design
www.fiveringswebdesign.com
Drupal site dev, graphic design, HTML/CSS layouts, site maintenance, ...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Re: UC credit module invalid argument
Assigned to:lindsayo» Ryan

Sure... it might not have been packaged up yet there. I really wouldn't be worried about it, because if you don't have a payment gateway module installed then there aren't going to be any settings on that page anyways.