- Introduced new entity `CKuendigung` for managing terminations. - Added fields for termination details including date, reason, type, and status. - Implemented backend service to initiate terminations from rental agreements. - Created frontend handler for termination actions with confirmation dialog. - Updated metadata and layouts for `CKuendigung` to support new functionality. - Added internationalization support for English and German languages. - Enhanced existing entities to establish relationships with terminations.
64 lines
1.6 KiB
PHP
64 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Espo\Custom\Controllers;
|
|
|
|
use Espo\Core\Exceptions\BadRequest;
|
|
use Espo\Core\Api\Request;
|
|
|
|
class CVmhMietverhltnis extends \Espo\Core\Templates\Controllers\BasePlus
|
|
{
|
|
/**
|
|
* POST Action: Initiate eviction lawsuit from Mietverhältnis
|
|
*/
|
|
public function postActionInitiateEviction(Request $request): array
|
|
{
|
|
$data = $request->getParsedBody();
|
|
|
|
$id = $data->id ?? null;
|
|
if (!$id) {
|
|
throw new BadRequest('No Mietverhältnis ID provided');
|
|
}
|
|
|
|
$service = $this->getRecordService();
|
|
$result = $service->initiateEviction($id);
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* POST Action: Initiate rent collection from Mietverhältnis
|
|
*/
|
|
public function postActionInitiateRentCollection(Request $request): array
|
|
{
|
|
$data = $request->getParsedBody();
|
|
|
|
$id = $data->id ?? null;
|
|
if (!$id) {
|
|
throw new BadRequest('No Mietverhältnis ID provided');
|
|
}
|
|
|
|
$service = $this->getRecordService();
|
|
$result = $service->initiateRentCollection($id);
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* POST Action: Initiate termination from Mietverhältnis
|
|
*/
|
|
public function postActionInitiateTermination(Request $request): array
|
|
{
|
|
$data = $request->getParsedBody();
|
|
|
|
$id = $data->id ?? null;
|
|
if (!$id) {
|
|
throw new BadRequest('No Mietverhältnis ID provided');
|
|
}
|
|
|
|
$service = $this->getRecordService();
|
|
$result = $service->initiateTermination($id);
|
|
|
|
return $result;
|
|
}
|
|
}
|