CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #37054

Use PM as FE-submitter for tt_news: DB-inserts ok but problem with multiple selects

Added by Bert Hiddink about 1 year ago. Updated about 1 year ago.

Status:Resolved Start date:2012-05-10
Priority:Should have Due date:
Assignee:Alex Kellner % Done:

0%

Category:-
Target version:-
Votes: 0

Description

Hello,

I use Powermail as a FE-form for submitting news, the db-inserts I do with the snippet below. This works just fine, also inserting categories in the mm-table works fine (please look at the snippet below).

However, in case of a "multiple select", the form submits the value as an array, "powermail_select powermail_uid9" becomes "powermail_select powermail_uid9[]"

So in order to insert this array in the tt_news-table, I would have to split the array before inserting, something like:
...
20.3.split {
token = ,
cObjNum = 1
1.current = 1
}
...

Tried several options but could not get this working. Any hints/ideas to get me going again?

Thanks in advance!
Bert

#Working snippet for tt_news & categories, TODO: multiple selects

plugin.tx_powermail_pi1 {
dbEntry {
tt_news {
_enable = TEXT
_enable.value = 1
_mm = COA
_mm {
10 = COA
10 { # 1 is always the mm table
1 = TEXT
1.value = tt_news_cat_mm # 2 is always the other table
2 = TEXT
2.value = tt_news_cat # 3 is always the uid of the other table to get a relation to this # (in this case uid_foreign of tt_news_cat_mm), first selectbox
3 = TEXT
3.data = TSFE:fe_user|sesData|powermail_285|uid7
} # Copy over to second selectbox, than to the third, etc...
20 < .10
20.3.data = TSFE:fe_user|sesData|powermail_285|uid9
}
pid = TEXT
pid.value=18
tstamp = TEXT
tstamp.data = date:U
crdate = TEXT
crdate.data = date:U
datetime = TEXT
datetime.data = date:U
title = TEXT
title.data = TSFE:fe_user|sesData|powermail_285|uid1
bodytext = TEXT
bodytext.data = TSFE:fe_user|sesData|powermail_285|uid2
bodytext.stripHtml = 1
}
}
}

History

Updated by Bert Hiddink about 1 year ago

Hello,

Just found out that in case of a multiple select, the values of the array could be catched like this:
TSFE:fe_user|sesData|powermail_285|uid9|0

So the TS for a multiple select with 4 options looks like this:
...

  1. Copy over to second selectbox, then catch values in case
  2. of a multiple select (4 options)
  3. First option
    20 < .10
    20.3.data = TSFE:fe_user|sesData|powermail_285|uid9|0
  4. Second option
    21 < .10
    21.3.data = TSFE:fe_user|sesData|powermail_285|uid9|1
    #Third option
    22 < .10
    22.3.data = TSFE:fe_user|sesData|powermail_285|uid9|2
    #Fourth option
    23 < .10
    23.3.data = TSFE:fe_user|sesData|powermail_285|uid9|3
    ...
    Checked and works ok!!!

Regards,
Bert

Updated by Alex Kellner about 1 year ago

  • Status changed from New to Resolved

thx

Updated by Bert Hiddink about 1 year ago

Hello,

This is my final snippet for an insert of a PM-form used as a FE-tt_news-submitter (please look below).

I works just fine but since the multiple selects became quite long how (>20 values), the TS-code also became quite long...

How could these lines:

...
            305.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|4            
            306 < .10
            306.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|5
            307 < .10
...

...done in a loop (with TS)? Any suggestions? Or should this done with a userfunc?

Thanks in advance!!!

Regards,
Bert

plugin.tx_powermail_pi1 {
    dbEntry {
      tt_news {
          _enable = TEXT
          _enable.value = 1
          _mm = COA
          _mm {
            10 = COA
            10 {
              # 1 is always the mm table      
              1 = TEXT
              1.value = tt_news_cat_mm          
              # 2 is always the other table      
              2 = TEXT
              2.value = tt_news_cat
              # 3 is always the uid of the other table to get a relation to this
              # (in this case uid_foreign of tt_news_cat_mm), first selectbox   
              # "285" is the uid of the Powermail content-element   
              # This is an insert of a select with a single select value
              # Country
              3 = TEXT
              3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat3}
            }  

            # Copy over to second selectbox, then catch values in case of a multiple select (5 options)
            # This is a multiple select Eje Pam
            20 < .10
            20.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat1}|0
            21 < .10
            21.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat1}|1
            22 < .10
            22.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat1}|2
            23 < .10
            23.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat1}|3            
            24 < .10
            24.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat1}|4            

            # This is a multiple select Tema
            301 < .10
            301.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|0
            302 < .10
            302.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|1
            303 < .10
            303.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|2
            304 < .10
            304.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|3            
            305 < .10
            305.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|4            
            306 < .10
            306.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|5
            307 < .10
            307.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|6
            308 < .10
            308.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|7
            309 < .10
            309.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|8            
            310 < .10
            310.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|9            
            311 < .10
            311.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|10
            312 < .10
            312.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|11
            313 < .10
            313.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|12
            314 < .10
            314.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|13            
            315 < .10
            315.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|14            
            316 < .10
            316.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|15
            317 < .10
            317.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|16
            318 < .10
            318.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat2}|17

            # This is a multiple select Fuentes de Financiamiento
            401 < .10
            401.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat4}|0
            402 < .10
            402.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat4}|1
            403 < .10
            403.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat4}|2
            404 < .10
            404.3.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid{$startUid}{$parentCat4}|3                   

          }          
          pid = TEXT
          pid.value=18
          tstamp = TEXT
          tstamp.data = date:U
          crdate = TEXT
          crdate.data = date:U
          datetime = TEXT
          datetime.data = date:U
          title = TEXT
          title.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid1
          bodytext = TEXT
          bodytext.data = TSFE:fe_user|sesData|powermail_{$powermailUid}|uid2
          bodytext.stripHtml = 1
      }        
  }
}

Also available in: Atom PDF