Changeset 7d43f89 in github
- Timestamp:
- Jun 2, 2010 6:02:23 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 1126fc6
- Parents:
- 5800fb6
- File:
-
- 1 edited
-
program/steps/addressbook/copy.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/steps/addressbook/copy.inc
rca38db5 r7d43f89 34 34 35 35 if ($TARGET && $TARGET->ready && !$TARGET->readonly) { 36 if ($target_group && $TARGET->groups)37 $TARGET->set_group($target_group);38 39 36 $arr_cids = explode(',', $cid); 37 $ids = array(); 38 40 39 foreach ($arr_cids as $cid) { 41 40 $plugin = $RCMAIL->plugins->exec_hook('create_contact', array( … … 46 45 $a_record = $plugin['record']; 47 46 48 if (!$plugin['abort']) 49 if ($TARGET->insert($a_record, true)) 50 $success++; 47 if (!$plugin['abort']) { 48 // check if contact exists, if so, we'll need it's ID 49 $result = $TARGET->search('email', $a_record['email'], true, true); 50 51 // insert contact record 52 if (!$result->count) { 53 if ($insert_id = $TARGET->insert($a_record, false)) { 54 $ids[] = $insert_id; 55 $success++; 56 } 57 } 58 else { 59 $record = $result->first(); 60 $ids[] = $record['ID']; 61 } 62 } 63 } 64 65 // assign to group 66 if ($target_group && $TARGET->groups && !empty($ids)) { 67 $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array( 68 'group_id' => $target_group, 'ids' => $ids, 'source' => $target)); 69 70 if (!$plugin['abort']) { 71 $TARGET->reset(); 72 $TARGET->set_group($target_group); 73 74 if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($TARGET->count()->count + count($plugin['ids']) > $maxnum)) { 75 $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum)); 76 $OUTPUT->send(); 77 } 78 79 if (($cnt = $TARGET->add_to_group($target_group, $plugin['ids'])) && $cnt > $success) 80 $success = $cnt; 81 } 51 82 } 52 83 } … … 56 87 else 57 88 $OUTPUT->show_message('copysuccess', 'notice', array('nr' => $success)); 58 59 // close connection to second address directory60 $TARGET->close();61 89 } 62 90
Note: See TracChangeset
for help on using the changeset viewer.
