Creating sub-content based on csv file in parent (plone dexterity) - plone

I have created two content types in Plone 4.3 via Dexterity and created a Plone Product on the file system.
The types are
Supplier
item
Items can only exist in inside Supplier, and I can manually create new items without
I'd like to be able to create a bunch of items if I upload a CSV file while creating a supplier. Any way dexterity supports this (trigger, custom view...)?

You'd have to handle that in a custom view. There is no pre-existing code to handle that.
For simple cases, just read the uploaded file with the csv module and use the rows to create items in the Supplier container:
from plone.dexterity.utils import createContentInContainer
import csv
reader = csv.reader(uploadedfile)
for row in reader:
createContentInContainer(supplier, 'your.package.item', title=row[0], ...)
For more complex operations, you could build a transmogrifier pipeline with the transmogrify.dexterity to convert CSV-data to dexterity objects, but that is probably overkill here.

Related

Sugar CRM - creating new module using module builder

I wanted to create a new module in my copy of Sugar CRM. I selected a package, and went to create a new module (using module builder). The last field in the form asks to select a module type . If we select module type, say, user, then around 10-15 fields comes up in the module. These cannot be edited. But I wanted to create a module which would consists of only those elements I wanted to. So is there any way to create a new module without having those fields?
For example, I wanted to create a module called 'donation' which would contain the list of all donations made by the users (1 'User' can make MANY 'donation'). Since user field will
always contain all the user detail (example, first name, last name, email etc), so we do not repeat them for each donations made by the user. So donation module should contain only field like
["user-id", "donation-amount", "payment-method", "cc-number"].
Any Sugar usercan help me in this issue?
Thanks.
Just simply hide the unwanted fields on the various views. Some of these fields are basically required by the framework in one way or another (name, date_modified, etc). But it doesn't mean that you need to utilize them. The other additional fields could be removed from the vardefs.php if desired, but it isn't worth the hassle usually.

Symfony 1.4 sfguard plugin related tables

I am developing project with symfony 1.4 using sfguard plugin and propel orm. I have some tables related to sf_guard_user table. I have to show these tables all together on admin interface. But sfguard plugin only allow adding one table which is named as sfuserprofile. When I created this table, I can reach the columns of this tables from generator.yml.
But I have to add so many data to database which is related to user such as location, detailed address, tel numbers and of course all of associated tables. I can not store all of them on sfuserprofile table. I have create some tables such as user_profile, user_address_details, user_album_images etc. But I could not integrate all of these tables except user_profile table to generator file.
I have red the read me file but I could not find any clues. Is it possible adding another table column to sfguard generator file.
Edit:
The solution is merging the target form classes in userprofile form class.
Either use partials (fields defined with _ in front of them) or define getters in you sfGuardUser model for each field you want to display. More information http://www.symfony-project.org/book/1_2/14-Generators (look for Custom Fields and Partial Fields).
That is a symfony 1.2 documentation. Some of the things are different in symfony 1.4, but it's enough info there to get you going on the right track.

How can I import several taxonomy term values into a single term_reference field using the feeds module?

I'm using the feeds module on a drupal 7 instance and I have a content type with a term_reference field with the option to include multiple tags. My question is, how can I import multiple tags from a CSV file with the feeds module? I tried by adding more sources for the same target, terms are created on the database but only the last one remains on the created nodes.
Use Feeds tamper module to add explode function to mapper and map EACH entry(in this case, separate multiple values for single field by a pipe or similar).

Drupal: new content module for manage lists

Does anybody known about module for new content type "Lists", like a module WebForms used for manage different web forms, it ("Lists") manage different lists.
For example,
Admin create content of "Lists" (something like this.../node/add/list), where set up as minimum:
name, title and other common things;
fields of every record in list (like fields in WebForms);
setup hierarchy (how many level deep).
User can manage created list (.../node/???):
add/delete folders (for hierarchy);
add/delete records in folders (or root) fills all fields;
move records betweens folders;
browse list.
P.S. I try to search on drupal.org but word "list" is very "garbage" and I cannot find anything suitable.
Checkout NodeQueue module. This is closest to your description http://drupal.org/project/nodequeue

Custom Action when specific node-type content is created in drupal 6?

I have a requirement where the admin will upload an excel file to the site. Once the file is uploaded the data has to be imported to a table. And data from the table will be synchronized to nodes if they are present else new node is created. My question is i can do the synchronization using hook_cron but i have to import the data of excel file to a specific table on creation of node. How can i fire a custom action on a specific node type of node creation in drupal 6?
You can use hook_nodeapi with the $op of insert.
You will get a reference of the node, where you can test the node type and do what you need to do.

Resources