瀏覽代碼

removed stuff

master
Daniel 2 年之前
父節點
當前提交
92776b3c1e
共有 30 個檔案被更改,包括 14 行新增9012 行删除
  1. +0
    -129
      httpdocs/symfony/src/Command/CmdImportUpdateCustomers.php
  2. +0
    -129
      httpdocs/symfony/src/Command/CmdImportUpdateOperators.php
  3. +0
    -260
      httpdocs/symfony/src/Controller/OperatorEditController.php
  4. +0
    -310
      httpdocs/symfony/src/Controller/OperatorMeetingEditController.php
  5. +0
    -62
      httpdocs/symfony/src/Controller/OperatorViewController.php
  6. +0
    -256
      httpdocs/symfony/src/Controller/ProductionEditController.php
  7. +0
    -314
      httpdocs/symfony/src/Controller/ProductionMeetingEditController.php
  8. +0
    -62
      httpdocs/symfony/src/Controller/ProductionViewController.php
  9. +14
    -0
      httpdocs/symfony/src/Controller/PublicController.php
  10. +0
    -256
      httpdocs/symfony/src/Controller/ServiceEditController.php
  11. +0
    -316
      httpdocs/symfony/src/Controller/ServiceMeetingEditController.php
  12. +0
    -62
      httpdocs/symfony/src/Controller/ServiceViewController.php
  13. +0
    -535
      httpdocs/symfony/src/Entity/EntOperator.php
  14. +0
    -472
      httpdocs/symfony/src/Entity/EntOperatorContact.php
  15. +0
    -693
      httpdocs/symfony/src/Entity/EntOperatorMeeting.php
  16. +0
    -97
      httpdocs/symfony/src/Entity/EntOperatorMeetingParticipant.php
  17. +0
    -440
      httpdocs/symfony/src/Entity/EntOperatorNote.php
  18. +0
    -535
      httpdocs/symfony/src/Entity/EntProduction.php
  19. +0
    -472
      httpdocs/symfony/src/Entity/EntProductionContact.php
  20. +0
    -693
      httpdocs/symfony/src/Entity/EntProductionMeeting.php
  21. +0
    -97
      httpdocs/symfony/src/Entity/EntProductionMeetingParticipant.php
  22. +0
    -440
      httpdocs/symfony/src/Entity/EntProductionNote.php
  23. +0
    -535
      httpdocs/symfony/src/Entity/EntService.php
  24. +0
    -472
      httpdocs/symfony/src/Entity/EntServiceContact.php
  25. +0
    -693
      httpdocs/symfony/src/Entity/EntServiceMeeting.php
  26. +0
    -97
      httpdocs/symfony/src/Entity/EntServiceMeetingParticipant.php
  27. +0
    -440
      httpdocs/symfony/src/Entity/EntServiceNote.php
  28. +0
    -18
      httpdocs/symfony/src/EntityVirtual/ServiceData.php
  29. +0
    -62
      httpdocs/symfony/src/Migrations/Version20201016103219.php
  30. +0
    -65
      httpdocs/symfony/src/Migrations/Version20220907142919.php

+ 0
- 129
httpdocs/symfony/src/Command/CmdImportUpdateCustomers.php 查看文件

@@ -1,129 +0,0 @@
<?php

namespace App\Command;

use App\Entity\EntCustomer;
use App\Utils\Utils;
use Doctrine\DBAL\DriverManager;
use Doctrine\ORM\EntityManager;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;


/**
* Command to import excel that with answers of specifications
*
* Class CmdImportAll
* @package App\Command
*/
class CmdImportUpdateCustomers extends Command
{
protected static $defaultName = 'app:update-customers';

/** @var EntityManager $em */
private $em;

/** @var ContainerInterface $container */
private $container;

private $environment;

/**
* CmdImportCustomers constructor.
* @param EntityManager $em
* @param ContainerInterface $container
*/
public function __construct(EntityManager $em, ContainerInterface $container)
{
$this->em = $em;
$this->container = $container;
$kernel = $this->container->get('kernel');
$this->environment = $kernel->getEnvironment();
parent::__construct();
}

/**
*
*/
protected function configure()
{
$this
// the short description shown while running "php bin/console list"
->setDescription('Imports customers from old db.')

// the full command description shown when running the command with
// the "--help" option
->setHelp('This command allows you to customers from old db.')
;
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
* @throws \Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$kernel = $this->container->get('kernel');
$this->environment = $kernel->getEnvironment();
$dbOld = Utils::getOldDbConnection($this->environment);

$customerSql = "SELECT * FROM `plp_kunden`";
$sth = $dbOld->prepare($customerSql);
$sth->execute();
$oldCustomers = $sth->fetchAll();

$newCustomers = $this->em->getRepository('App:EntCustomer')->findAll();
$newCustomersById = Utils::getSortedObjectsById($newCustomers);
$newCustomersByOldId = Utils::getSortedObjects('getOldPlpId', $newCustomers);

$this->em->getConnection()->beginTransaction();
try {
foreach ($oldCustomers as $oldCustomer) {
/** @var EntCustomer $entCustomer */
$entCustomer = null;
$customerName = !is_null($oldCustomer['PLP_Kunden_Name']) ? $oldCustomer['PLP_Kunden_Name'] : "";
$oldPlpId = $oldCustomer['PLP_Kunden_Bu'] . $oldCustomer['PLP_Kunden_Nr'];
if (!array_key_exists($oldCustomer['PLP_Kunden_Bu'] . $oldCustomer['PLP_Kunden_Nr'], $newCustomersByOldId)) {

$matchId = trim($oldCustomer['PLP_Kunden_www']);

if ($matchId == 1657 || $matchId == 1658) {
$bla = 0;
}

if (is_null($matchId)) {
throw new Exception('match id is not defined: '.$oldPlpId);
}

if (!array_key_exists($matchId, $newCustomersById)) {
throw new Exception('customer does not have matching id with new system: '.$matchId.' '.$oldPlpId);
}

// Create new customer (only once in inital execution)
$entCustomer = $newCustomersById[$matchId];
if (!is_null($entCustomer->getOldPlpId())) {
throw new Exception('customer already matched with new system: '.$matchId.' '.$oldPlpId);
}

$entCustomer->setOldPlpId($oldPlpId);
$this->em->persist($entCustomer);
}
}
$this->em->flush();
} catch (Exception $e) {
$this->em->getConnection()->rollBack();
throw new Exception($e->getMessage());
}
$this->em->getConnection()->commit();
}



}

+ 0
- 129
httpdocs/symfony/src/Command/CmdImportUpdateOperators.php 查看文件

@@ -1,129 +0,0 @@
<?php

namespace App\Command;

use App\Entity\EntCustomer;
use App\Entity\EntOperator;
use App\Utils\Utils;
use Doctrine\DBAL\DriverManager;
use Doctrine\ORM\EntityManager;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;


/**
* Command to import excel that with answers of specifications
*
* Class CmdImportAll
* @package App\Command
*/
class CmdImportUpdateOperators extends Command
{
protected static $defaultName = 'app:import-operators';

/** @var EntityManager $em */
private $em;

/** @var ContainerInterface $container */
private $container;

private $environment;

/**
* CmdImportCustomers constructor.
* @param EntityManager $em
* @param ContainerInterface $container
*/
public function __construct(EntityManager $em, ContainerInterface $container)
{
$this->em = $em;
$this->container = $container;
$kernel = $this->container->get('kernel');
$this->environment = $kernel->getEnvironment();
parent::__construct();
}

/**
*
*/
protected function configure()
{
$this
// the short description shown while running "php bin/console list"
->setDescription('Imports operators from old db.')

// the full command description shown when running the command with
// the "--help" option
->setHelp('This command allows you to operators from old db.')
;
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
* @throws \Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$dbOld = Utils::getOldDbConnection($this->environment);

$operatorSql = "SELECT * FROM `plp_betreiber`";
$sth = $dbOld->prepare($operatorSql);
$sth->execute();
$oldOperators = $sth->fetchAll();

$newOperators = $this->em->getRepository('App:EntOperator')->findAll();
$newOperatorsById = Utils::getSortedObjectsById($newOperators);
$newOperatorsByOldId = Utils::getSortedObjects('getOldPlpId', $newOperators);

$this->em->getConnection()->beginTransaction();
try {
foreach ($oldOperators as $oldOperator) {
/** @var EntOperator $entOperator */
$entOperator = null;
$operatorName = !is_null($oldOperator['PLP_Betreiber_Name']) ? $oldOperator['PLP_Betreiber_Name'] : "";
$oldPlpId = $oldOperator['PLP_Betreiber_VA_Nr'];

if ($oldPlpId != 0) {
if (!array_key_exists($oldOperator['PLP_Betreiber_VA_Nr'], $newOperatorsByOldId)) {

$matchId = trim($oldOperator['PLP_Betreiber_www']);
if (is_null($matchId)) {
throw new Exception('match id is not defined: '.$oldPlpId);
}

if (!array_key_exists($matchId, $newOperatorsById)) {
throw new Exception('operator does not have matching id with new system: '.$matchId.' '.$oldPlpId);
}

// Create new operator (only once in inital execution)
$entOperator = $newOperatorsById[$matchId];
if (!is_null($entOperator->getOldPlpId())) {
throw new Exception('operator already matched with new system: '.$matchId.' '.$oldPlpId);
}

$entOperator->setOldPlpId($oldPlpId);
$entOperator->setTaxNo($oldOperator['PLP_Betreiber_SteuerNr']);
$entOperator->setInvoiceMode($oldOperator['PLP_Betreiber_Abrechnungs_Modi']);
$entOperator->setInvoiceComment($oldOperator['PLP_Betreiber_Rechnung_Bem1']);
$entOperator->setInvoiceKey($oldOperator['PLP_Betreiber_Rechnung_Schluessel']);
$this->em->persist($entOperator);
}
}

}
} catch (Exception $e) {
$this->em->getConnection()->rollBack();
throw new Exception($e->getMessage());
}
$this->em->getConnection()->commit();

$this->em->flush();
}

}

+ 0
- 260
httpdocs/symfony/src/Controller/OperatorEditController.php 查看文件

@@ -1,260 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntOperator;
use App\Entity\EntOperatorContact;
use App\Entity\EntOperatorNote;
use App\Entity\EntUser;
use App\EntityVirtual\ServiceData;
use App\Utils\Message;
use App\Utils\Reply;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class OperatorEditController
* @package App\Controller
* @IsGranted({"ROLE_ACCOUNTING", "ROLE_TECHNIQUE", "ROLE_ADMIN"})
*/
class OperatorEditController extends AbstractController
{
/**
* @Route("/create-operator", name="create_operator")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createOperator(Request $request)
{
$operatorClient = json_decode($request->request->get('operator'));
$em = $this->getDoctrine()->getManager();
/** @var EntOperator $entOperator */
$entOperator = new EntOperator($em, $operatorClient->name);
$entOperator->setClientData($em, $operatorClient);
$em->persist($entOperator);
$em->flush();

$fullMappedOperator = $entOperator->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATORS, ServiceData::ACTION_ADD, $fullMappedOperator);
return Reply::getResponse($fullMappedOperator, Message::SUCCESS_OPERATOR_CREATE, 0, $serviceData);
}


/**
* @Route("/edit-operator", name="edit_operator")
* @param Request $request
* @return JsonResponse
*/
public function editOperator(Request $request)
{
$operatorClient = json_decode($request->request->get('operator'));
$em = $this->getDoctrine()->getManager();
/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($operatorClient->id);
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$entOperator->setClientData($em, $operatorClient);
$em->persist($entOperator);
$em->flush();

$fullMappedOperator = $entOperator->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATORS, ServiceData::ACTION_EDIT, $fullMappedOperator);
return Reply::getResponse($fullMappedOperator, Message::SUCCESS_OPERATOR_EDIT, 0, $serviceData);
}

/**
* @Route("/create-operator-contact", name="create_operator_contact")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createOperatorContact(Request $request)
{
$operatorContactClient = json_decode($request->request->get('operatorContact'));
$em = $this->getDoctrine()->getManager();
/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($operatorContactClient->operator_id);
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntOperatorContact $entOperatorContact */
$entOperatorContact = new EntOperatorContact($em, $entOperator, $operatorContactClient->lastname);
$entOperatorContact->setClientData($em, $operatorContactClient);
$em->persist($entOperatorContact);
$em->flush();

$fullMappedOperatorContact = $entOperatorContact->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_CONTACTS, ServiceData::ACTION_ADD, $fullMappedOperatorContact);
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_CONTACT_CREATE, 0, $serviceData);
}

/**
* @Route("/edit-operator-contact", name="edit_operator_contact")
* @param Request $request
* @return JsonResponse
*/
public function editOperatorContact(Request $request)
{
$operatorContactClient = json_decode($request->request->get('operatorContact'));
$em = $this->getDoctrine()->getManager();
/** @var EntOperatorContact $entOperatorContact */
$entOperatorContact = $em->getRepository('App:EntOperatorContact')->find($operatorContactClient->id);
if (is_null($entOperatorContact)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($entOperatorContact->getOperatorId());
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entOperatorContact->setClientData($em, $operatorContactClient);
$em->persist($entOperatorContact);
$em->flush();

$fullMappedOperatorContact = $entOperatorContact->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_CONTACTS, ServiceData::ACTION_EDIT, $fullMappedOperatorContact);
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_CONTACT_EDIT, 0, $serviceData);
}

/**
* @Route("/delete-operator-contact", name="delete_operator_contact")
* @param Request $request
* @return JsonResponse
*/
public function deleteOperatorContact(Request $request)
{
$operatorContactIdClient = json_decode($request->request->get('operatorContactId'));
$em = $this->getDoctrine()->getManager();
/** @var EntOperatorContact $entOperatorContact */
$entOperatorContact = $em->getRepository('App:EntOperatorContact')->find($operatorContactIdClient);
if (is_null($entOperatorContact)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($entOperatorContact->getOperatorId());
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$fullMappedOperatorContact = $entOperatorContact->clientMapper($em, true);
$em->remove($entOperatorContact);
$em->flush();

$sql = "UPDATE `operator_meeting` SET `operator_contact_id` = NULL WHERE `operator_contact_id` = ". $operatorContactIdClient;
$statement = $em->getConnection()->prepare($sql);
$statement->execute();

$sql = "UPDATE `operator_note` SET `operator_contact_id` = NULL WHERE `operator_contact_id` = ". $operatorContactIdClient;
$statement = $em->getConnection()->prepare($sql);
$statement->execute();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_CONTACTS, ServiceData::ACTION_DELETE, $fullMappedOperatorContact);
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_CONTACT_DELETE, 0, $serviceData);
}

/**
* @Route("/create-operator-note", name="create_operator_note")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createOperatorNote(Request $request)
{
$operatorNoteClient = json_decode($request->request->get('operatorNote'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($operatorNoteClient->operator_id);
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntOperatorNote $entOperatorNote */
$entOperatorNote = new EntOperatorNote($em, $entOperator, $user, $operatorNoteClient->title);
$entOperatorNote->setClientData($em, $operatorNoteClient);
$em->persist($entOperatorNote);
$em->flush();

return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_NOTE_CREATE);
}

