Initial xentral_oss_20.3.c9ffacf

This commit is contained in:
Alex
2021-05-21 08:49:41 +02:00
parent 5406e4a551
commit 34e5ac43d9
18884 changed files with 2109867 additions and 0 deletions
@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\TimeManagement\Wrapper;
use erpAPI;
use Xentral\Modules\TimeManagement\Exception\EmailNotSentException;
use Xentral\Modules\TimeManagement\Exception\EmailAccountNotFoundException;
final class TimeManagementMailerWrapper
{
/** @var erpAPI erp */
private $erp;
/**
* @param erpAPI $erp
*/
public function __construct(erpAPI $erp)
{
$this->erp = $erp;
}
/**
* @param string $senderEmail
* @param string[] $recipientEmails
* @param string $mailSubject
* @param string $mailContent
*
* @throws EmailAccountNotFoundException
* @throws EmailNotSentException
*/
public function send(string $senderEmail, array $recipientEmails, string $mailSubject, string $mailContent): void
{
foreach ($recipientEmails as $email) {
$isSent = $this->erp->MailSend(
$this->erp->GetFirmaMail(),
$senderEmail,
$email,
'',
$mailSubject,
$mailContent,
"",
""
);
if (!$isSent) {
throw new EmailNotSentException('Mail could not be sent. More info in the logger');
}
}
}
}
@@ -0,0 +1,69 @@
<?php
namespace Xentral\Modules\TimeManagement\Wrapper;
use DateTimeInterface;
use Mitarbeiterzeiterfassung;
final class TimeManagementTargetHourWrapper
{
/** @var Mitarbeiterzeiterfassung $timeRecordingModule */
private $timeRecordingModule;
public function __construct(Mitarbeiterzeiterfassung $timeRecordingModule)
{
$this->timeRecordingModule = $timeRecordingModule;
}
/**
* @param int $address_id
* @param DateTimeInterface $date
*
* @return bool
*/
public function recalculate(int $address_id, DateTimeInterface $date): bool
{
return $this->timeRecordingModule->MitarbeitererfassungIstNeuberechnen($address_id, $date->format('Y-m-d'));
}
/**
* @param int $addressId
* @param DateTimeInterface $date
* @param string $type
* @param bool $add
* @param string $time
* @param string $requestToken
*/
public function handleType(
int $addressId,
DateTimeInterface $date,
string $type,
bool $add = true,
string $time = '0',
string $requestToken = ''
): void {
$this->timeRecordingModule->MitarbeiterzeiterfassungInsertUpdateKuerzel(
$addressId,
$date->format('Y-m-d'),
$type,
$add,
$time,
$requestToken
);
}
/**
* @param int $addressId
* @param DateTimeInterface $date
* @param string $comment
*/
public function saveComment(int $addressId, DateTimeInterface $date, string $comment): void
{
$this->timeRecordingModule->MitarbeiterzeiterfassungInsertUpdateKommentar(
$addressId,
$date->format('Y-m-d'),
$comment
);
}
}