From: Michael J. Rubinsky Date: Sat, 14 Aug 2010 22:45:27 +0000 (-0400) Subject: Pass only the correct data to each of the owner fields. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6e57615ef92b4e06bd04378c159dcbd271c8a5a4;p=horde.git Pass only the correct data to each of the owner fields. This fixes the problem of the form failing validation, but it is still broken in the sense that once an owner is set for either of the fields, it is impossible to remove all owners from that field. This is because if the multienum is empty, the default value is applied to it when it is submitted. --- diff --git a/whups/lib/Forms/EditTicket.php b/whups/lib/Forms/EditTicket.php index f1705e668..1e80d443f 100644 --- a/whups/lib/Forms/EditTicket.php +++ b/whups/lib/Forms/EditTicket.php @@ -122,7 +122,16 @@ class EditTicketForm extends Horde_Form { 'multienum', false, false, null, array($f_users)); - $owners->setDefault($whups_driver->getOwners($vars->get('id'))); + $ticketOwners = array(); + $ticketGroups = array(); + foreach($whups_driver->getOwners($vars->get('id')) as $owner) { + if (strpos($owner, 'user:') !== false) { + $ticketOwners[] = $owner; + } else { + $ticketGroups[] = $owner; + } + } + $owners->setDefault($ticketOwners); } if (count($f_groups)) { @@ -133,7 +142,7 @@ class EditTicketForm extends Horde_Form { false, false, null, array($f_groups)); - $group_owners->setDefault($whups_driver->getOwners($vars->get('id'))); + $group_owners->setDefault($ticketGroups); } } break;