[BUGFIX] TCA: handle select renderMode=tree with minitems=1 AND maxitems=1

Using the TCA select renderMode=tree with the option
minitems=1 AND maxitems=1
leads to two bugs since TYPO3 4.5:

First #48943
* A new table entry won't mark the field selection as required. The yellow
  question mark is missing and you can save the entry.
* Once you select a checkbox in the tree and unselect it again, the
  required-check is working.

Second: #31637
* You load an existing table entry with a selection of e.g. a category
  which has been hidden or deleted. The selected checkbox won't be shown,
  but the required-check fails.
* Even worse: You can't select another category as the form thinks you
  have already selected one item (maxitem=1). You can fix this only by
  manipulating the database directly.

The reason for these bugs can be found in
DataPreprocessor::renderRecord_selectProc(). For maxitems = 1 the
foreign_table element ids for the tree will be fetched by getDataIdList().
These elements won't be checked whether they are valid (hidden/deleted).
This check is done in selectAddForeign() which is used for maxitems > 1.

The patch uses the same procedure as for maxitems > 1 in case
of renderMode = tree.

Resolves: #48943
Resolves: #31637
Releases: 6.3, 6.2, 6.1
Change-Id: I078ff524ea73951f2121d2c233a46bc2ae562952
Reviewed-on: https://review.typo3.org/31481
Reviewed-by: Markus Klein
Tested-by: Markus Klein