Installed nap along with ubercart (7.x-3.0-rc3) for drupal 7.1 . I am getting following warning messages

Notice: Undefined variable: results in nap_node_grants() (line 799 of C:\xampp\htdocs\website\sites\all\modules\nap\nap.module).
Warning: Invalid argument supplied for foreach() in nap_node_grants() (line 799 of C:\xampp\htdocs\website\sites\all\modules\nap\nap.module).
Notice: Undefined variable: results in nap_node_grants() (line 799 of C:\xampp\htdocs\website\sites\all\modules\nap\nap.module).
Warning: Invalid argument supplied for foreach() in nap_node_grants() (line 799 of C:\xampp\htdocs\website\sites\all\modules\nap\nap.module).

I have not tinkered with any code in nap module.

Comments

sminons’s picture

I am also getting the following error message after installing nap.
Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2135 of C:\xampp\htdocs\website\includes\database\database.inc).

light9’s picture

subscribe

danielb’s picture

I made a quick code change regarding the first error but I'd have to do some testing to find the cause of the second one.

sminons’s picture

Is there anything I could do to help you? Thanks for the update.

sminons’s picture

Applied the update and I was trying to add a new product when the following error occurred

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''theatre_movies_' ORDER BY n.title, n.nid' at line 1: SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 AND n.type IN :types_theatre_movies_ ORDER BY n.title, n.nid; Array ( [:types_theatre_movies_] => theatre_movies_ ) in nap_get_nodelist() (line 1219 of C:\xampp\htdocs\website\sites\all\modules\nap\nap.module).

Addn info:
Webframework : XAMPP 1.7.7
MySQL Version : 5.5.16
Installed drupal version : 7.10

danielb’s picture

not sure but i suspect maybe there is a ":types" and ":types_something_else" and it is causing a confusion? Perhaps I will prefix the placeholder with 'nap_'

danielb’s picture

Hmm I found a couple more small problems which might affect this. You'll have to resave the config page for the module.

danielb’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still an issue?

joshuaw’s picture

Can't speak for the original poster, but I had an issue similar to #5 which was resolved by disabling and uninstalling NAP & NAP UC, then reinstalling it.

joshuaw’s picture

StatusFileSize
new9.34 KB

Rather new to all this, but I believe I have resolved this issue, and many others regarding the move to Drupal 7 and Ubercart 3.x, in the attached patch. Would love extra eyes on this.

danielb’s picture

Status: Postponed (maintainer needs more info) » Active
joshuaw’s picture

StatusFileSize
new1.59 KB

My QA found an additional issue, but with the attached patch, this module has passed our QA. The issue at hand was the usage of "0000-00-00 00:00:00" as the default value for the expiry_date field, where Drupal 7 uses the STRICT_ALL_TABLES option. Have converted checks to NULL instead.

danielb’s picture

There are some seriously questionable things in those patches, I think we'll have to dissect each change bit by bit.

joshuaw’s picture

I'm not sure what is questionable in the patches. Can you expand on that?

danielb’s picture

I think a lot of things have been snuck in that don't relate to this issue and while they may be positive changes they really could have used some discussion or a separate issue to properly address them, there are a number of drupal coding standards issues, some changes don't seem to change anything just added white space or slightly change the format of the code, and the patches are done against a packaged version not a git checkout which adds a lot of junk to the files that shouldn't be there.

There a lot of good changes too, and I thank you for spotting those, but I'm at a loss to figure out which ones are necessary to solving the current issue.

You've shed some light on a few major problems that were missed during the upgrade to Drupal 7 but at the same time the patch is quite busy and I'm worried I may commit something that while it fixes the problem for you, may introduce issues for people using the module in a different way.

I might just have to manually do some cumulative improvements and fixes based on your patch and we can then revisit whether this issue continues to be a problem. I may need your advice on the purpose of some of the changes when I get down to it.

Hopefully I will work on it very soon.

danielb’s picture

I need some feedback about this.

This code appears to remove CA integration and replaces it with rules. How will this affect users relying on the current CA functionality?

 /**
  * Implements hook_nap_save_purchase().
  */
 function uc_nap_nap_save_purchase($nap_purchases, $nap_transaction) {
-  if (module_exists('ca')) {
+  if (module_exists('rules')) {
     $order = uc_order_load($nap_transaction->txn_id);
-    ca_pull_trigger('uc_nap_purchase', $order);
+    rules_invoke_event('uc_nap_purchase', $order);
   }
 }
danielb’s picture

I've committed the changes I think are necessary, some I think do not change anything, and a couple I disagree with so I haven't added those.
I'd like to hear about this ca/rules thing, other than that I think any other changes should be discussed in a separate issue.

danielb’s picture

And I think if at this point the module is working we should consider making a tagged release of D7 finally

joshuaw’s picture

To my knowledge, conditional actions have been removed for Ubercart 3.x and replaced with Rules.

http://www.ubercart.org/forum/support/22086/where_are_conditional_action...

joshuaw’s picture

Of course, you are right about my changes being a lump sum and probably not the way things are not normally done, so I apologize for that. I'll just address specific issues in the future.

danielb’s picture

Status: Active » Needs review

Thanks, I've made that change too, and created a release candidate.
Can sminons or anyone else provide feedback about whether any of the original error message persist with the latest code?

danielb’s picture

I think more needs to be done with this rules thing. There is still a hook_ca_trigger() there instead of hook_rules_event_info(), and perhaps all of those should be moved into nap.module not uc_nap as rules is more generic than ca was. Nevermind that last bit, the code within there is uc specific.

danielb’s picture

something like this?

<?php
/**
 * Implements hook_rules_event_info().
 */
function uc_nap_rules_event_info() {
  $events['uc_nap_purchase'] = array(
    'label' => t('Order placed containing at least one NAP product.'), 
    'group' => t('Order'), 
    'variables' => array(
      'order' => array(
        'type' => 'uc_order', 
        'label' => t('Order'),
      ), 
    ),
  );
  return $events;
}
?>
danielb’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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