diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 0d667b5..15c44e9 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -148 +149 diff --git a/db/db.update.149.php b/db/db.update.149.php index 02b99d9..d8a90ab 100644 --- a/db/db.update.149.php +++ b/db/db.update.149.php @@ -1,8 +1,8 @@ relation)); @@ -10,9 +10,9 @@ function db_update_142_post() { || levenshtein('mother',$relation)<3 || levenshtein('father',$relation)<3 || levenshtein('mom',$relation)<2 - || levenshtein('mere',$relation)<2 + || levenshtein('mere',$relation)<3 || levenshtein('dad',$relation)<2 - || levenshtein('pere',$relation)<2 + || levenshtein('pere',$relation)<3 || strstr($relation,'dad') || strstr($relation,'mom') || (strstr($relation,"mother") && !strstr($relation,"grand")) @@ -23,8 +23,11 @@ function db_update_142_post() { if($r->email) { echo " Have email, creating record - $r->email\n"; if($u=db146_user_load_by_email($r->email)) { - echo "This user already exists, linking parent record to their account!"; - db146_user_create("parent",$r->email,$u); + echo " This user already exists, linking parent record to their account!\n"; + if(!in_array("parent",$u['types'])) + db146_user_create("parent",$r->email,$u); + else + echo " - Already a parent, no need to re-add!\n"; } else { echo "Creating new parent record\n"; @@ -37,7 +40,7 @@ function db_update_142_post() { } } else { - echo "No email address, skipping"; + echo " No email address, skipping\n"; } } else {