DMKEBUSINESSGMBH / typo3-mkforms

https://www.dmk-ebusiness.de
3 stars 6 forks source link

SearchForm does not work (example below with cut and paste) #87

Open AntonMezger opened 6 years ago

AntonMezger commented 6 years ago

All my xml files work correctly with mkforms, however an xml file with a searchform refuses to render and tells me "Leider ist ein Fehler aufgetreten). The xml file was developed with formidable and probably something has to be changed I guess.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <formidable version="2.0.477" xmlns:renderlet="http://formidable.typo3.ug/xmlns/2.0.477/renderlet">

<meta>
    <name>searchform</name>
    <form formid="searchform" />
              <debug>false</debug>
              <codebehind name="cb" path="fileadmin/xml/cb/class.exportxls.php" />
              <codebehind name="cb1" path="fileadmin/xml/cb/class.userfunctions.php" />
</meta>

<control>
    <datasource:DB name="mytable">
            <sql>
                <userobj>
                    <php><![CDATA[
                          $superuser="Superuser";
                          if(in_array($superuser, $GLOBALS['TSFE']->fe_user->groupData['title'])){
                               return 'SELECT * FROM mytable';
                          } else {                               
            return 'SELECT * FROM mytable 
                WHERE association = ' ."'" . $GLOBALS["TSFE"]->fe_user->user["username"] ."'";
                          } 
                                  ]]></php>
                </userobj>
            </sql>  
    </datasource:DB>

</control>

