Einfacher mit TYPO3 arbeiten
Wenn man für das Newsletter-Modul 'DirectMail' mit dynamischen Empfängerlisten arbeiten möchte, kann man dies über den Listentyp 'Spezielle Abfrage' (Special query list) erledigen. Allerdings kann man dort weder mit mm-Tabellenverknüpfungen noch mit normalen Tabellenverknüpfungen richtig arbeiten.
Um dies zu ermöglichen muss die Datei typo3conf/ext/direct_mail/res/scripts/class.mailselect.php angepasst werden:
//MSH start
var $lang = array(
'OR' => 'or',
'AND' => 'and',
'comparison' => array(
// Type = text offset = 0
'0_' => 'contains',
'1_' => 'does not contain',
'2_' => 'starts with',
'3_' => 'does not start with',
'4_' => 'ends with',
'5_' => 'does not end with',
'6_' => 'equals',
'7_' => 'does not equal',
// Type = number , offset = 32
'32_' => 'equals',
'33_' => 'does not equal',
'34_' => 'is greater than',
'35_' => 'is less than',
'36_' => 'is between',
'37_' => 'is not between',
'38_' => 'is in list',
'39_' => 'is not in list',
'40_' => 'binary AND equals',
'41_' => 'binary AND does not equal',
'42_' => 'binary OR equals',
'43_' => 'binary OR does not equal',
// Type = multiple, relation, files , offset = 64
'64_' => 'equals',
'65_' => 'does not equal',
'66_' => 'contains',
'67_' => 'does not contain',
'68_' => 'is in list',
'69_' => 'is not in list',
'70_' => 'binary AND equals',
'71_' => 'binary AND does not equal',
'72_' => 'binary OR equals',
'73_' => 'binary OR does not equal',
'74_' => 'FIND_IN_SET',
// Type = date,time offset = 96
'96_' => 'equals',
'97_' => 'does not equal',
'98_' => 'is greater than',
'99_' => 'is less than',
'100_' => 'is between',
'101_' => 'is not between',
'102_' => 'binary AND equals',
'103_' => 'binary AND does not equal',
'104_' => 'binary OR equals',
'105_' => 'binary OR does not equal',
// Type = boolean, offset = 128
'128_' => 'is True',
'129_' => 'is False',
// Type = binary , offset = 160
'160_' => 'equals',
'161_' => 'does not equal',
'162_' => 'contains',
'163_' => 'does not contain'
)
);
var $compSQL = array(
// Type = text offset = 0
'0' => "#FIELD# LIKE '%#VALUE#%'",
'1' => "#FIELD# NOT LIKE '%#VALUE#%'",
'2' => "#FIELD# LIKE '#VALUE#%'",
'3' => "#FIELD# NOT LIKE '#VALUE#%'",
'4' => "#FIELD# LIKE '%#VALUE#'",
'5' => "#FIELD# NOT LIKE '%#VALUE#'",
'6' => "#FIELD# = '#VALUE#'",
'7' => "#FIELD# != '#VALUE#'",
// Type = number, offset = 32
'32' => "#FIELD# = '#VALUE#'",
'33' => "#FIELD# != '#VALUE#'",
'34' => '#FIELD# > #VALUE#',
'35' => '#FIELD# < #VALUE#',
'36' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#',
'37' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)',
'38' => '#FIELD# IN (#VALUE#)',
'39' => '#FIELD# NOT IN (#VALUE#)',
'40' => '(#FIELD# & #VALUE#)=#VALUE#',
'41' => '(#FIELD# & #VALUE#)!=#VALUE#',
'42' => '(#FIELD# | #VALUE#)=#VALUE#',
'43' => '(#FIELD# | #VALUE#)!=#VALUE#',
// Type = multiple, relation, files , offset = 64
'64' => "#FIELD# = '#VALUE#'",
'65' => "#FIELD# != '#VALUE#'",
'66' => "#FIELD# LIKE '%#VALUE#%' AND #FIELD# LIKE '%#VALUE1#%'",
'67' => "(#FIELD# NOT LIKE '%#VALUE#%' OR #FIELD# NOT LIKE '%#VALUE1#%')",
'68' => '#FIELD# IN (#VALUE#)',
'69' => '#FIELD# NOT IN (#VALUE#)',
'70' => '(#FIELD# & #VALUE#)=#VALUE#',
'71' => '(#FIELD# & #VALUE#)!=#VALUE#',
'72' => '(#FIELD# | #VALUE#)=#VALUE#',
'73' => '(#FIELD# | #VALUE#)!=#VALUE#',
'74' => 'FIND_IN_SET(#VALUE#, #FIELD#)',
// Type = date, offset = 32
'96' => "#FIELD# = '#VALUE#'",
'97' => "#FIELD# != '#VALUE#'",
'98' => '#FIELD# > #VALUE#',
'99' => '#FIELD# < #VALUE#',
'100' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#',
'101' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)',
'102' => '(#FIELD# & #VALUE#)=#VALUE#',
'103' => '(#FIELD# & #VALUE#)!=#VALUE#',
'104' => '(#FIELD# | #VALUE#)=#VALUE#',
'105' => '(#FIELD# | #VALUE#)!=#VALUE#',
// Type = boolean, offset = 128
'128' => "#FIELD# = '1'",
'129' => "#FIELD# != '1'",
// Type = binary = 160
'160' => "#FIELD# = '#VALUE#'",
'161' => "#FIELD# != '#VALUE#'",
'162' => '(#FIELD# & #VALUE#)=#VALUE#',
'163' => '(#FIELD# & #VALUE#)=0'
);
//MSH end
Dies muss zu den Klassenvariablen hinzugefügt werden (also nach 'var $allowedTables = array('tt_address','fe_users');' in Zeile 60)
Die meisten Optionen stammen dabei aus der Datei t3lib/class.t3lib_querygenerator.php - neu sind die Optionen mit 74, die dafür sorgen, dass als Kommaliste umgesetzte Datenbank-Verknüpfungen richtig generiert werden. MM-Verknüpfungen können wahrscheinlich analog umgesetzt werden - das habe ich allerdings noch nicht gebraucht. :)