/**
* @Route("/edit-operator-note", name="edit_operator_note")
* @param Request $request
* @return JsonResponse
*/
public function editOperatorNote(Request $request)
{
$operatorNoteClient = json_decode($request->request->get('operatorNote'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntOperatorNote $entOperatorNote */
$entOperatorNote = $em->getRepository('App:EntOperatorNote')->find($operatorNoteClient->id);
if (is_null($entOperatorNote) || $entOperatorNote->getCreationUserId() != $user->getId()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($entOperatorNote->getOperatorId());
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entOperatorNote->setClientData($em, $operatorNoteClient);
$em->persist($entOperatorNote);
$em->flush();

return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_NOTE_EDIT);
}

/**
* @Route("/delete-operator-note", name="delete_operator_note")
* @param Request $request
* @return JsonResponse
*/
public function deleteOperatorNote(Request $request)
{
$operatorNoteIdClient = json_decode($request->request->get('operatorNoteId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntOperatorNote $entOperatorNote */
$entOperatorNote = $em->getRepository('App:EntOperatorNote')->find($operatorNoteIdClient);
$bHasRightsToDelete = $entOperatorNote->getCreationUserId() == $user->getId() || $user->isAdmin();
if (is_null($entOperatorNote) || !$bHasRightsToDelete) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($entOperatorNote->getOperatorId());
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$em->remove($entOperatorNote);
$em->flush();

return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_NOTE_DELETE);
}
}

+ 0
- 310
httpdocs/symfony/src/Controller/OperatorMeetingEditController.php 查看文件

@@ -1,310 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntCustomer;
use App\Entity\EntCustomerMeeting;
use App\Entity\EntCustomerMeetingParticipant;
use App\Entity\EntInternalMeeting;
use App\Entity\EntInternalMeetingParticipant;
use App\Entity\EntMeetingType;
use App\Entity\EntOperator;
use App\Entity\EntOperatorMeeting;
use App\Entity\EntOperatorMeetingParticipant;
use App\Entity\EntProduction;
use App\Entity\EntProductionMeeting;
use App\Entity\EntProductionMeetingParticipant;
use App\Entity\EntService;
use App\Entity\EntServiceMeeting;
use App\Entity\EntServiceMeetingParticipant;
use App\Entity\EntUser;
use App\EntityVirtual\ServiceData;
use App\Utils\Message;
use App\Utils\Reply;
use App\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class MeetingEditController
* @package App\Controller
* @IsGranted("ROLE_ADMIN")
*/
class OperatorMeetingEditController extends AbstractController
{
/**
* @Route("/create-operator-meeting", name="create_operator_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createOperatorMeeting(Request $request)
{
$operatorMeetingClient = json_decode($request->request->get('operatorMeeting'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($operatorMeetingClient->operator_id);
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntUser $entOwnerUser */
$entOwnerUser = $em->getRepository('App:EntUser')->find($operatorMeetingClient->owner_user_id);
if (is_null($entOwnerUser)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntMeetingType $entMeetingType */
$entMeetingType = $em->getRepository('App:EntMeetingType')->find($operatorMeetingClient->meeting_type_id);
if (is_null($entMeetingType)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

if (!$user->isAdmin()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

// Database manipulation in transaction
$dbCon = $this->getDoctrine()->getConnection();
$dbCon->beginTransaction();

try {
/** @var EntOperatorMeeting $entOperatorMeeting */
$entOperatorMeeting = new EntOperatorMeeting($em, $entOperator, $user, $entOwnerUser, $entMeetingType,
$operatorMeetingClient->title, $operatorMeetingClient->start_date, $operatorMeetingClient->end_date);
$entOperatorMeeting->setClientData($em, $operatorMeetingClient);
$em->persist($entOperatorMeeting);
$em->flush();
$cntParticipants = count($operatorMeetingClient->v_participants);
for ($i = 0; $i < $cntParticipants; $i++) {
/** @var EntUser $participantUser */
$participantUser = $em->getRepository('App:EntUser')->find($operatorMeetingClient->v_participants[$i]->participant_user_id);
if (is_null($participantUser)) {
throw new Exception('invalid participant user');
}

/** @var EntOperatorMeetingParticipant $entParticipant */
$entParticipant = new EntOperatorMeetingParticipant($em, $entOperatorMeeting, $participantUser);
$em->persist($entParticipant);
}
$em->flush();

} catch (Exception $e) {
return Reply::getErrorResponse(Message::ERROR_INVALID_DATA);
}
// All data stored correctly
$dbCon->commit();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_MEETINGS, ServiceData::ACTION_ADD, $entOperatorMeeting->clientMapper($em, true));
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_MEETING_CREATE, 0, $serviceData);
}

/**
* @Route("/edit-operator-meeting", name="edit_operator_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function editOperatorMeeting(Request $request)
{
$operatorMeetingClient = json_decode($request->request->get('operatorMeeting'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($operatorMeetingClient->operator_id);
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntUser $entOwnerUser */
$entOwnerUser = $em->getRepository('App:EntUser')->find($operatorMeetingClient->owner_user_id);
if (is_null($entOwnerUser)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntMeetingType $entMeetingType */
$entMeetingType = $em->getRepository('App:EntMeetingType')->find($operatorMeetingClient->meeting_type_id);
if (is_null($entMeetingType)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntOperatorMeeting $entOperatorMeeting */
$entOperatorMeeting = $em->getRepository('App:EntOperatorMeeting')->find($operatorMeetingClient->id);
if (is_null($entOperatorMeeting)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

if (!$user->isAdmin()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

if (!$entOperatorMeeting->isEditDeletable()) {
return Reply::getErrorResponse(Message::ERROR_MEETING_NOT_EDIT_DELETABLE);
}

// Database manipulation in transaction
$dbCon = $this->getDoctrine()->getConnection();
$dbCon->beginTransaction();

try {
$entOperatorMeeting->setClientData($em, $operatorMeetingClient);
$em->persist($entOperatorMeeting);
$em->flush();

$formerParticipantsByUserId = Utils::getSortedObjects('getParticipantUserId',
$em->getRepository('App:EntOperatorMeetingParticipant')->findBy(['operator_meeting_id' => $entOperatorMeeting->getId()]));
$pUserIdsToKeep = [];
$cntParticipants = count($operatorMeetingClient->v_participants);
for ($i = 0; $i < $cntParticipants; $i++) {
if (!array_key_exists($operatorMeetingClient->v_participants[$i]->participant_user_id, $formerParticipantsByUserId)) {
/** @var EntUser $participantUser */
$participantUser = $em->getRepository('App:EntUser')->find($operatorMeetingClient->v_participants[$i]->participant_user_id);
if (is_null($participantUser)) {
throw new Exception('invalid participant user');
}

/** @var EntOperatorMeetingParticipant $entParticipant */
$entParticipant = new EntOperatorMeetingParticipant($em, $entOperatorMeeting, $participantUser);
$em->persist($entParticipant);
} else {
$pUserIdsToKeep[$operatorMeetingClient->v_participants[$i]->participant_user_id] = 1;
}
}

/** @var EntOperatorMeetingParticipant $formerParticipant */
foreach ($formerParticipantsByUserId as $pUserId => $formerParticipant) {
if (!array_key_exists($pUserId, $pUserIdsToKeep)) {
$em->remove($formerParticipant);
}
}
$em->flush();

} catch (Exception $e) {
return Reply::getErrorResponse(Message::ERROR_INVALID_DATA);
}
// All data stored correctly
$dbCon->commit();
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_MEETINGS, ServiceData::ACTION_EDIT, $entOperatorMeeting->clientMapper($em, true));
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_MEETING_EDIT, 0, $serviceData);
}

/**
* @Route("/delete-operator-meeting", name="delete_operator_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function deleteOperatorMeeting(Request $request)
{
$operatorMeetingIdClient = json_decode($request->request->get('operatorMeetingId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntOperatorMeeting $entOperatorMeeting */
$entOperatorMeeting = $em->getRepository('App:EntOperatorMeeting')->find($operatorMeetingIdClient);
if (is_null($entOperatorMeeting)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

if (!$user->isAdmin()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

if (!$entOperatorMeeting->isEditDeletable()) {
return Reply::getErrorResponse(Message::ERROR_MEETING_NOT_EDIT_DELETABLE);
}

/** @var EntOperator $entOperator */
$entOperator = $em->getRepository('App:EntOperator')->find($entOperatorMeeting->getOperatorId());
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$mappedOperatorMeeting = $entOperatorMeeting->clientMapper($em, true);
$em->remove($entOperatorMeeting);

$participants = $em->getRepository('App:EntOperatorMeetingParticipant')->findBy(['operator_meeting_id' => $entOperatorMeeting->getId()]);
/** @var EntOperatorMeetingParticipant $participant
*/
foreach ($participants as $participant) {
$em->remove($participant);
}
$em->flush();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_MEETINGS, ServiceData::ACTION_DELETE, $mappedOperatorMeeting);
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_MEETING_DELETE, 0, $serviceData);
}

/**
* @Route("/check-operator-meeting-report", name="check_operator_meeting_report")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function checkOperatorMeetingReport(Request $request)
{
$operatorMeetingIdClient = json_decode($request->request->get('operatorMeetingId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntOperatorMeeting $entOperatorMeeting */
$entOperatorMeeting = $em->getRepository('App:EntOperatorMeeting')->find($operatorMeetingIdClient);
if (is_null($entOperatorMeeting) || !$user->isAdmin()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$check = new \DateTime() > $entOperatorMeeting->getStartDate();
return $check ? Reply::getResponse($check) : Reply::getErrorResponse(Message::ERROR_REPORT_NOT_EDITABLE_YET);
}

/**
* @Route("/edit-operator-meeting-report", name="edit_operator_meeting_report")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function editOperatorMeetingReport(Request $request)
{
$operatorMeetingIdClient = json_decode($request->request->get('operatorMeetingId'));
$operatorMeetingReportClient = json_decode($request->request->get('operatorMeetingReport'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();


/** @var EntOperatorMeeting $entOperatorMeeting */
$entOperatorMeeting = $em->getRepository('App:EntOperatorMeeting')->find($operatorMeetingIdClient);
if (is_null($entOperatorMeeting) || !$user->isAdmin()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entOperator = $em->getRepository('App:EntOperator')->find($entOperatorMeeting->getOperatorId());
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entOperatorMeeting->setReport($operatorMeetingReportClient);
$em->persist($entOperatorMeeting);
$em->flush();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_OPERATOR_MEETINGS, ServiceData::ACTION_EDIT, $entOperatorMeeting->clientMapper($em, true));
return Reply::getResponse($entOperator->clientMapper($em, true), Message::SUCCESS_OPERATOR_MEETING_REPORT_SET, 0, $serviceData);
}
}

+ 0
- 62
httpdocs/symfony/src/Controller/OperatorViewController.php 查看文件

@@ -1,62 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntOperator;
use App\Entity\EntOperatorContact;
use App\Entity\EntOperatorMeeting;
use App\Utils\Message;
use App\Utils\Reply;
use App\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class OperatorViewController
* @package App\Controller
* @IsGranted("ROLE_USER")
*/
class OperatorViewController extends AbstractController
{
/**
* @Route("/get-operator-data", name="get_operator_data")
*/
public function getOperatorData()
{
$em = $this->getDoctrine()->getManager();
return Reply::getResponse(
[
'operators' => Utils::clientMap($em, $em->getRepository(EntOperator::class)->findAll()),
'operatorContacts' => Utils::clientMap($em, $em->getRepository(EntOperatorContact::class)->findAll()),
'operatorMeetings' => Utils::clientMap($em, $em->getRepository(EntOperatorMeeting::class)->findAll()),
]
);
}

/**
* @Route("/get-operator-full", name="get_operator_full")
* @param Request $request
* @return JsonResponse
*/
public function getOperatorFull(Request $request)
{
$operatorId = json_decode($request->request->get('operatorId'));
$em = $this->getDoctrine()->getManager();
/** @var EntOperator $entOperator */
$entOperator = $em->getRepository(EntOperator::class)->find($operatorId);
if (is_null($entOperator)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

return Reply::getResponse($entOperator->clientMapper($em, true));
}

}

+ 0
- 256
httpdocs/symfony/src/Controller/ProductionEditController.php 查看文件

@@ -1,256 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntProduction;
use App\Entity\EntProductionContact;
use App\Entity\EntProductionNote;
use App\Entity\EntUser;
use App\EntityVirtual\ServiceData;
use App\Utils\Message;
use App\Utils\Reply;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class ProductionEditController
* @package App\Controller
* @IsGranted({"ROLE_PRODUCTION", "ROLE_TECHNIQUE", "ROLE_SERVICE", "ROLE_ADMIN"})
*/
class ProductionEditController extends AbstractController
{
/**
* @Route("/create-production", name="create_production")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createProduction(Request $request)
{
$productionClient = json_decode($request->request->get('production'));
$em = $this->getDoctrine()->getManager();
$entProduction = new EntProduction($em, $productionClient->name);
$entProduction->setClientData($em, $productionClient);
$em->persist($entProduction);
$em->flush();

$fullMappedProduction = $entProduction->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTIONS, ServiceData::ACTION_ADD, $fullMappedProduction);
return Reply::getResponse($fullMappedProduction, Message::SUCCESS_PRODUCTION_CREATE, 0, $serviceData);
}


/**
* @Route("/edit-production", name="edit_production")
* @param Request $request
* @return JsonResponse
*/
public function editProduction(Request $request)
{
$productionClient = json_decode($request->request->get('production'));
$em = $this->getDoctrine()->getManager();
$entProduction = $em->getRepository(EntProduction::class)->find($productionClient->id);
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$entProduction->setClientData($em, $productionClient);
$em->persist($entProduction);
$em->flush();

$fullMappedProduction = $entProduction->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTIONS, ServiceData::ACTION_EDIT, $fullMappedProduction);
return Reply::getResponse($fullMappedProduction, Message::SUCCESS_PRODUCTION_EDIT, 0, $serviceData);
}

/**
* @Route("/create-production-contact", name="create_production_contact")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createProductionContact(Request $request)
{
$productionContactClient = json_decode($request->request->get('productionContact'));
$em = $this->getDoctrine()->getManager();
/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($productionContactClient->production_id);
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entProductionContact = new EntProductionContact($em, $entProduction, $productionContactClient->lastname);
$entProductionContact->setClientData($em, $productionContactClient);
$em->persist($entProductionContact);
$em->flush();

$fullMappedProductionContact = $entProductionContact->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_CONTACTS, ServiceData::ACTION_ADD, $fullMappedProductionContact);
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_CONTACT_CREATE, 0, $serviceData);
}

/**
* @Route("/edit-production-contact", name="edit_production_contact")
* @param Request $request
* @return JsonResponse
*/
public function editProductionContact(Request $request)
{
$productionContactClient = json_decode($request->request->get('productionContact'));
$em = $this->getDoctrine()->getManager();
/** @var EntProductionContact $entProductionContact */
$entProductionContact = $em->getRepository(EntProductionContact::class)->find($productionContactClient->id);
if (is_null($entProductionContact)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($entProductionContact->getProductionId());
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entProductionContact->setClientData($em, $productionContactClient);
$em->persist($entProductionContact);
$em->flush();

$fullMappedProductionContact = $entProductionContact->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_CONTACTS, ServiceData::ACTION_EDIT, $fullMappedProductionContact);
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_CONTACT_EDIT, 0, $serviceData);
}

/**
* @Route("/delete-production-contact", name="delete_production_contact")
* @param Request $request
* @return JsonResponse
*/
public function deleteProductionContact(Request $request)
{
$productionContactIdClient = json_decode($request->request->get('productionContactId'));
$em = $this->getDoctrine()->getManager();
/** @var EntProductionContact $entProductionContact */
$entProductionContact = $em->getRepository(EntProductionContact::class)->find($productionContactIdClient);
if (is_null($entProductionContact)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($entProductionContact->getProductionId());
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$fullMappedProductionContact = $entProductionContact->clientMapper($em, true);
$em->remove($entProductionContact);
$em->flush();

$sql = "UPDATE `production_meeting` SET `production_contact_id` = NULL WHERE `production_contact_id` = ". $productionContactIdClient;
$statement = $em->getConnection()->prepare($sql);
$statement->execute();

$sql = "UPDATE `production_note` SET `production_contact_id` = NULL WHERE `production_contact_id` = ". $productionContactIdClient;
$statement = $em->getConnection()->prepare($sql);
$statement->execute();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_CONTACTS, ServiceData::ACTION_DELETE, $fullMappedProductionContact);
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_CONTACT_DELETE, 0, $serviceData);
}

