I'm a newbie of Drupal. Recently I'm looking for a module that can log "who send what". Fortunately, I find this module. I think it is what I need. Thanks very much!

After configuration, some errors prompt when one node is send like follows:
user warning: Field 'timestamp' doesn't have a default value query: INSERT INTO send_contact (uid, mode) VALUES (1, 'mail') in drupal_home\includes\common.inc on line 3538.
user warning: Field 'scid' doesn't have a default value query: INSERT INTO send_contact_mail (mail, name) VALUES ('administrator@bestbole.com', 'bestbole|bestbole.com') in drupal_home\includes\common.inc on line 3538.
user warning: Field 'uid' doesn't have a default value query: INSERT INTO send_contact (mode) VALUES ('mail') in drupal_home\includes\common.inc on line 3538.
user warning: Field 'scid' doesn't have a default value query: INSERT INTO send_contact_mail (mail) VALUES ('xxxx_rec@gmail.com') in drupal_home\includes\common.inc on line 3538.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2 query: UPDATE send_contact SET timestamp = 1319593268 WHERE scid IN () in drupal_home\sites\all\modules\send\includes\handlers\send.inc on line 381.

Env: Windows XP with Apache, localhost
Drupal version: 6.22
send version: send-6.x-1.0-alpha6

By checking the table send_contact in db, I found the field "timestamp" is not permitted to null, but the value is not set when send fired. And other fields will not be populated correctly?

Another problem is that the authenticated sender's fields will be pre-populated in the send form, right? But these are empty in my case. I don't know if it acts as design or my configuration problem.

I wish I can make the module run in my local test site. Thanks.

Regards,
Younfan

Comments

Weijian’s picture

Once I had been trying to figure out the problem by adding some log. I found:
1. in send.inc, $message['sender'] is not set in function, so the site info will be used. That's not correct as the sender info had been provided in the send form.
public function send() {
if (!$recipients = $this->recipients()) return FALSE;
if (!$message = $this->message()) return FALSE;

$modes = module_invoke_all('send_mode_info');

// Keep a running list of contacts.
$scids = array();

// Set the delivery mode based on the default and profile settings.
$mode = isset($this->mode) ? $this->mode : 'mail';

// Set the sender from the message values.
$sender = isset($message['sender']) ? $message['sender'] : (object) array(
'uid' => 1,
'mail' => variable_get('site_mail', ''),
'name' => variable_get('site_name', t('Drupal')),
);
2. in send.api.inc, there is no timestamp info in $contact before it is inserted to db.
function send_contact($mode, $contact) {
...
// Save a new entry if we didn't just load one.
if (!$contact->scid) {
drupal_write_record('send_contact', $contact);
if ($table) {
drupal_write_record($table, $contact);
}
}
...
}

But based on my Drupal knowledge I can't figure out the root cause. Wish this helpful to find out the reason. Thanks.

Regards,
Younfan

Weijian’s picture

Update:
I unchecked the "not null" for the two fields "uid" and "timestamp" in send_contact table from db. Now it works.

My question:
Do these really need "not null" from the install?

See send.install:
'send_contact' => array(
'fields' => array(
'scid' => array(
'description' => t('The send contact id'),
'type' => 'serial',
'unsigned' => TRUE,
),
'uid' => array(
'description' => t('The user id'),
'type' => 'int',
'not null' => TRUE,
),
'mode' => array(
'description' => t('Delivery mode for this contact.'),
'type' => 'varchar',
'not null' => TRUE,
'length' => 32,
),
'timestamp' => array(
'description' => t('The last activity timestamp for this contact.'),
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
),
'primary key' => array('scid'),
),

Regards,
Weijian

Allie Micka’s picture

Status: Active » Postponed (maintainer needs more info)

I haven't changed the not-null status on those two columns, but I have never been able to reproduce this issue. I have, however, changed some of the default values for e.g. sender, which may prevent that problem from occurring.

If you're still at this, can you please try beta1 or higher to see if the issue goes away?

Thanks!