Using dragSortOrder on DownloadMail plugin

I inserted the Special Fieldname dragSortOrder in the Incoming Mail section and all seemed to work well until I attempted to download email. I got a MySQL error telling me that the dragSortOrder field 'doesn't contain a default value' anf the download terminated. Is there a way to get around this?

Thanks

Brian

Re: [affinitymc] Using dragSortOrder on DownloadMail plugin

By Jason - August 19, 2010

Hi Brian,

You can alter your plugin to insert 0 as a dragSortOrder value. In the downloadMail.php file, go to the downloadMail_addRecord function. There you'll see the MySQL Query that inserts a record into CMS Builder, You can change it to this (I've highlighted the change in red)

// NOTE: $overviewHeaders is from imap_fetch_overview() and incomplete, $headersAsText is the actual message headers
$insert = "INSERT INTO `{$GLOBALS['TABLE_PREFIX']}_incoming_mail` SET
`createdDate` = '".mysql_escape( $mysqlDate )."',
`updatedDate` = NOW(),
`updatedByUserNum` = '0',

`from` = '".mysql_escape( mb_decode_mimeheader(@$overviewHeaders->from) )."',
`to` = '".mysql_escape( mb_decode_mimeheader(@$overviewHeaders->to) )."',
`subject` = '".mysql_escape( mb_decode_mimeheader(@$overviewHeaders->subject) )."',
`text` = '".mysql_escape( $text )."',
`html` = '".mysql_escape( $html )."',

`account` = '".mysql_escape( $accountName )."',
`headers` = '".mysql_escape( $headersAsText )."',
`errors` = '',
`processed` = 0,
`dragSortOrder` = 0";


When you add the line with dragSortOrder, it's important that there be a common after the 0 for processed as seen above.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/