Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
By data dictionary, I guess I mean the civicrm xml files… I read somewhere that is what civi uses to generate the some of the code.
Re the html, you’ll hopefully be pleased to hear its not as bad as you think. The three html function are for development and debugging purposes – run them to explain how the class is proposing to perform the merge and how it got there – these functions merely provide a window into the logic called upon by autoMergeSQL – if you wanted I could easily tweak them to return a nested array instead of a html report. Given the need to do more work on this I wanted to build some proper windows into the machinery as I when along.
re “schema” – good question, sorry I didn’t realise would cause confusion (maybe showing my oracle roots) yep schema = database in mysql see http://lists.mysql.com/mysql/211616
Again, I am sorry for not reusing the existing code – but (1) its very scantly commented and I couldn’t follow it (2) it looked like it needed major surgery to extract form dependencies and (3) it is full of significant ‘todos’ and ‘fixmes’
Xavier autoMergeSQL() is ready to go – it just needs an api wrapper around it. It returns a single array with elements: is_error, error_message (on failure), sql (on success) and report.
I’ll swap out the drupal api calls for civicrm. So I’m happy to keep working on this, but I need to know I’m not wasting my time.
Function automerge_api_interface($param) { $result = AgcAutoMerge::autoMergeSQL($param['id'], $param['id_duplicate']); if ($result['is_error']) { return array($result['error_message']); } else { // where is the api definition for execute query? CRM_Core_DAO::executeQuery($result['sql']); if {{{no error returned by executeQuery}}} { return ($param[id];) } else { return {{{errors returned by executeQuery();}}} } }}
The existing manual merge code uses a good smattering of sql - so I'm assuming that 'safe entity transfer' isn't a current api call
so my question about the entitiy_id columns is:* how to identify which ones are a direct foreign key into civicrm_contact.id ?