$params['scheduled_date'] = CRM_Utils_Date::processDate($params['scheduled_date'] . ' ' . $params['scheduled_date_time']);
}
-
$mailingAB = civicrm_api3('MailingAB', 'get', array('id' => $params['id']));
$mailingAB = $mailingAB['values'][$params['id']];
- foreach (array('mailing_id_a', 'mailing_id_b') as $columnName) {
- civicrm_api3('Mailing', 'create', $params + array('id' => $mailingAB[$columnName]));
+ foreach (array('mailing_id_a', 'mailing_id_b') as $columnName) {
+ $params['id'] = $mailingAB[$columnName];
+ civicrm_api3('Mailing', 'create', $params);
}
return civicrm_api3_create_success();
$scope.tp1.include = $scope.incGroupids;
$scope.tp1.exclude = $scope.excGroupids;
- console.log($scope.tp1);
- console.log($scope.currentABTest.id);
-
- console.log("--------");
- var result = crmApi('Mailing', 'a_b_recipients_update', {
+ var result = crmApi('MailingAB', 'recipients_update', {
id: $scope.currentABTest.id,
groups: $scope.tp1
});
});
$scope.startabtest = function(){
- console.log("yo");
+ if (typeof $scope.sparestuff.date == 'undefined') {
+ $scope.sparestuff.date = 'now';
+ }
var result = crmApi('MailingAB', 'send_mail', {id: $scope.abId,
scheduled_date : $scope.sparestuff.date , scheduled_date_time: $scope.currentABTest.latertime});
}
$scope.update_abtest = function () {
$scope.currentABTest.declare_winning_time = $scope.currentABTest.date + " " + $scope.currentABTest.time;
- result = crmApi('MailingAB', 'create', {id: $scope.abId,
+ result = crmApi('MailingAB', 'create', {
+ id: $scope.abId,
testing_criteria_id: $scope.sparestuff.template.val,
mailing_id_a: $scope.currentABTest.mailing_id_a,
mailing_id_b: $scope.currentABTest.mailing_id_b,
$scope.tmp = function (tst, aorb) {
if (aorb == 1) {
$scope.mailA.msg_template_id = tst;
- console.log($scope.mailA.msg_template_id + "sasas");
if ($scope.mailA.msg_template_id == null) {
$scope.mailA.body_html = "";
}
else {
if (aorb == 2) {
$scope.mailB.msg_template_id = tst;
- console.log($scope.mailB.msg_template_id + "sasas");
if ($scope.mailB.msg_template_id == null) {
$scope.mailB.body_html = "";
}
}
else {
$scope.mailA.msg_template_id = tst;
- console.log($scope.mailA.msg_template_id + "sasas");
if ($scope.mailA.msg_template_id == null) {
$scope.mailA.body_html = "";
}
}
$scope.mailB.msg_template_id = tst;
- console.log($scope.mailB.msg_template_id + "sasas");
if ($scope.mailB.msg_template_id == null) {
$scope.mailB.body_html = "";
}
my: 'left',
at: 'top',
of: $(".crmABTestingAllTabs")
-
-
},
close: function () {
}, true);
$scope.call = function(){
- console.log($scope.emailadd);
$scope.$apply();
var result = crmApi('Mailing','send_test',{
mailing_id : $scope.currentABTest.mailing_id_a,
mailing_id : $scope.currentABTest.mailing_id_b,
test_email : $scope.sparestuff.emailadd
})
- console.log($scope.sparestuff.emailadd);
-
}
- $scope.$watch('sendtest', function () {
+ $scope.$watch('sendtest', function () {
if ($scope.sendtest == true) {
$('#sendtest').dialog({
title: 'Send Test Mails',
buttons: {
'Send': function () {
$scope.call();
-
$scope.sendtest = false;
$('#sendtest').dialog("close");
});
}
});
-
});
crmMailingAB.directive('nexttab', function () {