/**
* @Route("/create-production-note", name="create_production_note")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createProductionNote(Request $request)
{
$productionNoteClient = json_decode($request->request->get('productionNote'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($productionNoteClient->production_id);
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entProductionNote = new EntProductionNote($em, $entProduction, $user, $productionNoteClient->title);
$entProductionNote->setClientData($em, $productionNoteClient);
$em->persist($entProductionNote);
$em->flush();

return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_NOTE_CREATE);
}

/**
* @Route("/edit-production-note", name="edit_production_note")
* @param Request $request
* @return JsonResponse
*/
public function editProductionNote(Request $request)
{
$productionNoteClient = json_decode($request->request->get('productionNote'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntProductionNote $entProductionNote */
$entProductionNote = $em->getRepository(EntProductionNote::class)->find($productionNoteClient->id);
if (is_null($entProductionNote) || $entProductionNote->getCreationUserId() != $user->getId()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($entProductionNote->getProductionId());
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entProductionNote->setClientData($em, $productionNoteClient);
$em->persist($entProductionNote);
$em->flush();

return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_NOTE_EDIT);
}

/**
* @Route("/delete-production-note", name="delete_production_note")
* @param Request $request
* @return JsonResponse
*/
public function deleteProductionNote(Request $request)
{
$productionNoteIdClient = json_decode($request->request->get('productionNoteId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntProductionNote $entProductionNote */
$entProductionNote = $em->getRepository(EntProductionNote::class)->find($productionNoteIdClient);
$bHasRightsToDelete = $entProductionNote->getCreationUserId() == $user->getId() || $user->isAdmin();
if (is_null($entProductionNote) || !$bHasRightsToDelete) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($entProductionNote->getProductionId());
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$em->remove($entProductionNote);
$em->flush();

return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_NOTE_DELETE);
}
}

+ 0
- 314
httpdocs/symfony/src/Controller/ProductionMeetingEditController.php 查看文件

@@ -1,314 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntMeetingType;
use App\Entity\EntProduction;
use App\Entity\EntProductionMeeting;
use App\Entity\EntProductionMeetingParticipant;
use App\Entity\EntUser;
use App\EntityVirtual\ServiceData;
use App\Utils\Message;
use App\Utils\Reply;
use App\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class MeetingEditController
* @package App\Controller
* @IsGranted({"ROLE_ADMIN", "ROLE_TECHNIQUE", "ROLE_PRODUCTION", "ROLE_SERVICE"})
*/
class ProductionMeetingEditController extends AbstractController
{
/**
* @Route("/create-production-meeting", name="create_production_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createProductionMeeting(Request $request)
{
$productionMeetingClient = json_decode($request->request->get('productionMeeting'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($productionMeetingClient->production_id);
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntUser $entOwnerUser */
$entOwnerUser = $em->getRepository(EntUser::class)->find($productionMeetingClient->owner_user_id);
if (is_null($entOwnerUser)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntMeetingType $entMeetingType */
$entMeetingType = $em->getRepository(EntMeetingType::class)->find($productionMeetingClient->meeting_type_id);
if (is_null($entMeetingType)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

// Database manipulation in transaction
$dbCon = $this->getDoctrine()->getConnection();
$dbCon->beginTransaction();

try {
/** @var EntProductionMeeting $entProductionMeeting */
$entProductionMeeting = new EntProductionMeeting($em, $entProduction, $user, $entOwnerUser, $entMeetingType,
$productionMeetingClient->title, $productionMeetingClient->start_date, $productionMeetingClient->end_date);
$entProductionMeeting->setClientData($em, $productionMeetingClient);
$em->persist($entProductionMeeting);
$em->flush();
$cntParticipants = count($productionMeetingClient->v_participants);
for ($i = 0; $i < $cntParticipants; $i++) {
/** @var EntUser $participantUser */
$participantUser = $em->getRepository(EntUser::class)->find($productionMeetingClient->v_participants[$i]->participant_user_id);
if (is_null($participantUser)) {
throw new Exception('invalid participant user');
}

/** @var EntProductionMeetingParticipant $entParticipant */
$entParticipant = new EntProductionMeetingParticipant($em, $entProductionMeeting, $participantUser);
$em->persist($entParticipant);
}
$em->flush();

} catch (Exception $e) {
return Reply::getErrorResponse(Message::ERROR_INVALID_DATA);
}
// All data stored correctly
$dbCon->commit();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_MEETINGS, ServiceData::ACTION_ADD, $entProductionMeeting->clientMapper($em, true));
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_MEETING_CREATE, 0, $serviceData);
}

/**
* @Route("/edit-production-meeting", name="edit_production_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function editProductionMeeting(Request $request)
{
$productionMeetingClient = json_decode($request->request->get('productionMeeting'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($productionMeetingClient->production_id);
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntUser $entOwnerUser */
$entOwnerUser = $em->getRepository(EntUser::class)->find($productionMeetingClient->owner_user_id);
if (is_null($entOwnerUser)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntMeetingType $entMeetingType */
$entMeetingType = $em->getRepository(EntMeetingType::class)->find($productionMeetingClient->meeting_type_id);
if (is_null($entMeetingType)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntProductionMeeting $entProductionMeeting */
$entProductionMeeting = $em->getRepository(EntProductionMeeting::class)->find($productionMeetingClient->id);
if (is_null($entProductionMeeting)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

$bHasRightsToEdit =
$entProductionMeeting->getCreationUserId() === $user->getId() ||
$entProductionMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

if (!$entProductionMeeting->isEditDeletable()) {
return Reply::getErrorResponse(Message::ERROR_MEETING_NOT_EDIT_DELETABLE);
}

// Database manipulation in transaction
$dbCon = $this->getDoctrine()->getConnection();
$dbCon->beginTransaction();

try {
$entProductionMeeting->setClientData($em, $productionMeetingClient);
$em->persist($entProductionMeeting);
$em->flush();

$formerParticipantsByUserId = Utils::getSortedObjects('getParticipantUserId',
$em->getRepository(EntProductionMeetingParticipant::class)->findBy(['production_meeting_id' => $entProductionMeeting->getId()]));
$pUserIdsToKeep = [];
$cntParticipants = count($productionMeetingClient->v_participants);
for ($i = 0; $i < $cntParticipants; $i++) {
if (!array_key_exists($productionMeetingClient->v_participants[$i]->participant_user_id, $formerParticipantsByUserId)) {
/** @var EntUser $participantUser */
$participantUser = $em->getRepository(EntUser::class)->find($productionMeetingClient->v_participants[$i]->participant_user_id);
if (is_null($participantUser)) {
throw new Exception('invalid participant user');
}

/** @var EntProductionMeetingParticipant $entParticipant */
$entParticipant = new EntProductionMeetingParticipant($em, $entProductionMeeting, $participantUser);
$em->persist($entParticipant);
} else {
$pUserIdsToKeep[$productionMeetingClient->v_participants[$i]->participant_user_id] = 1;
}
}

/** @var EntProductionMeetingParticipant $formerParticipant */
foreach ($formerParticipantsByUserId as $pUserId => $formerParticipant) {
if (!array_key_exists($pUserId, $pUserIdsToKeep)) {
$em->remove($formerParticipant);
}
}
$em->flush();

} catch (Exception $e) {
return Reply::getErrorResponse(Message::ERROR_INVALID_DATA);
}
// All data stored correctly
$dbCon->commit();
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_MEETINGS, ServiceData::ACTION_EDIT, $entProductionMeeting->clientMapper($em, true));
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_MEETING_EDIT, 0, $serviceData);
}

/**
* @Route("/delete-production-meeting", name="delete_production_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function deleteProductionMeeting(Request $request)
{
$productionMeetingIdClient = json_decode($request->request->get('productionMeetingId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntProductionMeeting $entProductionMeeting */
$entProductionMeeting = $em->getRepository(EntProductionMeeting::class)->find($productionMeetingIdClient);
if (is_null($entProductionMeeting)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

$bHasRightsToEdit =
$entProductionMeeting->getCreationUserId() === $user->getId() ||
$entProductionMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

if (!$entProductionMeeting->isEditDeletable()) {
return Reply::getErrorResponse(Message::ERROR_MEETING_NOT_EDIT_DELETABLE);
}

/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($entProductionMeeting->getProductionId());
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$mappedProductionMeeting = $entProductionMeeting->clientMapper($em, true);
$em->remove($entProductionMeeting);

$participants = $em->getRepository(EntProductionMeetingParticipant::class)->findBy(['production_meeting_id' => $entProductionMeeting->getId()]);
/** @var EntProductionMeetingParticipant $participant */
foreach ($participants as $participant) {
$em->remove($participant);
}
$em->flush();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_MEETINGS, ServiceData::ACTION_DELETE, $mappedProductionMeeting);
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_MEETING_DELETE, 0, $serviceData);
}

/**
* @Route("/check-production-meeting-report", name="check_production_meeting_report")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function checkProductionMeetingReport(Request $request)
{
$productionMeetingIdClient = json_decode($request->request->get('productionMeetingId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntProductionMeeting $entProductionMeeting */
$entProductionMeeting = $em->getRepository(EntProductionMeeting::class)->find($productionMeetingIdClient);
if (is_null($entProductionMeeting)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$bHasRightsToEdit =
$entProductionMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

$check = new \DateTime() > $entProductionMeeting->getStartDate();
return $check ? Reply::getResponse($check) : Reply::getErrorResponse(Message::ERROR_REPORT_NOT_EDITABLE_YET);
}

/**
* @Route("/edit-production-meeting-report", name="edit_production_meeting_report")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function editProductionMeetingReport(Request $request)
{
/** @var EntUser $user */
$user = $this->getUser();
$productionMeetingIdClient = json_decode($request->request->get('productionMeetingId'));
$productionMeetingReportClient = json_decode($request->request->get('productionMeetingReport'));
$em = $this->getDoctrine()->getManager();

/** @var EntProductionMeeting $entProductionMeeting */
$entProductionMeeting = $em->getRepository(EntProductionMeeting::class)->find($productionMeetingIdClient);
if (is_null($entProductionMeeting)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$bHasRightsToEdit =
$entProductionMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

$entProduction = $em->getRepository(EntProduction::class)->find($entProductionMeeting->getProductionId());
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entProductionMeeting->setReport($productionMeetingReportClient);
$em->persist($entProductionMeeting);
$em->flush();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_PRODUCTION_MEETINGS, ServiceData::ACTION_EDIT, $entProductionMeeting->clientMapper($em, true));
return Reply::getResponse($entProduction->clientMapper($em, true), Message::SUCCESS_PRODUCTION_MEETING_REPORT_SET, 0, $serviceData);
}
}

+ 0
- 62
httpdocs/symfony/src/Controller/ProductionViewController.php 查看文件

@@ -1,62 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntProduction;
use App\Entity\EntProductionContact;
use App\Entity\EntProductionMeeting;
use App\Utils\Message;
use App\Utils\Reply;
use App\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class ProductionViewController
* @package App\Controller
* @IsGranted("ROLE_USER")
*/
class ProductionViewController extends AbstractController
{
/**
* @Route("/get-production-data", name="get_production_data")
*/
public function getProductionData()
{
$em = $this->getDoctrine()->getManager();
return Reply::getResponse(
[
'productions' => Utils::clientMap($em, $em->getRepository(EntProduction::class)->findAll()),
'productionContacts' => Utils::clientMap($em, $em->getRepository(EntProductionContact::class)->findAll()),
'productionMeetings' => Utils::clientMap($em, $em->getRepository(EntProductionMeeting::class)->findAll()),
]
);
}

/**
* @Route("/get-production-full", name="get_production_full")
* @param Request $request
* @return JsonResponse
*/
public function getProductionFull(Request $request)
{
$productionId = json_decode($request->request->get('productionId'));
$em = $this->getDoctrine()->getManager();
/** @var EntProduction $entProduction */
$entProduction = $em->getRepository(EntProduction::class)->find($productionId);
if (is_null($entProduction)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

return Reply::getResponse($entProduction->clientMapper($em, true));
}

}

+ 14
- 0
httpdocs/symfony/src/Controller/PublicController.php 查看文件

@@ -10,6 +10,7 @@ namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class PublicController extends AbstractController
@@ -26,6 +27,19 @@ class PublicController extends AbstractController
return new JsonResponse($data);
}

/**
* @Route("/test", name="test")
*/
public function showTestAction()
{
$data = array(
// you might translate this message
'message' => 'PHP api'
);
//return 1;
return new Response('<html><body>Debug data</body></html>');
}

/**
* Login
* @Route("/login", name="login")


+ 0
- 256
httpdocs/symfony/src/Controller/ServiceEditController.php 查看文件

@@ -1,256 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntService;
use App\Entity\EntServiceContact;
use App\Entity\EntServiceNote;
use App\Entity\EntUser;
use App\EntityVirtual\ServiceData;
use App\Utils\Message;
use App\Utils\Reply;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class ServiceEditController
* @package App\Controller
* @IsGranted({"ROLE_PRODUCTION", "ROLE_TECHNIQUE", "ROLE_SERVICE", "ROLE_ADMIN"})
*/
class ServiceEditController extends AbstractController
{
/**
* @Route("/create-service", name="create_service")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createService(Request $request)
{
$serviceClient = json_decode($request->request->get('service'));
$em = $this->getDoctrine()->getManager();
$entService = new EntService($em, $serviceClient->name);
$entService->setClientData($em, $serviceClient);
$em->persist($entService);
$em->flush();

$fullMappedService = $entService->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES, ServiceData::ACTION_ADD, $fullMappedService);
return Reply::getResponse($fullMappedService, Message::SUCCESS_SERVICE_CREATE, 0, $serviceData);
}


/**
* @Route("/edit-service", name="edit_service")
* @param Request $request
* @return JsonResponse
*/
public function editService(Request $request)
{
$serviceClient = json_decode($request->request->get('service'));
$em = $this->getDoctrine()->getManager();
$entService = $em->getRepository(EntService::class)->find($serviceClient->id);
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$entService->setClientData($em, $serviceClient);
$em->persist($entService);
$em->flush();

$fullMappedService = $entService->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES, ServiceData::ACTION_EDIT, $fullMappedService);
return Reply::getResponse($fullMappedService, Message::SUCCESS_SERVICE_EDIT, 0, $serviceData);
}

/**
* @Route("/create-service-contact", name="create_service_contact")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createServiceContact(Request $request)
{
$serviceContactClient = json_decode($request->request->get('serviceContact'));
$em = $this->getDoctrine()->getManager();
/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($serviceContactClient->service_id);
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entServiceContact = new EntServiceContact($em, $entService, $serviceContactClient->lastname);
$entServiceContact->setClientData($em, $serviceContactClient);
$em->persist($entServiceContact);
$em->flush();

$fullMappedServiceContact = $entServiceContact->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_CONTACTS, ServiceData::ACTION_ADD, $fullMappedServiceContact);
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_CONTACT_CREATE, 0, $serviceData);
}

/**
* @Route("/edit-service-contact", name="edit_service_contact")
* @param Request $request
* @return JsonResponse
*/
public function editServiceContact(Request $request)
{
$serviceContactClient = json_decode($request->request->get('serviceContact'));
$em = $this->getDoctrine()->getManager();
/** @var EntServiceContact $entServiceContact */
$entServiceContact = $em->getRepository(EntServiceContact::class)->find($serviceContactClient->id);
if (is_null($entServiceContact)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($entServiceContact->getServiceId());
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entServiceContact->setClientData($em, $serviceContactClient);
$em->persist($entServiceContact);
$em->flush();

$fullMappedServiceContact = $entServiceContact->clientMapper($em, true);
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_CONTACTS, ServiceData::ACTION_EDIT, $fullMappedServiceContact);
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_CONTACT_EDIT, 0, $serviceData);
}

