After installing this module I am no longer to delete nodes of any kind, it returns the following error:

Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2139 of /mysite/includes/database/database.inc).

I am running Ubercart 7.x-3.4+21-dev and Drupal 7.21

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slobo’s picture

Status: Active » Needs review

problem is in uc_restrict_qty.module

<?php
function uc_restrict_qty_node_delete($nid) {
  db_query("DELETE FROM {uc_restrict_qty_products} WHERE nid = :nid", array(':nid' => $nid));
}
?>

hook_node_delete provides $node, not $nid

Correct version:

<?php
function uc_restrict_qty_node_delete($node) {
  db_query("DELETE FROM {uc_restrict_qty_products} WHERE nid = :nid", array(':nid' => $node->nid));
}
?>
RaulMuroc’s picture

Attached a patch with solution.

Please, test & review it.

Thank you.

Risha’s picture

Thank you very much guys, the patch works correctly and nodes can be deleted normaly now as they should be, without any errors. Best regards and thanks again.

RaulMuroc’s picture

Status: Needs review » Reviewed & tested by the community
RaulMuroc’s picture

Status: Reviewed & tested by the community » Needs review
RaulMuroc’s picture

Status: Needs review » Closed (fixed)

Commited and included to the Ubertcart Restrict Qty's first stable version.

muhammad.tanweer’s picture

This fixed the issue. Its a silly mistake by the people of uc_restrict_qty module though.
Thanks anyways,

Muhammad
www.app-desk.com

RaulMuroc’s picture

And last comment is nonsense comment by muhammad.tanweer.
Thanks anyway :-)

neochief’s picture

Status: Closed (fixed) » Needs work

The patch is incomplete. Take a look at the function parameter. It should be $node instead of $nid.

neochief’s picture

Status: Needs work » Needs review
FileSize
460 bytes
RaSpirit’s picture

Comment fix missed, attached patch should be fine

webservant316’s picture

is this patch committed to dev?

webservant316’s picture

see this issue for all the patches I needed to get this module working...

https://www.drupal.org/node/2144385#comment-9393401

RaulMuroc’s picture

Status: Needs review » Closed (fixed)