@ Olivier
re: because an organization entry can not have a first and last name… Why not?
I’ve never seen an organization (business) that had a first and last name with the possible exception sole proprietorship, even then many operate under a org (business) name. So, Joe Smith and Bros Plumbing would still be an org name even though Joe Smith is within the org (business) name. Joe Smith would be its contact name, not the org name. So, with that said, an org can not have a first and last name and it will not be saved.
re: If you want to force importing Organization that would override the automatic selection based on “Last Name”. I just tested it and it’s unfortunately not working.
Sounds like you’re using an old version of the CSV Import.
re: The best would be to have a relational database with 1 Org. to n Ind.
Sure, if there were enough of a demand for such a structure. From my experience in supporting Connections that’s a level of complexity that would be lost on most and not really even needed to meet their needs.
@re: Connexion\Plugins\connections-csv\submenu\csv.php I modified line 253
Looks like you’re using CSV Import 0.8. That’s pretty old. The current version is 1.2. You should really update. You can download it from your purchase history.
Updating will not change the entry type logic, if anything it is a bit more explicit:
/*
* Attempt to determine the entry type by the data supplied in the CSV
* If the type is not supplied, it must be either these values:
*
* * individual
* * organization
*
* If it can not be determined by the supplied data, unset the row.
*/
// Valid entry types.
$entryTypes = array( 'individual', 'organization' );
$entryType = isset( $row->entry_type ) && ! empty( $row->entry_type ) ? strtolower( $row->entry_type ) : NULL;
// Set the entry type if it was supplied in the CSV file.
// If the entry type was not supplied, attempt to guess it from the supplied data.
if ( 'individual' == $entryType &&
( ( isset( $row->first_name ) && ! empty( $row->first_name ) ) && ( isset( $row->last_name ) && ! empty( $row->last_name ) ) ) ) {
$entry->setEntryType( 'individual' );
} elseif ( 'organization' == $entryType && ( isset( $row->organization ) && ! empty( $row->organization ) ) ) {
$entry->setEntryType( 'organization' );
} elseif ( ( isset( $row->first_name ) && ! empty( $row->first_name ) ) && ( isset( $row->last_name ) && ! empty( $row->last_name ) ) ) {
$entry->setEntryType( 'individual' );
} elseif ( isset( $row->organization ) && ! empty( $row->organization ) ) {
$entry->setEntryType( 'organization' );
}
re: unfortunately I lost all the last names
You can force entries to be imported to a specific type, as explained, but an org entry can not have a first and last name, the data will not be saved.
To me, and I’m making assumptions here, it sounds like you’re really importing individuals that are part of an org/dept, not the other way around.
Import your csv file as individuals with first and last names, do not make them contact names because that is completely different. Make sure each individual has their org and dept fields set.
Now, go to the Connections : Settings admin page and click the advanced tab. Enable the link options for org and dept.
You’ll still be presented with a list of individuals but their org and dept names under their names will be links. When a user clicks on those links the results will be filtered by the org or dept the user clicked.
I hope it helps get you closer to what you’re trying to achieve.