function display_fields($binding) { $fields = get_all_fields($binding); if ($fields) { echo "<fields count=\"" . count($fields) . "\">\n"; foreach ($fields as $field) { echo "<field id=\"" . $field->id . "\" name=\"" . $field->name . "\" label=\"" . $field->label . "\" " . "type=\"" . $field->type . "\" display=\"" . $field->display . "\" " . "visibility=\"" . $field->visibility . "\"/>\n"; } echo "</fields>\n"; } }
print_r($contacts); echo "Ready to migrate " . count($contacts) . " contacts from acct:list = {$src_acct}:{$src_list}\n"; $login_result = bronto_agency_login($dest_acct); if (!$login_result) { echo "Error: Unable to login to destination account id={$dest_acct}\n"; exit(1); } $binding = $login_result['binding']; if (!$use_ids) { $lists = get_lists_using_names($binding, $dest_list); if (!$lists) { echo "Error: Unable to map destination list name [{$dest_list}] to list ID\n"; exit(1); } else { if (count($lists) > 1) { echo "Error: More than one list matched destination list name [{$dest_list}]\n"; exit(1); } } $dest_list = $lists[0]->id; } echo "Retrieving fields for destination account id={$dest_acct}\n"; $dest_fields = get_all_fields($binding); echo "Got " . count($dest_fields) . " fields for this account\n"; // Create extra arrays to index the fields by fieldID and fieldName $dest_field_ids = array(); $dest_field_names = array(); foreach ($dest_fields as $fld) { $dest_field_ids[$fld->id] = $fld; $dest_field_names[$fld->name] = $fld; }
function get_contacts_inc_fields($binding, $filter) { $field_ids = array(); $fields = get_all_fields($binding); foreach ($fields as $field) { $field_ids[] = $field->id; } return get_contacts($binding, $filter, $field_ids); }