summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/addressbook/edit.inc
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-04-12 18:05:36 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-04-12 18:05:36 +0000
commite7622fad720a972df1e9d5ec8a70af4cedc51597 (patch)
tree75748d2c549c45ad98c67655ab95c12dff5f4302 /roundcubemail/program/steps/addressbook/edit.inc
parent2fbb073c0f3e5e067969e5a9250876148e3d9b28 (diff)
Keep all submitted data if contact form validation fails (#1487865)
git-svn-id: https://svn.roundcube.net/trunk@4649 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/addressbook/edit.inc')
-rw-r--r--roundcubemail/program/steps/addressbook/edit.inc38
1 files changed, 21 insertions, 17 deletions
diff --git a/roundcubemail/program/steps/addressbook/edit.inc b/roundcubemail/program/steps/addressbook/edit.inc
index 932dc4918..cf6beba68 100644
--- a/roundcubemail/program/steps/addressbook/edit.inc
+++ b/roundcubemail/program/steps/addressbook/edit.inc
@@ -31,18 +31,28 @@ if ($CONTACTS->readonly) {
}
-function rcmail_contact_edithead($attrib)
+function rcmail_get_edit_record()
{
- global $RCMAIL, $CONTACTS;
+ global $RCMAIL, $CONTACTS;
+
+ // check if we have a valid result
+ if ($GLOBALS['EDIT_RECORD']) {
+ $record = $GLOBALS['EDIT_RECORD'];
+ }
+ else if ($RCMAIL->action != 'add'
+ && !(($result = $CONTACTS->get_result()) && ($record = $result->first()))
+ ) {
+ $RCMAIL->output->show_message('contactnotfound');
+ return false;
+ }
+
+ return $record;
+}
+function rcmail_contact_edithead($attrib)
+{
// check if we have a valid result
- if ($RCMAIL->action != 'add'
- && !(($result = $CONTACTS->get_result()) && ($record = $result->first()))
- ) {
- $RCMAIL->output->show_message('contactnotfound');
- return false;
- }
-
+ $record = rcmail_get_edit_record();
$i_size = !empty($attrib['size']) ? $attrib['size'] : 20;
$form = array(
@@ -74,15 +84,9 @@ function rcmail_contact_edithead($attrib)
function rcmail_contact_editform($attrib)
{
- global $RCMAIL, $CONTACTS, $CONTACT_COLTYPES;
+ global $RCMAIL, $CONTACT_COLTYPES;
- // check if we have a valid result
- if ($RCMAIL->action != 'add'
- && !(($result = $CONTACTS->get_result()) && ($record = $result->first()))
- ) {
- $RCMAIL->output->show_message('contactnotfound');
- return false;
- }
+ $record = rcmail_get_edit_record();
// add some labels to client
$RCMAIL->output->add_label('noemailwarning', 'nonamewarning');