I suppose you've deactivated *email fields in Companies recordset. Am I right? There is a code responsible for archiving that looks like that:
$fields = DB::GetCol('SELECT field FROM company_field WHERE active=1 AND type=\'text\' AND field LIKE \'%mail%\' ORDER BY field');
foreach($fields as & $f) {
$f = 'c.f_'.preg_replace('/[^a-z0-9]/','_',strtolower($f));
}
$company = DB::GetCol('SELECT c.id FROM company_data_1 c LEFT JOIN rc_multiple_emails_data_1 m ON (m.f_record_id=c.id AND m.f_record_type=%s) WHERE c.active=1 AND ('.implode('='.DB::qstr($addr).' OR ',$fields).'='.DB::qstr($addr).' OR m.f_email=%s) AND (c.f_permission<%s OR c.created_by=%d)',array('company',$addr,2,$E_SESSION['user']));
Where this part introduces error:
('.implode('='.DB::qstr($addr).' OR ',$fields).'='.DB::qstr($addr).' OR m.f_email=%s)
because
$fields variable is empty.
I'll fix this to work correctly, to something like that:
$x = $fields ? implode('='.DB::qstr($addr).' OR ',$fields) . '=' . DB::qstr($addr) . ' OR ' : '';
$company = DB::GetCol('SELECT c.id FROM company_data_1 c LEFT JOIN rc_multiple_emails_data_1 m ON (m.f_record_id=c.id AND m.f_record_type=%s) WHERE c.active=1 AND (' . $x . 'm.f_email=%s) AND (c.f_permission<%s OR c.created_by=%d)',array('company',$addr,2,$E_SESSION['user']));
try to replace this code. It's in file modules/CRM/Roundcube/RC/plugins/epesi_archive/epesi_archive.php:112
Regards,
Adam