/**
* @Route("/delete-service-contact", name="delete_service_contact")
* @param Request $request
* @return JsonResponse
*/
public function deleteServiceContact(Request $request)
{
$serviceContactIdClient = json_decode($request->request->get('serviceContactId'));
$em = $this->getDoctrine()->getManager();
/** @var EntServiceContact $entServiceContact */
$entServiceContact = $em->getRepository(EntServiceContact::class)->find($serviceContactIdClient);
if (is_null($entServiceContact)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($entServiceContact->getServiceId());
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$fullMappedServiceContact = $entServiceContact->clientMapper($em, true);
$em->remove($entServiceContact);
$em->flush();

$sql = "UPDATE `service_meeting` SET `service_contact_id` = NULL WHERE `service_contact_id` = ". $serviceContactIdClient;
$statement = $em->getConnection()->prepare($sql);
$statement->execute();

$sql = "UPDATE `service_note` SET `service_contact_id` = NULL WHERE `service_contact_id` = ". $serviceContactIdClient;
$statement = $em->getConnection()->prepare($sql);
$statement->execute();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_CONTACTS, ServiceData::ACTION_DELETE, $fullMappedServiceContact);
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_CONTACT_DELETE, 0, $serviceData);
}

/**
* @Route("/create-service-note", name="create_service_note")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createServiceNote(Request $request)
{
$serviceNoteClient = json_decode($request->request->get('serviceNote'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($serviceNoteClient->service_id);
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entServiceNote = new EntServiceNote($em, $entService, $user, $serviceNoteClient->title);
$entServiceNote->setClientData($em, $serviceNoteClient);
$em->persist($entServiceNote);
$em->flush();

return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_NOTE_CREATE);
}

/**
* @Route("/edit-service-note", name="edit_service_note")
* @param Request $request
* @return JsonResponse
*/
public function editServiceNote(Request $request)
{
$serviceNoteClient = json_decode($request->request->get('serviceNote'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntServiceNote $entServiceNote */
$entServiceNote = $em->getRepository(EntServiceNote::class)->find($serviceNoteClient->id);
if (is_null($entServiceNote) || $entServiceNote->getCreationUserId() != $user->getId()) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($entServiceNote->getServiceId());
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entServiceNote->setClientData($em, $serviceNoteClient);
$em->persist($entServiceNote);
$em->flush();

return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_NOTE_EDIT);
}

/**
* @Route("/delete-service-note", name="delete_service_note")
* @param Request $request
* @return JsonResponse
*/
public function deleteServiceNote(Request $request)
{
$serviceNoteIdClient = json_decode($request->request->get('serviceNoteId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntServiceNote $entServiceNote */
$entServiceNote = $em->getRepository(EntServiceNote::class)->find($serviceNoteIdClient);
$bHasRightsToDelete = $entServiceNote->getCreationUserId() == $user->getId() || $user->isAdmin();
if (is_null($entServiceNote) || !$bHasRightsToDelete) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($entServiceNote->getServiceId());
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$em->remove($entServiceNote);
$em->flush();

return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_NOTE_DELETE);
}
}

+ 0
- 316
httpdocs/symfony/src/Controller/ServiceMeetingEditController.php 查看文件

@@ -1,316 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntMeetingType;
use App\Entity\EntProduction;
use App\Entity\EntService;
use App\Entity\EntServiceMeeting;
use App\Entity\EntServiceMeetingParticipant;
use App\Entity\EntUser;
use App\EntityVirtual\ServiceData;
use App\Utils\Message;
use App\Utils\Reply;
use App\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class MeetingEditController
* @package App\Controller
* @IsGranted({"ROLE_ADMIN", "ROLE_TECHNIQUE", "ROLE_PRODUCTION", "ROLE_SERVICE"})
*/
class ServiceMeetingEditController extends AbstractController
{
/**
* @Route("/create-service-meeting", name="create_service_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function createServiceMeeting(Request $request)
{
$serviceMeetingClient = json_decode($request->request->get('serviceMeeting'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($serviceMeetingClient->service_id);
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntUser $entOwnerUser */
$entOwnerUser = $em->getRepository(EntUser::class)->find($serviceMeetingClient->owner_user_id);
if (is_null($entOwnerUser)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntMeetingType $entMeetingType */
$entMeetingType = $em->getRepository(EntMeetingType::class)->find($serviceMeetingClient->meeting_type_id);
if (is_null($entMeetingType)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

// Database manipulation in transaction
$dbCon = $this->getDoctrine()->getConnection();
$dbCon->beginTransaction();

try {
/** @var EntServiceMeeting $entServiceMeeting */
$entServiceMeeting = new EntServiceMeeting($em, $entService, $user, $entOwnerUser, $entMeetingType,
$serviceMeetingClient->title, $serviceMeetingClient->start_date, $serviceMeetingClient->end_date);
$entServiceMeeting->setClientData($em, $serviceMeetingClient);
$em->persist($entServiceMeeting);
$em->flush();
$cntParticipants = count($serviceMeetingClient->v_participants);
for ($i = 0; $i < $cntParticipants; $i++) {
/** @var EntUser $participantUser */
$participantUser = $em->getRepository(EntUser::class)->find($serviceMeetingClient->v_participants[$i]->participant_user_id);
if (is_null($participantUser)) {
throw new Exception('invalid participant user');
}

/** @var EntServiceMeetingParticipant $entParticipant */
$entParticipant = new EntServiceMeetingParticipant($em, $entServiceMeeting, $participantUser);
$em->persist($entParticipant);
}
$em->flush();

} catch (Exception $e) {
return Reply::getErrorResponse(Message::ERROR_INVALID_DATA);
}
// All data stored correctly
$dbCon->commit();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_MEETINGS, ServiceData::ACTION_ADD, $entServiceMeeting->clientMapper($em, true));
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_MEETING_CREATE, 0, $serviceData);
}

/**
* @Route("/edit-service-meeting", name="edit_service_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function editServiceMeeting(Request $request)
{
$serviceMeetingClient = json_decode($request->request->get('serviceMeeting'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();
/** @var EntProduction $entService */
$entService = $em->getRepository(EntService::class)->find($serviceMeetingClient->service_id);
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntUser $entOwnerUser */
$entOwnerUser = $em->getRepository(EntUser::class)->find($serviceMeetingClient->owner_user_id);
if (is_null($entOwnerUser)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntMeetingType $entMeetingType */
$entMeetingType = $em->getRepository(EntMeetingType::class)->find($serviceMeetingClient->meeting_type_id);
if (is_null($entMeetingType)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

/** @var EntServiceMeeting $entServiceMeeting */
$entServiceMeeting = $em->getRepository(EntServiceMeeting::class)->find($serviceMeetingClient->id);
if (is_null($entServiceMeeting)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

$bHasRightsToEdit =
$entServiceMeeting->getCreationUserId() === $user->getId() ||
$entServiceMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

if (!$entServiceMeeting->isEditDeletable()) {
return Reply::getErrorResponse(Message::ERROR_MEETING_NOT_EDIT_DELETABLE);
}

// Database manipulation in transaction
$dbCon = $this->getDoctrine()->getConnection();
$dbCon->beginTransaction();

try {
$entServiceMeeting->setClientData($em, $serviceMeetingClient);
$em->persist($entServiceMeeting);
$em->flush();

$formerParticipantsByUserId = Utils::getSortedObjects('getParticipantUserId',
$em->getRepository(EntServiceMeetingParticipant::class)->findBy(['service_meeting_id' => $entServiceMeeting->getId()]));
$pUserIdsToKeep = [];
$cntParticipants = count($serviceMeetingClient->v_participants);
for ($i = 0; $i < $cntParticipants; $i++) {
if (!array_key_exists($serviceMeetingClient->v_participants[$i]->participant_user_id, $formerParticipantsByUserId)) {
/** @var EntUser $participantUser */
$participantUser = $em->getRepository(EntUser::class)->find($serviceMeetingClient->v_participants[$i]->participant_user_id);
if (is_null($participantUser)) {
throw new Exception('invalid participant user');
}

/** @var EntServiceMeetingParticipant $entParticipant */
$entParticipant = new EntServiceMeetingParticipant($em, $entServiceMeeting, $participantUser);
$em->persist($entParticipant);
} else {
$pUserIdsToKeep[$serviceMeetingClient->v_participants[$i]->participant_user_id] = 1;
}
}

/** @var EntServiceMeetingParticipant $formerParticipant */
foreach ($formerParticipantsByUserId as $pUserId => $formerParticipant) {
if (!array_key_exists($pUserId, $pUserIdsToKeep)) {
$em->remove($formerParticipant);
}
}
$em->flush();

} catch (Exception $e) {
return Reply::getErrorResponse(Message::ERROR_INVALID_DATA);
}
// All data stored correctly
$dbCon->commit();
$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_MEETINGS, ServiceData::ACTION_EDIT, $entServiceMeeting->clientMapper($em, true));
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_MEETING_EDIT, 0, $serviceData);
}

/**
* @Route("/delete-service-meeting", name="delete_service_meeting")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function deleteServiceMeeting(Request $request)
{
$serviceMeetingIdClient = json_decode($request->request->get('serviceMeetingId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntServiceMeeting $entServiceMeeting */
$entServiceMeeting = $em->getRepository(EntServiceMeeting::class)->find($serviceMeetingIdClient);
if (is_null($entServiceMeeting)) {
return Reply::getErrorResponse(Message::ERROR_NON_EXISTING_DATA);
}

if (!$entServiceMeeting->isEditDeletable()) {
return Reply::getErrorResponse(Message::ERROR_MEETING_NOT_EDIT_DELETABLE);
}

$bHasRightsToEdit =
$entServiceMeeting->getCreationUserId() === $user->getId() ||
$entServiceMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($entServiceMeeting->getServiceId());
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}
$mappedServiceMeeting = $entServiceMeeting->clientMapper($em, true);
$em->remove($entServiceMeeting);

$participants = $em->getRepository(EntServiceMeetingParticipant::class)->findBy(['service_meeting_id' => $entServiceMeeting->getId()]);
/** @var EntServiceMeetingParticipant $participant */
foreach ($participants as $participant) {
$em->remove($participant);
}
$em->flush();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_MEETINGS, ServiceData::ACTION_DELETE, $mappedServiceMeeting);
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_MEETING_DELETE, 0, $serviceData);
}

/**
* @Route("/check-service-meeting-report", name="check_service_meeting_report")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function checkServiceMeetingReport(Request $request)
{
$serviceMeetingIdClient = json_decode($request->request->get('serviceMeetingId'));
$em = $this->getDoctrine()->getManager();
/** @var EntUser $user */
$user = $this->getUser();

/** @var EntServiceMeeting $entServiceMeeting */
$entServiceMeeting = $em->getRepository(EntServiceMeeting::class)->find($serviceMeetingIdClient);
if (is_null($entServiceMeeting)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$bHasRightsToEdit =
$entServiceMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

$check = new \DateTime() > $entServiceMeeting->getStartDate();
return $check ? Reply::getResponse($check) : Reply::getErrorResponse(Message::ERROR_REPORT_NOT_EDITABLE_YET);
}

/**
* @Route("/edit-service-meeting-report", name="edit_service_meeting_report")
* @param Request $request
* @return JsonResponse
* @throws \Exception
*/
public function editServiceMeetingReport(Request $request)
{
/** @var EntUser $user */
$user = $this->getUser();
$serviceMeetingIdClient = json_decode($request->request->get('serviceMeetingId'));
$serviceMeetingReportClient = json_decode($request->request->get('serviceMeetingReport'));
$em = $this->getDoctrine()->getManager();

/** @var EntServiceMeeting $entServiceMeeting */
$entServiceMeeting = $em->getRepository(EntServiceMeeting::class)->find($serviceMeetingIdClient);
if (is_null($entServiceMeeting)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$entService = $em->getRepository(EntService::class)->find($entServiceMeeting->getServiceId());
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

$bHasRightsToEdit =
$entServiceMeeting->getOwnerUserId() === $user->getId() ||
$user->isAdmin();
if (!$bHasRightsToEdit) {
return Reply::getErrorResponse(Message::ERROR_NOT_ENOUGH_RIGHTS);
}

$entServiceMeeting->setReport($serviceMeetingReportClient);
$em->persist($entServiceMeeting);
$em->flush();

$serviceData = new ServiceData();
$serviceData->addServiceData(ServiceData::SERVICE_DATA_TYPE_SERVICES_MEETINGS, ServiceData::ACTION_EDIT, $entServiceMeeting->clientMapper($em, true));
return Reply::getResponse($entService->clientMapper($em, true), Message::SUCCESS_SERVICE_MEETING_REPORT_SET, 0, $serviceData);
}
}

+ 0
- 62
httpdocs/symfony/src/Controller/ServiceViewController.php 查看文件

@@ -1,62 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: danielknudsen
* Date: 05.04.18
* Time: 13:09
*/
namespace App\Controller;

use App\Entity\EntService;
use App\Entity\EntServiceContact;
use App\Entity\EntServiceMeeting;
use App\Utils\Message;
use App\Utils\Reply;
use App\Utils\Utils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* Class ServiceViewController
* @package App\Controller
* @IsGranted("ROLE_USER")
*/
class ServiceViewController extends AbstractController
{
/**
* @Route("/get-service-data", name="get_service_data")
*/
public function getServiceData()
{
$em = $this->getDoctrine()->getManager();
return Reply::getResponse(
[
'services' => Utils::clientMap($em, $em->getRepository(EntService::class)->findAll()),
'serviceContacts' => Utils::clientMap($em, $em->getRepository(EntServiceContact::class)->findAll()),
'serviceMeetings' => Utils::clientMap($em, $em->getRepository(EntServiceMeeting::class)->findAll()),
]
);
}

/**
* @Route("/get-service-full", name="get_service_full")
* @param Request $request
* @return JsonResponse
*/
public function getServiceFull(Request $request)
{
$serviceId = json_decode($request->request->get('serviceId'));
$em = $this->getDoctrine()->getManager();
/** @var EntService $entService */
$entService = $em->getRepository(EntService::class)->find($serviceId);
if (is_null($entService)) {
return Reply::getErrorResponse(Message::ERROR_DEFAULT);
}

return Reply::getResponse($entService->clientMapper($em, true));
}

}

+ 0
- 535
httpdocs/symfony/src/Entity/EntOperator.php 查看文件

@@ -1,535 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="operator")
*/
class EntOperator implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $old_plp_id;

/**
* @ORM\Column(type="string",nullable=false)
*/
protected $name;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $name_additional;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $url;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $tax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_mode;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_comment;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_key;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $active;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;

