| SVN Codebase Only These instructions are only valid for environments where code has been sourced from our SVN repository. The required xml/schema files are not included in tarball distributions. |
If you want to hack certain fields to be importable, it's not too
difficult. All you have to do is modify the schema file and regenerate
the DAO code. Here's a brief example:
cd civicrm/xml/schema/Contact
your favorite editor Individual.xml
Find the <field> you'd like to make importable. For this example,
let's use "job_title". Add the following lines after the
"<length>64</length>" tag, but before "</field>":
<import>true</import>
<headerPattern>/^job.*title/i</headerPattern>
<dataPattern>/.*/</headerPattern>
The first line flags the field as "importable". The second line
defines a regular expression that will be used to match against column
headers in imported files. The last line is for a regular expression
to match against data itself, in the absence of a column header. If
you don't know what to use for these, "/.*/" will work. Then you can
go map the field manually in the wizard.
After you've changed that file, go back down to the "xml/" directory,
and run "php GenCode.php". This script generates the DAO files from
the XML schema. At this point, your field is now importable. If
you're running php4, you may have to run the php5->php4 conversion
script again.
Note that this merely makes the field importable, but does not add new
logic to handle fuzzy data. For instance, your if your gender data
consists only of single letters, you'll still have to write code to
convert it into the enum type expected by CiviCRM.
