oliverklee / ext-seminars

TYPO3 extension "seminars"
https://www.oliverklee.de/typo3-services/seminarmanager/
GNU General Public License v2.0
6 stars 20 forks source link

Exception from sorting changes in 2.1.2 #192

Open aschmutt opened 5 years ago

aschmutt commented 5 years ago

I had seminar data created with Version 2.1.x and then updated to 2.1.2 -> sorting got removed from several tables in ext_tables.sql But database record still have the sorting fields, this might be the reason to the following exception.

But code is from the Extbase fork, merged manually by hand, so if you can't reproduce the bug it is an issue with my code -> give it back to me then

Uncaught TYPO3 Exception
There was an error with the database query. Column 'sorting' in order clause is ambiguous The last built query: SELECT title, address, zip, city, country, homepage, directions FROM tx_seminars_sites, tx_seminars_seminars_place_mm WHERE uid_local = 2 AND uid = uid_foreign AND `tx_seminars_sites`.`deleted` = 0 ORDER BY sorting ASC 

Tx_Oelib_Exception_Database thrown in file
/kunden/366137_70794/rp-hosting/5123095/6123095/typo3cms/seminars_typo3/typo3conf/ext/oelib/Classes/Db.php in line 338.

21 Tx_Oelib_Db::select("title, address, zip, city, country, homepage, directions", "tx_seminars_sites, tx_seminars_seminars_place_mm", "uid_local = 2 AND uid = uid_foreign AND `tx_seminars_sites`.`deleted` = 0", "", "sorting ASC", "")

/kunden/366137_70794/rp-hosting/5123095/6123095/typo3cms/seminars_typo3/typo3conf/ext/oelib/Classes/Db.php:
00411:             $groupBy,
00412:             $orderBy,
00413:             $limit
00414:         );
00415: 

20 Tx_Oelib_Db::selectMultiple("title, address, zip, city, country, homepage, directions", "tx_seminars_sites, tx_seminars_seminars_place_mm", "uid_local = 2 AND uid = uid_foreign AND `tx_seminars_sites`.`deleted` = 0", "", "sorting ASC")

/kunden/366137_70794/rp-hosting/5123095/6123095/typo3cms/seminars_typo3/typo3conf/ext/seminars/Classes/OldModel/Event.php:
00689:             \Tx_Oelib_Db::enableFields('tx_seminars_sites'),
00690:             '',
00691:             'sorting ASC'
00692:         );
00693:     }

19 Tx_Seminars_OldModel_Event::getPlacesAsArray()

/kunden/366137_70794/rp-hosting/5123095/6123095/typo3cms/seminars_typo3/typo3conf/ext/seminars/Classes/OldModel/Event.php:
00391:         $result = '';
00392: 
00393:         foreach ($this->getPlacesAsArray() as $place) {
00394:             $name = htmlspecialchars($place['title']);
00395:             if ($place['homepage'] != '') {

18 Tx_Seminars_OldModel_Event::getPlaceWithDetails(Tx_Seminars_FrontEnd_DefaultController)

/kunden/366137_70794/rp-hosting/5123095/6123095/typo3cms/seminars_typo3/typo3conf/ext/seminars/Classes/FrontEnd/DefaultController.php:
00950:             'place',
00951:             $this->getConfValueBoolean('showSiteDetails', 's_template_special')
00952:                 ? $this->seminar->getPlaceWithDetails($this)
00953:                 : htmlspecialchars($this->seminar->getPlaceShort())
00954:         );
oliverklee commented 5 years ago

@aschmutt Which steps are required to reproduce this problem?

And does the problem also occur if you use the unchanged seminars master version?

aschmutt commented 5 years ago

Yes, reproduced it in the unchanged master version as well. You need a event with some Places to reproduce.

This is the bugfix: tx_seminars_seminars_place_mm.sorting ASC replaces sorting ASC in typo3conf/ext/seminars/Classes/OldModel/Event.php -> getPlacesAsArray() Line 691

It requires a search-replace in all code, Speaker.php -> getSkillsShort() has the same error.

oliverklee commented 5 years ago

@aschmutt Would you be willing to create a PR for this?

aschmutt commented 5 years ago

I changed and tested it against my error, it is fine now.

oliverklee commented 5 years ago

@aschmutt Could you please post the steps to reproduce? Like this:

  1. create a Foo record
  2. create a Bar record and link the Foo record
  3. in the FE baz view, click on the "Foo" record
  4. click here