From: aditya-nambiar Date: Sun, 17 Aug 2014 11:50:27 +0000 (+0530) Subject: Double storing fixed X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1888267773d4da7e4e914b45eec3f94abf7e0a40;p=civicrm-core.git Double storing fixed --- diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index 188869b985..548e8cdaac 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -72,7 +72,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { $emailAdd = civicrm_api3('Email', 'get', array()); $mesTemplate = civicrm_api3('MessageTemplate', 'get', array( 'sequential' => 1, - 'return' => array("msg_html", "id", "msg_title"), + 'return' => array("msg_html", "id", "msg_title","msg_subject"), 'id' => array('>' => 58), )); $mailTokens = civicrm_api3('Mailing', 'get_token', array( 'usage' => 'Mailing')); diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 824cbe98c8..2d5455ecad 100755 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -151,6 +151,7 @@ $scope.sparestuff ={}; $scope.sparestuff.emailadd = ""; $scope.sparestuff.winnercriteria = ""; + $scope.sparestuff.isnew = false; mltokens = CRM.crmMailing.mailTokens; if ($scope.currentABTest.declare_winning_time != null) { $scope.ans = $scope.currentABTest.declare_winning_time.split(" "); @@ -161,6 +162,7 @@ if ($scope.currentABTest.just_created != 1) { $scope.abId = $scope.currentABTest.id; + $scope.sparestuff.isnew = false; var abmailA = crmApi('Mailing', 'getsingle', {id: $scope.currentABTest.mailing_id_a}); var abmailB = crmApi('Mailing', 'getsingle', {id: $scope.currentABTest.mailing_id_b}); var abmailC = crmApi('Mailing', 'getsingle', {id: $scope.currentABTest.mailing_id_c}); @@ -181,6 +183,7 @@ }); } else { + $scope.sparestuff.isnew = true; $scope.mailA = {}; $scope.mailB = {}; $scope.mailC = {}; @@ -389,9 +392,11 @@ $scope.currentABTest.testing_criteria_id = $scope.sparestuff.template.val; if ($scope.abId == "") { + console.log("bb"); result = crmApi('MailingAB', 'create', {name: $scope.currentABTest.name, testing_criteria_id: $scope.sparestuff.template.val}); } else { + console.log("aa"); if (typeof $scope.currentABTest.mailing_id_a == 'undefined') { result = crmApi('MailingAB', 'create', {id: $scope.abId, testing_criteria_id: $scope.sparestuff.template.val}); } @@ -471,6 +476,7 @@ } } + $scope.update_abtest = function () { $scope.currentABTest.declare_winning_time = $scope.currentABTest.date + " " + $scope.currentABTest.time; result = crmApi('MailingAB', 'create', { @@ -491,11 +497,13 @@ $scope.mailA.msg_template_id = tst; if ($scope.mailA.msg_template_id == null) { $scope.mailA.body_html = ""; + $scope.mailA.subject=""; } else { for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailA.msg_template_id) { $scope.mailA.body_html = $scope.tmpList[a].msg_html; + $scope.mailA.subject=$scope.tmpList[a].msg_subject; } } } @@ -505,11 +513,14 @@ $scope.mailB.msg_template_id = tst; if ($scope.mailB.msg_template_id == null) { $scope.mailB.body_html = ""; + $scope.mailB.subject=""; } else { for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailB.msg_template_id) { $scope.mailB.body_html = $scope.tmpList[a].msg_html; + $scope.mailB.subject=$scope.tmpList[a].msg_subject; + } } } @@ -518,11 +529,13 @@ $scope.mailA.msg_template_id = tst; if ($scope.mailA.msg_template_id == null) { $scope.mailA.body_html = ""; + $scope.mailA.subject=""; } else { for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailA.msg_template_id) { $scope.mailA.body_html = $scope.tmpList[a].msg_html; + $scope.mailA.subject=$scope.tmpList[a].msg_subject; } } } @@ -530,11 +543,15 @@ $scope.mailB.msg_template_id = tst; if ($scope.mailB.msg_template_id == null) { $scope.mailB.body_html = ""; + $scope.mailB.subject=""; + } else { for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailB.msg_template_id) { $scope.mailB.body_html = $scope.tmpList[a].msg_html; + $scope.mailB.subject=$scope.tmpList[a].msg_subject; + } } } @@ -542,6 +559,26 @@ } } + /*$scope.tmp = function (tst){ + $scope.currentMailing.msg_template_id=tst; + console.log($scope.currentMailing.msg_template_id+ "sasas"); + if($scope.currentMailing.msg_template_id == null){ + $scope.currentMailing.body_html=""; + $scope.currentMailing.subject=""; + } + else{ + for(var a in $scope.tmpList){ + + if($scope.tmpList[a].id==$scope.currentMailing.msg_template_id){ + $scope.currentMailing.body_html=$scope.tmpList[a].msg_html; + console.log($scope.tmpList[a].msg_subject); + $scope.currentMailing.subject=$scope.tmpList[a].msg_subject; + console.log($scope.currentMailing.subject); + } + } + } + };*/ + $scope.$watch('preview', function () { console.log("dsfdfsfds"); if ($scope.preview == true) { @@ -623,11 +660,15 @@ var myarr = new Array(1, 2, 3) // disable remaining tabs + if(scope.sparestuff.isnew == true) tabselector.tabs({disabled: myarr}); $(element).on("click", function () { if (scope.tab_val == 0) { + console.log("att"); scope.create_abtest(); + + console.log("tt"); } else { if (scope.tab_val == 2) { diff --git a/partials/abtesting/tab1.html b/partials/abtesting/tab1.html index 75770b5ec7..185ae60162 100755 --- a/partials/abtesting/tab1.html +++ b/partials/abtesting/tab1.html @@ -17,7 +17,7 @@
- + diff --git a/partials/abtesting/tab4.html b/partials/abtesting/tab4.html index 0402d98bfe..caada6782e 100755 --- a/partials/abtesting/tab4.html +++ b/partials/abtesting/tab4.html @@ -51,10 +51,10 @@

When to Start


- Now   + Now   Later
-     +         Time :