/**
* EntOperator constructor.
* @param ObjectManager $em
* @param $name
* @throws \Exception
*/
public function __construct(ObjectManager $em, $name)
{
$this->name = $name;
$this->active = true;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOldPlpId()
{
return $this->old_plp_id;
}

/**
* @return mixed
*/
public function getName()
{
return $this->name;
}

/**
* @return mixed
*/
public function getNameAdditional()
{
return $this->name_additional;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getUrl()
{
return $this->url;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @return mixed
*/
public function getTaxNo()
{
return $this->tax_no;
}

/**
* @return mixed
*/
public function getInvoiceMode()
{
return $this->invoice_mode;
}

/**
* @return mixed
*/
public function getInvoiceComment()
{
return $this->invoice_comment;
}

/**
* @return mixed
*/
public function getInvoiceKey()
{
return $this->invoice_key;
}

/**
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}

/**
* @return \DateTime
*/
public function getCreationDate(): \DateTime
{
return $this->creation_date;
}

/**
* @param mixed $old_plp_id
*/
public function setOldPlpId($old_plp_id): void
{
$this->old_plp_id = $old_plp_id;
}

/**
* @param mixed $name
*/
public function setName($name): void
{
$this->name = $name;
}

/**
* @param mixed $name_short
*/
public function setNameShort($name_short): void
{
$this->name_short = $name_short;
}

/**
* @param mixed $name_addtional
*/
public function setNameAdditional($name_addtional): void
{
$this->name_addtional = $name_addtional;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param mixed $url
*/
public function setUrl($url): void
{
$this->url = $url;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @param mixed $tax_no
*/
public function setTaxNo($tax_no): void
{
$this->tax_no = $tax_no;
}

/**
* @param mixed $invoice_mode
*/
public function setInvoiceMode($invoice_mode): void
{
$this->invoice_mode = $invoice_mode;
}

/**
* @param mixed $invoice_comment
*/
public function setInvoiceComment($invoice_comment): void
{
$this->invoice_comment = $invoice_comment;
}

/**
* @param mixed $invoice_key
*/
public function setInvoiceKey($invoice_key): void
{
$this->invoice_key = $invoice_key;
}

/**
* @param bool $active
*/
public function setActive(bool $active): void
{
$this->active = $active;
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setName($clientData->name);
$this->setNameAdditional($clientData->name_additional);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setUrl($clientData->url);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setComment($clientData->comment);
$this->setTaxNo($clientData->tax_no);
$this->setInvoiceMode($clientData->invoice_mode);
$this->setInvoiceComment($clientData->invoice_comment);
$this->setInvoiceKey($clientData->invoice_key);
$this->setActive($clientData->active);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
$res = [
'id' => $this->id,
'old_plp_id' => $this->old_plp_id,
'name' => $this->name,
'name_additional' => $this->name_additional,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'url' => $this->url,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'comment' => $this->comment,
'tax_no' => $this->tax_no,
'invoice_mode' => $this->invoice_mode,
'invoice_comment' => $this->invoice_mode,
'invoice_key' => $this->invoice_mode,
'active' => $this->active,
'v_operator_contacts' => [],
'v_operator_notes' => [],
'v_operator_meetings' => [],
];

if ($fullMapping) {
$res['v_operator_contacts'] = Utils::clientMap($em, $em->getRepository(EntOperatorContact::class)->findBy(['operator_id' => $this->getId()]));
$res['v_operator_notes'] = Utils::clientMap($em, $em->getRepository(EntOperatorNote::class)->findBy(['operator_id' => $this->getId()]));
$res['v_operator_meetings'] = Utils::clientMap($em, $em->getRepository(EntOperatorMeeting::class)->findBy(['operator_id' => $this->getId()]));
}

return $res;
}

}

+ 0
- 472
httpdocs/symfony/src/Entity/EntOperatorContact.php 查看文件

@@ -1,472 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="operator_contact")
*/
class EntOperatorContact implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $operator_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="date", nullable=true)
*/
protected $date_of_birth;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $is_xmas_mail_recipient = false;


/**
* EntOperatorContact constructor.
* @param ObjectManager $em
* @param EntOperator $entOperator
* @param $lastName
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntOperator $entOperator, $lastName)
{
if (is_null($entOperator->getId())) {
throw new Exception('no id found');
}

$this->operator_id = $entOperator->getId();
$this->lastname = $lastName;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOperatorId()
{
return $this->operator_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getCreationDate()
{
return $this->creation_date;
}

/**
* @return mixed
*/
public function getDateOfBirth()
{
return $this->date_of_birth;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $date_of_birth
*/
public function setDateOfBirth($date_of_birth): void
{
$this->date_of_birth = !is_null($date_of_birth) ? \DateTime::createFromFormat('Y-m-d', $date_of_birth) : $date_of_birth;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @return bool
*/
public function isIsxmasMailRecipient(): bool
{
return $this->is_xmas_mail_recipient;
}

/**
* @param bool $is_xmas_mail_recipient
*/
public function setIsxmasMailRecipient(bool $is_xmas_mail_recipient): void
{
$this->is_xmas_mail_recipient = $is_xmas_mail_recipient;
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setDepartment($clientData->department);
$this->setDateOfBirth($clientData->date_of_birth);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setComment($clientData->comment);
$this->setIsxmasMailRecipient($clientData->is_xmas_mail_recipient);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'operator_id' => $this->operator_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'department' => $this->department,
'date_of_birth' => $this->date_of_birth,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'comment' => $this->comment,
'is_xmas_mail_recipient' => $this->is_xmas_mail_recipient,
];
}

}

+ 0
- 693
httpdocs/symfony/src/Entity/EntOperatorMeeting.php 查看文件

@@ -1,693 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="operator_meeting", indexes={@ORM\Index(name="search_operator_idx", columns={"operator_id", "owner_user_id", "operator_contact_id"})})
*/
class EntOperatorMeeting implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $operator_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $creation_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $owner_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $meeting_type_id;
/**
* @ORM\Column(type="string", nullable=false)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $start_date;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $end_date;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $operator_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $report;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $first_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $second_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $report_reminder_sent;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;


/**
* EntOperatorMeeting constructor.
* @param ObjectManager $em
* @param EntOperator $entOperator
* @param EntUser $entCreationUser
* @param EntUser $entOwnerUser
* @param EntMeetingType $entMeetingType
* @param $title
* @param $startDate
* @param $endDate
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntOperator $entOperator, EntUser $entCreationUser, EntUser $entOwnerUser,
EntMeetingType $entMeetingType, $title, $startDate, $endDate)
{
if (is_null($entOperator->getId())) {
throw new Exception('no id found');
}

if (is_null($entCreationUser->getId())) {
throw new Exception('no id found');
}

if (is_null($entOwnerUser->getId())) {
throw new Exception('no id found');
}

$meetingTypesById = EntMeetingType::getMeetingTypesById($em);
if (is_null($entMeetingType->getId()) || !array_key_exists($entMeetingType->getId(), $meetingTypesById)) {
throw new Exception('no id found');
}

$this->operator_id = $entOperator->getId();
$this->creation_user_id = $entCreationUser->getId();
$this->owner_user_id = $entOwnerUser->getId();
$this->meeting_type_id = $entMeetingType->getId();
$this->title = $title;
$this->setStartDate($startDate);
$this->setEndDate($endDate);
$this->first_reminder_sent = false;
$this->second_reminder_sent = false;
$this->report_reminder_sent = false;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOperatorId()
{
return $this->operator_id;
}

/**
* @return mixed
*/
public function getCreationUserId()
{
return $this->creation_user_id;
}

/**
* @return mixed
*/
public function getOwnerUserId()
{
return $this->owner_user_id;
}

/**
* @return mixed
*/
public function getMeetingTypeId()
{
return $this->meeting_type_id;
}

/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}

/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}

/**
* @return mixed
*/
public function getStartDate()
{
return $this->start_date;
}

/**
* @return mixed
*/
public function getEndDate()
{
return $this->end_date;
}

/**
* @return mixed
*/
public function getOperatorContactId()
{
return $this->operator_contact_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getReport()
{
return $this->report;
}

/**
* @return bool
*/
public function isFirstReminderSent(): bool
{
return $this->first_reminder_sent;
}

/**
* @return bool
*/
public function isSecondReminderSent(): bool
{
return $this->second_reminder_sent;
}

/**
* @param mixed $owner_user_id
*/
public function setOwnerUserId($owner_user_id): void
{
$this->owner_user_id = $owner_user_id;
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $meeting_type_id
*/
public function setMeetingTypeId($meeting_type_id): void
{
$this->meeting_type_id = $meeting_type_id;
}

/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}

/**
* @param mixed $description
*/
public function setDescription($description): void
{
$this->description = $description;
}

/**
* @param mixed $start_date
*/
public function setStartDate($start_date): void
{
$this->start_date = \DateTime::createFromFormat('Y-m-d H:i:s', $start_date);
}

/**
* @param mixed $end_date
*/
public function setEndDate($end_date): void
{
$this->end_date = \DateTime::createFromFormat('Y-m-d H:i:s', $end_date);
}

/**
* @param ObjectManager $em
* @param $operator_contact_id
*/
public function setOperatorContactId(ObjectManager $em, $operator_contact_id): void
{
if ($operator_contact_id == 0) {
$this->operator_contact_id = $operator_contact_id;
} else {
/** @var EntOperatorContact $entOperatorContact */
$entOperatorContact = $em->getRepository('App:EntOperatorContact')->find($operator_contact_id);
// NOTE: Check if contact still exists
$this->operator_contact_id = !is_null($entOperatorContact) ? $operator_contact_id : null;
}
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param $report
* @throws \Exception
*/
public function setReport($report): void
{
$now = new \DateTime();
if ($now < $this->getStartDate()) {
throw new Exception('meeting has not started yet');
}
$this->report = $report;
}

/**
* @param mixed $first_reminder_sent
*/
public function setFirstReminderSent($first_reminder_sent): void
{
$this->first_reminder_sent = $first_reminder_sent;
}

/**
* @param mixed $second_reminder_sent
*/
public function setSecondReminderSent($second_reminder_sent): void
{
$this->second_reminder_sent = $second_reminder_sent;
}

/**
* @param mixed $report_reminder_sent
*/
public function setReportReminderSent($report_reminder_sent): void
{
$this->report_reminder_sent = $report_reminder_sent;
}

/**
* Checks if meeting is editable or deletable
* @return bool
* @throws \Exception
*/
public function isEditDeletable()
{
$now = new \DateTime();
return $now < $this->getStartDate();
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setOwnerUserId($clientData->owner_user_id);
$this->setMeetingTypeId($clientData->meeting_type_id);
$this->setTitle($clientData->title);
$this->setDescription($clientData->description);
$this->setStartDate($clientData->start_date);
$this->setEndDate($clientData->end_date);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setOperatorContactId($em, $clientData->operator_contact_id);

if (is_null($this->operator_contact_id)) {
$this->setGender(null);
$this->setFirstname(null);
$this->setLastname(null);
$this->setEmail(null);
$this->setPhoneNo(null);
$this->setMobileNo(null);
$this->setDepartment(null);
} else {
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setDepartment($clientData->department);
}
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
* @throws \Exception
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
$now = new \DateTime();
return [
'id' => $this->id,
'operator_id' => (int)$this->operator_id,
'creation_user_id' => (int)$this->creation_user_id,
'owner_user_id' => (int)$this->owner_user_id,
'meeting_type_id' => (int)$this->meeting_type_id,
'title' => $this->title,
'description' => $this->description,
'start_date' => !is_null($this->start_date) ? $this->start_date->format('Y-m-d H:i:s'): null,
'end_date' => !is_null($this->end_date) ? $this->end_date->format('Y-m-d H:i:s'): null,
'operator_contact_id' => $this->operator_contact_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'department' => $this->department,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'report' => $this->report,
'first_reminder_sent' => $this->first_reminder_sent,
'second_reminder_sent' => $this->second_reminder_sent,
'report_reminder_sent' => $this->report_reminder_sent,
'creation_date' => !is_null($this->creation_date) ? $this->creation_date->format('Y-m-d H:i:s'): null,
'v_participants' => Utils::clientMap($em, $em->getRepository(EntOperatorMeetingParticipant::class)->findBy(['operator_meeting_id' => $this->id])),
'v_is_editable' => $now < $this->start_date,
];
}

}

+ 0
- 97
httpdocs/symfony/src/Entity/EntOperatorMeetingParticipant.php 查看文件

@@ -1,97 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="operator_meeting_participant",indexes={@ORM\Index(name="search_participant_idx", columns={"operator_meeting_id", "participant_user_id"})},
* uniqueConstraints={@UniqueConstraint(name="unique_participant", columns={"operator_meeting_id", "participant_user_id"})})
*/
class EntOperatorMeetingParticipant implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $operator_meeting_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $participant_user_id;


/**
* EntOperatorMeetingParticipant constructor.
* @param ObjectManager $em
* @param EntOperatorMeeting $entOperatorMeeting
* @param EntUser $entParticipantUser
*
*/
public function __construct(ObjectManager $em, EntOperatorMeeting $entOperatorMeeting, EntUser $entParticipantUser)
{
if (is_null($entOperatorMeeting->getId())) {
throw new Exception('no id found');
}

if (is_null($entParticipantUser->getId())) {
throw new Exception('no id found');
}

$this->operator_meeting_id = $entOperatorMeeting->getId();
$this->participant_user_id = $entParticipantUser->getId();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOperatorMeetingId()
{
return $this->operator_meeting_id;
}

/**
* @return mixed
*/
public function getParticipantUserId()
{
return $this->participant_user_id;
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'operator_meeting_id' => $this->operator_meeting_id,
'participant_user_id' => $this->participant_user_id,
];
}

}

+ 0
- 440
httpdocs/symfony/src/Entity/EntOperatorNote.php 查看文件

@@ -1,440 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="operator_note")
*/
class EntOperatorNote implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $operator_id;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $operator_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="date", nullable=false)
*/
protected $note_date;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $creation_user_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $creation_user_firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $creation_user_lastname;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;


/**
* EntOperatorNote constructor.
* @param ObjectManager $em
* @param EntOperator $entOperator
* @param EntUser $entUser
* @param $title
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntOperator $entOperator, EntUser $entUser, $title)
{
if (is_null($entOperator->getId())) {
throw new Exception('no id found');
}

if (is_null($entUser->getId())) {
throw new Exception('no id found');
}

$this->operator_id = $entOperator->getId();
$this->creation_user_id = $entUser->getId();
$this->creation_user_firstname = $entUser->getFirstname();
$this->creation_user_lastname = $entUser->getLastname();
$this->title = $title;
$this->note_date = new \DateTime();
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOperatorId()
{
return $this->operator_id;
}

/**
* @return mixed
*/
public function getCreationUserId()
{
return $this->creation_user_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @return mixed
*/
public function getNoteDate()
{
return $this->note_date;
}

/**
* @return mixed
*/
public function getCreationUserFirstname()
{
return $this->creation_user_firstname;
}

/**
* @return mixed
*/
public function getCreationUserLastname()
{
return $this->creation_user_lastname;
}

/**
* @return mixed
*/
public function getCreationDate()
{
return $this->creation_date;
}

/**
* @return mixed
*/
public function getOperatorContactId()
{
return $this->operator_contact_id;
}

/**
* @param ObjectManager $em
* @param $operator_contact_id
*/
public function setOperatorContactId(ObjectManager $em, $operator_contact_id): void
{
if ($operator_contact_id == 0) {
$this->operator_contact_id = $operator_contact_id;
} else {
/** @var EntOperatorContact $entOperatorContact */
$entOperatorContact = $em->getRepository('App:EntOperatorContact')->find($operator_contact_id);
// NOTE: Check if contact still exists
$this->operator_contact_id = !is_null($entOperatorContact) ? $operator_contact_id : null;
}
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @param mixed $note_date
*/
public function setNoteDate($note_date): void
{
$this->note_date = \DateTime::createFromFormat('Y-m-d', $note_date);
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setOperatorContactId($em, $clientData->operator_contact_id);
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setDepartment($clientData->department);
$this->setTitle($clientData->title);
$this->setComment($clientData->comment);
$this->setNoteDate($clientData->note_date);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'operator_id' => $this->operator_id,
'operator_contact_id' => $this->operator_contact_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'department' => $this->department,
'title' => $this->title,
'comment' => $this->comment,
'note_date' => !is_null($this->note_date) ? $this->note_date->format('Y-m-d'): null,
'creation_date' => !is_null($this->creation_date) ? $this->creation_date->format('Y-m-d'): null,
'creation_user_id' => $this->getCreationUserId(),
'creation_user_firstname' => $this->getCreationUserFirstname(),
'creation_user_lastname' => $this->getCreationUserLastname(),
];
}

}

+ 0
- 535
httpdocs/symfony/src/Entity/EntProduction.php 查看文件

@@ -1,535 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="production")
*/
class EntProduction implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $old_plp_id;

/**
* @ORM\Column(type="string",nullable=false)
*/
protected $name;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $name_additional;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $url;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $tax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_mode;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_comment;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_key;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $active;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;

