diff --git a/inc/ui/principal-edit.php b/inc/ui/principal-edit.php index 6ada0168..0fc71e09 100644 --- a/inc/ui/principal-edit.php +++ b/inc/ui/principal-edit.php @@ -168,6 +168,7 @@ function principal_editor() { $editor->SetLookup( 'locale', 'SELECT \'\', \''.translate("*** Default Locale ***").'\' UNION SELECT locale, locale_name_locale FROM supported_locales ORDER BY 1 ASC' ); $editor->AddAttribute( 'locale', 'title', translate("The preferred language for this person.") ); $editor->AddAttribute( 'fullname', 'title', translate("The full name for this person, group or other type of principal.") ); + $editor->AddAttribute( 'email', 'title', translate("The email address identifies principals when processing invitations and freebusy lookups. It should be set to a unique value.") ); $editor->SetWhere( 'principal_id='.$id ); $editor->AddField('is_admin', 'EXISTS( SELECT 1 FROM role_member WHERE role_no = 1 AND role_member.user_no = dav_principal.user_no )' ); @@ -297,7 +298,15 @@ function principal_editor() { if ( isset($id) ) $delete_principal_button = '' . translate("Delete Principal") . ''; } - + + $email_unique = ''; + $qry = new AwlQuery('SELECT user_no FROM usr WHERE lower(usr.email) = lower(:email)', + array( ':email' => $editor->Value('email') )); + $qry->Exec('principal-edit', __LINE__, __FILE__); + if ($qry->rows() > 1 ) { + $email_unique = ' ' . translate('Attention: email address not unique, scheduling may not work!') . ''; + } + $id = $editor->Value('principal_id'); $template = << $prompt_password_1: ##newpass1.password.$pwstars## $prompt_password_2: ##newpass2.password.$pwstars## $prompt_fullname: ##fullname.input.50## - $prompt_email: ##email.input.50## + $prompt_email: ##email.input.50##$email_unique $prompt_locale: ##locale.select## $prompt_date_format: ##date_format_type.select## $prompt_type: ##type_id.select##