/** * @test */ public function enableFieldsCanBeDifferentForDifferentIgnores() { self::assertNotSame(Tx_Oelib_Db::enableFields('tx_oelib_test', 0, array()), Tx_Oelib_Db::enableFields('tx_oelib_test', 0, array('endtime' => TRUE))); }
/** * Returns the WHERE clause that selects all visible records from the DB. * * @param bool $allowHiddenRecords whether hidden records should be found * * @return string the WHERE clause that selects all visible records in the, * DB, will not be empty */ protected function getUniversalWhereClause($allowHiddenRecords = FALSE) { return '1 = 1' . Tx_Oelib_Db::enableFields($this->getTableName(), $allowHiddenRecords ? 1 : -1); }
/** * Checks whether a configuration value either is empty or contains a * comma-separated list of PIDs that specify pages or a given type. * * @param string $fieldName * TS setup field name to extract, must not be empty * @param bool $canUseFlexforms * whether the value can also be set via flexforms (this will be * mentioned in the error message) * @param string $sheet * flexforms sheet pointer, eg. "sDEF", will be ignored if * $canUseFlexforms is set to FALSE * @param string $explanation * a sentence explaining what that configuration value is needed for, * must not be empty * @param string $typeCondition * a comparison operator with a value that will be used in a SQL * query to check for the correct page types, for example "<199" or * "=254", must not be empty * * @return void */ protected function checkPageTypeOrEmpty($fieldName, $canUseFlexforms, $sheet, $explanation, $typeCondition) { $this->checkIfPidListOrEmpty($fieldName, $canUseFlexforms, $sheet, $explanation); if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $pids = $this->objectToCheck->getConfValueString($fieldName, $sheet); $offendingPids = Tx_Oelib_Db::selectColumnForMultiple('uid', 'pages', 'uid IN (' . $pids . ') AND NOT (doktype' . $typeCondition . ')' . Tx_Oelib_Db::enableFields('pages')); $dbResultCount = count($offendingPids); if ($dbResultCount > 0) { $pageIdPlural = $dbResultCount > 1 ? 's' : ''; $bePlural = $dbResultCount > 1 ? 'are' : 'is'; $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the page ID' . $pageIdPlural . ' <strong>' . implode(',', $offendingPids) . '</strong> ' . 'which ' . $bePlural . ' of an incorrect page type. ' . $explanation . '<br />'; $this->setErrorMessageAndRequestCorrection($fieldName, $canUseFlexforms, $message); } } }