61 Commits
Author SHA1 Message Date
Xenomporio a78571aa45 1.3.1 2022-09-07 17:16:04 +02:00
Xenomporio f64f6f64cb Bugfix yui autocompletebestellung (was commented out) 2022-09-07 11:42:22 +02:00
Xenomporio af4c64359b Wareneingang also for non stock artikel 2022-09-07 11:41:21 +02:00
root 383524f348 Improved compatibility to Xentral 20 database 2022-09-04 09:57:00 +00:00
Xenomporio 2bb3130b00 Release V.1.3 Readme 2022-08-20 12:20:03 +02:00
Xenomporio d808676489 Bugfix typo 2022-08-20 12:09:07 +02:00
Xenomporio 954eebcdc1 Ticket system bugfixes with filename handling 2022-08-20 11:59:32 +02:00
Xenomporio 84cd447f49 Ticket system cosmetic changes to xentral 20 compatibility assistents 2022-08-19 14:24:13 +02:00
Xenomporio d05cd92b3b ticket system migration helper for ticket date from xentral 20 2022-08-18 21:36:42 +02:00
Xenomporio 3f75bfad7d ticket system migration helper for ticket status from xentral 20 2022-08-18 20:45:09 +02:00
Xenomporio b16b19f2d6 ticket system switched message text display to iframe 2022-08-18 20:41:44 +02:00
Xenomporio c24be3f1c7 ticket system bugfix display of ticket subjects when notiz IS NULL (xentral 20 compatibility) 2022-08-15 23:43:36 +02:00
Xenomporio db1c9cc4ce Ticket system added database compatibility to xentral 20 enterprise ticket system 2022-08-15 18:52:36 +02:00
Xenomporio f3dfd870c2 Bugfix ticket system attachments with UTF-8 URL-encoded filenames 2022-08-14 20:18:15 +02:00
Xenomporio f08c9ecc09 Some changes for file management module dateien 2022-08-12 20:13:15 +02:00
Xenomporio 1e6812dbd4 edit.png -> edit.svg 2022-08-08 16:16:41 +02:00
Xenomporio 29cf035d2e small modifications to welcome.php 2022-08-08 15:52:45 +02:00
Xenomporio 37e100d7ff Bugfix SQL_CALC_FOUND_ROWS for all live tables 2022-08-08 14:06:22 +02:00
Xenomporio 7ff7e6bfd6 Ticket system bugfix received recipients 2022-08-07 12:07:55 +02:00
Xenomporio 17f0efcc68 module creator changed edit icon from png to svg 2022-08-07 11:50:57 +02:00
Xenomporio dfdad1b8c4 Ticket system implemented ticketregeln (ticket rules) 2022-08-07 11:50:13 +02:00
Xenomporio cdaecb3969 Ticket system link from ticket to adresse, changed icon from png to svg 2022-08-06 11:31:43 +02:00
Xenomporio a10933583c Some improvements in adresse CRM 2022-08-06 10:57:29 +02:00
Xenomporio 4c98f6966b CRM new email with prefilled text 2022-08-06 10:41:47 +02:00
Xenomporio 4af7eacfd8 Ticket system / sendmail, changes to response citation and html chars handling 2022-08-06 10:40:58 +02:00
Xenomporio 3c1e7e0949 Bugfix htmlentities in ckeditor e.g. <mail@server> 2022-08-05 21:16:58 +02:00
Xenomporio 18dde9387e Ticket send mail with signature 2022-08-05 19:02:50 +02:00
Xenomporio 6a41075086 Fill out mail adress in new ticket message 2022-08-05 17:19:01 +02:00
Xenomporio a1aa642849 Bugfix incoming tickets select warteschlange and adresse 2022-08-05 17:08:41 +02:00
Xenomporio e1e886e8e6 Ticket system fix display of user edited fields wth htmlentities 2022-08-04 17:58:09 +02:00
Xenomporio b57362ecba Added tickets to CRM view in adresse minidetail 2022-08-04 17:15:11 +02:00
Xenomporio eed70bf673 Bugfix for email address handling in ticket system 2022-08-04 16:50:22 +02:00
Xenomporio fd076040c2 Ticket system default sorting by time 2022-08-03 18:08:32 +02:00
Xenomporio d5a85858bd Ticket System save timestamp on mass edit, new ticket with standard project 2022-08-03 17:43:45 +02:00
Xenomporio 93da199f12 Bugfix ticket system display and handling of recipients 2022-08-03 17:24:28 +02:00
Xenomporio 731f67a9b9 adresse included tickets in crm view 2022-08-02 17:04:58 +02:00
Xenomporio 67bad8d911 Bugfix Ticket System empty cc 2022-08-02 11:50:43 +02:00
Xenomporio 244d30faa9 Bugfix display of open tickets in sidebar 2022-08-01 22:56:28 +02:00
Xenomporio 3238206446 Ticket system rework of the recipients, cc organisation, mail display and more 2022-08-01 22:55:52 +02:00
Xenomporio 6e7e27d289 Ticket system stapelverarbeitung multi processing 2022-07-31 22:32:36 +02:00
Xenomporio 7ca19d7bac Ticket system tag functionality as well as sort/search bugfix 2022-07-31 21:45:38 +02:00
Xenomporio 11f9e7e24e Ticket system filters, notiz adding, time of last action 2022-07-31 18:23:43 +02:00
Xenomporio 3c540cf48a Ticket system minidetail 2022-07-30 14:29:02 +02:00
Xenomporio ecf45792d6 Ticket prio with checkbox and highlight 2022-07-30 13:36:18 +02:00
Xenomporio 7bbcdf206b Ticket system now with drafts and attachement of sent mails 2022-07-30 10:49:47 +02:00
Xenomporio a9c85b0c81 Ticket new message with draft 2022-07-29 14:45:16 +02:00
Xenomporio 11def529a3 Only one RE: when answering tickets 2022-07-27 21:26:59 +02:00
Xenomporio 7efbe5bd0b Changes regarding ticket incoming file attachments 2022-07-27 18:05:24 +02:00
Xenomporio b7f468e62d Added log to einstellungen 2022-07-26 18:38:12 +02:00
Xenomporio b5caed416a Ticket sending works now, attachments tbd 2022-07-26 18:37:54 +02:00
Xenomporio eed061776a Some improvements erpapi mail 2022-07-26 17:35:16 +02:00
Xenomporio a5be988a43 Ticketsystem reading of mails and import
Todo frontend details and sending. Also there is a no timestamp error at import on some mails (error returns e.g.)
2022-07-24 21:11:25 +02:00
Xenomporio 9b9e6d13c5 Storing sent mails to IMAP folder now works 2022-07-23 21:11:01 +02:00
Xenomporio a4449204b5 Ticket module primitive list view 2022-07-22 17:42:03 +02:00
Xenomporio 8a1bfda324 Added IMAP testing function to emailbackup accounts 2022-07-22 17:27:42 +02:00
Xenomporio 881267a00e Sendmail force html, IMAP folder simple implementation but wothout attachments. Also display of new tickets modifed 2022-07-22 17:17:12 +02:00
Xenomporio c6fe8a736b module creator extended to use short table alias 2022-07-22 11:55:58 +02:00
Xenomporio dbf5201c20 Reimplemented module ticket wartschlangen 2022-07-22 11:15:27 +02:00
Xenomporio 910a8544a4 Some frontend adaption for the ticket system 2022-07-22 11:15:15 +02:00
Xenomporio b2610079d6 Importing of tickets from email
Everything needed went into TicketImportHelper, with LegacyDB. Functions taken from TicketService, Gateway and AddressWrapper
2022-07-21 23:44:48 +02:00
Xenomporio 6cbc0bd08e cronjob tickets first version, processing tbd 2022-07-21 17:21:24 +02:00
45 changed files with 4988 additions and 2879 deletions
+10
View File
@@ -13,6 +13,16 @@ Xenomporio ist eine umfassende webbasierte Anwendung zur Abwicklung aller kaufm
* Aufgaben- und Terminverwaltung
* Zeitabrechnung
# Letzte Änderungen: Ticket System
Neu in [V.1.3](https://github.com/xenomporio-org/Xenomporio/releases/tag/V.1.3):
Neuimplementierung des Xentral 20 Enterprise Ticketsystems mit vielen Verbesserungen, z.B.:
- Anhänge werden auch bei ausgehenden Nachrichten gespeichert
- Verbesserte Kommentarfunktion
- Unterstützung mehrerer Empfänger und CC
- Verbesserte Stapelverarbeitung
# Installation
[Hier gehts zur Server Installation](SERVER_INSTALL.md)
@@ -70,6 +70,7 @@ class MailAttachmentData implements MailAttachmentInterface
throw new InvalidArgumentException('missing header: "Content-Disposition"');
}
$disposition = $dispositionHeader->getValue();
if (!preg_match('/(.+);\s*filename="([^"]+)".*$/m', $disposition, $matches)) {
throw new InvalidArgumentException(
sprintf('unexpected header value "Content-Disposition" = %s', $disposition)
@@ -77,6 +78,17 @@ class MailAttachmentData implements MailAttachmentInterface
}
$isInline = strtolower($matches[1]) === 'inline';
$filename = $matches[2];
// Thunderbird UTF URL-Format
$UTF_pos = strpos($filename,'UTF-8\'\'');
if ($UTF_pos !== false) {
$wasUTF = "JA";
$filename = substr($filename,$UTF_pos);
$filename = rawurldecode($filename);
}
$cid = null;
$contentIdHeader = $part->getHeader('content-id');
if ($contentIdHeader !== null) {
@@ -145,8 +145,11 @@ final class SystemMailer
$email = new EmailMessage($subject, $body, $recipients, $ccs, $bccs);
foreach ($attachFiles as $file) {
$this->logger->debug("Attaching file", ['filename' => $file]);
if ($file !== null && file_exists($file)) {
$email->addAttachment(new FileAttachment($file));
} else {
$this->logger->debug("Attaching file failed", ['filename' => $file]);
}
}
+611 -255
View File
@@ -14,9 +14,13 @@ use Xentral\Components\MailClient\Client\MailClientInterface;
use Xentral\Components\MailClient\Data\MailMessageInterface;
use Xentral\Modules\SystemMailer\Data\EmailBackupAccount;
use Xentral\Modules\Ticket\Importer\TicketFormatter;
use Xentral\Modules\Ticket\Exception\NumberGeneratorException;
use Xentral\Modules\Ticket\Exception\InvalidArgumentException;
/**
* Utility functions for tickets_google cronjob for improved testability
* Utility functions for tickets cronjob for improved testability
* This is used to create and update tickets from emailbackup, called by the tickets.php cronjob
* It uses the TicketService to process the tickets
*/
class TicketImportHelper
{
@@ -49,7 +53,7 @@ class TicketImportHelper
/**
* @param LegacyDataBase $db
* @param erpAPI $erpApi
* @param TicketModule $ticketModule
* @param TicketModule $ticketModule
* @param LegacyConfig $config
* @param TicketFormatter $formatter
* @param MailClientInterface $mailClient
@@ -76,6 +80,400 @@ class TicketImportHelper
$this->config = $config;
}
/* Function from AddressWrapper...
Still using legacy db
*/
public function tryGetAddressIdByEmailAddress(string $emailAddress): ?int
{
$searchByEmail = 'SELECT a.id FROM `adresse` AS `a`
WHERE a.email LIKE \''.$emailAddress.'\' AND a.geloescht = 0
ORDER BY a.id DESC';
$id = $this->db->Select($searchByEmail);
if ($id !== null && $id > 0) {
return (int) $id;
}
$searchByResponsePerson = 'SELECT ap.adresse FROM `ansprechpartner` AS `ap`
WHERE ap.email LIKE \''.$emailAddress.'\'
ORDER BY ap.id DESC';
$id = $this->db->Select($searchByResponsePerson);
if ($id !== null && $id > 0) {
return (int) $id;
}
$searchByContactInfo = 'SELECT ak.adresse FROM `adresse_kontakte` AS `ak`
WHERE ak.kontakt LIKE \''.$emailAddress.'\' ORDER BY ak.id DESC';
$id = $this->db->Select($searchByContactInfo);
return (int) $id;
}
/* Some functions taken from TicketService (sorry...) */
/**
* @param string $ticketNumber
*
* @return void
*/
public function markTicketMessagesCompleted(string $ticketNumber): void
{
$this->setTicketMessagesStatus($ticketNumber, 'abgeschlossen'); // TicketGateway::STATUS_COMPLETED);
}
/**
* @param string $ticketNumber
* @param string $status
*
* @return void
*/
private function setTicketMessagesStatus(string $ticketNumber, string $status): void
{
$sql = "UPDATE `ticket_nachricht` SET `status` = '".$status."' WHERE `ticket` = '".$ticketNumber."';";
$this->db->Update($sql);
}
/**
* @param string $ticketNumber
*
* @throws InvalidArgumentException
*
* @return void
*/
public function resetTicketStatus(string $ticketNumber): void
{
$this->ensureTicketNumberExists($ticketNumber);
$sql = "UPDATE `ticket` SET
`status` = 'neu',
`zugewiesen` = '0',
`inbearbeitung` = '0',
`zeit` = now()
WHERE `schluessel` LIKE '".$ticketNumber."'";
$this->db->Update($sql);
}
/**
* @param string $ticketNumber
*
* @return void
*/
public function updateTicketMessagesCount(string $ticketNumber): void
{
$this->ensureTicketNumberExists($ticketNumber);
$count = $this->getMessageCountByTicketNumber($ticketNumber);
$count++;
$sql = "UPDATE `ticket` SET `nachrichten_anz` = '".$count."' WHERE schluessel = '".$tickerNumber."';";
$this->db->Update($sql);
}
/**
* @param string $ticketNumber
*
* @return void
*/
private function ensureTicketNumberExists(string $ticketNumber): void
{
if ($ticketNumber == '') {
throw new InvalidArgumentException(
sprintf('ticket number empty')
);
}
if (!$this->db->Select('SELECT id FROM ticket WHERE schluessel = '.$ticketNumber)) {
throw new InvalidArgumentException(
sprintf('ticket number "%s" does not exist', $ticketNumber)
);
}
}
/**
* @throws NumberGeneratorException
*
* @return string
*/
private function generateRandomTicketNumber(): string
{
$random = rand(300,700);
$loopCounter = 0;
while(true) {
$candidate = sprintf('%s%04d', date('Ymd'), $random++);
/* if (!$this->gateway->existsTicketNumber($candidate)) {
return $candidate;
}*/
if (!$this->db->Select('SELECT id FROM ticket WHERE schluessel = '.$candidate)) {
return($candidate);
}
if ($loopCounter > 99) {
throw new NumberGeneratorException('ticket number generation failed');
}
$loopCounter++;
}
}
/* Functions from Gateway */
/**
* @param string $ticketNumber
*
* @return int
*/
public function getMessageCountByTicketNumber(string $ticketNumber): int
{
$sql = "SELECT COUNT(tm.id) FROM `ticket_nachricht` AS `tm` WHERE tm.ticket = '".$ticketNumber."';";
$count = $this->db->Select($sql);
if ($count === null) {
return 0;
}
return (int) $count;
}
/**
* @param string $recipientMail
* @param string $senderMail
* @param string $senderName
* @param string $subject
*
* @return array
*/
public function getTicketRules(
string $recipientMail,
string $senderMail,
string $senderName,
string $subject
): array {
/*
$sql = "SELECT
tr.spam AS `is_spam`,
tr.dsgvo AS `is_gdpr_relevant`,
tr.prio AS `priority`,
tr.persoenlich AS `is_private`,
tr.warteschlange AS `queue_id`
FROM `ticket_regeln` AS `tr`
WHERE
tr.aktiv = 1
AND (tr.empfaenger_email LIKE :source_email OR empfaenger_email = '')
AND (
tr.sender_email LIKE :sender_email
OR (tr.sender_email LIKE '@%' AND :sender_email LIKE CONCAT('%', tr.sender_email))
OR tr.sender_email = ''
)
AND (tr.name LIKE :sender_name OR tr.name = '')
AND (tr.betreff LIKE :subject OR tr.betreff = '')";
$values = [
'source_email' => $recipientMail,
'sender_email' => $senderMail,
'sender_name' => $senderName,
'subject' => $subject,
];
return $this->db->fetchAll($sql, $values);
*/
// Legacy DB implementation:
$sql = "SELECT
tr.id,
tr.spam AS `is_spam`,
tr.dsgvo AS `is_gdpr_relevant`,
tr.prio AS `priority`,
tr.persoenlich AS `is_private`,
tr.warteschlange AS `queue_id`
FROM `ticket_regeln` AS `tr`
WHERE
tr.aktiv = 1
AND ('".$recipientMail."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '')
AND ('".$senderMail."' LIKE tr.sender_email OR tr.sender_email = '')
AND ('".$senderMail."' LIKE tr.name OR tr.name = '')
AND ('".$subject."' LIKE tr.betreff OR tr.betreff = '')";
$this->logger->debug('ticket rule',['sql' => $sql]);
$result = $this->db->SelectArr($sql);
if ($result != null) {
$this->logger->debug('ticket rules',['count',count($result)]);
return ($result);
} else {
$this->logger->debug('no ticket rules applicable',['']);
return(array());
}
}
/* END Functions from Gateway */
public function createTicket(
int $projectId,
string $senderName,
string $senderAddress,
string $subject,
int $timestamp,
string $replyToName,
string $replyToAddress
): string
{
$AddressId = $this->tryGetAddressIdByEmailAddress($senderAddress);
$ticketNumber = $this->generateRandomTicketNumber();
if($projectId < 1) {
$projectId = $this->mailAccount->getProjectId();
}
if ($this->mailAccount->isTicketMarkAsFinishedEnabled()) {
$status = 'abgeschlossen'; //TicketGateway::STATUS_COMPLETED;
} else {
$status = 'neu'; //TicketGateway::STATUS_NEW;
}
$queue_id = $this->mailAccount->getTicketQueueId();
if (!empty($queue_id)) {
$queue_label = $this->db->Select("SELECT label FROM warteschlangen WHERE id = ".$queue_id." LIMIT 1");
}
$insertTicket = "INSERT INTO `ticket` (
`schluessel`, `zeit`, `projekt`, `quelle`, `status`, `kunde`,
`mailadresse`, `prio`, `betreff`,`warteschlange`,`adresse`
) VALUES (
'".$ticketNumber."',
'".date('Y-m-d H:i:s', $timestamp)."',
'".$projectId."',
'".$this->mailAccount->getEmailAddress()."',
'".$status."',
'".$senderName."',
'".$senderAddress."',
'".'3'."',
'".$subject."',
'".$queue_label."',
'".$AddressId."');";
$this->db->Insert($insertTicket);
$ticketId = $this->db->GetInsertID();
$this->logger->debug('inserted ticket',['id' => $ticketId,'ticketnr' => $ticketNumber, 'projekt' => $projectId, 'warteschlange' => $this->mailAccount->getTicketQueueId(), 'adresse' => $AddressId]);
// todo als rueckgabe ticketnachricht
return $ticketNumber;
}
public function addTicketMessage(
string $ticketNumber,
int $timestamp,
string $message,
string $subject,
string $senderName,
string $senderAddress,
string $status,
string $replyToName,
string $replyToAddress
): int
{
// $this->db->beginTransaction();
try {
$sql = "INSERT INTO `ticket_nachricht` (
`ticket`, `zeit`, `text`, `betreff`, `medium`,
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`
) VALUES (
'".$ticketNumber."',
'".date('Y-m-d H:i:s', $timestamp)."',
'".$message."',
'".$subject."',
'".'email'."',
'".$senderName."',
'".$senderAddress."',
'".$status."',
'".$replyToName."',
'".$replyToAddress."');";
$this->logger->debug('database insert',['query' => $sql]);
$this->db->Insert($sql);
$messageId = $this->db->GetInsertID();
$this->logger->debug('inserted',['id' => $messageId, 'schluessel' => $ticketNumber]);
$this->updateTicketMessagesCount($ticketNumber);
$this->resetTicketStatus($ticketNumber);
// $this->db->commit();
$result = $messageId;
$this->markTicketMessagesCompleted($ticketNumber);
} catch (Throwable $e) {
// $this->db->rollBack();
$result = 0;
$this->logger->error('Failed to insert ticket message into db', ['exception' => $e]);
}
$this->applyTicketRules($messageId);
return($result);
}
public function applyTicketRules(int $ticketMessageId): void
{
/* $ticketData = $this->gateway->tryGetTicketDataByByMessage($ticketMessageId); */
$ticketData = $this->db->SelectArr("SELECT t.id, tn.mail as sender_email, tn.verfasser as sender_name, tn.betreff as subject, t.quelle as source_email FROM ticket t INNER JOIN ticket_nachricht tn ON tn.ticket = t.schluessel WHERE tn.id = '".$ticketMessageId."'")[0];
if ($ticketData === null) {
throw new InvalidArgumentException('cannot find ticket by message id');
}
$ticketId = $ticketData['id'];
$senderMail = $ticketData['sender_email'];
$senderName = $ticketData['sender_name'];
$subject = $ticketData['subject'];
$source = $ticketData['source_email'];
$this->logger->debug('check ticket rules',['tn_id' => $ticketMessageId, 'sender_email' => $senderMail, 'subject' => $subject]);
//TODO: richtig loggen: $this->app->erp->LogFile("Empfaengermail: $quelle Sendermail: $mailadresse Kunde: $kunde Betreff: $betreff");
$ruleArray = $this->getTicketRules($source, $senderMail, $senderName, $subject);
if (empty($ruleArray)) {
return;
}
foreach ($ruleArray as $rule) {
$this->logger->debug('ticket rule applies',['rule_id' => $rule['id']]);
/*
$update = $this->db->update();
$update->table('ticket');
if ($rule['is_spam'] === 1) {
$update->set('inbearbeitung', 0);
$update->set('zugewiesen', 1);
$this->db->perform(
'UPDATE `ticket_nachricht` SET `status` = :status WHERE `ticket` = :ticket_id',
['status' => TicketGateway::STATUS_SPAM, 'ticket_id' => $ticketId]
);
}
$update->set('dsgvo', $rule['is_gdpr_relevant']);
$update->set('privat', $rule['is_private'] );
$update->set('prio', $rule['priority'] );
$update->where('id = :ticket_id');
$sql = $update->getStatement();
$this->db->perform($sql, ['ticket_id' => $ticketId]);
*/
if ($rule['is_spam'] === 1) {
$sql = "UPDATE `ticket_nachricht` SET `status` = \'spam\' WHERE `id` = '".$ticketMessageId."'";
$this->db->Update($sql);
}
$sql = "UPDATE `ticket` SET `dsgvo` = '".$rule['is_gdpr_relevant']."', `privat` = '".$rule['is_private']."', `prio` = '".$rule['priority']."', `warteschlange` = '".$rule['queue_id']."' WHERE `id` = '".$ticketId."'";
$this->db->Update($sql);
}
}
/* End TicketService */
/**
* @param array $inboxMessageIds
*
@@ -92,6 +490,9 @@ class TicketImportHelper
continue;
}
try {
$this->logger->debug('Start import', ['message' => $message->getSubject()]);
$this->importMessage($message);
$insertedMailsCount++;
if ($this->mailAccount->isDeleteAfterImportEnabled()) {
@@ -125,6 +526,7 @@ class TicketImportHelper
// extract email data
$subject = $this->formatter->encodeToUtf8($message->getSubject());
$from = $this->formatter->encodeToUtf8($message->getSender()->getEmail());
$fromname = $this->formatter->encodeToUtf8($message->getSender()->getName());
$ccs = $message->getCcRecipients();
$cc_recv = [];
foreach ($ccs as $cc) {
@@ -146,14 +548,16 @@ class TicketImportHelper
if (strlen($action_html) < strlen($action)) {
$action_html = nl2br($action);
}
$name_sender = $this->formatter->encodeToUtf8($message->getSender()->getName());
$mail_replyto = $this->formatter->encodeToUtf8($message->getReplyToAddress());
$verfasser_replyto = $this->formatter->encodeToUtf8($message->getSender()->getName());
//check if email exists in database
$date = $message->getDate();
$timestamp = $date->getTimestamp();
$frommd5 = md5($from . $subject . $timestamp);
if (is_null($date)) { // This should not be happening -> Todo check getDate function
$this->logger->debug('Null date',['subject' => $message->getSubject()]);
$frommd5 = md5($from . $subject);
} else {
$timestamp = $date->getTimestamp();
$frommd5 = md5($from . $subject . $timestamp);
}
$empfang = $date->format('Y-m-d H:i:s');
$sql = "SELECT COUNT(id)
FROM `emailbackup_mails`
@@ -161,7 +565,13 @@ class TicketImportHelper
AND `empfang`='$empfang'
AND `webmail`='" . $this->mailAccount->getId() . "'";
$this->logger->debug('Importing message '.$from.' '.$fromname);
if ($this->db->Select($sql) == 0) {
$this->logger->debug('Importing message',['']);
$attachments = $message->getAttachments();
$anhang = count($attachments) > 0 ? 1 : 0;
$mailacc = $this->mailAccount->getEmailAddress();
@@ -201,291 +611,237 @@ class TicketImportHelper
$this->db->InsertWithoutLog($sql);
$id = $this->db->GetInsertID();
}
}
if ($DEBUG) {
echo "ticket suchen oder anlegen\n";
}
if ($DEBUG) {
echo "ticket suchen oder anlegen\n";
}
$ticketNumber = null;
$ticketexists = null;
if (preg_match("/Ticket #[0-9]{12}/i", $subject, $matches)) {
$ticketNumber = str_replace('Ticket #', '', $matches[0]);
$ticketexists = $this->db->Select(
"SELECT schluessel
FROM ticket
WHERE schluessel LIKE '" . $ticketNumber . "'
AND schluessel!='' LIMIT 1"
);
}
$ticketnachricht = null;
$_schluessel = null;
$schluessel = null;
$ticketexits = null;
if (preg_match("/Ticket #[0-9]{12}/i", $subject, $matches)) {
$schluessel = str_replace('Ticket #', '', $matches[0]);
$ticketexits = $this->db->Select(
"SELECT schluessel
FROM ticket
WHERE schluessel LIKE '" . $schluessel . "'
AND schluessel!='' LIMIT 1"
);
}
$ticketnachricht = null;
if ($ticketexits) {
if ($DEBUG) {
echo "ticket nummer in betreff gefunden\n";
}
if (!$ticketexists) {
$schluessel = str_replace('Ticket #', '', $matches[0]);
$this->logger->debug('New ticket',['']);
if ($action_html != '') {
$sql = "INSERT INTO `ticket_nachricht`
(
`id`,
`ticket`,
`zeit`,
`text`,
`betreff`,
`medium`,
`verfasser`,
`mail`,
`status`,
`verfasser_replyto`,
`mail_replyto`
) VALUES (
NULL,
'$schluessel',
FROM_UNIXTIME($timestamp),
'" . $this->db->real_escape_string($action_html) . "',
'" . $this->db->real_escape_string($subject) . "',
'email',
'" . $this->db->real_escape_string($name_sender) . "',
'" . $this->db->real_escape_string($from) . "',
'neu',
'" . $this->db->real_escape_string($verfasser_replyto) . "',
'" . $this->db->real_escape_string($mail_replyto) . "'
);";
} else {
$sql = "INSERT INTO `ticket_nachricht`
(
`id`,
`ticket`,
`zeit`,
`text`,
`betreff`,
`medium`,
`verfasser`,
`mail`,
`status`,
`verfasser_replyto`,
`mail_replyto`
) VALUES (
NULL,
'$schluessel',
FROM_UNIXTIME($timestamp),
'" . $this->db->real_escape_string($action) . "',
'" . $this->db->real_escape_string($subject) . "',
'email',
'" . $this->db->real_escape_string($name_sender) . "',
'" . $this->db->real_escape_string($from) . "',
'neu',
'" . $this->db->real_escape_string($verfasser_replyto) . "',
'" . $this->db->real_escape_string($mail_replyto) . "'
);";
}
$ticketNumber = $this->createTicket(
$this->projectId,
$fromname,
$from,
$subject,
$timestamp,
$fromname,
$from
);
} else {
$this->logger->debug('Add message to existing ticket',['ticketnummer' => $ticketNumber]);
}
// Add message to new or existing ticket
$ticketnachricht = $this->addTicketMessage(
(string) $ticketNumber,
$timestamp,
$action_html, //?
$subject,
$fromname,
$from,
'neu',
$fromname,
$from
);
if ($ticketnachricht > 0 && $id > 0) {
$this->db->Update(
"UPDATE `emailbackup_mails`
SET ticketnachricht='$ticketnachricht'
WHERE id='$id' LIMIT 1"
);
if (!$DEBUG) {
$this->db->InsertWithoutLog(
"UPDATE ticket_nachricht
SET status = 'abgeschlossen'
WHERE ticket LIKE '$schluessel'"
);
$this->db->InsertWithoutLog($sql);
$ticketnachricht = $this->db->GetInsertID();
$this->db->InsertWithoutLog(
"UPDATE ticket
SET status='neu', zugewiesen = 0, inbearbeitung=0
WHERE schluessel LIKE '$schluessel'"
);
$this->db->Update(
"UPDATE `ticket` AS `t`
INNER JOIN (
SELECT COUNT(`id`) AS `co`, `ticket`
FROM `ticket_nachricht`
GROUP BY `ticket`
) AS `tn` ON t.schluessel = tn.ticket
SET t.nachrichten_anz = tn.co
WHERE t.schluessel = '$schluessel'"
);
}
} else {
if (!$DEBUG) {
if ($action_html != '') {
$ticketnachricht = $this->ticketModule->CreateTicket(
$this->projectId,
$mailacc,
$name_sender,
$from,
$subject,
$action_html,
$timestamp,
"email",
null,
$verfasser_replyto,
$mail_replyto
); // ACHTUNG immer Projekt eprooshop
// Add all the ccs to the header table
if (is_array($cc_recv)) {
foreach ($cc_recv as $mail) {
if ($mail['name'] != '') {
$cc_value =
$this->db->real_escape_string($mail['name'])
. ' <'
. $this->db->real_escape_string($mail['email'])
. ">";
} else {
$ticketnachricht = $this->ticketModule->CreateTicket(
$this->projectId,
$mailacc,
$name_sender,
$from,
$subject,
$action,
$timestamp,
"email",
null,
$verfasser_replyto,
$mail_replyto
); // ACHTUNG immer Projekt eprooshop
$cc_value = $this->db->real_escape_string($mail['email']);
}
if ($cc_value != '') {
$sql = "INSERT INTO ticket_header
(`id`,`ticket_nachricht`,`type`,`value`)
VALUES
('', '$ticketnachricht', 'cc', '" . $cc_value . "')";
$this->db->InsertWithoutLog($sql);
}
$schluessel = $this->db->Select(
"SELECT `ticket`
FROM `ticket_nachricht`
WHERE `id`='$ticketnachricht' LIMIT 1"
);
} else {
echo "Lege neues Ticket an\n";
}
$cc_recv = [];
}
if ($ticketnachricht > 0 && $id > 0) {
$this->db->Update(
"UPDATE `emailbackup_mails`
SET ticketnachricht='$ticketnachricht'
WHERE id='$id' LIMIT 1"
);
if (is_array($cc_recv)) {
foreach ($cc_recv as $mail) {
if ($mail['name'] != '') {
$cc_value =
$this->db->real_escape_string($mail['name'])
. ' <'
. $this->db->real_escape_string($mail['email'])
. ">";
} else {
$cc_value = $this->db->real_escape_string($mail['email']);
}
if ($cc_value != '') {
$sql = "INSERT INTO ticket_header
(`id`,`ticket_nachricht`,`type`,`value`)
VALUES
('', '$ticketnachricht', 'cc', '" . $cc_value . "')";
$this->db->InsertWithoutLog($sql);
}
$this->logger->debug('Add recipients to header',['count' => count($message->getRecipients())]);
// Add all the recipients to the header table
if (count($message->getRecipients()) > 0) {
foreach ($message->getRecipients() as $recipient) {
$recipient_address = $this->db->real_escape_string($recipient->getEmail());
$this->logger->debug('Add recipient to header',['address' => $recipient_address]);
if ($recipient_address != '') {
$sql = "INSERT INTO ticket_header
(`id`,`ticket_nachricht`,`type`,`value`)
VALUES
('', '$ticketnachricht', 'to', '" . $recipient_address . "')";
$this->db->InsertWithoutLog($sql);
}
$cc_recv = [];
}
}
}
// Prüfen ob Ordner vorhanden ansonsten anlegen
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id";
if (!is_dir($ordner) && $id > 0) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
}
$raw_full_email = $message->getRawContent();
file_put_contents($ordner . '/mail.txt', $raw_full_email);
}
//speichere anhang als datei
if ($anhang == 1 && $id > 0) {
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname;
if (!is_dir($ordner)) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
}
}
// Prüfen ob Ordner vorhanden ansonsten anlegen
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id";
if (!is_dir($ordner) && $id > 0) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
}
$raw_full_email = $message->getRawContent();
file_put_contents($ordner . '/mail.txt', $raw_full_email);
}
//speichere anhang als datei
if ($anhang == 1 && $id > 0) {
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname;
if (!is_dir($ordner)) {
if (!is_dir($ordner)) {
if ($DEBUG) {
echo "mkdir $ordner\n";
} else {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
}
}
// Prüfen ob Ordner vorhanden ansonsten anlegen
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id";
if (!is_dir($ordner)) {
}
$this->logger->debug('Add attachments',['ticketnummer' => $ticketNumber, 'nachricht' => $ticketnachricht, 'count' => count($attachments)]);
foreach ($attachments as $attachment) {
if ($attachment->getFileName() !== '') {
if ($DEBUG) {
echo "mkdir $ordner\n";
} else {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
if ($handle) {
fwrite($handle, $attachment->getContent());
fclose($handle);
}
}
}
//Schreibe Anhänge in Datei-Tabelle
$datei = $ordner . '/' . $attachment->getFileName();
$dateiname = $attachment->getFileName();
foreach ($attachments as $attachment) {
if ($attachment->getFileName() !== '') {
if ($DEBUG) {
} else {
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
if ($handle) {
fwrite($handle, $attachment->getContent());
fclose($handle);
}
}
//Schreibe Anhänge in Datei-Tabelle
$datei = $ordner . '/' . $attachment->getFileName();
$dateiname = $attachment->getFileName();
if (stripos($dateiname, '=?utf-8') !== false) {
$dateiname = $this->formatter->encodeToUtf8($dateiname);
$dateiname = htmlspecialchars_decode($dateiname);
}
if (stripos($dateiname, '=?iso-8859') !== false) {
$dateiname = $this->formatter->encodeToUtf8($dateiname);
$dateiname = htmlspecialchars_decode($dateiname);
}
$this->logger->debug("Attachment", ['filename' => $dateiname]);
if ($DEBUG) {
echo "CreateDatei($dateiname,{$dateiname},\"\",\"\",\"datei\",\"Support Mail\",true,"
. $this->config->WFuserdata . "/dms/" . $this->config->WFdbname . ")\n";
} else {
$tmpid = $this->erpApi->CreateDatei(
$dateiname,
$dateiname,
'',
'',
$datei,
'Support Mail',
true,
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname
);
}
if (stripos(strtoupper($dateiname), '=?UTF-8') !== false) {
$dateiname = $this->formatter->encodeToUtf8($dateiname);
$dateiname = htmlspecialchars_decode($dateiname);
}
if (stripos(strtoupper($dateiname), '=?ISO-8859') !== false) {
$dateiname = $this->formatter->encodeToUtf8($dateiname);
$dateiname = htmlspecialchars_decode($dateiname);
}
if (stripos(strtoupper($dateiname), 'UTF-8\'\'') === 0) {
$dateiname = $this->formatter->encodeToUtf8(urldecode(substr($dateiname,7)));
$dateiname = htmlspecialchars_decode($dateiname);
}
if ($DEBUG) {
echo "AddDateiStichwort $tmpid,'Anhang','Ticket',$ticketnachricht,true)\n";
} else {
$this->erpApi->AddDateiStichwort(
$tmpid,
'Anhang',
'Ticket',
$ticketnachricht,
true
);
}
$this->logger->debug("Attachment cleaned", ['filename' => $dateiname]);
if ($DEBUG) {
echo "CreateDatei($dateiname,{$dateiname},\"\",\"\",\"datei\",\"Support Mail\",true,"
. $this->config->WFuserdata . "/dms/" . $this->config->WFdbname . ")\n";
} else {
$tmpid = $this->erpApi->CreateDatei(
$dateiname,
$dateiname,
'',
'',
$datei,
'Support Mail',
true,
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname
);
}
if ($DEBUG) {
echo "AddDateiStichwort $tmpid,'Anhang','Ticket',$ticketnachricht,true)\n";
} else {
$this->logger->debug('Add attachment',['ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
$this->erpApi->AddDateiStichwort(
$tmpid,
'Anhang',
'Ticket',
$ticketnachricht,
true
);
}
}
}
}
if (
$this->mailAccount->isAutoresponseEnabled()
&& $this->mailAccount->getAutoresponseText() !== ''
&& (
$this->erpApi->AutoresponderBlacklist($from) !== 1
|| $this->mailAccount->isAutoresponseLimitEnabled() === false
)
) {
$text = $this->mailAccount->getAutoresponseText();
$betreff = $this->mailAccount->getAutoresponseSubject();
$text = str_replace('{TICKET}', $schluessel, $text);
if (empty($text)) $text = '';
if (empty($betreff)) $betreff = '';
$text = str_replace('{TICKET}', $ticketNumber, $text);
$text = str_replace('{BETREFF}', $subject, $text);
$betreff = str_replace('{TICKET}', $schluessel, $betreff);
$betreff = str_replace('{TICKET}', $ticketNumber, $betreff);
$betreff = str_replace('{BETREFF}', $subject, $betreff);
if (
$this->mailAccount->isAutoresponseEnabled()
&& $this->mailAccount->getAutoresponseText() !== ''
&& (
$this->erpApi->AutoresponderBlacklist($from) !== 1
|| $this->mailAccount->isAutoresponseLimitEnabled() === false
)
) {
if (!$this->erpApi->isHTML($text)) {
$text = str_replace("\r\n", '<br>', $text);
}
$this->erpApi->MailSend(
$this->mailAccount->getSenderEmailAddress(),
'',
$from,
$name_sender,
$betreff,
$text
);
if (!$this->erpApi->isHTML($text)) {
$text = str_replace("\r\n", '<br>', $text);
}
$this->erpApi->MailSend(
$this->mailAccount->getSenderEmailAddress(),
'',
$from,
$name_sender,
$betreff,
$text
);
}
}
}
}
+6 -47
View File
@@ -14,15 +14,14 @@ use Xentral\Modules\Ticket\Task\TicketImportHelperFactory;
$DEBUG = 0;
/*
$debugfile = "/var/www/html/Xenomporio/debug.txt";
function file_append($filename,$text) {
$oldtext = file_get_contents($filename);
file_put_contents($filename,$oldtext.$text);
}
file_put_contents($debugfile,"0");
*/
/** @var ApplicationCore $app */
@@ -43,9 +42,6 @@ if($mutex){
SET `mutexcounter`=`mutexcounter`+1
WHERE `mutex` = 1 AND (`parameter` = '".$cronjobname."')"
);
file_append($debugfile,"MUTEX");
return;
}
$app->DB->Update(
@@ -58,9 +54,6 @@ $app->DB->Update(
$accountGateway = $app->Container->get('EmailAccountGateway');
$accounts = $accountGateway->getAccountsWithTicketActive();
file_append($debugfile,"Accs:".count($accounts).";");
// only load services if there is at least one account to import (performance)
$ticketModule = null;
$factory = null;
@@ -86,51 +79,28 @@ foreach ($accounts as $account) {
'Start imap ticket import for {email}',
['email' => $account->getEmailAddress(), 'account' => $account]
);
file_append($debugfile,"Account ".$account->getemailAddress());
// create mail client
try {
$mailConfig = $configProvider->createImapConfigFromAccount($account);
$mailClient = $factory->createImapClient($mailConfig);
} catch (Exception $e) {
$logger->error('Failed to create email client', ['error' => (string)$e, 'account' => $account]);
file_append($debugfile,"Failed 1");
continue;
}
file_append($debugfile,"Connect to ".."SSL: ".$configProvider->isSslEnabled()." auth ".getAuthType()."\n");
// connect mail client
try {
try {
$mailClient->connect();
file_append($debugfile,"Meh");
$mailClient->connect();
} catch (Exception $e) {
$logger->error('Error during imap connection', ['error' => (string)$e, 'account' => $account]);
file_append($debugfile,"Error ".(string)$e);
continue;
}
$logger->error('Error during imap connection', ['error' => (string)$e, 'account' => $account]);
continue;
}
file_append($debugfile,"2");
// connet to INBOX folder
try {
$mailClient->selectFolder('INBOX');
} catch (Exception $e) {
$logger->error('Failed to select INBOX folder', ['error' => (string)$e, 'account' => $account]);
file_append($debugfile,"Failed 2");
continue;
}
@@ -147,17 +117,11 @@ foreach ($accounts as $account) {
$criteria = 'UNSEEN';
}
file_append($debugfile,"3");
// search new messages
try {
$searchResult = $mailClient->searchMessages($criteria);
} catch (Exception $e) {
$logger->error('Error during imap search', ['exception' => $e]);
file_append($debugfile,"Failed 3");
continue;
}
$logger->debug('unread emails to import: {message_count}', ['message_count' => count($searchResult)]);
@@ -171,7 +135,7 @@ foreach ($accounts as $account) {
);
}
$importer = $importHelperFactory->create($mailClient, $account, $projectId);
$insertedMailsCount = $importer->importMessages($searchResult);
$insertedMailsCount = $importer->importMessages($searchResult); // TicketImportHelper->importMessages()
$totalEmailsImportCount += $insertedMailsCount;
// set mutex if the total amount of imported emails is more than 10
@@ -192,10 +156,6 @@ foreach ($accounts as $account) {
) {
$logger->error('Tickets error');
file_append($debugfile,"Failed 5");
return;
}
$app->DB->Update(
@@ -209,4 +169,3 @@ $app->DB->Update(
"UPDATE `prozessstarter` SET `mutex`=0,`mutexcounter`=0 WHERE (`parameter` = '".$cronjobname."')"
);
file_append($debugfile,"END");
+5 -5
View File
@@ -14355,16 +14355,16 @@ CREATE TABLE IF NOT EXISTS `ticket_nachricht` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ticket` varchar(255) NOT NULL,
`verfasser` varchar(255) NOT NULL,
`bearbeiter` varchar(255) NOT NULL,
`bearbeiter` varchar(255) NOT NULL DEFAULT '',
`mail` varchar(255) NOT NULL,
`zeit` datetime NOT NULL,
`zeitausgang` datetime NOT NULL,
`zeitausgang` datetime NULL,
`text` longtext NOT NULL,
`textausgang` longtext NOT NULL,
`textausgang` longtext NOT NULL DEFAULT '',
`betreff` varchar(255) NOT NULL,
`bemerkung` text NOT NULL,
`bemerkung` text NOT NULL DEFAULT '',
`medium` varchar(255) NOT NULL,
`versendet` varchar(255) NOT NULL,
`versendet` varchar(255) NOT NULL DEFAULT '',
`status` varchar(64) NOT NULL,
`mail_cc` varchar(128) NOT NULL DEFAULT '',
`verfasser_replyto` varchar(255) NOT NULL,
+1
View File
@@ -0,0 +1 @@
f64f6f64cbe6499f4060a487603626a6d712a484
+1206 -1198
View File
File diff suppressed because it is too large Load Diff
+83 -48
View File
@@ -9459,64 +9459,90 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
';
if($this->app->erp->RechteVorhanden('wiedervorlage','list')){
if($this->app->erp->GetKonfiguration('adresse_crm_collateerror') && method_exists($this,'ConvertLatin1UTF'))
{
$sql .= '
UNION ALL
UNION ALL
(
SELECT
w.id,"<img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/details_open.png class=details>" as open,
CONCAT(DATE_FORMAT(datum_erinnerung, "%Y-%m-%d"), " ", IF(zeit_erinnerung IS NULL OR DATE_FORMAT(zeit_erinnerung, "%H:%i")="00:00", "", DATE_FORMAT(zeit_erinnerung, "%H:%i")) ) as datum,
'. $this->ConvertLatin1UTF('w.bezeichnung').' as title,\'\' as ansprechpartner,
'. $this->ConvertLatin1UTF('p.abkuerzung').' as abkuerzung,
adr.name COLLATE utf8_general_ci as bearbeiter,
CONCAT("Wiedervorlage") as art,
CONCAT("<a data-type=wiedervorlage data-id=", w.id, "></a>") as gesendet,
"" as pdf,
concat("5","-",w.id) as did,'. $this->ConvertLatin1UTF('w.beschreibung').' as suchtext,\'\' as internebezeichnung
FROM
wiedervorlage w left join adresse adr on w.bearbeiter = adr.id
LEFT JOIN projekt p ON p.id=w.projekt
WHERE
w.adresse = ' . $adresseId . '
)';
}else{
(
SELECT
w.id,"<img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/details_open.png class=details>" as open,
CONCAT(DATE_FORMAT(datum_erinnerung, "%Y-%m-%d"), " ", IF(zeit_erinnerung IS NULL OR DATE_FORMAT(zeit_erinnerung, "%H:%i")="00:00", "", DATE_FORMAT(zeit_erinnerung, "%H:%i")) ) as datum,
'. $this->ConvertLatin1UTF('w.bezeichnung').' as title,\'\' as ansprechpartner,
'. $this->ConvertLatin1UTF('p.abkuerzung').' as abkuerzung,
adr.name COLLATE utf8_general_ci as bearbeiter,
CONCAT("Wiedervorlage") as art,
CONCAT("<a data-type=wiedervorlage data-id=", w.id, "></a>") as gesendet,
"" as pdf,
concat("5","-",w.id) as did,'. $this->ConvertLatin1UTF('w.beschreibung').' as suchtext,\'\' as internebezeichnung
FROM
wiedervorlage w left join adresse adr on w.bearbeiter = adr.id
LEFT JOIN projekt p ON p.id=w.projekt
WHERE
w.adresse = ' . $adresseId . '
)';
} else {
$sql .= '
UNION ALL
UNION ALL
(
SELECT
w.id,"<img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/details_open.png class=details>" as open,
CONCAT(DATE_FORMAT(datum_erinnerung, "%Y-%m-%d"), " ", IF(zeit_erinnerung IS NULL OR DATE_FORMAT(zeit_erinnerung, "%H:%i")="00:00", "", DATE_FORMAT(zeit_erinnerung, "%H:%i")) ) as datum,
w.bezeichnung COLLATE utf8_general_ci as title,\'\' as ansprechpartner,
p.abkuerzung COLLATE utf8_general_ci as abkuerzung,
adr.name COLLATE utf8_general_ci as bearbeiter,
CONCAT("Wiedervorlage") as art,
CONCAT("<a data-type=wiedervorlage data-id=", w.id, "></a>") as gesendet,
"" as pdf,
concat("5","-",w.id) as did,w.beschreibung COLLATE utf8_general_ci as suchtext,\'\' as internebezeichnung
FROM
wiedervorlage w left join adresse adr on w.bearbeiter = adr.id
LEFT JOIN projekt p ON p.id=w.projekt
WHERE
w.adresse = ' . $adresseId . '
)';
(
SELECT
w.id,
"<img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/details_open.png class=details>" as open,
CONCAT(DATE_FORMAT(datum_erinnerung, "%Y-%m-%d"), " ", IF(zeit_erinnerung IS NULL OR DATE_FORMAT(zeit_erinnerung, "%H:%i")="00:00", "", DATE_FORMAT(zeit_erinnerung, "%H:%i")) ) as datum,
w.bezeichnung COLLATE utf8_general_ci as title,
\'\' as ansprechpartner,
p.abkuerzung COLLATE utf8_general_ci as abkuerzung,
adr.name COLLATE utf8_general_ci as bearbeiter,
CONCAT("Wiedervorlage") as art,
CONCAT("<a data-type=wiedervorlage data-id=", w.id, "></a>") as gesendet,
"" as pdf,
concat("5","-",w.id) as did,
w.beschreibung COLLATE utf8_general_ci as suchtext,
\'\' as internebezeichnung
FROM
wiedervorlage w left join adresse adr on w.bearbeiter = adr.id
LEFT JOIN projekt p ON p.id=w.projekt
WHERE
w.adresse = ' . $adresseId . '
)';
}
}
$sql .='
) a
';
} // RechteVorhanden wiedervorlage
$sql .= 'UNION ALL
(
SELECT
t.id,
"<img src=./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/details_open.png class=details>" as open,
tn.zeit,
tn.betreff,
ifnull((SELECT name FROM ansprechpartner ap WHERE ap.adresse = a.id AND ap.email = tn.mail LIMIT 1),tn.mail) as ansprechpartner,
p.abkuerzung,
tn.verfasser,
\'Ticketnachricht\' as art,
CONCAT(IF(tn.versendet = 1, "JA", "NEIN"),"<a data-type=ticket_nachricht data-id=", t.id, "></a>") as gesendet,
\'\' as PDF,
concat("4","-",tn.id) as did,
CONCAT(tn.text,t.notiz) as suchtext,
\'\' as intern
FROM
ticket_nachricht tn
INNER JOIN ticket t ON
tn.ticket = t.schluessel
INNER JOIN adresse a ON t.adresse = a.id
LEFT JOIN projekt p on t.projekt = p.id
WHERE t.adresse = '.$adresseId.' AND !(tn.versendet = 1 AND tn.zeitausgang IS NULL)
)
';
$sql .= ') a ';
$moreinfo = true;
$doppelteids = true;
$moreinfoaction = 'brief';
$menucol = 9;
$more_data1 = $this->app->Secure->GetGET("more_data1");
$more_data2 = $this->app->Secure->GetGET("more_data2");
$more_data3 = $this->app->Secure->GetGET("more_data3");
@@ -9531,12 +9557,18 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
if ($more_data1 == 1) {
$subWhereConditions[] = 'art LIKE "brief%"';
}
if ($more_data2 == 1) {
$subWhereConditions[] = 'art LIKE "email"';
}
if ($more_data3 == 1) {
$subWhereConditions[] = 'art LIKE "telefon"';
}
if ($more_data4 == 1) {
$subWhereConditions[] = 'art LIKE "notiz"';
}
if ($more_data5 == 1) {
$subWhereConditions[] = 'art LIKE "ticket%"';
}
if ($more_data10 == 1) {
$subWhereConditions[] = 'art LIKE "wiedervorlage"';
}
@@ -12213,7 +12245,7 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
}
return str_replace($replace, $new, $sql);
}
function AutoCompleteBestellung($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
$module = $this->app->Secure->GetGET("module");
@@ -12243,7 +12275,7 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . '"
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
function AutoCompleteAddCut($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
@@ -12296,6 +12328,7 @@ return false;
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
function AutoCompleteAdd($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
@@ -12350,7 +12383,8 @@ return false;
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
function AutoCompleteAddEvent($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
if ($onlyfirst) {
$tpl = '
@@ -12367,7 +12401,8 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
function AutoCompleteJSON($fieldname, $filter, $onlyfirst = 0, $extendurl = "", $extendedelement = "", $extendurl2 ="", $extendedelement2 = "", $appendto = "", $return = false)
{
if($extendedelement)
+7 -1
View File
@@ -52,6 +52,7 @@ if ($argc >= 2) {
$template_edit_file_name = $module_name . "_edit.tpl";
$target_php_folder = "../../www/pages/";
$target_tpl_folder = "../../www/pages/content/";
$table_short_name = substr($module_name,0,1);
if (!$force && file_exists($target_php_folder.$php_file_name)) {
echo("File exists: ." .$target_php_folder.$php_file_name . "\n");
@@ -82,6 +83,7 @@ if ($argc >= 2) {
}
$columns = array();
$sql_columns = array();
$edit_form = "";
/* Iterate through the result set */
@@ -96,6 +98,7 @@ if ($argc >= 2) {
if ($value != 'id') {
$columns[] = $value;
$sql_columns[] = $table_short_name.".".$value;
}
break;
@@ -126,6 +129,8 @@ if ($argc >= 2) {
$list_of_columns = implode(', ', $columns);
$list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'";
$sql_list_of_columns = implode(', ', $sql_columns);
$sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'";
$get_input = "";
$set_input = "";
@@ -147,11 +152,12 @@ if ($argc >= 2) {
$php_file_contents = str_replace('PLACEHOLDER_LIST', $module_name . "_list", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_EDIT', $module_name . "_edit", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_DELETE', $module_name . "_delete", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SQL_LIST', "SELECT id, $list_of_columns, id FROM $module_name", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SQL_LIST', "SELECT SQL_CALC_FOUND_ROWS $table_short_name.id, $sql_list_of_columns, $table_short_name.id FROM $module_name $table_short_name", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SQL_EDIT', "INSERT INTO $module_name ($list_of_columns, id) values ('\".implode('\', \'',\$input).\"', \$id) ON DUPLICATE KEY UPDATE SET ", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_GET_INPUT', $get_input, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SET_INPUT', $set_input, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_COLUMNS', $list_of_columns_in_quotes, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SQL_COLUMNS', $sql_list_of_columns_in_quotes, $php_file_contents);
$php_file = fopen($target_php_folder . $php_file_name, "w");
if (empty($php_file)) {
@@ -33,13 +33,13 @@ class PLACEHOLDER_MODULECLASSNAME {
$heading = array(PLACEHOLDER_COLUMNS, 'Men&uuml;');
$width = array('10%'); // Fill out manually later
$findcols = array(PLACEHOLDER_COLUMNS);
$searchsql = array(PLACEHOLDER_COLUMNS);
$findcols = array(PLACEHOLDER_SQL_COLUMNS);
$searchsql = array(PLACEHOLDER_SQL_COLUMNS);
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=PLACEHOLDER_MODULENAME&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.png\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=PLACEHOLDER_MODULENAME&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=PLACEHOLDER_MODULENAME&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=PLACEHOLDER_MODULENAME&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$sql = "PLACEHOLDER_SQL_LIST";
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
$version="OSS";
$version_revision="1.0";
$version_revision="1.3.1";
$githash = file_get_contents("../githash.txt");
if (!empty($githash)) {
$version_revision .= " (".substr($githash,0,8).")";
+3 -3
View File
@@ -443,10 +443,10 @@ class erpooSystem extends Application
// Creates user specific items
$possibleUserItems = [
/* 'Inbox' => [
'link' => 'index.php?module=ticket&action=offene',
'Tickets' => [
'link' => 'index.php?module=ticket&action=list',
'counter' => $this->erp->AnzahlOffeneTickets()
],*/
],
'Aufgaben' => [
'link' => 'index.php?module=aufgaben&action=list',
'counter' => $this->erp->AnzahlOffeneAufgaben()
+120 -90
View File
@@ -2631,7 +2631,8 @@ public function NavigationHooks(&$menu)
public function AnzahlOffeneTickets($eigene=true)
{
return 0;
$sql = "SELECT COUNT(t.id) FROM ticket t WHERE t.status = 'neu' AND ((t.warteschlange = '') OR (t.warteschlange IN (SELECT w.label FROM warteschlangen w WHERE w.adresse = '".$this->app->User->GetAdresse()."')))";
return (int)$this->app->DB->Select($sql);
}
@@ -7083,6 +7084,7 @@ title: 'Abschicken',
$navarray['menu']['admin'][++$menu]['first'] = array('Verwaltung','rechnung','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Ticketregeln','ticketregeln','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Zeitkonten','zeiterfassung','list');
if(!$this->RechteVorhanden('mitarbeiterzeiterfassung','dashboard')){
$navarray['menu']['admin'][$menu]['sec'][] = array('Antrag einreichen','mitarbeiterzeiterfassung','timemanagementrequest');
@@ -29773,7 +29775,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
*/
// Force only existing emailbackup accounts
$tpl = "<option value=\"\">-</option>";
// $tpl = "<option value=\"\">-</option>";
$email_addr = $this->app->DB->SelectArr("SELECT email, angezeigtername FROM emailbackup WHERE email != '' AND (adresse<=0 OR adresse='".$this->app->User->GetAdresse()."') AND geloescht!=1 ORDER BY email");
@@ -29858,7 +29860,6 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
return '';
}
function GetSelectDokumentKunde($typ,$adresse,$select)
{
$typ_bezeichnung = ucfirst($typ);
@@ -32456,10 +32457,17 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
return $this->MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files,$projekt,$signature,$cc,$bcc, $system);
}
/*
* Return 0 = not ok, return 1 = ok
* $to, $to_name, $cc, $bcc can be csv or arrays
*/
function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$projekt="",$signature=true,$cc="",$bcc="", $system = false)
{
// keine leeren email versenden
if($text=="" && $betreff=="") return;
if($text=="" && $betreff=="") {
$this->mail_error = "Mailer Error: " . "Empty mail.";
return 0;
}
/* $isSystemTemplate = $system && is_file(dirname(__DIR__, 2) .'/classes/Modules/Company/templates/systemmail.tpl');
if($isSystemTemplate) {
@@ -32476,56 +32484,36 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$text = $this->ReadyForPDF($text);
$text = str_replace('€','&euro;',$text);
$texthtml = htmlspecialchars_decode(
/* $text = htmlspecialchars_decode(
htmlentities($text, ENT_NOQUOTES, 'UTF-8', false)
, ENT_NOQUOTES
);
if($texthtml!=$text)
{
$text = $texthtml;
}
); */
if($signature)
{
$eigenesignatur = $this->app->DB->Select("SELECT eigenesignatur FROM emailbackup WHERE email='$from' AND email !='' AND geloescht!=1 LIMIT 1");
//$this->app->erp->LogFile(addslashes("SELECT eigenesignatur FROM emailbackup WHERE email='$from' AND email !='' LIMIT 1"));
if(strlen(trim($this->Signatur($from))) > 0 && $eigenesignatur == 1)
{
if($this->isHTML($text))
{
$signaturtext = $this->Signatur($from);
if($this->isHTML($signaturtext))
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br>".$signaturtext;
else
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br>".nl2br($signaturtext);
}
else{
$body = utf8_decode(str_replace('\r\n',"\n",$text)).$this->Signatur($from);
}
$signaturtext = $this->Signatur($from);
if($this->isHTML($signaturtext))
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br>".$signaturtext;
else
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br>".nl2br($signaturtext);
}else{
if($projekt > 0 && $this->Projektdaten($projekt,"absendesignatur")!=""){
if($this->isHTML($text))
{
$signaturtext = $this->Projektdaten($projekt,"absendesignatur");
if($this->isHTML($signaturtext))
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br><br>".$signaturtext;
else
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br><br>".$this->ReadyForPDF(nl2br($signaturtext));
} else {
$body = utf8_decode(str_replace('\r\n',"\n",$text))."\r\n\r\n".$this->ReadyForPDF($this->Projektdaten($projekt,"absendesignatur"));
}
$signaturtext = $this->Projektdaten($projekt,"absendesignatur");
if($this->isHTML($signaturtext))
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br><br>".$signaturtext;
else
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br><br>".$this->ReadyForPDF(nl2br($signaturtext));
}else{
if(strlen(trim($this->Signatur($from))) > 0 && $eigenesignatur == 0){
if($this->isHTML($text))
{
$signaturtext = $this->Signatur($from);
if($this->isHTML($signaturtext))
$body = str_replace('\r\n',"\n",$text)."<br>".$signaturtext;
else
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br>".nl2br($signaturtext);
}else{
$body = utf8_decode(str_replace('\r\n',"\n",$text)).$this->Signatur($from);
}
$signaturtext = $this->Signatur($from);
if($this->isHTML($signaturtext))
$body = str_replace('\r\n',"\n",$text)."<br>".$signaturtext;
else
$body = utf8_decode(str_replace('\r\n',"\n",$text))."<br>".nl2br($signaturtext);
}else{
$body = utf8_decode(str_replace('\r\n',"\n",$text));
}
@@ -32536,17 +32524,6 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$body = utf8_decode(str_replace('\r\n',"\n",$text));
}
// wenn html rahmen
/*
if($isSystemTemplate) {
$email_html_template = file_get_contents(dirname(__DIR__, 2) .'/classes/Modules/Company/templates/systemmail.tpl');
$email_html_template = str_replace(
'{SERVER}',
str_replace('index.php','',$this->app->Location->getServer()),
$email_html_template
);
}
else */
{
$email_html_template = $this->Projektdaten($projekt, "email_html_template");
if($email_html_template == ""){
@@ -32571,23 +32548,30 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$recipients = [];
$to_csv = "";
$to_name_csv = "";
// Prepare names and addresses
if (is_array($to)) {
foreach ($to as $item) {
$to_array[] = $item;
$to_csv .= $item;
}
} else if (!empty($to)) {
foreach (explode(',',str_replace(" ","",$to)) as $item) {
$to_array[] = $item;
$to_csv .= $item;
}
}
if (is_array($to_name)) {
foreach ($to_name as $item) {
$to_name_array[] = $item;
$to_name_csv .= $item;
}
} else if (!empty($to_name)) {
foreach (explode(',',str_replace(" ","",$to_name)) as $item) {
$to_name_array[] = $item;
$to_name_csv .= $item;
}
}
@@ -32641,6 +32625,10 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$bccRecipients[] = new EmailRecipient($bcc3[0], $bcc3[1]);
}
// This will build the mail with phpmailer 6 and send it out
// There is no way to retrieve the created mail e.g. for IMAP output
// This should be migrated to laminas-mail (used for imap)
// Phpmailer 6 can then be removed
$sysMailerSent = $sysMailer->composeAndSendEmail(
$from,
$from_name,
@@ -32652,10 +32640,11 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$bccRecipients,
$sendmail_error
);
}
}
if($sysMailerSent === false) {
$this->app->erp->LogFile("Mailer Error: " . $sendmail_error);
$this->MailLogFile($from,$from_name,$to,$to_name,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
$this->MailLogFile($from,$from_name,$to_csv,$to_name_csv,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
$this->mail_error = "Mailer Error: " . $sendmail_error;
if(isset($this->app->User) && $this->app->User && method_exists($this->app->User, 'GetID'))
@@ -32663,35 +32652,59 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$this->app->erp->InternesEvent($this->app->User->GetID(),"Fehler bei Mailversand: ".$sendmail_error,"alert",1);
}
return 0;
}
// schreiben in post ausgang
$this->MailLogFile($from,$from_name,$to,$to_name,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
$imap_aktiv = $this->app->DB->Select("SELECT imap_sentfolder_aktiv FROM emailbackup WHERE email='".$from."' AND imap_sentfolder!='' AND geloescht!=1 LIMIT 1");
if($imap_aktiv=="1" && !preg_match("/Xentral Kopie/",$to_name) && !preg_match("/WaWision Kopie/",$to_name))
{
$imap_data = $this->app->DB->SelectRow("SELECT * FROM emailbackup WHERE email='".$from."' AND geloescht!=1 LIMIT 1");
$imapCopyMessage = $body;
if ($sysMailerSent === true && $emailObj !== null) {
/** @var MimeMessageFormatterInterface $formatter */
$formatter = $this->app->Container->get('MailClientMimeMessageFormatter');
$imapCopyMessage = $formatter->formatMessage(
$emailObj,
new EmailRecipient($from, $from_name)
);
}
try {
$account = EmailBackupAccount::fromDbState($imap_data);
/** @var MailClientProvider $clientProvider */
$clientProvider = $this->app->Container->get('MailClientProvider');
$client = $clientProvider->createMailClientFromAccount($account);
$client->connect();
$client->appendMessage($imapCopyMessage, $account->getImapOutgoingFolder());
} catch (Exception $e) {
$this->app->erp->LogFile("Mailer Error: " . (string)$e);
}
} else {
$this->app->erp->LogFile("IMAP Ausgang FROM ".$from." S $server P $port T $type SP $server_path B ".$imap_data['benutzername']." SF ".$imap_data['imap_sentfolder']);
}
$this->MailLogFile($from,$from_name,$to_csv,$to_name_csv,$betreff,$text,$files,$projekt,$signature,$cc,$bcc,$system);
// Put the mail in IMAP sent folder
// Note that this is implemented with laminas-mail and only this
// The created mail may differ from the sent one because it is created by different libraries
$imap_aktiv = $this->app->DB->Select("SELECT imap_sentfolder_aktiv FROM emailbackup WHERE email='".$from."' AND imap_sentfolder!='' AND geloescht!=1 LIMIT 1");
if($imap_aktiv=="1" && !preg_match("/Xentral Kopie/",$to_name_csv) && !preg_match("/WaWision Kopie/",$to_name_csv))
{
// This will build the mail as EmailMessage (Xentral\Components\Mailer\Data) and then rebuild it with laminas-mail message to produce the raw output
$emailObj = $sysMailer->composeEmail(
$recipients,
$betreff,
$body,
$files,
$ccRecipients,
$bccRecipients
);
if ($emailObj !== null) {
/** @var MimeMessageFormatterInterface $formatter */
$formatter = $this->app->Container->get('MailClientMimeMessageFormatter');
$imapCopyMessage = $formatter->formatMessage(
$emailObj,
new EmailRecipient($from, $from_name)
);
} else {
$this->app->erp->LogFile("Mailer Error: Email could not be composed!");
}
// Load the mail to IMAP using laminas
try {
$imap_data = $this->app->DB->SelectRow("SELECT * FROM emailbackup WHERE email='".$from."' AND geloescht!=1 LIMIT 1");
$account = EmailBackupAccount::fromDbState($imap_data);
/** @var MailClientProvider $clientProvider */
$clientProvider = $this->app->Container->get('MailClientProvider');
$client = $clientProvider->createMailClientFromAccount($account);
$client->connect();
$client->appendMessage($imapCopyMessage, $account->getImapOutgoingFolder());
} catch (Exception $e) {
$this->app->erp->LogFile("Mailer Error: " . (string) $e);
if(isset($this->app->User) && $this->app->User && method_exists($this->app->User, 'GetID'))
{
$this->app->erp->InternesEvent($this->app->User->GetID(),"IMAP-Fehler","alert",1);
}
return 0;
}
}
} // sysMailersent
$this->mail_error = "";
return 1;
}
@@ -43874,7 +43887,7 @@ function Firmendaten($field,$projekt="")
if(empty($pathArr) || !is_dir($prefix.'/'.implode('/', $pathArr))) {
return;
}
$glob = glob($prefix.implode('/', $pathArr).'/*');
$glob = glob($prefix.implode('/', $pathArr).'/*'); /**/
if(!empty($glob)) {
return;
}
@@ -43958,7 +43971,8 @@ function Firmendaten($field,$projekt="")
$version = $this->app->DB->Select("SELECT MAX(version) FROM datei_version WHERE datei='$id'");
$newid = $this->app->DB->Select("SELECT dateiname FROM datei_version WHERE datei='$id' AND version='$version' LIMIT 1");
return $this->UmlauteEntfernen($newid);
// return $this->UmlauteEntfernen($newid);
return $newid;
}
@@ -43971,6 +43985,9 @@ function Firmendaten($field,$projekt="")
return strtolower($tmp['extension']);
}
/*
* Retrieve files from stichwoerter and provide them in tmp for access
*/
function GetDateiSubjektObjektDateiname($subjekt,$objekt,$parameter,$prefix="")
{
@@ -43980,16 +43997,28 @@ function Firmendaten($field,$projekt="")
}
$tmp = [];
foreach($dateien as $datei) {
$tmpname = tempnam($this->GetTMP(), $prefix);
$newname = $tmpname."_".$this->GetDateiName($datei['datei']);
copy($this->GetDateiPfad($datei['datei']),$newname);
// $tmpname = tempnam($this->GetTMP(), $prefix);
$tmpname = $this->GetTMP().md5(uniqid(mt_rand(), true));
mkdir ($tmpname);
$newname = $tmpname."/".$this->GetDateiName($datei['datei']);
copy($this->GetDateiPfad($datei['datei']),$newname);
$tmp[] = $newname;
}
return $tmp;
}
function GetDateiStichwoerter($dateiid) {
$stichwoerter = $this->app->DB->SelectArr("SELECT subjekt, objekt, parameter FROM datei_stichwoerter WHERE datei=".$dateiid);
if (empty($stichwoerter)) {
return null;
}
else {
return $stichwoerter;
}
}
function GetDateiSubjektObjekt($subjekt,$objekt,$parameter)
{
$dateien = $this->app->DB->SelectArr("SELECT datei FROM datei_stichwoerter WHERE subjekt LIKE '$subjekt' AND objekt LIKE '$objekt' AND parameter='$parameter' GROUP by datei");
@@ -43998,7 +44027,8 @@ function Firmendaten($field,$projekt="")
}
$tmp = [];
foreach($dateien as $datei) {
$tmp[] = $this->GetDateiPfad($datei['datei']);
// $tmp[] = $this->GetDateiPfad($datei['datei']);
$tmp[] = $datei['datei']; // return the datei id
}
return $tmp;
}
+60 -4
View File
@@ -659,8 +659,10 @@ class Adresse extends GenAdresse {
$this->AdresseBriefPreview('dokumente',$id,false);
break;
case '2':
$this->AdresseBriefPreview('dokumente_send',$id,false);
$this->AdresseBriefPreview('dokumente_send',$id,false);
break;
case '4':
$this->AdresseBriefPreview('ticket_nachricht',$id,false);
break;
case '5':
@@ -3736,11 +3738,21 @@ function AdresseBriefErstellen() {
if (!empty($adresse['email'])) {
$this->app->Tpl->Add('EMAIL_AN',str_replace('"','&#34;',$adresse['name']) . ' &lt;' . $adresse['email'] . '&gt;');
}
$anschreiben = $this->app->DB->Select("SELECT anschreiben FROM adresse WHERE id='".$ticket_from_db['adresse']."' LIMIT 1");
if($anschreiben=="")
{
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben").",\n".$this->app->erp->Grussformel($projekt,$sprache);
}
$this->app->Tpl->Add('CONTENT',$anschreiben);
$projekt = $this->app->DB->Select("SELECT abkuerzung FROM projekt INNER JOIN adresse ON adresse.projekt = projekt.id WHERE adresse.id='".$id."' LIMIT 1");
$this->app->Tpl->Set('PROJEKT', $projekt);
$anhaenge = '';
$anhaenge .= '<tr><td nowrap>Datei:</td><td><input type="file" name="upload[]" id="file" /></td></tr>';
// $anhaenge .= '<tr><td nowrap>Datei 2:</td><td><input type="file" name="upload[]" /></td></tr>';
// $anhaenge .= '<tr><td nowrap>Datei 3:</td><td><input type="file" name="upload[]" /></td></tr>';
$this->app->Tpl->Add('ANHAENGEHERAUFLADEN', $anhaenge);
$anhaenge = '<tr><td colspan=3 align=center><i>Keine Anh&auml;nge vorhanden</i></td></tr>';
@@ -4073,6 +4085,19 @@ function AdresseBriefPreview($type = '', $id = '', $json = true) {
id = ' . $id . '
';
break;
case 'ticket_nachricht':
$query .= '
SELECT
id,
DATE_FORMAT(zeit, "%d.%m.%Y") as datum,
betreff,
text as content
FROM
ticket_nachricht
WHERE
id = ' . $id . '
';
break;
case 'wiedervorlage':
$query .= '
SELECT
@@ -4970,6 +4995,7 @@ function AdresseBrief() {
$count += $this->app->DB->Select('SELECT count(id) FROM dokumente_send WHERE adresse = ' . $id);
$count += $this->app->DB->Select('SELECT count(id) FROM wiedervorlage WHERE adresse = ' . $id);
$count += $this->app->DB->Select('SELECT count(id) FROM kalender_event WHERE adresse = '.$id);
$count += $this->app->DB->Select('SELECT count(tn.id) FROM ticket_nachricht tn INNER JOIN ticket t ON tn.ticket = t.schluessel WHERE t.adresse = '.$id);
if ($count > 0) {
$this->app->YUI->TableSearch('TABELLE', 'adresse_brief');
@@ -6358,6 +6384,8 @@ function AdresseVerein()
}
/**
* Query for adresse minidetail
* CRM view inside adresse page is in adresse.php
* @param int $adresseId AdressID
* @param int $maxResults SQL-Limit; Maximale Anzahl der Ergebnisse
*
@@ -6489,7 +6517,8 @@ function AdresseVerein()
SELECT
w.id,
CONCAT(DATE_FORMAT(datum_erinnerung, "%Y-%m-%d"), " ", IF(zeit_erinnerung IS NULL OR DATE_FORMAT(zeit_erinnerung, "%H:%i")="00:00", "", DATE_FORMAT(zeit_erinnerung, "%H:%i")) ) as datum,
w.bezeichnung COLLATE utf8_general_ci as title,\'\' as ansprechpartner,
w.bezeichnung COLLATE utf8_general_ci as title,
\'\' as ansprechpartner,
p.abkuerzung COLLATE utf8_general_ci as abkuerzung,
adr.name COLLATE utf8_general_ci as bearbeiter,
CONCAT("Wiedervorlage") as art,
@@ -6506,6 +6535,32 @@ function AdresseVerein()
)';
}
}
$sql .= 'UNION ALL
(
SELECT
t.id,
tn.zeit,
tn.betreff,
ifnull((SELECT name FROM ansprechpartner ap WHERE ap.adresse = a.id AND ap.email = tn.mail LIMIT 1),tn.mail) as ansprechpartner,
p.abkuerzung,
tn.verfasser,
\'Ticketnachricht\' as art,
CONCAT(IF(tn.versendet = 1, "JA", "NEIN"),"<a data-type=ticket_nachricht data-id=", t.id, "></a>") as gesendet,
\'\' as PDF,
concat("4","-",tn.id) as did,
CONCAT(tn.text,t.notiz) as suchtext,
\'\' as intern
FROM
ticket_nachricht tn
INNER JOIN ticket t ON
tn.ticket = t.schluessel
INNER JOIN adresse a ON t.adresse = a.id
LEFT JOIN projekt p ON t.projekt = p.id
WHERE t.adresse = '.$adresseId.' AND !(tn.versendet = 1 AND tn.zeitausgang IS NULL)
)
';
$sql .= ') AS a ';
$sql .= 'ORDER BY a.datum DESC ';
$sql .= 'LIMIT 0, ' . $maxResults;
@@ -6514,3 +6569,4 @@ function AdresseVerein()
}
}
+8 -1
View File
@@ -1287,7 +1287,14 @@ class Ajax {
for($i = 0; $i < $carr; $i++) {
$newarr[] = "{$arr[$i]['name2']}";
}
break;
break;
case 'warteschlangename':
$arr = $this->app->DB->SelectArr("SELECT CONCAT(label, ' ', warteschlange) as result from warteschlangen");
$carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++) {
$newarr[] = "{$arr[$i]['result']}";
}
break;
/*
select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.kundennummer order by a2.projekt = 13 DESC, a2.projekt = 0 DESC, projekt LIMIT 1) as name FROM adresse a WHERE a.kundennummer like '10500' group by a.kundennummer
+2 -2
View File
@@ -589,7 +589,7 @@ class Auftrag extends GenAuftrag
$menu = "";
$sql = "SELECT
$sql = "SELECT SQL_CALC_FOUND_ROWS
a.id,
'<img src=./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/details_open.png class=details>' AS `open`,
CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',a.id,'\" />') AS `auswahl`,
@@ -678,7 +678,7 @@ class Auftrag extends GenAuftrag
$menu = "";
$sql = "SELECT
$sql = "SELECT SQL_CALC_FOUND_ROWS
a.id,
'<img src=./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/details_open.png class=details>' AS `open`,
CONCAT('<input type=\"checkbox\" name=\"auswahlcronjob[]\" value=\"',a.id,'\" />') AS `auswahl`,
+6 -6
View File
@@ -228,12 +228,12 @@ input[type=button].anlegen_close {
var ersterEintrag = [TABELLEFLAG];
function edit_Eintrag(elem)
{
var entryData = $(elem).parent().parent().parent().parent().parent().parent().find('a').first();
var entryDataDokument = entryData.attr('data-type');
entryDataId = entryData.attr('data-id');
// entryData = entryData.split('||');
var entryData = $(elem).parent().parent().parent().parent().parent().parent().find('a').first();
var entryDataDokument = entryData.attr('data-type');
if (entryDataDokument != 'dokumente' && entryDataDokument != 'wiedervorlage' && entryDataDokument != 'kalender') {
entryDataId = entryData.attr('data-id');
if (entryDataDokument != 'dokumente' && entryDataDokument != 'wiedervorlage' && entryDataDokument != 'kalender') {
if(entryDataDokument == 'dokumente_send')
{
var artel = $(elem).parents('tr').first().parents('tr').first().find('span.editlink').first();
@@ -243,7 +243,7 @@ var ersterEintrag = [TABELLEFLAG];
}
else if(entryDataDokument == 'ticket_nachricht')
{
window.open('index.php?module=ticket&action=assistent&id='+entryDataId,'_blank');
window.open('index.php?module=ticket&action=edit&id='+entryDataId,'_blank');
return;
}
+19 -28
View File
@@ -1,44 +1,35 @@
<div id="tabs">
<ul>
<li><a href="#tab1">&Uuml;bersicht</a></li>
<li><a href="#tab2">neue Version anlegen</a></li>
</ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<div id="tab1">
<form action="" method="post" name="eprooform" enctype="multipart/form-data">
<h2>Beschreibung</h2>
<table border="0" width="100%">
<h2>Beschreibung</h2>
<table border="0" width="100%">
<tr><td>Titel</td><td colspan="3"><input type="text" size="30" name="titel" value="[TITEL]"></td></tr>
<tr><td>Beschreibung</td><td colspan="3"><textarea cols="35" rows="5" name="beschreibung">[BESCHREIBUNG]</textarea></td></tr>
</table>
<h2>Versionen</h2>[VERSIONEN]
<h2>Stichworte</h2>[STICHWORTE]
<table border="0" width="100%">
<tr valign="" height="" bgcolor="" align="" bordercolor="" class="klein" classname="klein">
<td width="" valign="" height="" bgcolor="" align="right" colspan="4" bordercolor="" classname="orange2" class="orange2">
<input type="submit" name="speichern"
value="Speichern" /> <input type="button" value="Abbrechen" /></td>
</tr>
</table>
</table>
<h2>Versionen</h2>
[VERSIONEN]
<h2>Zuordnungen</h2>
[STICHWOERTER]
<table border="0" width="100%">
<tr>
<td width="" valign="" height="" bgcolor="" align="right" bordercolor="" classname="orange2" class="orange2">
<input type="submit" name="speichern" value="Speichern" />
</td>
</tr>
<tr>
<td width="" valign="" height="" bgcolor="" align="right" bordercolor="" classname="orange2" class="orange2">
<input type="submit" value="Abbrechen" />
</td>
</tr>
</table>
</form>
</div>
<div id="tab2">
[NEUEVERSION]
+7 -7
View File
@@ -19,7 +19,7 @@
<tr valign="middle"><td>Stichwort:</td><td colspan="3">
<table>
<tr>
<td><select name="huhu" onchange="document.getElementById('subjekt').value=document.eprooform.huhu.options[document.eprooform.huhu.selectedIndex].value">
<td><select name="subjektselect" onchange="document.getElementById('subjekt').value=document.eprooform.subjektselect.options[document.eprooform.subjektselect.selectedIndex].value">
<option value=""></option>
<option value="Bild">Bild</option>
<option value="Schaltplan">Schaltplan</option>
@@ -32,17 +32,17 @@
<option value="Schaltplan">UST-Pr&uuml;fung</option>
</select></td>
<td>von</td>
<td><select>
<option value="Projekt">Projekt %</option>
<option value="Kunde">Kunde %</option>
<option value="Artikel">Artikel %</option>
<option value="Auftrag">Auftrag %</option>
<td><select name="objekt">
<option value="Projekt">Projekt ID</option>
<option value="Kunde">Kunde ID</option>
<option value="Artikel">Artikel ID</option>
<option value="Auftrag">Auftrag ID</option>
</select></td>
</tr>
<tr>
<td><input type="text" size="15" name="subjekt" id="subjekt" value="[SUBJEKT]"></td>
<td>&nbsp;</td>
<td><input type="text" size="15" name="objekt" value="[OBJEKT]"></td>
<td><input type="text" size="15" name="nummer" value="[NUMMER]"></td>
</tr>
</table>
</td></tr>
+10 -10
View File
@@ -24,7 +24,7 @@
</tr>
<tr align="center">
<td><a [TICKETVORLAGENLINK]>{|Ticket Vorlagen|}</a></td>
<td><a [WARTESCHLANGENLINK]>{|Warteschlangen|}</a></td>
<td><a [WARTESCHLANGENLINK]>{|Ticket Warteschlangen|}</a></td>
<!--<td><a href="index.php?module=generic&action=edit">Startseite</a></td>-->
<td><a [ARTIKELKATEGORIENLINK]>{|Artikel Kategorien|}</a></td>
<td><a href="index.php?module=artikeleinheit&action=list">{|Artikel Einheiten|}</a></td>
@@ -106,47 +106,47 @@
<table width="800" border="0" align="center">
<tr align="center">
<td width="25%"><a href="index.php?module=prozessstarter&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_22.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=protokoll&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_22.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=logfile&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_22.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=welcome&action=info"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_23.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=drucker&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_24.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=log&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_22.gif" border="0" width="30%"></a></td>
</tr>
<tr align="center">
<td><a href="index.php?module=prozessstarter&action=list">{|Prozessstarter|}</a></td>
<td><a href="index.php?module=prozessstarter&action=list">{|Errorlog|}</a></td>
<td><a href="index.php?module=welcome&action=info">{|Lizenz|}</a></td>
<td><a href="index.php?module=drucker&action=list">{|Drucker|}</a></td>
<td><a href="index.php?module=protokoll&action=list">{|Protokoll|}</a></td>
<td><a href="index.php?module=prozessstarter&action=list">{|Logfile|}</a></td>
<td><a href="index.php?module=prozessstarter&action=list">{|Log|}</a></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr align="center">
<td width="25%"><a href="index.php?module=protokoll&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_22.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=etiketten&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_14.gif" border="0" width="30%"></a></td>
<td width="25%" style="position:relative"><a [UEBERSETZUNGENLINK]><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_14.gif" border="0" width="30%"></a>[GREYUEBERSETZUNGEN]</td>
<td width="25%" style="position:relative"><a [ARBEITSFREIETAGELINK]><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_14.gif" border="0" width="30%"></a>[GREYARBEITSFREIETAGE]</td>
<td width="25%"><a href="index.php?module=drucker&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_24.gif" border="0" width="30%"></a></td>
</tr>
<tr align="center">
<td><a href="index.php?module=protokoll&action=list">{|Protokoll|}</a></td>
<td><a href="index.php?module=etiketten&action=list">{|Etiketten|}</a></td>
<td><a [UEBERSETZUNGENLINK]>{|&Uuml;bersetzungen|}</a></td>
<td width="25%"><a [ARBEITSFREIETAGELINK]>{|Arbeitsfreie Tage|}</a></td>
<td><a href="index.php?module=drucker&action=list">{|Drucker|}</a></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr align="center">
<td width="25%"><a href="index.php?module=welcome&action=info"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_23.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=support&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_23.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=api_account&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_25.gif" border="0" width="30%"></td>
<td width="25%"><a href="index.php?module=adapterbox&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_25.gif" border="0" width="30%"></a></td>
<td width="25%" style="position:relative"></td>
</tr>
<tr align="center">
<td><a href="index.php?module=welcome&action=info">{|Lizenz|}</a></td>
<td><a href="index.php?module=support&action=list">{|Support|}</a></td>
<td><a href="index.php?module=api_account&action=list">{|API-Account|}</a></td>
<td><a href="index.php?module=adapterbox&action=list">{|Adapterbox|}</a></td>
<td width="25%"></td>
</tr>
</table>
</fieldset>
+10 -1
View File
@@ -67,7 +67,10 @@
<tr><td>{|imap_sentfolder_aktiv|}:</td><td><input type="text" name="imap_sentfolder_aktiv" value="[IMAP_SENTFOLDER_AKTIV]" size="40"></td></tr>
<tr><td>{|imap_sentfolder|}:</td><td><input type="text" name="imap_sentfolder" value="[IMAP_SENTFOLDER]" size="40"></td></tr>
<tr><td>{|imap_port|}:</td><td><input type="text" name="imap_port" value="[IMAP_PORT]" size="40"></td></tr>
<tr><td>{|imap_type|}:</td><td><input type="text" name="imap_type" value="[IMAP_TYPE]" size="40"><i>0 = standard, 1 = SSL</i></td></tr>
<tr><td>{|imap_type|}:</td><td><input type="text" name="imap_type" value="[IMAP_TYPE]" size="40"><i>1 = standard, 3 = SSL, 5 = OAuth</i></td></tr>
<tr><td width="50">Testmail:</td><td>
<input type="submit" form="imap_test" value="IMAP testen" id="testimap-button">&nbsp;<i>Bitte erst speichern und dann testen!</i>
</td></tr>
</table>
</fieldset>
</div>
@@ -168,3 +171,9 @@
<input type="text" name="id" value="[ID]" style="display:none">
</form>
<form id="imap_test" action = "index.php">
<input type="text" name="module" value="emailbackup" style="display:none">
<input type="text" name="action" value="test_imap" style="display:none">
<input type="text" name="id" value="[ID]" style="display:none">
</form>
+51 -139
View File
@@ -1,141 +1,53 @@
<script type="text/javascript" src="./js/einfuegen.js" ></script>
<form method="POST" id="eprooform" enctype="multipart/form-data">
<table width=100%"><tr valign="top"><td>
<fieldset><legend>{|Nachricht|}</legend>
<table>
<tr><td width="200">Von:</td><td><select name="quelle" id="quelle"/>[QUELLE]</select></td></tr>
<tr><td>Kunde:</td><td><input type="text" name="adresse" onchange="changeemail()" id="adresse" size="80" /></td></tr>
<tr><td>E-Mail:</td><td><input type="text" name="email" id="email" size="80" /></td></tr>
<tr><td>E-Mail CC:</td><td><input type="text" name="emailcc" id="emailcc" size="80" /></td></tr>
<tr><td>Betreff:</td><td><input type="text" name="betreff" id="betreff" size="80" /></td></tr>
<tr><td>Nachricht:</td><td><textarea id="eingabetext" name="eingabetext" cols="90" style="min-height:200px;">[TEXT]</textarea></td></tr>
<tr><td>Anhang 1:</td><td><input type="file" name="datei[]" /></td></tr>
<tr><td>Anhang 2:</td><td><input type="file" name="datei[]" /></td></tr>
<tr><td>Anhang 3:</td><td><input type="file" name="datei[]" /></td></tr>
<tr><td>Anhang 4:</td><td><input type="file" name="datei[]" /></td></tr>
<tr><td>Anhang 5:</td><td><input type="file" name="datei[]" /></td></tr>
<tr><td></td><td><input type="submit" name="speichern" id="speichern" value="Speichern" />&nbsp;<input type="submit" name="senden" id="senden" value="Speichern und Senden" /></td></tr>
</table>
</fieldset>
</td><td width="30%">
Textvorlagen:<br>
<select name="vorlage" id="vorlage" onchange="changevorlage(this)"><option value=""> - </option>[VORLAGE]</select>
<div id="tabs">
<ul>
<li><a href="#tabs-1"></a></li>
</ul>
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-13 col-md-6 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" id="betreff" value="" size="20"></td></tr>
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="20"></td></tr>
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" value="[TAGS]" size="20"></td></tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-13 col-md-6 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Status|}:</td><td><select name="status">[STATUS]</select></td></tr>
<tr><td>{|Verantwortlich|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="20"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="20"></td></tr>
<tr><td>{|Notiz|}:</td><td><textarea name="notiz" id="notiz" rows="6" style="width:100%;">[NOTIZ]</textarea></td></tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-13 col-md-1 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
<td><button name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
[NEW_MESSAGE]
</form>
[MESSAGES]
</div>
</div>
</td></tr>
</table>
</form>
<script>
var vorlage = [];
[VORLAGEARRAY]
var kundennummer = '';
function changeemail()
{
if($('#adresse').val() != kundennummer)
{
kundennummer = $('#adresse').val();
var kunde = kundennummer.split(' ');
var kundenid = kunde[0];
kunde[kunde.length - 1].replace(')', '');
if(kunde[kunde.length - 1].replace(')', '') != '') {
$.ajax({
url: "index.php?module=ajax&action=filter&filtername=emailadresse&limit=1&kd_id="+kundenid,
type: 'GET',
dataType: 'json',
success: function (data) {
$("input#email").val(data[0]);
},
errror: function (data) {
$("input#email").val('');
},
});
}
$( "input#email" ).autocomplete({
source: "index.php?module=ajax&action=filter&filtername=emailadresse&kd_id="+kundenid,
});
}
}
function changevorlage(id)
{
if(typeof id == "undefined")id = $('#vorlage');
$.ajax({
url: 'index.php',
type: 'GET',
dataType: 'json',
data: 'module=ticket&action=create&getvorlagen=1&kunde='+$('#adresse').val(),
success: function(data) {
if(typeof data.v != "undefined")
{
$.each(data.v, function (k,va)
{
vorlage[k] = va;
}
);
id = $(id).val();
if(typeof (vorlage[id]) !== "undefined" )
{
einfuegenticket(vorlage[id]);
}
}
}
});
}
$(document).ready(function() {
/*
setInterval(function(){
if($('#adresse').val() != kundennummer)
{
kundennummer = $('#adresse').val();
var kunde = kundennummer.split(' ');
var kundenid = kunde[0];
kunde[kunde.length - 1].replace(')', '');
if(kunde[kunde.length - 1].replace(')', '') != '') {
$.ajax({
url: "index.php?module=ajax&action=filter&filtername=emailadresse&limit=1&kd_id="+kundenid,
type: 'GET',
dataType: 'json',
success: function (data) {
$("input#email").val(data[0]);
}
});
}
$( "input#email" ).autocomplete({
source: "index.php?module=ajax&action=filter&filtername=emailadresse&kd_id="+kundenid,
});
changevorlage();
}
},100);
*/
$('#eprooform').submit(function(){
var fehler = '';
if(!$('#adresse').val())fehler = fehler + ' Kein Kunde ausgewählt!';
if(!$('#betreff').val())fehler = fehler + ' Kein Betreff eingegeben!';
if(!$('#email').val())fehler = fehler + ' Keine E-Mail-Adresse ausgewählt!';
if(!$('#eingabetext').val())fehler = fehler + ' Kein Text eingegben!';
if(fehler == '')
{
return true;
}
else
{
alert(fehler);
return false;
}
});
});
</script>
+64
View File
@@ -0,0 +1,64 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1"></a></li>
</ul>
<!-- Example for multiple tabs
<ul hidden">
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
</ul>
-->
<div id="tabs-1">
[MESSAGE]
<form action="" enctype="multipart/form-data" method="POST">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|[STATUSICON]<b>Ticket <font color="blue">#[SCHLUESSEL]</font></b>|}</legend>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" id="betreff" value="[BETREFF]" size="20"></td></tr>
<tr><td>{|Letzte Aktion|}:</td><td>[ZEIT]</td></tr>
<tr><td>{|Von|}:</td><td>[MAILADRESSE] ([KUNDE])</td></tr>
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="20"><a href="index.php?module=adresse&action=edit&id=[ADRESSE_ID]"><img src="./themes/new/images/forward.svg" border="0" style="top:6px; position:relative"></a></td></tr>
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" id="tags" value="[TAGS]" size="20"></td></tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Status|}:</td><td><select name="status">[STATUS]</select></td></tr>
<tr><td>{|Verantwortlich|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="20"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="checkbox" name="prio" id="prio" value="1" [PRIO] size="20"></td></tr>
<tr><td>{|Neue Notiz|}:</td><td><textarea name="neue_notiz" id="neue_notiz" rows="1" style="width:100%;"></textarea></td></tr>
<tr><td>{|Notizen|}:</td><td><textarea name="notiz" id="notiz" rows="6" style="width:100%;">[NOTIZ]</textarea></td></tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-14 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
<td><button name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button></td></tr>
<td><button name="submit" value="neue_email" class="ui-button-icon" style="width:100%;">Neue E-Mail</button></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
[NEW_MESSAGE]
</form>
[MESSAGES]
</div>
</div>
+119
View File
@@ -0,0 +1,119 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1"></a></li>
</ul>
<!-- Example for multiple tabs
<ul hidden">
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
</ul>
-->
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|<!--Legend for this form area goes here>-->ticket|}</legend><i>Info like this.</i>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Schluessel|}:</td><td><input type="text" name="schluessel" value="[SCHLUESSEL]" size="40"></td></tr>
<tr><td>{|Zeit|}:</td><td><input type="text" name="zeit" value="[ZEIT]" size="40"></td></tr>
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" value="[PROJEKT]" size="40"></td></tr>
<tr><td>{|Bearbeiter|}:</td><td><input type="text" name="bearbeiter" value="[BEARBEITER]" size="40"></td></tr>
<tr><td>{|Quelle|}:</td><td><input type="text" name="quelle" value="[QUELLE]" size="40"></td></tr>
<tr><td>{|Status|}:</td><td><input type="text" name="status" value="[STATUS]" size="40"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr>
<tr><td>{|Kunde|}:</td><td><input type="text" name="kunde" value="[KUNDE]" size="40"></td></tr>
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Mailadresse|}:</td><td><input type="text" name="mailadresse" value="[MAILADRESSE]" size="40"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="40"></td></tr>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" value="[BETREFF]" size="40"></td></tr>
<tr><td>{|Zugewiesen|}:</td><td><input type="text" name="zugewiesen" value="[ZUGEWIESEN]" size="40"></td></tr>
<tr><td>{|Inbearbeitung|}:</td><td><input type="text" name="inbearbeitung" value="[INBEARBEITUNG]" size="40"></td></tr>
<tr><td>{|Inbearbeitung_user|}:</td><td><input type="text" name="inbearbeitung_user" value="[INBEARBEITUNG_USER]" size="40"></td></tr>
<tr><td>{|Firma|}:</td><td><input type="text" name="firma" value="[FIRMA]" size="40"></td></tr>
<tr><td>{|Notiz|}:</td><td><input type="text" name="notiz" value="[NOTIZ]" size="40"></td></tr>
<tr><td>{|Bitteantworten|}:</td><td><input type="text" name="bitteantworten" value="[BITTEANTWORTEN]" size="40"></td></tr>
<tr><td>{|Service|}:</td><td><input type="text" name="service" value="[SERVICE]" size="40"></td></tr>
<tr><td>{|Kommentar|}:</td><td><input type="text" name="kommentar" value="[KOMMENTAR]" size="40"></td></tr>
<tr><td>{|Privat|}:</td><td><input type="text" name="privat" value="[PRIVAT]" size="40"></td></tr>
<tr><td>{|Dsgvo|}:</td><td><input type="text" name="dsgvo" value="[DSGVO]" size="40"></td></tr>
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" value="[TAGS]" size="40"></td></tr>
<tr><td>{|Nachrichten_anz|}:</td><td><input type="text" name="nachrichten_anz" value="[NACHRICHTEN_ANZ]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<!-- Example for 2nd row
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Another legend|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Schluessel|}:</td><td><input type="text" name="schluessel" value="[SCHLUESSEL]" size="40"></td></tr>
<tr><td>{|Zeit|}:</td><td><input type="text" name="zeit" value="[ZEIT]" size="40"></td></tr>
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" value="[PROJEKT]" size="40"></td></tr>
<tr><td>{|Bearbeiter|}:</td><td><input type="text" name="bearbeiter" value="[BEARBEITER]" size="40"></td></tr>
<tr><td>{|Quelle|}:</td><td><input type="text" name="quelle" value="[QUELLE]" size="40"></td></tr>
<tr><td>{|Status|}:</td><td><input type="text" name="status" value="[STATUS]" size="40"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr>
<tr><td>{|Kunde|}:</td><td><input type="text" name="kunde" value="[KUNDE]" size="40"></td></tr>
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Mailadresse|}:</td><td><input type="text" name="mailadresse" value="[MAILADRESSE]" size="40"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="40"></td></tr>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" value="[BETREFF]" size="40"></td></tr>
<tr><td>{|Zugewiesen|}:</td><td><input type="text" name="zugewiesen" value="[ZUGEWIESEN]" size="40"></td></tr>
<tr><td>{|Inbearbeitung|}:</td><td><input type="text" name="inbearbeitung" value="[INBEARBEITUNG]" size="40"></td></tr>
<tr><td>{|Inbearbeitung_user|}:</td><td><input type="text" name="inbearbeitung_user" value="[INBEARBEITUNG_USER]" size="40"></td></tr>
<tr><td>{|Firma|}:</td><td><input type="text" name="firma" value="[FIRMA]" size="40"></td></tr>
<tr><td>{|Notiz|}:</td><td><input type="text" name="notiz" value="[NOTIZ]" size="40"></td></tr>
<tr><td>{|Bitteantworten|}:</td><td><input type="text" name="bitteantworten" value="[BITTEANTWORTEN]" size="40"></td></tr>
<tr><td>{|Service|}:</td><td><input type="text" name="service" value="[SERVICE]" size="40"></td></tr>
<tr><td>{|Kommentar|}:</td><td><input type="text" name="kommentar" value="[KOMMENTAR]" size="40"></td></tr>
<tr><td>{|Privat|}:</td><td><input type="text" name="privat" value="[PRIVAT]" size="40"></td></tr>
<tr><td>{|Dsgvo|}:</td><td><input type="text" name="dsgvo" value="[DSGVO]" size="40"></td></tr>
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" value="[TAGS]" size="40"></td></tr>
<tr><td>{|Nachrichten_anz|}:</td><td><input type="text" name="nachrichten_anz" value="[NACHRICHTEN_ANZ]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div> -->
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
<!-- Example for 2nd tab
<div id="tabs-2">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|...|}</legend>
<table width="100%" border="0" class="mkTableFormular">
...
</table>
</fieldset>
</div>
</div>
</div>
</div>
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
-->
</div>
+70
View File
@@ -0,0 +1,70 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
[VORTABS2UEBERSCHRIFT]<li><a href="#tabs-2">[TABTEXT2]</a></li>[NACHTABS2UEBERSCHRIFT]
</ul>
<div id="tabs-1">
[MESSAGE]
<form action="#tabs-1" id="frmauto" name="frmauto" method="post">
<div class="filter-box filter-usersave">
<div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}</div>
<ul class="filter-list">
[STATUSFILTER]
<li class="filter-item">
<label for="meinetickets" class="switch">
<input type="checkbox" id="meinetickets">
<span class="slider round"></span>
</label>
<label for="meinetickets">{|Meine|}</label>
</li>
<li class="filter-item">
<label for="prio" class="switch">
<input type="checkbox" id="prio">
<span class="slider round"></span>
</label>
<label for="prio">{|Prio|}</label>
</li>
<li class="filter-item">
<label for="geschlossene" class="switch">
<input type="checkbox" id="geschlossene">
<span class="slider round"></span>
</label>
<label for="geschlossene">{|Zzgl. abgeschlossen|}</label>
</li>
<li class="filter-item">
<label for="spam" class="switch">
<input type="checkbox" id="spam">
<span class="slider round"></span>
</label>
<label for="spam">{|Zzgl. Papierkorb|}</label>
</li>
</ul>
</div>
</div>
[TAB1]
<fieldset>
<table>
<legend>Stapelverarbeitung</legend>
<tr><td>{|Status|}:</td><td><select name="status">[STATUS]</select></td></tr>
<tr><td>{|Verantwortlich|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="20"></td></tr>
<tr>
<td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td><td><input type="submit" class="btnBlue" name="ausfuehren" value="{|Zuordnen|}" /></td>
</tr>
</table>
</fieldset>
</form>
[TAB1NEXT]
</div>
</div>
<script>
$('#autoalle').on('change',function(){
var wert = $(this).prop('checked');
$('#ticket_list').find('input[type="checkbox"]').prop('checked',wert);
$('#ticket_list').find('input[type="checkbox"]').first().trigger('change');
});
</script>
+2
View File
@@ -0,0 +1,2 @@
[INFO]
[MESSAGES]
+21
View File
@@ -0,0 +1,21 @@
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height" style="float:[NACHRICHT_FLOAT];">
<div class="inside inside-full-height" style= "border:1px solid black;">
<fieldset>
<legend>{|<b>[NACHRICHT_BETREFF]</b>|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Zeit|}:</td><td>[NACHRICHT_ZEIT]</td></tr>
<tr><td>{|Von|}:</td><td>[NACHRICHT_SENDER]</td></tr>
<tr><td>{|An|}:</td><td>[NACHRICHT_RECIPIENTS]</td></tr>
<tr><td>{|CC|}:</td><td>[NACHRICHT_CC_RECIPIENTS]</td></tr>
<tr><td colspan=2><hr style="border-style:solid; border-width:1px"></td></tr>
<tr><td colspan=2><div id="body" class="ticket_text_div">[NACHRICHT_TEXT]</div></td></tr>
<tr><td colspan=2><div id="body" class="ticket_attachments">[NACHRICHT_ANHANG]</div></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
+91
View File
@@ -0,0 +1,91 @@
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Neue E-Mail|}</legend>
<input type="hidden" name="type" value="email">
<input type="hidden" name="eintragId" value="[EINTRAGID]">
<div style="position: absolute; margin-top:27em; margin-left:30%; min-width: 90px; background: url(./themes/new/images/loading.gif) no-repeat; background-position: 50% 0px; background-size: 150px; padding-top: 90px; display:none; " id="mailworking">
</div>
<table width="100%" border="0" class="mkTableFormular">
<tr>
<td>An:</td>
<td><input type="text" name="email_an" id="email_an" value="[EMAIL_AN]" id="an" style="width: 500px;"></td>
<td align="right" valign="bottom">
</tr>
<tr>
<td>CC:</td>
<td><input type="text" id="email_cc" name="email_cc" value="[EMAIL_CC]" id="cc" style="width: 500px;"></td>
</tr>
<tr>
<td colspan="3"><br></td>
</tr>
<tr>
<td>Betreff:</td>
<td><input type="text" name="email_betreff" value="[EMAIL_BETREFF]" style="width: 500px;"></td>
</tr>
<tr>
<td>Text:</td>
<td colspan=2><textarea name="email_text" id="email_text" style="min-height: 180px;">[EMAIL_TEXT]</textarea><br><i>(Signatur für E-Mail wird automatisch angehängt)</i></td>
</tr>
[ANHAENGEHERAUFLADEN]
<tr>
<td colspan="3"><br></td>
</tr>
<tr valign="top">
<td>Anh&auml;nge:</td>
<td>
[ANHAENGE]
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="file" name="upload[]" id="file" multiple/></td>
</tr>
<tr>
<td align="left" valign="bottom">
<button name="submit" value="addfile" id="addfile" class="ui-button-icon" style="display:none">Hinzufügen</button>
</td>
<script type="text/javascript">
document.getElementById("file").onchange = function(e) {
document.getElementById("addfile").click();
}
</script>
</tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-14 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Neue E-Mail|}</legend>
<input type="hidden" name="type" value="email">
<input type="hidden" name="eintragId" value="[EINTRAGID]">
<div style="position: absolute; margin-top:27em; margin-left:30%; min-width: 90px; background: url(./themes/new/images/loading.gif) no-repeat; background-position: 50% 0px; background-size: 150px; padding-top: 90px; display:none; " id="mailworking">
</div>
<table width="100%" border="0" class="mkTableFormular">
<tr>
<td align="right" valign="bottom">
<button name="submit" value="entwurfloeschen" id="entwurfloeschen" class="ui-button-icon" style="width:100%;">Entwurf l&ouml;schen</button>
[DATEIENBUTTON]
</td>
</tr>
<tr>
<td align="right" ><button name="submit" value="zitat" id="zitat" class="ui-button-icon" style="width:100%;">Original-Nachricht einf&uuml;gen</button></td>
</tr>
<tr>
<td colspan="3"><br></td>
</tr>
<tr>
<td align="right" valign="bottom">
<button name="submit" value="absenden" id="absenden" class="ui-button-icon" style="width:100%;">Absenden</button>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
-266
View File
@@ -1,266 +0,0 @@
<!-- gehort zu tabview -->
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT]</a></li>
</ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<div id="tabs-1">
[MESSAGE]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside-white inside-full-height">
<div class="filter-box filter-usersave">
<div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}</div>
<ul class="filter-list">
<li class="filter-item">
<label for="nuraktive" class="switch">
<input type="checkbox" id="nuraktive">
<span class="slider round"></span>
</label>
<label for="nuraktive">&nbsp;{|nur aktive Regeln|}</label>
</li>
</ul>
</div>
</div>
[TAB1]
</div>
</div>
<div class="col-xs-12 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Aktionen|}</legend>
<input type="button" class="btnGreenNew" name="neuereintrag" value="&#10010; Neuer Eintrag" onclick="RegelnEdit(0);">
</fieldset>
</div>
</div>
</div>
</div>
[TAB1NEXT]
</div>
<!-- tab view schließen -->
</div>
<div id="editRegeln" style="display:none;" title="Bearbeiten">
<form method="post">
<input type="hidden" id="e_id">
<fieldset>
<legend>{|Regeln Eintrag|}</legend>
<table>
<tr>
<td width="180">{|Empf&auml;nger E-Mail Adresse|}:</td>
<td><input type="text" name="e_empf_email_adresse" id="e_empf_email_adresse" size="40"></td>
</tr>
<tr>
<td>{|Sender E-Mail Adresse|}:</td>
<td><input type="text" name="e_email_adresse" id="e_email_adresse" size="40"></td>
</tr>
<tr>
<td>{|Name|}:</td>
<td><input type="text" name="e_name" id="e_name" size="40"></td>
</tr>
<tr>
<td>{|Betreff|}:</td>
<td><input type="text" name="e_betreff" id="e_betreff" size="40"></td>
</tr>
<tr>
<td>{|Aktiv|}:</td>
<td><input type="checkbox" name="e_aktiv" id="e_aktiv" value="1"></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{|Aktion|}</legend>
<table>
<tr>
<td width="180">{|als SPAM markieren|}:</td>
<td><input type="checkbox" name="e_spam" id="e_spam" value="1"></td>
</tr>
<tr>
<td>{|als persönlich markieren|}:</td>
<td><input type="checkbox" name="e_persoenlich" id="e_persoenlich" value="1"></td>
</tr>
<tr>
<td>{|PRIO Markierung|}:</td>
<td><input type="checkbox" name="e_prio" id="e_prio" value="1"></td>
</tr>
<tr>
<td>{|DSGVO Markierung|}:</td>
<td><input type="checkbox" name="e_dsgvo" id="e_dsgvo" value="1"></td>
</tr>
<tr>
<td>{|Warteschlange zuordnen|}:</td>
<td>
<input type="text" id="ticketqueue" class="" tabindex="" name="ticketqueue" value="[WARTESCHLANGE]" size="50" placeholder="" maxlength="">
</td>
</tr>
</table>
</fieldset>
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
$('#e_email_adresse').focus();
$("#editRegeln").dialog({
modal: true,
bgiframe: true,
closeOnEscape:false,
minWidth:650,
maxHeight:700,
autoOpen: false,
buttons: {
ABBRECHEN: function() {
RegelnReset();
$(this).dialog('close');
},
SPEICHERN: function() {
RegelnEditSave();
}
}
});
$("#editRegeln").dialog({
close: function( event, ui ) { RegelnReset();}
});
});
function RegelnReset()
{
$('#editRegeln').find('#e_id').val('');
$('#editRegeln').find('#e_empf_email_adresse').val('');
$('#editRegeln').find('#e_email_adresse').val('');
$('#editRegeln').find('#e_name').val('');
$('#editRegeln').find('#e_betreff').val('');
$('#editRegeln').find('#e_spam').prop("checked", false);
$('#editRegeln').find('#e_persoenlich').prop("checked", false);
$('#editRegeln').find('#e_prio').prop("checked", false);
$('#editRegeln').find('#e_dsgvo').prop("checked", false);
$('#editRegeln').find('#ticketqueue').val('');
$('#editRegeln').find('#e_aktiv').prop("checked", true);
}
function RegelnEditSave() {
$.ajax({
url: 'index.php?module=ticket&action=regelnsave',
data: {
//Alle Felder die fürs editieren vorhanden sind
id: $('#e_id').val(),
empfaenger_email: $('#e_empf_email_adresse').val(),
sender_email: $('#e_email_adresse').val(),
name: $('#e_name').val(),
betreff: $('#e_betreff').val(),
spam: $('#e_spam').prop("checked")?1:0,
persoenlich: $('#e_persoenlich').prop("checked")?1:0,
prio: $('#e_prio').prop("checked")?1:0,
dsgvo: $('#e_dsgvo').prop("checked")?1:0,
warteschlange: $('#ticketqueue').val(),
aktiv: $('#e_aktiv').prop("checked")?1:0
},
method: 'post',
dataType: 'json',
beforeSend: function() {
App.loading.open();
},
success: function(data) {
App.loading.close();
if (data.status == 1) {
RegelnReset();
updateLiveTable();
$("#editRegeln").dialog('close');
} else {
alert(data.statusText);
}
}
});
}
function RegelnEdit(id) {
if(id > 0)
{
$.ajax({
url: 'index.php?module=ticket&action=regelnedit&cmd=get',
data: {
id: id
},
method: 'post',
dataType: 'json',
beforeSend: function() {
App.loading.open();
},
success: function(data) {
$('#editRegeln').find('#e_id').val(data.id);
$('#editRegeln').find('#e_empf_email_adresse').val(data.empfaenger_email)
$('#editRegeln').find('#e_email_adresse').val(data.sender_email);
$('#editRegeln').find('#e_name').val(data.name);
$('#editRegeln').find('#e_betreff').val(data.betreff);
$('#editRegeln').find('#e_spam').prop("checked",data.spam==1?true:false);
$('#editRegeln').find('#e_persoenlich').prop("checked",data.persoenlich==1?true:false);
$('#editRegeln').find('#e_prio').prop("checked",data.prio==1?true:false);
$('#editRegeln').find('#e_dsgvo').prop("checked",data.dsgvo==1?true:false);
$('#editRegeln').find('#ticketqueue').prop("value",data.warteschlange);
$('#editRegeln').find('#e_aktiv').prop("checked",data.aktiv==1?true:false);
App.loading.close();
$("#editRegeln").dialog('open');
}
});
} else {
RegelnReset();
$("#editRegeln").dialog('open');
}
}
function updateLiveTable(i) {
var oTableL = $('#ticketregeln').dataTable();
var tmp = $('.dataTables_filter input[type=search]').val();
oTableL.fnFilter('%');
//oTableL.fnFilter('');
oTableL.fnFilter(tmp);
}
function RegelnDelete(id) {
var conf = confirm('Wirklich löschen?');
if (conf) {
$.ajax({
url: 'index.php?module=ticket&action=regelndelete',
data: {
id: id
},
method: 'post',
dataType: 'json',
beforeSend: function() {
App.loading.open();
},
success: function(data) {
if (data.status == 1) {
updateLiveTable();
} else {
alert(data.statusText);
}
App.loading.close();
}
});
}
return false;
}
</script>
+1
View File
@@ -0,0 +1 @@
[TEXT]
+91
View File
@@ -0,0 +1,91 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1"></a></li>
</ul>
<!-- Example for multiple tabs
<ul hidden">
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
</ul>
-->
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Ticketregeln|}</legend><i>Ticketregeln f&uuml; die Verarbeitung bei Ticketeingang. Platzhalter werden mit % angegeben.</i>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|E-Mail Empf&auml;nger|}:</td><td><input type="text" name="empfaenger_email" value="[EMPFAENGER_EMAIL]" size="40"></td></tr>
<tr><td>{|E-Mail Verfasser|}:</td><td><input type="text" name="sender_email" value="[SENDER_EMAIL]" size="40"></td></tr>
<tr><td>{|Verfasser Name|}:</td><td><input type="text" name="name" value="[NAME]" size="40"></td></tr>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" value="[BETREFF]" size="40"></td></tr>
<tr><td>{|Papierkorb|}:</td><td><input type="text" name="spam" value="[SPAM]" size="40"></td></tr>
<tr><td>{|Pers&ouml;nlich|}:</td><td><input type="text" name="persoenlich" value="[PERSOENLICH]" size="40"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="40"></td></tr>
<tr><td>{|DSGVO|}:</td><td><input type="text" name="dsgvo" value="[DSGVO]" size="40"></td></tr>
<tr><td>{|Verantwortliche Warteschlange|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Aktiv|}:</td><td><input type="text" name="aktiv" value="[AKTIV]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<!-- Example for 2nd row
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Another legend|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Empfaenger_email|}:</td><td><input type="text" name="empfaenger_email" value="[EMPFAENGER_EMAIL]" size="40"></td></tr>
<tr><td>{|Sender_email|}:</td><td><input type="text" name="sender_email" value="[SENDER_EMAIL]" size="40"></td></tr>
<tr><td>{|Name|}:</td><td><input type="text" name="name" value="[NAME]" size="40"></td></tr>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" value="[BETREFF]" size="40"></td></tr>
<tr><td>{|Spam|}:</td><td><input type="text" name="spam" value="[SPAM]" size="40"></td></tr>
<tr><td>{|Persoenlich|}:</td><td><input type="text" name="persoenlich" value="[PERSOENLICH]" size="40"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="40"></td></tr>
<tr><td>{|Dsgvo|}:</td><td><input type="text" name="dsgvo" value="[DSGVO]" size="40"></td></tr>
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Aktiv|}:</td><td><input type="text" name="aktiv" value="[AKTIV]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div> -->
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
<!-- Example for 2nd tab
<div id="tabs-2">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|...|}</legend>
<table width="100%" border="0" class="mkTableFormular">
...
</table>
</fieldset>
</div>
</div>
</div>
</div>
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
-->
</div>
+5
View File
@@ -0,0 +1,5 @@
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>
+78
View File
@@ -0,0 +1,78 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1"></a></li>
</ul>
<!-- Example for multiple tabs
<ul hidden">
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
</ul>
-->
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|<!--Legend for this form area goes here>-->warteschlangen|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Kennung|}:</td><td><input type="text" name="label" value="[LABEL]" size="40"><i>Nur Buchstaben, keine Leerzeichen, keine Sonderzeichen und jede Kennung darf es nur einmal geben.</i></td></tr>
<tr valign="top"><td width="200">{|Verantwortlicher|}:</td><td width="">[ADRESSEAUTOSTART]<input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="40">[ADRESSEAUTOEND]</td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<!-- Example for 2nd row
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Another legend|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Label|}:</td><td><input type="text" name="label" value="[LABEL]" size="40"></td></tr>
<tr><td>{|Wiedervorlage|}:</td><td><input type="text" name="wiedervorlage" value="[WIEDERVORLAGE]" size="40"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div> -->
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
<!-- Example for 2nd tab
<div id="tabs-2">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|...|}</legend>
<table width="100%" border="0" class="mkTableFormular">
...
</table>
</fieldset>
</div>
</div>
</div>
</div>
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
-->
</div>
@@ -0,0 +1,5 @@
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>
+46 -48
View File
@@ -39,7 +39,6 @@ class Dateien {
// alle artikel die ein Kunde kaufen kann mit preisen netto brutto
$cmd = $app->Secure->GetGET("smodule");
$cmd = strtolower($_objekt);
$adresse = $app->DB->Select("SELECT adresse FROM {$cmd} WHERE id='$id' LIMIT 1");
// headings
$heading = array('','','','Titel', 'Stichwort', 'Version','Gr&ouml;&szlig;e', 'Ersteller','Version','Datum','Men&uuml;');
@@ -89,6 +88,31 @@ class Dateien {
LEFT JOIN datei_version v ON v.datei=d.id WHERE $where";
}
switch ($name) {
case "dateien_list":
$allowed['dateien_list'] = array('list');
$heading = array('ID','Titel', 'Beschreibung', 'Verkn&uuml;pfung', 'Geloescht', 'Logdatei', 'Men&uuml;');
$width = array('10%'); // Fill out manually later
$findcols = array('d.id','d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei');
$searchsql = array('d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei');
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=dateien&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
$sql = "SELECT SQL_CALC_FOUND_ROWS d.id, d.id, d.titel, d.beschreibung, GROUP_CONCAT(ds.objekt SEPARATOR ', '), d.geloescht, d.logdatei, d.id FROM datei d LEFT join datei_stichwoerter ds ON ds.datei = d.id";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM datei WHERE $where";
$groupby = " GROUP BY d.id ";
break;
}
$erg = [];
foreach($erlaubtevars as $k => $v)
@@ -113,7 +137,7 @@ class Dateien {
$this->app->ActionHandler("create","DateienCreate");
$this->app->ActionHandler("edit","DateienEdit");
$this->app->ActionHandler("list","DateienList");
$this->app->ActionHandler("list","datei_list");
$this->app->ActionHandler("archiv","DateienArchiv");
$this->app->ActionHandler("artikel","DateienArtikel");
$this->app->ActionHandler("send","DateienSend");
@@ -172,23 +196,16 @@ class Dateien {
$this->app->erp->Headlines('Dateien');
}
function datei_list() {
$this->app->erp->MenuEintrag("index.php?module=dateien&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=dateien&action=create", "Neu anlegen");
function DateienList()
{
$this->DateienHauptMenu();
/* Dateiene zur Nachbesserung */
$this->app->Tpl->Set('HEADING','Dateien');
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'dateien_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "dateien_list.tpl");
}
$this->app->Tpl->Set('SUBHEADING','Neuste Dateien');
//Jeder der in Nachbesserung war egal ob auto oder manuell wandert anschliessend in Manuelle-Freigabe");
$table = new EasyTable($this->app);
$table->Query("SELECT d.titel, s.subjekt, v.version, v.ersteller, v.bemerkung, d.id FROM datei d LEFT JOIN datei_stichwoerter s ON d.id=s.datei LEFT JOIN datei_version v ON v.datei=d.id ORDER by d.id DESC LIMIT 10",0,"");
$table->Display('INHALT');
$this->app->Tpl->Parse('PAGE',"rahmen.tpl");
$this->app->Tpl->Set('INHALT','');
}
function DateienDownload()
{
$typ = $this->app->Secure->GetGET('typ');
@@ -274,7 +291,7 @@ class Dateien {
$fileid = $this->app->erp->CreateDatei($_FILES['upload']['name'],$titel,$beschreibung,$nummer,$_FILES['upload']['tmp_name'],$this->app->User->GetName());
// stichwoerter hinzufuegen
$this->app->erp->AddDateiStichwort($fileid,$subjekt,$objekt);
$this->app->erp->AddDateiStichwort($fileid,$subjekt,$objekt,$nummer);
$this->app->Location->execute('index.php?module=dateien&action=edit&id='.$fileid);
//loeschen von /tmp
}
@@ -305,7 +322,6 @@ class Dateien {
$beschreibung = $this->app->DB->Select("SELECT beschreibung FROM datei WHERE id='$id' LIMIT 1");
$nummer= $this->app->DB->Select("SELECT nummer FROM datei WHERE id='$id' LIMIT 1");
$this->app->Tpl->Set('TITEL',$titel);
$this->app->Tpl->Set('KURZUEBERSCHRIFT2',$titel);
$this->app->Tpl->Set('BESCHREIBUNG',$beschreibung);
@@ -313,17 +329,22 @@ class Dateien {
$table = new EasyTable($this->app);
$table->Query("SELECT version,dateiname,datum,ersteller,bemerkung,id FROM datei_version WHERE datei='$id'",0,"");
$table->DisplayNew('VERSIONEN',"
/* $table->DisplayNew('VERSIONEN',"
<!--<a href=\"index.php?module=adresse&action=dateiversion&id=$id&lid=%value%\">edit</a>-->
<a href=\"#\"onclick=\"if(!confirm('Wirklich löschen?')) return false; else window.location.href='index.php?module=dateien&action=delete&fid=%value%&version=true&id=$id';\" ><img src=\"./themes/new/images/delete.svg\" border=\"0\"></a>
<a href=\"index.php?module=dateien&action=send&fid=%value%&id=$id\"><img src=\"./themes/new/images/download.svg\" border=\"0\"></a>
",
"<!--<a href=\"index.php?module=adresse&action=lieferadresseneu&id=$id\">Neue Version anlegen</a>-->");
"<!--<a href=\"index.php?module=adresse&action=lieferadresseneu&id=$id\">Neue Version anlegen</a>-->");*/
$table->DisplayNew('VERSIONEN',"
<a href=\"index.php?module=dateien&action=send&fid=%value%&id=$id\"><img src=\"./themes/new/images/download.svg\" border=\"0\"></a>
");
$table = new EasyTable($this->app);
$table->Query("SELECT subjekt,objekt,parameter FROM datei_stichwoerter WHERE datei='$id'",0,"");
$table->DisplayNew('STICHWORTE',"Parameter","noAction");
$table->DisplayNew('STICHWOERTER',"Parameter","noAction");
$this->app->YUI->AutoComplete("auftrag_zuordnen","auftrag");
$this->app->YUI->AutoComplete("verbindlichkeit_zuordnen","verbindlichkeit");
$this->app->Tpl->Set('HEADING',"Datei (Bearbeiten)");
$this->app->Tpl->Parse('PAGE',"datei.tpl");
@@ -346,32 +367,9 @@ class Dateien {
$this->app->erp->RunHook('LayouttemplateAttachmentItemsDelete', 2, $id, $cmd);
$version = $this->app->Secure->GetGET("version");
if($version!='')
{
if(is_numeric($fid)){
$this->app->DB->Delete("DELETE FROM datei_version WHERE id='$fid' AND datei='$id' LIMIT 1");
}
// TODO Datei aus dem Dateisystem entfernen
$this->app->Location->execute("index.php?module=dateien&action=edit&id=$id");
}
// stichweoeter loeschen
if(is_numeric($id)){
// Deletion of files removed, they only get marketd
if($cmd!="")
{
$this->app->DB->Delete("DELETE FROM datei_stichwoerter WHERE datei='$id' AND objekt LIKE '$cmd' LIMIT 1");
} else {
$this->app->DB->Delete("DELETE FROM datei_stichwoerter WHERE datei='$id'");
}
$check = $this->app->DB->Select("SELECT COUNT(id) FROM datei_stichwoerter WHERE datei='$id'");
if($check <=0)
{
$this->app->DB->Delete("DELETE FROM datei_version WHERE datei='$id'");
$this->app->DB->Update("UPDATE datei SET geloescht=1 WHERE id='$id'");
}
}
$this->app->DB->Update("UPDATE datei SET geloescht=1 WHERE id='$id'");
$refer = $_SERVER['HTTP_REFERER'];
$this->app->Location->execute($refer);
}
File diff suppressed because it is too large Load Diff
+84 -3
View File
@@ -5,6 +5,7 @@
*/
use Xentral\Components\Database\Exception\QueryFailureException;
use Xentral\Components\Logger\Logger;
class Emailbackup {
@@ -19,6 +20,7 @@ class Emailbackup {
$this->app->ActionHandler("edit", "emailbackup_edit");
$this->app->ActionHandler("delete", "emailbackup_delete");
$this->app->ActionHandler("test_smtp",'emailbackup_test_smtp');
$this->app->ActionHandler("test_imap",'emailbackup_test_imap');
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
@@ -42,10 +44,10 @@ $width = array('10%'); // Fill out manually later
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=emailbackup&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.png\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=emailbackup&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=emailbackup&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=emailbackup&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
// $sql = "SELECT id, angezeigtername, internebeschreibung, benutzername, passwort, server, smtp, ticket, imap_sentfolder_aktiv, imap_sentfolder, imap_port, imap_type, autoresponder, geschaeftsbriefvorlage, autoresponderbetreff, autorespondertext, projekt, emailbackup, adresse, firma, loeschtage, geloescht, ticketloeschen, ticketabgeschlossen, ticketqueue, ticketprojekt, ticketemaileingehend, smtp_extra, smtp_ssl, smtp_port, smtp_frommail, smtp_fromname, client_alias, smtp_authtype, smtp_authparam, smtp_loglevel, autosresponder_blacklist, eigenesignatur, signatur, mutex, abdatum, email, id FROM emailbackup";
$sql = "SELECT id, email, angezeigtername, internebeschreibung, benutzername, server, smtp, ticket, emailbackup, id FROM emailbackup";
$sql = "SELECT SQL_CALC_FOUND_ROWS id, email, angezeigtername, internebeschreibung, benutzername, server, smtp, ticket, emailbackup, id FROM emailbackup";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM emailbackup WHERE $where";
@@ -294,11 +296,90 @@ $width = array('10%'); // Fill out manually later
}
else {
$msg = $this->app->erp->base64_url_encode(
'<div class="error">Fehler beim Versende der Testmail: '.$this->app->erp->mail_error.'</div>'
'<div class="error">Fehler beim Versenden der Testmail: '.$this->app->erp->mail_error.'</div>'
);
}
$this->app->Location->execute("index.php?module=emailbackup&id=$id&action=edit&msg=$msg");
}
function emailbackup_test_imap() {
$id = $this->app->Secure->GetGET('id');
// get email Account
/** @var EmailAccountGateway $accountGateway */
$accountGateway = $this->app->Container->get('EmailAccountGateway');
$account = $accountGateway->getEmailAccountById($id);
if(!empty($account)) {
/** @var Ticket $ticketModule */
$ticketModule = $this->app->erp->LoadModul('ticket');
/** @var MailClientFactory $factory */
$factory = $this->app->Container->get('MailClientFactory');
/** @var MailClientConfigProvider $configProvider */
$configProvider = $this->app->Container->get('MailClientConfigProvider');
/** @var TicketFormatter $formatHelper */
$formatHelper = $this->app->Container->get('TicketFormatter');
/** @var TicketImportHelperFactory $importHelperFactory */
$importHelperFactory = $this->app->Container->get('TicketImportHelperFactory');
/** @var Logger $logger */
$logger = $this->app->Container->get('Logger');
$logger->debug(
'Start imap test {email}',
['email' => $account->getEmailAddress(), 'account' => $account]
);
// create mail client
try {
$mailConfig = $configProvider->createImapConfigFromAccount($account);
$mailClient = $factory->createImapClient($mailConfig);
} catch (Exception $e) {
$logger->error('Failed to create email client', ['error' => (string)$e, 'account' => $account]);
$msg = $this->app->erp->base64_url_encode(
'<div class="error">Fehler IMAP Test: '.$this->app->erp->mail_error.'</div>');
$error = true;
}
// connect mail client
try {
$mailClient->connect();
} catch (Exception $e) {
$logger->error('Error during imap connection', ['error' => (string)$e, 'account' => $account]);
$msg = $this->app->erp->base64_url_encode(
'<div class="error">Fehler IMAP Test: '.$this->app->erp->mail_error.'</div>');
$error = true;
}
// connet to INBOX folder
try {
$mailClient->selectFolder('INBOX');
} catch (Exception $e) {
$logger->error('Failed to select INBOX folder', ['error' => (string)$e, 'account' => $account]);
$msg = $this->app->erp->base64_url_encode(
'<div class="error">Fehler IMAP Test: '.$this->app->erp->mail_error.'</div>');
$error = true;
}
$mailClient->expunge();
$mailClient->disconnect();
if (!$error) {
$msg = $this->app->erp->base64_url_encode(
'<div class="info">IMAP Verbindung erfolgreich!</div>');
$logger->debug(
'IMAP test ok {email}',
['email' => $account->getEmailAddress(), 'account' => $account]
);
}
} else
{
$msg = $this->app->erp->base64_url_encode(
'<div class="error">Kein Account gefunden!</div>');
}
$this->app->Location->execute("index.php?module=emailbackup&id=$id&action=edit&msg=$msg");
}
}
+939
View File
@@ -0,0 +1,939 @@
<?php
/*
* Copyright (c) 2022 Xenomporio project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
use Xentral\Modules\Ticket\Task;
class Ticket {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "ticket_list");
$this->app->ActionHandler("create", "ticket_create"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "ticket_edit");
$this->app->ActionHandler("minidetail", "ticket_minidetail");
$this->app->ActionHandler("text", "ticket_text"); // Output text for iframe display
$this->app->ActionHandler("text_ausgang", "ticket_text_ausgang"); // Output text for iframe display
$this->app->ActionHandler("statusfix", "ticket_statusfix"); // Xentral 20 compatibility set all ticket status to latest ticket_nachricht status
$this->app->ActionHandler("datefix", "ticket_datefix"); // Xentral 20 compatibility set all ticket dates to latest ticket_nachricht date
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
public function Install() {
/* Fill out manually later */
}
function ticket_status_icon(string $status) {
return('<img src="./themes/new/images/status_'.$status.'.png" style="margin-right:1px" title="'.$status.'" border="0">');
}
public function TableSearch(&$app, $name, $erlaubtevars) {
function ticket_iconssql() {
return "CONCAT('<img src=\"./themes/new/images/status_',`t`.`status`,'.png\" style=\"margin-right:1px\" title=\"',`t`.`status`,'\" border=\"0\">')";
}
switch ($name) {
case "ticket_list":
$allowed['ticket_list'] = array('list');
$heading = array('','','Ticket #', 'Letzte Aktion', 'Adresse', 'Betreff', 'Tags', 'Verant.', 'Nachr.', 'Status', 'Alter', 'Projekt', 'Men&uuml;');
$width = array('1%','1%','5%', '5%', '5%', '30%', '1%', '5%', '1%', '1%', '1%', '1%', '1%');
$findcols = array('t.id','t.zeit','t.schluessel', 't.zeit', 'a.name', 't.betreff', 't.tags', 'w.warteschlange', 'nachrichten_anz', 't.status','t.zeit', 't.projekt');
$searchsql = array( 't.schluessel', 't.zeit', 'a.name', 't.betreff','t.notiz', 't.tags', 'w.warteschlange', 't.status', 't.projekt');
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=ticket&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>" . "</td></tr></table>";
$timedifference = "if (
TIMESTAMPDIFF(hour, t.zeit, NOW()) < 24,
CONCAT(TIMESTAMPDIFF(hour, t.zeit, NOW()),'h'),
CONCAT(TIMESTAMPDIFF(day, t.zeit, NOW()), 'd ',MOD(TIMESTAMPDIFF(hour, t.zeit, NOW()),24),'h'))";
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',t.id,'\" />') AS `auswahl`";
$priobetreff = "if(t.prio!=1,t.betreff,CONCAT('<b><font color=red>',t.betreff,'</font></b>'))";
$anzahlnachrichten = "(SELECT COUNT(n.id) FROM ticket_nachricht n WHERE n.ticket = t.schluessel)";
$tagstart = "<li class=\"tag-editor-tag\">";
$tagend = "</li>";
$sql = "SELECT SQL_CALC_FOUND_ROWS
t.id,
".$dropnbox.",
CONCAT('<a href=\"index.php?module=ticket&action=edit&id=',t.id,'\">',t.schluessel,'</a>'),
t.zeit,
a.name,
CONCAT('<b>',".$priobetreff.",'</b><br/><i>',replace(substring(ifnull(t.notiz,''),1,500),'\n','<br/>'),'</i>'),
CONCAT('<div class=\"ticketoffene\"><ul class=\"tag-editor\">'\n,'".$tagstart."',replace(t.tags,',','".$tagend."<div class=\"tag-editor-spacer\">&nbsp;</div>".$tagstart."'),'".$tagend."','</ul></div>'),
w.warteschlange,
".$anzahlnachrichten." as nachrichten_anz,
".ticket_iconssql().",
".$timedifference.",
p.abkuerzung,
t.id
FROM ticket t
LEFT JOIN adresse a ON t.adresse = a.id
LEFT JOIN warteschlangen w ON t.warteschlange = w.label
LEFT JOIN projekt p on t.projekt = p.id";
$where = "1";
// Toggle filters
$this->app->Tpl->Add('JQUERYREADY', "$('#meinetickets').click( function() { fnFilterColumn1( 0 ); } );");
$this->app->Tpl->Add('JQUERYREADY', "$('#prio').click( function() { fnFilterColumn2( 0 ); } );");
$this->app->Tpl->Add('JQUERYREADY', "$('#geschlossene').click( function() { fnFilterColumn3( 0 ); } );");
$this->app->Tpl->Add('JQUERYREADY', "$('#spam').click( function() { fnFilterColumn4( 0 ); } );");
for ($r = 1;$r <= 4;$r++) {
$this->app->Tpl->Add('JAVASCRIPT', '
function fnFilterColumn' . $r . ' ( i )
{
if(oMoreData' . $r . $name . '==1)
oMoreData' . $r . $name . ' = 0;
else
oMoreData' . $r . $name . ' = 1;
$(\'#' . $name . '\').dataTable().fnFilter(
\'\',
i,
0,0
);
}
');
}
$more_data1 = $this->app->Secure->GetGET("more_data1");
if ($more_data1 == 1) {
$where .= " AND t.warteschlange IN (SELECT w.label FROM warteschlangen w WHERE adresse=".$this->app->User->GetAdresse().")"; // Queues of user
} else {
}
$more_data2 = $this->app->Secure->GetGET("more_data2");
if ($more_data2 == 1) {
$where .= " AND t.prio = '1'";
}
else {
}
$more_data3 = $this->app->Secure->GetGET("more_data3");
if ($more_data3 == 1) {
}
else {
$where .= " AND (t.status <> 'abgeschlossen')"; // Exclude and geschlossen
}
$more_data4 = $this->app->Secure->GetGET("more_data4");
if ($more_data4 == 1) {
}
else {
$where .= " AND (t.status <> 'spam')";
}
// END Toggle filters
$moreinfo = true; // Allow drop down details
$menucol = 12; // For moredata
$count = "SELECT count(DISTINCT id) FROM ticket t WHERE $where";
// echo(htmlentities($sql." ".$where));
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function ticket_list() {
// Process multi action
$auswahl = $this->app->Secure->GetPOST('auswahl');
$selectedIds = [];
if(!empty($auswahl)) {
foreach($auswahl as $selectedId) {
$selectedId = (int)$selectedId;
if($selectedId > 0) {
$selectedIds[] = $selectedId;
}
}
$status = $this->app->Secure->GetPOST('status');
$warteschlange = $this->app->Secure->GetPOST('warteschlange');
$sql = "UPDATE ticket SET status = '".$status."', zeit = NOW()";
if ($warteschlange != '') {
$sql .= ", warteschlange = '".explode(" ",$warteschlange)[0]."'";
}
$sql .= " WHERE id IN (".implode(",",$selectedIds).")";
$this->app->DB->Update($sql);
}
// List
$this->app->YUI->TagEditor('taglist', array('width'=>370));
$this->app->Tpl->Add('SCRIPTJAVASCRIPT','<link rel="stylesheet" type="text/css" href="./css/jquery.tag-editor.css">');
$this->app->erp->MenuEintrag("index.php?module=ticket&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=ticket&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->Tpl->Set('STATUS', $this->app->erp->GetStatusTicketSelect('neu'));
$this->app->YUI->AutoComplete("warteschlange","warteschlangename");
$this->app->YUI->TableSearch('TAB1', 'ticket_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "ticket_list.tpl");
}
function get_messages_of_ticket($ticket_id, $where, $limit) {
if ($limit) {
$limitsql = " LIMIT ".((int) $limit);
} else {
$limitsql = "";
}
if (empty($ticket_id)) {
$ticket_where = "";
} else {
$ticket_where = " AND t.id = ".$ticket_id;
}
if (empty($where)) {
$where = "1";
}
// $sql = "SELECT n.id, n.betreff, n.verfasser, n.mail, n.mail_cc, n.zeit, n.zeitausgang, n.versendet, n.text, n.verfasser_replyto, mail_replyto, (SELECT GROUP_CONCAT(value SEPARATOR ', ' FROM ticket_header th WHERE th.ticket_nachricht = n.id AND th.type = 'cc') value from) as cc FROM ticket_nachricht n INNER JOIN ticket t ON t.schluessel = n.ticket WHERE (".$where.") AND t.id = ".$ticket_id." ORDER BY n.zeit DESC ".$limitsql;
$sql = "SELECT n.id,
n.betreff,
n.bearbeiter,
n.verfasser,
n.mail,
t.quelle,
n.zeit,
n.zeitausgang,
n.versendet,
n.text,
n.textausgang,
n.verfasser_replyto,
n.mail_replyto,
n.mail_cc,
(SELECT GROUP_CONCAT(value SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = n.id AND th.type = 'cc') as mail_cc_recipients,
(SELECT GROUP_CONCAT(value SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = n.id AND th.type = 'to') as mail_recipients
FROM ticket_nachricht n INNER JOIN ticket t ON t.schluessel = n.ticket
WHERE (".$where.") ".$ticket_where." ORDER BY n.zeit DESC ".$limitsql;
return $this->app->DB->SelectArr($sql);
}
function add_attachments_html($ticket_id, $message_id,$templatepos,$showdelete) {
$file_attachments = $this->app->erp->GetDateiSubjektObjekt('Anhang','Ticket',$message_id);
if (!empty($file_attachments)) {
$this->app->Tpl->Add('NACHRICHT_ANHANG',"<hr style=\"border-style:solid; border-width:1px\">");
foreach ($file_attachments as $file_attachment) {
if ($showdelete) {
$deletetext = '<a href=index.php?module=ticket&action=edit&id='.$ticket_id.'&cmd=deleteattachment'.'&fileid='.$file_attachment.'>'.
'<img src="./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/delete.svg" /></a>';
} else {
$deletetext = "";
}
$attachtext = "";
/* Not implemented -> Attachment of ticket_nachricht to business object is the better option -> implement later
$attachtext = '<a href=index.php?module=dateien&action=edit&id='.$file_attachment.'>'.
'<img src="./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/copy.svg" /></a>'; */
$this->app->Tpl->Add($templatepos,
"<a href=\"index.php?module=dateien&action=send&id=".$file_attachment.
"\">".
htmlentities($this->app->erp->GetDateiName($file_attachment)).
" (".
$this->app->erp->GetDateiSize($file_attachment).
")".
"</a>".
$deletetext.
$attachtext.
"<br>");
}
}
}
function add_messages_tpl($messages, $showdrafts) {
// Add Messages now
foreach ($messages as $message) {
// Clear this first
$this->app->Tpl->Set('NACHRICHT_ANHANG',"");
// Xentral 20 compatibility
if ($message['textausgang'] != '') {
// Sent message
$this->app->Tpl->Set("NACHRICHT_BETREFF",'<a href="index.php?module=ticket&action=text_ausgang&mid='.$message['id'].'" target="_blank">'.htmlentities($message['betreff']).'</a>');
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']);
$this->app->Tpl->Set("NACHRICHT_FLOAT","right");
$this->app->Tpl->Set("NACHRICHT_TEXT",$message['textausgang']);
$this->app->Tpl->Set("NACHRICHT_SENDER",htmlentities($message['bearbeiter']));
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['verfasser']." <".$message['mail'].">"));
// $this->app->Tpl->Set("NACHRICHT_TEXT",$message['textausgang']);
$this->app->Tpl->Set("NACHRICHT_TEXT",'<iframe class="ticket_text" src="index.php?module=ticket&action=text_ausgang&mid='.$message['id'].'"></iframe>');
$this->app->Tpl->Parse('MESSAGES', "ticket_nachricht.tpl");
}
if ($message['versendet'] == '1' && empty($message['textausgang'])) { // textausgang is always empty, except for old Xentral 20 tickets
// Sent message
if (is_null($message['zeitausgang'])) {
if (!$showdrafts) {
continue;
}
$this->app->Tpl->Set("NACHRICHT_BETREFF",htmlentities($message['betreff']." (Entwurf)"));
} else {
$this->app->Tpl->Set("NACHRICHT_BETREFF",htmlentities($message['betreff']));
}
$this->app->Tpl->Set("NACHRICHT_SENDER",htmlentities($message['verfasser']." <".$message['mail_replyto'].">"));
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['mail']));
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc']));
$this->app->Tpl->Set("NACHRICHT_FLOAT","right");
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']);
$this->app->Tpl->Set("NACHRICHT_NAME",htmlentities($message['verfasser']));
} else {
// Received message
$this->app->Tpl->Set("NACHRICHT_SENDER",htmlentities($message['verfasser']." <".$message['mail'].">"));
if ($message['mail_recipients'] != '') {
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['mail_recipients']));
}
else {
// Xentral 20 compatibility
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['quelle']));
}
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc_recipients']));
$this->app->Tpl->Set("NACHRICHT_BETREFF",'<a href="index.php?module=ticket&action=text&mid='.$message['id'].'" target="_blank">'.htmlentities($message['betreff']).'</a>');
$this->app->Tpl->Set("NACHRICHT_FLOAT","left");
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']);
}
// $this->app->Tpl->Set("NACHRICHT_TEXT",$message['text']);
$this->app->Tpl->Set("NACHRICHT_TEXT",'<iframe class="ticket_text" src="index.php?module=ticket&action=text&mid='.$message['id'].'"></iframe>');
$this->add_attachments_html($id,$message['id'],'NACHRICHT_ANHANG',false);
$this->app->Tpl->Parse('MESSAGES', "ticket_nachricht.tpl");
}
}
function ticket_text() {
$mid = $this->app->Secure->GetGET('mid');
if (empty($mid)) {
return;
}
$messages = $this->get_messages_of_ticket("", "n.id = ".$mid, NULL);
if (empty($messages)) {
}
$this->app->Tpl->Set("TEXT",$messages[0]['text']);
$this->app->Tpl->Output('ticket_text.tpl');
$this->app->ExitXentral();
}
function ticket_text_ausgang() {
$mid = $this->app->Secure->GetGET('mid');
if (empty($mid)) {
return;
}
$messages = $this->get_messages_of_ticket("", "n.id = ".$mid, NULL);
if (empty($messages)) {
}
$this->app->Tpl->Set("TEXT",$messages[0]['textausgang']);
$this->app->Tpl->Output('ticket_text.tpl');
$this->app->ExitXentral();
}
/**
* @throws NumberGeneratorException
*
* @return string
*/
private function generateRandomTicketNumber(): string
{
$random = rand(300,700);
$loopCounter = 0;
while(true) {
$candidate = sprintf('%s%04d', date('Ymd'), $random++);
if (!$this->app->DB->Select('SELECT id FROM ticket WHERE schluessel = '.$candidate)) {
return($candidate);
}
if ($loopCounter > 99) {
throw new NumberGeneratorException('ticket number generation failed');
}
$loopCounter++;
}
}
function ticket_save_to_db($id, $input) {
// Write to database
// Add checks here
if (empty($id)) {
// New item
$id = 'NULL';
}
if ($input['betreff'] == '') {
$input['betreff'] = "...";
}
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
$input['adresse'] = $this->app->erp->ReplaceAdresse(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
$input['warteschlange'] = explode(" ",$input['warteschlange'])[0]; // Just the label
$input['zeit'] = date('Y-m-d H:i:s', time());
$columns = "id, ";
$values = "$id, ";
$update = "";
$fix = "";
foreach ($input as $key => $value) {
if ($this->app->DB->ColumnExists('ticket',$key)) {
$columns = $columns.$fix.$key;
$values = $values.$fix."'".$value."'";
$update = $update.$fix.$key." = '$value'";
$fix = ", ";
}
}
$sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
$this->app->DB->Update($sql);
$id = $this->app->DB->GetInsertID();
return($id);
}
function save_draft($id, $input) {
$columns = "id, ";
$values = "$id, ";
$update = "";
$fix = "";
// Translate form to table
$input['betreff'] = $input['email_betreff'];
$input['mail'] = $input['email_an'];
$input['mail_cc'] = $input['email_cc'];
$input['text'] = $input['email_text'];
foreach ($input as $key => $value) {
if ($this->app->DB->ColumnExists('ticket_nachricht',$key)) {
$columns = $columns.$fix.$key;
$values = $values.$fix."'".$value."'";
$update = $update.$fix.$key." = '$value'";
$fix = ", ";
}
}
$sql = "INSERT INTO ticket_nachricht (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
$this->app->DB->Update($sql);
}
function ticket_create() {
$submit = $this->app->Secure->GetPOST('submit');
$input = $this->GetInput();
$projekt_id = $this->app->User->DefaultProjekt();
$projekt = $this->app->DB->Select("SELECT abkuerzung FROM projekt WHERE id = ".$projekt_id);
if ($submit != '') {
$input['schluessel'] = $this->generateRandomTicketNumber();
$input['kunde'] = $this->app->User->GetName();
$id = $this->ticket_save_to_db($id, $input);
header("Location: index.php?module=ticket&action=edit&id=$id");
exit();
}
$this->app->Tpl->Set('PROJEKT', $projekt);
$this->app->Tpl->Set('STATUSICON', $this->ticket_status_icon('neu')."&nbsp;");
$this->app->YUI->AutoComplete("adresse","adresse");
$this->app->YUI->AutoComplete("projekt","projektname",1);
$this->app->YUI->AutoComplete("status","ticketstatus",1);
$this->app->Tpl->Set('STATUS', $this->app->erp->GetStatusTicketSelect('neu'));
$this->app->YUI->AutoComplete("warteschlange","warteschlangename");
$this->app->Tpl->Parse('PAGE', "ticket_create.tpl");
}
function ticket_edit() {
$id = $this->app->Secure->GetGET('id');
if (empty($id)) {
return;
}
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=ticket&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=ticket&action=list", "Zur&uuml;ck zur &Uuml;bersicht");
$id = $this->app->Secure->GetGET('id');
$cmd = $this->app->Secure->GetGET('cmd');
$input = $this->GetInput();
$submit = $this->app->Secure->GetPOST('submit');
$msg = $this->app->erp->base64_url_decode($this->app->Secure->GetGET('msg'));
if ($input['neue_notiz'] != '') {
$input['notiz'] = $this->app->User->GetName()." ".date("d.m.Y H:i").": ".$input['neue_notiz']."\r\n".$input['notiz'];
}
// Always save
if ($submit != '')
{
$this->ticket_save_to_db($id, $input);
$msg = "<div class=\"success\">Die Einstellungen wurden erfolgreich &uuml;bernommen.</div>";
}
// Load values again from database
$ticket_from_db = $this->app->DB->SelectArr("SELECT t.id, t.schluessel, t.zeit, p.abkuerzung as projekt, t.bearbeiter, t.quelle, t.status, t.prio, t.adresse, t.kunde, CONCAT(w.label,' ',w.warteschlange) as warteschlange, t.mailadresse, t.betreff, t.zugewiesen, t.inbearbeitung, t.inbearbeitung_user, t.firma, t.notiz, t.bitteantworten, t.service, t.kommentar, t.privat, t.dsgvo, t.tags, t.nachrichten_anz, t.id FROM ticket t LEFT JOIN adresse a ON t.adresse = a.id LEFT JOIN projekt p on t.projekt = p.id LEFT JOIN warteschlangen w on t.warteschlange = w.label WHERE t.id=$id")[0];
foreach ($ticket_from_db as $key => $value) {
$this->app->Tpl->Set(strtoupper($key), $value);
}
$this->app->Tpl->Set('PRIO', $ticket_from_db['prio']==1?"checked":"");
$this->app->Tpl->Set('STATUSICON', $this->ticket_status_icon($ticket_from_db['status'])."&nbsp;");
$this->app->YUI->AutoComplete("adresse","adresse");
$this->app->Tpl->Set('ADRESSE', $this->app->erp->ReplaceAdresse(false,$ticket_from_db['adresse'],false)); // Convert ID to form display
$this->app->Tpl->Set('ADRESSE_ID',$ticket_from_db['adresse']);
$this->app->YUI->AutoComplete("projekt","projektname",1);
$this->app->YUI->AutoComplete("status","ticketstatus",1);
$this->app->YUI->TagEditor('tags', array('width'=>370));
$this->app->Tpl->Set('STATUS', $this->app->erp->GetStatusTicketSelect($ticket_from_db['status']));
$input['projekt'] = $this->app->erp->ReplaceProjekt(false,$input['projekt'],false); // Parameters: Target db?, value, from form?
$this->app->YUI->AutoComplete("warteschlange","warteschlangename");
// END Header
// Check for draft
$drafted_messages = $this->get_messages_of_ticket($id, "zeitausgang IS NULL AND versendet = '1'",NULL);
if (!empty($drafted_messages)) {
// Draft from form?
if ($submit != '') {
$this->save_draft($drafted_messages[0]['id'],$input);
// Reload
$drafted_messages = $this->get_messages_of_ticket($id, "zeitausgang IS NULL AND versendet = '1'",NULL);
}
// Load the draft for editing
$this->app->Tpl->Set('EMAIL_AN', htmlentities($drafted_messages[0]['mail']));
$this->app->Tpl->Set('EMAIL_CC', htmlentities($drafted_messages[0]['mail_cc']));
$this->app->Tpl->Set('EMAIL_BCC', htmlentities($drafted_messages[0]['mail_bcc']));
$this->app->Tpl->Set('EMAIL_BETREFF', htmlentities($drafted_messages[0]['betreff']));
$this->app->Tpl->Set('EMAIL_TEXT',htmlentities($drafted_messages[0]['text']));
// Show new message dialog
$this->app->Tpl->Set('EMAIL_SENDER', $this->app->erp->GetSelectEmailMitName($dokument['von']));
$this->app->YUI->AutoComplete("email_an","emailname");
$this->app->YUI->AutoComplete("email_cc","emailname");
$this->app->YUI->AutoComplete("email_bcc","emailname");
$this->app->YUI->CkEditor("email_text","internal", null, 'JQUERY');
// Delete attachment from draft
if ($cmd=='deleteattachment') {
$fileid = $this->app->Secure->GetGET('fileid');
// Check if this file is only attached to this draft and nowhere else
$check = $this->app->erp->GetDateiStichwoerter($fileid);
$save_to_delete = true;
foreach ($check as $stichwort) {
if ($stichwort['subjekt'] != 'anhang' || $stichwort['objekt'] != 'Ticket' || $stichwort['parameter'] != $drafted_messages[0]['id']) {
$save_to_delete = false;
break;
}
}
if ($save_to_delete) {
$this->app->erp->DeleteDatei($fileid);
} else {
$msg .= "<div class=\"success\">Fehler beim Löschen der Datei: In Verwendung.</div>";
}
}
// Upload of attachments
if(isset($_FILES['upload']) && is_array($_FILES['upload']))
{
foreach($_FILES['upload']['tmp_name'] as $key => $file)
{
if($file != "")
{
$fileid = $this->app->erp->CreateDatei($_FILES['upload']['name'][$key], $_FILES['upload']['name'][$key], "", "", $_FILES['upload']['tmp_name'][$key], $this->app->User->GetName());
// stichwoerter hinzufuegen
$this->app->erp->AddDateiStichwort($fileid, "anhang", "Ticket", $drafted_messages[0]['id']);
}
}
}
$this->add_attachments_html($id,$drafted_messages[0]['id'],'ANHAENGE',true);
$this->app->Tpl->Parse('NEW_MESSAGE', "ticket_new_message.tpl");
}
// END Draft
// Get all messsages
$messages = $this->get_messages_of_ticket($id, 1, NULL);
$recv_messages = $this->get_messages_of_ticket($id,"n.versendet != 1",NULL);
switch ($submit) {
case 'neue_email':
if (empty($drafted_messages)) {
// Create new message and save it for editing
$this->app->Tpl->Set('EMAIL_AN', htmlentities($recv_messages[0]['mail']));
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
$senderAddress = $this->app->erp->GetFirmaMail();
$to = "";
$cc = "";
if (!empty($recv_messages)) {
if (!str_starts_with(strtoupper($recv_messages[0]['betreff']),"RE:")) {
$betreff = "RE: ".$recv_messages[0]['betreff'];
}
else {
$betreff = $recv_messages[0]['betreff'];
}
$sql = "SELECT GROUP_CONCAT(DISTINCT `value` ORDER BY `value` SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = ".$recv_messages[0]['id']." AND `value` <> '".$senderAddress."' AND type='to'";
$to = $recv_messages[0]['mail'];
$to_additional = $this->app->DB->Select($sql);
if (!empty($to_additional)) {
$to .= ", ".$to_additional;
}
$sql = "SELECT GROUP_CONCAT(DISTINCT `value` ORDER BY `value` SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = ".$recv_messages[0]['id']." AND `value` <> '".$senderAddress."' AND type='cc'";
$cc = $this->app->DB->Select($sql);
}
else {
$betreff = $ticket_from_db['betreff'];
$sql = "SELECT email FROM adresse WHERE id =".$ticket_from_db['adresse'];
$to = $this->app->DB->Select($sql);
}
$anschreiben = $this->app->DB->Select("SELECT anschreiben FROM adresse WHERE id='".$ticket_from_db['adresse']."' LIMIT 1");
if($anschreiben=="")
{
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben").",\n".$this->app->erp->Grussformel($projekt,$sprache);
}
$sql = "INSERT INTO `ticket_nachricht` (
`ticket`, `zeit`, `text`, `betreff`, `medium`, `versendet`,
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`,`mail_cc`
) VALUES ('".$ticket_from_db['schluessel']."',NOW(),'".$anschreiben."','".$betreff."','email','1','".$senderName."','".$to."','neu','".$senderName."','".$senderAddress."','".$cc."');";
$this->app->DB->Insert($sql);
// Show new message dialog
header("Location: index.php?module=ticket&action=edit&id=$id");
$this->app->ExitXentral();
}
break;
case 'entwurfloeschen':
if (!empty($drafted_messages)) {
$sql = "UPDATE ticket_nachricht SET ticket = '' WHERE id=".$drafted_messages[0]['id'];
$this->app->DB->Update($sql);
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Der Entwurf wurde gel&ouml;scht.</div>");
header("Location: index.php?module=ticket&action=edit&msg=$msg&id=$id");
$this->app->ExitXentral();
}
break;
case 'zitat':
if (!empty($drafted_messages) && !empty($recv_messages)) {
$nl = "<br />";
$citation_info =$recv_messages[0]['zeit']." ".$recv_messages[0]['verfasser']." &lt;".$recv_messages[0]['mail']."&gt;";
$text = $drafted_messages[0]['text'].$nl.$nl.$citation_info.":".$nl."<blockquote type=\"cite\">".$recv_messages[0]['text']."</blockquote>";
$sql = "UPDATE ticket_nachricht SET text='".$text."' WHERE id=".$drafted_messages[0]['id'];
$this->app->DB->Update($sql);
header("Location: index.php?module=ticket&action=edit&id=$id");
$this->app->ExitXentral();
}
break;
case 'absenden':
if (empty($drafted_messages)) {
break;
}
$msg = "";
// Enforce Ticket #
if (!preg_match("/Ticket #[0-9]{12}/i", $drafted_messages[0]['betreff'])) {
$drafted_messages[0]['betreff'].= " Ticket #".$ticket_from_db['schluessel'];
}
// Attachments
$files = $this->app->erp->GetDateiSubjektObjektDateiname('Anhang','Ticket',$drafted_messages[0]['id'],"");
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
preg_match_all($pattern, $drafted_messages[0]['mail'], $matches);
$to = $matches[0];
if ($drafted_messages[0]['mail_cc'] != '') {
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
preg_match_all($pattern, $drafted_messages[0]['mail_cc'], $matches);
$cc = $matches[0];
} else {
$cc = null;
}
// function MailSend($from,$from_name,$to,$to_name,$betreff,$text,$files="",$projekt="",$signature=true,$cc="",$bcc="", $system = false)
if (
$this->app->erp->MailSend(
$drafted_messages[0]['mail_replyto'],
$drafted_messages[0]['verfasser_replyto'],
$to,
$to,
htmlentities($drafted_messages[0]['betreff']),
htmlentities($drafted_messages[0]['text']),
$files,
0,
true,
$cc,
'',
true
) != 0
) {
// Update message in ticket_nachricht
$sql = "UPDATE `ticket_nachricht` SET `zeitausgang` = NOW(), `betreff` = '".$drafted_messages[0]['betreff']."' WHERE id = ".$drafted_messages[0]['id'];
$this->app->DB->Insert($sql);
$msg .= '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'.';
if ($drafted_messages[0]['mail_cc'] != '') {
$msg .= ' (CC: '.$drafted_messages[0]['mail_cc'].')</div>';
}
else {
$msg .= '</div>';
}
header("Location: index.php?module=ticket&action=edit&id=".$id."&msg=".$this->app->erp->base64_url_encode($msg));
}
else {
$msg = '<div class="error">Fehler beim Versenden der E-Mail: '.$this->app->erp->mail_error.'</div>';
}
// Get messsages again
$messages = $this->get_messages_of_ticket($id,1,NULL);
break;
}
$this->add_messages_tpl($messages, false);
$this->app->Tpl->Set('MESSAGE', $msg);
$this->app->Tpl->Parse('PAGE', "ticket_edit.tpl");
}
/**
* Get all paramters from html form and save into $input
*/
public function GetInput(): array {
$input = array();
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
$input['projekt'] = $this->app->Secure->GetPOST('projekt');
$input['status'] = $this->app->Secure->GetPOST('status');
$input['adresse'] = $this->app->Secure->GetPOST('adresse');
$input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange');
$input['prio'] = !empty($this->app->Secure->GetPOST('prio'))?"1":"0";
$input['neue_notiz'] = $this->app->Secure->GetPOST('neue_notiz');
$input['notiz'] = $this->app->Secure->GetPOST('notiz');
$input['tags'] = $this->app->Secure->GetPOST('tags');
$input['betreff'] = $this->app->Secure->GetPOST('betreff');
$input['email_sender'] = $this->app->Secure->GetPOST('email_sender');
$input['email_an'] = $this->app->Secure->GetPOST('email_an');
$input['email_cc'] = $this->app->Secure->GetPOST('email_cc');
$input['email_bcc'] = $this->app->Secure->GetPOST('email_bcc');
$input['email_betreff'] = $this->app->Secure->GetPOST('email_betreff');
$input['email_text'] = $this->app->Secure->GetPOST('email_text');
return $input;
}
public function ticket_minidetail($parsetarget='',$menu=true) {
$id = $this->app->Secure->GetGET('id');
// Get last 3 messages
$messages = $this->get_messages_of_ticket($id, "1", 3);
if(!empty($messages)) {
$this->add_messages_tpl($messages, true); // With drafts
$render = true;
} else {
}
if($parsetarget=='')
{
if ($render) {
$this->app->Tpl->Output('ticket_minidetail.tpl');
}
$this->app->ExitXentral();
}
if ($render) {
$this->app->Tpl->Parse($parsetarget,'ticket_minidetail.tpl');
}
}
/*
* After import of Xentral 20 ticket system
* Set all ticket status to the status of the latest ticket_nachricht
*/
function ticket_statusfix() {
$confirmed = $this->app->Secure->GetGET('confirmed');
if ($confirmed == "yes") {
$sql = "UPDATE
ticket
SET
STATUS
=ifnull((
SELECT
tn.status
FROM
ticket_nachricht tn
INNER JOIN(
SELECT
ticket,
MAX(zeit) AS lastzeit
FROM
ticket_nachricht
GROUP BY
ticket
) l
ON
tn.ticket = l.ticket AND tn.zeit = l.lastzeit
WHERE
ticket.schluessel = tn.ticket
LIMIT 1
),'abgeschlossen')
WHERE ticket.status = 'neu'";
$this->app->DB->Update($sql);
$this->app->Tpl->Set('TEXT', "Status fix abgeschlossen.");
$this->app->Tpl->Parse('PAGE','ticket_text.tpl');
}
else {
// $this->app->Tpl->Set('TEXT', "This will replace all ticket status with the status of the latest ticket_nachricht. To confirm, press here: ");
$this->app->Tpl->Set('TEXT', "Dieser Assistent ersetzt den Status aller offenen Tickets (Weder abgeschlossen noch Spam) mit dem Status der letzten Nachricht im Ticket. Hier starten: ");
$this->app->Tpl->Add('TEXT', '<a href="index.php?module=ticket&action=statusfix&confirmed=yes"><button>OK</button></a>');
$this->app->Tpl->Parse('PAGE','ticket_text.tpl');
}
}
/*
* After import of Xentral 20 ticket system
* Set all ticket dates to the date of the latest ticket_nachricht
*/
function ticket_datefix() {
$confirmed = $this->app->Secure->GetGET('confirmed');
if ($confirmed == "yes") {
$sql = "UPDATE ticket set zeit =
(SELECT
MAX(zeit) AS lastzeit
FROM
ticket_nachricht
WHERE ticket.schluessel = ticket_nachricht.ticket AND ticket.schluessel
LIMIT 1
)
WHERE ticket.status <> 'abgeschlossen' AND ticket.status <> 'spam'";
$this->app->DB->Update($sql);
$this->app->Tpl->Set('TEXT', "Datum fix abgeschlossen.");
$this->app->Tpl->Parse('PAGE','ticket_text.tpl');
}
else {
// $this->app->Tpl->Set('TEXT', "This will replace all open ticket dates with the date of the latest ticket_nachricht. To confirm, press here: ");
$this->app->Tpl->Set('TEXT', "Dieser Assistent ersetzt das Datum aller offenen Tickets (Weder abgeschlossen noch Spam) mit dem Datum der letzten Nachricht im Ticket. Hier starten: ");
$this->app->Tpl->Add('TEXT', '<a href="index.php?module=ticket&action=datefix&confirmed=yes"><button>OK</button></a>');
$this->app->Tpl->Parse('PAGE','ticket_text.tpl');
}
}
}
+208
View File
@@ -0,0 +1,208 @@
<?php
/*
* Copyright (c) 2022 Xenomporio project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Ticketregeln {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "ticketregeln_list");
$this->app->ActionHandler("create", "ticketregeln_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "ticketregeln_edit");
$this->app->ActionHandler("delete", "ticketregeln_delete");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
public function Install() {
/* Fill out manually later */
}
static function TableSearch(&$app, $name, $erlaubtevars) {
switch ($name) {
case "ticketregeln_list":
$allowed['ticketregeln_list'] = array('list');
$heading = array('E-Mail Empf&auml;nger', 'E-Mail Verfasser', 'Verfasser Name', 'Betreff', 'Papierkorb', 'Pers&ouml;nlich', 'Prio', 'DSGVO', 'Verantw.', 'Aktiv', 'Men&uuml;');
$width = array('10%'); // Fill out manually later
$findcols = array('t.empfaenger_email', 't.sender_email', 't.name', 't.betreff', 't.spam', 't.persoenlich', 't.prio', 't.dsgvo', 't.warteschlange', 't.aktiv');
$searchsql = array('t.empfaenger_email', 't.sender_email', 't.name', 't.betreff', 't.spam', 't.persoenlich', 't.prio', 't.dsgvo', 't.warteschlange', 't.aktiv');
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=ticketregeln&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=ticketregeln&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$sql = "SELECT SQL_CALC_FOUND_ROWS t.id, t.empfaenger_email, t.sender_email, t.name, t.betreff, t.spam, t.persoenlich, t.prio, t.dsgvo, w.warteschlange, t.aktiv, t.id FROM ticket_regeln t LEFT JOIN warteschlangen w ON t.warteschlange = w.label";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM ticket_regeln WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function ticketregeln_list() {
$this->app->erp->MenuEintrag("index.php?module=ticketregeln&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=ticketregeln&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'ticketregeln_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "ticketregeln_list.tpl");
}
public function ticketregeln_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `ticket_regeln` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->ticketregeln_list();
}
/*
* Edit ticketregeln item
* If id is empty, create a new one
*/
function ticketregeln_edit() {
$id = $this->app->Secure->GetGET('id');
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=ticketregeln&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=ticketregeln&action=list", "Zur&uuml;ck zur &Uuml;bersicht");
$id = $this->app->Secure->GetGET('id');
$input = $this->GetInput();
$submit = $this->app->Secure->GetPOST('submit');
if (empty($id)) {
// New item
$id = 'NULL';
}
if ($submit != '')
{
// Write to database
// Add checks here
$input['warteschlange'] = explode(" ",$input['warteschlange'])[0]; // Just the label
$columns = "id, ";
$values = "$id, ";
$update = "";
$fix = "";
foreach ($input as $key => $value) {
$columns = $columns.$fix.$key;
$values = $values.$fix."'".$value."'";
$update = $update.$fix.$key." = '$value'";
$fix = ", ";
}
// echo($columns."<br>");
// echo($values."<br>");
// echo($update."<br>");
$sql = "INSERT INTO ticket_regeln (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
// echo($sql);
$this->app->DB->Update($sql);
if ($id == 'NULL') {
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
header("Location: index.php?module=ticketregeln&action=list&msg=$msg");
} else {
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich &uuml;bernommen.</div>");
}
}
// Load values again from database
$result = $this->app->DB->SelectArr("SELECT t.id, t.empfaenger_email, t.sender_email, t.name, t.betreff, t.spam, t.persoenlich, t.prio, t.dsgvo, t.warteschlange, t.aktiv, t.id FROM ticket_regeln t"." WHERE id=$id");
foreach ($result[0] as $key => $value) {
$this->app->Tpl->Set(strtoupper($key), $value);
}
/*
* Add displayed items later
*
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
$this->app->Tpl->Add('EMAIL', $email);
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
*/
$this->app->YUI->AutoComplete("warteschlange","warteschlangename");
// $this->SetInput($input);
$this->app->Tpl->Parse('PAGE', "ticketregeln_edit.tpl");
}
/**
* Get all paramters from html form and save into $input
*/
public function GetInput(): array {
$input = array();
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
$input['empfaenger_email'] = $this->app->Secure->GetPOST('empfaenger_email');
$input['sender_email'] = $this->app->Secure->GetPOST('sender_email');
$input['name'] = $this->app->Secure->GetPOST('name');
$input['betreff'] = $this->app->Secure->GetPOST('betreff');
$input['spam'] = $this->app->Secure->GetPOST('spam');
$input['persoenlich'] = $this->app->Secure->GetPOST('persoenlich');
$input['prio'] = $this->app->Secure->GetPOST('prio');
$input['dsgvo'] = $this->app->Secure->GetPOST('dsgvo');
$input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange');
$input['aktiv'] = $this->app->Secure->GetPOST('aktiv');
return $input;
}
/*
* Set all fields in the page corresponding to $input
*/
function SetInput($input) {
// $this->app->Tpl->Set('EMAIL', $input['email']);
$this->app->Tpl->Set('EMPFAENGER_EMAIL', $input['empfaenger_email']);
$this->app->Tpl->Set('SENDER_EMAIL', $input['sender_email']);
$this->app->Tpl->Set('NAME', $input['name']);
$this->app->Tpl->Set('BETREFF', $input['betreff']);
$this->app->Tpl->Set('SPAM', $input['spam']);
$this->app->Tpl->Set('PERSOENLICH', $input['persoenlich']);
$this->app->Tpl->Set('PRIO', $input['prio']);
$this->app->Tpl->Set('DSGVO', $input['dsgvo']);
$this->app->Tpl->Set('WARTESCHLANGE', $input['warteschlange']);
$this->app->Tpl->Set('AKTIV', $input['aktiv']);
}
}
+6 -4
View File
@@ -163,8 +163,10 @@ class Wareneingang
//&NBSP;<a href=\"#\" onclick=\"if(!confirm('Auftrag wirklich aus dem Versand nehmen?')) return false; else window.location.href='index.php?module=versanderzeugen&action=delete&id=%value%';\"><img src=\"./themes/[THEME]/images/delete.svg\" border=\"0\"></a></td></tr></table>";
$menucol = 4;
if($this->app->erp->Firmendaten("wareneingang_lagerartikel")) $lagerartikel = "AND art.lagerartikel = 1";
else $lagerartikel = "";
// if($this->app->erp->Firmendaten("wareneingang_lagerartikel")) $lagerartikel = "AND art.lagerartikel = 1";
// else
$lagerartikel = "";
$receiptDocument = $this->app->erp->ModulVorhanden('receiptdocument');
if($receiptDocument) {
$this->app->DB->Select('SELECT id FROM receiptdocument LIMIT 1');
@@ -1061,9 +1063,9 @@ class Wareneingang
$defaultorder = 6;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=wareneingang&action=distriinhalt&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.png\" border=\"0\"></a>&nbsp;</td></tr></table>";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=wareneingang&action=distriinhalt&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;</td></tr></table>";
$sql = "SELECT
$sql = "SELECT SQL_CALC_FOUND_ROWS
paketannahme.id,
paketannahme.id,
DATE_FORMAT(paketannahme.datum, '%d.%m.%Y %H:%i'),
+183
View File
@@ -0,0 +1,183 @@
<?php
/*
* Copyright (c) 2022 Xenomporio project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Warteschlangen {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "warteschlangen_list");
$this->app->ActionHandler("create", "warteschlangen_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "warteschlangen_edit");
$this->app->ActionHandler("delete", "warteschlangen_delete");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
public function Install() {
/* Fill out manually later */
}
static function TableSearch(&$app, $name, $erlaubtevars) {
switch ($name) {
case "warteschlangen_list":
$allowed['warteschlangen_list'] = array('list');
$heading = array('Name', 'Kennung', 'Verantwortlicher', 'Men&uuml;');
$width = array('10%'); // Fill out manually later
$findcols = array('warteschlange', 'label', 'adresse');
$searchsql = array('warteschlange', 'label', 'adresse');
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=warteschlangen&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=warteschlangen&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$sql = "SELECT SQL_CALC_FOUND_ROWS w.id, w.warteschlange, w.label, (SELECT a.name from adresse a WHERE a.id = w.adresse), id FROM warteschlangen w";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM warteschlangen WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function warteschlangen_list() {
$this->app->erp->MenuEintrag("index.php?module=warteschlangen&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=warteschlangen&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'warteschlangen_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "warteschlangen_list.tpl");
}
public function warteschlangen_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `warteschlangen` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->warteschlangen_list();
}
/*
* Edit warteschlangen item
* If id is empty, create a new one
*/
function warteschlangen_edit() {
$id = $this->app->Secure->GetGET('id');
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=warteschlangen&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=warteschlangen&action=list", "Zur&uuml;ck zur &Uuml;bersicht");
$id = $this->app->Secure->GetGET('id');
$input = $this->GetInput();
$submit = $this->app->Secure->GetPOST('submit');
if (empty($id)) {
// New item
$id = 'NULL';
}
if ($submit != '')
{
// Write to database
// Add checks here
$input['adresse'] = $this->app->erp->ReplaceAdresse(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
$columns = "id, ";
$values = "$id, ";
$update = "";
$fix = "";
foreach ($input as $key => $value) {
$columns = $columns.$fix.$key;
$values = $values.$fix."'".$value."'";
$update = $update.$fix.$key." = '$value'";
$fix = ", ";
}
// echo($columns."<br>");
// echo($values."<br>");
// echo($update."<br>");
$sql = "INSERT INTO warteschlangen (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
// echo($sql);
$this->app->DB->Update($sql);
if ($id == 'NULL') {
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
header("Location: index.php?module=warteschlangen&action=list&msg=$msg");
} else {
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich &uuml;bernommen.</div>");
}
}
// Load values again from database
$result = $this->app->DB->SelectArr("SELECT id, warteschlange, label, wiedervorlage, adresse, id FROM warteschlangen"." WHERE id=$id");
foreach ($result[0] as $key => $value) {
$this->app->Tpl->Set(strtoupper($key), $value);
}
$this->app->YUI->AutoComplete("adresse","mitarbeiterid");
$this->app->Tpl->Set('ADRESSE', $this->app->erp->ReplaceAdresse(false,$result[0]['adresse'],false)); // Convert ID to form display
/*
* Add displayed items later
*
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
$this->app->Tpl->Add('EMAIL', $email);
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
*/
$this->app->Tpl->Parse('PAGE', "warteschlangen_edit.tpl");
}
/**
* Get all paramters from html form and save into $input
*/
public function GetInput(): array {
$input = array();
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
$input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange');
$input['label'] = $this->app->Secure->GetPOST('label');
$input['wiedervorlage'] = $this->app->Secure->GetPOST('wiedervorlage');
$input['adresse'] = $this->app->Secure->GetPOST('adresse');
return $input;
}
}
+15 -10
View File
@@ -890,18 +890,23 @@ $this->app->Tpl->Add('TODOFORUSER',"<tr><td width=\"90%\">".$tmp[$i]['aufgabe'].
$this->app->erp->RunHook('welcome_start', 1 , $this);
if(empty($this->app->User->GetField('role')) || $this->app->acl->IsAdminadmin()) {
$this->app->ModuleScriptCache->IncludeWidgetNew('ClickByClickAssistant');
$this->app->ModuleScriptCache->IncludeJavascriptFiles(
// Xentral 20 database compatibility
if ($this->app->DB->Select("SHOW COLUMNS FROM `user` LIKE 'role'")) {
if(empty($this->app->User->GetField('role')) || $this->app->acl->IsAdminadmin()) {
$this->app->ModuleScriptCache->IncludeWidgetNew('ClickByClickAssistant');
$this->app->ModuleScriptCache->IncludeJavascriptFiles(
'welcome',
[
'body' => [
'./classes/Modules/Welcome/www/js/welcome_firststart.js',
],
]
);
$this->app->Tpl->Parse('AUFGABENPOPUP', 'welcome_firststart.tpl');
);
$this->app->Tpl->Parse('AUFGABENPOPUP', 'welcome_firststart.tpl');
}
}
if($this->app->User->GetType() === 'admin') {
$this->app->Tpl->Set('COLROWTASKS', '6');
}
@@ -3147,7 +3152,7 @@ $this->app->Tpl->Add('TAB1',"<h2>Schritt 2 von 2: Datenbank anpassen</h2><table
:'index.php?module=welcome&action=settings&cmd=changeroleclickbyclick',
'icon' => $isAdminAdmin?'password-icon':'add-person-icon',
'headline' => $isAdminAdmin?'Passwort ändern':'Ihre Rolle',
'subHeadline' => $isAdminAdmin?'Bitte gib ein Passwort ein und bestätige es mit einer zweiten Eingabe'
'subHeadline' => $isAdminAdmin?'Bitte geben Sie ein Passwort ein und bestätige es mit einer zweiten Eingabe'
:'Bitte geben Sie Ihre Rolle im Unternehmen ein',
'form' => [],
'ctaButtons' => [
@@ -3274,7 +3279,7 @@ $this->app->Tpl->Add('TAB1',"<h2>Schritt 2 von 2: Datenbank anpassen</h2><table
}
}
*/
$subHeadline = 'Du kannst nun loslegen.';
$subHeadline = 'Es kann nun losgehen.';
if($isAdminAdmin && !empty(erpAPI::Ioncube_Property('isdevelopmentversion'))) {
$subHeadline = 'Es handelt sich hier um eine Development-Version.
Diese ist nicht für den produktiven Einsatz gedacht.';
@@ -3294,7 +3299,7 @@ $this->app->Tpl->Add('TAB1',"<h2>Schritt 2 von 2: Datenbank anpassen</h2><table
'subHeadline' => $subHeadline,
'ctaButtons' => [
[
'title' => 'Klasse',
'title' => 'Ok',
'action' => 'close'
]
]
@@ -3520,7 +3525,7 @@ $this->app->Tpl->Add('TAB1',"<h2>Schritt 2 von 2: Datenbank anpassen</h2><table
$passwordunescaped = $this->app->Secure->GetPOST('setPassword', '', '', 'noescape');
if(empty($password)) {
return new JsonResponse(
['error'=>'Passworteingabe falsch! Bitte gebe ein Passwort ein!'],
['error'=>'Passworteingabe falsch! Bitte geben Sie ein Passwort ein!'],
JsonResponse::HTTP_BAD_REQUEST
);
}
@@ -3955,7 +3960,7 @@ $this->app->Tpl->Add('TAB1',"<h2>Schritt 2 von 2: Datenbank anpassen</h2><table
if (!$credService->existCredentials()) {
$this->app->Tpl->Add(
'MSG_NO_GMAILAPI',
'<div class="info">Die Goolge Schnittstelle ist im System nicht aktiv.'
'<div class="info">Die Google Schnittstelle ist im System nicht aktiv.'
);
$this->app->Tpl->Set('GMAIL_AUTH_DISABLE', 'disabled');
$this->app->Tpl->Set('GMAIL_ADDRESS_DISABLE', 'disabled');
+12
View File
@@ -2445,10 +2445,22 @@ ul.tag-editor {
border: 0 solid transparent;
background-color: transparent;
}
.ticketoffene .tag-editor-tag {
padding-right: 5px;
padding-left: 5px;
}
.ticketoffene input.tageditor {
visibility: hidden;
}
.ticket_text {
width: 100%;
border: none;
}
.ui-button-icon,
.ui-button:not(.ui-dialog-titlebar-close):not(.button-secondary),
input[type=submit]:not(.button-secondary) {
@@ -0,0 +1,5 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.95314 8.71436C9.34786 9.7745 8.22077 10.4289 7 10.4289C5.77923 10.4289 4.65214 9.7745 4.04686 8.71436H1.85714C1.38376 8.71436 1 9.09811 1 9.5715V12.1429C1 12.6163 1.38376 13.0001 1.85714 13.0001H12.1429C12.6162 13.0001 13 12.6163 13 12.1429V9.5715C13 9.09811 12.6162 8.71436 12.1429 8.71436H9.95314Z" stroke="#94979E" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7 7V1" stroke="#94979E" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.85693 5.28564L6.99979 6.99993L9.14265 5.28564" stroke="#94979E" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 741 B