From ca38db5744bc8c46c4a23d1ba68c6c4c9b5b4a07 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Tue, 01 Jun 2010 14:11:57 -0400 Subject: [PATCH] Allow to drag into groups of another address source --- program/steps/addressbook/copy.inc | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc index c8076c4..2d3a91a 100644 --- a/program/steps/addressbook/copy.inc +++ b/program/steps/addressbook/copy.inc @@ -25,6 +25,7 @@ $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 @@ $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++; } -- Gitblit v1.9.1