From 639a1b6c0399dc26df9f6feedc0b9f344a4befbe Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 13 Oct 2014 13:33:10 +0000 Subject: [PATCH] Check contact duplication of addressbooks with presets -Fix addressbook contacts added by add contact plus do not get checked for duplication -Fix another CSP error --- addressbook/inc/class.addressbook_ui.inc.php | 9 ++++++++- addressbook/js/app.js | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 9aecc49323..a7eaf49a0a 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1717,6 +1717,11 @@ window.egw_LAB.wait(function() { { case 'save': case 'apply': + if ($content['presets_fields']) + { + // unset the duplicate_filed after submit because we don't need to warn user for second time about contact duplication + unset($content['presets_fields']); + } if ($content['delete_photo']) { $content['jpegphoto'] = null; @@ -1985,7 +1990,9 @@ window.egw_LAB.wait(function() { { if (!empty($content[$field])) { - egw_framework::set_onload("app.addressbook.check_value(document.getElementById('exec[$field]'),0);"); + //Set the presets fields in content in order to be able to use them later in client side for checking duplication only on first time load + // after save/apply we unset them + $content['presets_fields'][]= $field; break; } } diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 131be8034d..4dc5392133 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -66,6 +66,14 @@ app.classes.addressbook = AppJS.extend( window.app.infolog = new window.app.classes.infolog(); } } + // Call check value if the AB got opened with presets + if (window.location.href.match(/&presets\[email\]/g) && content.presets_fields) + { + for(var i=0;i< content.presets_fields.length;i++) + { + this.check_value(this.et2.getWidgetById(content.presets_fields),0); + } + } break; }