It would be nice to have an option to add Family:group to the Family:location node similar to Family:individual having Family:group selection

CommentFileSizeAuthor
#9 family.install.txt7.7 KBMicrobe
#1 location.inc_.txt9.83 KBMicrobe

Comments

Microbe’s picture

StatusFileSize
new9.83 KB

I like your idea as it is something that work make attaching individuals to locations in bulk easier. I have therefore added it in but i dont have access to to CVS so cant upload straigt into the module so do the following:

run the following line in your mySQL database or similar using phpMyAdmin or similar. Adding a table prefix if you have one.

ALTER TABLE `family_location` ADD `related_group` INT( 5 ) UNSIGNED NULL DEFAULT NULL AFTER `country` ;

then upload over the current location.inc the attached file

This should make the changes but will only allow you to associate one group to each location, hopefully in the future I can change this to multiple groups.

DL’s picture

1 question: has this feature been committed to cvs?

Microbe’s picture

not as far as i know, i haven't.

pyutaros’s picture

Changes have been committed to CVS.

Notes:

Do not manually run the SQL query. Update.php will take care of this after the module has been updated.

I'm assuming these changes were made against the latest CVS files.

Consider making a patch in the future rather than uploading individual files. http://drupal.org/patch

Sorry for the extreme lack of activity lately. I'm having some employment issues that are severely sapping all of my time and resources. I'll message you later with my immediate plans for the module.

PS - Is import currently working?
Thanks,
Jonathan

DL’s picture

will test the update, thanks

DL’s picture

I downloaded the 5.x.3.1 and updated the module. I tried to edit the location index to add an ancestry and this is what I got:

user warning: Unknown column 'related_group' in 'field list' query: UPDATE family_location SET vid='7', title_format='Some title', building='Some building', street='Some street', city='Some City', county='Some County', state_province='some state', country='some country', related_group='5' WHERE nid='7' in /home/username/public_html/mysite/includes/database.mysql.inc on line 172.

Microbe’s picture

have you run update.php?

DL’s picture

yup, it added 1 table in DB, should I run it again?

Microbe’s picture

StatusFileSize
new7.7 KB

Still dont understand how to make patches so I will give you the new file. replace family.install with the following and then run update.php again this should work

pyutaros’s picture

I think you have the order of these updates wrong. Update numbers have to remain static to provide a sequence between versions.

function family_update_1() {
	$ret = array();
	$ret[]=update_sql("	
			CREATE TABLE {family_variable} (
			name VARCHAR ( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
			variable LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL
			) ENGINE = MYISAM
		");
	return $ret;
}
function family_update_2(){
	$ret = array();
	$ret[]=update_sql("	
ALTER TABLE {family_location} ADD related_group INT( 4 ) UNSIGNED NULL DEFAULT NULL AFTER country
		");
	return $ret;
}

Unless you can show me what I'm missing, I'm going to reverse order of these two.

Microbe’s picture

Nooooo DONT reorder them.
Some people will have update 1 already applied so by them changing it to update 2 when then apply update 2 it will repeat the update already made and not do what should be update 2. It doesn't matter that the changes were made in a different order as it will apply all updates up to the one that needs doing.

not sure if that all makes sense but basically dont reorder them

pyutaros’s picture

It doesn't makes sense. I'm looking at api.drupal.org, and that's exactly the opposite of what it says you should.

http://api.drupal.org/api/function/hook_update_N/5

Help me understand why this is different.

Microbe’s picture

It says:

The database updates are numbered sequentially starting with 1 in each module. The first is mymodule_update_1(). A good rule of thumb is to remove updates older than two major releases of Drupal. Never renumber update functions.

So when you add a second update, as we are doing, the first one stays as 1 and the new one is 2. Which is what I have done. Even though i think i posted the update before you added yours then you shouldn't change the order in which you add them to CVS.

pyutaros’s picture

I think that's what I'm saying. The updates are a different order in CVS. Inputting them the way that you have them listed will change that order. That's why I want to change the order of what's in the file you updated. Am I still wrong?

Microbe’s picture

You added the family_variables update to CVS in 3.1 and called it update_1 (It will always be update 1 now) then I came along and added update_2 (which should always now be update 2) afterwards with the related_group update. This should be how they are labelled and i think they are labelled like this but if not I'm sorry they are supposed to be changed.

pyutaros’s picture

Microbe,
Let me just apologize. I must be half dead, asleep, or something. They are in the right order. They have always been in the right order. I'll go ahead and apply it as is.
Sorry again,
Jonathan

pyutaros’s picture

Okay changes have been applied to CVS. New version 5.x-3.2 available. Going to go check my head. Microbe, I'm going to take the conversation offline now to discuss going forward.

DL’s picture

thanks, will test this ASAP.

DL’s picture

just tested it and there was no error like i reported in #6. great work

pyutaros’s picture

Assigned: Unassigned » pyutaros
Status: Active » Fixed

Setting to fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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