4
votes


this is my first post on Stack Overflow. I searched for about 2 Days on the Internet to resolve my problem. Hope you can help me.

i'm using Typo3 7.6.2 and created an extension with the Extension Builder 7.6 and Powermail 2.24.0

So i want to generate a selectbox to get the E-Mail Addresses of the Contact Person for that school which is defined with a database relation.

If i try to get Data via select from typoscript from my or other extension table (tx_wtschools_domain_model_schools) i wouldnt get an answer.

But if i use fe_user or fe_group i will get the answer as expected.

All records are stored on the page with id 22

I used this snippet http://www.typo3.net/forum/thematik/zeige/thema/112554/ especially the post from 19. 09. 2014, 12:42 (little scroll way down)

Generate Receivers List from WT-Schools

lib.receiver = COA
lib.receiver {
    10 = TEXT
    10.value = Bitte wählen|[\n]

    20 = CONTENT
    20 {
      table = tx_wtschools_domain_model_schools
      select.pidInList = 22
      #select.recursive = 100000

      renderObj = COA
      renderObj {
        10 = TEXT
        10.field = name
        10.wrap = |[\n]
       }
   }
   30 = TEXT
   30.value = Ende
}

So i haven't been to the second part already, were i would get the mail of the contact.

Thanks for your help if you need more information i will post it here!

greetings Jan

Here is A SQL-Dump of the schools table:

-- phpMyAdmin SQL Dump
-- version 4.5.5
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Erstellungszeit: 07. Apr 2016 um 09:06
-- Server-Version: 5.5.47-0+deb7u1
-- PHP-Version: 5.6.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Datenbank: `wt-kampfkunstschule`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `tx_wtschools_domain_model_schools`
--

