Hi,

if I uncheck a domain assigment, I get an sql error (at least when using MySQL), because The IN() condition comes out empty. Instead of imploding the arguments and setting the operator to 'IN', you can simply pass an array. It works then. Following a patch to fix it (tested using current release of D7 and MySQL as DB adapter). Attached you find the modified file.

Cheers,

Martin

// $Id: domain_blocks.module,v 1.6 2011/02/11 20:38:19 nonsie Exp $

Index: sites/all/modules/domain_blocks/domain_blocks.module
===================================================================

@@ -98,14 +98,15 @@
// Unset previously checked values that are now unchecked
$domains_to_be_removed = array_diff($previous_domains, $current_domains);
if (!empty($domains_to_be_removed)) {
- $domains_to_be_removed = implode(',', $domains_to_be_removed);
$realm = 'domain_id';
if (isset($domains_to_be_removed)) {
db_delete('domain_blocks')
->condition('module', $module)
->condition('delta', $delta)
->condition('realm', $realm)
- ->condition('domain_id', $domains_to_be_removed, 'IN')
+ ->condition('domain_id', $domains_to_be_removed)
->execute();
}
}

Comments

Nephele’s picture

Status: Active » Needs review
StatusFileSize
new999 bytes

I encountered the same problem. I've converted elovaris' edit into a patch, and confirmed that it worked.

asyn’s picture

StatusFileSize
new912 bytes

You should not leave commented out lines of code in a patch. I've removed them and attached the new patch.

I confirm that it works as well.

nonsie’s picture

Status: Needs review » Fixed

Committed to 7.x-2.x

Status: Fixed » Closed (fixed)

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