I enabled the MERCI module and configured it to use an existing content type (named Asset) at admin/settings/merci (NOT the built-in "Inventory" content type). After doing this, I would get an error when attempting to view a node of the Asset type (e.g. node/1154). The error was Fatal error: Unsupported operand types in path/to/drupal/install/merci.module line 1007

I'm using 6.x-2.0-beta10

The issue only happened with Resources. No error when set to Bucket.

The error occurred both when I had just the main MERCI module enabled, and when I had all of them enabled.

I have applied the patch on my dev system and it removed the error.

I'm not convinced that I'm properly using MERCI, but that's for another post 8^)

-James

CommentFileSizeAuthor
merci_operand.patch443 bytesjameswoods

Comments

darrick’s picture

I believe this begs the question. If an existing content-type becomes a bucket or resource should all currently existing content of that type be made into a reseravable item?

i.e if you created 1000 blog posts, then later made the content-type blog a resource should you then have 1000 reservable blog items?

or should only blog posts created after you changed the content-type to a resource be reservable?

I talked with kreynen on irc about this. For now we will not allow the merci_type_setting ('disabled', 'resource', or 'bucket') to be changed if there is existing content of that content type.

jameswoods’s picture

Forgive me if this reply should be on it's own thread...

Is it possible to enable the MERCI module on an existing Drupal-based inventory system?

I've got an inventory system that I built in Drupal which has nodes of content type "asset". Management now wants me to "add equipment checkout functionality". Is it possible to do this with MERCI?

No, onto a more selfish note, is my little patch worthy to be included? I've never contributed back to the community that has been so generous to me, but would love to 8^)

-James

darrick’s picture

Do you want all of your assets to be reservable? Or just some of them?

The patch was fine. But doesn't fix the real issue. $item_settings should never be false.

Migrating all your current assets to be reservable is not currently supported. I'm going to do what I said in post #1. But, I'll see if I can support the migration. I don't want to spend to much time on it.

If you are interested in adding the functionality yourself look at function merci_node_type_save_validate in merci.module. There will need to be a confirm page shown giving the admin the option to cancel or otherwise have all the current items become reservable items. Then in function merci_node_type_save_submit the merci_resource_node or merci_bucket_node and merci_reservation_item_node tables need to populated.

jameswoods’s picture

Possibly a few hundred out of 4,000ish would need to be reservable.

Don't bother spending time on writing migration functionality unless hoards of people start asking for it 8^)

Thank you for the starter tips on adding the functionality. I'll be getting back to management with my findings and see where they want to go.

-James

kreynen’s picture

Depending on the modules you've installed, you may be able to move nodes into a new content type by altering their type in your node table. The structure of the content_types must be identical so any CCK fields added to the asset type would need to be shared with asset_reservable.

There is actually a module that does this that tries to warn you about the dangers as well.

http://drupal.org/project/nodetype

On a simple site, I often switch story nodes into pages and delete the story type if the content types had been used interchangeably.

Orphaned CCK fields can cause problems when building your search index.

darrick’s picture

Title: Fatal error: Unsupported operand types in path/to/drupal/install/merci.module line 1007 » Allow changing merci type for a content type if content currently exists for that type
Version: 6.x-2.0-beta10 » 6.x-2.x-dev
Category: bug » feature