CREATE TABLE `tx_wtschools_domain_model_schools` (
  `uid` int(11) NOT NULL,
  `pid` int(11) NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL DEFAULT '',
  `address` varchar(255) NOT NULL DEFAULT '',
  `address_info` varchar(255) NOT NULL DEFAULT '',
  `postcode` varchar(255) NOT NULL DEFAULT '',
  `city` varchar(255) NOT NULL DEFAULT '',
  `city_label` varchar(255) NOT NULL DEFAULT '',
  `latitude` varchar(255) NOT NULL DEFAULT '',
  `longitude` varchar(255) NOT NULL DEFAULT '',
  `info` varchar(255) NOT NULL DEFAULT '',
  `active` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
  `gallery` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `profile_image` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `activate_alt_training` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
  `owner` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `contact` int(11) UNSIGNED DEFAULT '0',
  `trainer` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `categories` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `training_time` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `training_time_alt` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `tstamp` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `crdate` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `cruser_id` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `deleted` tinyint(4) UNSIGNED NOT NULL DEFAULT '0',
  `hidden` tinyint(4) UNSIGNED NOT NULL DEFAULT '0',
  `t3ver_oid` int(11) NOT NULL DEFAULT '0',
  `t3ver_id` int(11) NOT NULL DEFAULT '0',
  `t3ver_wsid` int(11) NOT NULL DEFAULT '0',
  `t3ver_label` varchar(255) NOT NULL DEFAULT '',
  `t3ver_state` tinyint(4) NOT NULL DEFAULT '0',
  `t3ver_stage` int(11) NOT NULL DEFAULT '0',
  `t3ver_count` int(11) NOT NULL DEFAULT '0',
  `t3ver_tstamp` int(11) NOT NULL DEFAULT '0',
  `t3ver_move_id` int(11) NOT NULL DEFAULT '0',
  `sys_language_uid` int(11) NOT NULL DEFAULT '0',
  `l10n_parent` int(11) NOT NULL DEFAULT '0',
  `l10n_diffsource` mediumblob
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Daten für Tabelle `tx_wtschools_domain_model_schools`
--

INSERT INTO `tx_wtschools_domain_model_schools` (`uid`, `pid`, `name`, `address`, `address_info`, `postcode`, `city`, `city_label`, `latitude`, `longitude`, `info`, `active`, `gallery`, `profile_image`, `activate_alt_training`, `owner`, `contact`, `trainer`, `categories`, `training_time`, `training_time_alt`, `tstamp`, `crdate`, `cruser_id`, `deleted`, `hidden`, `t3ver_oid`, `t3ver_id`, `t3ver_wsid`, `t3ver_label`, `t3ver_state`, `t3ver_stage`, `t3ver_count`, `t3ver_tstamp`, `t3ver_move_id`, `sys_language_uid`, `l10n_parent`, `l10n_diffsource`) VALUES
(1, 22, 'WT-Zentrum Radevormwald', 'Kaiserstraße 69', 'direkt am Markt', '42477', 'Radevormwald', '', '51.203107', '7.356229', 'Ihre Selbstverteidigungschule in Radevormwald', 1, 4, 1, 0, 1, 7, 31, 3, 8, 0, 1458657850, 1458208785, 1, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, -1, 0, 0x613a32313a7b733a31363a227379735f6c616e67756167655f756964223b4e3b733a363a2268696464656e223b4e3b733a343a226e616d65223b4e3b733a373a2261646472657373223b4e3b733a31323a22616464726573735f696e666f223b4e3b733a383a22706f7374636f6465223b4e3b733a343a2263697479223b4e3b733a31303a22636974795f6c6162656c223b4e3b733a383a226c61746974756465223b4e3b733a393a226c6f6e676974756465223b4e3b733a343a22696e666f223b4e3b733a363a22616374697665223b4e3b733a373a2267616c6c657279223b4e3b733a31333a2270726f66696c655f696d616765223b4e3b733a32313a2261637469766174655f616c745f747261696e696e67223b4e3b733a353a226f776e6572223b4e3b733a373a22636f6e74616374223b4e3b733a373a22747261696e6572223b4e3b733a31303a2263617465676f72696573223b4e3b733a31333a22747261696e696e675f74696d65223b4e3b733a31373a22747261696e696e675f74696d655f616c74223b4e3b7d),
(2, 22, 'WingTsun-Schule Remscheid-Lennep', 'Robert-Schumacher-Str. 6', 'Im Sportstudio Fit & Fun (über Rewe)', '42897', 'Remscheid', 'Remscheid-Lennep', '51.189055', '7.253708', 'Jeden Montag nach dem WingTsun: Selbstverteidigung mit und gegen Waffen. Fuer alle Teilnehmer des Erwachsenen WingTsun kostenlos!', 1, 3, 1, 0, 2, 6, 1, 3, 3, 3, 1458655705, 1458218192, 1, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, -1, 0, 0x613a32313a7b733a31363a227379735f6c616e67756167655f756964223b4e3b733a363a2268696464656e223b4e3b733a343a226e616d65223b4e3b733a373a2261646472657373223b4e3b733a31323a22616464726573735f696e666f223b4e3b733a383a22706f7374636f6465223b4e3b733a343a2263697479223b4e3b733a31303a22636974795f6c6162656c223b4e3b733a383a226c61746974756465223b4e3b733a393a226c6f6e676974756465223b4e3b733a343a22696e666f223b4e3b733a363a22616374697665223b4e3b733a373a2267616c6c657279223b4e3b733a31333a2270726f66696c655f696d616765223b4e3b733a32313a2261637469766174655f616c745f747261696e696e67223b4e3b733a353a226f776e6572223b4e3b733a373a22636f6e74616374223b4e3b733a373a22747261696e6572223b4e3b733a31303a2263617465676f72696573223b4e3b733a31333a22747261696e696e675f74696d65223b4e3b733a31373a22747261696e696e675f74696d655f616c74223b4e3b7d);

--
-- Indizes der exportierten Tabellen
--

--
-- Indizes für die Tabelle `tx_wtschools_domain_model_schools`
--
ALTER TABLE `tx_wtschools_domain_model_schools`
  ADD PRIMARY KEY (`uid`),
  ADD KEY `parent` (`pid`),
  ADD KEY `t3ver_oid` (`t3ver_oid`,`t3ver_wsid`),
  ADD KEY `language` (`l10n_parent`,`sys_language_uid`);

--
-- AUTO_INCREMENT für exportierte Tabellen
--

--
-- AUTO_INCREMENT für Tabelle `tx_wtschools_domain_model_schools`
--
ALTER TABLE `tx_wtschools_domain_model_schools`
  MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
1
What happens when you directly output this lib in your template? Do you get any results?Björn von TRITUM
no just the two self set values on 10. and 30.Jan Ritzmann
Could you please provide a dump of the tables/ tables? Did you use the extension builder to create these tables? Does the field "name" exist? What happens if you write 10.field = uid (instead of name)?Björn von TRITUM
yes i have used the extension builder to create the tables.I added the table Dump to the question. Yes it does exist i tried it with the field addresse, too.Jan Ritzmann

1 Answers

1
votes

The manual https://docs.typo3.org/typo3cms/extensions/powermail/2.24.0/ForAdministrators/GoodToKnow/PrefillField/Index.html of your version of Powermail shows how to create select lists. Example 3 shows how to read from a table. In your case you could use name and uid (the field would show the names and store the value of the uid).

To set the receiver the manual also has examples https://docs.typo3.org/typo3cms/extensions/powermail/2.24.0/ForAdministrators/GoodToKnow/DynamicReceiver/Index.html . In you use case I'd use a CONTENT query instead of the CASE from the example and look up the email address of the selected uid. Make sure that you use markers in the CONTENT object to inject the selected uid to prevent SQL injections!