/**
* EntProduction constructor.
* @param ObjectManager $em
* @param $name
* @throws \Exception
*/
public function __construct(ObjectManager $em, $name)
{
$this->name = $name;
$this->active = true;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOldPlpId()
{
return $this->old_plp_id;
}

/**
* @return mixed
*/
public function getName()
{
return $this->name;
}

/**
* @return mixed
*/
public function getNameAdditional()
{
return $this->name_additional;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getUrl()
{
return $this->url;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @return mixed
*/
public function getTaxNo()
{
return $this->tax_no;
}

/**
* @return mixed
*/
public function getInvoiceMode()
{
return $this->invoice_mode;
}

/**
* @return mixed
*/
public function getInvoiceComment()
{
return $this->invoice_comment;
}

/**
* @return mixed
*/
public function getInvoiceKey()
{
return $this->invoice_key;
}

/**
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}

/**
* @return \DateTime
*/
public function getCreationDate(): \DateTime
{
return $this->creation_date;
}

/**
* @param mixed $old_plp_id
*/
public function setOldPlpId($old_plp_id): void
{
$this->old_plp_id = $old_plp_id;
}

/**
* @param mixed $name
*/
public function setName($name): void
{
$this->name = $name;
}

/**
* @param mixed $name_short
*/
public function setNameShort($name_short): void
{
$this->name_short = $name_short;
}

/**
* @param mixed $name_addtional
*/
public function setNameAdditional($name_addtional): void
{
$this->name_addtional = $name_addtional;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param mixed $url
*/
public function setUrl($url): void
{
$this->url = $url;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @param mixed $tax_no
*/
public function setTaxNo($tax_no): void
{
$this->tax_no = $tax_no;
}

/**
* @param mixed $invoice_mode
*/
public function setInvoiceMode($invoice_mode): void
{
$this->invoice_mode = $invoice_mode;
}

/**
* @param mixed $invoice_comment
*/
public function setInvoiceComment($invoice_comment): void
{
$this->invoice_comment = $invoice_comment;
}

/**
* @param mixed $invoice_key
*/
public function setInvoiceKey($invoice_key): void
{
$this->invoice_key = $invoice_key;
}

/**
* @param bool $active
*/
public function setActive(bool $active): void
{
$this->active = $active;
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setName($clientData->name);
$this->setNameAdditional($clientData->name_additional);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setUrl($clientData->url);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setComment($clientData->comment);
$this->setTaxNo($clientData->tax_no);
$this->setInvoiceMode($clientData->invoice_mode);
$this->setInvoiceComment($clientData->invoice_comment);
$this->setInvoiceKey($clientData->invoice_key);
$this->setActive($clientData->active);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
$res = [
'id' => $this->id,
'old_plp_id' => $this->old_plp_id,
'name' => $this->name,
'name_additional' => $this->name_additional,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'url' => $this->url,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'comment' => $this->comment,
'tax_no' => $this->tax_no,
'invoice_mode' => $this->invoice_mode,
'invoice_comment' => $this->invoice_mode,
'invoice_key' => $this->invoice_mode,
'active' => $this->active,
'v_production_contacts' => [],
'v_production_notes' => [],
'v_production_meetings' => [],
];

if ($fullMapping) {
$res['v_production_contacts'] = Utils::clientMap($em, $em->getRepository(EntProductionContact::class)->findBy(['production_id' => $this->getId()]));
$res['v_production_notes'] = Utils::clientMap($em, $em->getRepository(EntProductionNote::class)->findBy(['production_id' => $this->getId()]));
$res['v_production_meetings'] = Utils::clientMap($em, $em->getRepository(EntProductionMeeting::class)->findBy(['production_id' => $this->getId()]));
}

return $res;
}

}

+ 0
- 472
httpdocs/symfony/src/Entity/EntProductionContact.php 查看文件

@@ -1,472 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="production_contact")
*/
class EntProductionContact implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $production_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="date", nullable=true)
*/
protected $date_of_birth;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $is_xmas_mail_recipient = false;


/**
* EntProductionContact constructor.
* @param ObjectManager $em
* @param EntProduction $entProduction
* @param $lastName
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntProduction $entProduction, $lastName)
{
if (is_null($entProduction->getId())) {
throw new Exception('no id found');
}

$this->production_id = $entProduction->getId();
$this->lastname = $lastName;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getProductionId()
{
return $this->production_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getCreationDate()
{
return $this->creation_date;
}

/**
* @return mixed
*/
public function getDateOfBirth()
{
return $this->date_of_birth;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $date_of_birth
*/
public function setDateOfBirth($date_of_birth): void
{
$this->date_of_birth = !is_null($date_of_birth) ? \DateTime::createFromFormat('Y-m-d', $date_of_birth) : $date_of_birth;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @return bool
*/
public function isIsxmasMailRecipient(): bool
{
return $this->is_xmas_mail_recipient;
}

/**
* @param bool $is_xmas_mail_recipient
*/
public function setIsxmasMailRecipient(bool $is_xmas_mail_recipient): void
{
$this->is_xmas_mail_recipient = $is_xmas_mail_recipient;
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setDepartment($clientData->department);
$this->setDateOfBirth($clientData->date_of_birth);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setComment($clientData->comment);
$this->setIsxmasMailRecipient($clientData->is_xmas_mail_recipient);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'production_id' => $this->production_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'department' => $this->department,
'date_of_birth' => $this->date_of_birth,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'comment' => $this->comment,
'is_xmas_mail_recipient' => $this->is_xmas_mail_recipient,
];
}

}

+ 0
- 693
httpdocs/symfony/src/Entity/EntProductionMeeting.php 查看文件

@@ -1,693 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="production_meeting", indexes={@ORM\Index(name="search_production_idx", columns={"production_id", "owner_user_id", "production_contact_id"})})
*/
class EntProductionMeeting implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $production_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $creation_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $owner_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $meeting_type_id;
/**
* @ORM\Column(type="string", nullable=false)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $start_date;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $end_date;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $production_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $report;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $first_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $second_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $report_reminder_sent;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;


/**
* EntProductionMeeting constructor.
* @param ObjectManager $em
* @param EntProduction $entProduction
* @param EntUser $entCreationUser
* @param EntUser $entOwnerUser
* @param EntMeetingType $entMeetingType
* @param $title
* @param $startDate
* @param $endDate
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntProduction $entProduction, EntUser $entCreationUser, EntUser $entOwnerUser,
EntMeetingType $entMeetingType, $title, $startDate, $endDate)
{
if (is_null($entProduction->getId())) {
throw new Exception('no id found');
}

if (is_null($entCreationUser->getId())) {
throw new Exception('no id found');
}

if (is_null($entOwnerUser->getId())) {
throw new Exception('no id found');
}

$meetingTypesById = EntMeetingType::getMeetingTypesById($em);
if (is_null($entMeetingType->getId()) || !array_key_exists($entMeetingType->getId(), $meetingTypesById)) {
throw new Exception('no id found');
}

$this->production_id = $entProduction->getId();
$this->creation_user_id = $entCreationUser->getId();
$this->owner_user_id = $entOwnerUser->getId();
$this->meeting_type_id = $entMeetingType->getId();
$this->title = $title;
$this->setStartDate($startDate);
$this->setEndDate($endDate);
$this->first_reminder_sent = false;
$this->second_reminder_sent = false;
$this->report_reminder_sent = false;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getProductionId()
{
return $this->production_id;
}

/**
* @return mixed
*/
public function getCreationUserId()
{
return $this->creation_user_id;
}

/**
* @return mixed
*/
public function getOwnerUserId()
{
return $this->owner_user_id;
}

/**
* @return mixed
*/
public function getMeetingTypeId()
{
return $this->meeting_type_id;
}

/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}

/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}

/**
* @return mixed
*/
public function getStartDate()
{
return $this->start_date;
}

/**
* @return mixed
*/
public function getEndDate()
{
return $this->end_date;
}

/**
* @return mixed
*/
public function getProductionContactId()
{
return $this->production_contact_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getReport()
{
return $this->report;
}

/**
* @return bool
*/
public function isFirstReminderSent(): bool
{
return $this->first_reminder_sent;
}

/**
* @return bool
*/
public function isSecondReminderSent(): bool
{
return $this->second_reminder_sent;
}

/**
* @param mixed $owner_user_id
*/
public function setOwnerUserId($owner_user_id): void
{
$this->owner_user_id = $owner_user_id;
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $meeting_type_id
*/
public function setMeetingTypeId($meeting_type_id): void
{
$this->meeting_type_id = $meeting_type_id;
}

/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}

/**
* @param mixed $description
*/
public function setDescription($description): void
{
$this->description = $description;
}

/**
* @param mixed $start_date
*/
public function setStartDate($start_date): void
{
$this->start_date = \DateTime::createFromFormat('Y-m-d H:i:s', $start_date);
}

/**
* @param mixed $end_date
*/
public function setEndDate($end_date): void
{
$this->end_date = \DateTime::createFromFormat('Y-m-d H:i:s', $end_date);
}

/**
* @param ObjectManager $em
* @param $production_contact_id
*/
public function setProductionContactId(ObjectManager $em, $production_contact_id): void
{
if ($production_contact_id == 0) {
$this->production_contact_id = $production_contact_id;
} else {
/** @var EntProductionContact $entProductionContact */
$entProductionContact = $em->getRepository(EntProductionContact::class)->find($production_contact_id);
// NOTE: Check if contact still exists
$this->production_contact_id = !is_null($entProductionContact) ? $production_contact_id : null;
}
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param $report
* @throws \Exception
*/
public function setReport($report): void
{
$now = new \DateTime();
if ($now < $this->getStartDate()) {
throw new Exception('meeting has not started yet');
}
$this->report = $report;
}

/**
* @param mixed $first_reminder_sent
*/
public function setFirstReminderSent($first_reminder_sent): void
{
$this->first_reminder_sent = $first_reminder_sent;
}

/**
* @param mixed $second_reminder_sent
*/
public function setSecondReminderSent($second_reminder_sent): void
{
$this->second_reminder_sent = $second_reminder_sent;
}

/**
* @param mixed $report_reminder_sent
*/
public function setReportReminderSent($report_reminder_sent): void
{
$this->report_reminder_sent = $report_reminder_sent;
}

/**
* Checks if meeting is editable or deletable
* @return bool
* @throws \Exception
*/
public function isEditDeletable()
{
$now = new \DateTime();
return $now < $this->getStartDate();
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setOwnerUserId($clientData->owner_user_id);
$this->setMeetingTypeId($clientData->meeting_type_id);
$this->setTitle($clientData->title);
$this->setDescription($clientData->description);
$this->setStartDate($clientData->start_date);
$this->setEndDate($clientData->end_date);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setProductionContactId($em, $clientData->production_contact_id);

if (is_null($this->production_contact_id)) {
$this->setGender(null);
$this->setFirstname(null);
$this->setLastname(null);
$this->setEmail(null);
$this->setPhoneNo(null);
$this->setMobileNo(null);
$this->setDepartment(null);
} else {
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setDepartment($clientData->department);
}
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
* @throws \Exception
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
$now = new \DateTime();
return [
'id' => $this->id,
'production_id' => (int)$this->production_id,
'creation_user_id' => (int)$this->creation_user_id,
'owner_user_id' => (int)$this->owner_user_id,
'meeting_type_id' => (int)$this->meeting_type_id,
'title' => $this->title,
'description' => $this->description,
'start_date' => !is_null($this->start_date) ? $this->start_date->format('Y-m-d H:i:s'): null,
'end_date' => !is_null($this->end_date) ? $this->end_date->format('Y-m-d H:i:s'): null,
'production_contact_id' => $this->production_contact_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'department' => $this->department,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'report' => $this->report,
'first_reminder_sent' => $this->first_reminder_sent,
'second_reminder_sent' => $this->second_reminder_sent,
'report_reminder_sent' => $this->report_reminder_sent,
'creation_date' => !is_null($this->creation_date) ? $this->creation_date->format('Y-m-d H:i:s'): null,
'v_participants' => Utils::clientMap($em, $em->getRepository(EntProductionMeetingParticipant::class)->findBy(['production_meeting_id' => $this->id])),
'v_is_editable' => $now < $this->start_date,
];
}

}

+ 0
- 97
httpdocs/symfony/src/Entity/EntProductionMeetingParticipant.php 查看文件

@@ -1,97 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="production_meeting_participant",indexes={@ORM\Index(name="search_participant_idx", columns={"production_meeting_id", "participant_user_id"})},
* uniqueConstraints={@UniqueConstraint(name="unique_participant", columns={"production_meeting_id", "participant_user_id"})})
*/
class EntProductionMeetingParticipant implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $production_meeting_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $participant_user_id;


/**
* EntProductionMeetingParticipant constructor.
* @param ObjectManager $em
* @param EntProductionMeeting $entProductionMeeting
* @param EntUser $entParticipantUser
*
*/
public function __construct(ObjectManager $em, EntProductionMeeting $entProductionMeeting, EntUser $entParticipantUser)
{
if (is_null($entProductionMeeting->getId())) {
throw new Exception('no id found');
}

if (is_null($entParticipantUser->getId())) {
throw new Exception('no id found');
}

$this->production_meeting_id = $entProductionMeeting->getId();
$this->participant_user_id = $entParticipantUser->getId();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getProductionMeetingId()
{
return $this->production_meeting_id;
}

/**
* @return mixed
*/
public function getParticipantUserId()
{
return $this->participant_user_id;
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'production_meeting_id' => $this->production_meeting_id,
'participant_user_id' => $this->participant_user_id,
];
}

}

+ 0
- 440
httpdocs/symfony/src/Entity/EntProductionNote.php 查看文件

@@ -1,440 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="production_note")
*/
class EntProductionNote implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $production_id;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $production_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="date", nullable=false)
*/
protected $note_date;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $creation_user_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $creation_user_firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $creation_user_lastname;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;


/**
* EntProductionNote constructor.
* @param ObjectManager $em
* @param EntProduction $entProduction
* @param EntUser $entUser
* @param $title
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntProduction $entProduction, EntUser $entUser, $title)
{
if (is_null($entProduction->getId())) {
throw new Exception('no id found');
}

if (is_null($entUser->getId())) {
throw new Exception('no id found');
}

$this->production_id = $entProduction->getId();
$this->creation_user_id = $entUser->getId();
$this->creation_user_firstname = $entUser->getFirstname();
$this->creation_user_lastname = $entUser->getLastname();
$this->title = $title;
$this->note_date = new \DateTime();
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getProductionId()
{
return $this->production_id;
}

/**
* @return mixed
*/
public function getCreationUserId()
{
return $this->creation_user_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @return mixed
*/
public function getNoteDate()
{
return $this->note_date;
}

/**
* @return mixed
*/
public function getCreationUserFirstname()
{
return $this->creation_user_firstname;
}

/**
* @return mixed
*/
public function getCreationUserLastname()
{
return $this->creation_user_lastname;
}

/**
* @return mixed
*/
public function getCreationDate()
{
return $this->creation_date;
}

/**
* @return mixed
*/
public function getProductionContactId()
{
return $this->production_contact_id;
}

/**
* @param ObjectManager $em
* @param $production_contact_id
*/
public function setProductionContactId(ObjectManager $em, $production_contact_id): void
{
if ($production_contact_id == 0) {
$this->production_contact_id = $production_contact_id;
} else {
/** @var EntProductionContact $entProductionContact */
$entProductionContact = $em->getRepository(EntProductionContact::class)->find($production_contact_id);
// NOTE: Check if contact still exists
$this->production_contact_id = !is_null($entProductionContact) ? $production_contact_id : null;
}
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @param mixed $note_date
*/
public function setNoteDate($note_date): void
{
$this->note_date = \DateTime::createFromFormat('Y-m-d', $note_date);
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setProductionContactId($em, $clientData->production_contact_id);
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setDepartment($clientData->department);
$this->setTitle($clientData->title);
$this->setComment($clientData->comment);
$this->setNoteDate($clientData->note_date);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'production_id' => $this->production_id,
'production_contact_id' => $this->production_contact_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'department' => $this->department,
'title' => $this->title,
'comment' => $this->comment,
'note_date' => !is_null($this->note_date) ? $this->note_date->format('Y-m-d'): null,
'creation_date' => !is_null($this->creation_date) ? $this->creation_date->format('Y-m-d'): null,
'creation_user_id' => $this->getCreationUserId(),
'creation_user_firstname' => $this->getCreationUserFirstname(),
'creation_user_lastname' => $this->getCreationUserLastname(),
];
}

}

