Add new "inactive" subscriber status

[MAILPOET-1970]
This commit is contained in:
Ján Mikláš
2019-04-10 13:09:41 +02:00
committed by M. Shull
parent 2169900072
commit be777c20aa

View File

@ -35,6 +35,7 @@ class Subscriber extends Model {
const STATUS_UNSUBSCRIBED = 'unsubscribed';
const STATUS_UNCONFIRMED = 'unconfirmed';
const STATUS_BOUNCED = 'bounced';
const STATUS_INACTIVE = 'inactive';
const SUBSCRIBER_TOKEN_LENGTH = 6;
/** @var string|bool */
@ -254,6 +255,11 @@ class Subscriber extends Model {
'label' => WPFunctions::get()->__('Bounced', 'mailpoet'),
'count' => self::filter(self::STATUS_BOUNCED)->count()
),
array(
'name' => self::STATUS_INACTIVE,
'label' => WPFunctions::get()->__('Inactive', 'mailpoet'),
'count' => self::filter(self::STATUS_INACTIVE)->count()
),
array(
'name' => 'trash',
'label' => WPFunctions::get()->__('Trash', 'mailpoet'),
@ -650,6 +656,12 @@ class Subscriber extends Model {
->where('status', self::STATUS_BOUNCED);
}
static function inactive($orm) {
return $orm
->whereNull('deleted_at')
->where('status', self::STATUS_INACTIVE);
}
static function withoutSegments($orm) {
return $orm->select(MP_SUBSCRIBERS_TABLE.'.*')
->whereRaw(