diff --git a/lib/WebGUI/Mailing.pm b/lib/WebGUI/Mailing.pm index cb96cd4..8125582 100644 --- a/lib/WebGUI/Mailing.pm +++ b/lib/WebGUI/Mailing.pm @@ -33,9 +33,9 @@ sub crud_definition { sendDate => { fieldType => 'dateTime', }, - active => { - fieldType => 'yesNo', - defaultValue => 0, + state => { + fieldType => 'text', + defaultValue => 'idle', }, ); @@ -285,7 +285,7 @@ sub www_sendBatchConfirm { $self->queueEmails( $userIds ); $self->update( { sendDate => $scheduled, - active => 1, + state => 'scheduled', } ); return WebGUI::Mailing::Admin->new( $session )->www_view; diff --git a/lib/WebGUI/Mailing/Admin.pm b/lib/WebGUI/Mailing/Admin.pm index 1e61d5c..793508c 100644 --- a/lib/WebGUI/Mailing/Admin.pm +++ b/lib/WebGUI/Mailing/Admin.pm @@ -57,7 +57,7 @@ sub www_createMailing { my $mailing = WebGUI::Mailing->create( $session, { assetId => $assetId, issueId => $issueId, - active => 0, + state => 'idle', } ); return $mailing->www_edit; @@ -119,9 +119,11 @@ sub www_view { my @mailings; my $it = WebGUI::Mailing->getAllIterator( $session, { sequenceKeyValue => $issueId } ); while ( my $mailing = $it->() ) { + my $state = $mailing->get('state'); push @mailings, { %{ $mailing->get }, status => $mailing->getStatusLine, + "is$state" => 1, sendTestUrl => $url->page('newsletter=mailing;func=sendTestEmails;id='.$mailing->getId ), sendUrl => $url->page('newsletter=mailing;func=sendBatch;id='.$mailing->getId ), editUrl => $url->page('newsletter=mailing;func=edit;id='.$mailing->getId ), diff --git a/lib/WebGUI/Mailing/Email.pm b/lib/WebGUI/Mailing/Email.pm index 02d01e7..0b05410 100644 --- a/lib/WebGUI/Mailing/Email.pm +++ b/lib/WebGUI/Mailing/Email.pm @@ -82,25 +82,13 @@ sub getSendableEmails { { 'WGMailing' => 'mailingId' }, ], constraints => [ - { 'isTest=?' => [ 0 ] }, - { 'status=?' => [ 'queued' ] }, - { 'active=?' => [ 1 ] }, - { 'sendDate <= ?' => [ time ] }, + { 'isTest=?' => [ 0 ] }, + { 'status=?' => [ 'queued' ] }, + { 'state=?' => [ 'scheduled' ] }, + { 'sendDate <= ?' => [ time ] }, ], } ); - my @sql = $class->getAllSql( $session, { - joinUsing => [ - { 'WGMailing' => 'mailingId' }, - ], - constraints => [ - { 'isTest=?' => [ 0 ] }, - { 'status=?' => [ 'queued' ] }, - { 'active=?' => [ 1 ] }, - { 'sendDate <= ?' => [ time ] }, - ], - } ); - $session->log->warn( "--->" . shift( @sql ) . join "\n\n", @{ shift @sql } ); return $it; } diff --git a/sbin/packages/root_import_personalnewsletter.wgpkg b/sbin/packages/root_import_personalnewsletter.wgpkg index 4940c61..838af0e 100644 Binary files a/sbin/packages/root_import_personalnewsletter.wgpkg and b/sbin/packages/root_import_personalnewsletter.wgpkg differ