Status update of newsletters completed

- duplicate newsletter now includes options as well
- fixed NaN issue in statistics when newsletter is being sent
- use constant for scheduled (and put it as the sendingQueue Model level)
This commit is contained in:
Jonathan Labreuille
2016-06-16 20:01:53 +02:00
parent 744455f0df
commit aa3a46b941
7 changed files with 122 additions and 69 deletions

View File

@ -7,6 +7,8 @@ class SendingQueue extends Model {
public static $_table = MP_SENDING_QUEUES_TABLE;
const STATUS_COMPLETED = 'completed';
const STATUS_SCHEDULED = 'scheduled';
const STATUS_PAUSED = 'paused';
function __construct() {
parent::__construct();
@ -16,7 +18,7 @@ class SendingQueue extends Model {
if($this->count_processed === $this->count_total) {
return false;
} else {
$this->set('status', 'paused');
$this->set('status', STATUS_PAUSED);
$this->save();
return ($this->getErrors() === false && $this->id() > 0);
}
@ -26,14 +28,14 @@ class SendingQueue extends Model {
if($this->count_processed === $this->count_total) {
return $this->complete();
} else {
$this->set_expr('status', 'NULL');
$this->setExpr('status', 'NULL');
$this->save();
return ($this->getErrors() === false && $this->id() > 0);
}
}
function complete() {
$this->set('status', 'completed');
$this->set('status', self::STATUS_COMPLETED);
$this->save();
return ($this->getErrors() === false && $this->id() > 0);
}