Hi,
whenever I add a newsletter node I'll get an error in the content/newsletter tab :

PDOException : SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.status' in 'where clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {simplenews_mail_spool} simplenews_mail_spool WHERE (nid = :db_condition_placeholder_0) AND (vid = :db_condition_placeholder_1) AND (s.status = 1 OR s.status = 3) ) subquery; Array ( [:db_condition_placeholder_0] => 67 [:db_condition_placeholder_1] => 67 ) dans simplenews_count_spool() (ligne 527 dans /homez.196/institutc/www/dev/sites/all/modules/simplenews/includes/simplenews.mail.inc).

If I choose to only send the newsletter to the testing mails it'll work, but if I choose to send it everyone nothing will happen - if I go check the cron after that, the same error message will appear.
If I delete every newsletter node I wrote, the error messages will be gone.

Did I do something wrong ?

Comments

DementedManiac’s picture

I'm seeing the same error message.

After scheduling the newsletter, when I then manually run cron, the above error message ( only difference is the actual vid and nid ) is displayed.

Dawson

simon georges’s picture

Status: Active » Needs review
StatusFileSize
new432 bytes

Would this patch help ?

DementedManiac’s picture

I changed

function simplenews_count_spool($nid, $vid, $status = array(SIMPLENEWS_SPOOL_PENDING, SIMPLENEWS_SPOOL_IN_PROGRESS)) {
  $clauses = array();
  $params = array();

  if (!is_array($status)) {
    $status = array($status);
  }

  foreach ($status as $s) {
    $clauses[] = "s.status = $s";
  }

  $query = db_select('simplenews_mail_spool')
    ->condition('nid', $nid)
    ->condition('vid', $vid)
    ->where(implode(' OR ', $clauses));
  return $query->countQuery()->execute()->fetchField();
}

to

function simplenews_count_spool($nid, $vid, $status = array(SIMPLENEWS_SPOOL_PENDING, SIMPLENEWS_SPOOL_IN_PROGRESS)) {
  $clauses = array();
  $params = array();

  if (!is_array($status)) {
    $status = array($status);
  }

  foreach ($status as $s) {
    $clauses[] = "status = $s";
  }

  $query = db_select('simplenews_mail_spool')
    ->condition('nid', $nid)
    ->condition('vid', $vid)
    ->where(implode(' OR ', $clauses));
  return $query->countQuery()->execute()->fetchField();
}

and the error is no longer generated when running cron, but no emails seem to have been sent.
When I go to the newsletter page it still says "this newsletter is pending"

DementedManiac’s picture

Status: Needs review » Active

Thanks Simon, hadn't seen your patch before I posted, though I think you've done the same that I did, and as I mentioned the error's gone, but still no emails sent. Though I guess that's a different issue.

Arkanen’s picture

Same, all the errors are gone but it seems it doesn't send anything when choosing to send the newsletter to everyone.
If I send one test newsletter to the test address it will work though, so I guess it's some cron related issues
thanks for the patch

Arkanen’s picture

Status: Active » Fixed
simon georges’s picture

Please don't change the status to "fixed" until it's committed (put it instead to "reviewed and tested by the community").
Your luck is, due do the small size of the patch, I just committed it ;-) (see commit).

Arkanen’s picture

oops - sorry, I'm new to Drupal, thanks

Narus’s picture

Same here,

Thanks for the patch but well ... still no email sent.
Do you really guess that's a different issue ?

mxr576’s picture

Subscribe

reaperscg’s picture

Subscribe

sigmax’s picture

Status: Fixed » Reviewed & tested by the community

subscribe

sigmax’s picture

subscribe

simon georges’s picture

Status: Reviewed & tested by the community » Fixed

This issue is fixed. There was indeed another issue (#1175400: Mails won't send - but testing mails works) regarding the sending, fixed as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.