<elements>

    <renderlet:BOX name="mybrand" mode="h2">
        <html>
            <userobj>
                <php><![CDATA[

// en=0 de=2 fr=3 it=5 switch ($GLOBALS['TSFE']->sys_language_uid) { case 0: $html = "Actual user: " . $GLOBALS["TSFE"]->fe_user->user["username"]; break; case 2: $html = "Aktueller Benutzer: " . $GLOBALS["TSFE"]->fe_user->user["username"]; break; case 3: $html = "Utilisateur actuel: " . $GLOBALS["TSFE"]->fe_user->user["username"]; break; case 5: $html = "Utente corrente: " . $GLOBALS["TSFE"]->fe_user->user["username"]; break; } return $html; ]]> </renderlet:BOX>

              <renderlet:BOX name="boxMessage" mode="H1" />

    <renderlet:SEARCHFORM name="mysearch">
        <datasource use="mytable" />
        <childs>

                               <template>
                                    <path>fileadmin/xml/template/form_search.html</path>
                               </template>

            <renderlet:TEXT name="association" class="tb2">
                                         <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.association.label</label>
            </renderlet:TEXT>

            <renderlet:TEXT name="berater" class="tb2">
                                         <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.name.label</label>
            </renderlet:TEXT>

            <renderlet:TEXT name="patient" class="tb2">
                                         <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.patient.label</label>
            </renderlet:TEXT>

                     <renderlet:LISTBOX name="year">
                   <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.year.label</label>
                  <data>
               <items>
                <item caption="" value=""/>
                <item caption="2007" value="2007"/>
                <item caption="2008" value="2008"/>
                <item caption="2009" value="2009"/>
                <item caption="2010" value="2010"/>
                <item caption="2011" value="2011"/>
                <item caption="2012" value="2012"/>
                <item caption="2013" value="2013"/>
                <item caption="2014" value="2014"/>
                <item caption="2015" value="2015"/>
                <item caption="2016" value="2016"/>
                <item caption="2017" value="2017"/>
                <item caption="2018" value="2018"/>
                <item caption="2019" value="2019"/>
                <item caption="2020" value="2020"/>
               </items>
                 </data>
                  </renderlet:LISTBOX>

                             <renderlet:DATE  name="datefrom"  class="tb2" activeListable="false" >
                                    <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.datefrom.label</label>
                                    <data>
                                             <datetime format="%d-%m-%y" locale="fr_FR"  allowmanualedition="true" displaytime="false" convertToTimestamp="false" />
                                    </data>
                            </renderlet:DATE> 

                            <renderlet:DATE  name="dateto"  class="tb2" activeListable="false" >
                                    <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.dateto.label</label>
                                    <data>
                                             <datetime format="%d-%m-%y" locale="fr_FR"  allowmanualedition="true" displaytime="false" convertToTimestamp="false" />
                                    </data>
                           </renderlet:DATE> 

    <renderlet:BUTTON name="exportexcel1">
                       <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.export1.label</label>
        <onclick runat="server" exec="cb.doExport()"  params="1" when="before-render"/>
    </renderlet:BUTTON>

    <renderlet:BUTTON name="exportexcel2">
                       <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.export2.label</label>
        <onclick runat="server" exec="cb.doExport()"  params="2" when="before-render"/>
    </renderlet:BUTTON>

    <renderlet:BUTTON name="print">
                       <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.pdf.label</label>
        <onclick runat="server" exec="cb.doPrint()"  when="before-render"/>
    </renderlet:BUTTON>

    <renderlet:BUTTON name="btnClear" >
                      <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.resetform.label</label>
                <onclick runat="client">
                    <userobj>
                        <php><![CDATA[

                                                       $aTasks = array();
                                                       $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["datefrom"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["dateto"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["year"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["patient"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["association"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["berater"]->majixClearValue();
                                                        return $aTasks;

                        ]]></php>
                    </userobj>
                </onclick>
            </renderlet:BUTTON>

              <renderlet:SUBMIT name="btnSearch" mode="search" >
                   <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.search.label</label>
              </renderlet:SUBMIT>

        </childs>
    </renderlet:SEARCHFORM>

    <renderlet:LISTER name="pages" ajaxLister="true">
        <ifEmpty>Empty</ifEmpty>
        <searchform use="mysearch" />
        <pager>
            <rows perpage="10" />
                                 <sort column="uid"  direction="DESC"/>
        </pager>
        <columns>
            <column type="renderlet:LINK" name="uid" listHeader="id" >
                <url>
                    <userobj>
                        <php><![CDATA[
                                                               return "index.php?id=80&uid=".$this->getListData('uid')."&L=".$GLOBALS['TSFE']->sys_language_uid;
                        ]]></php>
                    </userobj>
                </url>
                                </column>
            <column type="renderlet:TEXT" name="association" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.association.label" />
            <column type="renderlet:TEXT" name="berater"  listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.name.label"/>
            <column type="renderlet:LISTBOX" name="zielerreichung" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.label">
                <data>
                    <items>
                                                 <item><value>-1</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items0</caption>
                                                 </item>
                                                 <item><value>1</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items1</caption>
                                                 </item>
                                                 <item><value>2</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items2</caption>
                                                 </item>
                                                 <item><value>3</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items3</caption>
                                                 </item>
                                                 <item><value>4</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items4</caption>
                                                  </item>
                                                  <item><value>5</value>
                                                      <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items5</caption>
                                                  </item>
                                                   </items>
                </data>
            </column>
                                <column type="renderlet:TEXTAREA" defaultWrap="false" name="Text"  listHeader="Text"/>
                                <column type="renderlet:TEXT" name="year" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.year.label" />
                                <column type="renderlet:TEXT" name="patient" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.patient.label" />

                                        <column type="renderlet:DATE" name="beratungsdatum" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.dateberatung.label" >
                <data>
                    <datetime format="%d-%m-%Y" />
                </data>
            </column>

                                <column type="renderlet:BUTTON" name="btn-del"  listHeader=""  class="delete">
                                        <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.delete.label</label>
                <onclick
                    runat="ajax"
                    params="rowData::uid"
                    cache="false"
                    exec="cb1.btnDelete_click()"
                />
                                </column>

        </columns>
    </renderlet:LISTER>

</elements>

hannesbochmann commented 6 years ago

Could you please set the extension configuration of rn_base for verbose mayday to true? After this you should see a more verbose error message in place. Furthermore it would be helpful to install a devlog extension like mklog if that doesn't help.

AntonMezger commented 6 years ago

Hi,

I got the following backtrace, but it seems that actually I do not understand where the problem is coming from. I hope you can help me:

UNCAUGHT EXCEPTION FOR VIEW: tx_mkforms_action_FormBase CODE: 1 MESSAGE: PHP Warning: array_key_exists() expects parameter 2 to be array, null given in C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\widgets\searchform\class.tx_mkforms_widgets_searchform_Main.php line 173 STACK:

TYPO3\CMS\Core\Error\Exception: PHP Warning: array_key_exists() expects parameter 2 to be array, null given in C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\widgets\searchform\class.tx_mkforms_widgets_searchform_Main.php line 173 in C:\inetpub\wwwroot\typo3_src-7.6.31\typo3\sysext\core\Classes\Error\ErrorHandler.php:111

Stack trace:

0 [internal function]: TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'array_key_exist...', 'C:\inetpub\wwwr...', 173, Array)

1 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\widgets\searchform\class.tx_mkforms_widgets_searchform_Main.php(173): array_key_exists('rdt_lister', NULL)

2 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\widgets\searchform\class.tx_mkforms_widgets_searchform_Main.php(67): tx_mkforms_widgets_searchform_Main->_initCriterias()

3 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\widgets\searchform\class.tx_mkforms_widgets_searchform_Main.php(24): tx_mkforms_widgets_searchform_Main->_initData()

4 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\api\class.mainrenderlet.php(524): tx_mkforms_widgets_searchform_Main->_render()

5 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\api\class.tx_ameosformidable.php(2901): formidable_mainrenderlet->render()

6 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\api\class.tx_ameosformidable.php(2878): tx_ameosformidable->_renderElement(Object(tx_mkforms_widgets_searchform_Main))

7 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\api\class.tx_ameosformidable.php(2441): tx_ameosformidable->_renderElements()

8 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\api\class.tx_ameosformidable.php(2192): tx_ameosformidable->_render()

9 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\mkforms\action\class.tx_mkforms_action_FormBase.php(113): tx_ameosformidable->render()

10 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\rn_base\action\class.tx_rnbase_action_BaseIOC.php(87): tx_mkforms_action_FormBase->handleRequest(Object(tx_rnbase_parameters), Object(Tx_Rnbase_Configuration_Processor), Object(ArrayObject))

11 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\rn_base\class.tx_rnbase_controller.php(254): tx_rnbase_action_BaseIOC->execute(Object(tx_rnbase_parameters), Object(Tx_Rnbase_Configuration_Processor))

12 C:\inetpub\wwwroot\sdgziel\typo3conf\ext\rn_base\class.tx_rnbase_controller.php(228): tx_rnbase_controller->doAction('tx_mkforms_acti...', Object(tx_rnbase_parameters), Object(Tx_Rnbase_Configuration_Processor))

13 [internal function]: tx_rnbase_controller->main('', Array)

.... skip useless parts

Best regards

Anton

De : Hannes Bochmann notifications@github.com Envoyé : lundi 20 août 2018 08:49 À : DMKEBUSINESSGMBH/typo3-mkforms typo3-mkforms@noreply.github.com Cc : Anton Mezger antonmezger@gmail.com; Author author@noreply.github.com Objet : Re: [DMKEBUSINESSGMBH/typo3-mkforms] SearchForm does not work (example below with cut and paste) (#87)

Could you please set the extension configuration of rn_base for verbose mayday to true? After this you should see a more verbose error message in place. Furthermore it would be helpful to install a devlog extension like mklog https://github.com/DMKEBUSINESSGMBH/typo3-mklog/ if that doesn't help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DMKEBUSINESSGMBH/typo3-mkforms/issues/87#issuecomment-414214127 , or mute the thread https://github.com/notifications/unsubscribe-auth/AMZUKJnvcvnpopFdM9IE0GYKHEzAyM6aks5uSlvNgaJpZM4WC_-o . https://github.com/notifications/beacon/AMZUKOVHWnPk5MrmySCrIva7gR_OkXKQks5uSlvNgaJpZM4WC_-o.gif

hannesbochmann commented 6 years ago

There seems to be a problem with session handling as $GLOBALS['_SESSION']['ameos_formidable']['applicationdata'] is no array. Could you please check if tx_mkforms_session_MixedSessionManager::initializeSessionArray() is invoked before the error occurs and what's the content of $GLOBALS['_SESSION']['ameos_formidable'] at the start and the end of this method? You could also check if the problem occurs with older versions of mkforms. After 3.0.14 there were some changes to the session handling. Maybe it works 3.0.14 which would lead us in the right direction.

AntonMezger commented 6 years ago

Hi,

Effectively $GLOBALS['_SESSION'] is null; how to invoke the initializeSessionArray, that method being private?

Many thanks for helping me out

Best regards

De : Hannes Bochmann notifications@github.com Envoyé : lundi 20 août 2018 09:24 À : DMKEBUSINESSGMBH/typo3-mkforms typo3-mkforms@noreply.github.com Cc : Anton Mezger antonmezger@gmail.com; Author author@noreply.github.com Objet : Re: [DMKEBUSINESSGMBH/typo3-mkforms] SearchForm does not work (example below with cut and paste) (#87)

There seems to be a problem with session handling as $GLOBALS['_SESSION']['ameos_formidable']['applicationdata'] is no array. Could you please check if tx_mkforms_session_MixedSessionManager::initializeSessionArray() is invoked before the error occurs and what's the content of $GLOBALS['_SESSION']['ameos_formidable'] at the start and the end of this method? You could also check if the problem occurs with older versions of mkforms. After 3.0.14 there were some changes to the session handling. Maybe it works 3.0.14 which would lead us in the right direction.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DMKEBUSINESSGMBH/typo3-mkforms/issues/87#issuecomment-414221460 , or mute the thread https://github.com/notifications/unsubscribe-auth/AMZUKOIfdSf-lIwSHC8ZYAgK-_HPIlSHks5uSmQAgaJpZM4WC_-o . https://github.com/notifications/beacon/AMZUKHMUR2fygScl-ZGyequyf1YzMZOqks5uSmQAgaJpZM4WC_-o.gif

AntonMezger commented 6 years ago

Hi,

By the way I use version 3.0.21. I prefer not to go back to an older version, while the problem will occur than again in the future.

Best regards

Anton

De : Hannes Bochmann notifications@github.com Envoyé : lundi 20 août 2018 09:24 À : DMKEBUSINESSGMBH/typo3-mkforms typo3-mkforms@noreply.github.com Cc : Anton Mezger antonmezger@gmail.com; Author author@noreply.github.com Objet : Re: [DMKEBUSINESSGMBH/typo3-mkforms] SearchForm does not work (example below with cut and paste) (#87)

There seems to be a problem with session handling as $GLOBALS['_SESSION']['ameos_formidable']['applicationdata'] is no array. Could you please check if tx_mkforms_session_MixedSessionManager::initializeSessionArray() is invoked before the error occurs and what's the content of $GLOBALS['_SESSION']['ameos_formidable'] at the start and the end of this method? You could also check if the problem occurs with older versions of mkforms. After 3.0.14 there were some changes to the session handling. Maybe it works 3.0.14 which would lead us in the right direction.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DMKEBUSINESSGMBH/typo3-mkforms/issues/87#issuecomment-414221460 , or mute the thread https://github.com/notifications/unsubscribe-auth/AMZUKOIfdSf-lIwSHC8ZYAgK-_HPIlSHks5uSmQAgaJpZM4WC_-o . https://github.com/notifications/beacon/AMZUKHMUR2fygScl-ZGyequyf1YzMZOqks5uSmQAgaJpZM4WC_-o.gif

hannesbochmann commented 6 years ago

You don't need to invoke that method, mkforms should take care of that. It's done for example when tx_mkforms_session_MixedSessionManager is instantiated (check the constrcutor). You should only go back to an older version to check at which point the functionality broke. My guess is that it will work with mkforms 3.0.14. With that in mind it would be much more easy to track down the problem.

AntonMezger commented 6 years ago

Hi,

I replaced my version of mkforms with version 3.0.14.

Now application data appears as array and contains rdt_lister.

However, now I get another error; it tells me that my template is wrong, I guess, but it is the same as always (is there something new?). See template below:

UNCAUGHT EXCEPTION FOR VIEW: tx_mkforms_action_FormBase CODE: 0 MESSAGE:

MKFORMS:

RENDERLET:SEARCHFORM[name=mysearch] - Template defined, but /template/subpart is missing. Please check your XML configuration.

XML: fileadmin/xml/search.xml MKFORMS Version: v3.0.21 Total exec. time: 0.129 sec

debug trail:

  1. {closure}#34

  2. TYPO3\CMS\Frontend\Http\Application->run#33

  3. TYPO3\CMS\Core\Core\Bootstrap->handleRequest#78

  4. TYPO3\CMS\Frontend\Http\RequestHandler->handleRequest#308

  5. TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript#232

  6. TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->recursivelyReplaceIntPlaceholdersInContent#3488

  7. TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript_process#3522

  8. TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle#3577

  9. TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->render#859

  10. TYPO3\CMS\Frontend\ContentObject\UserContentObject->render#943

  11. TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction#40

  12. call_user_func_array#7322

  13. tx_rnbase_controller->main#

  14. tx_rnbase_controller->doAction#228

  15. tx_rnbase_action_BaseIOC->execute#254

  16. tx_mkforms_action_FormBase->handleRequest#87

  17. tx_ameosformidable->render#113

  18. tx_ameosformidable->_render#2179

  19. tx_ameosformidable->_renderElements#2428

  20. tx_ameosformidable->_renderElement#2865

  21. formidable_mainrenderlet->render#2888

  22. tx_mkforms_widgets_searchform_Main->_render#491

  23. formidable_mainrenderlet->renderChildsCompiled#27

  24. formidable_mainrenderlet->findTemplate#2806

  25. formidable_mainrenderlet->mayday#2766

  26. tx_ameosformidable->mayday#2801

  27. tx_mkforms_util_Div::mayday#3376

  28. tx_rnbase_util_Debug::getDebugTrail#261

Filter:

{association.label} : {association.input} {berater.label} : {berater.input} {patient.label} : {patient.input}
  {year.label} : {year.input} {datefrom.label} : {datefrom.input} {dateto.label} : {dateto.input}
            <div style="margin-left: 50px; margin-top: 10px;">

              <span class="label">{btnSearch}</span>

            {btnClear.input}

              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

            {print.input}

              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

             {exportexcel1.input}

            {exportexcel2.input}

            </div>

<!-- ###mysearch### end-->
{pages}
  <!-- ###ROWS### begin-->

  <!-- ###ROW### begin-->

  {short} {btn-del} {btn-hide} <br />

  {long}

  <!-- ###ROW### end-->

  <!-- ###ROWS### end-->

  <!-- ###pages### end-->       

De : Hannes Bochmann notifications@github.com Envoyé : lundi 20 août 2018 09:42 À : DMKEBUSINESSGMBH/typo3-mkforms typo3-mkforms@noreply.github.com Cc : Anton Mezger antonmezger@gmail.com; Author author@noreply.github.com Objet : Re: [DMKEBUSINESSGMBH/typo3-mkforms] SearchForm does not work (example below with cut and paste) (#87)

You don't need to invoke that method, mkforms should take care of that. It's done for example when tx_mkforms_session_MixedSessionManager is instantiated (check the constrcutor). You should only go back to an older version to check at which point the functionality broke. My guess is that it will work with mkforms 3.0.14. With that in mind it would be much more easy to track down the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DMKEBUSINESSGMBH/typo3-mkforms/issues/87#issuecomment-414225840 , or mute the thread https://github.com/notifications/unsubscribe-auth/AMZUKP5UIErZt9xFmCBYzZ7KVknNylcJks5uSmhDgaJpZM4WC_-o . https://github.com/notifications/beacon/AMZUKPOIIEO84BqhIkSqnVRzlkenVbTfks5uSmhDgaJpZM4WC_-o.gif

hannesbochmann commented 6 years ago

The new error is due to an error in your xml. The