summaryrefslogtreecommitdiff
path: root/program/steps/addressbook/copy.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-06-01 18:11:57 +0000
committerthomascube <thomas@roundcube.net>2010-06-01 18:11:57 +0000
commitca38db5744bc8c46c4a23d1ba68c6c4c9b5b4a07 (patch)
tree1f6d38db2dc1ffd33232e19396bc4bf51f013cc9 /program/steps/addressbook/copy.inc
parentbb502908b24da460826f46591513748e372935fc (diff)
Allow to drag into groups of another address source
Diffstat (limited to 'program/steps/addressbook/copy.inc')
-rw-r--r--program/steps/addressbook/copy.inc14
1 files changed, 11 insertions, 3 deletions
diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc
index c8076c40e..2d3a91a6f 100644
--- a/program/steps/addressbook/copy.inc
+++ b/program/steps/addressbook/copy.inc
@@ -25,6 +25,7 @@ if (!$OUTPUT->ajax_call)
$cid = get_input_value('_cid', RCUBE_INPUT_POST);
$target = get_input_value('_to', RCUBE_INPUT_POST);
+$target_group = get_input_value('_togid', RCUBE_INPUT_POST);
if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && strlen($target) && $target !== $source)
{
@@ -32,12 +33,19 @@ if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && strlen($t
$TARGET = $RCMAIL->get_address_book($target);
if ($TARGET && $TARGET->ready && !$TARGET->readonly) {
+ if ($target_group && $TARGET->groups)
+ $TARGET->set_group($target_group);
+
$arr_cids = explode(',', $cid);
foreach ($arr_cids as $cid) {
- $plugin = $RCMAIL->plugins->exec_hook('create_contact', array('record' => $CONTACTS->get_record($cid, true), 'source' => $target));
- $a_record = $plugin['record'];
+ $plugin = $RCMAIL->plugins->exec_hook('create_contact', array(
+ 'record' => $CONTACTS->get_record($cid, true),
+ 'source' => $target,
+ 'group' => $target_group,
+ ));
+ $a_record = $plugin['record'];
- if (!$plugin['abort'])
+ if (!$plugin['abort'])
if ($TARGET->insert($a_record, true))
$success++;
}