+ 0
- 535
httpdocs/symfony/src/Entity/EntService.php 查看文件

@@ -1,535 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="service")
*/
class EntService implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $old_plp_id;

/**
* @ORM\Column(type="string",nullable=false)
*/
protected $name;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $name_additional;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $url;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $tax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_mode;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_comment;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $invoice_key;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $active;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;

/**
* EntService constructor.
* @param ObjectManager $em
* @param $name
* @throws \Exception
*/
public function __construct(ObjectManager $em, $name)
{
$this->name = $name;
$this->active = true;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getOldPlpId()
{
return $this->old_plp_id;
}

/**
* @return mixed
*/
public function getName()
{
return $this->name;
}

/**
* @return mixed
*/
public function getNameAdditional()
{
return $this->name_additional;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getUrl()
{
return $this->url;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @return mixed
*/
public function getTaxNo()
{
return $this->tax_no;
}

/**
* @return mixed
*/
public function getInvoiceMode()
{
return $this->invoice_mode;
}

/**
* @return mixed
*/
public function getInvoiceComment()
{
return $this->invoice_comment;
}

/**
* @return mixed
*/
public function getInvoiceKey()
{
return $this->invoice_key;
}

/**
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}

/**
* @return \DateTime
*/
public function getCreationDate(): \DateTime
{
return $this->creation_date;
}

/**
* @param mixed $old_plp_id
*/
public function setOldPlpId($old_plp_id): void
{
$this->old_plp_id = $old_plp_id;
}

/**
* @param mixed $name
*/
public function setName($name): void
{
$this->name = $name;
}

/**
* @param mixed $name_short
*/
public function setNameShort($name_short): void
{
$this->name_short = $name_short;
}

/**
* @param mixed $name_addtional
*/
public function setNameAdditional($name_addtional): void
{
$this->name_addtional = $name_addtional;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param mixed $url
*/
public function setUrl($url): void
{
$this->url = $url;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @param mixed $tax_no
*/
public function setTaxNo($tax_no): void
{
$this->tax_no = $tax_no;
}

/**
* @param mixed $invoice_mode
*/
public function setInvoiceMode($invoice_mode): void
{
$this->invoice_mode = $invoice_mode;
}

/**
* @param mixed $invoice_comment
*/
public function setInvoiceComment($invoice_comment): void
{
$this->invoice_comment = $invoice_comment;
}

/**
* @param mixed $invoice_key
*/
public function setInvoiceKey($invoice_key): void
{
$this->invoice_key = $invoice_key;
}

/**
* @param bool $active
*/
public function setActive(bool $active): void
{
$this->active = $active;
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setName($clientData->name);
$this->setNameAdditional($clientData->name_additional);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setUrl($clientData->url);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setComment($clientData->comment);
$this->setTaxNo($clientData->tax_no);
$this->setInvoiceMode($clientData->invoice_mode);
$this->setInvoiceComment($clientData->invoice_comment);
$this->setInvoiceKey($clientData->invoice_key);
$this->setActive($clientData->active);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
$res = [
'id' => $this->id,
'old_plp_id' => $this->old_plp_id,
'name' => $this->name,
'name_additional' => $this->name_additional,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'url' => $this->url,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'comment' => $this->comment,
'tax_no' => $this->tax_no,
'invoice_mode' => $this->invoice_mode,
'invoice_comment' => $this->invoice_mode,
'invoice_key' => $this->invoice_mode,
'active' => $this->active,
'v_service_contacts' => [],
'v_service_notes' => [],
'v_service_meetings' => [],
];

if ($fullMapping) {
$res['v_service_contacts'] = Utils::clientMap($em, $em->getRepository(EntServiceContact::class)->findBy(['service_id' => $this->getId()]));
$res['v_service_notes'] = Utils::clientMap($em, $em->getRepository(EntServiceNote::class)->findBy(['service_id' => $this->getId()]));
$res['v_service_meetings'] = Utils::clientMap($em, $em->getRepository(EntServiceMeeting::class)->findBy(['service_id' => $this->getId()]));
}

return $res;
}

}

+ 0
- 472
httpdocs/symfony/src/Entity/EntServiceContact.php 查看文件

@@ -1,472 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="service_contact")
*/
class EntServiceContact implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $service_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="date", nullable=true)
*/
protected $date_of_birth;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $is_xmas_mail_recipient = false;


/**
* EntServiceContact constructor.
* @param ObjectManager $em
* @param EntService $entService
* @param $lastName
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntService $entService, $lastName)
{
if (is_null($entService->getId())) {
throw new Exception('no id found');
}

$this->service_id = $entService->getId();
$this->lastname = $lastName;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getServiceId()
{
return $this->service_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getCreationDate()
{
return $this->creation_date;
}

/**
* @return mixed
*/
public function getDateOfBirth()
{
return $this->date_of_birth;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $date_of_birth
*/
public function setDateOfBirth($date_of_birth): void
{
$this->date_of_birth = !is_null($date_of_birth) ? \DateTime::createFromFormat('Y-m-d', $date_of_birth) : $date_of_birth;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @return bool
*/
public function isIsxmasMailRecipient(): bool
{
return $this->is_xmas_mail_recipient;
}

/**
* @param bool $is_xmas_mail_recipient
*/
public function setIsxmasMailRecipient(bool $is_xmas_mail_recipient): void
{
$this->is_xmas_mail_recipient = $is_xmas_mail_recipient;
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setDepartment($clientData->department);
$this->setDateOfBirth($clientData->date_of_birth);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setComment($clientData->comment);
$this->setIsxmasMailRecipient($clientData->is_xmas_mail_recipient);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'service_id' => $this->service_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'department' => $this->department,
'date_of_birth' => $this->date_of_birth,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'comment' => $this->comment,
'is_xmas_mail_recipient' => $this->is_xmas_mail_recipient,
];
}

}

+ 0
- 693
httpdocs/symfony/src/Entity/EntServiceMeeting.php 查看文件

@@ -1,693 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="service_meeting", indexes={@ORM\Index(name="search_service_idx", columns={"service_id", "owner_user_id", "service_contact_id"})})
*/
class EntServiceMeeting implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $service_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $creation_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $owner_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $meeting_type_id;
/**
* @ORM\Column(type="string", nullable=false)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $start_date;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $end_date;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $service_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $country_id;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $report;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $first_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $second_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
protected $report_reminder_sent;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;


/**
* EntServiceMeeting constructor.
* @param ObjectManager $em
* @param EntService $entService
* @param EntUser $entCreationUser
* @param EntUser $entOwnerUser
* @param EntMeetingType $entMeetingType
* @param $title
* @param $startDate
* @param $endDate
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntService $entService, EntUser $entCreationUser, EntUser $entOwnerUser,
EntMeetingType $entMeetingType, $title, $startDate, $endDate)
{
if (is_null($entService->getId())) {
throw new Exception('no id found');
}

if (is_null($entCreationUser->getId())) {
throw new Exception('no id found');
}

if (is_null($entOwnerUser->getId())) {
throw new Exception('no id found');
}

$meetingTypesById = EntMeetingType::getMeetingTypesById($em);
if (is_null($entMeetingType->getId()) || !array_key_exists($entMeetingType->getId(), $meetingTypesById)) {
throw new Exception('no id found');
}

$this->service_id = $entService->getId();
$this->creation_user_id = $entCreationUser->getId();
$this->owner_user_id = $entOwnerUser->getId();
$this->meeting_type_id = $entMeetingType->getId();
$this->title = $title;
$this->setStartDate($startDate);
$this->setEndDate($endDate);
$this->first_reminder_sent = false;
$this->second_reminder_sent = false;
$this->report_reminder_sent = false;
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getServiceId()
{
return $this->service_id;
}

/**
* @return mixed
*/
public function getCreationUserId()
{
return $this->creation_user_id;
}

/**
* @return mixed
*/
public function getOwnerUserId()
{
return $this->owner_user_id;
}

/**
* @return mixed
*/
public function getMeetingTypeId()
{
return $this->meeting_type_id;
}

/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}

/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}

/**
* @return mixed
*/
public function getStartDate()
{
return $this->start_date;
}

/**
* @return mixed
*/
public function getEndDate()
{
return $this->end_date;
}

/**
* @return mixed
*/
public function getServiceContactId()
{
return $this->service_contact_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}

/**
* @return mixed
*/
public function getStreetNo()
{
return $this->street_no;
}

/**
* @return mixed
*/
public function getZip()
{
return $this->zip;
}

/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}

/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}

/**
* @return mixed
*/
public function getReport()
{
return $this->report;
}

/**
* @return bool
*/
public function isFirstReminderSent(): bool
{
return $this->first_reminder_sent;
}

/**
* @return bool
*/
public function isSecondReminderSent(): bool
{
return $this->second_reminder_sent;
}

/**
* @param mixed $owner_user_id
*/
public function setOwnerUserId($owner_user_id): void
{
$this->owner_user_id = $owner_user_id;
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $meeting_type_id
*/
public function setMeetingTypeId($meeting_type_id): void
{
$this->meeting_type_id = $meeting_type_id;
}

/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}

/**
* @param mixed $description
*/
public function setDescription($description): void
{
$this->description = $description;
}

/**
* @param mixed $start_date
*/
public function setStartDate($start_date): void
{
$this->start_date = \DateTime::createFromFormat('Y-m-d H:i:s', $start_date);
}

/**
* @param mixed $end_date
*/
public function setEndDate($end_date): void
{
$this->end_date = \DateTime::createFromFormat('Y-m-d H:i:s', $end_date);
}

/**
* @param ObjectManager $em
* @param $service_contact_id
*/
public function setServiceContactId(ObjectManager $em, $service_contact_id): void
{
if ($service_contact_id == 0) {
$this->service_contact_id = $service_contact_id;
} else {
/** @var EntServiceContact $entServiceContact */
$entServiceContact = $em->getRepository(EntServiceContact::class)->find($service_contact_id);
// NOTE: Check if contact still exists
$this->service_contact_id = !is_null($entServiceContact) ? $service_contact_id : null;
}
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}

/**
* @param mixed $street_no
*/
public function setStreetNo($street_no): void
{
$this->street_no = $street_no;
}

/**
* @param mixed $zip
*/
public function setZip($zip): void
{
$this->zip = $zip;
}

/**
* @param mixed $city
*/
public function setCity($city): void
{
$this->city = $city;
}

/**
* @param mixed $country_id
*/
public function setCountryId($country_id): void
{
$this->country_id = $country_id;
}

/**
* @param $report
* @throws \Exception
*/
public function setReport($report): void
{
$now = new \DateTime();
if ($now < $this->getStartDate()) {
throw new Exception('meeting has not started yet');
}
$this->report = $report;
}

/**
* @param mixed $first_reminder_sent
*/
public function setFirstReminderSent($first_reminder_sent): void
{
$this->first_reminder_sent = $first_reminder_sent;
}

/**
* @param mixed $second_reminder_sent
*/
public function setSecondReminderSent($second_reminder_sent): void
{
$this->second_reminder_sent = $second_reminder_sent;
}

/**
* @param mixed $report_reminder_sent
*/
public function setReportReminderSent($report_reminder_sent): void
{
$this->report_reminder_sent = $report_reminder_sent;
}

/**
* Checks if meeting is editable or deletable
* @return bool
* @throws \Exception
*/
public function isEditDeletable()
{
$now = new \DateTime();
return $now < $this->getStartDate();
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setOwnerUserId($clientData->owner_user_id);
$this->setMeetingTypeId($clientData->meeting_type_id);
$this->setTitle($clientData->title);
$this->setDescription($clientData->description);
$this->setStartDate($clientData->start_date);
$this->setEndDate($clientData->end_date);
$this->setStreet($clientData->street);
$this->setStreetNo($clientData->street_no);
$this->setZip($clientData->zip);
$this->setCity($clientData->city);
$this->setCountryId($clientData->country_id);
$this->setServiceContactId($em, $clientData->service_contact_id);

if (is_null($this->service_contact_id)) {
$this->setGender(null);
$this->setFirstname(null);
$this->setLastname(null);
$this->setEmail(null);
$this->setPhoneNo(null);
$this->setMobileNo(null);
$this->setDepartment(null);
} else {
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setDepartment($clientData->department);
}
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
* @throws \Exception
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
$now = new \DateTime();
return [
'id' => $this->id,
'service_id' => (int)$this->service_id,
'creation_user_id' => (int)$this->creation_user_id,
'owner_user_id' => (int)$this->owner_user_id,
'meeting_type_id' => (int)$this->meeting_type_id,
'title' => $this->title,
'description' => $this->description,
'start_date' => !is_null($this->start_date) ? $this->start_date->format('Y-m-d H:i:s'): null,
'end_date' => !is_null($this->end_date) ? $this->end_date->format('Y-m-d H:i:s'): null,
'service_contact_id' => $this->service_contact_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'department' => $this->department,
'street' => $this->street,
'street_no' => $this->street_no,
'zip' => $this->zip,
'city' => $this->city,
'country_id' => $this->country_id,
'report' => $this->report,
'first_reminder_sent' => $this->first_reminder_sent,
'second_reminder_sent' => $this->second_reminder_sent,
'report_reminder_sent' => $this->report_reminder_sent,
'creation_date' => !is_null($this->creation_date) ? $this->creation_date->format('Y-m-d H:i:s'): null,
'v_participants' => Utils::clientMap($em, $em->getRepository(EntServiceMeetingParticipant::class)->findBy(['service_meeting_id' => $this->id])),
'v_is_editable' => $now < $this->start_date,
];
}

}

+ 0
- 97
httpdocs/symfony/src/Entity/EntServiceMeetingParticipant.php 查看文件

@@ -1,97 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="service_meeting_participant",indexes={@ORM\Index(name="search_participant_idx", columns={"service_meeting_id", "participant_user_id"})},
* uniqueConstraints={@UniqueConstraint(name="unique_participant", columns={"service_meeting_id", "participant_user_id"})})
*/
class EntServiceMeetingParticipant implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $service_meeting_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $participant_user_id;


/**
* EntServiceMeetingParticipant constructor.
* @param ObjectManager $em
* @param EntServiceMeeting $entServiceMeeting
* @param EntUser $entParticipantUser
*
*/
public function __construct(ObjectManager $em, EntServiceMeeting $entServiceMeeting, EntUser $entParticipantUser)
{
if (is_null($entServiceMeeting->getId())) {
throw new Exception('no id found');
}

if (is_null($entParticipantUser->getId())) {
throw new Exception('no id found');
}

$this->service_meeting_id = $entServiceMeeting->getId();
$this->participant_user_id = $entParticipantUser->getId();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getServiceMeetingId()
{
return $this->service_meeting_id;
}

/**
* @return mixed
*/
public function getParticipantUserId()
{
return $this->participant_user_id;
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'service_meeting_id' => $this->service_meeting_id,
'participant_user_id' => $this->participant_user_id,
];
}

}

+ 0
- 440
httpdocs/symfony/src/Entity/EntServiceNote.php 查看文件

@@ -1,440 +0,0 @@
<?php

namespace App\Entity;


