Chore: Verschiebe Git-Repository in das Hauptverzeichnis und richte .gitignore ein
This commit is contained in:
commit
96d0545193
502 files changed
+176027
No files matched your search
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\Eid\TxGutachten;
|
||||
|
||||
class ProjektClone
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function clone()
|
||||
{
|
||||
TxGutachten::$debug = 0;
|
||||
|
||||
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
||||
$projekt_id = GeneralUtility::_GP('id');
|
||||
if (!is_numeric($projekt_id)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$_projekte = Select::projekte($projekt_id);
|
||||
|
||||
if (!isset($_projekte[0])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$_new_projekte = $_projekte[0];
|
||||
|
||||
unset($_new_projekte['id']);
|
||||
unset($_new_projekte['gutachter']);
|
||||
unset($_new_projekte['auftraggeber']);
|
||||
unset($_new_projekte['active']);
|
||||
$_new_projekte['uid'] = $userid;
|
||||
$_new_projekte['intname'] .= ' (Kopie)';
|
||||
$_new_projekte['beschreibung'] = 'KOPIE! '.$_new_projekte['beschreibung'];
|
||||
$_new_projekte['erstelldatum'] = time();
|
||||
$new_projekt_id = DbFunction::secureInsert('tx_gutachten_projekte', $_new_projekte);
|
||||
|
||||
$_table_to_copy = ['tx_gutachten_projekteplatzhalter', 'tx_gutachten_projektestandards', 'tx_gutachten_allgemein', 'tx_gutachten_help', 'tx_gutachten_raume_generell'];
|
||||
|
||||
foreach ($_table_to_copy as $key => $table) {
|
||||
$_data = DbFunction::select($table, '*', ['pid' => $projekt_id]);
|
||||
foreach ($_data as $key => $value) {
|
||||
unset($value['id']);
|
||||
$value['pid'] = $new_projekt_id;
|
||||
DbFunction::secureInsert($table, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$_data = DbFunction::select('tx_gutachten_raume_basis', '*', ['pid' => $projekt_id]);
|
||||
$_basis_ids = [];
|
||||
foreach ($_data as $key => $value) {
|
||||
$id = $value['id'];
|
||||
unset($value['id']);
|
||||
|
||||
$value['pid'] = $new_projekt_id;
|
||||
$_basis_ids[$id] = DbFunction::secureInsert('tx_gutachten_raume_basis', $value);
|
||||
}
|
||||
|
||||
$_data = DbFunction::select('tx_gutachten_raume_all', '*', ['pid' => $projekt_id]);
|
||||
foreach ($_data as $key => $value) {
|
||||
unset($value['id']);
|
||||
$value['pid'] = $new_projekt_id;
|
||||
|
||||
$tt_raume_basis_id = $value['tt_raume_basis_id'];
|
||||
$value['tt_raume_basis_id'] = $_basis_ids[$tt_raume_basis_id];
|
||||
|
||||
DbFunction::secureInsert('tx_gutachten_raume_all', $value);
|
||||
}
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user