44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace HermannTelser\Gutachten\Settings;
|
|
|
|
use HermannTelser\Gutachten\DB\DbFunction;
|
|
use HermannTelser\Gutachten\DB\Select;
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
|
class TextEdit
|
|
{
|
|
/**
|
|
* @param mixed $id
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function update()
|
|
{
|
|
$table = GeneralUtility::_GP('table');
|
|
$field = GeneralUtility::_GP('field');
|
|
$value = GeneralUtility::_GP('value');
|
|
$id = GeneralUtility::_GP('id');
|
|
if (-1 == $id) {
|
|
$insert_array = [];
|
|
$insert_array[$field] = $value;
|
|
DbFunction::secureInsert($table, $insert_array);
|
|
} else {
|
|
$update_array = [];
|
|
if ('tx_gutachten_raume_generell' == $table) {
|
|
if ('raumart' == $field) {
|
|
$update_array['tt_raumart_id'] = Select::methoden_by_raumart($value);
|
|
} elseif ('factor' == $field) {
|
|
$update_array['factor'] = str_replace(',', '.', $value);
|
|
}
|
|
} else {
|
|
$update_array[$field] = $value;
|
|
}
|
|
DbFunction::secureUpdate($table, $update_array, ['id' => $id]);
|
|
}
|
|
if ('tx_gutachten_raume_basis' == $table) {
|
|
DbFunction::query("Update tx_gutachten_raume_basis SET summe_az = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u where id=$id");
|
|
}
|
|
}
|
|
}
|