use App\Entity\IFace\IEntity;
use App\Utils\Utils;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="service_note")
*/
class EntServiceNote implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $service_id;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
protected $service_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $department;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="date", nullable=false)
*/
protected $note_date;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
protected $creation_user_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
protected $creation_user_firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
protected $creation_user_lastname;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
protected $creation_date;


/**
* EntServiceNote constructor.
* @param ObjectManager $em
* @param EntService $entService
* @param EntUser $entUser
* @param $title
* @throws \Exception
*/
public function __construct(ObjectManager $em, EntService $entService, EntUser $entUser, $title)
{
if (is_null($entService->getId())) {
throw new Exception('no id found');
}

if (is_null($entUser->getId())) {
throw new Exception('no id found');
}

$this->service_id = $entService->getId();
$this->creation_user_id = $entUser->getId();
$this->creation_user_firstname = $entUser->getFirstname();
$this->creation_user_lastname = $entUser->getLastname();
$this->title = $title;
$this->note_date = new \DateTime();
$this->creation_date = new \DateTime();
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @return mixed
*/
public function getServiceId()
{
return $this->service_id;
}

/**
* @return mixed
*/
public function getCreationUserId()
{
return $this->creation_user_id;
}

/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}

/**
* @return mixed
*/
public function getFirstname()
{
return $this->firstname;
}

/**
* @return mixed
*/
public function getLastname()
{
return $this->lastname;
}

/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}

/**
* @return mixed
*/
public function getPhoneNo()
{
return $this->phone_no;
}

/**
* @return mixed
*/
public function getMobileNo()
{
return $this->mobile_no;
}

/**
* @return mixed
*/
public function getFaxNo()
{
return $this->fax_no;
}

/**
* @return mixed
*/
public function getDepartment()
{
return $this->department;
}

/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @return mixed
*/
public function getNoteDate()
{
return $this->note_date;
}

/**
* @return mixed
*/
public function getCreationUserFirstname()
{
return $this->creation_user_firstname;
}

/**
* @return mixed
*/
public function getCreationUserLastname()
{
return $this->creation_user_lastname;
}

/**
* @return mixed
*/
public function getCreationDate()
{
return $this->creation_date;
}

/**
* @return mixed
*/
public function getServiceContactId()
{
return $this->service_contact_id;
}

/**
* @param ObjectManager $em
* @param $service_contact_id
*/
public function setServiceContactId(ObjectManager $em, $service_contact_id): void
{
if ($service_contact_id == 0) {
$this->service_contact_id = $service_contact_id;
} else {
/** @var EntServiceContact $entServiceContact */
$entServiceContact = $em->getRepository(EntServiceContact::class)->find($service_contact_id);
// NOTE: Check if contact still exists
$this->service_contact_id = !is_null($entServiceContact) ? $service_contact_id : null;
}
}

/**
* @param mixed $gender
*/
public function setGender($gender): void
{
if (!is_null($gender) && !Utils::isValidGender($gender)) {
throw new Exception('invalid gender');
}
$this->gender = $gender;
}

/**
* @param mixed $firstname
*/
public function setFirstname($firstname): void
{
$this->firstname = $firstname;
}

/**
* @param mixed $lastname
*/
public function setLastname($lastname): void
{
$this->lastname = $lastname;
}

/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}

/**
* @param mixed $phone_no
*/
public function setPhoneNo($phone_no): void
{
$this->phone_no = $phone_no;
}

/**
* @param mixed $mobile_no
*/
public function setMobileNo($mobile_no): void
{
$this->mobile_no = $mobile_no;
}

/**
* @param mixed $fax_no
*/
public function setFaxNo($fax_no): void
{
$this->fax_no = $fax_no;
}

/**
* @param mixed $department
*/
public function setDepartment($department): void
{
$this->department = $department;
}

/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}

/**
* @param mixed $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}

/**
* @param mixed $note_date
*/
public function setNoteDate($note_date): void
{
$this->note_date = \DateTime::createFromFormat('Y-m-d', $note_date);
}

/**
* Sets client data
* @param ObjectManager $em
* @param $clientData
*/
public function setClientData(ObjectManager $em, $clientData)
{
$this->setServiceContactId($em, $clientData->service_contact_id);
$this->setGender($clientData->gender);
$this->setFirstname($clientData->firstname);
$this->setLastname($clientData->lastname);
$this->setEmail($clientData->email);
$this->setPhoneNo($clientData->phone_no);
$this->setMobileNo($clientData->mobile_no);
$this->setFaxNo($clientData->fax_no);
$this->setDepartment($clientData->department);
$this->setTitle($clientData->title);
$this->setComment($clientData->comment);
$this->setNoteDate($clientData->note_date);
}

/**
* Client mapper
* @param ObjectManager $em
* @param bool $fullMapping
* @return array
*/
public function clientMapper(ObjectManager $em, $fullMapping = false)
{
return [
'id' => $this->id,
'service_id' => $this->service_id,
'service_contact_id' => $this->service_contact_id,
'gender' => $this->gender,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email' => $this->email,
'phone_no' => $this->phone_no,
'mobile_no' => $this->mobile_no,
'fax_no' => $this->fax_no,
'department' => $this->department,
'title' => $this->title,
'comment' => $this->comment,
'note_date' => !is_null($this->note_date) ? $this->note_date->format('Y-m-d'): null,
'creation_date' => !is_null($this->creation_date) ? $this->creation_date->format('Y-m-d'): null,
'creation_user_id' => $this->getCreationUserId(),
'creation_user_firstname' => $this->getCreationUserFirstname(),
'creation_user_lastname' => $this->getCreationUserLastname(),
];
}

}

+ 0
- 18
httpdocs/symfony/src/EntityVirtual/ServiceData.php 查看文件

@@ -18,15 +18,6 @@ class ServiceData
const SERVICE_DATA_TYPE_CUSTOMER_CONTACTS = 'customerContacts';
const SERVICE_DATA_TYPE_CUSTOMER_MEETINGS = 'customerMeetings';
const SERVICE_DATA_TYPE_INTERNAL_MEETINGS = 'internalMeetings';
const SERVICE_DATA_TYPE_OPERATORS = 'operators';
const SERVICE_DATA_TYPE_OPERATOR_CONTACTS = 'operatorContacts';
const SERVICE_DATA_TYPE_OPERATOR_MEETINGS = 'operatorMeetings';
const SERVICE_DATA_TYPE_PRODUCTIONS = 'productions';
const SERVICE_DATA_TYPE_PRODUCTION_CONTACTS = 'productionContacts';
const SERVICE_DATA_TYPE_PRODUCTION_MEETINGS = 'productionMeetings';
const SERVICE_DATA_TYPE_SERVICES = 'services';
const SERVICE_DATA_TYPE_SERVICES_CONTACTS = 'serviceContacts';
const SERVICE_DATA_TYPE_SERVICES_MEETINGS = 'serviceMeetings';

const ACTION_ADD = 'add';
const ACTION_EDIT = 'edit';
@@ -37,15 +28,6 @@ class ServiceData
self::SERVICE_DATA_TYPE_CUSTOMER_CONTACTS => 1,
self::SERVICE_DATA_TYPE_CUSTOMER_MEETINGS => 1,
self::SERVICE_DATA_TYPE_INTERNAL_MEETINGS => 1,
self::SERVICE_DATA_TYPE_OPERATORS => 1,
self::SERVICE_DATA_TYPE_OPERATOR_CONTACTS => 1,
self::SERVICE_DATA_TYPE_OPERATOR_MEETINGS => 1,
self::SERVICE_DATA_TYPE_PRODUCTIONS => 1,
self::SERVICE_DATA_TYPE_PRODUCTION_CONTACTS => 1,
self::SERVICE_DATA_TYPE_PRODUCTION_MEETINGS => 1,
self::SERVICE_DATA_TYPE_SERVICES => 1,
self::SERVICE_DATA_TYPE_SERVICES_CONTACTS => 1,
self::SERVICE_DATA_TYPE_SERVICES_MEETINGS => 1,
];

private static $validActions = [


+ 0
- 62
httpdocs/symfony/src/Migrations/Version20201016103219.php 查看文件

@@ -1,62 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20201016103219 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}

public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE customer_note CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE operator_note CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE operator_contact ADD is_xmas_mail_recipient TINYINT(1) NOT NULL, CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE customer_contact ADD is_xmas_mail_recipient TINYINT(1) NOT NULL, CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE customer_meeting CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE operator_meeting CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
}

public function postUp(Schema $schema): void
{
// Process xmas flags
$opContacts = $this->connection->fetchAll("SELECT * FROM `operator_contact`");
foreach ($opContacts as $opContact) {
if (!is_null($opContact['comment']) && strpos($opContact['comment'], 'Weihnachten')) {
$this->connection->exec("UPDATE `operator_contact` SET `is_xmas_mail_recipient` = 1 WHERE id = ".$opContact['id']);
}
}
$cuContacts = $this->connection->fetchAll("SELECT * FROM `customer_contact`");
foreach ($cuContacts as $cuContact) {
if (!is_null($cuContact['comment']) && strpos($cuContact['comment'], 'Weihnachten')) {
$this->connection->exec("UPDATE `customer_contact` SET `is_xmas_mail_recipient` = 1 WHERE id = ".$cuContact['id']);
}
}
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE customer_contact DROP is_xmas_mail_recipient, CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE customer_meeting CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE customer_note CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE operator_contact DROP is_xmas_mail_recipient, CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE operator_meeting CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE operator_note CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
}
}

+ 0
- 65
httpdocs/symfony/src/Migrations/Version20220907142919.php 查看文件

@@ -1,65 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220907142919 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}

public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE TABLE production (id INT AUTO_INCREMENT NOT NULL, old_plp_id VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, name_additional VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_no VARCHAR(255) DEFAULT NULL, zip VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country_id INT UNSIGNED DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, fax_no VARCHAR(255) DEFAULT NULL, comment VARCHAR(255) DEFAULT NULL, tax_no VARCHAR(255) DEFAULT NULL, invoice_mode VARCHAR(255) DEFAULT NULL, invoice_comment VARCHAR(255) DEFAULT NULL, invoice_key VARCHAR(255) DEFAULT NULL, active TINYINT(1) NOT NULL, creation_date DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE production_meeting_participant (id INT AUTO_INCREMENT NOT NULL, production_meeting_id INT UNSIGNED NOT NULL, participant_user_id INT UNSIGNED NOT NULL, UNIQUE INDEX unique_participant (production_meeting_id, participant_user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE service_meeting (id INT AUTO_INCREMENT NOT NULL, service_id INT UNSIGNED NOT NULL, creation_user_id INT UNSIGNED NOT NULL, owner_user_id INT UNSIGNED NOT NULL, meeting_type_id INT UNSIGNED NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, start_date DATETIME NOT NULL, end_date DATETIME NOT NULL, service_contact_id INT UNSIGNED DEFAULT NULL, gender enum(\'male\', \'female\', \'diverse\'), firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_no VARCHAR(255) DEFAULT NULL, zip VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country_id INT UNSIGNED DEFAULT NULL, report LONGTEXT DEFAULT NULL, first_reminder_sent TINYINT(1) NOT NULL, second_reminder_sent TINYINT(1) NOT NULL, report_reminder_sent TINYINT(1) NOT NULL, creation_date DATETIME NOT NULL, INDEX search_service_idx (service_id, owner_user_id, service_contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE production_contact (id INT AUTO_INCREMENT NOT NULL, production_id INT UNSIGNED NOT NULL, gender enum(\'male\', \'female\', \'diverse\'), firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) NOT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, fax_no VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, date_of_birth DATE DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_no VARCHAR(255) DEFAULT NULL, zip VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country_id INT UNSIGNED DEFAULT NULL, comment VARCHAR(255) DEFAULT NULL, creation_date DATETIME NOT NULL, is_xmas_mail_recipient TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE service_meeting_participant (id INT AUTO_INCREMENT NOT NULL, service_meeting_id INT UNSIGNED NOT NULL, participant_user_id INT UNSIGNED NOT NULL, UNIQUE INDEX unique_participant (service_meeting_id, participant_user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE service (id INT AUTO_INCREMENT NOT NULL, old_plp_id VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, name_additional VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_no VARCHAR(255) DEFAULT NULL, zip VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country_id INT UNSIGNED DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, fax_no VARCHAR(255) DEFAULT NULL, comment VARCHAR(255) DEFAULT NULL, tax_no VARCHAR(255) DEFAULT NULL, invoice_mode VARCHAR(255) DEFAULT NULL, invoice_comment VARCHAR(255) DEFAULT NULL, invoice_key VARCHAR(255) DEFAULT NULL, active TINYINT(1) NOT NULL, creation_date DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE production_note (id INT AUTO_INCREMENT NOT NULL, production_id INT UNSIGNED NOT NULL, production_contact_id INT UNSIGNED DEFAULT NULL, gender enum(\'male\', \'female\', \'diverse\'), firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, fax_no VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, title VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, note_date DATE NOT NULL, creation_user_id INT UNSIGNED NOT NULL, creation_user_firstname VARCHAR(255) DEFAULT NULL, creation_user_lastname VARCHAR(255) NOT NULL, creation_date DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE service_contact (id INT AUTO_INCREMENT NOT NULL, service_id INT UNSIGNED NOT NULL, gender enum(\'male\', \'female\', \'diverse\'), firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) NOT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, fax_no VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, date_of_birth DATE DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_no VARCHAR(255) DEFAULT NULL, zip VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country_id INT UNSIGNED DEFAULT NULL, comment VARCHAR(255) DEFAULT NULL, creation_date DATETIME NOT NULL, is_xmas_mail_recipient TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE service_note (id INT AUTO_INCREMENT NOT NULL, service_id INT UNSIGNED NOT NULL, service_contact_id INT UNSIGNED DEFAULT NULL, gender enum(\'male\', \'female\', \'diverse\'), firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, fax_no VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, title VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, note_date DATE NOT NULL, creation_user_id INT UNSIGNED NOT NULL, creation_user_firstname VARCHAR(255) DEFAULT NULL, creation_user_lastname VARCHAR(255) NOT NULL, creation_date DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE production_meeting (id INT AUTO_INCREMENT NOT NULL, production_id INT UNSIGNED NOT NULL, creation_user_id INT UNSIGNED NOT NULL, owner_user_id INT UNSIGNED NOT NULL, meeting_type_id INT UNSIGNED NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, start_date DATETIME NOT NULL, end_date DATETIME NOT NULL, production_contact_id INT UNSIGNED DEFAULT NULL, gender enum(\'male\', \'female\', \'diverse\'), firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone_no VARCHAR(255) DEFAULT NULL, mobile_no VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_no VARCHAR(255) DEFAULT NULL, zip VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country_id INT UNSIGNED DEFAULT NULL, report LONGTEXT DEFAULT NULL, first_reminder_sent TINYINT(1) NOT NULL, second_reminder_sent TINYINT(1) NOT NULL, report_reminder_sent TINYINT(1) NOT NULL, creation_date DATETIME NOT NULL, INDEX search_production_idx (production_id, owner_user_id, production_contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE customer_note CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE operator_note CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE operator_contact CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE customer_contact CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE customer_meeting CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
$this->addSql('ALTER TABLE operator_meeting CHANGE gender gender enum(\'male\', \'female\', \'diverse\')');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('DROP TABLE production');
$this->addSql('DROP TABLE production_meeting_participant');
$this->addSql('DROP TABLE service_meeting');
$this->addSql('DROP TABLE production_contact');
$this->addSql('DROP TABLE service_meeting_participant');
$this->addSql('DROP TABLE service');
$this->addSql('DROP TABLE production_note');
$this->addSql('DROP TABLE service_contact');
$this->addSql('DROP TABLE service_note');
$this->addSql('DROP TABLE production_meeting');
$this->addSql('ALTER TABLE customer_contact CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE customer_meeting CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE customer_note CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE operator_contact CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE operator_meeting CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('ALTER TABLE operator_note CHANGE gender gender VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
}
}

Loading…
取消
儲存