Author SHA1 Message Date
OpenXE 3f135f6852 Merge branch 'master' into develop.1.8 2023-03-13 12:51:38 +01:00
OpenXE 75aaf5e2af Module creator improvement layout edit forms 2023-03-12 16:44:14 +01:00
OpenXE e9cec0ce30 Buchhaltung Export verbindlichkeit rechnungsdatum + bugfix consistency 2023-03-10 13:12:57 +01:00
OpenXE 226a2dffdf Export Buchhaltung added consistency check 2023-03-10 11:04:58 +01:00
OpenXE 44781b52bb Export Buchhaltung first version 2023-03-09 16:40:25 +01:00
OpenXE 245e2d1545 onlineshops added tab artikelliste 2023-03-05 11:25:14 +01:00
OpenXE e2fc1e15e8 lagerzahlen added log information 2023-03-04 14:21:08 +01:00
OpenXE 49c934ede4 Kontenrahmen missing files added 2023-03-02 10:19:31 +01:00
OpenXE 61047af440 Zolltarifnummer module restored 2023-03-02 10:19:04 +01:00
OpenXE cb8b2487d7 module_creator improvement on column headers and findcols 2023-03-02 09:52:36 +01:00
OpenXE 2ffee66e00 Kontenrahmen module restored, also importvorlage for kontenrahmen implemented 2023-03-01 16:27:52 +01:00
OpenXE 37a6fecc36 module creator layout fix 2023-03-01 15:59:17 +01:00
OpenXE-ERP d35a4f41b9 Merge pull request #63 from OpenXE-org/develop.1.8
Update version.php
2023-02-19 12:27:16 +01:00
OpenXE-ERP aae29d6281 Update version.php 2023-02-19 12:25:33 +01:00
OpenXE d846a251ca Angebot added column Bearbeiter 2023-02-17 13:41:04 +01:00
OpenXE c00ae0eb5b Bugfix Firmendaten default entries are not there, thus not editable 2023-02-17 12:22:07 +01:00
OpenXE 05714cfd21 Bugfix Shop LagerSync 2023-02-16 10:56:00 +01:00
OpenXE 4be2d5af23 Lager Lagerbestandsberechnung removed group by lager, bugfixes regarding calculations 2023-02-15 16:38:48 +01:00
OpenXE 1e371e7377 Lager LagerBuchenEinlagern corrected misleading message "Regal gibt es nicht" 2023-02-13 10:31:33 +01:00
OpenXE 2397fda1e6 Lager Bestandsberechnung rewrite of the SQL statements, removed last stock movement 2023-02-12 19:41:01 +01:00
OpenXE ad3207d67c erpapi FormatMenge default 0 decimal places 2023-02-10 11:08:03 +01:00
OpenXE e0a049608e report bugfix missing data column ftp_passive 2023-02-09 19:09:55 +01:00
OpenXE 0572295637 Lager bestandsberechnung bugfix currencies 2023-02-08 16:24:30 +01:00
OpenXE 770a36b183 Produktion lager stock remove parts with production number 2023-02-06 15:00:34 +01:00
OpenXE 826923fd51 Bugfix waehrungumrechnung 2023-02-06 14:33:51 +01:00
OpenXE 9657e16797 Bugfix Lagerbestandsberechnung 2023-02-06 14:31:20 +01:00
OpenXE aff5eef945 Waehrumgumrechnung module restored 2023-02-05 13:23:03 +01:00
OpenXE 3d8c7a13e3 Lager Lagerbestandsberechnung restored 2023-02-04 19:05:22 +01:00
OpenXE 6bb54be5a3 Ticket system rewrite of ticket import attachment handling, now with application/octet-stream and cid 2023-02-02 16:39:00 +01:00
OpenXE 9a45653eaf Ticket system improvement on error handling and logging 2023-02-01 19:02:16 +01:00
OpenXE 9daaf58281 Ticket system attachements exception handling 2023-02-01 16:55:54 +01:00
OpenXE 0eb3ba50f2 Ticket system some fixes where the attachment filename could not be read 2023-02-01 11:24:20 +01:00
OpenXE f0bebba1ff Ticket system bufix escaping of subject text 2023-02-01 10:16:24 +01:00
OpenXE da0b7d2720 Ticket system bugfix character encoding is now read from parts and used to convert to UTF-8 2023-01-29 19:06:08 +01:00
OpenXE 00dc3414a2 Ticket system bugfix unescaped text in check ticket rule 2023-01-28 16:32:34 +01:00
OpenXE-ERP ce11caac12 Merge pull request #54 from tsgoff/patch-1
setup.php php 8.1 deprecation for function_exists(): Passing null to parameter
2023-01-19 10:53:11 +01:00
OpenXE bb3a68042d ticket system ensure status offen on self-assigned tickets 2023-01-19 09:27:23 +01:00
tsgoff f8bfe19f1d Update setup.php
php 8.1 deprecation for function_exists(): Passing null to parameter
2023-01-18 23:15:24 +01:00
OpenXE d89c23ad0e bugfix ticket system mail addresses with long tld > 4 characters 2023-01-18 14:41:12 +01:00
OpenXE cb3191393a Bugfix ticket system letzte aktion 2023-01-17 10:31:10 +01:00
OpenXE 0b4be37433 Bugfix ticket system ticket to self 2023-01-16 18:37:32 +01:00
OpenXE 9a721758a9 Improvements Ticket system, date format, mail address search 2023-01-16 18:10:01 +01:00
OpenXE 424d77a795 Bugfix artikel profisuche 2023-01-13 22:02:42 +01:00
OpenXE 357497f10f Uebersetzung rich text 2023-01-13 12:01:45 +01:00
OpenXE f9550ca18b Bugfix auftrag offenepositionen 2023-01-13 10:42:03 +01:00
OpenXE 99eed95d85 Bugfix ticket email draft, set sender and sendername later when sending 2023-01-12 17:58:54 +01:00
OpenXE c9a24e7f75 Bugfix produktion projekt selection 2023-01-12 16:51:58 +01:00
OpenXE f535679263 Auftrag offene positionen 2023-01-12 16:20:31 +01:00
OpenXE 613d45b1cc Ticket system improvements for import encoding, ticket system limited display of html elements (strip_tags) 2023-01-12 00:01:20 +01:00
OpenXE 1fdd6dbf95 Bugfix produktion non-stock artikel 2023-01-11 12:08:23 +01:00
OpenXE cad0103b7f Translations for documents -> fill out table uebersetzungen 2023-01-10 14:13:19 +01:00
OpenXE 57d0592a9a Bugfix ticket mail citation 2023-01-09 11:16:39 +01:00
OpenXE f76400e248 Bestellvorschlag now working 2023-01-08 18:51:29 +01:00
OpenXE 3c7e189acb Bugfix importvorlage verkaufspreise 2023-01-05 12:53:05 +01:00
OpenXE c006c1c474 bugfix erpapi ANABREGSNeuberechnen 2023-01-04 13:20:23 +01:00
OpenXE 2844c1cc67 ticket system bugfixes for import: escaping, attachments, dateformat 2023-01-04 12:27:34 +01:00
OpenXE 14bf992b2b bugfix ticket system ACL attachements 2023-01-03 14:04:04 +01:00
OpenXE 78e56ab160 Bugfix ticket system new mail signature 2023-01-03 12:44:51 +01:00
OpenXE ab65feb455 Bestellvorschlag with parameter absatz and voraus 2023-01-02 11:29:53 +01:00
OpenXE 93e3b01a25 Ajax loading animation hourglass reactivated 2023-01-01 18:21:44 +01:00
OpenXE 5b74049f5c Bestellvorschlag table for saved values and auftrag WIP 2023-01-01 17:52:45 +01:00
root aa3dea0277 bestellvorschlag with subselect only > 0 WIP 2022-12-29 17:43:24 +01:00
OpenXE 67d7a63898 bestellvorschlag new module WIP 2022-12-29 16:28:37 +01:00
OpenXE 2acc8aceb9 Bugfix count(0) dokumente 2022-12-28 17:08:19 +01:00
OpenXE 1f661b9a2b loginpage now with custom.css 2022-12-27 16:35:59 +01:00
OpenXE 45164166f5 Bugfix for bcc in struktur.sql 2022-12-26 13:30:38 +01:00
OpenXE d94c05383a ticket system design improvements, subject in info box, optimized space usage, bugfix warteschlange autocomplete 2022-12-23 19:55:48 +01:00
OpenXE 135017158c Log with milliseconds 2022-12-23 19:12:52 +01:00
OpenXE 71861079e3 ticket system rework for secure import, email stays unread until import is successfull emailbackup_mails will be reverted on error 2022-12-23 17:18:13 +01:00
OpenXE 0648e57b63 Bugfix for use of BCC for all mails 2022-12-21 15:05:05 +00:00
OpenXE bb9fd68613 Bugfix auftrag tpl 2022-12-21 10:21:14 +00:00
OpenXE 143e4e96bd ticket system minor design improvement 2022-12-21 09:34:33 +00:00
OpenXE 2cfe710c9a bugfixe auftrag minidetail versandzentrum 2022-12-19 12:49:16 +00:00
OpenXE 0afc12e718 bugfix dokumente zahlungsziel not defined ('' vs. 0) 2022-12-17 13:03:53 +00:00
OpenXE 529587c0f5 Extended .htaccess for setup and inline PDF 2022-12-16 17:45:17 +00:00
OpenXE 35f6532520 Teilauftrag WIP 2022-12-16 17:33:15 +00:00
OpenXE 84eaf1b495 Modified GetPOSTArray and GetGETArray, because keys were not filled in 2022-12-16 14:40:19 +00:00
OpenXE c519d8030a Version 1.7 2022-12-15 11:49:22 +00:00
OpenXE 0848148b9e shopimporter_shopware6 removed v2 from URL to allow shopware 6.4 api 2022-12-15 10:40:10 +00:00
OpenXE 6c9d8b7594 upgrade view comparison now ignores view security 2022-12-15 09:46:41 +00:00
OpenXE 51f9929228 upgrade.sh executable bit 2022-12-14 17:44:06 +00:00
OpenXE 508ee0ae8e added userdata to .gitignore 2022-12-14 17:24:17 +00:00
OpenXE ca9b48cb58 upgrade some usability improvements, upgrade.sh script 2022-12-14 17:12:12 +00:00
OpenXE 817dd802aa upgrade added info and -o option 2022-12-14 15:25:48 +00:00
OpenXE 6a5679ba23 upgrade improved folder handling, git init part 2 2022-12-14 12:38:16 +00:00
OpenXE 724c57d309 upgrade improved folder handling, git init 2022-12-13 18:40:13 +00:00
84 changed files with 15750 additions and 243101 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
conf/user.inc.php conf/user.inc.php
conf/user_defined.php conf/user_defined.php
userdata/cronjobkey.txt userdata
userdata/tmp/
www/cache/ www/cache/
@@ -66,7 +66,7 @@ final class DatabaseLogHandler extends AbstractLogHandler
$sql = 'INSERT INTO `log` $sql = 'INSERT INTO `log`
(`log_time`, `level`, `message`, `class`, `method`, `line`, `origin_type`, `origin_detail`, `dump`) (`log_time`, `level`, `message`, `class`, `method`, `line`, `origin_type`, `origin_detail`, `dump`)
VALUES VALUES
(NOW(), :level, :message, :class, :method, :line, :origin_type, :origin_detail, :dump)'; (NOW(3), :level, :message, :class, :method, :line, :origin_type, :origin_detail, :dump)';
$this->db->perform($sql, $values); $this->db->perform($sql, $values);
} }
} }
@@ -51,40 +51,95 @@ class MailAttachmentData implements MailAttachmentInterface
$this->cid = $cid; $this->cid = $cid;
} }
/*
Check the type of Attachment
Possible results: application/octet-stream, attachment, inline
*/
public static function getAttachmentPartType(MailMessagePartInterface $part): ?string {
if (!$part->isMultipart()) {
$header = $part->getHeader('content-disposition');
if ($header !== null) {
$split = explode(';', $header->getValue());
if ($split[0] === 'attachment') {
return ('attachment');
} else if ($split[0] === 'inline') {
return ('inline');
}
} else { // Check for application/octet-stream
$content_type = $part->getContentType();
if ($content_type == 'application/octet-stream') {
return('application/octet-stream');
}
}
}
return(null);
}
/** /**
* @param MailMessagePartInterface $part * @param MailMessagePartInterface $part
*
* @throws InvalidArgumentException * @throws InvalidArgumentException
* *
* @return MailAttachmentData * @return MailAttachmentData
*/ */
public static function fromMailMessagePart(MailMessagePartInterface $part): MailAttachmentData public static function fromMailMessagePart(MailMessagePartInterface $part): MailAttachmentData
{ {
$attachmenttype = MailAttachmentData::getAttachmentPartType($part);
if ($attachmenttype == null) {
throw new InvalidArgumentException('object is no attachment');
}
$disposition = $part->getHeaderValue('content-disposition');
if ($disposition == null) {
$disposition = '';
}
$disposition = str_replace(["\n\r", "\n", "\r"], '', $disposition);
// file_put_contents('debug.txt',date("HH:mm:ss")."\nDispo: ".$disposition); // FILE_APPEND
// Determine filename
/*
Content-Disposition: inline
Content-Disposition: attachment
Content-Disposition: attachment; filename="filename.jpg"
This is not correctly implemented -> only the first string is evaluated
Content-Disposition: attachment; filename*0="filename_that_is_"
Content-Disposition: attachment; filename*1="very_long.jpg"
*/
$filename = 'OpenXE_file.unknown';
if (preg_match('/(.+);\s*filename(?:\*[0-9]){0,1}="*([^"]+)"*.*$/m', $disposition, $matches)) { // Filename in disposition
$filename = $matches[2];
} else {
$contenttype = $part->getHeaderValue('content-type');
$contenttype = str_replace(["\n\r", "\n", "\r"], '', $contenttype);
// file_put_contents('debug.txt',date("HH:mm:ss")."\nConttype: ".$contenttype,FILE_APPEND); // FILE_APPEND
if (preg_match('/(.+);\s*name(?:\*[0-9]){0,1}="*([^"]+)"*.*$/m', $contenttype, $matches)) { // Name in content-type
$filename = $matches[2];
} else if ($contenttype == 'message/rfc822') { // RFC822 message
$filename = 'ForwardedMessage.eml';
}
}
$encodingHeader = $part->getHeader('content-transfer-encoding'); $encodingHeader = $part->getHeader('content-transfer-encoding');
if ($encodingHeader === null) { if ($encodingHeader === null) {
throw new InvalidArgumentException('missing header: "Content-Transfer-Encoding"'); $content_transfer_encoding = '';
} else {
$content_transfer_encoding = $encodingHeader->getValue();
} }
$encoding = $encodingHeader->getValue();
$dispositionHeader = $part->getHeader('content-disposition');
if ($dispositionHeader === null) {
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)
);
}
$isInline = strtolower($matches[1]) === 'inline';
$filename = $matches[2];
// Thunderbird UTF URL-Format // Thunderbird UTF URL-Format
$UTF_pos = strpos($filename,'UTF-8\'\''); $UTF_pos = strpos($filename,'UTF-8\'\'');
if ($UTF_pos !== false) { if ($UTF_pos !== false) {
$wasUTF = "JA"; $wasUTF = "JA";
$filename = substr($filename,$UTF_pos); $filename = substr($filename,$UTF_pos);
$filename = rawurldecode($filename); $filename = rawurldecode($filename);
} }
@@ -97,13 +152,24 @@ class MailAttachmentData implements MailAttachmentInterface
$cid = $cidMatches[1]; $cid = $cidMatches[1];
} }
} }
if ($attachmenttype == 'inline' && $cid != null) {
$filename = "cid:".$cid;
}
$content = $part->getContent();
if ($content === null) { // This should not be
// file_put_contents('debug.txt',date("HH:mm:ss")."\n".print_r($part,true)); // FILE_APPEND
throw new InvalidArgumentException(
sprintf('content is null "%s"', substr(print_r($part,true),0,1000))
);
}
return new self( return new self(
$filename, $filename,
$part->getContent(), $content,
$part->getContentType(), $part->getContentType(),
$encoding, $content_transfer_encoding,
$isInline, $attachmenttype == 'inline',
$cid $cid
); );
} }
@@ -147,6 +147,7 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
$parts = []; $parts = [];
$this->findAttachmentParts($this->contentPart, $parts); $this->findAttachmentParts($this->contentPart, $parts);
$attachments = []; $attachments = [];
foreach ($parts as $part) { foreach ($parts as $part) {
$attachments[] = MailAttachmentData::fromMailMessagePart($part); $attachments[] = MailAttachmentData::fromMailMessagePart($part);
} }
@@ -162,18 +163,16 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
*/ */
private function findAttachmentParts(MailMessagePartInterface $part, array &$resultArray): void private function findAttachmentParts(MailMessagePartInterface $part, array &$resultArray): void
{ {
try {
$header = $part->getHeader('content-disposition');
$split = explode(';', $header->getValue());
if ($split[0] === 'attachment' || $split[0] === 'inline') {
$resultArray[] = $part;
return; if ($part->isMultipart()) {
} // Recurse subparts
} catch (Throwable $e) {
for ($i = 0; $i < $part->countParts(); $i++) { for ($i = 0; $i < $part->countParts(); $i++) {
$this->findAttachmentParts($part->getPart($i), $resultArray); $this->findAttachmentParts($part->getPart($i), $resultArray);
} }
} else {
if (MailAttachmentData::getAttachmentPartType($part) != null) {
$resultArray[] = $part;
}
} }
} }
@@ -308,10 +307,7 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
if ($date === null) { if ($date === null) {
return null; return null;
} }
$dateTime = DateTime::createFromFormat(DateTimeInterface::RFC2822, $date->getValue()); $dateTime = date_create($date->getValue());
if ($dateTime === false) {
$dateTime = DateTime::createFromFormat(DateTimeInterface::RFC822, $date->getValue());
}
if ($dateTime === false) { if ($dateTime === false) {
return null; return null;
} }
@@ -83,6 +83,18 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
return $this->headers[strtolower($name)]; return $this->headers[strtolower($name)];
} }
/**
* @inheritDoc
*/
public function getHeaderValue(string $name): ?string
{
$header = $this->getHeader($name);
if ($header == null) {
return (null);
}
return($header->getValue());
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -97,6 +109,33 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
return $split[0]; return $split[0];
} }
/**
* @inheritDoc
*/
public function getCharset(): ?string
{
$header = $this->getHeader('content-type');
if ($header === null) {
return '';
}
$pattern = "/([a-zA-Z]*[\/]*[a-zA-Z]*);[a-zA-Z\n\t\r0-9 ]*charset=\"([a-zA-Z-0-9]+)\"/i";
$matches = array();
if (preg_match(
$pattern,
$header->getValue(),
$matches
)) {
if (count($matches) >= 3) {
return($matches[2]);
} else {
return(null);
}
}
else {
return(null);
}
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -116,17 +155,30 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
/** /**
* @return string|null * @return string|null
*/ */
public function getDecodedContent(): ?string public function getDecodedContent(string $to_charset = 'UTF-8'): ?string
{ {
$result = '';
if ($this->content === null) { if ($this->content === null) {
return null; return null;
} }
$encodingHeader = $this->getHeader('content-transfer-encoding'); $encodingHeader = $this->getHeader('content-transfer-encoding');
if ($encodingHeader === null ) { if ($encodingHeader === null ) {
return $this->content; $result = $this->content;
}
else {
$result = $this->decode($this->content, $encodingHeader->getValue());
} }
return $this->decode($this->content, $encodingHeader->getValue()); $charset = $this->getCharset();
// throw new InvalidArgumentException('Charset is '.$charset." Text is: ".$result);
$converted = mb_convert_encoding(
$result,
$to_charset,
$charset
);
return($converted);
} }
/** /**
@@ -22,12 +22,22 @@ class TicketFormatter
*/ */
public function encodeToUtf8(string $string): string public function encodeToUtf8(string $string): string
{ {
$encoding = mb_detect_encoding($string, 'UTF-8, ISO-8859-1, ISO-8859-15', true);
return mb_convert_encoding( $converted = mb_convert_encoding(
$string, $string,
'UTF-8', 'UTF-8',
$encoding 'auto'
);
// Fallback
if ($converted === false) {
$converted = mb_convert_encoding(
$string,
'UTF-8',
'iso-8859-1'
); );
} }
return ($converted);
}
} }
@@ -209,7 +209,7 @@ class TicketImportHelper
return($candidate); return($candidate);
} }
if ($loopCounter > 99) { if ($loopCounter > 9999) {
throw new NumberGeneratorException('ticket number generation failed'); throw new NumberGeneratorException('ticket number generation failed');
} }
$loopCounter++; $loopCounter++;
@@ -289,10 +289,10 @@ class TicketImportHelper
FROM `ticket_regeln` AS `tr` FROM `ticket_regeln` AS `tr`
WHERE WHERE
tr.aktiv = 1 tr.aktiv = 1
AND ('".$recipientMail."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '') AND ('".$this->db->real_escape_string($recipientMail)."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '')
AND ('".$senderMail."' LIKE tr.sender_email OR tr.sender_email = '') AND ('".$this->db->real_escape_string($senderMail)."' LIKE tr.sender_email OR tr.sender_email = '')
AND ('".$senderMail."' LIKE tr.name OR tr.name = '') AND ('".$this->db->real_escape_string($senderMail)."' LIKE tr.name OR tr.name = '')
AND ('".$subject."' LIKE tr.betreff OR tr.betreff = '')"; AND ('".$this->db->real_escape_string($subject)."' LIKE tr.betreff OR tr.betreff = '')";
$this->logger->debug('ticket rule',['sql' => $sql]); $this->logger->debug('ticket rule',['sql' => $sql]);
@@ -347,10 +347,10 @@ class TicketImportHelper
'".$projectId."', '".$projectId."',
'".$this->mailAccount->getEmailAddress()."', '".$this->mailAccount->getEmailAddress()."',
'".$status."', '".$status."',
'".$senderName."', '".$this->db->real_escape_string($senderName)."',
'".$senderAddress."', '".$this->db->real_escape_string($senderAddress)."',
'".'3'."', '".'3'."',
'".$subject."', '".$this->db->real_escape_string($subject)."',
'".$queue_label."', '".$queue_label."',
'".$AddressId."');"; '".$AddressId."');";
@@ -383,14 +383,14 @@ class TicketImportHelper
) VALUES ( ) VALUES (
'".$ticketNumber."', '".$ticketNumber."',
'".date('Y-m-d H:i:s', $timestamp)."', '".date('Y-m-d H:i:s', $timestamp)."',
'".$message."', '".$this->db->real_escape_string($message)."',
'".$subject."', '".$this->db->real_escape_string($subject)."',
'".'email'."', '".'email'."',
'".$senderName."', '".$this->db->real_escape_string($senderName)."',
'".$senderAddress."', '".$this->db->real_escape_string($senderAddress)."',
'".$status."', '".$status."',
'".$replyToName."', '".$this->db->real_escape_string($replyToName)."',
'".$replyToAddress."');"; '".$this->db->real_escape_string($replyToAddress)."');";
$this->logger->debug('database insert',['query' => $sql]); $this->logger->debug('database insert',['query' => $sql]);
$this->db->Insert($sql); $this->db->Insert($sql);
@@ -483,6 +483,9 @@ class TicketImportHelper
{ {
$insertedMailsCount = 0; $insertedMailsCount = 0;
foreach ($inboxMessageIds as $messageNumber) { foreach ($inboxMessageIds as $messageNumber) {
$this->logger->debug("Fetch $messageNumber", ['']);
try { try {
$message = $this->mailClient->fetchMessage((int)$messageNumber); $message = $this->mailClient->fetchMessage((int)$messageNumber);
} catch (Throwable $e) { } catch (Throwable $e) {
@@ -491,17 +494,24 @@ class TicketImportHelper
} }
try { try {
$this->logger->debug('Start import', ['message' => $message->getSubject()]); // $this->logger->debug('Start import', ['message' => substr(print_r($message,true),1000)]);
$this->logger->debug('Start import '.$messageNumber, []);
$this->importMessage($message); $result = $this->importMessage($message);
if ($result === true) {
$insertedMailsCount++; $insertedMailsCount++;
if ($this->mailAccount->isDeleteAfterImportEnabled()) { if ($this->mailAccount->isDeleteAfterImportEnabled()) {
$this->mailClient->deleteMessage((int)$messageNumber); $this->mailClient->deleteMessage((int)$messageNumber);
} else { } else {
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']); $this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
} }
} else {
$this->logger->error('Error during email import '.$messageNumber, ['message' => substr(print_r($message,true),0,1000)]);
continue;
}
} catch (Throwable $e) { } catch (Throwable $e) {
$this->logger->error('Error during email import', ['exception' => $e]); $this->logger->error('Error during email import '.$messageNumber, ['message' => substr(print_r($message,true),0,1000)]);
continue; continue;
} }
} }
@@ -517,12 +527,10 @@ class TicketImportHelper
/** /**
* @param MailMessageInterface $message * @param MailMessageInterface $message
* *
* @return void * @return true on success
*/ */
public function importMessage(MailMessageInterface $message): void public function importMessage(MailMessageInterface $message): bool
{ {
$DEBUG = 0;
// extract email data // extract email data
$subject = $this->formatter->encodeToUtf8($message->getSubject()); $subject = $this->formatter->encodeToUtf8($message->getSubject());
$from = $this->formatter->encodeToUtf8($message->getSender()->getEmail()); $from = $this->formatter->encodeToUtf8($message->getSender()->getEmail());
@@ -543,17 +551,32 @@ class TicketImportHelper
if ($htmlBody === null) { if ($htmlBody === null) {
$htmlBody = ''; $htmlBody = '';
} }
if ($plainTextBody == '' && $htmlBody == '') {
$simple_content = $message->getContent();
if (empty($simple_content)) {
$this->logger->debug('Empty mail',[]);
} else {
$plainTextBody = $simple_content;
$htmlBody = nl2br(htmlentities($simple_content));
}
}
$this->logger->debug('Text',['plain' => $plainTextBody, 'html' => $htmlBody, 'simple_content' => $simple_content]);
$action = $this->formatter->encodeToUtf8($plainTextBody); $action = $this->formatter->encodeToUtf8($plainTextBody);
$action_html = $this->formatter->encodeToUtf8($htmlBody); $action_html = $this->formatter->encodeToUtf8($htmlBody);
if (strlen($action_html) < strlen($action)) { if (strlen($action_html) < strlen($action)) {
$action_html = nl2br($action); $action_html = nl2br($action);
} }
//check if email exists in database $this->logger->debug('Text (converted)',['plain' => $action, 'html' => $action_html]);
// Import database emailbackup
$date = $message->getDate(); $date = $message->getDate();
if (is_null($date)) { // This should not be happening -> Todo check getDate function if (is_null($date)) { // This should not be happening -> Todo check getDate function
$this->logger->debug('Null date',['subject' => $message->getSubject()]); $this->logger->debug('Null date',['subject' => $message->getSubject(), $message->getHeader('date')->getValue()]);
$frommd5 = md5($from . $subject); return(false);
} else { } else {
$timestamp = $date->getTimestamp(); $timestamp = $date->getTimestamp();
$frommd5 = md5($from . $subject . $timestamp); $frommd5 = md5($from . $subject . $timestamp);
@@ -563,21 +586,29 @@ class TicketImportHelper
FROM `emailbackup_mails` FROM `emailbackup_mails`
WHERE `checksum`='$frommd5' WHERE `checksum`='$frommd5'
AND `empfang`='$empfang' AND `empfang`='$empfang'
AND `ticketnachricht` != 0
AND `webmail`='" . $this->mailAccount->getId() . "'"; AND `webmail`='" . $this->mailAccount->getId() . "'";
$this->logger->debug('Importing message '.$from.' '.$fromname); $this->logger->debug('Importing message '.$from.' '.$fromname);
if ($this->db->Select($sql) == 0) { $result = $this->db->Select($sql);
$emailbackup_mails_id = null;
$this->logger->debug('Importing message',['']); if ($result == 0) {
// $this->logger->debug('Importing message',['message' => substr(print_r($message,true),1000)]);
$this->logger->debug('Importing message attachments',[]);
try {
$attachments = $message->getAttachments(); $attachments = $message->getAttachments();
}
catch (Throwable $e) {
$this->logger->error('Error while getting attachments',['exception' => $e]);
return(false);
}
$anhang = count($attachments) > 0 ? 1 : 0; $anhang = count($attachments) > 0 ? 1 : 0;
$mailacc = $this->mailAccount->getEmailAddress(); $mailacc = $this->mailAccount->getEmailAddress();
if (empty($mailacc) && count($message->getRecipients()) > 0) {
$mailacc = array_values($message->getRecipients())[0]->getEmail();
}
$mailaccid = $this->mailAccount->getId(); $mailaccid = $this->mailAccount->getId();
if (!$this->erpApi->isMailAdr($from)) { if (!$this->erpApi->isMailAdr($from)) {
@@ -604,23 +635,24 @@ class TicketImportHelper
'$empfang','$anhang','$frommd5' '$empfang','$anhang','$frommd5'
)"; )";
$id = null;
if ($DEBUG) {
echo $sql;
} else {
$this->db->InsertWithoutLog($sql); $this->db->InsertWithoutLog($sql);
$id = $this->db->GetInsertID(); $emailbackup_mails_id = $this->db->GetInsertID();
} } else {
$this->logger->debug('Message already imported.',['']);
return(true);
} }
if ($DEBUG) { $this->logger->debug('Message emailbackup_mails imported.',['id' => $emailbackup_mails_id]);
echo "ticket suchen oder anlegen\n"; // END database import emailbackup
}
// Find ticket and add or create new ticket
$ticketNumber = null; $ticketNumber = null;
$ticketexists = null; $ticketexists = null;
if (preg_match("/Ticket #[0-9]{12}/i", $subject, $matches)) { if (preg_match("/Ticket #[0-9]{12}/i", $subject, $matches)) {
$ticketNumber = str_replace('Ticket #', '', $matches[0]); $ticketNumber = str_replace('Ticket #', '', $matches[0]);
$this->logger->debug('Check for number',['ticketnummer' => $ticketNumber]);
$ticketexists = $this->db->Select( $ticketexists = $this->db->Select(
"SELECT schluessel "SELECT schluessel
FROM ticket FROM ticket
@@ -648,7 +680,7 @@ class TicketImportHelper
$this->logger->debug('Add message to existing ticket',['ticketnummer' => $ticketNumber]); $this->logger->debug('Add message to existing ticket',['ticketnummer' => $ticketNumber]);
} }
// Add message to new or existing ticket // Database import ticket: Add message to new or existing ticket
$ticketnachricht = $this->addTicketMessage( $ticketnachricht = $this->addTicketMessage(
(string) $ticketNumber, (string) $ticketNumber,
$timestamp, $timestamp,
@@ -661,11 +693,11 @@ class TicketImportHelper
$from $from
); );
if ($ticketnachricht > 0 && $id > 0) { if ($ticketnachricht > 0 && $emailbackup_mails_id > 0) {
$this->db->Update( $this->db->Update(
"UPDATE `emailbackup_mails` "UPDATE `emailbackup_mails`
SET ticketnachricht='$ticketnachricht' SET ticketnachricht='$ticketnachricht'
WHERE id='$id' LIMIT 1" WHERE id='$emailbackup_mails_id' LIMIT 1"
); );
@@ -711,56 +743,58 @@ class TicketImportHelper
} }
} }
} }
} else {
$this->logger->error("Message not imported!", ['Time' => $timestamp, 'Subject' => $subject, 'From' => $from]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
} }
// END database import ticket
// Prüfen ob Ordner vorhanden ansonsten anlegen // File management folder with raw text
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id"; $ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$emailbackup_mails_id";
if (!is_dir($ordner) && $id > 0) { if (!is_dir($ordner) && $emailbackup_mails_id > 0) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) { if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
} }
$raw_full_email = $message->getRawContent(); $raw_full_email = $message->getRawContent();
file_put_contents($ordner . '/mail.txt', $raw_full_email); file_put_contents($ordner . '/mail.txt', $raw_full_email);
} }
//speichere anhang als datei // File management attachments
if ($anhang == 1 && $id > 0) { if ($anhang == 1 && $emailbackup_mails_id > 0) {
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname; $ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname;
if (!is_dir($ordner)) { if (!is_dir($ordner)) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) { if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]); $this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
} }
} }
// Prüfen ob Ordner vorhanden ansonsten anlegen // Prüfen ob Ordner vorhanden ansonsten anlegen
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id"; $ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$emailbackup_mails_id";
if (!is_dir($ordner)) { if (!is_dir($ordner)) {
if ($DEBUG) {
echo "mkdir $ordner\n";
} else {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) { if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]); $this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
} $this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
} }
} }
$this->logger->debug('Add attachments',['ticketnummer' => $ticketNumber, 'nachricht' => $ticketnachricht, 'count' => count($attachments)]); $this->logger->debug('Add '.count($attachments).' attachments',['']);
foreach ($attachments as $attachment) { foreach ($attachments as $attachment) {
if ($attachment->getFileName() !== '') { if ($attachment->getFileName() !== '') {
if ($DEBUG) {
} else {
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb'); $handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
if ($handle) { if ($handle) {
fwrite($handle, $attachment->getContent()); fwrite($handle, $attachment->getContent());
fclose($handle); fclose($handle);
} }
}
//Schreibe Anhänge in Datei-Tabelle //Schreibe Anhänge in Datei-Tabelle
$datei = $ordner . '/' . $attachment->getFileName(); $datei = $ordner . '/' . $attachment->getFileName();
$dateiname = $attachment->getFileName(); $dateiname = $attachment->getFileName();
$this->logger->debug("Attachment", ['filename' => $dateiname]);
if (stripos(strtoupper($dateiname), '=?UTF-8') !== false) { if (stripos(strtoupper($dateiname), '=?UTF-8') !== false) {
$dateiname = $this->formatter->encodeToUtf8($dateiname); $dateiname = $this->formatter->encodeToUtf8($dateiname);
$dateiname = htmlspecialchars_decode($dateiname); $dateiname = htmlspecialchars_decode($dateiname);
@@ -774,12 +808,6 @@ class TicketImportHelper
$dateiname = htmlspecialchars_decode($dateiname); $dateiname = htmlspecialchars_decode($dateiname);
} }
$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( $tmpid = $this->erpApi->CreateDatei(
$dateiname, $dateiname,
$dateiname, $dateiname,
@@ -790,13 +818,8 @@ class TicketImportHelper
true, true,
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname $this->config->WFuserdata . '/dms/' . $this->config->WFdbname
); );
}
if ($DEBUG) { $this->logger->debug('Add attachment',['filename' => $dateiname, 'ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
echo "AddDateiStichwort $tmpid,'Anhang','Ticket',$ticketnachricht,true)\n";
} else {
$this->logger->debug('Add attachment',['ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
$this->erpApi->AddDateiStichwort( $this->erpApi->AddDateiStichwort(
$tmpid, $tmpid,
@@ -807,9 +830,9 @@ class TicketImportHelper
); );
} }
} }
} } // END File management
}
// Autoresponder
if ( if (
$this->mailAccount->isAutoresponseEnabled() $this->mailAccount->isAutoresponseEnabled()
&& $this->mailAccount->getAutoresponseText() !== '' && $this->mailAccount->getAutoresponseText() !== ''
@@ -843,5 +866,7 @@ class TicketImportHelper
$text $text
); );
} }
return(true);
} }
} }
+11 -4
View File
@@ -34,7 +34,7 @@ if(empty($app->remote)) {
$app->remote = new Remote($app); $app->remote = new Remote($app);
} }
} }
$app->erp->LogFile("Starte Synchronisation"); $app->erp->LogFile("Lagerzahlen-Synchronisation Start");
//$app->DB->Update("UPDATE artikel SET cache_lagerplatzinhaltmenge='999'"); //$app->DB->Update("UPDATE artikel SET cache_lagerplatzinhaltmenge='999'");
@@ -53,6 +53,9 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
$shops = $app->DB->SelectArr('SELECT * FROM `shopexport` WHERE `aktiv` = 1'); $shops = $app->DB->SelectArr('SELECT * FROM `shopexport` WHERE `aktiv` = 1');
if(empty($shops)) { if(empty($shops)) {
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende: Keine aktiven Shops");
return; return;
} }
$shopByIds = []; $shopByIds = [];
@@ -97,6 +100,9 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
); );
if(empty($lagerartikel)) { if(empty($lagerartikel)) {
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende: Keine fälligen Artikel");
return; return;
} }
@@ -110,7 +116,7 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
} }
$clagerartikel = $lagerartikel?count($lagerartikel):0; $clagerartikel = $lagerartikel?count($lagerartikel):0;
$app->erp->LogFile('Artikel Gesamt fuer Synchronisation: '.$clagerartikel); $app->erp->LogFile('Lagerzahlen-Synchronisation, Artikel gesamt: '.$clagerartikel);
foreach($lagerartikel as $ij => $articleId) { foreach($lagerartikel as $ij => $articleId) {
$app->DB->Update( $app->DB->Update(
"UPDATE `prozessstarter` "UPDATE `prozessstarter`
@@ -172,9 +178,10 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
} }
} }
catch (Exception $exception) { catch (Exception $exception) {
$app->erp->LogFile($app->DB->real_escape_string($exception->getMessage())); $app->erp->LogFile("Lagerzahlen-Synchronisation Exception:".$app->DB->real_escape_string($exception->getMessage()));
} }
} }
$app->erp->LogFile('Ende Synchronisation'); $app->erp->LogFile("Lagerzahlen-Synchronisation Ende");
+5 -2
View File
@@ -16728,7 +16728,9 @@ INSERT INTO `firmendaten_werte` (`id`, `name`, `typ`, `typ1`, `typ2`, `wert`, `d
(385, 'cleaner_shopimport', 'tinyint', '1', '', '1', '1', 0, 0), (385, 'cleaner_shopimport', 'tinyint', '1', '', '1', '1', 0, 0),
(386, 'cleaner_shopimport_tage', 'int', '11', '', '90', '90', 0, 0), (386, 'cleaner_shopimport_tage', 'int', '11', '', '90', '90', 0, 0),
(387, 'cleaner_adapterbox', 'tinyint', '1', '', '1', '1', 0, 0), (387, 'cleaner_adapterbox', 'tinyint', '1', '', '1', '1', 0, 0),
(388, 'cleaner_adapterbox_tage', 'int', '11', '', '90', '90', 0, 0); (388, 'cleaner_adapterbox_tage', 'int', '11', '', '90', '90', 0, 0),
(389, 'bcc3', 'varchar', '128', '', '', '', 0, 0)
;
INSERT INTO `geschaeftsbrief_vorlagen` (`id`, `sprache`, `betreff`, `text`, `subjekt`, `projekt`, `firma`) VALUES INSERT INTO `geschaeftsbrief_vorlagen` (`id`, `sprache`, `betreff`, `text`, `subjekt`, `projekt`, `firma`) VALUES
(1, 'deutsch', 'Bestellung {BELEGNR} von {FIRMA}', '{ANSCHREIBEN},<br><br>anbei übersenden wir Ihnen unsere Bestellung zu. Bitte senden Sie uns als Bestätigung für den Empfang eine Auftragsbestätigung zu.', 'Bestellung', 1, 1), (1, 'deutsch', 'Bestellung {BELEGNR} von {FIRMA}', '{ANSCHREIBEN},<br><br>anbei übersenden wir Ihnen unsere Bestellung zu. Bitte senden Sie uns als Bestätigung für den Empfang eine Auftragsbestätigung zu.', 'Bestellung', 1, 1),
@@ -16798,7 +16800,8 @@ INSERT INTO `prozessstarter` (`id`, `bezeichnung`, `bedingung`, `art`, `startzei
(6, 'Überzahlte Rechnungen', '', 'uhrzeit', '2015-10-25 23:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'ueberzahlterechnungen', 0, 0, 0, 1, ''), (6, 'Überzahlte Rechnungen', '', 'uhrzeit', '2015-10-25 23:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'ueberzahlterechnungen', 0, 0, 0, 1, ''),
(7, 'Umsatzstatistik', '', 'uhrzeit', '2015-10-25 23:30:00', '0000-00-00 00:00:00', '', 'cronjob', 'umsatzstatistik', 0, 0, 0, 1, ''), (7, 'Umsatzstatistik', '', 'uhrzeit', '2015-10-25 23:30:00', '0000-00-00 00:00:00', '', 'cronjob', 'umsatzstatistik', 0, 0, 0, 1, ''),
(8, 'Paketmarken Tracking Download', '', 'uhrzeit', '2015-10-25 14:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'wgettracking', 0, 0, 0, 1, ''), (8, 'Paketmarken Tracking Download', '', 'uhrzeit', '2015-10-25 14:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'wgettracking', 0, 0, 0, 1, ''),
(9, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, ''); (9, 'Lagerhistorie', '', 'uhrzeit', '2015-10-25 00:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'lagerwert', 0, 0, 0, 1, ''),
(10, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, '');
INSERT INTO `user` (`id`, `username`, `password`, `repassword`, `description`, `settings`, `parentuser`, `activ`, `type`, `adresse`, `fehllogins`, `standarddrucker`, `firma`, `logdatei`, `startseite`, `hwtoken`, `hwkey`, `hwcounter`, `motppin`, `motpsecret`, `passwordmd5`, `externlogin`, `projekt_bevorzugen`, `email_bevorzugen`, `projekt`, `rfidtag`, `vorlage`, `kalender_passwort`, `kalender_ausblenden`, `kalender_aktiv`, `gpsstechuhr`, `standardetikett`, `standardfax`, `internebezeichnung`, `hwdatablock`, `standardversanddrucker`, `passwordsha512`, `salt`) VALUES INSERT INTO `user` (`id`, `username`, `password`, `repassword`, `description`, `settings`, `parentuser`, `activ`, `type`, `adresse`, `fehllogins`, `standarddrucker`, `firma`, `logdatei`, `startseite`, `hwtoken`, `hwkey`, `hwcounter`, `motppin`, `motpsecret`, `passwordmd5`, `externlogin`, `projekt_bevorzugen`, `email_bevorzugen`, `projekt`, `rfidtag`, `vorlage`, `kalender_passwort`, `kalender_ausblenden`, `kalender_aktiv`, `gpsstechuhr`, `standardetikett`, `standardfax`, `internebezeichnung`, `hwdatablock`, `standardversanddrucker`, `passwordsha512`, `salt`) VALUES
(1, 'admin', 'qnvEQ1sFWNdIg', 0, 'Administrator', 'firstinstall', 0, 1, 'admin', 1, 0, 0, 1, '2016-08-05 08:34:59', NULL, NULL, NULL, NULL, NULL, NULL, '21232f297a57a5a743894a0e4a801fc3', 1, 0, 1, 0, '', NULL, NULL, 0, NULL, NULL, 0, 0, NULL, NULL, 0, '', ''); (1, 'admin', 'qnvEQ1sFWNdIg', 0, 'Administrator', 'firstinstall', 0, 1, 'admin', 1, 0, 0, 1, '2016-08-05 08:34:59', NULL, NULL, NULL, NULL, NULL, NULL, '21232f297a57a5a743894a0e4a801fc3', 1, 0, 1, 0, '', NULL, NULL, 0, NULL, NULL, 0, 0, NULL, NULL, 0, '', '');
+1 -1
View File
@@ -1085,7 +1085,7 @@ $tooltip['produktion']['abschluss']['#mengeerfolgreich'] = 'Höhere Mengen als d
$tooltip['produktion']['edit']['#mengeerfolgreich'] = $tooltip['produktion']['abschluss']['#mengeerfolgreich']; $tooltip['produktion']['edit']['#mengeerfolgreich'] = $tooltip['produktion']['abschluss']['#mengeerfolgreich'];
$tooltip['produktion']['create']['#standardlager'] = "Lager, aus dem die Artikel für die Produktion ausgelagert werden sollen. Hier können alle Lager ausgewählt werden, in denen sich mindestens ein Lagerplatz befindet, aus dem Produktionen ausgelagert werden dürfen (Einstellung auf Regalebene unter Lager => Lagerverwaltung)."; $tooltip['produktion']['create']['#standardlager'] = "Lager, aus dem die Artikel für die Produktion ausgelagert werden sollen. Hier können alle Lager ausgewählt werden, in denen sich mindestens ein Lagerplatz befindet, aus dem Produktionen ausgelagert werden dürfen (Einstellung auf Regalebene unter Lager => Lagerverwaltung).";
$tooltip['produktion']['edit']['#standardlager'] = $tooltip['produktion']['create']['#standardlager']; $tooltip['produktion']['edit']['#standardlager'] = $tooltip['produktion']['create']['#standardlager'];
$tooltip['produktion']['edit']['#ziellager'] = "Wenn kein Ziellager angegenen ist, wird in das Standard-Lager des Artikels gebucht, wenn es das nicht gibt, in das Materiallager der Produktion.";
/* PROJEKT */ /* PROJEKT */
+11 -1
View File
@@ -197,7 +197,7 @@ class Acl
break; break;
case 'dateien': case 'dateien':
$sql = "SELECT objekt FROM datei_stichwoerter WHERE datei = %s"; $sql = "SELECT objekt FROM datei_stichwoerter WHERE datei = %s LIMIT 1";
$dateiModul = strtolower($this->app->DB->Select(sprintf($sql,$id))); $dateiModul = strtolower($this->app->DB->Select(sprintf($sql,$id)));
//TODO datei_stichwoerter.objekt ist nicht zuverlässig für alle Datentypen. Deswegen nur zur Absicherung der bekannten Fälle #604706 //TODO datei_stichwoerter.objekt ist nicht zuverlässig für alle Datentypen. Deswegen nur zur Absicherung der bekannten Fälle #604706
@@ -1261,6 +1261,16 @@ Allow from all
Order Allow,Deny Order Allow,Deny
Allow from all Allow from all
</Files> </Files>
# Allow access to setup.php
<Files setup.php>
Order Allow,Deny
Allow from all
</Files>
# Allow access to inline PDF viewer
<Files viewer.html>
Order Allow,Deny
Allow from all
</Files>
# end # end
'); ');
+8 -4
View File
@@ -135,8 +135,10 @@ class Secure
{ {
foreach($this->POST as $key=>$value) foreach($this->POST as $key=>$value)
{ {
$key = $this->GetPOST($key,"alpha+digit+specialchars",20); $value = $this->GetPOST($key);
$ret[$key]=$this->GetPOST($value); if ($value !== null) {
$ret[$key] = $value;
}
} }
} }
if(!empty($ret)) if(!empty($ret))
@@ -153,8 +155,10 @@ class Secure
{ {
foreach($this->GET as $key=>$value) foreach($this->GET as $key=>$value)
{ {
$key = $this->GetGET($key,"alpha+digit+specialchars",20); $value = $this->GetGET($key);
$ret[$key]=$this->GetGET($value); if ($value !== null) {
$ret[$key] = $value;
}
} }
} }
if(!empty($ret)) if(!empty($ret))
+5 -4
View File
@@ -7868,10 +7868,10 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
// headings // headings
$heading = array('', '', 'Angebot', 'Vom', 'Kd-Nr.', 'Kunde', 'Land', 'Projekt', 'Zahlung', 'Betrag (brutto)', 'Status', 'Men&uuml;'); $heading = array('', '', 'Angebot', 'Vom', 'Kd-Nr.', 'Kunde', 'Land', 'Projekt', 'Zahlung', 'Betrag (brutto)', 'Status','Bearbeiter', 'Men&uuml;');
$width = array('1%', '1%', '1%', '10%', '10%', '40%', '5%', '1%', '1%', '1%', '1%', '1%', '1%', '1%'); $width = array('1%', '1%', '1%', '10%', '10%', '40%', '5%', '1%', '1%', '1%', '1%', '1%', '1%', '1%');
$findcols = array('open', 'a.belegnr', 'a.belegnr', 'a.datum', 'adr.kundennummer', 'a.name', 'a.land', 'p.abkuerzung', 'a.zahlungsweise', 'a.gesamtsumme', 'a.status', 'id'); $findcols = array('open', 'a.belegnr', 'a.belegnr', 'a.datum', 'adr.kundennummer', 'a.name', 'a.land', 'p.abkuerzung', 'a.zahlungsweise', 'a.gesamtsumme', 'a.status','a.bearbeiter', 'id');
$searchsql = array('DATE_FORMAT(a.datum,\'%d.%m.%Y\')', 'a.anfrage','a.belegnr', 'adr.kundennummer', 'a.name', 'a.land', 'p.abkuerzung', 'a.zahlungsweise', 'a.status', "FORMAT(a.gesamtsumme,2{$extended_mysql55})", 'a.status', 'adr.freifeld1','a.internebezeichnung'); $searchsql = array('DATE_FORMAT(a.datum,\'%d.%m.%Y\')', 'a.anfrage','a.belegnr', 'adr.kundennummer', 'a.name', 'a.land', 'p.abkuerzung', 'a.zahlungsweise', 'a.status', "FORMAT(a.gesamtsumme,2{$extended_mysql55})", 'a.status','a.bearbeiter', 'adr.freifeld1','a.internebezeichnung');
$defaultorder = 12; //Optional wenn andere Reihenfolge gewuenscht $defaultorder = 12; //Optional wenn andere Reihenfolge gewuenscht
$defaultorderdesc = 1; $defaultorderdesc = 1;
@@ -7904,7 +7904,7 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
."<td>" ."<td>"
."<a href=\"#\" class=\"label-manager\" data-label-column-number=\"5\" data-label-reference-id=\"%value%\" data-label-reference-table=\"angebot\"><span class=\"label-manager-icon\"></span></a>" ."<a href=\"#\" class=\"label-manager\" data-label-column-number=\"5\" data-label-reference-id=\"%value%\" data-label-reference-table=\"angebot\"><span class=\"label-manager-icon\"></span></a>"
."</td></tr></table>"; ."</td></tr></table>";
$menucol = 11; $menucol = 12;
$parameter = $this->app->User->GetParameter('table_filter_angebot'); $parameter = $this->app->User->GetParameter('table_filter_angebot');
$parameter = base64_decode($parameter); $parameter = base64_decode($parameter);
@@ -7925,6 +7925,7 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
a.zahlungsweise as zahlungsweise, a.zahlungsweise as zahlungsweise,
FORMAT(a.gesamtsumme,2{$extended_mysql55}) as betrag, FORMAT(a.gesamtsumme,2{$extended_mysql55}) as betrag,
UPPER(a.status) as status, UPPER(a.status) as status,
a.bearbeiter,
a.id a.id
"; ";
@@ -1,6 +0,0 @@
{
"host": "localhost",
"database": "openxe",
"user": "openxe",
"passwd": "openxe"
}
-343
View File
@@ -1,343 +0,0 @@
<?php
/*
* Helper to compare database structures from files vs. database
*
* Copyright (c) 2022 OpenXE project
*
*/
/*
MariaDB [openxe]> SHOW FULL db_def;
+----------------------------------------------+------------+
| Tables_in_openxe | Table_type |
+----------------------------------------------+------------+
| abrechnungsartikel | BASE TABLE |
| abrechnungsartikel_gruppe | BASE TABLE |
| abschlagsrechnung_rechnung | BASE TABLE |
| accordion | BASE TABLE |
| adapterbox | BASE TABLE |
| adapterbox_log | BASE TABLE |
| adapterbox_request_log | BASE TABLE |
| adresse | BASE TABLE |
| adresse_abosammelrechnungen | BASE TABLE |
| adresse_accounts | BASE TABLE |
| adresse_filter | BASE TABLE |
| adresse_filter_gruppen | BASE TABLE |
...
MariaDB [openxe]> SHOW FULL COLUMNS FROM wiki;
+-------------------+--------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------------------+--------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| id | int(11) | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| name | varchar(255) | utf8mb3_general_ci | YES | MUL | NULL | | select,insert,update,references | |
| content | longtext | utf8mb3_general_ci | NO | | NULL | | select,insert,update,references | |
| lastcontent | longtext | utf8mb3_general_ci | NO | | NULL | | select,insert,update,references | |
| wiki_workspace_id | int(11) | NULL | NO | | 0 | | select,insert,update,references | |
| parent_id | int(11) | NULL | NO | | 0 | | select,insert,update,references | |
| language | varchar(32) | utf8mb3_general_ci | NO | | | | select,insert,update,references | |
+-------------------+--------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
MariaDB [openxe]> show keys from wiki;
+-------+------------+----------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Ignored |
+-------+------------+----------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| wiki | 0 | PRIMARY | 1 | id | A | 244 | NULL | NULL | | BTREE | | | NO |
| wiki | 0 | suche | 1 | name | A | 244 | NULL | NULL | YES | BTREE | | | NO |
| wiki | 0 | suche | 2 | wiki_workspace_id | A | 244 | NULL | NULL | | BTREE | | | NO |
| wiki | 1 | name | 1 | name | A | 244 | NULL | NULL | YES | BTREE | | | NO |
+-------+------------+----------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
*/
require('mustal_mysql_upgrade_tool.php');
$connection_info_file_name = "connection_info.json";
$target_folder = ".";
$tables_file_name_wo_folder = "db_schema.json";
$tables_file_name_w_folder = $target_folder."/".$tables_file_name_wo_folder;
$delimiter = ";";
$quote = '"';
$sql_file_name = "upgrade.sql";
$color_red = "\033[31m";
$color_green = "\033[32m";
$color_yellow = "\033[33m";
$color_default = "\033[39m";
// -------------------------------- START
echo("\n");
if ($argc > 1) {
if (in_array('-v', $argv)) {
$verbose = true;
} else {
$verbose = false;
}
if (in_array('-f', $argv)) {
$force = true;
} else {
$force = false;
}
if (in_array('-e', $argv)) {
$export = true;
} else {
$export = false;
}
if (in_array('-c', $argv)) {
$compare = true;
} else {
$compare = false;
}
if (in_array('-i', $argv)) {
$onlytables = true;
} else {
$onlytables = false;
}
if (in_array('-upgrade', $argv)) {
$upgrade = true;
} else {
$upgrade = false;
}
if (in_array('-do', $argv)) {
$doupgrade = true;
} else {
$doupgrade = false;
}
if (in_array('-clean', $argv)) {
$clean = true;
} else {
$clean = false;
}
if (in_array('-utf8fix', $argv)) {
$utf8fix = true;
} else {
$utf8fix = false;
}
$connection_info_contents = file_get_contents($connection_info_file_name);
if (!$connection_info_contents) {
echo("Unable to load $connection_info_file_name\n");
exit;
}
$connection_info = json_decode($connection_info_contents, true);
$host = $connection_info['host'];
$user = $connection_info['user'];
$passwd = $connection_info['passwd'];
$schema = $connection_info['database'];
echo("--------------- Loading from database '$schema@$host'... ---------------\n");
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
if (empty($db_def)) {
echo ("Could not load from $schema@$host\n");
exit;
}
echo("--------------- Loading from database '$schema@$host' complete. ---------------\n");
if ($export) {
echo("--------------- Export to JSON... ---------------\n");
// $result = save_tables_to_csv($db_def, $target_folder, $tables_file_name_wo_folder, $delimiter, $quote, $keys_postfix, $force);
$result = mustal_save_tables_to_json($db_def, $target_folder, $tables_file_name_wo_folder, $force);
if ($result != 0) {
$result_texts = array("ok","key postfix error","table list file error","table file error","key file error");
echo ("Could not save to JSON (".$result_texts[$result]."). To overwrite, use -f.\n");
exit;
}
echo("Exported ".count($db_def['tables'])." tables.\n");
echo("--------------- Export to JSON ($tables_file_name_w_folder) complete. ---------------\n");
}
if ($compare || $upgrade) {
// Results here as ['text'] ['diff']
$compare_differences = array();
echo("--------------- Loading from JSON... ---------------\n");
$compare_def = mustal_load_tables_from_json($target_folder, $tables_file_name_wo_folder);
if (empty($compare_def)) {
echo ("Could not load from JSON $tables_file_name_w_folder\n");
exit;
}
echo("--------------- Loading from JSON complete. ---------------\n");
// Do the comparison
/*
echo("--------------- Comparing JSON '".$compare_def['database']."@".$compare_def['host']."' vs. database '$schema@$host' ---------------\n");
echo(count($compare_def['tables'])." tables in JSON, ".count($db_def['tables'])." tables in database.\n");
$compare_differences = compare_table_array($db_def,"in DB",$compare_def,"in JSON",false);
echo("Comparison found ".(empty($compare_differences)?0:count($compare_differences))." differences.\n");
if ($verbose) {
foreach ($compare_differences as $compare_difference) {
$comma = "";
foreach ($compare_difference as $key => $value) {
echo($comma."$key => '$value'");
$comma = ", ";
}
echo("\n");
}
}*/
echo("--------------- Comparing database '$schema@$host' vs. JSON '".$compare_def['database']."@".$compare_def['host']."' ---------------\n");
if($utf8fix) {
$column_collation_aliases = array(
['utf8mb3_general_ci','utf8_general_ci']
);
} else {
$column_collation_aliases = array();
}
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true,$column_collation_aliases);
echo((empty($compare_differences)?0:count($compare_differences))." differences.\n");
if ($verbose) {
foreach ($compare_differences as $compare_difference) {
$comma = "";
foreach ($compare_difference as $key => $value) {
echo($comma."$key => [$value]");
$comma = ", ";
}
echo("\n");
}
}
echo("--------------- Comparison complete. ---------------\n");
}
if ($upgrade) {
// First create all db_def that are missing in the db
echo("--------------- Calculating database upgrade for '$schema@$host'... ---------------\n");
$upgrade_sql = array();
$result = mustal_calculate_db_upgrade($compare_def, $db_def, $upgrade_sql, $mustal_replacers);
if ($result != 0) {
echo("Error: $result\n");
exit;
}
if (!empty($result)) {
echo(count($result)." errors.\n");
if ($verbose) {
foreach($result as $error) {
echo("Code: ".$error[0]." '".$error[1]."'.");
}
}
return(-1);
}
echo("--------------- Database upgrade for '$schema@$host'... ---------------\n");
if ($verbose) {
foreach($upgrade_sql as $statement) {
echo($statement."\n");
}
}
echo(count($upgrade_sql)." upgrade statements\n");
echo("--------------- Database upgrade calculated for '$schema@$host' (show SQL with -v). ---------------\n");
if ($doupgrade) {
echo("--------------- Executing database upgrade for '$schema@$host' database will be written! ---------------\n");
// First get the contents of the database table structure
$mysqli = mysqli_connect($host, $user, $passwd, $schema);
/* Check if the connection succeeded */
if (!$mysqli) {
echo ("Failed to connect!\n");
} else {
$counter = 0;
$error_counter = 0;
$number_of_statements = count($upgrade_sql);
foreach ($upgrade_sql as $sql) {
$counter++;
echo("\rUpgrade step $counter of $number_of_statements... ");
if ($verbose) {
echo("(".substr($sql,0,100)."...) ");
}
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
$error = " not ok: ". mysqli_error($mysqli)."\n";
echo($error);
file_put_contents("./errors.txt",$error.$sql."\n",FILE_APPEND);
$error_counter++;
} else {
echo("ok.\r");
}
}
echo("--------------- Executing database upgrade for '$schema@$host' executed. ---------------\n");
echo("$error_counter errors.\n");
echo("--------------- Executing database upgrade for '$schema@$host' done. ---------------\n");
echo("--------------- Checking database upgrade for '$schema@$host'... ---------------\n");
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
echo("--------------- Comparing database '$schema@$host' vs. JSON '".$compare_def['database']."@".$compare_def['host']."' ---------------\n");
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true);
echo((empty($compare_differences)?0:count($compare_differences))." differences.\n");
}
}
} // upgrade
echo("--------------- Done. ---------------\n");
echo("\n");
} else {
info();
exit;
}
function info() {
echo("OpenXE database compare\n");
echo("Copyright 2022 (c) OpenXE project\n");
echo("\n");
echo("Export database structures in a defined format for database comparison / upgrade\n");
echo("Options:\n");
echo("\t-v: verbose output\n");
echo("\t-f: force override of existing files\n");
echo("\t-e: export database structure to files\n");
echo("\t-c: compare content of files with database structure\n");
echo("\t-i: ignore column definitions\n");
echo("\t-utf8fix: apply fix for 'utf8' != 'utf8mb3'\n");
echo("\t-upgrade: Create the needed SQL to upgrade the database to match the JSON\n");
echo("\t-do: Execute the SQL to upgrade the database to match the JSON (risky!)\n");
echo("\t-clean: (not yet implemented) Create the needed SQL to remove items from the database not in the JSON\n");
echo("\n");
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,661 +0,0 @@
<?php
/*
MUSTAL Mysql Upgrade Schema Tool by Alex Ledis
Helper to compare database structures from JSON files vs. database and upgrade database
Copyright (c) 2022 Alex Ledis
Licensed under AGPL v3
Version 1.0
function mustal_load_tables_from_db(string $host, string $schema, string $user, string $passwd, $replacers) : array
Load structure from db connection to an array.
function mustal_save_tables_to_json(array $db_def, string $path, string $tables_file_name, bool $force) : int
Save structure from array to a JSON file.
function mustal_load_tables_from_json(string $path, string $tables_file_name) : array
Load structure from JSON file into array.
function mustal_compare_table_array(array $nominal, string $nominal_name, array $actual, string $actual_name, bool $check_column_definitions) : array
Compare two database structures
Returns a structured array containing information on all the differences.
function mustal_calculate_db_upgrade(array $compare_def, array $db_def, array &$upgrade_sql) : int
Generate the SQL needed to upgrade the database to match the definition, based on a comparison.
Data structure in Array and JSON
{
"host": "hostname",
"database": "schemaname",
"user": "username",
"tables": [
{
"name": "",
"type": "",
"columns": [
{
"Field": "",
"Type": "",
"Collation": "",
"Null": "",
"Key": "",
"Default": "",
"Extra": "",
"Privileges": "",
"Comment": ""
}
],
"keys": [
{
"Key_name": "",
"columns": [
"",
""
]
}
]
}
]
}
*/
// These default values will not be in quotes, converted to lowercase and be replaced by the second entry
$mustal_replacers = [
['current_timestamp','current_timestamp()'],
['on update current_timestamp','on update current_timestamp()']
];
// Load all db_def from a DB connection into a db_def array
function mustal_load_tables_from_db(string $host, string $schema, string $user, string $passwd, $replacers) : array {
// First get the contents of the database table structure
$mysqli = mysqli_connect($host, $user, $passwd, $schema);
/* Check if the connection succeeded */
if (!$mysqli) {
return(array());
}
// Get db_def and views
$sql = "SHOW FULL tables";
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
return(array());
}
while ($row = mysqli_fetch_assoc($query_result)) {
$table = array();
$table['name'] = $row['Tables_in_'.$schema];
$table['type'] = $row['Table_type'];
$tables[] = $table; // Add table to list of tables
}
// Get and add columns of the table
foreach ($tables as &$table) {
$sql = "SHOW FULL COLUMNS FROM ".$table['name'];
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
return(array());
}
$columns = array();
while ($column = mysqli_fetch_assoc($query_result)) {
// Do some harmonization
if ($column['Default'] !== NULL) {
mustal_sql_replace_reserved_functions($column,$replacers);
$column['Default'] = mustal_mysql_put_text_type_in_quotes($column['Type'],$column['Default']);
}
$columns[] = $column; // Add column to list of columns
}
$table['columns'] = $columns;
$sql = "SHOW KEYS FROM ".$table['name'];
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
return(array());
}
$keys = array();
while ($key = mysqli_fetch_assoc($query_result)) {
$keys[] = $key; // Add key to list of keys
}
// Compose comparable format for keys
$composed_keys = array();
foreach ($keys as $key) {
// Check if this key exists already
$key_pos = array_search($key['Key_name'],array_column($composed_keys,'Key_name'));
if ($key_pos == false) {
// New key
$composed_key = array();
$composed_key['Key_name'] = $key['Key_name'];
$composed_key['Index_type'] = $key['Index_type'];
$composed_key['columns'][] = $key['Column_name'];
$composed_keys[] = $composed_key;
} else {
// Given key, add column
$composed_keys[$key_pos]['columns'][] .= $key['Column_name'];
}
}
unset($key);
$table['keys'] = $composed_keys;
unset($composed_keys);
}
unset($table);
$result = array();
$result['host'] = $host;
$result['database'] = $schema;
$result['user'] = $user;
$result['tables'] = $tables;
return($result);
}
function mustal_save_tables_to_json(array $db_def, string $path, string $tables_file_name, bool $force) : int {
// Prepare db_def file
if (!is_dir($path)) {
mkdir($path);
}
if (!$force && file_exists($path."/".$tables_file_name)) {
return(2);
}
$tables_file = fopen($path."/".$tables_file_name, "w");
if (empty($tables_file)) {
return(2);
}
fwrite($tables_file, json_encode($db_def,JSON_PRETTY_PRINT));
fclose($tables_file);
return(0);
}
// Load all db_def from JSON file
function mustal_load_tables_from_json(string $path, string $tables_file_name) : array {
$db_def = array();
$contents = file_get_contents($path."/".$tables_file_name);
if (!$contents) {
return(array());
}
$db_def = json_decode($contents, true);
if (!$db_def) {
return(array());
}
return($db_def);
}
// Compare two definitions
// Report based on the first array
// Return Array
// $column_collation_aliases may contain synonyms for collations e.g. utf8mb3_general_ci vs utf8_general_ci
function mustal_compare_table_array(array $nominal, string $nominal_name, array $actual, string $actual_name, bool $check_column_definitions, array $column_collation_aliases = array()) : array {
$compare_differences = array();
if (count($nominal['tables']) != count($actual['tables'])) {
$compare_difference = array();
$compare_difference['type'] = "Table count";
$compare_difference[$nominal_name] = count($nominal['tables']);
$compare_difference[$actual_name] = count($actual['tables']);
$compare_differences[] = $compare_difference;
}
foreach ($nominal['tables'] as $database_table) {
$found_table = array();
foreach ($actual['tables'] as $compare_table) {
if ($database_table['name'] == $compare_table['name']) {
$found_table = $compare_table;
break;
}
}
unset($compare_table);
if ($found_table) {
// Check type table vs view
if ($database_table['type'] != $found_table['type']) {
$compare_difference = array();
$compare_difference['type'] = "Table type";
$compare_difference['table'] = $database_table['name'];
$compare_difference[$nominal_name] = $database_table['type'];
$compare_difference[$actual_name] = $found_table['type'];
$compare_differences[] = $compare_difference;
}
// Only BASE TABLE supported now
if ($found_table['type'] != 'BASE TABLE') {
continue;
}
// Check columns
$compare_table_columns = array_column($found_table['columns'],'Field');
foreach ($database_table['columns'] as $column) {
$column_name_to_find = $column['Field'];
$column_key = array_search($column_name_to_find,$compare_table_columns,true);
if ($column_key !== false) {
// Compare the properties of the columns
if ($check_column_definitions) {
$found_column = $found_table['columns'][$column_key];
foreach ($column as $key => $value) {
// Apply aliases
if (!empty($column_collation_aliases)) {
foreach($column_collation_aliases as $column_collation_alias) {
if ($value == $column_collation_alias[0]) {
$value = $column_collation_alias[1];
}
if ($found_column[$key] == $column_collation_alias[0]) {
$found_column[$key] = $column_collation_alias[1];
}
}
}
if ($found_column[$key] != $value) {
if ($key != 'Key') { // Keys will be handled separately
$compare_difference = array();
$compare_difference['type'] = "Column definition";
$compare_difference['table'] = $database_table['name'];
$compare_difference['column'] = $column['Field'];
$compare_difference['property'] = $key;
$compare_difference[$nominal_name] = $value;
$compare_difference[$actual_name] = $found_column[$key];
$compare_differences[] = $compare_difference;
}
}
}
unset($value);
} // $check_column_definitions
} else {
$compare_difference = array();
$compare_difference['type'] = "Column existence";
$compare_difference['table'] = $database_table['name'];
$compare_difference[$nominal_name] = $column['Field'];
$compare_differences[] = $compare_difference;
}
}
unset($column);
// Check keys
$compare_table_sql_indexs = array_column($found_table['keys'],'Key_name');
foreach ($database_table['keys'] as $sql_index) {
$sql_index_name_to_find = $sql_index['Key_name'];
$sql_index_key = array_search($sql_index_name_to_find,$compare_table_sql_indexs,true);
if ($sql_index_key !== false) {
// Compare the properties of the sql_indexs
if ($check_column_definitions) {
$found_sql_index = $found_table['keys'][$sql_index_key];
foreach ($sql_index as $key => $value) {
if ($found_sql_index[$key] != $value) {
// if ($key != 'permissions') {
$compare_difference = array();
$compare_difference['type'] = "Key definition";
$compare_difference['table'] = $database_table['name'];
$compare_difference['key'] = $sql_index['Key_name'];
$compare_difference['property'] = $key;
$compare_difference[$nominal_name] = implode(',',$value);
$compare_difference[$actual_name] = implode(',',$found_sql_index[$key]);
$compare_differences[] = $compare_difference;
// }
}
}
unset($value);
} // $check_sql_index_definitions
} else {
$compare_difference = array();
$compare_difference['type'] = "Key existence";
$compare_difference['table'] = $database_table['name'];
$compare_difference[$nominal_name] = $sql_index['Key_name'];
$compare_differences[] = $compare_difference;
}
}
unset($sql_index);
} else {
$compare_difference = array();
$compare_difference['type'] = "Table existence";
$compare_difference[$nominal_name] = $database_table['name'];
$compare_differences[] = $compare_difference;
}
}
unset($database_table);
return($compare_differences);
}
// Generate SQL to create or modify column
function mustal_column_sql_definition(string $table_name, array $column, array $reserved_words_without_quote) : string {
foreach($column as $key => &$value) {
$value = (string) $value;
$value = mustal_column_sql_create_property_definition($key,$value,$reserved_words_without_quote);
}
// Default handling here
if ($column['Default'] == " DEFAULT ''") {
$column['Default'] = "";
}
$sql =
$column['Type'].
$column['Null'].
$column['Default'].
$column['Extra'].
$column['Collation'];
return($sql);
}
// Generate SQL to modify a single column property
function mustal_column_sql_create_property_definition(string $property, string $property_value, array $reserved_words_without_quote) : string {
switch ($property) {
case 'Type':
break;
case 'Null':
if ($property_value == "NO") {
$property_value = " NOT NULL"; // Idiotic...
}
if ($property_value == "YES") {
$property_value = " NULL"; // Also Idiotic...
}
break;
case 'Default':
// Check for MYSQL function mustal_call as default
if (in_array(strtolower($property_value),$reserved_words_without_quote)) {
$quote = "";
} else {
// Remove quotes if there are
$property_value = trim($property_value,"'");
$quote = "'";
}
$property_value = " DEFAULT $quote".$property_value."$quote";
break;
case 'Extra':
if ($property_value != '') {
$property_value = " ".$property_value;
}
break;
case 'Collation':
if ($property_value != '') {
$property_value = " COLLATE ".$property_value;
}
break;
default:
$property_value = "";
break;
}
return($property_value);
}
// Replaces different variants of the same function mustal_to allow comparison
function mustal_sql_replace_reserved_functions(array &$column, array $replacers) {
$result = strtolower($column['Default']);
foreach ($replacers as $replace) {
if ($result == $replace[0]) {
$result = $replace[1];
}
}
$column['Default'] = $result;
$result = strtolower($column['Extra']);
foreach ($replacers as $replace) {
if ($result == $replace[0]) {
$result = $replace[1];
}
}
$column['Extra'] = $result;
}
// Is it a text type? -> Use quotes then
function mustal_mysql_put_text_type_in_quotes(string $checktype, string $value) : string {
$types = array('char','varchar','tinytext','text','mediumtext','longtext');
foreach($types as $type) {
if (stripos($checktype, $type) !== false) {
return("'".$value."'");
}
}
return($value);
}
function mustal_implode_with_quote(string $quote, string $delimiter, array $array_to_implode) : string {
return($quote.implode($quote.$delimiter.$quote, $array_to_implode).$quote);
}
// Calculate the sql neccessary to update the database
// returns array(code,text)
// Error codes:
// 0 ok
// 1 Upgrade type of table not supported
// 2 Error on table upgrade
// 3 Error on column existence upgrade
// 4 Error on column existence upgrade
// 5 Error on column definition upgrade
// 6 Error on column definition upgrade
// 7 Error on key existence upgrade
// 8 Error on key existence upgrade
// 9 Error on key definition upgrade
// 10 Error on key definition upgrade
// 11 Table type upgrade not supported
// 12 Upgrade type not supported
function mustal_calculate_db_upgrade(array $compare_def, array $db_def, array &$upgrade_sql, array $replacers) : array {
$result = array();
$upgrade_sql = array();
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true);
if (count($compare_differences) > 0) {
$upgrade_sql[] = ("SET SQL_MODE='ALLOW_INVALID_DATES';");
$upgrade_sql[] = ("SET SESSION innodb_strict_mode=OFF;");
}
foreach ($compare_differences as $compare_difference) {
switch ($compare_difference['type']) {
case 'Table existence':
// Get table definition from JSON
$table_name = $compare_difference['in JSON'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
switch ($table['type']) {
case 'BASE TABLE':
// Create table in DB
$sql = "";
$sql = "CREATE TABLE `".$table['name']."` (";
$comma = "";
foreach ($table['columns'] as $column) {
$sql .= $comma."`".$column['Field']."` ".mustal_column_sql_definition($table_name, $column,array_column($replacers,1));
$comma = ", ";
}
// Add keys
$comma = ", ";
foreach ($table['keys'] as $key) {
if ($key['Key_name'] == 'PRIMARY') {
$keystring = "PRIMARY KEY ";
} else {
if(array_key_exists('Index_type', $key)) {
$index_type = $key['Index_type'];
} else {
$index_type = "";
}
$keystring = $index_type." KEY `".$key['Key_name']."` ";
}
$sql .= $comma.$keystring."(`".implode("`,`",$key['columns'])."`) ";
}
$sql .= ")";
$upgrade_sql[] = $sql;
break;
default:
$result[] = array(1,"Upgrade type '".$table['type']."' on table '".$table['name']."' not supported.");
break;
}
} else {
$result[] = array(2,"Error table_key while creating upgrade for table existence `$table_name`.");
}
break;
case 'Column existence':
$table_name = $compare_difference['table'];
$column_name = $compare_difference['in JSON'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$columns = $table['columns'];
$column_key = array_search($column_name,array_column($columns,'Field'));
if ($column_key !== false) {
$column = $table['columns'][$column_key];
$sql = "ALTER TABLE `$table_name` ADD COLUMN `".$column_name."` ";
$sql .= mustal_column_sql_definition($table_name, $column, array_column($replacers,1));
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(3,"Error column_key while creating column '$column_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(4,"Error table_key while creating upgrade for column existence '$column_name' in table '$table_name'.");
}
// Add Column in DB
break;
case 'Column definition':
$table_name = $compare_difference['table'];
$column_name = $compare_difference['column'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$columns = $table['columns'];
$column_names = array_column($columns,'Field');
$column_key = array_search($column_name,$column_names);
if ($column_key !== false) {
$column = $table['columns'][$column_key];
$sql = "ALTER TABLE `$table_name` MODIFY COLUMN `".$column_name."` ";
$sql .= mustal_column_sql_definition($table_name, $column,array_column($replacers,1));
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(5,"Error column_key while modifying column '$column_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(6,"Error table_key while modifying column '$column_name' in table '$table_name'.");
return(6);
}
// Modify Column in DB
break;
case 'Key existence':
$table_name = $compare_difference['table'];
$key_name = $compare_difference['in JSON'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$keys = $table['keys'];
$key_names = array_column($keys,'Key_name');
$key_key = array_search($key_name,$key_names);
if ($key_key !== false) {
$key = $table['keys'][$key_key];
$sql = "ALTER TABLE `$table_name` ADD KEY `".$key_name."` ";
$sql .= "(`".implode("`,`",$key['columns'])."`)";
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(7,"Error key_key while adding key '$key_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(8,"Error table_key while adding key '$key_name' in table '$table_name'.");
}
break;
case "Key definition":
$table_name = $compare_difference['table'];
$key_name = $compare_difference['key'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$keys = $table['keys'];
$key_names = array_column($keys,'Key_name');
$key_key = array_search($key_name,$key_names);
if ($key_key !== false) {
$key = $table['keys'][$key_key];
$sql = "ALTER TABLE `$table_name` DROP KEY `".$key_name."`;";
$upgrade_sql[] = $sql;
$sql = "ALTER TABLE `$table_name` ADD KEY `".$key_name."` ";
$sql .= "(`".implode("`,`",$key['columns'])."`)";
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(9, "Error key_key while changing key '$key_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(10,"Error table_key while changing key '$key_name' in table '$table_name'.");
}
break;
case 'Table count':
// Nothing to do
break;
case 'Table type':
$result[] = array(11,"Upgrade type '".$compare_difference['type']."' on table '".$compare_difference['table']."' not supported.");
break;
default:
$result[] = array(12,"Upgrade type '".$compare_difference['type']."' not supported.");
break;
}
}
$upgrade_sql = array_unique($upgrade_sql);
return($result);
}
+16 -1
View File
@@ -17,6 +17,8 @@
* PLACEHOLDER_GET_INPUT * PLACEHOLDER_GET_INPUT
* PLACEHOLDER_SET_INPUT * PLACEHOLDER_SET_INPUT
* PLACEHOLDER_COLUMNS * PLACEHOLDER_COLUMNS
* PLACEHOLDER_ID_COLUMN
* PLACEHOLDER_HEADERS
* PLACEHOLDER_SET_TPL * PLACEHOLDER_SET_TPL
*/ */
@@ -109,6 +111,7 @@ if ($argc >= 2) {
$columns = array(); $columns = array();
$sql_columns = array(); $sql_columns = array();
$edit_form = ""; $edit_form = "";
$tab_pos = " "; // Tab position
/* Iterate through the result set */ /* Iterate through the result set */
echo "FIELD\t\t\t\tType\t\tNull\tKey\tDefault\tExtra\n"; echo "FIELD\t\t\t\tType\t\tNull\tKey\tDefault\tExtra\n";
@@ -150,7 +153,16 @@ if ($argc >= 2) {
// <tr><td>{|Bezeichnung|}:*</td><td><input type="text" id="bezeichnung" name="bezeichnung" value="[BEZEICHNUNG]" size="40"></td></tr> // <tr><td>{|Bezeichnung|}:*</td><td><input type="text" id="bezeichnung" name="bezeichnung" value="[BEZEICHNUNG]" size="40"></td></tr>
if ($row['Field'] != 'id') { if ($row['Field'] != 'id') {
$edit_form = $edit_form . '<tr><td>{|' . ucfirst($row['Field']) . '|}:</td><td><input type="text" name="' . $row['Field'].'" id="'.$row['Field'].'" value="[' . strtoupper($row['Field']) . ']" size="20"></td></tr>' . "\n"; $edit_form = $edit_form.
'<tr>
<td>
{|' . ucfirst($row['Field']) . '|}:
</td>
<td>
<input type="text" name="' . $row['Field'].'" id="'.$row['Field'].'" value="[' . strtoupper($row['Field']) . ']" size="20">
</td>
</tr>
';
} }
echo("\n"); echo("\n");
} }
@@ -164,6 +176,7 @@ if ($argc >= 2) {
// Create php file // Create php file
$list_of_columns = implode(', ', $columns); $list_of_columns = implode(', ', $columns);
$list_of_columns_headers_in_quotes = "'" . implode('\', \'', array_map('ucfirst',$columns)) . "'";
$list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'"; $list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'";
$sql_list_of_columns = implode(', ', $sql_columns); $sql_list_of_columns = implode(', ', $sql_columns);
$sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'"; $sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'";
@@ -194,6 +207,8 @@ if ($argc >= 2) {
$php_file_contents = str_replace('PLACEHOLDER_GET_INPUT', $get_input, $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_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_COLUMNS', $list_of_columns_in_quotes, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_ID_COLUMN', $table_short_name.".id", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_HEADERS', $list_of_columns_headers_in_quotes, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SQL_COLUMNS', $sql_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"); $php_file = fopen($target_php_folder . $php_file_name, "w");
@@ -1,5 +1,10 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
</ul>
<div id="tabs-1"> <div id="tabs-1">
[MESSAGE] [MESSAGE]
[TAB1] [TAB1]
[TAB1NEXT] [TAB1NEXT]
</div> </div>
</div>
@@ -30,13 +30,13 @@ class PLACEHOLDER_MODULECLASSNAME {
switch ($name) { switch ($name) {
case "PLACEHOLDER_LIST": case "PLACEHOLDER_LIST":
$allowed['PLACEHOLDER_LIST'] = array('list'); $allowed['PLACEHOLDER_LIST'] = array('list');
$heading = array('','',PLACEHOLDER_COLUMNS, 'Men&uuml;'); $heading = array('','',PLACEHOLDER_HEADERS, 'Men&uuml;');
$width = array('1%','1%','10%'); // Fill out manually later $width = array('1%','1%','10%'); // Fill out manually later
// columns that are aligned right (numbers etc) // columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8); // $alignright = array(4,5,6,7,8);
$findcols = array(PLACEHOLDER_SQL_COLUMNS); $findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS);
$searchsql = array(PLACEHOLDER_SQL_COLUMNS); $searchsql = array(PLACEHOLDER_SQL_COLUMNS);
$defaultorder = 1; $defaultorder = 1;
+6 -3
View File
@@ -1,16 +1,19 @@
Upgrade the OpenXE system. OpenXE upgrade system
NOTE: NOTE:
The upgrade system is for use in LINUX only and needs to have git installed. The upgrade system is for use in LINUX only and needs to have git installed.
The following steps are executed:
1. get files from git 1. get files from git
2. run database upgrade 2. run database upgrade
Files in this directory: Files in this directory:
UPGRADE.md -> This file UPGRADE.md -> This file
upgrade.php -> The upgrade program upgrade.sh -> The upgrade starter, execute with "./upgrade.sh". Execute without parameters to view possible options.
Files in the data subdirectory: Files in the data subdirectory:
.in_progress.flag -> if this file exists, an upgrade is in progress, system will be locked upgrade.php -> The upgrade program
db_schema.json -> Contains the nominal database structure db_schema.json -> Contains the nominal database structure
exported_db_schema.json -> Contains the exported database structure (optional)
remote.json -> Contains the git remote & branch which should be used for upgrade remote.json -> Contains the git remote & branch which should be used for upgrade
upgrade.log -> Contains the output from the last run that was started from within OpenXE
+109 -4
View File
@@ -28444,6 +28444,55 @@
} }
] ]
}, },
{
"name": "bestellvorschlag",
"type": "BASE TABLE",
"columns": [
{
"Field": "user",
"Type": "int(11)",
"Collation": null,
"Null": "NO",
"Key": "PRI",
"Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "artikel",
"Type": "int(11)",
"Collation": null,
"Null": "NO",
"Key": "PRI",
"Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "menge",
"Type": "int(11)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
}
],
"keys": [
{
"Key_name": "PRIMARY",
"Index_type": "BTREE",
"columns": [
"artikel",
"user"
]
}
]
},
{ {
"name": "bestellvorschlag_app", "name": "bestellvorschlag_app",
"type": "BASE TABLE", "type": "BASE TABLE",
@@ -56922,7 +56971,7 @@
}, },
{ {
"Field": "log_time", "Field": "log_time",
"Type": "datetime", "Type": "datetime(3)",
"Collation": null, "Collation": null,
"Null": "YES", "Null": "YES",
"Key": "", "Key": "",
@@ -77639,7 +77688,52 @@
"Extra": "", "Extra": "",
"Privileges": "select,insert,update,references", "Privileges": "select,insert,update,references",
"Comment": "" "Comment": ""
},
{
"Field": "buchhaltung_berater",
"Type": "varchar(64)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": "",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "buchhaltung_mandant",
"Type": "varchar(64)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": "",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "buchhaltung_wj_beginn",
"Type": "varchar(4)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": "'0101'",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "buchhaltung_sachkontenlaenge",
"Type": "int(1)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": "4",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
} }
], ],
"keys": [ "keys": [
{ {
@@ -84808,6 +84902,17 @@
"Privileges": "select,insert,update,references", "Privileges": "select,insert,update,references",
"Comment": "" "Comment": ""
}, },
{
"Field": "ftp_passive",
"Type": "int(1)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": "0",
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{ {
"Field": "email_active", "Field": "email_active",
"Type": "tinyint(4)", "Type": "tinyint(4)",
@@ -114243,17 +114348,17 @@
{ {
"name": "belege", "name": "belege",
"type": "VIEW", "type": "VIEW",
"Create": "CREATE ALGORITHM=UNDEFINED DEFINER=`openxe`@`localhost` SQL SECURITY DEFINER VIEW `belege` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe` from `rechnung` where (`rechnung`.`status` <> 'angelegt') union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,(`gutschrift`.`umsatz_netto` * -(1)) AS `umsatz_netto*-1`,(`gutschrift`.`erloes_netto` * -(1)) AS `erloes_netto*-1`,(`gutschrift`.`deckungsbeitrag` * -(1)) AS `deckungsbeitrag*-1`,(`gutschrift`.`provision_summe` * -(1)) AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe` from `gutschrift` where (`gutschrift`.`status` <> 'angelegt')" "Create": "CREATE VIEW `belege` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe` from `rechnung` where `rechnung`.`status` <> 'angelegt' union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,`gutschrift`.`umsatz_netto` * -1 AS `umsatz_netto*-1`,`gutschrift`.`erloes_netto` * -1 AS `erloes_netto*-1`,`gutschrift`.`deckungsbeitrag` * -1 AS `deckungsbeitrag*-1`,`gutschrift`.`provision_summe` * -1 AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe` from `gutschrift` where `gutschrift`.`status` <> 'angelegt'"
}, },
{ {
"name": "belegegesamt", "name": "belegegesamt",
"type": "VIEW", "type": "VIEW",
"Create": "CREATE ALGORITHM=UNDEFINED DEFINER=`openxe`@`localhost` SQL SECURITY DEFINER VIEW `belegegesamt` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`soll` AS `umsatz_brutto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe`,`rechnung`.`projekt` AS `projekt` from `rechnung` union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,(`gutschrift`.`umsatz_netto` * -(1)) AS `umsatz_netto*-1`,(`gutschrift`.`soll` * -(1)) AS `umsatz_brutto*-1`,(`gutschrift`.`erloes_netto` * -(1)) AS `erloes_netto*-1`,(`gutschrift`.`deckungsbeitrag` * -(1)) AS `deckungsbeitrag*-1`,(`gutschrift`.`provision_summe` * -(1)) AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe`,`gutschrift`.`projekt` AS `projekt` from `gutschrift` union all select `auftrag`.`id` AS `id`,`auftrag`.`adresse` AS `adresse`,`auftrag`.`datum` AS `datum`,`auftrag`.`belegnr` AS `belegnr`,`auftrag`.`status` AS `status`,`auftrag`.`land` AS `land`,'auftrag' AS `typ`,`auftrag`.`umsatz_netto` AS `umsatz_netto`,`auftrag`.`gesamtsumme` AS `umsatz_brutto`,`auftrag`.`erloes_netto` AS `erloes_netto`,`auftrag`.`deckungsbeitrag` AS `deckungsbeitrag`,`auftrag`.`provision_summe` AS `provision_summe`,`auftrag`.`vertriebid` AS `vertriebid`,`auftrag`.`gruppe` AS `gruppe`,`auftrag`.`projekt` AS `projekt` from `auftrag` union all select `bestellung`.`id` AS `id`,`bestellung`.`adresse` AS `adresse`,`bestellung`.`datum` AS `datum`,`bestellung`.`belegnr` AS `belegnr`,`bestellung`.`status` AS `status`,`bestellung`.`land` AS `land`,'bestellung' AS `typ`,`bestellung`.`gesamtsumme` AS `umsatz_netto`,`bestellung`.`gesamtsumme` AS `umsatz_brutto`,'0' AS `erloes_netto`,'0' AS `deckungsbeitrag`,'0' AS `provision_summe`,'0' AS `vertriebid`,'0' AS `gruppe`,`bestellung`.`projekt` AS `projekt` from `bestellung` union all select `lieferschein`.`id` AS `id`,`lieferschein`.`adresse` AS `adresse`,`lieferschein`.`datum` AS `datum`,`lieferschein`.`belegnr` AS `belegnr`,`lieferschein`.`status` AS `status`,`lieferschein`.`land` AS `land`,'lieferschein' AS `typ`,'0' AS `umsatz_netto`,'0' AS `umsatz_brutto`,'0' AS `erloes_netto`,'0' AS `deckungsbeitrag`,'0' AS `provision_summe`,'0' AS `vertriebid`,'0' AS `gruppe`,`lieferschein`.`projekt` AS `projekt` from `lieferschein` union all select `angebot`.`id` AS `id`,`angebot`.`adresse` AS `adresse`,`angebot`.`datum` AS `datum`,`angebot`.`belegnr` AS `belegnr`,`angebot`.`status` AS `status`,`angebot`.`land` AS `land`,'angebot' AS `typ`,`angebot`.`umsatz_netto` AS `umsatz_netto`,`angebot`.`gesamtsumme` AS `umsatz_brutto`,'0' AS `erloes_netto`,`angebot`.`deckungsbeitrag` AS `deckungsbeitrag`,'0' AS `provision_summe`,`angebot`.`vertriebid` AS `vertriebid`,'0' AS `gruppe`,`angebot`.`projekt` AS `projekt` from `angebot`" "Create": "CREATE VIEW `belegegesamt` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`soll` AS `umsatz_brutto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe`,`rechnung`.`projekt` AS `projekt` from `rechnung` union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,`gutschrift`.`umsatz_netto` * -1 AS `umsatz_netto*-1`,`gutschrift`.`soll` * -1 AS `umsatz_brutto*-1`,`gutschrift`.`erloes_netto` * -1 AS `erloes_netto*-1`,`gutschrift`.`deckungsbeitrag` * -1 AS `deckungsbeitrag*-1`,`gutschrift`.`provision_summe` * -1 AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe`,`gutschrift`.`projekt` AS `projekt` from `gutschrift` union all select `auftrag`.`id` AS `id`,`auftrag`.`adresse` AS `adresse`,`auftrag`.`datum` AS `datum`,`auftrag`.`belegnr` AS `belegnr`,`auftrag`.`status` AS `status`,`auftrag`.`land` AS `land`,'auftrag' AS `typ`,`auftrag`.`umsatz_netto` AS `umsatz_netto`,`auftrag`.`gesamtsumme` AS `umsatz_brutto`,`auftrag`.`erloes_netto` AS `erloes_netto`,`auftrag`.`deckungsbeitrag` AS `deckungsbeitrag`,`auftrag`.`provision_summe` AS `provision_summe`,`auftrag`.`vertriebid` AS `vertriebid`,`auftrag`.`gruppe` AS `gruppe`,`auftrag`.`projekt` AS `projekt` from `auftrag` union all select `bestellung`.`id` AS `id`,`bestellung`.`adresse` AS `adresse`,`bestellung`.`datum` AS `datum`,`bestellung`.`belegnr` AS `belegnr`,`bestellung`.`status` AS `status`,`bestellung`.`land` AS `land`,'bestellung' AS `typ`,`bestellung`.`gesamtsumme` AS `umsatz_netto`,`bestellung`.`gesamtsumme` AS `umsatz_brutto`,'0' AS `erloes_netto`,'0' AS `deckungsbeitrag`,'0' AS `provision_summe`,'0' AS `vertriebid`,'0' AS `gruppe`,`bestellung`.`projekt` AS `projekt` from `bestellung` union all select `lieferschein`.`id` AS `id`,`lieferschein`.`adresse` AS `adresse`,`lieferschein`.`datum` AS `datum`,`lieferschein`.`belegnr` AS `belegnr`,`lieferschein`.`status` AS `status`,`lieferschein`.`land` AS `land`,'lieferschein' AS `typ`,'0' AS `umsatz_netto`,'0' AS `umsatz_brutto`,'0' AS `erloes_netto`,'0' AS `deckungsbeitrag`,'0' AS `provision_summe`,'0' AS `vertriebid`,'0' AS `gruppe`,`lieferschein`.`projekt` AS `projekt` from `lieferschein` union all select `angebot`.`id` AS `id`,`angebot`.`adresse` AS `adresse`,`angebot`.`datum` AS `datum`,`angebot`.`belegnr` AS `belegnr`,`angebot`.`status` AS `status`,`angebot`.`land` AS `land`,'angebot' AS `typ`,`angebot`.`umsatz_netto` AS `umsatz_netto`,`angebot`.`gesamtsumme` AS `umsatz_brutto`,'0' AS `erloes_netto`,`angebot`.`deckungsbeitrag` AS `deckungsbeitrag`,'0' AS `provision_summe`,`angebot`.`vertriebid` AS `vertriebid`,'0' AS `gruppe`,`angebot`.`projekt` AS `projekt` from `angebot`"
}, },
{ {
"name": "belegeregs", "name": "belegeregs",
"type": "VIEW", "type": "VIEW",
"Create": "CREATE ALGORITHM=UNDEFINED DEFINER=`openxe`@`localhost` SQL SECURITY DEFINER VIEW `belegeregs` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe`,`rechnung`.`projekt` AS `projekt` from `rechnung` union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,(`gutschrift`.`umsatz_netto` * -(1)) AS `umsatz_netto*-1`,(`gutschrift`.`erloes_netto` * -(1)) AS `erloes_netto*-1`,(`gutschrift`.`deckungsbeitrag` * -(1)) AS `deckungsbeitrag*-1`,(`gutschrift`.`provision_summe` * -(1)) AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe`,`gutschrift`.`projekt` AS `projekt` from `gutschrift`" "Create": "CREATE VIEW `belegeregs` AS select `rechnung`.`id` AS `id`,`rechnung`.`adresse` AS `adresse`,`rechnung`.`datum` AS `datum`,`rechnung`.`belegnr` AS `belegnr`,`rechnung`.`status` AS `status`,`rechnung`.`land` AS `land`,'rechnung' AS `typ`,`rechnung`.`umsatz_netto` AS `umsatz_netto`,`rechnung`.`erloes_netto` AS `erloes_netto`,`rechnung`.`deckungsbeitrag` AS `deckungsbeitrag`,`rechnung`.`provision_summe` AS `provision_summe`,`rechnung`.`vertriebid` AS `vertriebid`,`rechnung`.`gruppe` AS `gruppe`,`rechnung`.`projekt` AS `projekt` from `rechnung` union all select `gutschrift`.`id` AS `id`,`gutschrift`.`adresse` AS `adresse`,`gutschrift`.`datum` AS `datum`,`gutschrift`.`belegnr` AS `belegnr`,`gutschrift`.`status` AS `status`,`gutschrift`.`land` AS `land`,'gutschrift' AS `typ`,`gutschrift`.`umsatz_netto` * -1 AS `umsatz_netto*-1`,`gutschrift`.`erloes_netto` * -1 AS `erloes_netto*-1`,`gutschrift`.`deckungsbeitrag` * -1 AS `deckungsbeitrag*-1`,`gutschrift`.`provision_summe` * -1 AS `provision_summe*-1`,`gutschrift`.`vertriebid` AS `vertriebid`,`gutschrift`.`gruppe` AS `gruppe`,`gutschrift`.`projekt` AS `projekt` from `gutschrift`"
} }
] ]
} }
@@ -48,26 +48,23 @@ function git(string $command, &$output, bool $show_command, bool $show_output, s
echo_output($output); echo_output($output);
} }
} }
if ($retval != 0) {
echo_out($error_text."\n");
}
return($retval); return($retval);
} }
// -------------------------------- START // -------------------------------- START
// Check for correct call method // Check for correct call method
$directory = "";
if (php_sapi_name() == "cli") { if (php_sapi_name() == "cli") {
$cli = true;
$directory = "."; $directory = getcwd();
} else if (basename(getcwd()) != 'upgrade') { if (basename($directory) != 'upgrade') {
// Started from "www"
$directory = "../upgrade";
} else {
abort("Must be executed from 'upgrade' directory."); abort("Must be executed from 'upgrade' directory.");
return(-1); return(-1);
} }
if ($cli) {
$check_git = false; $check_git = false;
$do_git = false; $do_git = false;
$check_db = false; $check_db = false;
@@ -94,6 +91,12 @@ if ($cli) {
$force = false; $force = false;
} }
if (in_array('-o', $argv)) {
$origin = true;
} else {
$origin = false;
}
if (in_array('-connection', $argv)) { if (in_array('-connection', $argv)) {
$connection = true; $connection = true;
} else { } else {
@@ -124,7 +127,7 @@ if ($cli) {
} }
if ($check_git || $check_db || $do_git || $do_db) { if ($check_git || $check_db || $do_git || $do_db) {
upgrade_main($directory,$verbose,$check_git,$do_git,$export_db,$check_db,$do_db,$force,$connection); upgrade_main($directory,$verbose,$check_git,$do_git,$export_db,$check_db,$do_db,$force,$connection,$origin);
} else { } else {
info(); info();
} }
@@ -136,40 +139,9 @@ if ($cli) {
} }
// -------------------------------- END // -------------------------------- END
function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do_git, bool $export_db, bool $check_db, bool $do_db, bool $force, bool $connection) { function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do_git, bool $export_db, bool $check_db, bool $do_db, bool $force, bool $connection, bool $origin) {
if ($connection) {
$connection_file_name = $directory."/data/connection.json";
$connection_file_contents = file_get_contents($connection_file_name);
if (!$connection_file_contents) {
abort("Unable to load $connection_file_name");
return(-1);
}
$connection_info = json_decode($connection_file_contents, true);
$host = $connection_info['host'];
$user = $connection_info['user'];
$passwd = $connection_info['passwd'];
$schema = $connection_info['schema'];
} else {
class DatabaseConnectionInfo {
function __construct($dir) {
require($dir."/../conf/user.inc.php");
}
}
$dbci = new DatabaseConnectionInfo($directory);
$host = $dbci->WFdbhost;
$user = $dbci->WFdbuser;
$passwd = $dbci->WFdbpass;
$schema = $dbci->WFdbname;
}
require_once($directory.'/../vendor/mustal/mustal_mysql_upgrade_tool.php');
$mainfolder = dirname($directory);
$datafolder = $directory."/data"; $datafolder = $directory."/data";
$lockfile_name = $datafolder."/.in_progress.flag"; $lockfile_name = $datafolder."/.in_progress.flag";
$remote_file_name = $datafolder."/remote.json"; $remote_file_name = $datafolder."/remote.json";
@@ -180,34 +152,34 @@ function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do
//require_once($directory.'/../cronjobs/githash.php'); //require_once($directory.'/../cronjobs/githash.php');
if ($origin) {
$remote_info = array('host' => 'origin','branch' => 'master');
} else {
$remote_info_contents = file_get_contents($remote_file_name); $remote_info_contents = file_get_contents($remote_file_name);
if (!$remote_info_contents) { if (!$remote_info_contents) {
abort("Unable to load $remote_file_name"); abort("Unable to load $remote_file_name");
return(-1); return(-1);
} }
$remote_info = json_decode($remote_info_contents, true); $remote_info = json_decode($remote_info_contents, true);
$modified_files = false;
if ($check_git || $do_git) {
// Get changed files on system -> Should be empty
$output = array();
$retval = git("ls-files -m ..", $output,$verbose,false,"Git not initialized.");
if (!empty($output)) {
$modified_files = true;
echo_out("There are modified files:\n");
echo_output($output);
} }
if ($check_git || $do_git) {
$retval = git("log HEAD --", $output,$verbose,false,"");
// Not a git repository -> Create it and then go ahead // Not a git repository -> Create it and then go ahead
if ($retval == 128) { if ($retval == 128) {
if (!$do_git) {
abort("Git not initialized, use -do to initialize.");
return(-1);
}
echo_out("Setting up git..."); echo_out("Setting up git...");
$retval = git("init ..", $output,$verbose,$verbose,"Error while initializing git!"); $retval = git("init $mainfolder", $output,$verbose,$verbose,"Error while initializing git!");
if ($retval != 0) { if ($retval != 0) {
abort(""); abort("");
return(-1); return(-1);
} }
$retval = git("add ../.", $output,$verbose,$verbose,"Error while initializing git!"); $retval = git("add $mainfolder", $output,$verbose,$verbose,"Error while initializing git!");
if ($retval != 0) { if ($retval != 0) {
abort(""); abort("");
return(-1); return(-1);
@@ -218,7 +190,7 @@ function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do
return(-1); return(-1);
} }
$retval = git("checkout FETCH_HEAD -f", $output,$verbose,$verbose,"Error while initializing git!"); $retval = git("checkout FETCH_HEAD -f --", $output,$verbose,$verbose,"Error while initializing git!");
if ($retval != 0) { if ($retval != 0) {
abort(""); abort("");
return(-1); return(-1);
@@ -228,16 +200,26 @@ function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do
return(-1); return(-1);
} }
// Get changed files on system -> Should be empty
$modified_files = false;
$output = array();
$retval = git("ls-files -m $mainfolder", $output,$verbose,false,"Error while checking Git status.");
if (!empty($output)) {
$modified_files = true;
echo_out("There are modified files:\n");
echo_output($output);
}
if ($verbose) { if ($verbose) {
echo_out("--------------- Upgrade history ---------------\n"); echo_out("--------------- Upgrade history ---------------\n");
$retval = git("log --date=short-local --pretty=\"%cd (%h): %s\" HEAD --not HEAD~5",$output,$verbose,$verbose,"Error while showing history!"); $retval = git("log --date=short-local --pretty=\"%cd (%h): %s\" HEAD --not HEAD~5 --",$output,$verbose,$verbose,"Error while showing history!");
if ($retval != 0) { if ($retval != 0) {
abort(""); abort("");
return(-1); return(-1);
} }
} else { } else {
echo_out("--------------- Current version ---------------\n"); echo_out("--------------- Current version ---------------\n");
$retval = git("log -1 --date=short-local --pretty=\"%cd (%h): %s\" HEAD",$output,$verbose,true,"Error while showing history!"); $retval = git("log -1 --date=short-local --pretty=\"%cd (%h): %s\" HEAD --",$output,$verbose,true,"Error while showing history!");
if ($retval != 0) { if ($retval != 0) {
return(-1); return(-1);
} }
@@ -302,6 +284,39 @@ function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do
} // $check_git } // $check_git
if ($check_db || $do_db || $export_db) { if ($check_db || $do_db || $export_db) {
if ($connection) {
$connection_file_name = $directory."/data/connection.json";
$connection_file_contents = file_get_contents($connection_file_name);
if (!$connection_file_contents) {
abort("Unable to load $connection_file_name");
return(-1);
}
$connection_info = json_decode($connection_file_contents, true);
$host = $connection_info['host'];
$user = $connection_info['user'];
$passwd = $connection_info['passwd'];
$schema = $connection_info['schema'];
} else {
class DatabaseConnectionInfo {
function __construct($dir) {
require($dir."/../conf/user.inc.php");
}
}
$dbci = new DatabaseConnectionInfo($directory);
$host = $dbci->WFdbhost;
$user = $dbci->WFdbuser;
$passwd = $dbci->WFdbpass;
$schema = $dbci->WFdbname;
}
require_once($directory.'/../vendor/mustal/mustal_mysql_upgrade_tool.php');
echo_out("--------------- Loading from database '$schema@$host'... ---------------\n"); echo_out("--------------- Loading from database '$schema@$host'... ---------------\n");
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers); $db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
@@ -458,6 +473,7 @@ function info() {
echo_out("\t-do: execute all upgrades\n"); echo_out("\t-do: execute all upgrades\n");
echo_out("\t-v: verbose output\n"); echo_out("\t-v: verbose output\n");
echo_out("\t-f: force override of existing files\n"); echo_out("\t-f: force override of existing files\n");
echo_out("\t-o: update from origin instead of remote.json\n");
echo_out("\t-connection use connection.json in data folder instead of user.inc.php\n"); echo_out("\t-connection use connection.json in data folder instead of user.inc.php\n");
echo_out("\t-clean: (not yet implemented) create the needed SQL to remove items from the database not in the JSON\n"); echo_out("\t-clean: (not yet implemented) create the needed SQL to remove items from the database not in the JSON\n");
echo_out("\n"); echo_out("\n");
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
sudo -u www-data php data/upgrade.php "$@"
@@ -18,7 +18,8 @@ class ContentDisposition implements UnstructuredInterface
* *
* @var int * @var int
*/ */
const MAX_PARAMETER_LENGTH = 76; // const MAX_PARAMETER_LENGTH = 76; // This is the RECOMMENDATION
const MAX_PARAMETER_LENGTH = 996; // This is the LIMIT
/** /**
* @var string * @var string
+5 -4
View File
@@ -68,7 +68,7 @@ $mustal_replacers = [
]; ];
// Load all db_def from a DB connection into a db_def array // Load all db_def from a DB connection into a db_def array
function mustal_load_tables_from_db(string $host, string $schema, string $user, string $passwd, $replacers) : array { function mustal_load_tables_from_db(string $host, string $schema, string $user, string $passwd, array $replacers) : array {
// First get the contents of the database table structure // First get the contents of the database table structure
$mysqli = mysqli_connect($host, $user, $passwd, $schema); $mysqli = mysqli_connect($host, $user, $passwd, $schema);
@@ -127,10 +127,9 @@ function mustal_load_tables_from_db(string $host, string $schema, string $user,
foreach ($keys as $key) { foreach ($keys as $key) {
// Check if this key exists already // Check if this key exists already
$key_pos = array_search($key['Key_name'],array_column($composed_keys,'Key_name')); $key_pos = array_search($key['Key_name'],array_column($composed_keys,'Key_name'));
if ($key_pos == false) { if ($key_pos === false) {
// New key // New key
$composed_key = array(); $composed_key = array();
$composed_key['Key_name'] = $key['Key_name']; $composed_key['Key_name'] = $key['Key_name'];
@@ -167,7 +166,9 @@ function mustal_load_tables_from_db(string $host, string $schema, string $user,
return(array()); return(array());
} }
$viewdef = mysqli_fetch_assoc($query_result); $viewdef = mysqli_fetch_assoc($query_result);
$view['Create'] = $viewdef['Create View'];
// Remove the security info from view definition
$view['Create'] = "CREATE ".stristr($viewdef['Create View'],"VIEW");
} }
$result = array(); $result = array();
+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
$version="OSS"; $version="OSS";
$version_revision="1.6"; $version_revision="1.8";
$githash = file_get_contents("../githash.txt"); $githash = file_get_contents("../githash.txt");
if (!empty($githash)) { if (!empty($githash)) {
$version_revision .= " (".substr($githash,0,8).")"; $version_revision .= " (".substr($githash,0,8).")";
+10
View File
@@ -13,4 +13,14 @@ Allow from all
Order Allow,Deny Order Allow,Deny
Allow from all Allow from all
</Files> </Files>
# Allow access to setup.php
<Files setup.php>
Order Allow,Deny
Allow from all
</Files>
# Allow access to inline PDF viewer
<Files viewer.html>
Order Allow,Deny
Allow from all
</Files>
# end # end
+76 -21
View File
@@ -1503,9 +1503,44 @@ public function NavigationHooks(&$menu)
} }
// @refactor DbHelper Komponente // @refactor DbHelper Komponente
function FormatMenge($spalte) function FormatMenge($spalte, $decimals = 0)
{ {
return "replace(trim($spalte)+0,'.',',')"; return ('FORMAT('.$spalte.','.$decimals.',\'de_DE\')');
// return "replace(trim($spalte)+0,'.',',')";
}
static function add_alias(string $text, $alias = false) {
if (empty($alias)) {
return($text);
}
else {
return ($text." as `$alias`");
}
}
// @refactor DbHelper Komponente
function FormatDate(string $spalte, string $alias = null)
{
return $this->add_alias("DATE_FORMAT($spalte,'%d.%m.%Y')", $alias);
}
// @refactor DbHelper Komponente
function FormatDateShort(string $spalte, string $alias = null)
{
return $this->add_alias("DATE_FORMAT($spalte,'%d.%m.%y')", $alias);
}
// @refactor DbHelper Komponente
function FormatDateTimeShort(string $spalte, string $alias = null)
{
return $this->add_alias("DATE_FORMAT($spalte,'%d.%m.%y %H:%i')", $alias);
}
// @refactor DbHelper Komponente
function FormatDateTime(string $spalte, string $alias = null)
{
return $this->add_alias("DATE_FORMAT($spalte,'%d.%m.%Y %H:%i:%s')", $alias);
} }
public function XMLExportVorlage($id,$filter=array(), $cdata = false) public function XMLExportVorlage($id,$filter=array(), $cdata = false)
@@ -3899,6 +3934,9 @@ title: 'Abschicken',
//$zahlungszielskonto = round((100 * $skontobetrag / $soll),2); // den wert lassen sonst sieht es komisch am briefpapier aus Ticket 757670 //$zahlungszielskonto = round((100 * $skontobetrag / $soll),2); // den wert lassen sonst sieht es komisch am briefpapier aus Ticket 757670
} }
} }
$zahlungszieltage = (int) $zahlungszieltage;
$zahlungdatum = $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD(datum, INTERVAL $zahlungszieltage DAY),'%d.%m.%Y') FROM $doctype WHERE id='$doctypeid' LIMIT 1"); $zahlungdatum = $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD(datum, INTERVAL $zahlungszieltage DAY),'%d.%m.%Y') FROM $doctype WHERE id='$doctypeid' LIMIT 1");
$anzeigen = false; $anzeigen = false;
@@ -3945,6 +3983,8 @@ title: 'Abschicken',
//$this->RunHook('ZahlungsweisetextZahlungsdatum',4, $doctype, $doctypeid, $zahlungdatum, $zahlungsweisetext); //$this->RunHook('ZahlungsweisetextZahlungsdatum',4, $doctype, $doctypeid, $zahlungdatum, $zahlungsweisetext);
$zahlungszieltageskonto = (int) $zahlungszieltageskonto;
$zahlungszielskontodatum = $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD(datum, INTERVAL $zahlungszieltageskonto DAY),'%d.%m.%Y') FROM $doctype WHERE id='$doctypeid' LIMIT 1"); $zahlungszielskontodatum = $this->app->DB->Select("SELECT DATE_FORMAT(DATE_ADD(datum, INTERVAL $zahlungszieltageskonto DAY),'%d.%m.%Y') FROM $doctype WHERE id='$doctypeid' LIMIT 1");
$adresse = !empty($doctypeRow['adresse'])?$doctypeRow['adresse']:0; $adresse = !empty($doctypeRow['adresse'])?$doctypeRow['adresse']:0;
@@ -3955,7 +3995,6 @@ title: 'Abschicken',
$skontofaehignetto = $this->Skontofaehig($doctypeid, $doctype,false); $skontofaehignetto = $this->Skontofaehig($doctypeid, $doctype,false);
$skontofaehignetto = number_format((float)$skontofaehignetto,2,',','.'); $skontofaehignetto = number_format((float)$skontofaehignetto,2,',','.');
if($zahlungszieltageskonto<=0) if($zahlungszieltageskonto<=0)
$zahlungszielskontodatum = $zahlungdatum; $zahlungszielskontodatum = $zahlungdatum;
@@ -7014,7 +7053,7 @@ title: 'Abschicken',
$navarray['menu']['admin'][$menu]['sec'][] = array('Preisanfrage','preisanfrage','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Preisanfrage','preisanfrage','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Bestellung','bestellung','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Bestellung','bestellung','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Bestellvorschlag','bestellvorschlag','ausgehend'); $navarray['menu']['admin'][$menu]['sec'][] = array('Bestellvorschlag','bestellvorschlag','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Erweiterter Bestellvorschlag','bestellvorschlagapp','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Erweiterter Bestellvorschlag','bestellvorschlagapp','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Produktion','produktion','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Produktion','produktion','list');
@@ -7094,6 +7133,7 @@ title: 'Abschicken',
} }
$navarray['menu']['admin'][$menu]['sec'][] = array('Import/Export Zentrale','importvorlage','uebersicht'); $navarray['menu']['admin'][$menu]['sec'][] = array('Import/Export Zentrale','importvorlage','uebersicht');
$navarray['menu']['admin'][$menu]['sec'][] = array('W&auml;hrungen','waehrungumrechnung','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Seriennummern','seriennummern','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Seriennummern','seriennummern','list');
$navarray['menu']['admin'][$menu]['sec'][] = array('Chargen','chargen','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Chargen','chargen','list');
@@ -22813,7 +22853,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
} }
$isArticleCacheDifferent = $lagerartikel[$ij]['cache_lagerplatzinhaltmenge'] $isArticleCacheDifferent = $lagerartikel[$ij]['cache_lagerplatzinhaltmenge']
!= ($verkaufbare_menge_korrektur + $pseudolager); != ((int) $verkaufbare_menge_korrektur + (int) $pseudolager);
$storageCache = $isArticleCacheDifferent $storageCache = $isArticleCacheDifferent
? null : $this->getStorageCacheInfosByShopId((int)$shop, (int)$lagerartikel[$ij]['id']); ? null : $this->getStorageCacheInfosByShopId((int)$shop, (int)$lagerartikel[$ij]['id']);
@@ -22856,9 +22896,9 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
} }
} }
$this->LogFile('*** UPDATE '.$lagerartikel[$ij]['nummer'].' '.$lagerartikel[$ij]['name_de'].' Shop: '.$shop.' Lagernd: '.$verkaufbare_menge.' Korrektur: '.round($verkaufbare_menge_korrektur - $verkaufbare_menge,7).' Pseudolager: '.round($pseudolager,8)); $this->LogFile('*** UPDATE '.$lagerartikel[$ij]['nummer'].' '.$lagerartikel[$ij]['name_de'].' Shop: '.$shop.' Lagernd: '.$verkaufbare_menge.' Korrektur: '.round((float) ($verkaufbare_menge_korrektur - $verkaufbare_menge),7).' Pseudolager: '.round((float) $pseudolager,8));
$cacheQuantity = $verkaufbare_menge_korrektur + $pseudolager; $cacheQuantity = (int) $verkaufbare_menge_korrektur + (int) $pseudolager;
$this->app->DB->Update( $this->app->DB->Update(
"UPDATE `artikel` SET `cache_lagerplatzinhaltmenge` = '{$cacheQuantity}' "UPDATE `artikel` SET `cache_lagerplatzinhaltmenge` = '{$cacheQuantity}'
WHERE `id`= '{$lagerartikel[$ij]['id']}' LIMIT 1" WHERE `id`= '{$lagerartikel[$ij]['id']}' LIMIT 1"
@@ -27324,7 +27364,7 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$bcc3 = $this->Firmendaten('bcc3'); $bcc3 = $this->Firmendaten('bcc3');
if($bcc3!="") if($bcc3!="")
{ {
$bccRecipients[] = new EmailRecipient($bcc3[0], $bcc3[1]); $bccRecipients[] = new EmailRecipient($bcc3, $bcc3);
} }
// This will build the mail with phpmailer 6 and send it out // This will build the mail with phpmailer 6 and send it out
@@ -27447,8 +27487,13 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
function BeschriftungSprache($sprache='') function BeschriftungSprache($sprache='')
{ {
$sprache = strtolower(trim($sprache));
if ($sprache === '') {
$this->beschriftung_sprache='deutsch'; $this->beschriftung_sprache='deutsch';
} else {
$this->beschriftung_sprache=strtolower(trim($sprache));
}
} }
function BeschriftungStandardwerte($field,$sprache="deutsch",$getvars=false) function BeschriftungStandardwerte($field,$sprache="deutsch",$getvars=false)
@@ -27640,10 +27685,10 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
function getUebersetzung($field, $sprache, $id = true) function getUebersetzung($field, $sprache, $id = true)
{ {
$sprach = strtolower($sprache); $sprache = strtolower($sprache);
if(empty($this->uebersetzungId)) if(empty($this->uebersetzungId))
{ {
$arr = $this->app->DB->SelectArr('SELECT id, label, sprache, beschriftung $arr = $this->app->DB->SelectArr('SELECT id, label, sprache, beschriftung, original
FROM uebersetzung FROM uebersetzung
WHERE sprache <> "" AND label <> ""'); WHERE sprache <> "" AND label <> ""');
if(!empty($arr)) if(!empty($arr))
@@ -27651,7 +27696,12 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
foreach($arr as $row) foreach($arr as $row)
{ {
$this->uebersetzungId[$row['label']][strtolower($row['sprache'])] = $row['id']; $this->uebersetzungId[$row['label']][strtolower($row['sprache'])] = $row['id'];
if ($row['beschriftung'] != '') {
$this->uebersetzungBeschriftung[$row['label']][strtolower($row['sprache'])] = $row['beschriftung']; $this->uebersetzungBeschriftung[$row['label']][strtolower($row['sprache'])] = $row['beschriftung'];
} else {
$this->uebersetzungBeschriftung[$row['label']][strtolower($row['sprache'])] = $row['original'];
}
} }
} }
} }
@@ -27671,6 +27721,7 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
function Beschriftung($field,$sprache='') function Beschriftung($field,$sprache='')
{ {
if($sprache!='') { if($sprache!='') {
$this->BeschriftungSprache($sprache); $this->BeschriftungSprache($sprache);
} }
@@ -27711,9 +27762,7 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
{ {
return $wert; return $wert;
} }
//1. deutsches wort als standard return $field; // Not found!
$wert = $this->BeschriftungDeutschesWort($field);
return $wert;
} }
@@ -28807,12 +28856,6 @@ function Firmendaten($field,$projekt="")
{ {
return $obj->GetWaehrungUmrechnungskurs($von,$nach,$onlytable); return $obj->GetWaehrungUmrechnungskurs($von,$nach,$onlytable);
} }
if ($von === 'EUR' && $nach === 'USD') {
return 1.20;
}
if ($von==='EUR' && $nach==='CHF') {
return 1.06;
}
return 0; return 0;
} }
@@ -36273,7 +36316,7 @@ function Firmendaten($field,$projekt="")
$tatsaechlicheslieferdatum = $orderRow['tatsaechlicheslieferdatum']; $tatsaechlicheslieferdatum = $orderRow['tatsaechlicheslieferdatum'];
$projekt = $orderRow['projekt']; $projekt = $orderRow['projekt'];
$differenztage = $this->Projektdaten($projekt,'differenz_auslieferung_tage'); $differenztage = $this->Projektdaten($projekt,'differenz_auslieferung_tage');
if($differenztage<0) { if($differenztage<0 || empty($differenztage)) {
$differenztage=2; $differenztage=2;
} }
$lieferdatum = $orderRow['lieferdatum']; $lieferdatum = $orderRow['lieferdatum'];
@@ -36817,6 +36860,18 @@ function Firmendaten($field,$projekt="")
} }
$this->GetArtikelSteuer($artikel, $ust_befreit, $aufwendung, $tmpsteuersatz, $tmpsteuertext, $erloes, $posRow['umsatzsteuer'], null, $projekt); $this->GetArtikelSteuer($artikel, $ust_befreit, $aufwendung, $tmpsteuersatz, $tmpsteuertext, $erloes, $posRow['umsatzsteuer'], null, $projekt);
$this->getErloesFirmendaten($artikel, $ust_befreit, $aufwendung, $tmpsteuersatzFD, $tmpsteuertextFD, $tmperloesFD, $posRow['umsatzsteuer'], null, $projekt);
if (!$tmpsteuersatz) {
$tmpsteuersatz = $tmpsteuersatzFD;
}
if (!$tmpsteuertext) {
$tmpsteuertext = $tmpsteuertextFD;
}
if (!$erloes) {
$erloes = $tmperloesFD;
}
} }
function PortoBerechnen($adresse,$gesamtsumme,$portoartikel, &$realpreis = false) function PortoBerechnen($adresse,$gesamtsumme,$portoartikel, &$realpreis = false)
+1 -1
View File
@@ -41,7 +41,7 @@ class AngebotPDF extends BriefpapierCustom {
{ {
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden // pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id); $check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false; if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true; else $this->ust_spalteausblende=true;
} }
+1 -1
View File
@@ -43,7 +43,7 @@ class AuftragPDF extends BriefpapierCustom {
{ {
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden // pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id); $check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false; if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true; else $this->ust_spalteausblende=true;
} }
+1 -1
View File
@@ -43,7 +43,7 @@ class GutschriftPDF extends BriefpapierCustom {
{ {
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden // pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id); $check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false; if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true; else $this->ust_spalteausblende=true;
} }
+1 -1
View File
@@ -41,7 +41,7 @@ class ProformarechnungPDF extends BriefpapierCustom {
{ {
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden // pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id); $check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false; if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true; else $this->ust_spalteausblende=true;
} }
+1 -1
View File
@@ -50,7 +50,7 @@ class RechnungPDF extends BriefpapierCustom {
{ {
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden // pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id); $check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
if(count($check)>1)$this->ust_spalteausblende=false; if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
else $this->ust_spalteausblende=true; else $this->ust_spalteausblende=true;
} }
$lvl = null; $lvl = null;
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1289,7 +1289,7 @@ class Ajax {
} }
break; break;
case 'warteschlangename': case 'warteschlangename':
$arr = $this->app->DB->SelectArr("SELECT CONCAT(label, ' ', warteschlange) as result from warteschlangen"); $arr = $this->app->DB->SelectArr("SELECT CONCAT(label, ' ', warteschlange) as result from warteschlangen WHERE label LIKE '%$term%' OR warteschlange LIKE '%$term%' ORDER BY label");
$carr = !empty($arr)?count($arr):0; $carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++) { for($i = 0; $i < $carr; $i++) {
$newarr[] = "{$arr[$i]['result']}"; $newarr[] = "{$arr[$i]['result']}";
+19 -6
View File
@@ -288,9 +288,15 @@ class Artikel extends GenArtikel {
case 'lieferantartikelpreise': case 'lieferantartikelpreise':
$id = (int)$this->app->Secure->GetGET('id'); $id = (int)$this->app->Secure->GetGET('id');
$allowed['artikel'] = array('profisuche'); $allowed['artikel'] = array('profisuche');
// alle artikel die ein Kunde kaufen kann mit preisen netto brutto
$cmd = $this->app->Secure->GetGET('smodule'); $cmd = $this->app->Secure->GetGET('cmd');
$adresse = $this->app->DB->Select("SELECT adresse FROM {$cmd} WHERE id='$id' LIMIT 1"); $module = $this->app->Secure->GetGET('module');
if ($module == 'artikel') {
$table = $cmd;
} else {
$table = $this->app->Secure->GetGET('smodule');
}
$adresse = $this->app->DB->Select(sprintf('SELECT adresse FROM `%s` WHERE id=%d LIMIT 1',$table,$id));
// headings // headings
$heading = array('', 'Nummer', 'Artikel', 'Ab', 'Preis', 'Lager', 'Res.', 'Menge', 'Projekt', 'Men&uuml;'); $heading = array('', 'Nummer', 'Artikel', 'Ab', 'Preis', 'Lager', 'Res.', 'Menge', 'Projekt', 'Men&uuml;');
@@ -340,8 +346,15 @@ class Artikel extends GenArtikel {
} }
// alle artikel die ein Kunde kaufen kann mit preisen netto brutto // alle artikel die ein Kunde kaufen kann mit preisen netto brutto
$cmd = $this->app->Secure->GetGET('smodule'); $cmd = $this->app->Secure->GetGET('cmd');
$adresse = $this->app->DB->Select(sprintf('SELECT adresse FROM `%s` WHERE id=%d LIMIT 1',$cmd,$id)); $module = $this->app->Secure->GetGET('module');
if ($module == 'artikel') {
$table = $cmd;
} else {
$table = $this->app->Secure->GetGET('frommodule');
$table = substr($table , 0, strpos($table, "."));
}
$adresse = $this->app->DB->Select(sprintf('SELECT adresse FROM `%s` WHERE id=%d LIMIT 1',$table,$id));
$sEcho = (int)$this->app->Secure->GetGET('sEcho'); $sEcho = (int)$this->app->Secure->GetGET('sEcho');
if ($sEcho === 1) { if ($sEcho === 1) {
@@ -3145,7 +3158,7 @@ class Artikel extends GenArtikel {
$vpe = ''; $vpe = '';
if($projekt <=0 ){ if($projekt <=0 ){
$projekt = $this->app->DB->Select("SELECT name_de FROM artikel WHERE id='$artikel_id' LIMIT 1"); $projekt = $this->app->DB->Select("SELECT projekt FROM artikel WHERE id='$artikel_id' LIMIT 1");
} }
if($projekt <=0){ if($projekt <=0){
+295 -7
View File
@@ -40,6 +40,7 @@ class Auftrag extends GenAuftrag
*/ */
public function TableSearch($app, $name, $erlaubtevars) public function TableSearch($app, $name, $erlaubtevars)
{ {
switch($name) switch($name)
{ {
case 'auftraege': case 'auftraege':
@@ -661,7 +662,7 @@ class Auftrag extends GenAuftrag
$menu .= "</a>"; $menu .= "</a>";
$moreinfo = true; // Minidetail active $moreinfo = true; // Minidetail active
$menucol = 9; // For minidetail $menucol = 11; // For minidetail
break; break;
case 'auftraegeoffeneautowartend': case 'auftraegeoffeneautowartend':
@@ -707,10 +708,162 @@ class Auftrag extends GenAuftrag
$menu .= "<a href=\"index.php?module=auftrag&action=edit&id=%value%\">"; $menu .= "<a href=\"index.php?module=auftrag&action=edit&id=%value%\">";
$menu .= "<img src=\"themes/{$this->app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\">"; $menu .= "<img src=\"themes/{$this->app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\">";
$menu .= "</a>"; $menu .= "</a>";
$menucol = 9; // For moredata $menucol = 11; // For moredata
break; break;
case 'positionen_teillieferung':
$id = $app->Secure->GetGET('id');
$allowed['positionen_teillieferung'] = array('list');
$heading = array('Position','Artikel','Nr.','Menge','Lager','Teilmenge','');
$width = array( '1%', '60%', '29%','5%','5%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('ap.sort','a.name_de','a.nummer','ap.menge','lager','teilmenge');
$searchsql = array('');
$defaultorder = 2;
$defaultorderdesc = 0;
$input_for_menge = "CONCAT(
'<input type = \"number\" min=\"0\" max=\"',
ap.menge,
'\" name=\"teilmenge_',
ap.id,
'\"',
' value=\"',
'\">',
'</input>'
)";
// .'(SELECT TRIM(IFNULL(SUM(l.menge),0))+0 FROM lager_platz_inhalt l WHERE l.artikel=a.id) as lager'
$sql = "SELECT SQL_CALC_FOUND_ROWS
ap.sort,
ap.sort,
a.name_de,
a.nummer,"
.$this->app->erp->FormatMenge('ap.menge').","
."(SELECT TRIM(IFNULL(SUM(l.menge),0))+0 FROM lager_platz_inhalt l WHERE l.artikel=a.id) as lager,"
.$input_for_menge
." FROM auftrag_position ap
INNER JOIN
artikel a
ON ap.artikel = a.id";
$where = " ap.auftrag = $id ";
$count = "SELECT count(DISTINCT ap.id) FROM auftrag_position ap WHERE $where";
// $groupby = "";
break;
case "offenepositionen":
$allowed['offenepositionen'] = array('list');
$heading = array('Erwartetes Lieferdatum','Urspr&uumlngliches Lieferdatum','Kunde','Auftrag','Position','ArtikelNr.','Artikel','Menge','Auftragsvolumen','Lagermenge','Monitor','Men&uuml');
// $width = array('10%','10%','10%','10%','30%','30%');
// Spalten für die Sortierfunktion in der Liste, muss identisch mit SQL-Ergebnis sein, erste Spalte weglassen,Spalten- Alias funktioniert nicht
$findcols = array('erwartetes_lieferdatum','urspruengliches_lieferdatum','kunde','belegnr','position','artikel','bezeichnung','menge','umsatz');
// Spalten für die Schnellsuche
$searchsql = array("DATE_FORMAT(erwartetes_lieferdatum,\"%Y-%m-%d\")",'kunde','belegnr','artikel','bezeichnung');
// Sortierspalte laut SQL
$defaultorder = 2;
$defaultorderdesc = 0;
$numbercols = [8,9,10];
$sumcol = [8,9];
$alignright = [8,9,10];
$menucol = 12;
$menu = "<a href=\"index.php?module=auftrag&action=edit&id=%value%\" target=\"blank\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>";
// 1. Spalte ist unsichtbar, 2. Für Minidetail, 3. ist Standardsortierung beim öffnen des Moduls
$sql = "SELECT SQL_CALC_FOUND_ROWS
auftrag_id,
DATE_FORMAT(erwartetes_lieferdatum,\"%d.%m.%Y\") erwartetes_lieferdatum_form,
CASE
WHEN urspruengliches_lieferdatum <> erwartetes_lieferdatum THEN CONCAT(\"<p style=\'color:red;\'>\",DATE_FORMAT(urspruengliches_lieferdatum,\"%d.%m.%Y\"),\"</p>\")
ELSE DATE_FORMAT(urspruengliches_lieferdatum,\"%d.%m.%Y\")
END urspruengliches_lieferdatum_form,
kunde,
belegnr,
position,
CONCAT(\"<a href=index.php?module=artikel&action=edit&id=\",artikel_id,\" target=_blank>\",artikel,\"</a>\") artikel,
bezeichnung,
menge,
umsatz,
CASE WHEN menge <= lager THEN CONCAT(\"<a href=index.php?module=artikel&action=lager&id=\",artikel_id,\" target=_blank>\",ROUND(lager,0),\"</a>\")
ELSE CONCAT(\"<a href=index.php?module=artikel&action=lager&id=\",artikel_id,\" style=\'color:red;\' target=_blank>\",ROUND(lager,0),\"</a>\")
END lagermenge,".
$this->app->YUI->IconsSQL().
"autoversand_icon,
auftrag_id
FROM
(
SELECT
auf.id,
auf.status,
auf.lager_ok,
auf.porto_ok,
auf.ust_ok,
auf.vorkasse_ok,
auf.nachnahme_ok,
auf.check_ok,
auf.liefertermin_ok,
auf.kreditlimit_ok,
auf.liefersperre_ok,
auf.adresse,
CASE
WHEN auftrag_position.lieferdatum <> '0000-00-00' AND auftrag_position.lieferdatum > CURRENT_DATE THEN auftrag_position.lieferdatum
WHEN auftrag_position.lieferdatum <> '0000-00-00' THEN CURRENT_DATE
WHEN auf.tatsaechlicheslieferdatum <> '0000-00-00' AND auf.tatsaechlicheslieferdatum > CURRENT_DATE THEN auf.tatsaechlicheslieferdatum
WHEN auf.tatsaechlicheslieferdatum <> '0000-00-00' THEN CURRENT_DATE
WHEN auf.lieferdatum <> '0000-00-00' AND auf.lieferdatum > CURRENT_DATE THEN auf.lieferdatum
ELSE CURRENT_DATE
END erwartetes_lieferdatum,
CASE
WHEN auftrag_position.lieferdatum <> '0000-00-00' THEN auftrag_position.lieferdatum
WHEN auf.tatsaechlicheslieferdatum <> '0000-00-00' THEN auf.tatsaechlicheslieferdatum
WHEN auf.lieferdatum <> '0000-00-00' THEN auf.lieferdatum
ELSE auf.datum
END urspruengliches_lieferdatum,
auf.name kunde,
auf.belegnr belegnr,
auftrag_position.sort position,
artikel.nummer artikel,
artikel.id artikel_id,
auftrag_position.bezeichnung bezeichnung,
round(auftrag_position.menge,0) menge,
round(auftrag_position.menge*auftrag_position.preis,2) umsatz,
(SELECT SUM(menge) FROM lager_platz_inhalt INNER JOIN lager_platz ON lager_platz_inhalt.lager_platz = lager_platz.id WHERE lager_platz_inhalt.artikel = artikel.id AND lager_platz.sperrlager <> 1) as lager,
auf.autoversand autoversand,
auf.id auftrag_id
FROM auftrag auf
INNER JOIN auftrag_position ON auf.id = auftrag_position.auftrag
INNER JOIN artikel ON auftrag_position.artikel = artikel.id
WHERE auf.status <> 'abgeschlossen' AND auf.belegnr <> ''
ORDER BY urspruengliches_lieferdatum ASC, auf.belegnr ASC, auftrag_position.sort ASC
) a";
$where = "";
$groupby = "";
// Für Anzeige der Gesamteinträge
$count = "SELECT count(DISTINCT auftrag_position.id) FROM auftrag a INNER JOIN auftrag_position ON a.id = auftrag_position.auftrag WHERE a.status <>'abgeschlossen' AND a.belegnr <> ''";
// Spalte mit Farbe der Zeile (immer vorletzte-1)
// $trcol = 12;
// $moreinfo = true;
break;
} }
$erg = []; $erg = [];
@@ -765,7 +918,7 @@ class Auftrag extends GenAuftrag
$this->app->ActionHandler("rechnung","AuftragRechnung"); $this->app->ActionHandler("rechnung","AuftragRechnung");
$this->app->ActionHandler("lieferschein","AuftragLieferschein"); $this->app->ActionHandler("lieferschein","AuftragLieferschein");
$this->app->ActionHandler("lieferscheinrechnung","AuftragLieferscheinRechnung"); $this->app->ActionHandler("lieferscheinrechnung","AuftragLieferscheinRechnung");
$this->app->ActionHandler("teillieferung","AuftragTeillieferung");
$this->app->ActionHandler("nachlieferung","AuftragNachlieferung"); $this->app->ActionHandler("nachlieferung","AuftragNachlieferung");
// $this->app->ActionHandler("versand","AuftragVersand"); // $this->app->ActionHandler("versand","AuftragVersand");
$this->app->ActionHandler("freigabe","AuftragFreigabe"); $this->app->ActionHandler("freigabe","AuftragFreigabe");
@@ -798,6 +951,8 @@ class Auftrag extends GenAuftrag
$this->app->ActionHandler("steuer", "AuftragSteuer"); $this->app->ActionHandler("steuer", "AuftragSteuer");
$this->app->ActionHandler("berechnen", "Auftraegeberechnen"); $this->app->ActionHandler("berechnen", "Auftraegeberechnen");
$this->app->ActionHandler("offene", "AuftragOffenePositionen");
$this->app->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
$id = $this->app->Secure->GetGET('id'); $id = $this->app->Secure->GetGET('id');
@@ -1271,7 +1426,11 @@ class Auftrag extends GenAuftrag
$kommissionierart = $this->app->DB->Select("SELECT kommissionierverfahren FROM projekt WHERE id='$projekt' LIMIT 1"); $kommissionierart = $this->app->DB->Select("SELECT kommissionierverfahren FROM projekt WHERE id='$projekt' LIMIT 1");
//$art = $this->app->DB->Select("SELECT art FROM auftrag WHERE id='$id' LIMIT 1"); //$art = $this->app->DB->Select("SELECT art FROM auftrag WHERE id='$id' LIMIT 1");
$alleartikelreservieren = ''; $alleartikelreservieren = '';
$teillieferungen = '';
if ($status==='angelegt' || $status==='freigegeben') {
$teillieferungen = '<option value="teillieferung">Teilauftrag erstellen</option>';
}
if($status==='freigegeben') { if($status==='freigegeben') {
$alleartikelreservieren = "<option value=\"reservieren\">alle Artikel reservieren</option>"; $alleartikelreservieren = "<option value=\"reservieren\">alle Artikel reservieren</option>";
@@ -1369,9 +1528,14 @@ class Auftrag extends GenAuftrag
{ {
switch(cmd) switch(cmd)
{ {
case 'storno': if(!confirm('Wirklich stornieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=delete&id=%value%'; break; case 'storno':
case 'unstorno': if(!confirm('Wirklich stornierten Auftrag wieder freigeben?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=undelete&id=%value%'; break; if(!confirm('Wirklich stornieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=delete&id=%value%'; break;
case 'teillieferung': window.location.href='index.php?module=auftrag&action=teillieferung&id=%value%'; break; case 'unstorno':
if(!confirm('Wirklich stornierten Auftrag wieder freigeben?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=undelete&id=%value%';
break;
case 'teillieferung':
window.location.href='index.php?module=auftrag&action=teillieferung&id=%value%';
break;
case 'anfrage': if(!confirm('Wirklich rückführen?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=anfrage&id=%value%'; break; case 'anfrage': if(!confirm('Wirklich rückführen?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=anfrage&id=%value%'; break;
case 'kreditlimit': if(!confirm('Wirklich Kreditlimit für diesen Auftrag freigeben?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=kreditlimit&id=%value%'; break; case 'kreditlimit': if(!confirm('Wirklich Kreditlimit für diesen Auftrag freigeben?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=kreditlimit&id=%value%'; break;
case 'copy': if(!confirm('Wirklich kopieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=copy&id=%value%'; break; case 'copy': if(!confirm('Wirklich kopieren?')) return document.getElementById('aktion$prefix').selectedIndex = 0; else window.location.href='index.php?module=auftrag&action=copy&id=%value%'; break;
@@ -6128,6 +6292,7 @@ Die Gesamtsumme stimmt nicht mehr mit urspr&uuml;nglich festgelegten Betrag '.
$this->app->erp->MenuEintrag('index.php?module=auftrag&action=list','&Uuml;bersicht'); $this->app->erp->MenuEintrag('index.php?module=auftrag&action=list','&Uuml;bersicht');
$this->app->erp->MenuEintrag('index.php?module=auftrag&action=create','Neuen Auftrag anlegen'); $this->app->erp->MenuEintrag('index.php?module=auftrag&action=create','Neuen Auftrag anlegen');
$this->app->erp->MenuEintrag('index.php?module=auftrag&action=offene','Offene Positionen');
$this->app->erp->MenuEintrag('index.php?module=auftrag&action=versandzentrum','Versandzentrum'); $this->app->erp->MenuEintrag('index.php?module=auftrag&action=versandzentrum','Versandzentrum');
if(strlen($backurl)>5){ if(strlen($backurl)>5){
@@ -7004,4 +7169,127 @@ Die Gesamtsumme stimmt nicht mehr mit urspr&uuml;nglich festgelegten Betrag '.
header('Location: index.php?module=auftrag&action=versandzentrum'); header('Location: index.php?module=auftrag&action=versandzentrum');
} }
/*
* Split auftrag into separate documents with submit -> do it and return jump to the new split part
*/
function AuftragTeillieferung() {
$id = $this->app->Secure->GetGET('id');
$this->AuftragMenu();
$submit = $this->app->Secure->GetPOST('submit');
$sql = "SELECT * from auftrag WHERE id = $id";
$auftrag_alt = $this->app->DB->SelectArr($sql)[0];
$msg = "";
if (in_array($auftrag_alt['status'],array('angelegt','freigegeben'))) {
if ($submit != '') {
$msg = "";
switch ($submit) {
case 'speichern':
// Get parameters
$teilmenge_input = $this->app->Secure->GetPOSTArray();
$teilmengen = array();
foreach ($teilmenge_input as $key => $value) {
if ((strpos($key,'teilmenge_') === 0) && ($value !== '')) {
$posid = substr($key,'10');
$teilmenge = array('posid' => $posid, 'menge' => $value);
$teilmengen[] = $teilmenge;
}
}
if (!empty($teilmengen)) {
// Create new auftrag
$sql = "SELECT * from auftrag WHERE id = $id";
$auftrag_alt = $this->app->DB->SelectArr($sql)[0];
// Part auftrag of part auftrag -> select parent
$hauptauftrag_id = $auftrag_alt['teillieferungvon'];
if ($hauptauftrag_id != 0) {
$sql = "SELECT belegnr FROM auftrag WHERE id = $hauptauftrag_id";
$hauptauftrag_belegnr = $this->app->DB->SelectArr($sql)[0]['belegnr'];
} else {
$hauptauftrag_id = $auftrag_alt['id'];
$hauptauftrag_belegnr = $auftrag_alt['belegnr'];
}
$sql = "SELECT MAX(teillieferungnummer) as tpn FROM auftrag WHERE teillieferungvon = $hauptauftrag_id";
$teillieferungnummer = $this->app->DB->SelectArr($sql)[0]['tpn'];
if (empty($teillieferungnummer) || $teillieferungnummer == 0) {
$teillieferungnummer = '1';
} else {
$teillieferungnummer++;
}
$belegnr_neu = $hauptauftrag_belegnr."-".$teillieferungnummer;
$auftrag_neu = $auftrag_alt;
$auftrag_neu['id'] = null;
$auftrag_neu['belegnr'] = $belegnr_neu;
$auftrag_neu['teillieferungvon'] = $hauptauftrag_id;
$auftrag_neu['teillieferungnummer'] = $teillieferungnummer;
$id_neu = $this->app->DB->MysqlCopyRow('auftrag','id',$id);
$sql = "UPDATE auftrag SET belegnr = '$belegnr_neu', teillieferungvon = $hauptauftrag_id, teillieferungnummer = $teillieferungnummer WHERE id = $id_neu";
$this->app->DB->Update($sql);
// Adjust quantities
foreach ($teilmengen as $teilmenge) {
$sql = "SELECT menge FROM auftrag_position WHERE id = ".$teilmenge['posid'];
$menge_alt = $this->app->DB->SelectArr($sql)[0]['menge'];
$menge_neu = $teilmenge['menge'];
if ($menge_neu > $menge_alt) {
$menge_neu = $menge_alt;
}
$menge_reduziert = $menge_alt-$menge_neu;
$posid_alt = $teilmenge['posid'];
$posid_neu = $this->app->DB->MysqlCopyRow('auftrag_position','id',$posid_alt);
$sql = "UPDATE auftrag_position SET menge = $menge_reduziert WHERE id = $posid_alt";
$this->app->DB->Update($sql);
$sql = "UPDATE auftrag_position SET auftrag = $id_neu, menge = $menge_neu WHERE id = $posid_neu";
$this->app->DB->Update($sql);
}
header('Location: index.php?module=auftrag&action=edit&id='.$id_neu);
}
break;
case 'abbrechen':
header('Location: index.php?module=auftrag&action=edit&id='.$id);
return;
break;
}
} // Submit
else {
$msg = "Teilauftrag: Auswahl der Artikel f&uuml;r den Teilauftrag.";
}
} // Status ok
else {
$msg = 'Teilauftrag in diesem Status nicht möglich.';
}
$this->app->Tpl->Add('INFOTEXT',$msg);
$this->app->YUI->TableSearch('TABLE','positionen_teillieferung', 'show','','',basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE','auftrag_teillieferung.tpl');
} // AuftragTeillieferung
function AuftragOffenePositionen() {
$this->AuftraguebersichtMenu();
$this->app->YUI->TableSearch('TAB1','offenepositionen',"show","","",basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE',"tabview.tpl");
}
} }
+544
View File
@@ -0,0 +1,544 @@
<?php
/*
* Copyright (c) 2022 OpenXE project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Bestellvorschlag {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "bestellvorschlag_list");
// $this->app->ActionHandler("create", "bestellvorschlag_edit"); // This automatically adds a "New" button
// $this->app->ActionHandler("edit", "bestellvorschlag_edit");
// $this->app->ActionHandler("delete", "bestellvorschlag_delete");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
public function Install() {
/* Fill out manually later */
}
public function TableSearch(&$app, $name, $erlaubtevars) {
switch ($name) {
case "bestellvorschlag_list":
$allowed['bestellvorschlag_list'] = array('list');
$monate_absatz = $this->app->User->GetParameter('bestellvorschlag_monate_absatz');
if (empty($monate_absatz)) {
$monate_absatz = 0;
}
$monate_voraus = $this->app->User->GetParameter('bestellvorschlag_monate_voraus');
if (empty($monate_voraus)) {
$monate_voraus = 0;
}
$heading = array('', '', 'Nr.', 'Artikel','Lieferant','Mindestlager','Lager','Bestellt','Auftrag','Absatz','Voraus','Vorschlag','Eingabe','');
$width = array('1%','1%','1%', '20%', '10%', '1%', '1%', '1%', '1%', '1%', '1%', '1%', '1%', '1%');
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('a.id','a.id','a.nummer','a.name_de','l.name','mindestlager','lager','bestellt','auftrag','absatz','voraus','vorschlag');
$searchsql = array('a.name_de');
$defaultorder = 1;
$defaultorderdesc = 0;
$numbercols = array(6,7,8,9,10,11,12);
// $sumcol = array(6);
$alignright = array(6,7,8,9,10,11,12);
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',a.id,'\" />') AS `auswahl`";
// $menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=bestellvorschlag&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=bestellvorschlag&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$input_for_menge = "CONCAT(
'<input type = \"number\" min=\"0\"',
' name=\"menge_',
a.id,
'\" value=\"',
ROUND((SELECT mengen.vorschlag)),
'\" style=\"text-align:right; width:100%\">',
'</input>'
)";
$user = $app->User->GetID();
$sql_artikel_mengen = "
SELECT
a.id,
(
SELECT
COALESCE(SUM(menge),0)
FROM
lager_platz_inhalt lpi
INNER JOIN lager_platz lp ON
lp.id = lpi.lager_platz
WHERE
lpi.artikel = a.id AND lp.sperrlager = 0
) AS lager,
(
SELECT
COALESCE(SUM(menge - geliefert),0)
FROM
bestellung_position bp
INNER JOIN bestellung b ON
bp.bestellung = b.id
WHERE
bp.artikel = a.id AND b.status IN(
'versendet',
'freigegeben',
'angelegt'
)
) AS bestellt,
(
SELECT
COALESCE(SUM(menge - geliefert),0)
FROM
auftrag_position aufp
INNER JOIN auftrag auf ON
aufp.auftrag = auf.id
WHERE
aufp.artikel = a.id AND auf.status IN(
'versendet',
'freigegeben',
'angelegt'
)
) AS auftrag,
(
SELECT
COALESCE(SUM(menge),0)
FROM
rechnung_position rp
INNER JOIN rechnung r ON
rp.rechnung = r.id
WHERE
rp.artikel = a.id AND r.status IN(
'versendet',
'freigegeben'
) AND r.datum > LAST_DAY(CURDATE() - INTERVAL ('$monate_absatz'+1) MONTH) AND r.datum <= LAST_DAY(CURDATE() - INTERVAL 1 MONTH)
) AS absatz,
ROUND (
(
select absatz
) / '$monate_absatz' * '$monate_voraus') AS voraus,
(
SELECT
COALESCE(menge,0)
FROM
bestellvorschlag bv
WHERE
bv.artikel = a.id AND bv.user = '$user'
) AS vorschlag_save,
a.mindestlager -(
SELECT
lager
) - COALESCE((
SELECT
bestellt
),
0)
+ COALESCE((
SELECT
auftrag
),
0)
+ COALESCE((
SELECT
voraus
),
0)
AS vorschlag_ber_raw,
IF(
(
SELECT
vorschlag_ber_raw
) > 0,
(
SELECT
vorschlag_ber_raw
),
0
) AS vorschlag_ber,
COALESCE(
(
SELECT
vorschlag_save
),
(
SELECT
vorschlag_ber
)
) AS vorschlag,
FORMAT(a.mindestlager, 0, 'de_DE') AS mindestlager_form,
FORMAT((
SELECT
lager
),
0,
'de_DE') AS lager_form,
FORMAT(
COALESCE((
SELECT
bestellt
),
0),
0,
'de_DE'
) AS bestellt_form,
FORMAT(
COALESCE((
SELECT
auftrag
),
0),
0,
'de_DE'
) AS auftrag_form,
FORMAT(
COALESCE((
SELECT
absatz
),
0),
0,
'de_DE'
) AS absatz_form,
FORMAT(
COALESCE((
SELECT
voraus
),
0),
0,
'de_DE'
) AS voraus_form,
FORMAT(
(
SELECT
vorschlag_ber
),
'0',
'de_DE'
) AS vorschlag_ber_form
,
FORMAT(
(
SELECT
vorschlag
),
'0',
'de_DE'
) AS vorschlag_form
FROM
artikel a
";
//echo($sql_artikel_mengen);
$sql = "SELECT SQL_CALC_FOUND_ROWS
a.id,
$dropnbox,
a.nummer,
a.name_de,
l.name,
mengen.mindestlager_form,
mengen.lager_form,
mengen.bestellt_form,
mengen.auftrag_form,
mengen.absatz_form,
mengen.voraus_form,
mengen.vorschlag_ber_form,"
.$input_for_menge
."FROM
artikel a
INNER JOIN
adresse l ON l.id = a.adresse
INNER JOIN
(SELECT * FROM ($sql_artikel_mengen) mengen_inner WHERE mengen_inner.vorschlag > 0) as mengen ON mengen.id = a.id";
$where = "a.adresse != '' AND a.geloescht != 1 AND a.inaktiv != 1";
$count = "SELECT count(DISTINCT a.id) FROM artikel a WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function bestellvorschlag_list() {
$submit = $this->app->Secure->GetPOST('submit');
$user = $this->app->User->GetID();
$monate_absatz = $this->app->Secure->GetPOST('monate_absatz');
if (empty($monate_absatz)) {
$monate_absatz = 0;
}
$monate_voraus = $this->app->Secure->GetPOST('monate_voraus');
if (empty($monate_voraus)) {
$monate_voraus = 0;
}
// For transfer to tablesearch
$this->app->User->SetParameter('bestellvorschlag_monate_absatz', $monate_absatz);
$this->app->User->SetParameter('bestellvorschlag_monate_voraus', $monate_voraus);
switch ($submit) {
case 'loeschen':
$sql = "DELETE FROM bestellvorschlag where user = $user";
$this->app->DB->Delete($sql);
break;
case 'speichern':
$menge_input = $this->app->Secure->GetPOSTArray();
$mengen = array();
foreach ($menge_input as $key => $menge) {
if ((strpos($key,'menge_') === 0) && ($menge !== '')) {
$artikel = substr($key,'6');
if ($menge > 0) {
$sql = "INSERT INTO bestellvorschlag (artikel, user, menge) VALUES($artikel,$user,$menge) ON DUPLICATE KEY UPDATE menge = $menge";
$this->app->DB->Insert($sql);
}
}
}
break;
case 'bestellungen_erzeugen':
$auswahl = $this->app->Secure->GetPOST('auswahl');
$selectedIds = [];
if(empty($auswahl)) {
$msg = '<div class="error">Bitte Artikel ausw&auml;hlen.</div>';
break;
}
if(!empty($auswahl)) {
foreach ($auswahl as $selectedId) {
$selectedId = (int) $selectedId;
if ($selectedId > 0) {
$selectedIds[] = $selectedId;
}
}
}
$menge_input = $this->app->Secure->GetPOSTArray();
$mengen = array();
foreach ($selectedIds as $artikel_id) {
foreach ($menge_input as $key => $menge) {
if ((strpos($key,'menge_') === 0) && ($menge !== '')) {
$artikel = substr($key,'6');
if ($menge > 0 && $artikel == $artikel_id) {
$mengen[] = array('id' => $artikel,'menge' => $menge);
}
}
}
}
$mengen_pro_adresse = array();
foreach ($mengen as $menge) {
$sql = "SELECT adresse FROM artikel WHERE id = ".$menge['id'];
$adresse = $this->app->DB->Select($sql);
if (!empty($adresse)) {
$index = array_search($adresse, array_column($mengen_pro_adresse,'adresse'));
if ($index !== false) {
$mengen_pro_adresse[$index]['positionen'][] = $menge;
} else {
$mengen_pro_adresse[] = array('adresse' => $adresse,'positionen' => array($menge));
}
}
}
$angelegt = 0;
foreach ($mengen_pro_adresse as $bestelladresse) {
$bestellid = $this->app->erp->CreateBestellung($bestelladresse);
if (!empty($bestellid)) {
$angelegt++;
$this->app->erp->LoadBestellungStandardwerte($bestellid,$bestelladresse['adresse']);
$this->app->erp->BestellungProtokoll($bestellid,"Bestellung angelegt");
foreach ($bestelladresse['positionen'] as $position) {
$preisid = $this->app->erp->Einkaufspreis($position['id'], $position['menge'], $bestelladresse['adresse']);
if ($preisid == null) {
$artikelohnepreis = $position['id'];
} else {
$artikelohnepreis = null;
}
$this->app->erp->AddBestellungPosition(
$bestellid,
$preisid,
$position['menge'],
$datum,
'',
$artikelohnepreis
);
}
$this->app->erp->BestellungNeuberechnen($bestellid);
}
}
$msg .= "<div class=\"success\">Es wurden $angelegt Bestellungen angelegt.</div>";
break;
}
$this->app->erp->MenuEintrag("index.php?module=bestellvorschlag&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=bestellvorschlag&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->Tpl->Set('MONATE_ABSATZ',$monate_absatz);
$this->app->Tpl->Set('MONATE_VORAUS',$monate_voraus);
$this->app->Tpl->Set('MESSAGE',$msg);
$this->app->YUI->TableSearch('TAB1', 'bestellvorschlag_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "bestellvorschlag_list.tpl");
}
public function bestellvorschlag_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `bestellvorschlag` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->bestellvorschlag_list();
}
/*
* Edit bestellvorschlag item
* If id is empty, create a new one
*/
function bestellvorschlag_edit() {
$id = $this->app->Secure->GetGET('id');
// Check if other users are editing this id
if($this->app->erp->DisableModul('artikel',$id))
{
return;
}
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=bestellvorschlag&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=bestellvorschlag&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
$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 bestellvorschlag (".$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=bestellvorschlag&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
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',b.id,'\" />') AS `auswahl`";
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS b.id, $dropnbox, b.artikel, b.adresse, b.lager, b.id FROM bestellvorschlag b"." 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->SetInput($input);
$this->app->Tpl->Parse('PAGE', "bestellvorschlag_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['artikel'] = $this->app->Secure->GetPOST('artikel');
$input['adresse'] = $this->app->Secure->GetPOST('adresse');
$input['lager'] = $this->app->Secure->GetPOST('lager');
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('ARTIKEL', $input['artikel']);
$this->app->Tpl->Set('ADRESSE', $input['adresse']);
$this->app->Tpl->Set('LAGER', $input['lager']);
}
}
+23 -10
View File
@@ -1,22 +1,35 @@
<!-- gehort zu tabview -->
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1">[TABTEXT]</a></li> <li><a href="#tabs-1">[TABTEXT]</a></li>
</ul> </ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<div id="tabs-1"> <div id="tabs-1">
<div class="info">Teillieferung: Auswahl der Artikel f&uuml;r eine Teillieferung. Bestimmen Sie welche Artikel als Teillieferung vorab versendet werden sollen,<br> <div class="info">[INFOTEXT]</div>
und wann die Rechnung versendet wird (bei aktueller oder n&auml;chster Lieferung).</div>
<br> <br>
<form action="" method="post"> <form action="" method="post">
[MESSAGE] [MESSAGE]
[TAB1] <div class="row">
[TAB1NEXT] <div class="row-height">
<div class="col-xs-14 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
[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>
<tr><td><button name="submit" id="speichern" value="speichern" class="ui-button-icon" style="width:100%";>Teilauftrag erzeugen</button></td></tr>
<tr><td><button name="submit" id="abbrechen" value="abbrechen" class="ui-button-icon" style="width:100%";>Vorgang abbrechen</button></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
<!-- tab view schließen -->
</div> </div>
@@ -0,0 +1,83 @@
<div id="tabs">
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-4 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Einstellungen|}</legend>
<td>{|Absatz ber&uuml;cksichtigen (Monate)|}:</td>
<td><input type="number" min="0" name="monate_absatz" id="monate_absatz" value="[MONATE_ABSATZ]" size="20""></td>
</tr>
<tr>
<td>{|Vorausplanen (Monate)|}:</td>
<td><input type="number" min="0" name="monate_voraus" id="monate_voraus" value="[MONATE_VORAUS]" size="20""></td>
</tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-14 col-md-8 col-md-height">
<div class="inside inside-full-height">
</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>
<tr>
<td><button name="submit" class="ui-button-icon" style="width:100%;" value="loeschen">{|Zur&uuml;cksetzen|}</button></td>
</tr>
<tr>
<td><button name="submit" class="ui-button-icon" style="width:100%;" value="speichern">{|Speichern|}</button></td>
</tr>
<tr>
<td><button name="submit" class="ui-button-icon" style="width:100%;" value="bestellungen_erzeugen">{|Bestellungen erzeugen|}</button></td>
</tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
[TAB1]
<fieldset>
<table>
<tr>
<td>
<input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</form>
[TAB1NEXT]
</div>
</div>
<script>
$('#autoalle').on('change',function(){
var wert = $(this).prop('checked');
$('#bestellvorschlag_list').find('input[type="checkbox"]').prop('checked',wert);
$('#bestellvorschlag_list').find('input[type="checkbox"]').first().trigger('change');
});
</script>
@@ -0,0 +1,58 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT]</a></li>
</ul>
<!-- ende gehort zu tabview -->
<form action="" method="post">
<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 inside-full-height'>
<fieldset>
<legend>{|Buchungsstapel|}</legend>
<table width="100%" border="0">
<tr>
<td>{|Rechnungen:|}</td>
<td><input type="checkbox" name="rechnung" value="1" [RGCHECKED] /></td>
</tr>
<tr>
<td>{|Gutschriften:|}</td>
<td><input type="checkbox" name="gutschrift" value="1" [GSCHECKED] /></td>
</tr>
<tr>
<td>{|Verbindlichkeiten:|}</td>
<td><input type="checkbox" name="verbindlichkeit" value="1" [VBCHECKED] /></td>
</tr>
<tr>
<td>Datum von:</td>
<td><input type="text" name="von" id="von" value="[VON]" /></td>
</tr>
<tr>
<td>Datum bis:</td>
<td><input type="text" name="bis" id="bis" value="[BIS]" /></td>
</tr>
<tr>
<td>Projekt:</td>
<td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" /></td>
</tr>
</table>
</fieldset>
</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="submit" name="submit" value="Download" class="btnGreenBig">
</fieldset>
</div>
</div>
</div>
</div><!-- row -->
</form>
</div>
+24
View File
@@ -1059,6 +1059,30 @@
<!--<tr> <!--<tr>
<td width="300">Export nach Positionen</td><td colspan="3"><input type="checkbox" name="steuer_positionen_export" value="1" [STEUER_POSITIONEN_EXPORT]"></td> <td width="300">Export nach Positionen</td><td colspan="3"><input type="checkbox" name="steuer_positionen_export" value="1" [STEUER_POSITIONEN_EXPORT]"></td>
</tr>--> </tr>-->
<tr>
<td width="300">Berater:</td>
<td>
<input type="text" name="buchhaltung_berater" size="10" value="[BUCHHALTUNG_BERATER]">
</td>
</tr>
<tr>
<td width="300">Mandant:</td>
<td>
<input type="text" name="buchhaltung_mandant" size="10" value="[BUCHHALTUNG_MANDANT]">
</td>
</tr>
<tr>
<td width="300">Wirtschaftsjahr Beginn (MMDD):</td>
<td>
<input type="text" name="buchhaltung_wj_beginn" id="buchhaltung_wj_beginn" size="10" value="[BUCHHALTUNG_WJ_BEGINN]">
</td>
</tr>
<tr>
<td width="300">Sachkontenl&auml;nge (4-8):</td>
<td>
<input type="text" name="buchhaltung_sachkontenlaenge" size="10" value="[BUCHHALTUNG_SACHKONTENLAENGE]">
</td>
</tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
@@ -6,6 +6,7 @@
<li><a href="#tabs-3">{|Zeiterfassung|}</a></li> <li><a href="#tabs-3">{|Zeiterfassung|}</a></li>
<li><a href="#tabs-4">{|Wiedervorlagen|}</a></li> <li><a href="#tabs-4">{|Wiedervorlagen|}</a></li>
<li><a href="#tabs-5">{|Notizen|}</a></li> <li><a href="#tabs-5">{|Notizen|}</a></li>
<li><a href="#tabs-6">{|Kontorahmen|}</a></li>
</ul> </ul>
<div id="tabs-1"> <div id="tabs-1">
@@ -503,4 +504,51 @@
</div> </div>
</div> </div>
</div> </div>
<div id="tabs-6">
<div class="row">
<div class="col-xs-12 col-sm-1 col-sm-height">
<div class="inside inside-full-height">
<fieldset><legend>{|Kontorahmen|}</legend>
<table class="mkTable">
<tr>
<th>Variable</th>
<th>Beschreibung</th>
<th>Kommentar</th>
</tr>
<tr>
<td>sachkonto</td>
<td>Sachkontonummer</td>
<td></td>
</tr>
<tr>
<td>beschriftung</td>
<td>Sachkontobeschriftung</td>
<td></td>
</tr>
<tr>
<td>art</td>
<td>Art des Kontos</td>
<td>'Aufwendungen', 'Erl&ouml;se', 'Geldtransit' oder 'Saldo'</td>
</tr>
<tr>
<td>bemerkung</td>
<td>Bemerkung zum Konto</td>
<td>optional</td>
</tr>
<tr>
<td>projekt</td>
<td>Projekt-Kennung</td>
<td>optional</td>
</tr>
<tr>
<td>ausblenden</td>
<td>Soll das Konto ausgeblendet werden?</td>
<td>0 oder 1</td>
</tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</div> </div>
@@ -17,14 +17,14 @@
<tr><td colspan="99">&nbsp;</td></tr> <tr><td colspan="99">&nbsp;</td></tr>
<tr align="center"> <tr align="center">
<td width="25%"><a href="index.php?module=exportbelegepositionen&action=export"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_1.gif" border="0" width="30%"></a></td> <td width="25%"><a href="index.php?module=exportbelegepositionen&action=export"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_1.gif" border="0" width="30%"></a></td>
<td width="25%"><a href="index.php?module=exportbuchhaltung&action=export"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_1.gif" border="0" width="30%"></a></td>
<td width="25%">[BELEGEIMPORTSTART]<a href="index.php?module=belegeimport&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_1.gif" border="0" width="30%"></a>[BELEGEIMPORTEND]</td> <td width="25%">[BELEGEIMPORTSTART]<a href="index.php?module=belegeimport&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_1.gif" border="0" width="30%"></a>[BELEGEIMPORTEND]</td>
<td width="25%">&nbsp;</td>
<!--<td width="25%"><a href="index.php?module=shopexport&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_20.gif" border="0" width="30%"></a></td>--> <!--<td width="25%"><a href="index.php?module=shopexport&action=list"><img src="./themes/[THEME]/images/einstellungen/Icons_dunkel_20.gif" border="0" width="30%"></a></td>-->
</tr> </tr>
<tr align="center"> <tr align="center">
<td><a href="index.php?module=exportbelegepositionen&action=export">{|Belegpositionen|} <br>{|Export|}</a></td> <td><a href="index.php?module=exportbelegepositionen&action=export">{|Belegpositionen|} <br>{|Export|}</a></td>
<td><a href="index.php?module=exportbuchhaltung&action=list">{|Buchhaltung|}<br>{|Export|}</a></td>
<td>[BELEGEIMPORTSTART]<a href="index.php?module=belegeimport&action=list">Belege Importer</a>[BELEGEIMPORTEND]</td> <td>[BELEGEIMPORTSTART]<a href="index.php?module=belegeimport&action=list">Belege Importer</a>[BELEGEIMPORTEND]</td>
<td>&nbsp;</td>
<!--<td><a href="index.php?module=shopexport&action=list">Export<br>(Online-Shop)</a></td>--> <!--<td><a href="index.php?module=shopexport&action=list">Export<br>(Online-Shop)</a></td>-->
</tr> </tr>
<!--<tr><td colspan="4"><br></td></tr> <!--<tr><td colspan="4"><br></td></tr>
+32
View File
@@ -0,0 +1,32 @@
<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-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|<!--Legend for this form area goes here>-->kontorahmen|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Sachkonto|}:</td><td><input type="text" name="sachkonto" id="sachkonto" value="[SACHKONTO]" size="20"></td></tr>
<tr><td>{|Beschriftung|}:</td><td><input type="text" name="beschriftung" id="beschriftung" value="[BESCHRIFTUNG]" size="20"></td></tr>
<tr><td>{|Bemerkung|}:</td><td><input type="text" name="bemerkung" id="bemerkung" value="[BEMERKUNG]" size="20"></td></tr>
<tr><td>{|Ausblenden|}:</td><td><input type="checkbox" name="ausblenden" id="ausblenden" value="1" [AUSBLENDEN] size="20"></td></tr>
<tr><td>{|Art|}:</td><td><select name="art">[ART]</select></td></tr>
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
</div>
+12 -315
View File
@@ -1,333 +1,30 @@
<!-- gehort zu tabview -->
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1">[TABTEXT]</a></li> <li><a href="#tabs-1">[TABTEXT1]</a></li>
</ul> </ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<form method="post">
<div id="tabs-1"> <div id="tabs-1">
<form action="#tabs-1" id="frmauto" name="frmauto" method="post">
[MESSAGE] [MESSAGE]
[TAB1] [TAB1]
<fieldset> <fieldset>
<legend>{|Stapelverarbeitung|}</legend>
<input type="checkbox" id="auswahlalle" onchange="kontorahmenmarkieren();" />&nbsp;{|alle markieren|}&nbsp;
<input type="submit" class="btnBlue" name="loeschen" id="loeschen" value="Alle markierten l&ouml;schen" />
</fieldset>
<!--<fieldset>
<legend>Anlegen</legend>
<table> <table>
<legend>Stapelverarbeitung</legend>
<tr> <tr>
<td width="40">Konto:</td><td width="170"><input type="text" name="konto" id="konto"></td> <td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td><td><input type="submit" class="btnBlue" name="ausfuehren" value="{|L&ouml;schen|}" /></td>
<td width="75">Beschriftung:</td><td width="170"><input type="text" name="beschriftung" id="beschriftung"></td>
<td width="23">Art:</td><td width="145"><select name="art" id="art" style="width:11em">
<option value="0"></option>
<option value="1">Aufwendungen</option>
<option value="2">Erl&ouml;se</option>
<option value="3">Geldtransit</option>
<option value="9">Saldo</option>
</select></td>
<td>Nicht sichtbar:</td><td width="40"><input type="checkbox" name="nichtsichtbar" id="nichtsichtbar" value="1"></td>
<td><input type="submit" name="anlegen" id="anlegen" value="Anlegen"></td>
</tr>
</table>
</fieldset>-->
[TAB1NEXT]
<!--<input type="button" class="check" onclick="kontorahmenmarkieren()" name="markieren" id="markieren" value="Alle markieren" />-->
</div>
<!-- tab view schließen -->
</div>
<div id="editKontorahmen" style="display:none;" title="Bearbeiten">
<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>{|Kontorahmen|}</legend>
<input type="hidden" id="editid">
<table>
<tr>
<td>{|Konto|}:</td>
<td><input type="text" name="editkonto" id="editkonto" size="40"></td>
</tr>
<tr>
<td width="120">{|Beschriftung|}:</td>
<td><input type="text" name="editbeschriftung" id="editbeschriftung" size="40"></td>
</tr>
<tr>
<td>{|Art|}:</td>
<td><select name="editart" id="editart">
<option value="0"></option>
<option value="1">Aufwendungen</option>
<option value="2">Erl&ouml;se</option>
<option value="3">Geldtransit</option>
<option value="9">Saldo</option>
</select>
</td>
</tr>
<tr>
<td>{|Bemerkung|}:</td>
<td><textarea name="editbemerkung" id="editbemerkung" rows="5" cols="38"></textarea></td>
</tr>
<tr>
<td>{|Projekt|}:</td>
<td><input type="text" name="editprojekt" id="editprojekt" size="40"></td>
</tr>
<tr>
<td>{|Nicht sichtbar|}:</td>
<td><input type="checkbox" name="editnichtsichtbar" id="editnichtsichtbar" value="1" size="40"></td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
</div>
</div>
</div>
</div>
</div>
</form> </form>
<script type="text/javascript"> [TAB1NEXT]
</div>
</div>
$(document).ready(function() { <script>
$('#editkonto').focus();
$("#editKontorahmen").dialog({ $('#autoalle').on('change',function(){
modal: true, var wert = $(this).prop('checked');
bgiframe: true, $('#kontorahmen_list').find('input[type="checkbox"]').prop('checked',wert);
closeOnEscape:false, $('#kontorahmen_list').find('input[type="checkbox"]').first().trigger('change');
minWidth:600,
autoOpen: false,
buttons: {
ABBRECHEN: function() {
KontorahmenReset();
$(this).dialog('close');
},
SPEICHERN: function() {
Kontorahmen_EditSave();
}
}
}); });
$("#editKontorahmen").dialog({
close: function( event, ui ) {KontorahmenReset();}
});
});
function KontorahmenReset(){
$('#editKontorahmen').find('#editid').val('');
$('#editKontorahmen').find('#editkonto').val('');
$('#editKontorahmen').find('#editbeschriftung').val('');
$('#editKontorahmen').find('#editart').val('');
$('#editKontorahmen').find('#editbemerkung').val('');
$('#editKontorahmen').find('#editprojekt').val('');
$('#editKontorahmen').find('#editnichtsichtbar').prop('checked', false);
}
function Kontorahmen_EditSave() {
$.ajax({
url: 'index.php?module=kontorahmen&action=save',
data: {
//Alle Felder die fürs editieren vorhanden sind
editid: $('#editid').val(),
editkonto: $('#editkonto').val(),
editbeschriftung: $('#editbeschriftung').val(),
editart: $('#editart').val(),
editbemerkung: $('#editbemerkung').val(),
editprojekt: $('#editprojekt').val(),
editnichtsichtbar: $('#editnichtsichtbar').prop("checked")?1:0,
},
method: 'post',
dataType: 'json',
beforeSend: function() {
App.loading.open();
},
success: function(data) {
App.loading.close();
if (data.status == 1) {
KontorahmenReset();
updateLiveTable();
$("#editKontorahmen").dialog('close');
} else {
alert(data.statusText);
}
}
});
}
function Kontorahmen_Edit(id) {
if(id > 0){
$.ajax({
url: 'index.php?module=kontorahmen&action=edit&cmd=get',
data: {
id: id
},
method: 'post',
dataType: 'json',
beforeSend: function() {
App.loading.open();
},
success: function(data) {
$('#editKontorahmen').find('#editid').val(data.id);
$('#editKontorahmen').find('#editkonto').val(data.sachkonto);
$('#editKontorahmen').find('#editbeschriftung').val(data.beschriftung);
$('#editKontorahmen').find('#editart').val(data.art);
$('#editKontorahmen').find('#editbemerkung').val(data.bemerkung);
$('#editKontorahmen').find('#editprojekt').val(data.projekt);
$('#editKontorahmen').find('#editnichtsichtbar').prop("checked",data.ausblenden==1?true:false);
if(data.art=="" || data.art <=0 )
$('#editKontorahmen').find('#editart').val('0');
else
$('#editKontorahmen').find('#editart').val(data.art);
App.loading.close();
$("#editKontorahmen").dialog('open');
}
});
}else{
KontorahmenReset();
$("#editKontorahmen").dialog('open');
}
}
function updateLiveTable(i) {
var oTableL = $('#kontorahmenlist').dataTable();
var tmp = $('.dataTables_filter input[type=search]').val();
oTableL.fnFilter('%');
//oTableL.fnFilter('');
oTableL.fnFilter(tmp);
}
/*function Kontorahmen_Delete(id) {
var conf = confirm('Wirklich löschen?');
if (conf) {
$.ajax({
url: 'index.php?module=kontorahmen&action=delete',
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>
<script type="text/javascript">
function chkontorahmen(kid)
{
var status = 0;
var el = '#kontorahmen_'+kid;
status = $(el).prop('checked');
if(status)status = 1;
if(kid)
{
$.ajax({
url: 'index.php?module=kontorahmen&action=chkontorahmen',
type: 'POST',
dataType: 'json',
data: {kontorahmen :kid, wert : status},
success: function(data) {
},
beforeSend: function() {
}
});
}
}
function alleauswaehlen()
{
var wert = $('#auswahlalle').prop('checked');
$('#kontorahmenlist').find(':checkbox').prop('checked',wert);
$.ajax({
url: 'index.php?module=kontorahmen&action=allemarkieren',
type: 'POST',
dataType: 'json',
data: {markiert : checked},
success: function(data){
},
beforeSend: function(){
}
});
}
function kontorahmenmarkieren(){
//$('.check:button').click(function(){
var checked = !$(this).data('checked');
$('input:checkbox').prop('checked', checked);
$('.check:button').val(checked ? 'Alle entmarkieren' : 'Alle markieren' )
$(this).data('checked', checked);
$.ajax({
url: 'index.php?module=kontorahmen&action=allemarkieren',
type: 'POST',
dataType: 'json',
data: {markiert : checked},
success: function(data){
},
beforeSend: function(){
}
});
//});
}
</script> </script>
+5 -37
View File
@@ -31,30 +31,21 @@
<form method="POST"> <form method="POST">
<table class="option-table"> <table class="option-table">
<tr> <tr>
<td>{|Datum|}:</td><td><input type="text" [DATUMDISABLED] id="datum" name="datum" value="[DATUM]" onchange="holedatum()"/></td> <td>{|Datum|}:</td><td><input type="text" id="datum" name="datum" value="[DATUM]"/></td>
<td>{|Artikel|}:</td><td><input type="text" id="artikel" name="artikel" value="[ARTIKEL]" size="40"></td>
<td>{|Artikelkategorie|}:</td><td><input type="text" id="artikelkategorie" name="artikelkategorie" value="[ARTIKELKATEGORIE]" size="40"></td>
<td>{|Preis|}:</td> <td>{|Preis|}:</td>
<td> <td>
<select id="preisart" name="preisart"> <select id="preisart" name="preisart">
<option value="letzterek" [LETZTEREK]>{|Letzter EK (live mit aktuellem Wert)|}</option> <option value="letzterek" [LETZTEREK]>{|EK aus Einkaufspreisen|}</option>
<option value="kalkulierterek" [KALKULIERTEREK]>{|kalkulierter EK (live mit aktuellem Wert)|}</option> <option value="kalkulierterek" [KALKULIERTEREK]>{|Kalkulierter EK (wenn vorhanden)|}</option>
<option value="inventurwert" [INVENTURWERT]>{|Inventurwert (live mit aktuellem Wert)|}</option> <option value="inventurwert" [INVENTURWERT]>{|Inventurwert (wenn vorhanden)|}</option>
<option value="letzterekarchiv" [LETZTEREKARCHIV]>{|Letzter EK (nur aus Archiv)|}</option>
<option value="kalkulierterekarchiv" [KALKULIERTEREKARCHIV]>{|kalkulierter EK (nur aus Archiv)|}</option>
<option value="inventurwertarchiv" [INVENTURWERTARCHIV]>{|Inventurwert (nur aus Archiv)|}</option>
</select> </select>
</td> </td>
<td>
<input type="checkbox" value="1" id="gruppierenlager" name="gruppierenlager" [GRUPPIERENLAGER]/>
<label for="gruppierenlager">{|Gruppieren Lager|}</label>
</td>
<td> <td>
<input type="checkbox" value="1" id="preiseineuro" name="preiseineuro" [PREISEINEURO]/> <input type="checkbox" value="1" id="preiseineuro" name="preiseineuro" [PREISEINEURO]/>
<label for="preiseineuro">{|alle Preise in EUR anzeigen|}</label> <label for="preiseineuro">{|alle Preise in EUR anzeigen|}</label>
</td> </td>
<td> <td>
<input type="submit" value="{|laden|}" name="laden"/> <input type="submit" value="{|Laden|}" name="laden"/>
</td> </td>
</tr> </tr>
</table> </table>
@@ -66,26 +57,3 @@
<!-- tab view schließen --> <!-- tab view schließen -->
</div> </div>
<script>
function holedatum(){
var datum = $('#datum').val();
$.ajax({
url: 'index.php?module=lager&action=wert&cmd=datumpruefen&datum='+datum,
type: 'POST',
dataType: 'json',
data: {},
success: function(data) {
if(data == ''){
document.getElementById('datumsinfobox').style.display = 'none';
}else{
document.getElementById('datumsinfobox').style.display = '';
document.getElementById('datumsinfobox').innerHTML = '<div id="infoberechnung">Vor dem '+data+' liegen keine Berechnungen f&uuml;r Lagerbewegungen vor.</div>';
}
},
beforeSend: function() {
}
});
}
</script>
+10 -1
View File
@@ -243,7 +243,7 @@
</div> </div>
<div id="tabs-3"> <div id="tabs-3">
[MESSAGE] [MESSAGE]
<form action="" method="post"> <form action="index.php?module=produktion_position&action=edit&produktion=[PRODUKTION_ID]" method="post">
[FORMHANDLEREVENT] [FORMHANDLEREVENT]
<div class="row"> <div class="row">
<div class="row-height"> <div class="row-height">
@@ -252,6 +252,15 @@
<fieldset> <fieldset>
<legend>{|Positionen|}</legend> <legend>{|Positionen|}</legend>
[PRODUKTION_POSITION_SOURCE_POSITION_TABELLE] [PRODUKTION_POSITION_SOURCE_POSITION_TABELLE]
<table width="100%" border="0" class="mkTableFormular">
<tr [AKTION_FREIGEBEN]>
<td>{|Artikel|}:</td>
<td><input type="text" name="artikel" id="artikel" size="20"></td>
<td>{|Menge|}:</td>
<td><input type="number" min="0" name="menge" id="menge" size="20"></td>
<td><button name="submit" value="hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzuf&uuml;gen</button></td>
</tr>
</table>
</fieldset> </fieldset>
</div> </div>
</div> </div>
@@ -0,0 +1,51 @@
<!-- 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">
<form action="" method="post">
[MESSAGE]
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height">
<div class="inside_white inside-full-height">
<fieldset class="white">
<legend></legend>
[TAB1]
</fieldset>
<fieldset>
<table>
<legend>Stapelverarbeitung</legend>
<tr>
<td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td><td><input type="submit" class="btnBlue" name="delcacheselected" value="{|Lagerzahlencache zur&uuml;cksetzen|}" /></td>
</tr>
</table>
</fieldset>
</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="submit" class="btnBlueNew" value="{|Lagerzahlencache gesamt zur&uuml;cksetzen|}" name="delcache"><br
</fieldset>
</div>
</div>
</div>
</form>
</div>
<!-- tab view schließen -->
</div>
<script>
$('#autoalle').on('change',function(){
var wert = $(this).prop('checked');
$('#shopexport_artikellist').find('input[type="checkbox"]').prop('checked',wert);
$('#shopexport_artikellist').find('input[type="checkbox"]').first().trigger('change');
});
</script>
@@ -40,8 +40,8 @@
<fieldset> <fieldset>
<legend>{|Aktionen|}</legend> <legend>{|Aktionen|}</legend>
<input type="submit" class="btnBlueNew" value="{|Lagerzahlcache zur&uuml;cksetzen|}" name="delcache"><br> <input type="submit" class="btnBlueNew" value="{|Lagerzahlencache zur&uuml;cksetzen|}" name="delcache"><br>
<input type="submit" class="btnBlueNew" value="{|Lagerzahlcache für Shopartikel mit Menge 0 zur&uuml;cksetzen|}" name="delzerostockcache"><br> <input type="submit" class="btnBlueNew" value="{|Lagerzahlencache für Shopartikel mit Menge 0 zur&uuml;cksetzen|}" name="delzerostockcache"><br>
<input type="submit" class="btnBlueNew" value="{|Artikelcache zur&uuml;cksetzen|}" name="delarticlecache"><br> <input type="submit" class="btnBlueNew" value="{|Artikelcache zur&uuml;cksetzen|}" name="delarticlecache"><br>
<input type="submit" class="btnBlueNew" value="{|Alle Artikel laden|}" name="alle" onclick="if(!confirm('{|Wollen Sie wirklich alle Artikel an den Shop übertragen? Eventuell werden hier auch Artikeltexte, Preise, Bilder, Eigenschaften, Kategorien, etc. übertragen und überschrieben. Bitte prüfen Sie das Verhalten vorher an einigen Artikel. Bitte nehmen Sie in jedemfall vorab eine Sicherung im Shop vor.|}')) return false;"><br> <input type="submit" class="btnBlueNew" value="{|Alle Artikel laden|}" name="alle" onclick="if(!confirm('{|Wollen Sie wirklich alle Artikel an den Shop übertragen? Eventuell werden hier auch Artikeltexte, Preise, Bilder, Eigenschaften, Kategorien, etc. übertragen und überschrieben. Bitte prüfen Sie das Verhalten vorher an einigen Artikel. Bitte nehmen Sie in jedemfall vorab eine Sicherung im Shop vor.|}')) return false;"><br>
<input type="submit" class="btnBlueNew" value="{|Alle ge&auml;nderten Artikel laden|}" name="allchanged" onclick="if(!confirm('{|Wollen Sie wirklich alle Artikel an den Shop übertragen? Eventuell werden hier auch Artikeltexte, Preise, Bilder, Eigenschaften, Kategorien, etc. übertragen und überschrieben. Bitte prüfen Sie das Verhalten vorher an einigen Artikel. Bitte nehmen Sie in jedemfall vorab eine Sicherung im Shop vor.|}')) return false;"><br> <input type="submit" class="btnBlueNew" value="{|Alle ge&auml;nderten Artikel laden|}" name="allchanged" onclick="if(!confirm('{|Wollen Sie wirklich alle Artikel an den Shop übertragen? Eventuell werden hier auch Artikeltexte, Preise, Bilder, Eigenschaften, Kategorien, etc. übertragen und überschrieben. Bitte prüfen Sie das Verhalten vorher an einigen Artikel. Bitte nehmen Sie in jedemfall vorab eine Sicherung im Shop vor.|}')) return false;"><br>
+2 -2
View File
@@ -20,11 +20,11 @@
<table width="100%" border="0" class="mkTableFormular"> <table width="100%" border="0" class="mkTableFormular">
<legend>{|[STATUSICON]<b>Ticket <font color="blue">#[SCHLUESSEL]</font></b>|}</legend> <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>{|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>[KUNDE]&nbsp;[MAILADRESSE]</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>{|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>{|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> <tr><td>{|Tags|}:</td><td><input type="text" name="tags" id="tags" value="[TAGS]" size="20"></td></tr>
<tr><td>{|Letzte Aktion|}:</td><td>[ZEIT]</td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
+20 -5
View File
@@ -1,21 +1,36 @@
<div class="row"> <div class="row">
<div class="row-height"> <div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height" style="float:[NACHRICHT_FLOAT];"> <div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height" style= "border:1px solid black;"> <div class="inside inside-full-height" >
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-4 col-md-height" style="float:[META_FLOAT];">
<div class="inside inside-full-height" >
<fieldset> <fieldset>
<legend>{|<b>[NACHRICHT_BETREFF]</b>|}</legend>
<table width="100%" border="0" class="mkTableFormular"> <table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Betreff|}:</td><td><b>[NACHRICHT_BETREFF]<b></td></tr>
<tr><td>{|Zeit|}:</td><td>[NACHRICHT_ZEIT]</td></tr> <tr><td>{|Zeit|}:</td><td>[NACHRICHT_ZEIT]</td></tr>
<tr><td>{|Von|}:</td><td>[NACHRICHT_SENDER]</td></tr> <tr><td>{|Von|}:</td><td>[NACHRICHT_SENDER]</td></tr>
<tr><td>{|An|}:</td><td>[NACHRICHT_RECIPIENTS]</td></tr> <tr><td>{|An|}:</td><td>[NACHRICHT_RECIPIENTS]</td></tr>
<tr><td>{|CC|}:</td><td>[NACHRICHT_CC_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> <tr><td colspan=2><div id="body" class="ticket_attachments">[NACHRICHT_ANHANG]</div></td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-8 col-md-height ticket_nachricht_box" style="float:[NACHRICHT_FLOAT]">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<tr><td colspan=2><div id="body" class="ticket_text_div">[NACHRICHT_TEXT]</div></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
+90
View File
@@ -0,0 +1,90 @@
<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>{|&Uuml;bersetzung|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Label|}:</td><td><input type="text" name="label" id="label" value="[LABEL]" size="20"></td></tr>
<!---
<tr>
<td>{|Sprache|}:</td>
<td>
<select name="sprache" size="0" tabindex="1" id="sprache" class="" onchange="">
[SPRACHENSELECT]
</select>
</td>
--!>
<tr><td>{|Sprache|}:</td><td><input type="text" name="sprache" id="sprache" value="[SPRACHE]" size="20"></td></tr>
</tr>
<tr><td>{|&Uuml;bersetzung|}:</td><td><textarea name="beschriftung" id="beschriftung" rows="6" style="width:100%;">[BESCHRIFTUNG]</textarea></td></tr>
<tr><td>{|Original|}:</td><td><textarea name="original" id="original" rows="6" style="width:100%;">[ORIGINAL]</textarea></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>{|Label|}:</td><td><input type="text" name="label" id="label" value="[LABEL]" size="20"></td></tr>
<tr><td>{|Beschriftung|}:</td><td><input type="text" name="beschriftung" id="beschriftung" value="[BESCHRIFTUNG]" size="20"></td></tr>
<tr><td>{|Sprache|}:</td><td><input type="text" name="sprache" id="sprache" value="[SPRACHE]" size="20"></td></tr>
<tr><td>{|Original|}:</td><td><input type="text" name="original" id="original" value="[ORIGINAL]" size="20"></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>
+10
View File
@@ -0,0 +1,10 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
</ul>
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>
</div>
+19 -5
View File
@@ -10,6 +10,20 @@
--> -->
<div id="tabs-1"> <div id="tabs-1">
[MESSAGE] [MESSAGE]
<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>{|OpenXE Upgrade-System|}</legend>
Das Upgrade funktioniert in 2 Schritten: Dateien aktualisieren, Datenbank auffrischen. Wenn das Upgrade lange l&auml;uft, kann der Fortschritt in einem neuen Fenster mit "Anzeige auffrischen" angezeigt werden.<br><br>
Falls nach einem Abbruch oder schwerwiegenden Fehler kein Upgrade möglich ist, im Hauptordner den Ordner ".git" l&ouml;schen und das Upgrade in der Konsole erneut durchf&uuml;hren.
Dazu im Unterordner "upgrade" diesen Befehl starten: <pre>./upgrade.sh -do</pre>
</fieldset>
</div>
</div>
</div>
</div>
<form action="" method="post"> <form action="" method="post">
[FORMHANDLEREVENT] [FORMHANDLEREVENT]
<div class="row"> <div class="row">
@@ -53,12 +67,12 @@
<table width="100%" border="0" class="mkTableFormular"> <table width="100%" border="0" class="mkTableFormular">
<tr><td colspan=2><button name="submit" value="refresh" class="ui-button-icon" style="width:100%;">Anzeige auffrischen</button></td></tr> <tr><td colspan=2><button name="submit" value="refresh" class="ui-button-icon" style="width:100%;">Anzeige auffrischen</button></td></tr>
<tr><td colspan=2><button name="submit" value="check_upgrade" class="ui-button-icon" style="width:100%;">Upgrades pr&uuml;fen</button></td></tr> <tr><td colspan=2><button name="submit" value="check_upgrade" class="ui-button-icon" style="width:100%;">Upgrades pr&uuml;fen</button></td></tr>
<tr><td style="width:100%;">{|Upgrade-Details anzeigen|}:</td><td><input type="checkbox" name="details_anzeigen" value=1 size="20"></td></tr> <tr><td style="width:100%;">{|Upgrade-Details anzeigen|}:</td><td><input type="checkbox" name="details_anzeigen" value=1 [DETAILS_ANZEIGEN] size="20"></td></tr>
<tr [UPGRADE_VISIBLE]><td colspan=2><button name="submit" value="do_upgrade" class="ui-button-icon" style="width:100%;">UPGRADE</button></td></tr> <tr [UPGRADE_VISIBLE]><td colspan=2><button name="submit" formtarget="_blank" value="do_upgrade" class="ui-button-icon" style="width:100%;">UPGRADE</button></td></tr>
<tr [UPGRADE_VISIBLE]><td style="width:100%;">{|Erzwingen (-f)|}:</td><td><input type="checkbox" name="erzwingen" value=1 size="20"></td></tr> <tr [UPGRADE_VISIBLE]><td style="width:100%;">{|Erzwingen (-f)|}:</td><td><input type="checkbox" name="erzwingen" value=1 [ERZWINGEN] size="20"></td></tr>
<tr><td colspan=2><button name="submit" value="check_db" class="ui-button-icon" style="width:100%;">Datenbank pr&uuml;fen</button></td></tr> <tr><td colspan=2><button name="submit" value="check_db" class="ui-button-icon" style="width:100%;">Datenbank pr&uuml;fen</button></td></tr>
<tr><td style="width:100%;">{|Datenbank-Details anzeigen|}:</td><td><input type="checkbox" name="db_details_anzeigen" value=1 size="20"></td></tr> <tr><td style="width:100%;">{|Datenbank-Details anzeigen|}:</td><td><input type="checkbox" name="db_details_anzeigen" value=1 [DB_DETAILS_ANZEIGEN] size="20"></td></tr>
<tr [UPGRADE_DB_VISIBLE]><td colspan=2><button name="submit" value="do_db_upgrade" class="ui-button-icon" style="width:100%;">Datenbank UPGRADE</button></td></tr> <tr [UPGRADE_DB_VISIBLE]><td colspan=2><button name="submit" formtarget="_blank" value="do_db_upgrade" class="ui-button-icon" style="width:100%;">Datenbank UPGRADE</button></td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
@@ -12,11 +12,11 @@
<fieldset><legend>{|Umrechnung|}</legend> <fieldset><legend>{|Umrechnung|}</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td> <table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td>
<table align="center" border="0" cellspacing="0" cellpadding="3"> <table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td>W&auml;hrung von</td><td><input type="text" name="waehrung_von" value="[WAEHRUNG_VON]" /></td></tr> <tr><td>W&auml;hrung von</td><td><select name="waehrung_von">[WAEHRUNG_VON]</select></td></tr>
<tr><td>W&auml;hrung nach</td><td><input type="text" name="waehrung_nach" value="[WAEHRUNG_NACH]" /></td></tr> <tr><td>W&auml;hrung nach</td><td><select name="waehrung_nach">[WAEHRUNG_NACH]</select></td></tr>
<tr><td>Kurs:</td><td><input type="text" name="kurs" value="[KURS]" /></td></tr> <tr><td>Kurs:</td><td><input type="number" lang="de_DE" step="0.0001" name="kurs" value="[KURS]" /></td></tr>
<tr><td>g&uuml;ltig bis</td><td><input type="text" name="gueltig_bis" id="gueltig_bis" value="[GUELTIG_BIS]" /></td></tr> <tr><td>g&uuml;ltig bis</td><td><input type="text" name="gueltig_bis" id="gueltig_bis" value="[GUELTIG_BIS]" /></td></tr>
<tr><td></td><td><input type="submit" value="Speichern" name="speichern" /></td></tr> <tr><td></td><td><input type="submit" value="Speichern" name="submit" /></td></tr>
</table> </table>
</tr></td></table> </tr></td></table>
</fieldset> </fieldset>
@@ -27,3 +27,6 @@
<!-- tab view schließen --> <!-- tab view schließen -->
</div> </div>
@@ -10,6 +10,7 @@
[MESSAGE] [MESSAGE]
[TAB1] [TAB1]
[TAB1NEXT] [TAB1NEXT]
<!--
<form method="post"> <form method="post">
<table width="100%"><tr><td width="100%" align="center"> <table width="100%"><tr><td width="100%" align="center">
<input type="submit" name="abgleich" value="Nur angelegte Kurse von der ECB holen" />&nbsp; <input type="submit" name="abgleich" value="Nur angelegte Kurse von der ECB holen" />&nbsp;
@@ -17,6 +18,7 @@
</td></tr> </td></tr>
</table> </table>
</form> </form>
-->
</div> </div>
<!-- tab view schließen --> <!-- tab view schließen -->
@@ -0,0 +1,77 @@
<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>-->Zolltarifnummer|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Nummer|}:</td><td><input type="text" name="nummer" id="nummer" value="[NUMMER]" size="20"></td></tr>
<tr><td>{|Beschreibung|}:</td><td><input type="text" name="beschreibung" id="beschreibung" value="[BESCHREIBUNG]" size="20"></td></tr>
<tr><td>{|Interne Bemerkung|}:</td><td><input type="text" name="internebemerkung" id="internebemerkung" value="[INTERNEBEMERKUNG]" size="20"></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>{|Nummer|}:</td><td><input type="text" name="nummer" id="nummer" value="[NUMMER]" size="20"></td></tr>
<tr><td>{|Beschreibung|}:</td><td><input type="text" name="beschreibung" id="beschreibung" value="[BESCHREIBUNG]" size="20"></td></tr>
<tr><td>{|Internebemerkung|}:</td><td><input type="text" name="internebemerkung" id="internebemerkung" value="[INTERNEBEMERKUNG]" size="20"></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,10 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
</ul>
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>
</div>
+759
View File
@@ -0,0 +1,759 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
/*
* Copyright (c) 2023 OpenXE project
*/
?>
<?php
class ConsistencyException extends Exception {
/*
contains the result data as array(string 'belegnr', float 'betrag_gesamt', float 'betrag_summe'))
*/
private $_data = array();
public function __construct($message, $data)
{
$this->_data = $data;
parent::__construct($message);
}
public function getData()
{
return $this->_data;
}
}
class Exportbuchhaltung
{
/** @var Application $app */
var $app;
var $belegnummer;
var $headerwritten = false;
/**
* Exportbelegepositionen constructor.
*
* @param Application $app
* @param bool $intern
*/
public function __construct($app, $intern = false)
{
$this->app = $app;
if ($intern == true) {
return;
}
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("export", "ExportBuchhaltungList");
$this->app->ActionHandlerListen($app);
$this->app->erp->Headlines('Buchhaltung Export DATEV');
}
function ExportBuchhaltungList() {
$submit = $this->app->Secure->GetPOST('submit');
$von_form = $this->app->Secure->GetPOST("von");
$bis_form = $this->app->Secure->GetPOST("bis");
$von = date_create($this->app->erp->ReplaceDatum(true, $von_form, true));
$bis = date_create($this->app->erp->ReplaceDatum(true, $bis_form, true));
$projektkuerzel = $this->app->Secure->GetPOST("projekt");
$projekt = $this->app->erp->ReplaceProjekt(true, $projektkuerzel, true);
$rgchecked = $this->app->Secure->GetPOST("rechnung");
$gschecked = $this->app->Secure->GetPOST("gutschrift");
$vbchecked = $this->app->Secure->GetPOST("verbindlichkeit");
$msg = "";
// Preload values
if (empty($submit)) {
$von = date_create('now')->modify('first day of last month');
$von_form = $this->app->erp->ReplaceDatum(false,$von->format('Y-m-d'),false);
$bis = date_create('now')->modify('last day of last month');
$bis_form = $this->app->erp->ReplaceDatum(false,$bis->format('Y-m-d'),false);
$rgchecked = true;
$gschecked = true;
$vbchecked = true;
}
$missing_obligatory = array();
$buchhaltung_berater = $this->app->erp->Firmendaten('buchhaltung_berater');
$buchhaltung_mandant = $this->app->erp->Firmendaten('buchhaltung_mandant');
$buchhaltung_wj_beginn = $this->app->erp->Firmendaten('buchhaltung_wj_beginn');
$buchhaltung_sachkontenlaenge = $this->app->erp->Firmendaten('buchhaltung_sachkontenlaenge');
$buchhaltung_berater = $this->app->erp->Firmendaten('buchhaltung_berater');
if (empty($buchhaltung_berater)) {
$missing_obligatory[] = "Berater";
}
$buchhaltung_mandant = $this->app->erp->Firmendaten('buchhaltung_mandant');
if (empty($buchhaltung_mandant)) {
$missing_obligatory[] = "Mandant";
}
$buchhaltung_wj_beginn = $this->app->erp->Firmendaten('buchhaltung_wj_beginn');
if (empty($buchhaltung_wj_beginn)) {
$missing_obligatory[] = "Wirtschaftsjahr";
}
$buchhaltung_sachkontenlaenge = $this->app->erp->Firmendaten('buchhaltung_sachkontenlaenge');
if (empty($buchhaltung_sachkontenlaenge)) {
$missing_obligatory[] = "Sachkontenl&auml;nge";
}
if (!empty($missing_obligatory)) {
$msg = "<div class=warning>Angaben in den Grundeinstellungen fehlen: ".implode(", ",$missing_obligatory).".</div>";
}
//---------- DOWNLOAD HERE
if ($submit == 'Download') {
$dataok = true;
if (
!$rgchecked &&
!$gschecked &&
!$vbchecked
) {
$msg = "<div class=error>Bitte mindestens eine Belegart auswählen.</div>";
$dataok = false;
}
$von_next_year = clone $von;
$von_next_year = $von_next_year->modify("+1 year");;
$buchhaltung_wj_beginn = date_create(date_format($von,'Y').$buchhaltung_wj_beginn);
if ($buchhaltung_wj_beginn > $von) {
$buchhaltung_wj_beginn = $buchhaltung_wj_beginn->modify("-1 year");
}
$buchhaltung_wj_beginn_next_year = clone $buchhaltung_wj_beginn;
$buchhaltung_wj_beginn_next_year->modify("+1 year");
if ($bis < $von || $bis > $von_next_year || $bis >= $buchhaltung_wj_beginn_next_year) {
$msg = "<div class=error>Ung&uuml;ltiger Datumsbereich.</div>";
$dataok = false;
}
if ($dataok) {
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
try {
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename);
header("Content-Disposition: attachment; filename=" . $filename);
header("Pragma: no-cache");
header("Expires: 0");
echo($csv);
$this->app->ExitXentral();
}
catch (ConsistencyException $e) {
$msg = "<div class=error>Inkonsistente Daten (".$e->getMessage()."): <br>";
$data = $e->getData();
$count = 0;
foreach($data as $item) {
$msg .= $item['typ']." ".$item['belegnr']." (Kopf ".$this->app->erp->ReplaceMengeBetrag(false,$item['betrag_gesamt'],false)." Positionen ".$this->app->erp->ReplaceMengeBetrag(false,$item['betrag_summe'],false).")<br>";
$count++;
if ($count == 10) {
$msg .= "...";
break;
}
}
$msg .= "</div>";
}
}
}
//---------- DOWNLOAD HERE
$this->app->erp->MenuEintrag("index.php?module=exportbuchhaltung&action=export", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=importvorlage&action=uebersicht", "Zur&uuml;ck");
$this->app->YUI->AutoComplete("projekt", "projektname", 1);
$this->app->YUI->DatePicker("von");
$this->app->YUI->DatePicker("bis");
$this->app->Tpl->SET('MESSAGE', $msg);
$this->app->Tpl->SET('RGCHECKED',$rgchecked?'checked':'');
$this->app->Tpl->SET('GSCHECKED',$gschecked?'checked':'');
$this->app->Tpl->SET('VBCHECKED',$vbchecked?'checked':'');
$this->app->Tpl->SET('VON', $von_form);
$this->app->Tpl->SET('BIS', $bis_form);
$this->app->Tpl->SET('PROJEKT', $projektkuerzel);
$this->app->Tpl->Parse('PAGE', "exportbuchhaltung_export.tpl");
}
/*
* Create DATEV Buchhungsstapel
* @throws ConsistencyException with string (list of items) if consistency check fails
*/
function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv') : string {
$datev_header_definition = array (
'1' => 'Kennzeichen',
'2' => 'Versionsnummer',
'3' => 'Formatkategorie',
'4' => 'Formatname',
'5' => 'Formatversion',
'6' => 'Erzeugt am',
'7' => 'Reserviert',
'8' => 'Reserviert',
'9' => 'Reserviert',
'10' => 'Reserviert',
'11' => 'Beraternummer',
'12' => 'Mandantennummer',
'13' => 'WJ-Beginn',
'14' => 'Sachkontenlänge',
'15' => 'Datum von',
'16' => 'Datum bis',
'17' => 'Bezeichnung',
'18' => 'Diktatkürzel',
'19' => 'Buchungstyp',
'20' => 'Rechnungs- legungszweck',
'21' => 'Festschreibung',
'22' => 'WKZ',
'23' => 'Reserviert',
'24' => 'Derivatskennzeichen',
'25' => 'Reserviert',
'26' => 'Reserviert',
'27' => 'Sachkonten- rahmen',
'28' => 'ID der Branchen- lösung',
'29' => 'Reserviert',
'30' => 'Reserviert',
'31' => 'Anwendungs- information'
);
$datev_buchungsstapel_definition = array (
'1' => 'Umsatz',
'2' => 'Soll-/Haben-Kennzeichen',
'3' => 'WKZ Umsatz',
'4' => 'Kurs',
'5' => 'Basisumsatz',
'6' => 'WKZ Basisumsatz',
'7' => 'Konto',
'8' => 'Gegenkonto (ohne BU-Schlüssel)',
'9' => 'BU-Schlüssel',
'10' => 'Belegdatum',
'11' => 'Belegfeld 1',
'12' => 'Belegfeld 2',
'13' => 'Skonto',
'14' => 'Buchungstext',
'15' => 'Postensperre',
'16' => 'Diverse Adressnummer',
'17' => 'Geschäftspartnerbank',
'18' => 'Sachverhalt',
'19' => 'Zinssperre',
'20' => 'Beleglink',
'21' => 'Beleginfo -Art 1',
'22' => 'Beleginfo -Inhalt 1',
'23' => 'Beleginfo -Art 2',
'24' => 'Beleginfo -Inhalt 2',
'25' => 'Beleginfo -Art 3',
'26' => 'Beleginfo -Inhalt 3',
'27' => 'Beleginfo -Art 4',
'28' => 'Beleginfo -Inhalt 4',
'29' => 'Beleginfo -Art 5',
'30' => 'Beleginfo -Inhalt 5',
'31' => 'Beleginfo -Art 6',
'32' => 'Beleginfo -Inhalt 6',
'33' => 'Beleginfo -Art 7',
'34' => 'Beleginfo -Inhalt 7',
'35' => 'Beleginfo -Art 8',
'36' => 'Beleginfo -Inhalt 8',
'37' => 'KOST1 -Kostenstelle',
'38' => 'KOST2 -Kostenstelle',
'39' => 'KOST-Menge',
'40' => 'EU-Mitgliedstaat u. UStID (Bestimmung)',
'41' => 'EU-Steuersatz (Bestimmung)',
'42' => 'Abw. Versteuerungsart',
'43' => 'Sachverhalt L+L',
'44' => 'Funktionsergänzung L+L',
'45' => 'BU 49 Hauptfunktiontyp',
'46' => 'BU 49 Hauptfunktionsnummer',
'47' => 'BU 49 Funktionsergänzung',
'48' => 'Zusatzinformation Art 1',
'49' => 'Zusatzinformation Inhalt 1',
'50' => 'Zusatzinformation Art 2',
'51' => 'Zusatzinformation Inhalt 2',
'52' => 'Zusatzinformation Art 3',
'53' => 'Zusatzinformation Inhalt 3',
'54' => 'Zusatzinformation Art 4',
'55' => 'Zusatzinformation Inhalt 4',
'56' => 'Zusatzinformation Art 5',
'57' => 'Zusatzinformation Inhalt 5',
'58' => 'Zusatzinformation Art 6',
'59' => 'Zusatzinformation Inhalt 6',
'60' => 'Zusatzinformation Art 7',
'61' => 'Zusatzinformation Inhalt 7',
'62' => 'Zusatzinformation Art 8',
'63' => 'Zusatzinformation Inhalt 8',
'64' => 'Zusatzinformation Art 9',
'65' => 'Zusatzinformation Inhalt 9',
'66' => 'Zusatzinformation Art 10',
'67' => 'Zusatzinformation Inhalt 10',
'68' => 'Zusatzinformation Art 11',
'69' => 'Zusatzinformation Inhalt 11',
'70' => 'Zusatzinformation Art 12',
'71' => 'Zusatzinformation Inhalt 12',
'72' => 'Zusatzinformation Art 13',
'73' => 'Zusatzinformation Inhalt 13',
'74' => 'Zusatzinformation Art 14',
'75' => 'Zusatzinformation Inhalt 14',
'76' => 'Zusatzinformation Art 15',
'77' => 'Zusatzinformation Inhalt 15',
'78' => 'Zusatzinformation Art 16',
'79' => 'Zusatzinformation Inhalt 16',
'80' => 'Zusatzinformation Art 17',
'81' => 'Zusatzinformation Inhalt 17',
'82' => 'Zusatzinformation Art 18',
'83' => 'Zusatzinformation Inhalt 18',
'84' => 'Zusatzinformation Art 19',
'85' => 'Zusatzinformation Inhalt 19',
'86' => 'Zusatzinformation Art 20',
'87' => 'Zusatzinformation Inhalt 20',
'88' => 'Stück',
'89' => 'Gewicht',
'90' => 'Zahlweise',
'91' => 'Forderungsart',
'92' => 'Veranlagungsjahr',
'93' => 'Zugeordnete Fälligkeit',
'94' => 'Skontotyp',
'95' => 'Auftragsnummer',
'96' => 'Buchungstyp',
'97' => 'USt-Schlüssel (Anzahlungen)',
'98' => 'EU-Mitgliedstaat (Anzahlungen)',
'99' => 'Sachverhalt L+L (Anzahlungen)',
'100' => 'EU-Steuersatz (Anzahlungen)',
'101' => 'Erlöskonto (Anzahlungen)',
'102' => 'Herkunft-Kz',
'103' => 'Leerfeld',
'104' => 'KOST-Datum',
'105' => 'SEPA-Mandatsreferenz',
'106' => 'Skontosperre',
'107' => 'Gesellschaftername',
'108' => 'Beteiligtennummer',
'109' => 'Identifikationsnummer',
'110' => 'Zeichnernummer',
'111' => 'Postensperre bis',
'112' => 'Bezeichnung SoBil-Sachverhalt',
'113' => 'Kennzeichen SoBil-Buchung',
'114' => 'Festschreibung',
'115' => 'Leistungsdatum',
'116' => 'Datum Zuord. Steuerperiode',
'117' => 'Fälligkeit',
'118' => 'Generalumkehr',
'119' => 'Steuersatz',
'120' => 'Land',
'121' => 'Abrechnungsreferenz',
'122' => 'BVV-Position (Betriebsvermögensvergleich)',
'123' => 'EU-Mitgliedstaat u. UStID (Ursprung)',
'124' => 'EU-Steuersatz (Ursprung)');
$usernamearr = explode(' ',strtoupper($this->app->User->GetName()." X X"));
if (count($usernamearr) < 2) {
$kuerzel = $usernamearr[0][0].$usernamearr[0][1];
}
else {
$kuerzel = $usernamearr[0][0].$usernamearr[1][0];
}
$data['Kennzeichen'] = 'EXTF';
$data['Versionsnummer'] = '700';
$data['Formatkategorie'] = '21';
$data['Formatname'] = 'Buchungsstapel';
$data['Formatversion'] = '12';
$data['Erzeugt am'] = date('YmdHis').'000';
$data['Reserviert'] = '';
$data['Reserviert'] = '';
$data['Reserviert'] = '';
$data['Reserviert'] = '';
$data['Beraternummer'] = $berater;
$data['Mandantennummer'] = $mandant;
$data['WJ-Beginn'] = date_format($wj_beginn,"Ymd");
$data['Sachkontenlänge'] = $sachkontenlaenge;
$data['Datum von'] = date_format($von,"Ymd");
$data['Datum bis'] = date_format($bis,"Ymd");
$data['Bezeichnung'] = mb_strimwidth($filename,0,30);
$data['Diktatkürzel'] = $kuerzel;
$data['Buchungstyp'] = 1;
$data['Rechnungs- legungszweck'] = 0;
$data['Festschreibung'] = 1;
$data['WKZ'] = 'EUR';
$data['Reserviert'] = '';
$data['Derivatskennzeichen'] = '';
$data['Reserviert'] = '';
$data['Reserviert'] = '';
$data['Sachkonten- rahmen'] = '';
$data['ID der Branchen- lösung'] = '';
$data['Reserviert'] = '';
$data['Reserviert'] = '';
$data['Anwendungs- information'] = '';
// Start
$csv = "";
// Output data header row
$comma = "";
foreach ($datev_header_definition as $key => $value) {
if (!isset($data[$value])) {
$data[$value] = '';
}
$csv .= $comma.'"'.$data[$value].'"';
$comma = ";";
}
$csv .= "\r\n";
// Output column captions
$comma = "";
foreach ($datev_buchungsstapel_definition as $key => $value) {
$csv .= $comma.'"'.$value.'"';
$comma = ";";
}
$csv .= "\r\n";
// Collate data and transform in RAM
$typen = array(
array(
'typ' => 'rechnung',
'subtable' => 'rechnung_position',
'kennzeichen' => 'S',
'kennzeichen_negativ' => 'H',
'field_belegnr' => 'b.belegnr',
'field_name' => 'b.name',
'field_date' => 'datum',
'field_auftrag' => 'b.auftrag',
'field_kontonummer' => 'a.kundennummer_buchhaltung',
'field_kundennummer' => 'b.kundennummer',
'field_betrag_gesamt' => 'b.soll',
'field_betrag' => 'p.umsatz_brutto_gesamt',
'field_gegenkonto' => '\'\'',
'condition_where' => ' AND b.status IN (\'freigegeben\',\'versendet\',\'storniert\')',
'Buchungstyp' => 'SR',
'do' => $rechnung
),
array(
'typ' => 'gutschrift',
'subtable' => 'gutschrift_position',
'kennzeichen' => 'H',
'kennzeichen_negativ' => 'S',
'field_belegnr' => 'b.belegnr',
'field_name' => 'b.name',
'field_date' => 'datum',
'field_auftrag' => '\'\'',
'field_kontonummer' => 'a.kundennummer_buchhaltung',
'field_kundennummer' => 'b.kundennummer',
'field_betrag_gesamt' => 'b.soll',
'field_betrag' => 'p.umsatz_brutto_gesamt',
'field_gegenkonto' => '\'\'',
'condition_where' => ' AND b.status IN (\'freigegeben\',\'versendet\')',
'Buchungstyp' => '',
'do' => $gutschrift
),
array(
'typ' => 'verbindlichkeit',
'subtable' => 'verbindlichkeit_kontierung',
'kennzeichen' => 'H',
'kennzeichen_negativ' => 'S',
'field_belegnr' => 'b.rechnung',
'field_name' => 'a.name',
'field_date' => 'rechnungsdatum',
'field_auftrag' => 'b.auftrag',
'field_kontonummer' => 'a.lieferantennummer_buchhaltung',
'field_kundennummer' => 'a.lieferantennummer',
'field_betrag_gesamt' => 'b.betrag',
'field_betrag' => 'p.betrag',
'field_gegenkonto' => 'gegenkonto',
'condition_where' => '',
'Buchungstyp' => '',
'do' => $verbindlichkeit
)
);
foreach ($typen as $typ) {
if (!$typ['do']) {
continue;
}
$sql = "SELECT
".$typ['field_belegnr']." as belegnr,
".$typ['field_auftrag']." as auftrag,
if(".$typ['field_kontonummer']." <> '',".$typ['field_kontonummer'].",".$typ['field_kundennummer'].") as kundennummer,
".$typ['field_name']." as name,
b.ustid,
b.".$typ['field_date']." as datum,
p.id as pos_id,
".$typ['field_betrag_gesamt']." as betrag_gesamt,
".$typ['field_betrag']." as betrag,
".$typ['field_gegenkonto']." as gegenkonto,
p.waehrung as pos_waehrung
FROM
".$typ['typ']." b
LEFT JOIN
".$typ['subtable']." p
ON
b.id = p.".$typ['typ']."
INNER JOIN
adresse a ON a.id = b.adresse
WHERE
b.".$typ['field_date']." BETWEEN '".date_format($von,"Y-m-d")."' AND '".date_format($bis,"Y-m-d")."' AND (b.projekt=$projekt OR $projekt=0)".$typ['condition_where'];
// Check consistency of positions
$sql_check = "SELECT *
FROM
(
SELECT
belegnr,
betrag_gesamt,
ROUND(SUM(betrag),2) AS betrag_summe
FROM
(".$sql.") posten
GROUP BY
belegnr
) summen
WHERE betrag_gesamt <> betrag_summe OR betrag_summe IS NULL";
$result = $this->app->DB->SelectArr($sql_check);
if (!empty($result)) {
$e = new ConsistencyException(ucfirst($typ['typ']),$result);
throw $e;
}
// Query position data
$arr = $this->app->DB->Query($sql);
while ($row = $this->app->DB->Fetch_Assoc($arr)) {
// print_r($row);
$posid = $row['pos_id'];
$tmpsteuersatz = 0;
$tmpsteuertext = '';
$erloes = '';
$result = array();
$this->app->erp->GetSteuerPosition($typ['typ'], $posid, $tmpsteuersatz, $tmpsteuertext, $erloes);
$data = array();
if ($row['betrag'] >= 0) {
$data['Umsatz'] = number_format($row['betrag'], 2, ',', ''); // obligatory
$data['Soll-/Haben-Kennzeichen'] = $typ['kennzeichen']; // obligatory
} else {
$data['Umsatz'] = number_format(-$row['betrag'], 2, ',', ''); // obligatory
$data['Soll-/Haben-Kennzeichen'] = $typ['kennzeichen_negativ']; // obligatory
}
$data['EU-Steuersatz (Bestimmung)'] = number_format($$tmpsteuersatz, 2, ',', '');
$data['WKZ Umsatz'] = $row['pos_waehrung'];
$data['Belegfeld 1'] = mb_strimwidth($row['belegnr'],0,12);
$data['Konto'] = $row['kundennummer']; // obligatory
if ($typ['field_gegenkonto'] == 'gegenkonto') {
$data['Gegenkonto (ohne BU-Schlüssel)'] = $row['gegenkonto']; // obligatory
} else {
$data['Gegenkonto (ohne BU-Schlüssel)'] = $erloes; // obligatory
}
$data['Belegdatum'] = date_format(date_create($row['datum']),"dm"); // obligatory
$data['Buchungstext'] = mb_strimwidth($row['name'],0,60);
$data['EU-Mitgliedstaat u. UStID (Bestimmung)'] = $row['ustid'];
$data['Auftragsnummer'] = $row['auftrag'];
$comma = "";
foreach ($datev_buchungsstapel_definition as $key => $value) {
if (!isset($data[$value])) {
$data[$value] = '';
}
$csv .= $comma.'"'.$data[$value].'"';
$comma = ";";
}
$csv .= "\r\n";
}
}
$csv .= '"0";"S";"EUR";"0";"";"";"1234";"1370";"";"101";"";"";"";"Testbuchung";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"0";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""'; // Testbuchung
$csv = mb_convert_encoding($csv, "ISO-8859-1", "UTF-8");
return($csv);
}
}
/*
Documentation DATEV formats
HEADER
| # | Überschrift | Ausdruck | Beschreibung |
|----|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | Kennzeichen | ^["](EXTF|DTVF)["]$ | EXTF = Export aus 3rd-Party App DTVF = Export aus DATEV App |
| 2 | Versionsnummer | ^(700)$ | Versionsnummer des Headers. Anhand der Versionsnummer können ältere Versionen abwärtskompatibel verarbeitet werden. |
| 3 | Formatkategorie | ^(16|20|21|46|48|65)$ | 16 = Debitoren-/Kreditoren 20 = Kontenbeschriftungen 21 = Buchungsstapel 46 = Zahlungsbedingungen 48 = Diverse Adressen 65 = Wiederkehrende Buchungen |
| 4 | Formatname | ^["](Buchungsstapel|Wiederkehrende Buchungen|Debitoren/Kreditoren| Kontenbeschriftungen| Zahlungsbedingungen| Diverse Adressen)["]$ | Formatname |
| 5 | Formatversion | ^(2|4|5|12)$ | Debitoren-/Kreditoren = 5 Kontenbeschriftungen = 3 Buchungsstapel = 12 Zahlungsbedingungen = 2 Wiederkehrende Buchungen = 4 Diverse Adressen = 2 |
| 6 | Erzeugt am | ^([2])([0])([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(2[0-3]|[01][0-9])([0-5][0-9])([0-5][0-9][0-9][0-9][0-9])$ | Zeitstempel: YYYYMMDDHHMMSSFFF |
| 7 | Reserviert | ^[]$ | Leerfeld |
| 8 | Reserviert | ^["]\w{0,2}["]$ | Leerfeld |
| 9 | Reserviert | ^["]\w{0,25}["]$ | Leerfeld |
| 10 | Reserviert | ^["]\w{0,25}["]$ | Leerfeld |
| 11 | Beraternummer | ^(\d{4,6}|\d{7})$ | Bereich 1001-9999999 |
| 12 | Mandantennummer | ^\d{1,5}$ | Bereich 1-99999 |
| 13 | WJ-Beginn | ^([2])([0])([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$ | Wirtschaftsjahresbeginn Format: YYYYMMDD |
| 14 | Sachkontenlänge | ^[4-8]$ | Nummernlänge der Sachkonten. Wert muss beim Import mit Konfiguration des Mandats in der DATEV App übereinstimmen. |
| 15 | Datum von | ^([2])([0])([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$ | Beginn der Periode des Stapels Format: YYYYMMDD Siehe Anhang 2. |
| 16 | Datum bis | ^([2])([0])([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$ | Ende der Periode des Stapels Format: YYYYMMDD Siehe Anhang 2. |
| 17 | Bezeichnung | ^["][\w.-/ ]{0,30}["]$ | Bezeichnung des Stapels z.B. „Rechnungsausgang 09/2019“ |
| 18 | Diktatkürzel | ^["]([A-Z]{2}){0,2}["]$ | Kürzel in Großbuchstaben des Bearbeiters z.B. "MM" für Max Mustermann |
| 19 | Buchungstyp | ^[1-2]$ | 1 = Finanzbuchführung        (default) 2 = Jahresabschluss |
| 20 | Rechnungs- legungszweck | ^(0|30|40|50|64)$ | 0 = unabhängig        (default) 30 = Steuerrecht 40 = Kalkulatorik 50 = Handelsrecht 64 = IFRS |
| 21 | Festschreibung | ^(0|1)$ | 0 = keine Festschreibung 1 = Festschreibung        (default) |
| 22 | WKZ | ^["]([A-Z]{3})["]$ | ISO-Code der Währung "EUR" = default Liste der ISO-Codes |
| 23 | Reserviert | ^[]$ | Leerfeld |
| 24 | Derivatskennzeichen | ^["]["]$ | Leerfeld |
| 25 | Reserviert | ^[]$ | Leerfeld |
| 26 | Reserviert | ^[]$ | Leerfeld |
| 27 | Sachkonten- rahmen | ^["](\d{2}){0,2}["]$ | Sachkontenrahmen der für die Bewegungsdaten verwendet wurde |
| 28 | ID der Branchen- lösung | ^\d{0,4}$ | Falls eine spezielle DATEV Branchenlösung genutzt wird. |
| 29 | Reserviert | ^[]$ | Leerfeld |
| 30 | Reserviert | ^["]["]$ | Leerfeld |
| 31 | Anwendungs- information | ^["].{0,16}["]$ | Verarbeitungskennzeichen der abgebenden Anwendung z.B. „09/2019“ |
| # | Überschrift | Ausdruck | Beschreibung |
|-----|-------------------------------------------|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | Umsatz | ^\d{1,10}[,]\d{2}$ | Umsatz/Betrag für den Datensatz z.B.: 1234567890,12 Betrag muss positiv sein. |
| 2 | Soll-/Haben-Kennzeichen | ^["](S|H)["]$ | Soll-/Haben-Kennzeichnung bezieht sich auf das Feld #7 Konto S = SOLL (default) H = HABEN |
| 3 | WKZ Umsatz | ^["]([A-Z]{3})["]$ | ISO-Code der Währung #22 aus Header = default Liste der ISO-Codes |
| 4 | Kurs | ^([1-9]\d{0,3}[,]\d{2,6})$ | Wenn Umsatz in Fremdwährung bei #1 angegeben wird #004, 005 und 006 sind zu übergeben z.B.: 1234,123456 |
| 5 | Basisumsatz | ^(\d{1,10}[,]\d{2})$ | Siehe #004. z.B.: 1234567890,12 |
| 6 | WKZ Basisumsatz | | Siehe #004. Liste der ISO-Codes |
| 7 | Konto | ^(\d{1,9})$ | Sach- oder Personenkonto z.B. 8400 |
| 8 | Gegenkonto (ohne BU-Schlüssel) | ^(\d{1,9})$ | Sach- oder Personenkonto z.B. 70000 |
| 9 | BU-Schlüssel | ^(["]\d{4}["])$ | Steuerungskennzeichen zur Abbildung verschiedener Funktionen/Sachverhalte Weitere Details |
| 10 | Belegdatum | ^(\d{4})$ | Format: TTMM, z.B. 0105 Das Jahr wird immer aus dem Feld 13 des Headers ermittelt |
| 11 | Belegfeld 1 | ^(["][\w$%\-\/]{0,36}["])$ | Rechnungs-/Belegnummer Wird als "Schlüssel" für den Ausgleich offener Rechnungen genutzt z.B. "Rg32029/2019" Sonderzeichen: $ & % * + - / Andere Zeichen sind unzulässig (insbesondere Leerzeichen, Umlaute, Punkt, Komma, Semikolon und Doppelpunkt). |
| 12 | Belegfeld 2 | ^(["][\w$%\-\/]{0,12}["])$ | Mehrere Funktionen Details siehe hier |
| 13 | Skonto | ^([1-9]\d{0,7}[,]\d{2})$ | Skontobetrag z.B. 3,71 nur bei Zahlungsbuchungen zulässig |
| 14 | Buchungstext | ^(["].{0,60}["])$ | 0-60 Zeichen |
| 15 | Postensperre | ^(0|1)$ | Mahn- oder Zahlsperre 0 = keine Sperre (default) 1 = Sperre Die Rechnung kann aus dem Mahnwesen / Zahlungsvorschlag ausgeschlossen werden. |
| 16 | Diverse Adressnummer | ^(["]\w{0,9}["])$ | Adressnummer einer diversen Adresse. #OPOS |
| 17 | Geschäftspartnerbank | ^(\d{3})$ | Referenz um für Lastschrift oder Zahlung eine bestimmte Geschäftspartnerbank genutzt werden soll. #OPOS Beim Import der Geschäftspartnerbank muss auch das Feld SEPA-Mandatsreferenz (Feld-Nr. 105) gefüllt sein. |
| 18 | Sachverhalt | ^(\d{2})$ | Kennzeichen für einen Mahnzins/Mahngebühr-Datensatz 31 = Mahnzins 40 = Mahngebühr #OPOS |
| 19 | Zinssperre | ^(0|1)$ | Sperre für Mahnzinsen 0 = keine Sperre (default) 1 = Sperre #OPOS |
| 20 | Beleglink | Generell:^(["].{0,210}["])$ Konkret für Link in eine DATEV App:^ ["](BEDI|DDMS|DORG)[ ]["] ["][<GUID>]["]["]["]$ | Link zu einem digitalen Beleg in einer DATEV App. BEDI = Unternehmen online Der Beleglink besteht aus einem Programmkürzel und der GUID. Da das Feld Beleglink ein Textfeld ist, müssen in der Schnittstellendatei die Anführungszeichen verdoppelt werden. z.B. "BEDI ""f9a0475d-d0df…""" |
| 21 | Beleginfo -Art 1 | ^(["].{0,20}["])$ | Bei einem DATEV-Format, das aus einem DATEV-Rechnungswesen-Programm erstellt wurde, können diese Felder Informationen aus einem Beleg (z. B. einem elektronischen Kontoumsatz) enthalten. Wird die Feldlänge eines Beleginfo-Inhalts-Feldes überschrit- ten, wird die Information im nächsten Beleginfo-Feld weitergeführt. Wichtiger Hinweis Eine Beleginfo besteht immer aus den Bestandteilen Beleginfo-Art und Beleginfo-Inhalt. Wenn Sie die Beleginfo nutzen möchten, füllen Sie bitte immer beide Felder. Beispiel: Beleginfo-Art: Kontoumsätze der jeweiligen Bank Beleginfo-Inhalt: Buchungsspezifische Inhalte zu den oben genannten Informationsarten |
| 22 | Beleginfo -Inhalt 1 | ^(["].{0,210}["])$ | siehe #21 |
| 23 | Beleginfo -Art 2 | ^(["].{0,20}["])$ | siehe #21 |
| 24 | Beleginfo -Inhalt 2 | ^(["].{0,210}["])$ | siehe #21 |
| 25 | Beleginfo -Art 3 | ^(["].{0,20}["])$ | siehe #21 |
| 26 | Beleginfo -Inhalt 3 | ^(["].{0,210}["])$ | siehe #21 |
| 27 | Beleginfo -Art 4 | ^(["].{0,20}["])$ | siehe #21 |
| 28 | Beleginfo -Inhalt 4 | ^(["].{0,210}["])$ | siehe #21 |
| 29 | Beleginfo -Art 5 | ^(["].{0,20}["])$ | siehe #21 |
| 30 | Beleginfo -Inhalt 5 | ^(["].{0,210}["])$ | siehe #21 |
| 31 | Beleginfo -Art 6 | ^(["].{0,20}["])$ | siehe #21 |
| 32 | Beleginfo -Inhalt 6 | ^(["].{0,210}["])$ | siehe #21 |
| 33 | Beleginfo -Art 7 | ^(["].{0,20}["])$ | siehe #21 |
| 34 | Beleginfo -Inhalt 7 | ^(["].{0,210}["])$ | siehe #21 |
| 35 | Beleginfo -Art 8 | ^(["].{0,20}["])$ | siehe #21 |
| 36 | Beleginfo -Inhalt 8 | ^(["].{0,210}["])$ | siehe #21 |
| 37 | KOST1 -Kostenstelle | ^(["][\w ]{0,36}["])$ | Über KOST1 erfolgt die Zuordnung des Geschäftsvorfalls für die anschließende Kostenrechnung. Die benutzte Länge muss vorher in den Stammdaten vom KOST-Programm eingestellt werden. |
| 38 | KOST2 -Kostenstelle | ^(["][\w ]{0,36}["])$ | Über KOST2 erfolgt die Zuordnung des Geschäftsvorfalls für die anschließende Kostenrechnung. Die benutzte Länge muss vorher in den Stammdaten vom KOST-Programm eingestellt werden. |
| 39 | KOST-Menge | ^\d{12}[,]\d{4}$ | Im KOST-Mengenfeld wird die Wertgabe zu einer bestimmten Bezugsgröße für eine Kostenstelle erfasst. Diese Bezugsgröße kann z. B. kg, g, cm, m, % sein. Die Bezugsgröße ist definiert in den Kostenrechnungs-Stammdaten. Beispiel:123123123,1234 |
| 40 | EU-Mitgliedstaat u. UStID (Bestimmung) | ^(["].{0,15}["])$ | Die USt-IdNr. besteht aus - 2-stelligen Länderkürzel (siehe Dok.-Nr. 1080169; Ausnahme Griechenland und Nordirland: Das Länderkürzel lautet EL für Griechenland und XI für Nordirland) - 13-stelliger USt-IdNr. - Beispiel: DE133546770. Die USt-IdNr kann auch Buchstaben haben, z.B.: bei Österreich Detaillierte Informationen zur Erfassung von EU-Informationen im Buchungssatz: Dok.-Nr: 9211462. |
| 41 | EU-Steuersatz (Bestimmung) | ^\d{2}[,]\d{2}$ | Nur für entsprechende EU-Buchungen: Der im EU-Bestimmungsland gültige Steuersatz. Beispiel: 12,12 |
| 42 | Abw. Versteuerungsart | ^(["](I|K|P|S)["])$ | Für Buchungen, die in einer von der Mandantenstammdaten- Schlüsselung abweichenden Umsatzsteuerart verarbeitet werden sollen, kann die abweichende Versteuerungsart im Buchungssatz übergeben werden: I = Ist-Versteuerung K = keine Umsatzsteuerrechnung P = Pauschalierung (z. B. für Land- und Forstwirtschaft) S = Soll-Versteuerung |
| 43 | Sachverhalt L+L | ^(\d{1,3})$ | Sachverhalte gem. § 13b Abs. 1 Satz 1 Nrn. 1.-5. UStG Achtung: Der Wert 0 ist unzulässig. Sachverhalts-Nummer siehe Info-Doku 1034915 |
| 44 | Funktionsergänzung L+L | ^\d{0,3}$ | Steuersatz / Funktion zum L+L-Sachverhalt Achtung: Der Wert 0 ist unzulässig. Beispiel: Wert 190 für 19% |
| 45 | BU 49 Hauptfunktiontyp | ^\d$ | Bei Verwendung des BU-Schlüssels 49 für „andere Steuer- sätze“ muss der steuerliche Sachverhalt mitgegeben werden |
| 46 | BU 49 Hauptfunktionsnummer | ^\d{0,2}$ | siehe #45 |
| 47 | BU 49 Funktionsergänzung | ^\d{0,3}$ | siehe #45 |
| 48 | Zusatzinformation Art 1 | ^(["].{0,20}["])$ | Zusatzinformationen, die zu Buchungssätzen erfasst werden können. Diese Zusatzinformationen besitzen den Charakter eines Notizzettels und können frei erfasst werden. Wichtiger Hinweis Eine Zusatzinformation besteht immer aus den Bestandtei- len Informationsart und Informationsinhalt. Wenn Sie die Zusatzinformation nutzen möchten, füllen Sie bitte immer beide Felder. Beispiel: Informationsart, z. B. Filiale oder Mengengrößen (qm) Informationsinhalt: buchungsspezifische Inhalte zu den oben genannten Informationsarten. |
| 49 | Zusatzinformation Inhalt 1 | ^(["].{0,210}["])$ | siehe #48 |
| 50 | Zusatzinformation Art 2 | ^(["].{0,20}["])$ | siehe #48 |
| 51 | Zusatzinformation Inhalt 2 | ^(["].{0,210}["])$ | siehe #48 |
| 52 | Zusatzinformation Art 3 | ^(["].{0,20}["])$ | siehe #48 |
| 53 | Zusatzinformation Inhalt 3 | ^(["].{0,210}["])$ | siehe #48 |
| 54 | Zusatzinformation Art 4 | ^(["].{0,20}["])$ | siehe #48 |
| 55 | Zusatzinformation Inhalt 4 | ^(["].{0,210}["])$ | siehe #48 |
| 56 | Zusatzinformation Art 5 | ^(["].{0,20}["])$ | siehe #48 |
| 57 | Zusatzinformation Inhalt 5 | ^(["].{0,210}["])$ | siehe #48 |
| 58 | Zusatzinformation Art 6 | ^(["].{0,20}["])$ | siehe #48 |
| 59 | Zusatzinformation Inhalt 6 | ^(["].{0,210}["])$ | siehe #48 |
| 60 | Zusatzinformation Art 7 | ^(["].{0,20}["])$ | siehe #48 |
| 61 | Zusatzinformation Inhalt 7 | ^(["].{0,210}["])$ | siehe #48 |
| 62 | Zusatzinformation Art 8 | ^(["].{0,20}["])$ | siehe #48 |
| 63 | Zusatzinformation Inhalt 8 | ^(["].{0,210}["])$ | siehe #48 |
| 64 | Zusatzinformation Art 9 | ^(["].{0,20}["])$ | siehe #48 |
| 65 | Zusatzinformation Inhalt 9 | ^(["].{0,210}["])$ | siehe #48 |
| 66 | Zusatzinformation Art 10 | ^(["].{0,20}["])$ | siehe #48 |
| 67 | Zusatzinformation Inhalt 10 | ^(["].{0,210}["])$ | siehe #48 |
| 68 | Zusatzinformation Art 11 | ^(["].{0,20}["])$ | siehe #48 |
| 69 | Zusatzinformation Inhalt 11 | ^(["].{0,210}["])$ | siehe #48 |
| 70 | Zusatzinformation Art 12 | ^(["].{0,20}["])$ | siehe #48 |
| 71 | Zusatzinformation Inhalt 12 | ^(["].{0,210}["])$ | siehe #48 |
| 72 | Zusatzinformation Art 13 | ^(["].{0,20}["])$ | siehe #48 |
| 73 | Zusatzinformation Inhalt 13 | ^(["].{0,210}["])$ | siehe #48 |
| 74 | Zusatzinformation Art 14 | ^(["].{0,20}["])$ | siehe #48 |
| 75 | Zusatzinformation Inhalt 14 | ^(["].{0,210}["])$ | siehe #48 |
| 76 | Zusatzinformation Art 15 | ^(["].{0,20}["])$ | siehe #48 |
| 77 | Zusatzinformation Inhalt 15 | ^(["].{0,210}["])$ | siehe #48 |
| 78 | Zusatzinformation Art 16 | ^(["].{0,20}["])$ | siehe #48 |
| 79 | Zusatzinformation Inhalt 16 | ^(["].{0,210}["])$ | siehe #48 |
| 80 | Zusatzinformation Art 17 | ^(["].{0,20}["])$ | siehe #48 |
| 81 | Zusatzinformation Inhalt 17 | ^(["].{0,210}["])$ | siehe #48 |
| 82 | Zusatzinformation Art 18 | ^(["].{0,20}["])$ | siehe #48 |
| 83 | Zusatzinformation Inhalt 18 | ^(["].{0,210}["])$ | siehe #48 |
| 84 | Zusatzinformation Art 19 | ^(["].{0,20}["])$ | siehe #48 |
| 85 | Zusatzinformation Inhalt 19 | ^(["].{0,210}["])$ | siehe #48 |
| 86 | Zusatzinformation Art 20 | ^(["].{0,20}["])$ | siehe #48 |
| 87 | Zusatzinformation Inhalt 20 | ^(["].{0,210}["])$ | siehe #48 |
| 88 | Stück | ^\d{0,8}$ | Wirkt sich nur bei Sachverhalt mit SKR 14 Land- und Forst- wirtschaft aus, für andere SKR werden die Felder beim Import / Export überlesen bzw. leer exportiert. |
| 89 | Gewicht | ^(\d{1,8}[,]\d{2})$ | siehe #88 |
| 90 | Zahlweise | ^\d{0,2}$ | OPOS-Informationen 1 = Lastschrift 2 = Mahnung 3 = Zahlung |
| 91 | Forderungsart | ^(["]\w{0,10}["])$ | OPOS-Informationen |
| 92 | Veranlagungsjahr | ^(([2])([0])([0-9]{2}))$ | OPOS-Informationen Format: JJJJ |
| 93 | Zugeordnete Fälligkeit | ^((0[1-9]|[1-2][0-9]|3[0-1])(0[1-9]|1[0-2])([2])([0])([0-9]{2}))$ | OPOS-Informationen Format: TTMMJJJJ |
| 94 | Skontotyp | ^\d$ | 1 = Einkauf von Waren 2 = Erwerb von Roh-Hilfs- und Betriebsstoffen |
| 95 | Auftragsnummer | ^(["].{0,30}["])$ | Allgemeine Bezeichnung, des Auftrags / Projekts. Mit der Auftragsnummer muss auch der Buchungstyp (Feld 96) angegeben werden. |
| 96 | Buchungstyp | ^(["][A-Z]{2}["])$ | AA = Angeforderte Anzahlung / Abschlagsrechnung AG = Erhaltene Anzahlung (Geldeingang) AV = Erhaltene Anzahlung (Verbindlichkeit) SR = Schlussrechnung SU = Schlussrechnung (Umbuchung) SG = Schlussrechnung (Geldeingang) SO = Sonstige |
| 97 | USt-Schlüssel (Anzahlungen) | ^\d{0,2}$ | USt-Schlüssel der späteren Schlussrechnung |
| 98 | EU-Mitgliedstaat (Anzahlungen) | ^(["][A-Z]{2}["])$ | EU-Mitgliedstaat der späteren Schlussrechnung siehe Info-Doku 1080169 |
| 99 | Sachverhalt L+L (Anzahlungen) | ^\d{0,3}$ | L+L-Sachverhalt der späteren Schlussrechnung Sachverhalte gem. § 13b UStG Achtung: Der Wert 0 ist unzulässig. Sachverhalts-Nummer siehe Info-Doku 1034915 |
| 100 | EU-Steuersatz (Anzahlungen) | ^(\d{1,2}[,]\d{2})$ | EU-Steuersatz der späteren Schlussrechnung Nur für entsprechende EU-Buchungen: Der im EU-Bestimmungsland gültige Steuersatz. Beispiel: 12,12 |
| 101 | Erlöskonto (Anzahlungen) | ^(\d{4,8})$ | Erlöskonto der späteren Schlussrechnung |
| 102 | Herkunft-Kz | ^(["][A-Z]{2}["])$ | Wird beim Import durch SV (Stapelverarbeitung) ersetzt. |
| 103 | Leerfeld | ^(["].{0,36}["])$ | Wird von DATEV verwendet |
| 104 | KOST-Datum | ^((0[1-9]|[1-2]\d|3[0-1])(0[1-9]|1[0-2])([2])([0])(\d{2}))$ | Format TTMMJJJJ |
| 105 | SEPA-Mandatsreferenz | ^(["].{0,35}["])$ | Vom Zahlungsempfänger individuell vergebenes Kennzeichen eines Mandats (z.B. Rechnungs- oder Kundennummer). Beim Import der SEPA-Mandatsreferenz muss auch das Feld Geschäftspartnerbank (Feld-Nr. 17) gefüllt sein. |
| 106 | Skontosperre | ^[0|1]$ | Gültige Werte: 0, 1. 1 = Skontosperre 0 = Keine Skontosperre |
| 107 | Gesellschaftername | ^(["].{0,76}["])$ | |
| 108 | Beteiligtennummer | ^(\d{4})$ | Die Beteiligtennummer muss der amtlichen Nummer aus der Feststellungserklärung entsprechen, diese darf nicht beliebig vergeben werden. Die Pflege der Gesellschafterdaten und das Anlegen von Sonderbilanzsachverhalte ist nur in Absprache mit der Steuerkanzlei möglich. Betrifft Feld 107-110. |
| 109 | Identifikationsnummer | ^(["].{0,11}["])$ | |
| 110 | Zeichnernummer | ^(["].{0,20}["])$ | |
| 111 | Postensperre bis | ^((0[1-9]|[1-2]\d|3[0-1])(0[1-9]|1[0-2])([2])([0])(\d{2}))$ | Format TTMMJJJJ |
| 112 | Bezeichnung SoBil-Sachverhalt | ^(["].{0,30}["])$ | |
| 113 | Kennzeichen SoBil-Buchung | ^(\d{1,2})$ | Sobil-Buchung erzeugt = 1 Sobil-Buchung nicht erzeugt = (Default) bzw. 0 |
| 114 | Festschreibung | ^(0|1)$ | leer = nicht definiert; wird automatisch festgeschrieben 0 = keine Festschreibung 1 = Festschreibung Hat ein Buchungssatz in diesem Feld den Inhalt 1, so wird der gesamte Stapel nach dem Import festgeschrieben. |
| 115 | Leistungsdatum | ^((0[1-9]|[1-2]\d|3[0-1])(0[1-9]|1[0-2])([2])([0])(\d{2}))$ | Format TTMMJJJJ siehe Info-Doku 9211426 Beim Import des Leistungsdatums muss das Feld „116 Datum Zuord. Steuer-periode“ gefüllt sein. Der Einsatz des Leistungsdatums muss in Absprache mit dem Steuerberater erfolgen. |
| 116 | Datum Zuord. Steuerperiode | ^((0[1-9]|[1-2]\d|3[0-1])(0[1-9]|1[0-2])([2])([0])(\d{2}))$ | Format TTMMJJJJ |
| 117 | Fälligkeit | ^((0[1-9]|[1-2]\d|3[0-1])(0[1-9]|1[0-2])([2])([0])(\d{2}))$ | OPOS Informationen, Format: TTMMJJJJ OPOS-Verarbeitungsinformationen über Belegfeld 2 (Feldnummer 12) sind in diesem Fall nicht nutzbar |
| 118 | Generalumkehr | ^(["](0|1)["])$ | G oder 1 = Generalumkehr 0 = keine Generalumkehr |
| 119 | Steuersatz | ^(\d{1,2}[,]\d{2})$ | Wird bei Verwendung von BU-Schlüssel ohne festen Steuersatz benötigt (z. B. BU-Schlüssel 100). Weitere Informationen unter Dok.Nr. 9231347 Kapitel „Erfassung eines Steuersatzes bei Steuerschlüsseln“ |
| 120 | Land | ^(["][A-Z]{2}["])$ | Beispiel: DE für Deutschland |
| 121 | Abrechnungsreferenz | ^(["].{0,50}["])$ | Die Abrechnungsreferenz stellt eine Klammer über alle Transaktionen des Zahlungsdienstleisters und die dazu gehörige Auszahlung dar. Sie wird über den Zahlungsdatenservice bereitgestellt und bei der Erzeugung von Buchungsvorschläge berücksichtigt. |
| 122 | BVV-Position (Betriebsvermögensvergleich) | ^([1|2|3|4|5])$ | Details zum Feld siehe hier 1 Kapitalanpassung 2 Entnahme / Ausschüttung lfd. WJ 3 Einlage / Kapitalzuführung lfd. WJ 4 Übertragung § 6b Rücklage 5 Umbuchung (keine Zuordnung) |
| 123 | EU-Mitgliedstaat u. UStID (Ursprung) | ^(["].{0,15}["])$ | Die USt-IdNr. besteht aus - 2-stelligen Länderkürzel (siehe Dok.-Nr. 1080169) Ausnahme Griechenland: Das Länderkürzel lautet EL) - 13-stelliger USt-IdNr. - Beispiel: DE133546770. Die USt-IdNr kann auch Buchstaben haben, z.B.: bei Österreich Detaillierte Informationen zur Erfassung von EU-Informationen im Buchungssatz: Dok.-Nr: 9211462. |
| 124 | EU-Steuersatz (Ursprung) | ^\d{2}[,]\d{2}$ | Nur für entsprechende EU-Buchungen: Der im EU-Ursprungsland gültige Steuersatz. Beispiel: 12,12 |
*/
+26 -31
View File
@@ -569,6 +569,10 @@ class Firmendaten {
public function FirmendatenEdit() public function FirmendatenEdit()
{ {
// Make sure the default values are all there, otherwise they are not editable
$this->app->erp->StandardFirmendatenWerte();
if($this->app->Secure->GetPOST('installnewpayent')) { if($this->app->Secure->GetPOST('installnewpayent')) {
$this->checkPaymentModules(true); $this->checkPaymentModules(true);
} }
@@ -1016,38 +1020,26 @@ class Firmendaten {
,'zahlungszielskonto','kleinunternehmer','schnellanlegen','bestellvorschlaggroessernull','immernettorechnungen','rechnung_header','rechnung_footer', ,'zahlungszielskonto','kleinunternehmer','schnellanlegen','bestellvorschlaggroessernull','immernettorechnungen','rechnung_header','rechnung_footer',
'lieferschein_header','lieferschein_footer','auftrag_header','auftrag_footer','angebot_header','angebot_footer','gutschrift_header','gutschrift_footer','bestellung_header','bestellung_footer', 'lieferschein_header','lieferschein_footer','auftrag_header','auftrag_footer','angebot_header','angebot_footer','gutschrift_header','gutschrift_footer','bestellung_header','bestellung_footer',
'arbeitsnachweis_header','arbeitsnachweis_footer','provisionsgutschrift_header','provisionsgutschrift_footer','proformarechnung_header','proformarechnung_footer','eu_lieferung_vermerk','export_lieferung_vermerk' 'arbeitsnachweis_header','arbeitsnachweis_footer','provisionsgutschrift_header','provisionsgutschrift_footer','proformarechnung_header','proformarechnung_footer','eu_lieferung_vermerk','export_lieferung_vermerk'
,'wareneingang_kamera_waage','layout_iconbar','passwort','host','port','mailssl','signatur','email','absendername','bcc1','bcc2' ,'wareneingang_kamera_waage','layout_iconbar','passwort','host','port','mailssl','signatur','email','absendername','bcc1','bcc2','bcc3'
,'firmenfarbe','name','strasse','plz','ort','steuernummer','projekt','steuer_positionen_export','tabsnavigationfarbe','tabsnavigationfarbeschrift' ,'firmenfarbe','name','strasse','plz','ort','steuernummer','projekt','steuer_positionen_export','tabsnavigationfarbe','tabsnavigationfarbeschrift'
,"buchhaltung_berater","buchhaltung_mandant","buchhaltung_wj_beginn","buchhaltung_sachkontenlaenge"
); );
if(isset($sql2a)){ if(isset($sql2a)){
unset($sql2a); unset($sql2a);
} }
/*
foreach($toupdate as $v) {
$sql2a[] = $v ." = '".$data[$v]."' ";
}
$sql2 = "UPDATE firmendaten SET ".implode(',',$sql2a)." WHERE firma = '$id' LIMIT 1";
unset($sql2a);
$this->app->DB->Update($sql2);
*/
// if($this->app->DB->error()) {
foreach($toupdate as $v) { foreach($toupdate as $v) {
$check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$v'"); $check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$v'");
if ($check) { if ($check) {
$this->app->DB->Update("UPDATE firmendaten SET ".$v." = '".($data[$v])."'"." WHERE firma = '$id' LIMIT 1"); $this->app->DB->Update("UPDATE firmendaten SET ".$v." = '".($data[$v])."'"." WHERE firma = '$id' LIMIT 1");
} }
} }
// }
if (isset($firmendaten_werte_spalten)) { if (isset($firmendaten_werte_spalten)) {
foreach($toupdate as $key) { foreach($toupdate as $key) {
if(isset($firmendaten_werte_spalten[$key]) && $firmendaten_werte_spalten[$key]['wert'] != $data[$key]) { if(isset($firmendaten_werte_spalten[$key])) {
if ($firmendaten_werte_spalten[$key]['wert'] != $data[$key]) {
$this->app->DB->Update("UPDATE firmendaten_werte SET wert = '".$data[$key]."' WHERE id = '".$firmendaten_werte_spalten[$key]['id']."' LIMIT 1"); $this->app->DB->Update("UPDATE firmendaten_werte SET wert = '".$data[$key]."' WHERE id = '".$firmendaten_werte_spalten[$key]['id']."' LIMIT 1");
unset($firmendaten_werte_spalten[$key]); unset($firmendaten_werte_spalten[$key]);
if(!empty($doubletes[$key])) { if(!empty($doubletes[$key])) {
@@ -1061,10 +1053,13 @@ class Firmendaten {
unset($doubletes[$key]); unset($doubletes[$key]);
} }
} }
} else {
// Create new value in firmendaten_werte
$sql = "INSERT INTO firmendaten_werte (name, wert) VALUES('$key', '".$data[$key]."')";
$this->app->DB->Update($sql);
}
} }
} }
for($i = 0; $i <= 3; $i++) { for($i = 0; $i <= 3; $i++) {
for($j = 0; $j <= 5; $j++) { for($j = 0; $j <= 5; $j++) {
@@ -1072,23 +1067,12 @@ class Firmendaten {
} }
} }
/* foreach($toupdate2 as $k => $v) {
$sql2a[] = $k ." = '".$v."' ";
}
$sql2 = "UPDATE firmendaten SET ".implode(',',$sql2a)." WHERE firma = '$id' LIMIT 1";
unset($sql2a);
$this->app->DB->Update($sql2);
*/
// if($this->app->DB->error()) {
foreach($toupdate2 as $k => $v) { foreach($toupdate2 as $k => $v) {
$check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$k'"); $check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$k'");
if ($check) { if ($check) {
$this->app->DB->Update("UPDATE firmendaten SET ".$k." = '".$v."'"." WHERE firma = '$id' LIMIT 1"); $this->app->DB->Update("UPDATE firmendaten SET ".$k." = '".$v."'"." WHERE firma = '$id' LIMIT 1");
} }
} }
// }
if(isset($firmendaten_werte_spalten)) { if(isset($firmendaten_werte_spalten)) {
foreach($toupdate2 as $key => $v) { foreach($toupdate2 as $key => $v) {
@@ -1400,6 +1384,9 @@ class Firmendaten {
if(!isset($data[0][$v['name']])){ if(!isset($data[0][$v['name']])){
$data[0][$v['name']] = $v['wert']; $data[0][$v['name']] = $v['wert'];
} }
// Fill all fields
$this->app->Tpl->Set(strtoupper($v['name']), $v['wert']);
} }
} }
@@ -1719,6 +1706,7 @@ class Firmendaten {
$this->app->Tpl->Set('ABSENDERNAME' , $data[0]['absendername']); $this->app->Tpl->Set('ABSENDERNAME' , $data[0]['absendername']);
$this->app->Tpl->Set('BCC1' , $data[0]['bcc1']); $this->app->Tpl->Set('BCC1' , $data[0]['bcc1']);
$this->app->Tpl->Set('BCC2' , $data[0]['bcc2']); $this->app->Tpl->Set('BCC2' , $data[0]['bcc2']);
$this->app->Tpl->Set('BCC3' , $data[0]['bcc3']);
$this->app->Tpl->Set('FIRMENFARBE' , $data[0]['firmenfarbe']); $this->app->Tpl->Set('FIRMENFARBE' , $data[0]['firmenfarbe']);
$this->app->Tpl->Set('NAME' , $data[0]['name']); $this->app->Tpl->Set('NAME' , $data[0]['name']);
$this->app->Tpl->Set('STRASSE' , $data[0]['strasse']); $this->app->Tpl->Set('STRASSE' , $data[0]['strasse']);
@@ -2073,14 +2061,15 @@ class Firmendaten {
$this->app->Tpl->Set('ABSENDERNAME' , $data['absendername']); $this->app->Tpl->Set('ABSENDERNAME' , $data['absendername']);
$this->app->Tpl->Set('BCC1' , $data['bcc1']); $this->app->Tpl->Set('BCC1' , $data['bcc1']);
$this->app->Tpl->Set('BCC2' , $data['bcc2']); $this->app->Tpl->Set('BCC2' , $data['bcc2']);
$this->app->Tpl->Set('BCC3' , $data['bcc3']);
$this->app->Tpl->Set('FIRMENFARBE' , $data['firmenfarbe']); $this->app->Tpl->Set('FIRMENFARBE' , $data['firmenfarbe']);
$this->app->Tpl->Set('NAME' , $data['name']); $this->app->Tpl->Set('NAME' , $data['name']);
$this->app->Tpl->Set('STRASSE' , $data['strasse']); $this->app->Tpl->Set('STRASSE' , $data['strasse']);
$this->app->Tpl->Set('PLZ' , $data['plz']); $this->app->Tpl->Set('PLZ' , $data['plz']);
$this->app->Tpl->Set('ORT' , $data['ort']); $this->app->Tpl->Set('ORT' , $data['ort']);
$this->app->Tpl->Set('STEUERNUMMER' , $data['steuernummer']); $this->app->Tpl->Set('STEUERNUMMER' , $data['steuernummer']);
}
}
/** /**
* @return array * @return array
*/ */
@@ -2224,6 +2213,7 @@ class Firmendaten {
$data['absendername'] = ($this->app->Secure->POST["absendername"]); $data['absendername'] = ($this->app->Secure->POST["absendername"]);
$data['bcc1'] = ($this->app->Secure->POST["bcc1"]); $data['bcc1'] = ($this->app->Secure->POST["bcc1"]);
$data['bcc2'] = ($this->app->Secure->POST["bcc2"]); $data['bcc2'] = ($this->app->Secure->POST["bcc2"]);
$data['bcc3'] = ($this->app->Secure->POST["bcc3"]);
$data['name'] = ($this->app->Secure->POST["name"]); $data['name'] = ($this->app->Secure->POST["name"]);
$data['firmenfarbe'] = ($this->app->Secure->POST["firmenfarbe"]); $data['firmenfarbe'] = ($this->app->Secure->POST["firmenfarbe"]);
$data['strasse'] = ($this->app->Secure->POST["strasse"]); $data['strasse'] = ($this->app->Secure->POST["strasse"]);
@@ -2265,6 +2255,12 @@ class Firmendaten {
$data['sprachebevorzugen'] = ($this->app->Secure->POST["sprachebevorzugen"]); $data['sprachebevorzugen'] = ($this->app->Secure->POST["sprachebevorzugen"]);
// Buchhaltung export datev
$data['buchhaltung_berater'] = ($this->app->Secure->POST["buchhaltung_berater"]);
$data['buchhaltung_mandant'] = ($this->app->Secure->POST["buchhaltung_mandant"]);
$data['buchhaltung_wj_beginn'] = ($this->app->Secure->POST["buchhaltung_wj_beginn"]);
$data['buchhaltung_sachkontenlaenge'] = ($this->app->Secure->POST["buchhaltung_sachkontenlaenge"]);
return $data; return $data;
} }
@@ -3110,7 +3106,6 @@ class Firmendaten {
$this->app->YUI->AutoComplete('document_project', 'projektname', 1); $this->app->YUI->AutoComplete('document_project', 'projektname', 1);
$this->app->Tpl->Add('TAB1', $table); $this->app->Tpl->Add('TAB1', $table);
//$this->app->Tpl->Set('TAB1', $ret); //$this->app->Tpl->Set('TAB1', $ret);
$this->app->Tpl->Parse('PAGE','tabview.tpl'); $this->app->Tpl->Parse('PAGE','tabview.tpl');
+64 -3
View File
@@ -1418,7 +1418,7 @@ class Importvorlage extends GenImportvorlage {
$ersterdatensatz = 1; $ersterdatensatz = 1;
$zeitstempel = time(); $zeitstempel = time();
$number_of_rows = count($tmp['cmd']); $number_of_rows = empty($tmp['cmd'])?0:count($tmp['cmd']);
$number_of_rows = $number_of_rows + 2; $number_of_rows = $number_of_rows + 2;
if($isCronjob) { if($isCronjob) {
@@ -1553,6 +1553,13 @@ class Importvorlage extends GenImportvorlage {
} }
} }
// HERE START OF PROCESSING OF THE ROWS
// INSIDE FOR LOOP
// $i -> loop counter row number starting with 1
// $number_of_rows
// access data -> $tmp['column_name'][$i]
// $tmp['cmd'] -> create or update
// $tmp['checked'] -> 0 or 1
switch($ziel) switch($ziel)
{ {
@@ -3739,7 +3746,7 @@ class Importvorlage extends GenImportvorlage {
} }
$altervk = $this->app->DB->Select("SELECT preis FROM verkaufspreise WHERE artikel='$artikelid' AND ab_menge='".$tmp['verkaufspreis'.$verkaufspreisanzahl.'menge'][$i]."' $altervk = $this->app->DB->Select("SELECT preis FROM verkaufspreise WHERE artikel='$artikelid' AND ab_menge='".$tmp['verkaufspreis'.$verkaufspreisanzahl.'menge'][$i]."'
AND (gueltig_bis='0000-00-00' OR gueltig_bis >=NOW() ) AND adresse <='$_kundenid' ".($gruppe?" AND gruppe = '".$gruppe."'":" AND (is_null(gruppe) or gruppe = '') ")." LIMIT 1"); AND (gueltig_bis='0000-00-00' OR gueltig_bis >=NOW() ) AND adresse <='$_kundenid' ".($gruppe?" AND gruppe = '".$gruppe."'":" AND ((gruppe IS NULL) or gruppe = '') ")." LIMIT 1");
if($altervk != str_replace(',','.',$tmp['verkaufspreis'.$verkaufspreisanzahl.'netto'][$i]) && str_replace(',','.',$tmp['verkaufspreis'.$verkaufspreisanzahl.'netto'][$i])) if($altervk != str_replace(',','.',$tmp['verkaufspreis'.$verkaufspreisanzahl.'netto'][$i]) && str_replace(',','.',$tmp['verkaufspreis'.$verkaufspreisanzahl.'netto'][$i]))
{ {
@@ -3755,7 +3762,7 @@ class Importvorlage extends GenImportvorlage {
//verkaufspreis3internerkommentar'][$i] //verkaufspreis3internerkommentar'][$i]
$this->app->DB->Update("UPDATE verkaufspreise SET gueltig_bis=DATE_SUB(NOW(),INTERVAL 1 DAY) $this->app->DB->Update("UPDATE verkaufspreise SET gueltig_bis=DATE_SUB(NOW(),INTERVAL 1 DAY)
WHERE artikel='".$artikelid."' AND adresse='$_kundenid' ".($gruppe?" AND gruppe = '".$gruppe."'":" AND (is_null(gruppe) or gruppe = '') ")." WHERE artikel='".$artikelid."' AND adresse='$_kundenid' ".($gruppe?" AND gruppe = '".$gruppe."'":" AND ((gruppe IS NULL) or gruppe = '') ")."
AND ab_menge='".$tmp['verkaufspreis'.$verkaufspreisanzahl.'menge'][$i]."' LIMIT 1"); AND ab_menge='".$tmp['verkaufspreis'.$verkaufspreisanzahl.'menge'][$i]."' LIMIT 1");
$verkaufspreis1stueckdivisor = 1; $verkaufspreis1stueckdivisor = 1;
@@ -5021,7 +5028,61 @@ class Importvorlage extends GenImportvorlage {
} }
} }
break; break;
case 'kontorahmen':
// Create a row dataset (without checked and cmd)
$update_sql = "";
$row = array();
$comma = "";
foreach ($tmp as $key => $value) {
if ($key != 'cmd' && $key != 'checked') {
$row[$key] = $value[$i];
$comma = ", ";
} }
}
if (empty($row['sachkonto'])) {
break;
}
$art_array = array(
'1' => 'Aufwendungen',
'2' => 'Erlöse',
'3' => 'Geldtransit',
'9' => 'Saldo'
);
$row['art'] = array_search($row['art'], $art_array);
$row['projekt'] = $this->app->erp->ReplaceProjekt(true,$row['projekt'],true); // Parameters: Target db?, value, from form?
$sql = "SELECT * FROM kontorahmen WHERE sachkonto = '".$row['sachkonto']."'";
$result = $this->app->DB->SelectArr($sql);
if (!empty($result)) {
$comma = "";
foreach ($row as $key => $value) {
$update_sql .= $comma."`".$key."` = '".$value."'";
$comma = ", ";
}
$sql = "UPDATE kontorahmen SET ".$update_sql." WHERE `sachkonto` = '".$row['sachkonto']."'";
$result = $this->app->DB->Update($sql);
} else {
$sql = "INSERT INTO kontorahmen (".
implode(", ",array_keys($row)).
") VALUES ('".
implode("', '",array_values($row)).
"')";
$result = $this->app->DB->Update($sql);
}
break;
}
// HERE END OF PROCESSING THE ROWS switch($ziel);
if($isCronjob) { if($isCronjob) {
$this->app->DB->Update( $this->app->DB->Update(
sprintf( sprintf(
+257
View File
@@ -0,0 +1,257 @@
<?php
/*
* Copyright (c) 2022 OpenXE project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Kontorahmen {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "kontorahmen_list");
$this->app->ActionHandler("create", "kontorahmen_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "kontorahmen_edit");
$this->app->ActionHandler("delete", "kontorahmen_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 "kontorahmen_list":
$allowed['kontorahmen_list'] = array('list');
$heading = array('', 'Sachkonto', 'Beschriftung', 'Art', 'Bemerkung', 'Projekt', 'Ausblenden', 'Men&uuml;');
$width = array( '1%','2%' , '10%', '2%', '10%', '2%', '1%', '1%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$art = "CASE
WHEN k.art = 1 THEN 'Aufwendungen'
WHEN k.art = 2 THEN 'Erl&ouml;se'
WHEN k.art = 3 THEN 'Geldtransit'
WHEN k.art = 9 THEN 'Saldo'
ELSE ''
END";
$findcols = array('','k.sachkonto', 'k.beschriftung', "($art)",'k.bemerkung', '(SELECT abkuerzung FROM projekt WHERE projekt.id = k.projekt LIMIT 1)', 'k.ausblenden');
$searchsql = array('k.sachkonto', 'k.beschriftung', 'k.bemerkung', 'k.art', 'k.projekt');
$defaultorder = 1;
$defaultorderdesc = 0;
$dropnbox = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',k.id,'\" />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=kontorahmen&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=kontorahmen&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
k.id,
$dropnbox,
if(k.ausblenden,CONCAT('<strike>', k.sachkonto,'</strike>'),k.sachkonto) AS sachkonto,
k.beschriftung,
$art
AS art,
k.bemerkung,
(SELECT abkuerzung FROM projekt WHERE projekt.id = k.projekt LIMIT 1),
k.ausblenden,
k.id
FROM kontorahmen k";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM kontorahmen WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function kontorahmen_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;
}
}
$sql = "DELETE FROM kontorahmen";
$sql .= " WHERE id IN (".implode(",",$selectedIds).")";
$this->app->DB->Update($sql);
}
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'kontorahmen_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "kontorahmen_list.tpl");
}
public function kontorahmen_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `kontorahmen` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->kontorahmen_list();
}
/*
* Edit kontorahmen item
* If id is empty, create a new one
*/
function kontorahmen_edit() {
$id = $this->app->Secure->GetGET('id');
// Check if other users are editing this id
if($this->app->erp->DisableModul('artikel',$id))
{
return;
}
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&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['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],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 kontorahmen (".$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=kontorahmen&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
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',k.id,'\" />') AS `auswahl`";
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS k.id, $dropnbox, k.sachkonto, k.beschriftung, k.bemerkung, k.ausblenden, k.art, k.projekt, k.id FROM kontorahmen k"." WHERE id=$id");
$result[0]['projekt'] = $this->app->erp->ReplaceProjekt(false,$result[0]['projekt'],false); // Parameters: Target db?, value, from form?
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->Tpl->Set('AUSBLENDEN', $result[0]['ausblenden']==1?"checked":"");
$this->app->YUI->AutoComplete("projekt","projektname",1);
$art_array = array(
'1' => 'Aufwendungen',
'2' => 'Erl&ouml;se',
'3' => 'Geldtransit',
'9' => 'Saldo'
);
$this->app->Tpl->Set('ART', $this->app->erp->GetSelectAsso($art_array,$result[0]['art']));
// $this->SetInput($input);
$this->app->Tpl->Parse('PAGE', "kontorahmen_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['sachkonto'] = $this->app->Secure->GetPOST('sachkonto');
$input['beschriftung'] = $this->app->Secure->GetPOST('beschriftung');
$input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung');
$input['ausblenden'] = !empty($this->app->Secure->GetPOST('ausblenden'))?"1":"0";
$input['art'] = $this->app->Secure->GetPOST('art');
$input['projekt'] = $this->app->Secure->GetPOST('projekt');
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('SACHKONTO', $input['sachkonto']);
$this->app->Tpl->Set('BESCHRIFTUNG', $input['beschriftung']);
$this->app->Tpl->Set('BEMERKUNG', $input['bemerkung']);
$this->app->Tpl->Set('AUSBLENDEN', $input['ausblenden']);
$this->app->Tpl->Set('ART', $input['art']);
$this->app->Tpl->Set('PROJEKT', $input['projekt']);
}
}
+227 -612
View File
@@ -18,93 +18,13 @@ class Lager extends GenLager {
/** @var Application $app */ /** @var Application $app */
var $app; var $app;
/**
* @param string $arttab
* @param string $tab1
* @param string $tab2
*
* @return string
*/
static function LetzterEK($arttab = 'art', $tab1 = 'e1', $tab2 = 'e')
{
return "
(
SELECT $tab2.artikel, $tab2.waehrung, $tab2.preis FROM
(SELECT max( $tab2.id ) AS id, artikel
FROM einkaufspreise $tab2
WHERE $tab2.geloescht !=1
AND (
ifnull($tab2.gueltig_bis,'0000-00-00') = '0000-00-00'
OR $tab2.gueltig_bis >= CURDATE( )
)
GROUP BY artikel) ".$tab1."
INNER JOIN einkaufspreise ".$tab2." ON $tab1.id = $tab2.id
)
";
}
/** /**
* @param string $typ * @param string $typ
* @param bool $live
* *
* @return string * @return string
*/ */
static function Waehrung($typ = 'letzterek', $live = true) static function Waehrung($typ = 'letzterek')
{ {
if(!$live)
{
switch($typ)
{
case 'letzterek':
return "if(ifnull(lw.preis_letzterek,0) <> 0,if(lw.waehrungletzt<>'',lw.waehrungletzt,'EUR'),if(ifnull(ek.waehrung,'')<>'',ek.waehrung,'EUR'))";
break;
case 'letzerekarchiv':
return "if(ifnull(lw.preis_letzterek,0) <> 0,if(lw.waehrungletzt<>'',lw.waehrungletzt,'EUR'),'EUR')";
break;
case 'inventurwertarchiv':
return "if(ifnull(lw.inventurwert,0) <> 0,'EUR',
if(ifnull(lw.preis_letzterek,0) <> 0,
if(lw.waehrungletzt <> '',lw.waehrungletzt,'EUR'),
'EUR'
)
)";
break;
case 'inventurwert':
return "if(ifnull(lw.inventurwert,0) <> 0,'EUR',
if(ifnull(art.inventurekaktiv,0) <> 0
, 'EUR',
if(ifnull(lw.preis_letzterek,0) <> 0,
if(lw.waehrungletzt <> '',lw.waehrungletzt,'EUR'),
if(ifnull(ek.waehrung,'')<>'',ek.waehrung,'EUR')
)
)
)";
break;
case 'kalkulierterekarchiv':
return "
if(
ifnull(lw.preis_kalkulierterek,0) <> 0
,
if(lw.waehrungkalk<>'',lw.waehrungkalk,'EUR')
,
if(ifnull(lw.preis_letzterek,0) <> 0,
if(lw.waehrungletzt<>'',lw.waehrungletzt,'EUR')
,'EUR'
)
)";
break;
default:
return "
if(ifnull(lw.preis_kalkulierterek,0) <> 0,if(lw.waehrungkalk<>'',lw.waehrungkalk,'EUR'),
if(ifnull(art.verwendeberechneterek,0) <> 0, if(ifnull(art.berechneterekwaehrung,'')<>'',art.berechneterekwaehrung,'EUR')
,
if(ifnull(lw.preis_letzterek,0) <> 0,if(lw.waehrungletzt<>'',lw.waehrungletzt,'EUR'),if(ifnull(ek.waehrung,'')<>'',ek.waehrung,'EUR'))
)
)";
break;
}
}else{
switch($typ) switch($typ)
{ {
case 'letzterek': case 'letzterek':
@@ -125,67 +45,40 @@ class Lager extends GenLager {
break; break;
} }
} }
/**
* @param string $typ
*
* @return string
*/
public static function PreisTypErgebnis(string $typ = 'letzterek') : string {
switch($typ)
{
case 'kalkulierterek':
return("if (art.verwendeberechneterek,'K','E')");
break;
case 'inventurwert':
return("if (art.inventurekaktiv,'I','E')");
break;
default:
case 'letzterek':
return("'E'");
break;
}
} }
/** /**
* @param string $typ * @param string $typ
* @param bool $live
* *
* @return string * @return string
*/ */
public static function EinzelPreis($typ = 'letzterek', $live = true) public static function EinzelPreis($typ = 'letzterek')
{
if(!$live)
{ {
switch($typ) switch($typ)
{ {
case 'letzterekarchiv':
return "if(ifnull(lw.preis_letzterek,0) <> 0,lw.preis_letzterek,0)";
break;
case 'letzterek': case 'letzterek':
return "if(ifnull(lw.preis_letzterek,0) <> 0,lw.preis_letzterek,ifnull(ek.preis,0))";
break;
case 'inventurwertarchiv':
return "if(ifnull(lw.inventurwert,0) <> 0,lw.inventurwert,
ifnull(lw.preis_letzterek,0)
)";
break;
case 'inventurwert':
return "if(ifnull(lw.inventurwert,0) <> 0,lw.inventurwert,
if(ifnull(art.inventurekaktiv,0) <> 0
, art.inventurek,
if(ifnull(lw.preis_letzterek,0) <> 0,lw.preis_letzterek,ifnull(ek.preis,0))
)
)";
break;
case 'kalkulierterekarchiv':
return "
if(
ifnull(lw.preis_kalkulierterek,0) <> 0,
lw.preis_kalkulierterek,
ifnull(lw.preis_letzterek,0)
)";
break;
default:
return "
if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.preis_kalkulierterek,
if(ifnull(art.verwendeberechneterek,0) <> 0,art.berechneterek
,if(ifnull(lw.preis_letzterek,0) <> 0,
lw.preis_letzterek,
ifnull(ek.preis,0)
)
)
)";
break;
}
}else{
switch($typ)
{
case 'letzterek':
case 'letzterekarchiv':
return "ifnull(ek.preis,0)"; return "ifnull(ek.preis,0)";
break; break;
case 'inventurwertarchiv':
case 'inventurwert': case 'inventurwert':
return "if(ifnull(art.inventurekaktiv,0) <> 0,art.inventurek,ifnull(ek.preis,0))"; return "if(ifnull(art.inventurekaktiv,0) <> 0,art.inventurek,ifnull(ek.preis,0))";
break; break;
@@ -199,192 +92,6 @@ class Lager extends GenLager {
break; break;
} }
} }
}
/**
* @param string $typ
* @param bool $live
*
* @return string
*/
public static function KursJoin($typ, $live = true)
{
return " LEFT JOIN (
SELECT max(kurs) as kurs, waehrung_von, waehrung_nach FROM waehrung_umrechnung WHERE (isnull(gueltig_bis) OR gueltig_bis >= now() OR gueltig_bis = '0000-00-00') AND (waehrung_von LIKE 'EUR' OR waehrung_nach LIKE 'EUR') GROUP BY waehrung_von,waehrung_nach
) wt ON wt.waehrung_nach <> 'EUR' AND wt.waehrung_nach = ".self::Waehrung($typ, $live)." OR wt.waehrung_von <> 'EUR' AND wt.waehrung_von = ".self::Waehrung($typ, $live)." ";
}
/**
* @param Application $app
* @param string $typ
* @param null|bool $live
*
* @return string
*/
public static function PreisUmrechnung($app, $typ, $live = null)
{
$kursusd = $app->erp->GetWaehrungUmrechnungskurs('EUR','USD');
$kurschf = $app->erp->GetWaehrungUmrechnungskurs('EUR','CHF');
if(!$live)
{
return '
if(
ifnull(lw.kursletzt,0)<> 0
,
1 / lw.kursletzt
,
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = '.self::Waehrung($typ, $live).',
(1/wt.kurs),
wt.kurs
)
,
if('.self::Waehrung($typ, $live).' = \'USD\',
1.0 / '.$kursusd.',
if('.self::Waehrung($typ, $live).' = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
)
*
'.self::EinzelPreis($typ, $live);
}
return '
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = '.self::Waehrung($typ, $live).',
(1/wt.kurs),
wt.kurs
)
,
if('.self::Waehrung($typ, $live).' = \'USD\',
1.0 / '.$kursusd.',
if('.self::Waehrung($typ, $live).' = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
*
'.self::EinzelPreis($typ, $live);
/*
if(!$live)
{//aus Cronjob
if($typ == 'letzterek')
{
return '
if(
ifnull(lw.kursletzt,0)<> 0
,
1 / lw.kursletzt
,
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = lw.waehrungletzt,
(1/wt.kurs),
wt.kurs
)
,
if(lw.waehrungletzt = \'USD\',
1.0 / '.$kursusd.',
if(lw.waehrungletzt = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
)
* ifnull(lw.preis_letzterek,0)
';
}else{
return '
if(
if(ifnull(lw.preis_kalkulierterek,0) <> 0,ifnull(lw.kurskalk,0),ifnull(lw.kursletzt,0))<> 0
,
1 / if(ifnull(lw.preis_kalkulierterek,0) <> 0,ifnull(lw.kurskalk,0),ifnull(lw.kursletzt,0))
,
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.kurskalk,lw.kursletzt),
(1/wt.kurs),
wt.kurs
)
,
if(if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.kurskalk,lw.kursletzt) = \'USD\',
1.0 / '.$kursusd.',
if(if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.kurskalk,lw.kursletzt) = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
)
* if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.preis_kalkulierterek,ifnull(lw.preis_letzterek,0))
';
}
}else{
if($typ == 'letzterek')
{
return '
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = ek.waehrung,
(1/wt.kurs),
wt.kurs
)
,
if(ifnull(ek.waehrung,\'\') = \'USD\',
1.0 / '.$kursusd.',
if(ifnull(ek.waehrung,\'\') = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
* ifnull(ek.preis,0)
';
}else{
return '
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = if(ifnull(art.berechneterek,0) <> 0,art.berechneterekwaehrung,ifnull(ek.waehrung,\'\')),
(1/wt.kurs),
wt.kurs
)
,
if(if(ifnull(art.berechneterek,0) <> 0,art.berechneterekwaehrung,ifnull(ek.waehrung,\'\')) = \'USD\',
1.0 / '.$kursusd.',
if(if(ifnull(art.berechneterek,0) <> 0,art.berechneterekwaehrung,ifnull(ek.waehrung,\'\')) = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
* if(ifnull(art.berechneterek,0) <> 0,art.berechneterek,ifnull(ek.preis,0))
';
}
}
*/
}
/** /**
* @param Application $app * @param Application $app
@@ -598,39 +305,26 @@ class Lager extends GenLager {
break; break;
case "lager_wert": case "lager_wert":
$allowed['lager'] = array('wert'); $allowed['lager'] = array('wert');
$app->DB->Select("SELECT waehrungkalk,waehrungletzt,kurskalk,kursletzt FROM lagerwert LIMIT 1");
if($app->DB->error())
{
$app->erp->CheckColumn("waehrungkalk", "VARCHAR(16)", "lagerwert", "NOT NULL DEFAULT ''");
$app->erp->CheckColumn("waehrungletzt", "VARCHAR(16)", "lagerwert", "NOT NULL DEFAULT ''");
$app->erp->CheckColumn("kurskalk","DECIMAL(19,8)", "lagerwert", "NOT NULL DEFAULT '0'");
$app->erp->CheckColumn("kursletzt","DECIMAL(19,8)", "lagerwert", "NOT NULL DEFAULT '0'");
}
$preisart = (String)$app->YUI->TableSearchFilter($name, 1, 'preisart', $app->User->GetParameter("lager_wert_preisart"));
if($preisart == '')
{
$preisart = 'letzterek';
}
$artikel = (String)$app->YUI->TableSearchFilter($name, 2, 'artikel', $app->User->GetParameter("lager_wert_artikel")); // Get HTML form values
if($artikel) $preisart = $app->User->GetParameter('preisart');
{ $datum = $app->User->GetParameter('datum');
$artikel = explode(' ', $artikel); $gruppierenlager = $app->User->GetParameter('gruppierenlager');
$artikel = $app->DB->Select("SELECT id FROM artikel WHERE nummer = '".reset($artikel)."' AND (geloescht = 0 OR isnull(geloescht)) LIMIT 1"); $preiseineuro = $app->User->GetParameter('preiseineuro');
}
$datum = (String)$app->YUI->TableSearchFilter($name, 3, 'datum', $app->User->GetParameter("lager_wert_datum"));
if($datum) if($datum)
{ {
$datum = $app->String->Convert($datum, '%1.%2.%3', '%3-%2-%1'); $datum = $app->String->Convert($datum, '%1.%2.%3', '%3-%2-%1');
}else{ }else{
$datum = date('Y-m-d'); $datum = date('Y-m-d');
} }
$colmenge = 'lw.menge';
$colgewicht = "ifnull(art.gewicht,'0') * ifnull(lw.menge,0)";
$colvolumen = "ifnull(art.laenge,'0')*ifnull(art.breite,'0')*ifnull(art.hoehe,'0')* ifnull(lw.menge,0)";
if($datum == date('Y-m-d')) if($datum == date('Y-m-d'))
{ {
$live = true; $live = true;
$colmenge = 'lpi.menge';
}else{ }else{
$live = false; $live = false;
$_datum = $app->DB->Select("SELECT max(datum) FROM lagerwert WHERE datum <= '$datum' AND '$datum' < curdate() "); $_datum = $app->DB->Select("SELECT max(datum) FROM lagerwert WHERE datum <= '$datum' AND '$datum' < curdate() ");
@@ -640,303 +334,189 @@ class Lager extends GenLager {
} }
} }
$lager = (String)$app->YUI->TableSearchFilter($name, 4, 'lager', $app->User->GetParameter("lager_lager")); $heading = array('Datum','Artikel-Nr.','Artikel','Artikelkategorie','Lager','Lagerplatz','Menge','Gewicht','Volumen','Preistyp','EK-Preis','W&auml;hrung','Kurs','', 'Gesamt','');
if($lager) $width = array( '5%', '05%', '20%', '10%', '10%', '5%' , '5%', '5%', '5%', '1%', '5%', '1%', '1%', '1%','2%', '1%');
{ $findcols = array('lw.datum','art.nummer','art.name_de','(select bezeichnung from artikelkategorien where id=(select SUBSTRING_INDEX(SUBSTRING_INDEX(art.typ, \'kat\', 1), \'_\', 1) as type from artikel where id=art.id))', 'lagername', 'name',$colmenge,$colgewicht,$colvolumen);
$lager = $app->DB->Select("SELECT id FROM lager WHERE bezeichnung = '$lager' AND (geloescht = 0 OR isnull(geloescht)) LIMIT 1");
}
$lagerplatz = (String)$app->YUI->TableSearchFilter($name, 5, 'lagerplatz', $app->User->GetParameter("lager_lagerplatz"));
if($lagerplatz)
{
$lagerplatz = explode(' ', $lagerplatz);
$lagerplatz = $app->DB->Select("SELECT id FROM lager_platz WHERE kurzbezeichnung = '".reset($lagerplatz)."' AND (geloescht = 0 OR isnull(geloescht)) LIMIT 1");
}
$gruppierenlager = (int)$app->YUI->TableSearchFilter($name, 6, 'gruppierenlager', $app->User->GetParameter("lager_wert_gruppierenlager"),0,'checkbox');
$preiseineuro = (int)$app->YUI->TableSearchFilter($name, 7, 'preiseineuro', $app->User->GetParameter("lager_wert_preiseineuro"),0,'checkbox');
if($preiseineuro)
{
$kursusd = $app->erp->GetWaehrungUmrechnungskurs('EUR','USD');
$kurschf = $app->erp->GetWaehrungUmrechnungskurs('EUR','CHF');
}
$artikelkategorie = (String)$app->YUI->TableSearchFilter($name, 8, 'artikelkategorie', $app->User->GetParameter("lager_wert_artikelkategorie"));
$artikelkategorie = explode(" ", $artikelkategorie);
$artikelkategorieid = $artikelkategorie[0];
$artikelkategorieid = $app->DB->Select("SELECT id FROM artikelkategorien WHERE id = '$artikelkategorieid' LIMIT 1");
if($artikelkategorieid != ''){
$artikelkategorie = $artikelkategorieid;
}else{
$artikelkategorie = 0;
}
//if($artikelkategorie)$artikelkategorie = $app->DB->Select("SELECT id FROM artikelkategorien WHERE bezeichnung LIKE '%$artikelkategorie%' LIMIT 1");
$colgewicht ="if(lw.gewicht = 0,ifnull(art.gewicht,'0') ,lw.gewicht) *lw.menge";
$colvolumen = "if(lw.volumen=0,ifnull(art.laenge,'0')*ifnull(art.breite,'0')*ifnull(art.hoehe,'0'),lw.volumen)*lw.menge";
$colkurzbezeichnung = 'lp.kurzbezeichnung';
$colbezeichnung = 'lag.bezeichnung';
if($live)
{
$colgewicht = "ifnull(art.gewicht,'0') * ifnull(lpi.menge,0)";
$colvolumen = "ifnull(art.laenge,'0')*ifnull(art.breite,'0')*ifnull(art.hoehe,'0')* ifnull(lpi.menge,0)";
$colkurzbezeichnung = 'lpi.kurzbezeichnung';
$colbezeichnung = 'lpi.bezeichnung';
}
$heading = array('Datum','Artikel-Nr.','Artikel','Artikelkategorie','Lager','Lagerplatz','Menge','Gewicht','Volumen','EK-Preis','Gesamt','W&auml;hrung','letzte Bewegung', '');
$width = array('5%','10%','20%','10%','10%','10%','5%','5%','5%','5%','5%','5%','8%', '1%');
$findcols = array('lw.datum','art.nummer','art.name_de','(select bezeichnung from artikelkategorien where id=(select SUBSTRING_INDEX(SUBSTRING_INDEX(art.typ, \'kat\', 1), \'_\', 1) as type from artikel where id=art.id))', $colbezeichnung,$colkurzbezeichnung,$colmenge,$colgewicht,$colvolumen);
$kursjoin = "";
$numbercols = array(9, 10);
$datecols = array(0);
if($preisart == 'letzterek')
{
if ($preiseineuro) { if ($preiseineuro) {
$kursjoin = self::KursJoin($preisart, $datum); $preisEUR = "((SELECT preisfinal)*if((SELECT waehrungfinal) = 'EUR' OR (SELECT waehrungfinal) = NULL,1,kurs))";
$dummy = self::PreisUmrechnung($app, $preisart, $live); $gesamtcol = "(".$preisEUR."* lw.menge)";
/*$dummy = ' $kurs = $app->erp->FormatPreis('kurs',2);
if(
ifnull(lw.kursletzt,0)<> 0
,
1 / lw.kursletzt
,
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = lw.waehrungletzt,
(1/wt.kurs),
wt.kurs
)
,
if(lw.waehrungletzt = \'USD\',
1.0 / '.$kursusd.',
if(lw.waehrungletzt = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
)
* ifnull(lw.preis_letzterek,0)
';*/
} else { } else {
//$dummy = 'ifnull(lw.preis_letzterek,0)'; $gesamtcol = "((SELECT preisfinal)*lw.menge)";
$dummy = self::EinzelPreis($preisart,$live); $kurs = 1;
} }
$findcols[] = $dummy;
$preiscol = $app->erp->FormatPreis($dummy,2); $findcols[] = self::PreisTypErgebnis($preisart);
$gesamtcol = "(".$dummy.'*'.$colmenge.")"; $findcols[] = $preis;
$findcols[] = 'waehrung';
$findcols[] = 'kurs';
$findcols[] = '';
$findcols[] = $gesamtcol; $findcols[] = $gesamtcol;
//$waehrungcol = 'lw.waehrungletzt';
$waehrungcol = self::Waehrung($preisart,$live);
$findcols[] = $waehrungcol;
}elseif($preisart == 'inventurwert'){
if($preiseineuro){
$dummy = self::PreisUmrechnung($app, $preisart, $live);
$kursjoin = self::KursJoin($preisart, $datum);
}else{
$dummy = 'if(ifnull(lw.inventurwert,0) = 0 AND art.inventurekaktiv = 1, ifnull(art.inventurek,0), ifnull(lw.inventurwert,0))';
$dummy = $dummy = self::EinzelPreis($preisart,$live);
}
$findcols[] = $dummy;
$preiscol = $app->erp->FormatPreis($dummy,2);
$findcols[] = $dummy.'*'.$colmenge;
//$gesamtcol = $app->erp->FormatPreis($dummy.'*'.$colmenge,2);
$gesamtcol = "(".$dummy.'*'.$colmenge.")";
//$waehrungcol = "'EUR'";
$waehrungcol = self::Waehrung($preisart,$live);
$findcols[] = $waehrungcol;
}else{
if($preiseineuro){
$kursjoin = self::KursJoin($preisart, $datum);
/*$dummy = '
if(
if(ifnull(lw.preis_kalkulierterek,0) <> 0,ifnull(lw.kurskalk,0),ifnull(lw.kursletzt,0))<> 0
,
1 / if(ifnull(lw.preis_kalkulierterek,0) <> 0,ifnull(lw.kurskalk,0),ifnull(lw.kursletzt,0))
,
if(
ifnull(wt.kurs,0) <> 0
,
if(
wt.waehrung_nach = if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.kurskalk,lw.kursletzt),
(1/wt.kurs),
wt.kurs
)
,
if(if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.kurskalk,lw.kursletzt) = \'USD\',
1.0 / '.$kursusd.',
if(if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.kurskalk,lw.kursletzt) = \'CHF\',
1.0 / '.$kurschf.',
1)
)
)
)
* if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.preis_kalkulierterek,ifnull(lw.preis_letzterek,0))
';*/
$dummy = self::PreisUmrechnung($app, $preisart, $live);
//$dummy = 'if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.preis_kalkulierterek,ifnull(lw.preis_letzterek,0))';
}else{
//$dummy = 'if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.preis_kalkulierterek,ifnull(lw.preis_letzterek,0))';
$dummy = self::EinzelPreis($preisart,$live);
}
$findcols[] = $dummy;
$preiscol = $app->erp->FormatPreis($dummy,2);
$findcols[] = '('.$dummy.'*'.$colmenge.')';
//$gesamtcol = $app->erp->FormatPreis('('.$dummy.'*'.$colmenge.')',2);
$gesamtcol = '('.$dummy.'*'.$colmenge.')';
//$waehrungcol = 'if(ifnull(lw.preis_kalkulierterek,0) <> 0,lw.waehrungkalk,lw.waehrungletzt)';
$waehrungcol = self::Waehrung($preisart,$live);
$findcols[] = $waehrungcol;
}
$findcols[] = 'lw.letzte_bewegung';
$findcols[] = 'art.id'; $findcols[] = 'art.id';
//$searchsql = array('art.nummer','art.name_de','lag.bezeichnung','lp.kurzbezeichnung');
$searchsql = $findcols; $searchsql = $findcols;
$searchsql[0] = "date_format(lw.datum,'%d.%m.%Y')"; $searchsql[0] = "date_format(lw.datum,'%d.%m.%Y')";
$searchsql[11] = "date_format(lw.letzte_bewegung,'%d.%m.%Y %H:%i:%s')";
//$columnfilter = true;
$defaultorder = 1; $defaultorder = 1;
$defaultorderdesc = 0; $defaultorderdesc = 0;
$alignright = array(7,8,9,10,11); $alignright = array(7,8,9,10,11,11,13,15);
$sumcol = array(8,9,11); $sumcol = array(7,15);
$numbercols = array(7,8,9,11,13,15);
$datecols = array(0);
$onequeryperuser = true; $onequeryperuser = true;
$joinek = ' LEFT JOIN '.self::LetzterEK('art', 'e1','e2').' ek ON art.id = ek.artikel';
if($artikelkategorie > 0){
$joinartikelbaum = ' LEFT JOIN artikelbaum_artikel aba ON art.id = aba.artikel';
}
$waehrungcolanz = $waehrungcol;
if($preiseineuro){
$waehrungcolanz = "'EUR'";
}
if (!$live) if (!$live)
{ {
$sql = "SELECT DISTINCT SQL_CALC_FOUND_ROWS art.id, date_format(lw.datum,'%d.%m.%Y'), art.nummer, art.name_de, (select bezeichnung from artikelkategorien where id=(select SUBSTRING_INDEX(SUBSTRING_INDEX(art.typ, 'kat', 1), '_', 1) as type from artikel where id=art.id)) as artikelkategorie, lag.bezeichnung, lp.kurzbezeichnung, $lagermengen_sql = "(SELECT datum, artikel, menge, lager_platz FROM lagerwert WHERE datum = '$datum')";
".$app->erp->FormatMenge('lw.menge',2).",".$app->erp->FormatPreis($colgewicht,2).",".$app->erp->FormatPreis($colvolumen,2)." $where = "1";
, $preiscol, ".$app->erp->FormatPreis($gesamtcol,2).", $waehrungcolanz ,ifnull(date_format(lw.letzte_bewegung,'%d.%m.%Y %H:%i:%s'), ''), art.id
FROM artikel art
INNER JOIN lagerwert lw ON lw.artikel = art.id AND (isnull(art.geloescht) OR art.geloescht = 0) AND art.lagerartikel = 1
$joinek
$kursjoin
$joinartikelbaum
"; } else { // LIVE
$where = " lw.datum = '$datum' ";
if($gruppierenlager) $lagermengen_sql = "(
{ SELECT
$sql .= "INNER JOIN (SELECT '' as kurzbezeichnung ) lp ON lp.kurzbezeichnung = '' NOW() as datum,
INNER JOIN lager lag ON lw.lager = lag.id lager_platz_inhalt.artikel,
SUM(lager_platz_inhalt.menge) AS menge,
lager_platz_inhalt.lager_platz AS lager_platz
FROM
lager_platz_inhalt
GROUP BY
DATE_FORMAT(NOW(), '%d.%m.%Y'),
lager_platz_inhalt.artikel,
lager_platz_inhalt.lager_platz
) ";
$where = "1 ";
} // LIVE
// Subselect to obtain the relevant (minimum) currency conversion rates for a given date
$currency_sql = "
SELECT
waehrung_umrechnung.waehrung_von,
waehrung_umrechnung.waehrung_nach,
MIN(kurs) kurs
FROM
waehrung_umrechnung
WHERE
DATE(
REPLACE
(
COALESCE(gueltig_bis, '9999-12-31'),
'0000-00-00',
'9999-12-31'
)
) =(
SELECT
MIN(
DATE(
REPLACE
(
COALESCE(wu4min.gueltig_bis, '9999-12-31'),
'0000-00-00',
'9999-12-31'
)
)
)
FROM
waehrung_umrechnung wu4min
WHERE
waehrung_umrechnung.waehrung_von = wu4min.waehrung_von AND waehrung_umrechnung.waehrung_nach = wu4min.waehrung_nach AND DATE(
REPLACE
(
COALESCE(wu4min.gueltig_bis, '9999-12-31'),
'0000-00-00',
'9999-12-31'
)
) >= DATE('".$datum."')
)
GROUP BY
waehrung_umrechnung.waehrung_von,
waehrung_umrechnung.waehrung_nach
"; ";
$where .= " AND lw.lager <> 0"; // Subselect to obtain the relevant (minimum) prices per article
if($lager) $prices_sql = "
{ SELECT
$where .= " AND lw.lager = '$lager' "; artikel,
} waehrung,
if($lagerplatz) preis
{ FROM
$where .= " AND lw.lager_platz = '$lagerplatz' "; einkaufspreise
} WHERE
}else{ preis =(
$sql .= "INNER JOIN lager_platz lp ON lp.id = lw.lager_platz SELECT
INNER JOIN lager lag ON lag.id = lp.lager MIN(preis)
"; FROM
$where .= " AND lw.lager = 0"; einkaufspreise minek
if($lager) WHERE
{ einkaufspreise.artikel = minek.artikel AND DATE(
$where .= " AND lw.lager = '$lager' "; REPLACE
} (
if($lagerplatz) COALESCE(gueltig_bis, '9999-12-31'),
{ '0000-00-00',
$where .= " AND lw.lager_platz = '$lagerplatz' "; '9999-12-31'
} )
} ) =(
}else{ SELECT
MIN(
$findcols[0] = 'curdate()'; DATE(
REPLACE
$sql = "SELECT DISTINCT SQL_CALC_FOUND_ROWS art.id, date_format(curdate(),'%d.%m.%Y'), art.nummer, art.name_de, (select bezeichnung from artikelkategorien where id=(select SUBSTRING_INDEX(SUBSTRING_INDEX(art.typ, 'kat', 1), '_', 1) as type from artikel where id=art.id)) as artikelkategorie, lpi.bezeichnung, lpi.kurzbezeichnung, (
".$app->erp->FormatMenge($colmenge,2).",".$app->erp->FormatPreis($colgewicht,2).",".$app->erp->FormatPreis($colvolumen,2)." COALESCE(ek4min.gueltig_bis, '9999-12-31'),
, $preiscol, ".$app->erp->FormatPreis($gesamtcol,2).", $waehrungcolanz ,ifnull(date_format(lbew.zeit,'%d.%m.%Y %H:%i:%s'), ''), art.id '0000-00-00',
FROM artikel art '9999-12-31'
$joinek )
$joinartikelbaum )
LEFT JOIN lagerwert lw ON lw.artikel = art.id AND lw.datum = '$datum' AND lw.datum < curdate() )
$kursjoin FROM
"; einkaufspreise ek4min
$where = " (isnull(art.geloescht) OR art.geloescht = 0) AND art.lagerartikel = 1 "; WHERE
if($gruppierenlager) minek.artikel = ek4min.artikel AND ek4min.geloescht != 1 AND minek.geloescht != 1 AND DATE(
{ REPLACE
$sql .= "INNER JOIN ( (
SELECT lager_platz_inhalt.artikel, sum(lager_platz_inhalt.menge) as menge, '' as kurzbezeichnung,lager.bezeichnung, lager.id as lager COALESCE(ek4min.gueltig_bis, '9999-12-31'),
FROM lager_platz_inhalt '0000-00-00',
INNER JOIN lager_platz ON lager_platz_inhalt.lager_platz = lager_platz.id '9999-12-31'
INNER JOIN lager ON lager_platz.lager = lager.id )
GROUP BY lager_platz_inhalt.artikel, lager.id ) >= DATE('".$datum."')
) lpi ON lpi.artikel = art.id AND (isnull(art.geloescht) OR art.geloescht = 0) AND art.lagerartikel = 1 )
LEFT JOIN ( )
SELECT max(lb1.logdatei) as zeit, lb1.artikel, lp1.lager as lager GROUP BY
FROM lager_bewegung lb1 artikel,
INNER JOIN lager_platz lp1 ON lb1.lager_platz = lp1.id AND ifnull(lp1.geloescht, 0) = 0 waehrung
INNER JOIN lager l1 ON lp1.lager = l1.id AND ifnull(l1.geloescht,0) = 0
GROUP BY lb1.artikel,lp1.lager
) lbew ON lpi.artikel = lbew.artikel AND lpi.lager = lbew.lager
"; ";
$where .= " AND lpi.lager <> 0"; $sql = "SELECT DISTINCT SQL_CALC_FOUND_ROWS
if($lager) art.id,
{ ".$app->erp->FormatDate('lw.datum')." as datum,
$where .= " AND lpi.lager = '$lager' "; art.nummer,
} art.name_de,
//if($lagerplatz)$where .= " AND lpi.lager_platz = '$lagerplatz' "; (select bezeichnung from artikelkategorien where id=(select SUBSTRING_INDEX(SUBSTRING_INDEX(art.typ, 'kat', 1), '_', 1) as type from artikel where id=art.id)) as artikelkategorie,
}else{ lagerplatz.lagername,
$sql .= "INNER JOIN ( lagerplatz.name,
SELECT lager_platz_inhalt.artikel, sum(lager_platz_inhalt.menge) as menge, lager_platz.kurzbezeichnung,lager.bezeichnung, lager.id as lager,lager_platz.id as lager_platz ".$app->erp->FormatMenge('lw.menge',2).",".$app->erp->FormatPreis($colgewicht,2).",".$app->erp->FormatPreis($colvolumen,2)." as menge,
FROM lager_platz_inhalt ".self::PreisTypErgebnis($preisart)." as preisart,
INNER JOIN lager_platz ON lager_platz_inhalt.lager_platz = lager_platz.id ".self::EinzelPreis($preisart)." AS preisfinal,
INNER JOIN lager ON lager_platz.lager = lager.id ".self::Waehrung($preisart)." AS waehrungfinal,
GROUP BY lager_platz_inhalt.artikel, lager.id, lager_platz.id ".$kurs." AS kurs,
) lpi ON lpi.artikel = art.id '' as hidden,
LEFT JOIN ( ".$app->erp->FormatPreis($gesamtcol,2)." as gesamt,
SELECT max(lb1.logdatei) as zeit, lb1.artikel, lp1.id as lager_platz art.id
FROM lager_bewegung lb1 FROM
INNER JOIN lager_platz lp1 ON lb1.lager_platz = lp1.id AND ifnull(lp1.geloescht, 0) = 0 artikel art
INNER JOIN lager l1 ON lp1.lager = l1.id AND ifnull(l1.geloescht,0) = 0 INNER JOIN ".$lagermengen_sql." AS lw ON lw.artikel = art.id AND (isnull(art.geloescht) OR art.geloescht = 0) AND art.lagerartikel = 1
GROUP BY lb1.artikel,lp1.id LEFT JOIN (".$prices_sql.") AS ek ON art.id = ek.artikel AND ".self::Waehrung($preisart)." = ek.waehrung
) lbew ON lpi.artikel = lbew.artikel AND lpi.lager_platz = lbew.lager_platz LEFT JOIN (".$currency_sql.") AS kurs ON kurs.waehrung_von = ".self::Waehrung($preisart)." AND kurs.waehrung_nach = 'EUR'
"; ";
$where .= " AND lpi.lager <> 0"; $lagerplatz_sql = "(SELECT lager_platz.id, lager.bezeichnung lagername, lager_platz.kurzbezeichnung name from lager INNER JOIN lager_platz on lager_platz.lager = lager.id) lagerplatz";
if($lager)
{
$where .= " AND lpi.lager = '$lager' ";
}
}
$findcols[10] = "CAST($gesamtcol as DECIMAL(10,2))"; $sql .= "INNER JOIN ".$lagerplatz_sql." ON lw.lager_platz = lagerplatz.id";
$findcols[11] = $waehrungcol;
$findcols[12] = "ifnull(lbew.zeit, '')";
$searchsql[12] = "date_format(lbew.zeit,'%d.%m.%Y %H:%i:%s')";
} $where .= " AND (isnull(art.geloescht) OR art.geloescht = 0) AND art.lagerartikel = 1 ";
if($artikel)
{
$where .= " AND art.id = '$artikel' ";
}
if($artikelkategorie > 0){
$where .= " AND (aba.kategorie = '$artikelkategorie' OR art.typ = '".$artikelkategorie."_kat') ";
//$where .= " AND art.typ = '".$artikelkategorie."_kat' ";
}
$sql = $app->YUI->CodiereSQLForOneQuery($sql, $name); $sql = $app->YUI->CodiereSQLForOneQuery($sql, $name);
$groupby = ""; $groupby = "";
@@ -1521,7 +1101,8 @@ class Lager extends GenLager {
$this->app->ActionHandler("artikelentfernenreserviert", "LagerArtikelEntfernenReserviert"); $this->app->ActionHandler("artikelentfernenreserviert", "LagerArtikelEntfernenReserviert");
$this->app->ActionHandler("letztebewegungen", "LagerLetzteBewegungen"); $this->app->ActionHandler("letztebewegungen", "LagerLetzteBewegungen");
$this->app->ActionHandler("schnelleinlagern", "LagerSchnellEinlagern"); $this->app->ActionHandler("schnelleinlagern", "LagerSchnellEinlagern");
$this->app->ActionHandler("wert", "LagerWert");
$this->app->ActionHandler("wert2", "LagerWert2");
$this->app->ActionHandler("schnellumlagern", "LagerSchnellUmlagern"); $this->app->ActionHandler("schnellumlagern", "LagerSchnellUmlagern");
$this->app->ActionHandler("schnellauslagern", "LagerSchnellAuslagern"); $this->app->ActionHandler("schnellauslagern", "LagerSchnellAuslagern");
@@ -2073,11 +1654,42 @@ class Lager extends GenLager {
public function LagerWert() public function LagerWert()
{ {
$this->LagerHauptmenu(); $this->LagerHauptmenu();
$this->app->Tpl->Set('VERS','Professional'); /* $this->app->Tpl->Set('VERS','Professional');
$this->app->Tpl->Set('MODUL','Professional'); $this->app->Tpl->Set('MODUL','Professional');
$this->app->Tpl->Parse('PAGE', 'only_version.tpl'); $this->app->Tpl->Parse('PAGE', 'only_version.tpl');
ROFLMAO
*/
// Transfer Parameters to TableSearch
$gruppierenlager = $this->app->Secure->GetPOST('gruppierenlager');
$this->app->User->SetParameter('gruppierenlager', $gruppierenlager);
$preiseineuro = $this->app->Secure->GetPOST('preiseineuro');
$this->app->User->SetParameter('preiseineuro', $preiseineuro);
$datum = $this->app->Secure->GetPOST('datum');
$this->app->User->SetParameter('datum', $datum);
$preisart = $this->app->Secure->GetPOST('preisart');
$this->app->User->SetParameter('preisart', $preisart);
$this->app->YUI->DatePicker("datum");
$this->app->Tpl->Set('DATUM', $datum);
$this->app->Tpl->Set('PREISEINEURO', $preiseineuro==1?"checked":"");
$this->app->Tpl->Set('GRUPPIERENLAGER', $gruppierenlager==1?"checked":"");
$this->app->Tpl->Set(strtoupper($preisart), 'selected');
$this->app->erp->MenuEintrag('index.php?module=lager&action=list','zur&uuml;ck zur &Uuml;bersicht');
$this->app->erp->Headlines('','Bestand');
$this->app->YUI->TableSearch('TAB1', 'lager_wert', 'show','','',basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE','lager_wert.tpl');
} }
public function LagerBuchenZwischenlagerDelete() public function LagerBuchenZwischenlagerDelete()
{ {
$id = $this->app->Secure->GetGET('id'); $id = $this->app->Secure->GetGET('id');
@@ -2362,7 +1974,6 @@ class Lager extends GenLager {
$alles_komplett++; $alles_komplett++;
} }
$artikel_tmp = $this->app->DB->Select("SELECT id FROM artikel WHERE nummer='$nummer' AND nummer!='' AND geloescht!=1 AND lagerartikel=1 LIMIT 1"); $artikel_tmp = $this->app->DB->Select("SELECT id FROM artikel WHERE nummer='$nummer' AND nummer!='' AND geloescht!=1 AND lagerartikel=1 LIMIT 1");
$ean = $this->app->DB->Select("SELECT id FROM artikel WHERE ean='$nummer' AND ean!='' AND geloescht!=1 AND lagerartikel=1 LIMIT 1"); $ean = $this->app->DB->Select("SELECT id FROM artikel WHERE ean='$nummer' AND ean!='' AND geloescht!=1 AND lagerartikel=1 LIMIT 1");
if($artikel_tmp <=0 && $ean > 0) if($artikel_tmp <=0 && $ean > 0)
@@ -2381,10 +1992,14 @@ class Lager extends GenLager {
// gibts regal // gibts regal
$regalcheck = $this->app->DB->Select("SELECT id FROM lager_platz WHERE id='$regal' LIMIT 1"); $regalcheck = $this->app->DB->Select("SELECT id FROM lager_platz WHERE id='$regal' LIMIT 1");
if ($regalcheck != $regal || $regal == '' || $regal == 0) { if ($regalcheck != $regal) {
$grund.= "<li>Regal gibt es nicht!</li>"; $grund.= "<li>Regal gibt es nicht!</li>";
$alles_komplett++; $alles_komplett++;
} }
if ($regal == '' || $regal == 0) {
$grund.= "<li>Bitte Regal angeben.</li>";
$alles_komplett++;
}
if ($alles_komplett > 0 && $regal != '') { if ($alles_komplett > 0 && $regal != '') {
$this->app->Tpl->Set('MESSAGELAGER', "<div class=\"error\">Artikel wurde nicht gebucht! Grund:<ul>$grund</ul> </div>"); $this->app->Tpl->Set('MESSAGELAGER', "<div class=\"error\">Artikel wurde nicht gebucht! Grund:<ul>$grund</ul> </div>");
+2 -2
View File
@@ -82,7 +82,7 @@ class Log
'Nachricht', 'Nachricht',
'', '',
]; ];
$width = ['1%', '4%', '8%', '4%', '10%', '15%', '20%', '10%', '5%', '40%']; $width = ['1%', '4%', '9%', '4%', '10%', '15%', '20%', '10%', '5%', '40%'];
$findcols = [ $findcols = [
'open', 'open',
'l.id', 'l.id',
@@ -116,7 +116,7 @@ class Log
$sql = "SELECT l.id, $sql = "SELECT l.id,
'<img src=./themes/new/images/details_open.png class=details>' AS `open`, '<img src=./themes/new/images/details_open.png class=details>' AS `open`,
l.id, l.id,
DATE_FORMAT(l.log_time,'%d.%m.%Y %H:%i:%s') AS `log_time`, SUBSTRING(DATE_FORMAT(l.log_time,'%d.%m.%Y %H:%i:%s %f'),1,23) AS `log_time`,
l.level, l.origin_type, l.origin_detail, l.class, l.method, l.line, l.message, l.id l.level, l.origin_type, l.origin_detail, l.class, l.method, l.line, l.message, l.id
FROM `log` AS `l`"; FROM `log` AS `l`";
$fastcount = 'SELECT COUNT(l.id) FROM `log` AS `l`'; $fastcount = 'SELECT COUNT(l.id) FROM `log` AS `l`';
+85
View File
@@ -147,6 +147,48 @@ class Onlineshops extends GenShopexport {
$where = " s.shopid = '$id' AND g.aktiv = 1"; $where = " s.shopid = '$id' AND g.aktiv = 1";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"#\" onclick=kundengruppenEdit(%value%)>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>" . "&nbsp;" . "<a href=\"#\" onclick=DeleteDialog(\"index.php?module=onlineshops&action=kundengruppendelete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "&nbsp;</td></tr></table>"; $menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"#\" onclick=kundengruppenEdit(%value%)>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>" . "&nbsp;" . "<a href=\"#\" onclick=DeleteDialog(\"index.php?module=onlineshops&action=kundengruppendelete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "&nbsp;</td></tr></table>";
break; break;
case 'shopexport_artikellist':
$id = $app->Secure->GetGET('id');
$allowed['onlineshops'] = array('artikellist');
$heading = array('', '', 'Artikel-Nr.','Artikel','Aktiv','Lagersync','Einstellungen aus Artikel','Letzte Artikel&uuml;bertragung','Letzter Lagersync','Lagercache','Men&uuml;');
$width = array( '1%','1%', '5%', '40%', '1%', '1%', '1%', '7%', '7%', '1%', '1%');
$findcols = array('a.id','a.id','a.nummer','a.name_de','aos.aktiv','a.autolagerlampe','aos.ausartikel','last_article_transfer','aos.last_storage_transfer','a.cache_lagerplatzinhaltmenge');
$searchsql = array('a.nummer','a.name_de');
$defaultorder = 1; //Optional wenn andere Reihenfolge gewuenscht
$defaultorderdesc = 0;
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',a.id,'\" />') AS `auswahl`";
$sql = "
SELECT SQL_CALC_FOUND_ROWS
a.id,".
$dropnbox.",
a.nummer,
a.name_de,
aos.aktiv,
a.autolagerlampe,
aos.ausartikel,".
$app->erp->FormatDateTime('aos.last_article_transfer').",".
$app->erp->FormatDateTime('aos.last_storage_transfer').",
if(a.cache_lagerplatzinhaltmenge = -999,'',a.cache_lagerplatzinhaltmenge) cache,
a.id
FROM
artikel a
INNER JOIN artikel_onlineshops aos ON
a.id = aos.artikel
INNER JOIN shopexport s ON
s.id = aos.shop
";
$where = " s.id = '$id'";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=artikel&action=edit&id=%value%#tabs-4\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
// $menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"#\" onclick=kundengruppenEdit(%value%)>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>" . "&nbsp;" . "<a href=\"#\" onclick=DeleteDialog(\"index.php?module=onlineshops&action=kundengruppendelete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "&nbsp;</td></tr></table>";
$orderby = null;
break;
} }
$erg = []; $erg = [];
@@ -216,6 +258,8 @@ class Onlineshops extends GenShopexport {
$this->app->ActionHandler('itemlink', 'ShopexportItemlink'); $this->app->ActionHandler('itemlink', 'ShopexportItemlink');
$this->app->ActionHandler('orderlink', 'ShopexportOrderlink'); $this->app->ActionHandler('orderlink', 'ShopexportOrderlink');
$this->app->ActionHandler('artikellist', 'ShopexportArtikelList');
$this->app->erp->Headlines('Shopexport'); $this->app->erp->Headlines('Shopexport');
$this->app->ActionHandlerListen($app); $this->app->ActionHandlerListen($app);
} }
@@ -2790,6 +2834,46 @@ class Onlineshops extends GenShopexport {
parent::ShopexportList(); parent::ShopexportList();
} }
public function ShopexportArtikelList()
{
// Copied from shopexport (dirty)
$id = (int)$this->app->Secure->GetGET('id');
$delcache = $this->app->Secure->GetPOST('delcache');
$delcacheselected = $this->app->Secure->GetPOST('delcacheselected');
// Process multi action
$where = "1";
$auswahl = $this->app->Secure->GetPOST('auswahl');
$selectedIds = [];
if(!empty($auswahl)) {
foreach($auswahl as $selectedId) {
$selectedId = (int)$selectedId;
if($selectedId > 0) {
$selectedIds[] = $selectedId;
}
}
$where = "a.id IN (".implode(",",$selectedIds).")";
}
if(!empty($delcache) || !empty($delcacheselected)) {
$anz = 0;
if($id > 0) {
$this->app->DB->Update("UPDATE artikel a
LEFT JOIN (SELECT artikel FROM artikel_onlineshops WHERE shop = '$id' AND aktiv = 1 GROUP BY artikel) oa ON a.id = oa.artikel
SET a.cache_lagerplatzinhaltmenge = -999 WHERE (a.shop = '$id' OR a.shop2 = '$id' OR a.shop3 = '$id' OR NOT ISNULL(oa.artikel)) AND a.geloescht = 0 AND ($where)");
$anz = $this->app->DB->affected_rows();
$this->app->erp->LogFile("Lagerzahlencache zurückgesetzt für $anz Artikel, shopid: $id");
$this->app->Tpl->Add('MESSAGE','<div class="info">Lagerzahlencache zurückgesetzt für '.$anz.' Artikel, shopid: '.$id.'</div>');
}
}
$this->ShopexportMenu();
$this->app->YUI->TableSearch('TAB1','shopexport_artikellist', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "shopexport_artikellist.tpl");
}
/** /**
* @param array $importerCapabilities * @param array $importerCapabilities
* @param array $featureKeys * @param array $featureKeys
@@ -2942,6 +3026,7 @@ class Onlineshops extends GenShopexport {
//$this->app->Tpl->Add('KURZUEBERSCHRIFT2',$name); //$this->app->Tpl->Add('KURZUEBERSCHRIFT2',$name);
$this->app->erp->MenuEintrag('index.php?module=onlineshops&action=edit&id='.$id,'Details'); $this->app->erp->MenuEintrag('index.php?module=onlineshops&action=edit&id='.$id,'Details');
//$this->app->erp->MenuEintrag("index.php?module=shopexport&action=export&id=$id","Export"); //$this->app->erp->MenuEintrag("index.php?module=shopexport&action=export&id=$id","Export");
$this->app->erp->MenuEintrag('index.php?module=onlineshops&action=artikellist&id='.$id,'Artikelliste');
$this->app->erp->MenuEintrag('index.php?module=shopexport&action=artikeluebertragung&id='.$id,'Artikel &Uuml;bertragung'); $this->app->erp->MenuEintrag('index.php?module=shopexport&action=artikeluebertragung&id='.$id,'Artikel &Uuml;bertragung');
if($this->app->DB->Select("SELECT modulename FROM shopexport WHERE id = '$id'") === 'shopimporter_shopware'){ if($this->app->DB->Select("SELECT modulename FROM shopexport WHERE id = '$id'") === 'shopimporter_shopware'){
//Soll nur in Shopware angezeigt werden, da nur in Shopware unterstüzt //Soll nur in Shopware angezeigt werden, da nur in Shopware unterstüzt
+23 -11
View File
@@ -179,8 +179,8 @@ class Produktion {
$width = array( '1%','1%','5%', '30%', '5%', '1%', '1%', '1%' , '1%', '1%', '1%' ,'1%'); $width = array( '1%','1%','5%', '30%', '5%', '1%', '1%', '1%' , '1%', '1%', '1%' ,'1%');
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=produktion_position&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=produktion_position&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=produktion_position&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=produktion_position&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
} else { } else {
$heading = array('','','Nummer', 'Artikel', 'Projekt','Planmenge pro St&uuml;ck', 'Lager (verf&uuml;gbar)', 'Reserviert','Planmenge', 'Verbraucht',''); $heading = array('','','Nummer', 'Artikel', 'Projekt','Planmenge pro St&uuml;ck', 'Lager alle (verf&uuml;gbar)', 'Lager (verf&uuml;gbar)', 'Reserviert', 'Planmenge', 'Verbraucht', '');
$width = array('1%','1%', '5%','30%', '5%', '1%', '1%', '1%' , '1%' ,'1%' ,'1%'); $width = array( '1%','1%','5%', '30%', '5%', '1%', '1%', '1%' , '1%', '1%', '1%' ,'1%');
$menu = ""; $menu = "";
} }
@@ -201,6 +201,7 @@ class Produktion {
(SELECT a.name_de FROM artikel a WHERE a.id = p.artikel LIMIT 1) as name, (SELECT a.name_de FROM artikel a WHERE a.id = p.artikel LIMIT 1) as name,
(SELECT projekt.abkuerzung FROM projekt INNER JOIN artikel a WHERE a.projekt = projekt.id AND a.id = p.artikel LIMIT 1) as projekt, (SELECT projekt.abkuerzung FROM projekt INNER JOIN artikel a WHERE a.projekt = projekt.id AND a.id = p.artikel LIMIT 1) as projekt,
FORMAT(p.menge/$produktionsmenge,0,'de_DE') as stueckmenge, FORMAT(p.menge/$produktionsmenge,0,'de_DE') as stueckmenge,
IF ((SELECT lagerartikel FROM artikel a WHERE a.id = p.artikel LIMIT 1) != 0,
CONCAT ( CONCAT (
FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.artikel = p.artikel),0),0,'de_DE'), FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.artikel = p.artikel),0),0,'de_DE'),
' (', ' (',
@@ -211,8 +212,8 @@ class Produktion {
'de_DE' 'de_DE'
), ),
')' ')'
) as lageralle, ),'') as lageralle,
if ('$standardlager' = '0','-', if (('$standardlager' != '0') && ((SELECT lagerartikel FROM artikel a WHERE a.id = p.artikel LIMIT 1) != 0),
CONCAT ( CONCAT (
FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.lager_platz = $standardlager AND lpi.artikel = p.artikel),0),0,'de_DE'), FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.lager_platz = $standardlager AND lpi.artikel = p.artikel),0),0,'de_DE'),
' (', ' (',
@@ -224,6 +225,7 @@ class Produktion {
), ),
')' ')'
) )
,''
) as lager, ) as lager,
FORMAT ((SELECT SUM(menge) FROM lager_reserviert r WHERE r.lager_platz = $standardlager AND r.artikel = p.artikel AND r.objekt = 'produktion' AND r.parameter = $id AND r.posid = p.id),0,'de_DE') as Reserviert, FORMAT ((SELECT SUM(menge) FROM lager_reserviert r WHERE r.lager_platz = $standardlager AND r.artikel = p.artikel AND r.objekt = 'produktion' AND r.parameter = $id AND r.posid = p.id),0,'de_DE') as Reserviert,
FORMAT(p.menge,0,'de_DE'), FORMAT(p.menge,0,'de_DE'),
@@ -268,6 +270,7 @@ class Produktion {
(SELECT a.name_de FROM artikel a WHERE a.id = p.artikel LIMIT 1) as name, (SELECT a.name_de FROM artikel a WHERE a.id = p.artikel LIMIT 1) as name,
(SELECT projekt.abkuerzung FROM projekt INNER JOIN artikel a WHERE a.projekt = projekt.id AND a.id = p.artikel LIMIT 1) as projekt, (SELECT projekt.abkuerzung FROM projekt INNER JOIN artikel a WHERE a.projekt = projekt.id AND a.id = p.artikel LIMIT 1) as projekt,
FORMAT(SUM(p.menge)/$produktionsmenge,0,'de_DE') as stueckmenge, FORMAT(SUM(p.menge)/$produktionsmenge,0,'de_DE') as stueckmenge,
IF ((SELECT lagerartikel FROM artikel a WHERE a.id = p.artikel LIMIT 1) != 0,
CONCAT ( CONCAT (
FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.artikel = p.artikel),0),0,'de_DE'), FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.artikel = p.artikel),0),0,'de_DE'),
' (', ' (',
@@ -278,8 +281,8 @@ class Produktion {
'de_DE' 'de_DE'
), ),
')' ')'
) as lageralle, ),'') as lageralle,
if ('$standardlager' = '0','-', if (('$standardlager' != '0') && ((SELECT lagerartikel FROM artikel a WHERE a.id = p.artikel LIMIT 1) != 0),
CONCAT ( CONCAT (
FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.lager_platz = $standardlager AND lpi.artikel = p.artikel),0),0,'de_DE'), FORMAT (IFNULL((SELECT SUM(menge) FROM lager_platz_inhalt lpi WHERE lpi.lager_platz = $standardlager AND lpi.artikel = p.artikel),0),0,'de_DE'),
' (', ' (',
@@ -291,6 +294,7 @@ class Produktion {
), ),
')' ')'
) )
,''
) as lager, ) as lager,
FORMAT ((SELECT SUM(menge) FROM lager_reserviert r WHERE r.lager_platz = $standardlager AND r.artikel = p.artikel AND r.objekt = 'produktion' AND r.parameter = $id),0,'de_DE') as reserviert, FORMAT ((SELECT SUM(menge) FROM lager_reserviert r WHERE r.lager_platz = $standardlager AND r.artikel = p.artikel AND r.objekt = 'produktion' AND r.parameter = $id),0,'de_DE') as reserviert,
FORMAT(SUM(p.menge),0,'de_DE') as menge, FORMAT(SUM(p.menge),0,'de_DE') as menge,
@@ -416,6 +420,7 @@ class Produktion {
$input['datumbereitstellung'] = $this->app->erp->ReplaceDatum(true,$input['datumbereitstellung'],true); $input['datumbereitstellung'] = $this->app->erp->ReplaceDatum(true,$input['datumbereitstellung'],true);
$input['datumproduktion'] = $this->app->erp->ReplaceDatum(true,$input['datumproduktion'],true); $input['datumproduktion'] = $this->app->erp->ReplaceDatum(true,$input['datumproduktion'],true);
$input['datumproduktionende'] = $this->app->erp->ReplaceDatum(true,$input['datumproduktionende'],true); $input['datumproduktionende'] = $this->app->erp->ReplaceDatum(true,$input['datumproduktionende'],true);
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true);
$columns = "id, "; $columns = "id, ";
$values = "$id, "; $values = "$id, ";
@@ -579,7 +584,7 @@ class Produktion {
$sql = "UPDATE produktion SET status = 'gestartet' WHERE id=$id"; $sql = "UPDATE produktion SET status = 'gestartet' WHERE id=$id";
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
$sql = "SELECT id, artikel, menge, geliefert_menge, stuecklistestufe FROM produktion_position pp WHERE produktion=$id"; $sql = "SELECT pp.id, pp.artikel, pp.menge, pp.geliefert_menge, pp.stuecklistestufe, a.lagerartikel FROM produktion_position pp INNER JOIN artikel a ON a.id = pp.artikel WHERE pp.produktion=$id";
$material = $this->app->DB->SelectArr($sql); $material = $this->app->DB->SelectArr($sql);
foreach ($material as $material_position) { foreach ($material as $material_position) {
@@ -588,8 +593,8 @@ class Produktion {
$menge_artikel_auslagern = $material_position['menge']/$produktionsartikel_position['menge']*$menge_auslagern; $menge_artikel_auslagern = $material_position['menge']/$produktionsartikel_position['menge']*$menge_auslagern;
// Remove material from stock // Remove material from stock
if ($material_position['stuecklistestufe'] == 0) { if ($material_position['stuecklistestufe'] == 0 && $material_position['lagerartikel']) {
$result = $this->app->erp->LagerAuslagernRegal($material_position['artikel'],$global_standardlager,$menge_artikel_auslagern,$global_projekt,'Produktion '.$produktion_belegnr); $result = $this->app->erp->LagerAuslagernRegal($material_position['artikel'],$global_standardlager,$menge_artikel_auslagern,$global_projekt,'Produktion '.$global_produktionsnummer);
if ($result != 1) { if ($result != 1) {
$msg .= "<div class=\"error\">Kritischer Fehler beim Ausbuchen! (Position ".$material_position['id'].", Menge ".$menge_artikel_auslagern.").</div>". $msg .= "<div class=\"error\">Kritischer Fehler beim Ausbuchen! (Position ".$material_position['id'].", Menge ".$menge_artikel_auslagern.").</div>".
$error = true; $error = true;
@@ -1046,18 +1051,23 @@ class Produktion {
} }
if($produktion_from_db['standardlager'] == 0) { if($produktion_from_db['standardlager'] == 0) {
$msg .= "<div class=\"error\">Kein Lager ausgew&auml;hlt.</div>"; $msg .= "<div class=\"error\">Kein Materiallager ausgew&auml;hlt.</div>";
} }
$this->app->Tpl->Set('PROJEKT',$this->app->erp->ReplaceProjekt(false,$produktion_from_db['projekt'],false));
$this->app->YUI->AutoComplete("projekt", "projektname", 1); $this->app->YUI->AutoComplete("projekt", "projektname", 1);
$this->app->YUI->AutoComplete("kundennummer", "kunde", 1); $this->app->YUI->AutoComplete("kundennummer", "kunde", 1);
$this->app->YUI->AutoComplete("auftragid", "auftrag", 1); $this->app->YUI->AutoComplete("auftragid", "auftrag", 1);
$this->app->YUI->AutoComplete("artikel_planen", "stuecklistenartikel"); $this->app->YUI->AutoComplete("artikel_planen", "stuecklistenartikel");
$this->app->YUI->AutoComplete("artikel_hinzu", "artikelnummer");
$this->app->YUI->AutoComplete("standardlager", "lagerplatz"); $this->app->YUI->AutoComplete("standardlager", "lagerplatz");
$this->app->YUI->AutoComplete("ziellager", "lagerplatz"); $this->app->YUI->AutoComplete("ziellager", "lagerplatz");
$this->app->YUI->AutoComplete("artikel", "artikelnummer");
$this->app->Tpl->Set('STANDARDLAGER', $this->app->erp->ReplaceLagerPlatz(false,$produktion_from_db['standardlager'],false)); // Convert ID to form display $this->app->Tpl->Set('STANDARDLAGER', $this->app->erp->ReplaceLagerPlatz(false,$produktion_from_db['standardlager'],false)); // Convert ID to form display
$this->app->YUI->DatePicker("datum"); $this->app->YUI->DatePicker("datum");
@@ -1172,6 +1182,8 @@ class Produktion {
break; break;
} }
$this->app->Tpl->Set('PRODUKTION_ID',$id);
$this->app->Tpl->Set('MESSAGE', $msg); $this->app->Tpl->Set('MESSAGE', $msg);
$this->produktion_minidetail('MINIDETAILINEDIT'); $this->produktion_minidetail('MINIDETAILINEDIT');
$this->app->Tpl->Parse('PAGE', "produktion_edit.tpl"); $this->app->Tpl->Parse('PAGE', "produktion_edit.tpl");
@@ -1267,7 +1279,7 @@ class Produktion {
$menge_moeglich = PHP_INT_MAX; $menge_moeglich = PHP_INT_MAX;
$sql = "SELECT id, artikel, SUM(menge) as menge, geliefert_menge FROM produktion_position pp WHERE produktion=$produktion_id AND stuecklistestufe=0 GROUP BY artikel"; $sql = "SELECT pp.id, artikel, SUM(menge) as menge, geliefert_menge FROM produktion_position pp INNER JOIN artikel a ON pp.artikel = a.id WHERE pp.produktion=$produktion_id AND pp.stuecklistestufe=0 AND a.lagerartikel != 0 GROUP BY artikel";
$materialbedarf_gesamt = $this->app->DB->SelectArr($sql); $materialbedarf_gesamt = $this->app->DB->SelectArr($sql);
$sql = "SELECT id, artikel, SUM(menge) as menge, geliefert_menge as geliefert_menge FROM produktion_position pp WHERE produktion=$produktion_id AND stuecklistestufe=1 GROUP BY artikel"; $sql = "SELECT id, artikel, SUM(menge) as menge, geliefert_menge as geliefert_menge FROM produktion_position pp WHERE produktion=$produktion_id AND stuecklistestufe=1 GROUP BY artikel";
+16 -7
View File
@@ -86,7 +86,6 @@ class Produktion_position {
} }
if ($go_to_production) { if ($go_to_production) {
if ($pid == 0) { if ($pid == 0) {
$id = (int) $this->app->Secure->GetGET('id'); $id = (int) $this->app->Secure->GetGET('id');
$sql = "SELECT p.status, p.id from produktion p INNER JOIN produktion_position pp ON pp.produktion = p.id WHERE pp.id = $id"; $sql = "SELECT p.status, p.id from produktion p INNER JOIN produktion_position pp ON pp.produktion = p.id WHERE pp.id = $id";
@@ -138,17 +137,27 @@ class Produktion_position {
if (empty($id)) { if (empty($id)) {
// New item // New item
$id = 'NULL'; $id = 'NULL';
} $produktion_id = $this->app->Secure->GetGET('produktion');
$sql = "SELECT p.status from produktion p WHERE p.id = $produktion_id";
$result = $this->app->DB->SelectArr($sql)[0];
$status = $result['status'];
} else {
$sql = "SELECT p.status, p.id from produktion p INNER JOIN produktion_position pp ON pp.produktion = p.id WHERE pp.id = $id"; $sql = "SELECT p.status, p.id from produktion p INNER JOIN produktion_position pp ON pp.produktion = p.id WHERE pp.id = $id";
$result = $this->app->DB->SelectArr($sql)[0]; $result = $this->app->DB->SelectArr($sql)[0];
$status = $result['status']; $status = $result['status'];
$produktion_id = $result['id']; $produktion_id = $result['id'];
}
$input['produktion'] = $produktion_id;
$sql = "SELECT FORMAT(menge,0) as menge FROM produktion_position WHERE produktion = $produktion_id AND stuecklistestufe = 1"; $sql = "SELECT FORMAT(menge,0) as menge FROM produktion_position WHERE produktion = $produktion_id AND stuecklistestufe = 1";
$result = $this->app->DB->SelectArr($sql)[0]; $result = $this->app->DB->SelectArr($sql)[0];
$planmenge = $result['menge']; $planmenge = $result['menge'];
if ($planmenge == 0) {
$this->produktion_position_edit_end("Keine Planung vorhanden.",true, true, $produktion_id);
}
if ($submit != '') if ($submit != '')
{ {
@@ -168,7 +177,7 @@ class Produktion_position {
// Only allow quantities that are a multiple of the target quantity // Only allow quantities that are a multiple of the target quantity
if ($input['menge'] % $planmenge != 0) { if ($input['menge'] % $planmenge != 0) {
$this->produktion_position_edit_end("Positionsmenge muss Vielfaches von $planmenge sein.",true, true); $this->produktion_position_edit_end("Positionsmenge muss Vielfaches von $planmenge sein.",true, true, $produktion_id);
} }
$columns = "id, "; $columns = "id, ";
@@ -200,7 +209,7 @@ class Produktion_position {
} else { } else {
$msg = "Die Einstellungen wurden erfolgreich &uuml;bernommen."; $msg = "Die Einstellungen wurden erfolgreich &uuml;bernommen.";
} }
$this->produktion_position_edit_end($msg,false,true); $this->produktion_position_edit_end($msg,false,true,$produktion_id);
} }
@@ -222,8 +231,8 @@ class Produktion_position {
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername); $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
*/ */
//$this->app->YUI->AutoComplete("artikel", "artikelnummer"); $this->app->YUI->AutoComplete("artikel", "artikelnummer");
$this->app->YUI->AutoComplete("artikel", "lagerartikelnummer"); //$this->app->YUI->AutoComplete("artikel", "lagerartikelnummer");
$this->app->Tpl->Set('ARTIKEL',$this->app->erp->ReplaceArtikel(false, $result[0]['artikel'], false)); // Convert from form to db $this->app->Tpl->Set('ARTIKEL',$this->app->erp->ReplaceArtikel(false, $result[0]['artikel'], false)); // Convert from form to db
$this->app->Tpl->Set('PRODUKTIONID',$result[0]['produktion']); $this->app->Tpl->Set('PRODUKTIONID',$result[0]['produktion']);
+10
View File
@@ -52,6 +52,8 @@ class Shopexport
$this->app->ActionHandler("dateien","ShopexportDateien"); $this->app->ActionHandler("dateien","ShopexportDateien");
$this->app->ActionHandler("live","ShopexportLive"); $this->app->ActionHandler("live","ShopexportLive");
$this->app->ActionHandler('artikellist', 'ShopexportArtikelList');
$this->app->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app); $this->app->ActionHandlerListen($app);
} }
@@ -260,6 +262,7 @@ class Shopexport
$this->app->erp->MenuEintrag("index.php?module=onlineshops&action=edit&id=$id",'Details'); $this->app->erp->MenuEintrag("index.php?module=onlineshops&action=edit&id=$id",'Details');
//$this->app->erp->MenuEintrag("index.php?module=shopexport&action=export&id=$id","Export"); //$this->app->erp->MenuEintrag("index.php?module=shopexport&action=export&id=$id","Export");
$this->app->erp->MenuEintrag('index.php?module=onlineshops&action=artikellist&id='.$id,'Artikelliste');
$this->app->erp->MenuEintrag("index.php?module=shopexport&action=artikeluebertragung&id=$id","Artikel &Uuml;bertragung"); $this->app->erp->MenuEintrag("index.php?module=shopexport&action=artikeluebertragung&id=$id","Artikel &Uuml;bertragung");
if($this->app->DB->Select("SELECT modulename FROM shopexport WHERE id = '$id'") === 'shopimporter_shopware'){ if($this->app->DB->Select("SELECT modulename FROM shopexport WHERE id = '$id'") === 'shopimporter_shopware'){
//Soll nur in Shopware angezeigt werden, da nur in Shopware unterstüzt //Soll nur in Shopware angezeigt werden, da nur in Shopware unterstüzt
@@ -927,6 +930,13 @@ class Shopexport
$this->app->Tpl->Parse('PAGE','shopexport_artikeluebertragung.tpl'); $this->app->Tpl->Parse('PAGE','shopexport_artikeluebertragung.tpl');
} }
public function ShopexportArtikelList()
{
$this->ShopexportMenu();
$this->app->YUI->TableSearch('TAB1','shopexport_artikellist', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "shopexport_artikellist.tpl");
}
public function ShopexportAdressuebertragung() public function ShopexportAdressuebertragung()
{ {
$id = (int)$this->app->Secure->GetGET('id'); $id = (int)$this->app->Secure->GetGET('id');
+3 -3
View File
@@ -178,7 +178,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase
{ {
$accessToken = $this->shopwareToken(); $accessToken = $this->shopwareToken();
$url = $this->ShopUrl; $url = $this->ShopUrl;
$url .= 'v2/' . $endpoint; $url .= $endpoint;
$ch = curl_init(); $ch = curl_init();
$headerInformation[] = 'Content-Type:application/json'; $headerInformation[] = 'Content-Type:application/json';
@@ -1430,7 +1430,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase
]; ];
$this->shopwareRequest('POST', '_action/sync?_response=true', $mediaAssociationData); $this->shopwareRequest('POST', '_action/sync?_response=true', $mediaAssociationData);
$url = $this->ShopUrl . 'v2/_action/media/' . $mediaId . '/upload?extension=' . $extension . '&fileName=' . $filename; $url = $this->ShopUrl . '_action/media/' . $mediaId . '/upload?extension=' . $extension . '&fileName=' . $filename;
$ch = curl_init(); $ch = curl_init();
$setHeaders = [ $setHeaders = [
'Content-Type:image/' . $extension, 'Content-Type:image/' . $extension,
@@ -3480,7 +3480,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase
$documentId = $documentData['documentId']; $documentId = $documentData['documentId'];
$accessToken = $this->shopwareToken(); $accessToken = $this->shopwareToken();
$url = $this->ShopUrl . 'v2/_action/document/' . $documentId . '/upload?_response=true&extension=pdf&fileName=' . $documentNumber; $url = $this->ShopUrl . '_action/document/' . $documentId . '/upload?_response=true&extension=pdf&fileName=' . $documentNumber;
$ch = curl_init(); $ch = curl_init();
$setHeaders = [ $setHeaders = [
+98 -29
View File
@@ -48,11 +48,11 @@ class Ticket {
case "ticket_list": case "ticket_list":
$allowed['ticket_list'] = array('list'); $allowed['ticket_list'] = array('list');
$heading = array('','','Ticket #', 'Letzte Aktion', 'Adresse', 'Betreff', 'Tags', 'Verant.', 'Nachr.', 'Status', 'Alter', 'Projekt', 'Men&uuml;'); $heading = array('','','Ticket #', 'Aktion','Adresse', 'Betreff', 'Tags', 'Verant.', 'Nachr.', 'Status', 'Projekt', 'Men&uuml;');
$width = array('1%','1%','5%', '5%', '5%', '30%', '1%', '5%', '1%', '1%', '1%', '1%', '1%'); $width = array('1%','1%','5%', '5%', '5%', '30%', '1%', '5%', '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'); $findcols = array('t.id','t.id','t.schluessel', 't.zeit', 'a.name', 't.betreff', 't.tags', 'w.warteschlange', 'nachrichten_anz', 't.status', 'p.abkuerzung');
$searchsql = array( 't.schluessel', 't.zeit', 'a.name', 't.betreff','t.notiz', 't.tags', 'w.warteschlange', 't.status', 't.projekt'); $searchsql = array( 't.schluessel', 't.zeit', 'a.name', 't.betreff','t.notiz', 't.tags', 'w.warteschlange', 't.status', 'p.abkuerzung','(SELECT mail FROM ticket_nachricht tn WHERE tn.ticket = t.schluessel AND tn.versendet <> 1 LIMIT 1)');
$defaultorder = 1; $defaultorder = 1;
$defaultorderdesc = 0; $defaultorderdesc = 0;
@@ -65,27 +65,29 @@ class Ticket {
CONCAT(TIMESTAMPDIFF(hour, t.zeit, NOW()),'h'), CONCAT(TIMESTAMPDIFF(hour, t.zeit, NOW()),'h'),
CONCAT(TIMESTAMPDIFF(day, t.zeit, NOW()), 'd ',MOD(TIMESTAMPDIFF(hour, t.zeit, NOW()),24),'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`"; $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>'))"; $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)"; $anzahlnachrichten = "(SELECT COUNT(n.id) FROM ticket_nachricht n WHERE n.ticket = t.schluessel)";
$letztemail = $app->erp->FormatDateTimeShort("(SELECT MAX(n.zeit) FROM ticket_nachricht n WHERE n.ticket = t.schluessel AND n.zeit IS NOT NULL)");
$tagstart = "<li class=\"tag-editor-tag\">"; $tagstart = "<li class=\"tag-editor-tag\">";
$tagend = "</li>"; $tagend = "</li>";
$sql = "SELECT SQL_CALC_FOUND_ROWS $sql = "SELECT SQL_CALC_FOUND_ROWS
t.id, t.id,
".$dropnbox.", ".$dropnbox.",
CONCAT('<a href=\"index.php?module=ticket&action=edit&id=',t.id,'\">',t.schluessel,'</a>'), CONCAT('<a href=\"index.php?module=ticket&action=edit&id=',t.id,'\">',t.schluessel,'</a>'),".
t.zeit, $app->erp->FormatDateTimeShort('zeit')." as aktion,
a.name, CONCAT(COALESCE(CONCAT(a.name,'<br>'),''),COALESCE((SELECT mail FROM ticket_nachricht tn WHERE tn.ticket = t.schluessel AND tn.versendet <> 1 LIMIT 1),'')) as combiadresse,
CONCAT('<b>',".$priobetreff.",'</b><br/><i>',replace(substring(ifnull(t.notiz,''),1,500),'\n','<br/>'),'</i>'), 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>'), 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, w.warteschlange,
".$anzahlnachrichten." as nachrichten_anz, ".$anzahlnachrichten." as `nachrichten_anz`,
".ticket_iconssql().", ".ticket_iconssql().",
".$timedifference.",
p.abkuerzung, p.abkuerzung,
t.id t.id
FROM ticket t FROM ticket t
@@ -149,7 +151,7 @@ class Ticket {
// END Toggle filters // END Toggle filters
$moreinfo = true; // Allow drop down details $moreinfo = true; // Allow drop down details
$menucol = 12; // For moredata $menucol = 11; // For moredata
$count = "SELECT count(DISTINCT id) FROM ticket t WHERE $where"; $count = "SELECT count(DISTINCT id) FROM ticket t WHERE $where";
@@ -170,6 +172,16 @@ class Ticket {
return $erg; return $erg;
} }
// Ensure status 'offen' on self-assigned tickets
function ticket_set_self_assigned_status(array $ids) {
$sql = "UPDATE ticket SET status = 'offen'
WHERE
status = 'neu'
AND id IN (".implode(',',$ids).")
AND warteschlange IN (SELECT label FROM warteschlangen WHERE adresse = '".$this->app->User->GetAdresse()."')";
$this->app->DB->Update($sql);
}
function ticket_list() { function ticket_list() {
// Process multi action // Process multi action
@@ -192,9 +204,10 @@ class Ticket {
} }
$sql .= " WHERE id IN (".implode(",",$selectedIds).")"; $sql .= " WHERE id IN (".implode(",",$selectedIds).")";
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
$this->ticket_set_self_assigned_status($selectedIds);
} }
// List // List
@@ -239,8 +252,8 @@ class Ticket {
n.verfasser, n.verfasser,
n.mail, n.mail,
t.quelle, t.quelle,
n.zeit, ".$this->app->erp->FormatDateTimeShort('n.zeit','zeit').",
n.zeitausgang, ".$this->app->erp->FormatDateTimeShort('n.zeitausgang','zeitausgang').",
n.versendet, n.versendet,
n.text, n.text,
n.textausgang, n.textausgang,
@@ -307,6 +320,7 @@ class Ticket {
$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_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_ZEIT",$message['zeitausgang']);
$this->app->Tpl->Set("NACHRICHT_FLOAT","right"); $this->app->Tpl->Set("NACHRICHT_FLOAT","right");
$this->app->Tpl->Set("META_FLOAT","left");
$this->app->Tpl->Set("NACHRICHT_TEXT",$message['textausgang']); $this->app->Tpl->Set("NACHRICHT_TEXT",$message['textausgang']);
$this->app->Tpl->Set("NACHRICHT_SENDER",htmlentities($message['bearbeiter'])); $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_RECIPIENTS",htmlentities($message['verfasser']." <".$message['mail'].">"));
@@ -327,12 +341,13 @@ class Ticket {
} }
$this->app->Tpl->Set("NACHRICHT_BETREFF",htmlentities($message['betreff']." (Entwurf)")); $this->app->Tpl->Set("NACHRICHT_BETREFF",htmlentities($message['betreff']." (Entwurf)"));
} else { } else {
$this->app->Tpl->Set("NACHRICHT_BETREFF",htmlentities($message['betreff'])); $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_SENDER",htmlentities($message['verfasser']." <".$message['mail_replyto'].">")); $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_RECIPIENTS",htmlentities($message['mail']));
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc'])); $this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc']));
$this->app->Tpl->Set("NACHRICHT_FLOAT","right"); $this->app->Tpl->Set("NACHRICHT_FLOAT","right");
$this->app->Tpl->Set("META_FLOAT","left");
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']); $this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']);
$this->app->Tpl->Set("NACHRICHT_NAME",htmlentities($message['verfasser'])); $this->app->Tpl->Set("NACHRICHT_NAME",htmlentities($message['verfasser']));
} else { } else {
@@ -349,8 +364,9 @@ class Ticket {
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['quelle'])); $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_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_BETREFF",'<a href="index.php?module=ticket&action=text&mid='.$message['id'].'&insecure=1" target="_blank">'.htmlentities($message['betreff']).'</a>');
$this->app->Tpl->Set("NACHRICHT_FLOAT","left"); $this->app->Tpl->Set("NACHRICHT_FLOAT","left");
$this->app->Tpl->Set("META_FLOAT","right");
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']); $this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']);
} }
@@ -365,9 +381,21 @@ class Ticket {
} }
} }
function ticket_text() { function ticket_text() {
$secure_html_tags = array(
'<br>',
'<p>',
'<strong>',
'<b>',
'<table>',
'<tr>',
'<td>',
'<style>'
);
$mid = $this->app->Secure->GetGET('mid'); $mid = $this->app->Secure->GetGET('mid');
$insecure = $this->app->Secure->GetGET('insecure');
if (empty($mid)) { if (empty($mid)) {
return; return;
@@ -378,7 +406,18 @@ class Ticket {
if (empty($messages)) { if (empty($messages)) {
} }
if ($insecure) {
$this->app->Tpl->Set("TEXT",$messages[0]['text']); $this->app->Tpl->Set("TEXT",$messages[0]['text']);
} else {
$secure_text = strip_tags($messages[0]['text'],$secure_html_tags);
if (strlen($secure_text) != strlen($messages[0]['text'])) {
// $secure_text = "<p style=\"all: initial;border-bottom-color:black;border-bottom-style:solid;border-bottom-width:1px;display:block;font-size:small;\">Einige Elemente wurden durch OpenXE blockiert.</p>".$secure_text;
$secure_text = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/icon-invisible.svg\" alt=\"Einige Elemente wurden durch OpenXE blockiert.\" title=\"Einige Elemente wurden durch OpenXE blockiert.\" border=\"0\" style=\"all: initial;display:block;float:right;font-size:small;\">".$secure_text;
}
$this->app->Tpl->Set("TEXT",$secure_text);
}
$this->app->Tpl->Output('ticket_text.tpl'); $this->app->Tpl->Output('ticket_text.tpl');
$this->app->ExitXentral(); $this->app->ExitXentral();
} }
@@ -460,6 +499,9 @@ class Ticket {
$sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update; $sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
$id = $this->app->DB->GetInsertID(); $id = $this->app->DB->GetInsertID();
$this->ticket_set_self_assigned_status(array($id));
return($id); return($id);
} }
@@ -549,7 +591,10 @@ class Ticket {
} }
// Load values again from database // 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];
$sql = "SELECT t.id, t.schluessel, ".$this->app->erp->FormatDateTimeShort("zeit",'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";
$ticket_from_db = $this->app->DB->SelectArr($sql)[0];
foreach ($ticket_from_db as $key => $value) { foreach ($ticket_from_db as $key => $value) {
$this->app->Tpl->Set(strtoupper($key), $value); $this->app->Tpl->Set(strtoupper($key), $value);
@@ -561,6 +606,10 @@ class Ticket {
$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', $this->app->erp->ReplaceAdresse(false,$ticket_from_db['adresse'],false)); // Convert ID to form display
if ($ticket_from_db['mailadresse'] != "") {
$this->app->Tpl->Set('MAILADRESSE',"&lt;".$ticket_from_db['mailadresse']."&gt;");
}
$this->app->Tpl->Set('ADRESSE_ID',$ticket_from_db['adresse']); $this->app->Tpl->Set('ADRESSE_ID',$ticket_from_db['adresse']);
$this->app->YUI->AutoComplete("projekt","projektname",1); $this->app->YUI->AutoComplete("projekt","projektname",1);
@@ -645,14 +694,14 @@ class Ticket {
switch ($submit) { switch ($submit) {
case 'neue_email': case 'neue_email':
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
$senderAddress = $this->app->erp->GetFirmaMail();
if (empty($drafted_messages)) { if (empty($drafted_messages)) {
// Create new message and save it for editing // Create new message and save it for editing
$this->app->Tpl->Set('EMAIL_AN', htmlentities($recv_messages[0]['mail'])); $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 = ""; $to = "";
$cc = ""; $cc = "";
@@ -687,13 +736,30 @@ class Ticket {
$anschreiben = $this->app->DB->Select("SELECT anschreiben FROM adresse WHERE id='".$ticket_from_db['adresse']."' LIMIT 1"); $anschreiben = $this->app->DB->Select("SELECT anschreiben FROM adresse WHERE id='".$ticket_from_db['adresse']."' LIMIT 1");
if($anschreiben=="") if($anschreiben=="")
{ {
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben").",\n".$this->app->erp->Grussformel($projekt,$sprache); $anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben");
} }
$anschreiben = $anschreiben.",<br>".$this->app->erp->Grussformel($projekt,$sprache);
$sql = "INSERT INTO `ticket_nachricht` ( $sql = "INSERT INTO `ticket_nachricht` (
`ticket`, `zeit`, `text`, `betreff`, `medium`, `versendet`, `ticket`, `zeit`, `text`, `betreff`, `medium`, `versendet`,
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`,`mail_cc` `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."');"; ) VALUES ('".
$ticket_from_db['schluessel'].
"',NOW(),'".
$this->app->DB->real_escape_string($anschreiben).
"','".
$this->app->DB->real_escape_string($betreff).
"','email','1','".
$this->app->DB->real_escape_string($senderName).
"','".
$this->app->DB->real_escape_string($to).
"','neu','".
$this->app->DB->real_escape_string($senderName).
"','".
$this->app->DB->real_escape_string($senderAddress).
"','".
$this->app->DB->real_escape_string($cc)."');";
$this->app->DB->Insert($sql); $this->app->DB->Insert($sql);
// Show new message dialog // Show new message dialog
@@ -717,7 +783,7 @@ class Ticket {
$citation_info =$recv_messages[0]['zeit']." ".$recv_messages[0]['verfasser']." &lt;".$recv_messages[0]['mail']."&gt;"; $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>"; $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']; $sql = "UPDATE ticket_nachricht SET text='".$this->app->DB->real_escape_string($text)."' WHERE id=".$drafted_messages[0]['id'];
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
header("Location: index.php?module=ticket&action=edit&id=$id"); header("Location: index.php?module=ticket&action=edit&id=$id");
$this->app->ExitXentral(); $this->app->ExitXentral();
@@ -739,24 +805,27 @@ class Ticket {
// Attachments // Attachments
$files = $this->app->erp->GetDateiSubjektObjektDateiname('Anhang','Ticket',$drafted_messages[0]['id'],""); $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'; $pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,63})(?:\.[a-z]{2})?/i';
preg_match_all($pattern, $drafted_messages[0]['mail'], $matches); preg_match_all($pattern, $drafted_messages[0]['mail'], $matches);
$to = $matches[0]; $to = $matches[0];
if ($drafted_messages[0]['mail_cc'] != '') { 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); preg_match_all($pattern, $drafted_messages[0]['mail_cc'], $matches);
$cc = $matches[0]; $cc = $matches[0];
} else { } else {
$cc = null; $cc = null;
} }
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
$senderAddress = $this->app->erp->GetFirmaMail();
// function MailSend($from,$from_name,$to,$to_name,$betreff,$text,$files="",$projekt="",$signature=true,$cc="",$bcc="", $system = false) // function MailSend($from,$from_name,$to,$to_name,$betreff,$text,$files="",$projekt="",$signature=true,$cc="",$bcc="", $system = false)
if ( if (
$this->app->erp->MailSend( $this->app->erp->MailSend(
$drafted_messages[0]['mail_replyto'], $senderAddress,
$drafted_messages[0]['verfasser_replyto'], $senderName,
$to, $to,
$to, $to,
htmlentities($drafted_messages[0]['betreff']), htmlentities($drafted_messages[0]['betreff']),
@@ -771,7 +840,7 @@ class Ticket {
) { ) {
// Update message in ticket_nachricht // Update message in ticket_nachricht
$sql = "UPDATE `ticket_nachricht` SET `zeitausgang` = NOW(), `betreff` = '".$drafted_messages[0]['betreff']."' WHERE id = ".$drafted_messages[0]['id']; $sql = "UPDATE `ticket_nachricht` SET `zeitausgang` = NOW(), `betreff` = '".$this->app->DB->real_escape_string($drafted_messages[0]['betreff'])."', `verfasser` = '$senderName', `verfasser_replyto` = '$senderName', `mail_replyto` = '$senderAddress' WHERE id = ".$drafted_messages[0]['id'];
$this->app->DB->Insert($sql); $this->app->DB->Insert($sql);
$msg .= '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'.'; $msg .= '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'.';
+242
View File
@@ -0,0 +1,242 @@
<?php
/*
* Copyright (c) 2022 OpenXE project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Uebersetzung {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "uebersetzung_list");
$this->app->ActionHandler("create", "uebersetzung_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "uebersetzung_edit");
$this->app->ActionHandler("delete", "uebersetzung_delete");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
public function Install() {
/* Fill out manually later */
}
public function TableSearch(&$app, $name, $erlaubtevars) {
switch ($name) {
case "uebersetzung_list":
$allowed['uebersetzung_list'] = array('list');
// Transfer a parameter from form -> see below for setting of parameter
// $parameter = $this->app->User->GetParameter('parameter');
$heading = array('','Label', 'Sprache','&Uuml;bersetzung', 'Original', 'Men&uuml;');
$width = array('1%','5%','5%','20%','20%','1%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('id','u.label', 'u.sprache', 'u.beschriftung', 'u.original');
$searchsql = array('u.label', 'u.beschriftung', 'u.sprache', 'u.original');
$defaultorder = 1;
$defaultorderdesc = 0;
// Some options for the columns:
// $numbercols = array(1,2);
// $sumcol = array(1,2);
// $alignright = array(1,2);
$dropnbox = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',u.id,'\" />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=uebersetzung&action=edit&id=%value%\"><img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=uebersetzung&action=delete&id=%value%\");>" . "<img src=\"themes/{$this->app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
$sql = "SELECT SQL_CALC_FOUND_ROWS
u.id,
$dropnbox,
u.label,
u.sprache,
if( CHAR_LENGTH(u.beschriftung) > 100,
CONCAT('<span style=\"word-wrap:anywhere;\">',u.beschriftung,'</span>'),
u.beschriftung)
as beschriftung,
if( CHAR_LENGTH(u.original) > 100,
CONCAT('<span style=\"word-wrap:anywhere;\">',u.original,'</span>'),
u.original)
as original,
u.id FROM uebersetzung u";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM uebersetzung WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function uebersetzung_list() {
// For transfer of form parameter to tablesearch
// $parameter = $this->app->Secure->GetPOST('parameter');
// $this->app->User->SetParameter('parameter', $parameter);
$this->app->erp->MenuEintrag("index.php?module=uebersetzung&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=uebersetzung&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'uebersetzung_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "uebersetzung_list.tpl");
}
public function uebersetzung_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `uebersetzung` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->uebersetzung_list();
}
/*
* Edit uebersetzung item
* If id is empty, create a new one
*/
function uebersetzung_edit() {
$id = $this->app->Secure->GetGET('id');
// Check if other users are editing this id
if($this->app->erp->DisableModul('artikel',$id))
{
return;
}
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=uebersetzung&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=uebersetzung&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
$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 uebersetzung (".$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=uebersetzung&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
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',u.id,'\" />') AS `auswahl`";
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS u.id, $dropnbox, u.label, u.beschriftung, u.sprache, u.original, u.id FROM uebersetzung u"." 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);
*/
$sprachen = $this->app->erp->GetSprachenSelect();
foreach ($sprachen as $key => $value) {
$this->app->Tpl->Add('SPRACHENSELECT', "<option value='".$key."'>".$value."</option>");
}
$this->app->YUI->CkEditor("beschriftung","internal", null, 'JQUERY');
$this->app->YUI->CkEditor("original","internal", null, 'JQUERY');
// $this->SetInput($input);
$this->app->Tpl->Parse('PAGE', "uebersetzung_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['label'] = $this->app->Secure->GetPOST('label');
$input['beschriftung'] = $this->app->Secure->GetPOST('beschriftung');
$input['sprache'] = $this->app->Secure->GetPOST('sprache');
$input['original'] = $this->app->Secure->GetPOST('original');
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('LABEL', $input['label']);
$this->app->Tpl->Set('BESCHRIFTUNG', $input['beschriftung']);
$this->app->Tpl->Set('SPRACHE', $input['sprache']);
$this->app->Tpl->Set('ORIGINAL', $input['original']);
}
}
+12 -6
View File
@@ -30,7 +30,10 @@ class upgrade {
$db_verbose = $this->app->Secure->GetPOST('db_details_anzeigen') === '1'; $db_verbose = $this->app->Secure->GetPOST('db_details_anzeigen') === '1';
$force = $this->app->Secure->GetPOST('erzwingen') === '1'; $force = $this->app->Secure->GetPOST('erzwingen') === '1';
include("../upgrade/upgrade.php"); $this->app->Tpl->Set('DETAILS_ANZEIGEN', $verbose?"checked":"");
$this->app->Tpl->Set('DB_DETAILS_ANZEIGEN', $db_verbose?"checked":"");
include("../upgrade/data/upgrade.php");
$logfile = "../upgrade/data/upgrade.log"; $logfile = "../upgrade/data/upgrade.log";
upgrade_set_out_file_name($logfile); upgrade_set_out_file_name($logfile);
@@ -38,27 +41,29 @@ class upgrade {
$this->app->Tpl->Set('UPGRADE_VISIBLE', "hidden"); $this->app->Tpl->Set('UPGRADE_VISIBLE', "hidden");
$this->app->Tpl->Set('UPGRADE_DB_VISIBLE', "hidden"); $this->app->Tpl->Set('UPGRADE_DB_VISIBLE', "hidden");
//function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do_git, bool $export_db, bool $check_db, bool $do_db, bool $force, bool $connection) //function upgrade_main(string $directory,bool $verbose, bool $check_git, bool $do_git, bool $export_db, bool $check_db, bool $do_db, bool $force, bool $connection, bool $origin) {
$directory = dirname(getcwd())."/upgrade";
switch ($submit) { switch ($submit) {
case 'check_upgrade': case 'check_upgrade':
$this->app->Tpl->Set('UPGRADE_VISIBLE', ""); $this->app->Tpl->Set('UPGRADE_VISIBLE', "");
unlink($logfile); unlink($logfile);
upgrade_main("../upgrade",$verbose,true,false,false,true,false,$force,false); upgrade_main($directory,$verbose,true,false,false,true,false,$force,false,false);
break; break;
case 'do_upgrade': case 'do_upgrade':
unlink($logfile); unlink($logfile);
upgrade_main("../upgrade",$verbose,true,true,false,true,true,$force,false); upgrade_main($directory,$verbose,true,true,false,true,true,$force,false,false);
break; break;
case 'check_db': case 'check_db':
$this->app->Tpl->Set('UPGRADE_DB_VISIBLE', ""); $this->app->Tpl->Set('UPGRADE_DB_VISIBLE', "");
unlink($logfile); unlink($logfile);
upgrade_main("../upgrade",$db_verbose,false,false,false,true,false,$force,false); upgrade_main($directory,$db_verbose,false,false,false,true,false,$force,false,false);
break; break;
case 'do_db_upgrade': case 'do_db_upgrade':
$this->app->Tpl->Set('UPGRADE_DB_VISIBLE', ""); $this->app->Tpl->Set('UPGRADE_DB_VISIBLE', "");
unlink($logfile); unlink($logfile);
upgrade_main("../upgrade",$db_verbose,false,false,false,true,true,$force,false); upgrade_main($directory,$db_verbose,false,false,false,true,true,$force,false,false);
break; break;
case 'refresh': case 'refresh':
break; break;
@@ -73,3 +78,4 @@ class upgrade {
} }
+223
View File
@@ -0,0 +1,223 @@
<?php
/*
* Copyright (c) 2022 OpenXE project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Waehrungumrechnung {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "waehrung_umrechnung_list");
$this->app->ActionHandler("create", "waehrung_umrechnung_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "waehrung_umrechnung_edit");
$this->app->ActionHandler("delete", "waehrung_umrechnung_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 "waehrung_umrechnung_list":
$allowed['waehrung_umrechnung_list'] = array('list');
$heading = array('','','W&auml;hrung von', 'W&auml;hrung nach', 'Kurs', 'G&uuml;ltig bis', 'Ge&auml;ndert am', 'Bearbeiter', 'Kommentar', 'Men&uuml;');
$width = array('1%','1%','10%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('id','id','w.waehrung_von', 'w.waehrung_nach', 'w.kurs', 'w.gueltig_bis', 'w.zeitstempel', 'w.bearbeiter', 'w.kommentar');
$searchsql = array('w.waehrung_von', 'w.waehrung_nach', 'w.kurs', 'w.gueltig_bis', 'w.zeitstempel', 'w.bearbeiter', 'w.kommentar');
$defaultorder = 1;
$defaultorderdesc = 0;
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',w.id,'\" />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=waehrungumrechnung&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=waehrungumrechnung&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, $dropnbox, w.waehrung_von, w.waehrung_nach, ".$app->erp->FormatMenge('w.kurs',4).", ".$app->erp->FormatDate("w.gueltig_bis").", ".$app->erp->FormatDateTime('w.zeitstempel').", w.bearbeiter, w.kommentar, w.id FROM waehrung_umrechnung w";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM waehrung_umrechnung WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function waehrung_umrechnung_list() {
$this->app->erp->MenuEintrag("index.php?module=waehrungumrechnung&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=waehrungumrechnung&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'waehrung_umrechnung_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "waehrungumrechnung_list.tpl");
}
public function waehrung_umrechnung_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `waehrung_umrechnung` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->waehrung_umrechnung_list();
}
/*
* Edit waehrung_umrechnung item
* If id is empty, create a new one
*/
function waehrung_umrechnung_edit() {
$id = $this->app->Secure->GetGET('id');
// Check if other users are editing this id
if($this->app->erp->DisableModul('artikel',$id))
{
return;
}
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=waehrungumrechnung&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=waehrungumrechnung&action=list", "Zur&uuml;ck zur &Uuml;bersicht");
$id = $this->app->Secure->GetGET('id');
$input = $this->GetInput();
$submit = $this->app->Secure->GetPOST('submit');
$input['gueltig_bis'] = $this->app->erp->ReplaceDatum(true,$input['gueltig_bis'],true);
if (empty($id)) {
// New item
$id = 'NULL';
}
if ($submit != '')
{
// Write to database
// Add checks here
$input['bearbeiter'] = $this->app->DB->real_escape_string($this->app->User->GetName());
$input['zeitstempel'] = date('Y-m-d H:m:s');
$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 waehrung_umrechnung (".$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=waehrungumrechnung&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
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',w.id,'\" />') AS `auswahl`";
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS w.id, $dropnbox, w.waehrung_von, w.waehrung_nach, w.kurs, w.gueltig_bis, w.zeitstempel, w.bearbeiter, w.kommentar, w.id FROM waehrung_umrechnung w"." 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->SetInput($input);
$this->app->YUI->DatePicker("gueltig_bis");
$this->app->Tpl->Set('GUELTIG_BIS',$this->app->erp->ReplaceDatum(false,$result[0]['gueltig_bis'],true));
$this->app->Tpl->Set('WAEHRUNG_VON',$this->app->erp->getSelectAsso($this->app->erp->GetWaehrung(), $result[0]['waehrung_von']));
$this->app->Tpl->Set('WAEHRUNG_NACH',$this->app->erp->getSelectAsso($this->app->erp->GetWaehrung(), $result[0]['waehrung_nach']));
$this->app->Tpl->Parse('PAGE', "waehrungumrechnung_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['waehrung_von'] = $this->app->Secure->GetPOST('waehrung_von');
$input['waehrung_nach'] = $this->app->Secure->GetPOST('waehrung_nach');
$input['kurs'] = $this->app->Secure->GetPOST('kurs');
$input['gueltig_bis'] = $this->app->Secure->GetPOST('gueltig_bis');
$input['zeitstempel'] = $this->app->Secure->GetPOST('zeitstempel');
$input['bearbeiter'] = $this->app->Secure->GetPOST('bearbeiter');
$input['kommentar'] = $this->app->Secure->GetPOST('kommentar');
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('WAEHRUNG_VON', $input['waehrung_von']);
$this->app->Tpl->Set('WAEHRUNG_NACH', $input['waehrung_nach']);
$this->app->Tpl->Set('KURS', $input['kurs']);
$this->app->Tpl->Set('GUELTIG_BIS', $input['gueltig_bis']);
$this->app->Tpl->Set('ZEITSTEMPEL', $input['zeitstempel']);
$this->app->Tpl->Set('BEARBEITER', $input['bearbeiter']);
$this->app->Tpl->Set('KOMMENTAR', $input['kommentar']);
}
}
+202
View File
@@ -0,0 +1,202 @@
<?php
/*
* Copyright (c) 2022 OpenXE project
*/
use Xentral\Components\Database\Exception\QueryFailureException;
class Zolltarifnummer {
function __construct($app, $intern = false) {
$this->app = $app;
if ($intern)
return;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "zolltarifnummer_list");
$this->app->ActionHandler("create", "zolltarifnummer_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "zolltarifnummer_edit");
$this->app->ActionHandler("delete", "zolltarifnummer_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 "zolltarifnummer_list":
$allowed['zolltarifnummer_list'] = array('list');
$heading = array('','','Nummer', 'Beschreibung', 'Interne Bemerkung', 'Men&uuml;');
$width = array('1%','1%','30%','30%','30%','1%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('z.id','z.id','z.nummer', 'z.beschreibung', 'z.internebemerkung');
$searchsql = array('z.nummer', 'z.beschreibung', 'z.internebemerkung');
$defaultorder = 1;
$defaultorderdesc = 0;
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',z.id,'\" />') AS `auswahl`";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=zolltarifnummer&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=zolltarifnummer&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 z.id, $dropnbox, z.nummer, z.beschreibung, z.internebemerkung, z.id FROM zolltarifnummer z";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM zolltarifnummer WHERE $where";
// $groupby = "";
break;
}
$erg = false;
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
function zolltarifnummer_list() {
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=create", "Neu anlegen");
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'zolltarifnummer_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "zolltarifnummer_list.tpl");
}
public function zolltarifnummer_delete() {
$id = (int) $this->app->Secure->GetGET('id');
$this->app->DB->Delete("DELETE FROM `zolltarifnummer` WHERE `id` = '{$id}'");
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gel&ouml;scht.</div>");
$this->zolltarifnummer_list();
}
/*
* Edit zolltarifnummer item
* If id is empty, create a new one
*/
function zolltarifnummer_edit() {
$id = $this->app->Secure->GetGET('id');
// Check if other users are editing this id
if($this->app->erp->DisableModul('artikel',$id))
{
return;
}
$this->app->Tpl->Set('ID', $id);
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=edit&id=$id", "Details");
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&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
$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 zolltarifnummer (".$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=zolltarifnummer&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
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',z.id,'\" />') AS `auswahl`";
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS z.id, $dropnbox, z.nummer, z.beschreibung, z.internebemerkung, z.id FROM zolltarifnummer z"." 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->SetInput($input);
$this->app->Tpl->Parse('PAGE', "zolltarifnummer_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['nummer'] = $this->app->Secure->GetPOST('nummer');
$input['beschreibung'] = $this->app->Secure->GetPOST('beschreibung');
$input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung');
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('NUMMER', $input['nummer']);
$this->app->Tpl->Set('BESCHREIBUNG', $input['beschreibung']);
$this->app->Tpl->Set('INTERNEBEMERKUNG', $input['internebemerkung']);
}
}
+1 -1
View File
@@ -101,7 +101,7 @@
unset($_POST['_ACTION']); unset($_POST['_ACTION']);
unset($_POST['_SUBMIT']); unset($_POST['_SUBMIT']);
$error = ((function_exists($action)) ? $action() : ''); $error = ((function_exists($action ?? '')) ? $action() : '');
if($configfile=='') $error .= "<br>'configfile' for this step is missing"; if($configfile=='') $error .= "<br>'configfile' for this step is missing";
if($error=='') { if($error=='') {
+21 -10
View File
@@ -1809,12 +1809,12 @@ fieldset.usersave div.filter-item > label {
fieldset { fieldset {
position: relative; position: relative;
margin: 0; margin: 0;
margin-top: 5px; /* margin-top: 5px;
padding: 5px; padding: 5px;
border: 0 solid transparent; border: 0 solid transparent;
border-top: 25px solid transparent; border-top: 25px solid transparent;
border-bottom: 5px solid transparent; border-bottom: 5px solid transparent;
border-width: 24px 5px 0; border-width: 24px 5px 0;*/
border-color: transparent; border-color: transparent;
background-color: transparent; background-color: transparent;
} }
@@ -2139,7 +2139,7 @@ img {
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
-moz-border-radius: 4px; -moz-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
padding-top: 2px; /* padding-top: 2px;*/
} }
@@ -2467,12 +2467,23 @@ ul.tag-editor {
visibility: hidden; visibility: hidden;
} }
.ticket_nachricht_box {
border: solid 1px;
border-color: var(--textfield-border);
border-radius: 7px;
padding: 0px !important;
}
.ticket_nachricht_box fieldset {
padding: 0px !important;
}
.ticket_text { .ticket_text {
width: 100%; width: 100%;
border: none; border: none;
height: 300px;
} }
.ui-button-icon, .ui-button-icon,
.ui-button:not(.ui-dialog-titlebar-close):not(.button-secondary), .ui-button:not(.ui-dialog-titlebar-close):not(.button-secondary),
input[type=submit]:not(.button-secondary) { input[type=submit]:not(.button-secondary) {
@@ -3373,7 +3384,7 @@ div.noteit_highprio {
right: 10px; right: 10px;
top: 28px; top: 28px;
} }
/*
@media screen and (min-width: 320px) { @media screen and (min-width: 320px) {
.mkTableFormular tr td:first-child { .mkTableFormular tr td:first-child {
padding-top: 7px; padding-top: 7px;
@@ -3386,7 +3397,7 @@ div.noteit_highprio {
} }
.mkTableFormular tr td { .mkTableFormular tr td {
vertical-align: top; vertical-align: top;
} }*/
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.hide768 { .hide768 {
display: none; display: none;
@@ -3699,10 +3710,10 @@ span.red, b.red {
} }
.dataTables_wrapper .dataTables_processing { .dataTables_wrapper .dataTables_processing {
background: url('../images/loading.gif') no-repeat; background: url('../images/loading.gif') no-repeat !important;
background-position: 50% 0; background-position: 50% 0 !important;
background-size: 150px; background-size: 150px !important;
padding-top: 90px; padding-top: 90px !important;
} }
a.ui-tabs-anchor:hover { a.ui-tabs-anchor:hover {
+1
View File
@@ -13,6 +13,7 @@
<script src="themes/new/js/scripts_login.js"></script> <script src="themes/new/js/scripts_login.js"></script>
<link rel="stylesheet" href="themes/new/css/normalize.min.css?v=5"> <link rel="stylesheet" href="themes/new/css/normalize.min.css?v=5">
<link rel="stylesheet" href="themes/new/css/login_styles.css?v=3"> <link rel="stylesheet" href="themes/new/css/login_styles.css?v=3">
<link rel="stylesheet" href="themes/new/css/custom.css?v=3">
</head> </head>
<body> <body>
@@ -75,9 +75,10 @@ class WidgetGenimportvorlage
$field->AddOption('Adresse&nbsp;(min. Angabe: name)','adresse'); $field->AddOption('Adresse&nbsp;(min. Angabe: name)','adresse');
$field->AddOption('Artikel&nbsp;(min. Angabe: nummer oder name_de)','artikel'); $field->AddOption('Artikel&nbsp;(min. Angabe: nummer oder name_de)','artikel');
$field->AddOption('Einkaufspreise&nbsp;(min. Angabe: lieferantennummer und herstellernummer oder herstellernummer )','einkauf'); $field->AddOption('Einkaufspreise&nbsp;(min. Angabe: lieferantennummer und herstellernummer oder herstellernummer )','einkauf');
$field->AddOption('Zeiterfassung&nbsp;(min. Angabe datum_von,zeit_von,datum_bis,zeit_bis,kundennummer,taetigkeit)','zeiterfassung'); $field->AddOption('Zeiterfassung&nbsp;(min. Angabe: datum_von,zeit_von,datum_bis,zeit_bis,kundennummer,taetigkeit)','zeiterfassung');
$field->AddOption('Wiedervorlagen (min. Angabe datum_faellig, kundennummer,mitarbeiternummer,betreff)','wiedervorlagen'); $field->AddOption('Wiedervorlagen (min. Angabe: datum_faellig, kundennummer,mitarbeiternummer,betreff)','wiedervorlagen');
$field->AddOption('Notizen (min. Angabe datum,kundennummer,mitarbeiternummer,betreff)','notizen'); $field->AddOption('Notizen (min. Angabe: datum,kundennummer,mitarbeiternummer,betreff)','notizen');
$field->AddOption('Kontenrahmen (min. Angabe: sachkonto,beschriftung,art)','kontorahmen');
$this->form->NewField($field); $this->form->NewField($field);
$field = new HTMLInput("importerstezeilenummer","text","","15","","","","","","","","0","",""); $field = new HTMLInput("importerstezeilenummer","text","","15","","","","","","","","0","","");
+12
View File
@@ -509,6 +509,18 @@ class WidgetGenprojekt
$field = new HTMLInput("steuer_aufwendung_inland_import","text","","10","","","","","","","","0","",""); $field = new HTMLInput("steuer_aufwendung_inland_import","text","","10","","","","","","","","0","","");
$this->form->NewField($field); $this->form->NewField($field);
$field = new HTMLInput("buchhaltung_berater","text","","10","","","","","","","","0","","");
$this->form->NewField($field);
$field = new HTMLInput("buchhaltung_mandant","text","","10","","","","","","","","0","","");
$this->form->NewField($field);
$field = new HTMLInput("buchhaltung_wj_beginn","text","","10","","","","","","","","0","","");
$this->form->NewField($field);
$field = new HTMLInput("buchhaltung_sachkontenlaenge","text","","10","","","","","","","","0","","");
$this->form->NewField($field);
$field = new HTMLSelect("kasse_lagerprozess",0,"kasse_lagerprozess","","","0"); $field = new HTMLSelect("kasse_lagerprozess",0,"kasse_lagerprozess","","","0");
$field->AddOption('{|Keine Lagerbuchung erzeugen|}','kein'); $field->AddOption('{|Keine Lagerbuchung erzeugen|}','kein');
+67 -12
View File
@@ -83,7 +83,7 @@ function abweichend2()
<fieldset><legend>{|Allgemein|}</legend> <fieldset><legend>{|Allgemein|}</legend>
<table class="mkTableFormular"> <table class="mkTableFormular">
<tr id="kundestyle"><td><legend>{|Kunde|}</legend></td><td nowrap>[ADRESSE][MSGADRESSE]&nbsp;[BUTTON_UEBERNEHMEN]</td></tr> <tr id="kundestyle"><td>{|Kunde|}</td><td nowrap>[ADRESSE][MSGADRESSE]&nbsp;[BUTTON_UEBERNEHMEN]</td></tr>
<tr id="lieferantenauftragstyle"><td><legend>{|Lieferant|}</legend></td><td nowrap>[LIEFERANT][MSGLIEFERANT]&nbsp;[BUTTON_UEBERNEHMEN2]</td></tr> <tr id="lieferantenauftragstyle"><td><legend>{|Lieferant|}</legend></td><td nowrap>[LIEFERANT][MSGLIEFERANT]&nbsp;[BUTTON_UEBERNEHMEN2]</td></tr>
<tr><td>{|an Lieferanten|}:</td><td nowrap>[LIEFERANTENAUFTRAG][MSGLIEFERANTENAUFTRAG]&nbsp;</td></tr> <tr><td>{|an Lieferanten|}:</td><td nowrap>[LIEFERANTENAUFTRAG][MSGLIEFERANTENAUFTRAG]&nbsp;</td></tr>
<tr><td>{|Projekt|}:</td><td>[PROJEKT][MSGPROJEKT]</td></tr> <tr><td>{|Projekt|}:</td><td>[PROJEKT][MSGPROJEKT]</td></tr>
@@ -228,18 +228,51 @@ function abweichend2()
<fieldset><legend>{|Auftrag|}</legend> <fieldset><legend>{|Auftrag|}</legend>
<table class="mkTableFormular"> <table class="mkTableFormular">
<tr><td>{|Zahlungsweise|}:</td><td>[ZAHLUNGSWEISE][MSGZAHLUNGSWEISE] <tr>
<br>[VORABBEZAHLTMARKIEREN][MSGVORABBEZAHLTMARKIEREN]&nbsp;manuell Zahlungsfreigabe erteilen <td>
</td></tr> {|Zahlungsweise|}:
</td>
<td>
[ZAHLUNGSWEISE][MSGZAHLUNGSWEISE]
</td>
</tr>
<tr>
<td>
{|Manuell Zahlungsfreigabe erteilen|}:
</td>
<td>
[VORABBEZAHLTMARKIEREN][MSGVORABBEZAHLTMARKIEREN]
</td>
</tr>
<tr><td>{|Versandart|}:</td><td>[VERSANDART][MSGVERSANDART]</td></tr> <tr><td>{|Versandart|}:</td><td>[VERSANDART][MSGVERSANDART]</td></tr>
<tr><td><label for="lieferbedingung">{|Lieferbedingung|}:</label></td><td>[LIEFERBEDINGUNG][MSGLIEFERBEDINGUNG]</td></tr> <tr><td><label for="lieferbedingung">{|Lieferbedingung|}:</label></td><td>[LIEFERBEDINGUNG][MSGLIEFERBEDINGUNG]</td></tr>
<tr><td>{|Vertrieb|}:</td><td>[VERTRIEB][MSGVERTRIEB]&nbsp;[VERTRIEBBUTTON]</td></tr> <tr><td>{|Vertrieb|}:</td><td>[VERTRIEB][MSGVERTRIEB]&nbsp;[VERTRIEBBUTTON]</td></tr>
<tr><td>{|Bearbeiter|}:</td><td>[BEARBEITER][MSGBEARBEITER]&nbsp;[INNENDIENSTBUTTON]</td></tr> <tr><td>{|Bearbeiter|}:</td><td>[BEARBEITER][MSGBEARBEITER]&nbsp;[INNENDIENSTBUTTON]</td></tr>
<tr><td>{|Portopr&uuml;fung ausschalten|}:</td><td>[KEINPORTO][MSGKEINPORTO]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tr>
{|Kein Briefpapier und Logo|}:&nbsp;[OHNE_BRIEFPAPIER][MSGOHNE_BRIEFPAPIER]</td></tr> <td>
<tr><td>{|Artikeltexte ausblenden|}:</td><td>[OHNE_ARTIKELTEXT][MSGOHNE_ARTIKELTEXT]</td></tr> {|Portopr&uuml;fung ausschalten|}:
</td>
<td>
[KEINPORTO][MSGKEINPORTO]
</td>
</tr>
<tr>
<td>
{|Kein Briefpapier und Logo|}:
</td>
<td>
[OHNE_BRIEFPAPIER][MSGOHNE_BRIEFPAPIER]
</td>
</tr>
<tr>
<td>
{|Artikeltexte ausblenden|}:
</td>
<td>
[OHNE_ARTIKELTEXT][MSGOHNE_ARTIKELTEXT]
</td>
</tr>
</table> </table>
</fieldset> </fieldset>
<fieldset><legend>{|Versandzentrum Optionen|}</legend> <fieldset><legend>{|Versandzentrum Optionen|}</legend>
@@ -261,7 +294,7 @@ function abweichend2()
<div class="col-xs-12 col-sm-6 col-sm-height"> <div class="col-xs-12 col-sm-6 col-sm-height">
<div class="inside inside-full-height"> <div class="inside inside-full-height">
<fieldset><legend>{|Sonstiges|}</legend> <fieldset><legend>{|Sonstigess|}</legend>
<table class="mkTableFormular"><tr><td>{|GLN|}:</td><td>[GLN][MSGGLN]</td></tr>[EXTRABEREICHSONSTIGES]</table> <table class="mkTableFormular"><tr><td>{|GLN|}:</td><td>[GLN][MSGGLN]</td></tr>[EXTRABEREICHSONSTIGES]</table>
</fieldset> </fieldset>
@@ -295,7 +328,7 @@ function abweichend(cmd)
<div id="rechnung" style="display:[RECHNUNG]"> <div id="rechnung">
<fieldset><legend>{|Rechnung|}</legend> <fieldset><legend>{|Rechnung|}</legend>
<table width="100%"> <table width="100%">
<tr><td width="200">{|Zahlungsziel (in Tagen)|}:</td><td>[ZAHLUNGSZIELTAGE][MSGZAHLUNGSZIELTAGE]</td></tr> <tr><td width="200">{|Zahlungsziel (in Tagen)|}:</td><td>[ZAHLUNGSZIELTAGE][MSGZAHLUNGSZIELTAGE]</td></tr>
@@ -397,8 +430,30 @@ function abweichend(cmd)
<fieldset><legend>UST-Pr&uuml;fung</legend> <fieldset><legend>UST-Pr&uuml;fung</legend>
<table width="100%"> <table width="100%">
<tr><td width="200">{|UST ID|}:</td><td>[USTID][MSGUSTID]</td></tr> <tr><td width="200">{|UST ID|}:</td><td>[USTID][MSGUSTID]</td></tr>
<tr><td>{|Besteuerung|}:</td><td>[UST_BEFREIT][MSGUST_BEFREIT]&nbsp;[KEINSTEUERSATZ][MSGKEINSTEUERSATZ]&nbsp;{|ohne Hinweis bei EU oder Export|}</td></tr> <tr>
<tr><td>{|UST-ID gepr&uuml;ft|}:</td><td>[UST_OK][MSGUST_OK]&nbsp;UST / Export gepr&uuml;ft + Freigabe f&uuml;r Versand</td></tr> <td>
{|Besteuerung|}:
</td>
<td>
[UST_BEFREIT][MSGUST_BEFREIT]
</td>
</tr>
<tr>
<td>
{|Ohne Hinweis bei EU oder Export|}:
</td>
<td>
[KEINSTEUERSATZ][MSGKEINSTEUERSATZ]
</td>
</tr>
<tr>
<td>
{|UST-ID gepr&uuml;ft|}:
</td>
<td>
[UST_OK]&nbsp;UST / Export gepr&uuml;ft + Freigabe f&uuml;r Versand
</td>
</tr>
</table> </table>
</fieldset> </fieldset>
+25 -9
View File
@@ -348,14 +348,11 @@
<div class="row"> <div class="row">
<div class="row-height"> <div class="row-height">
<div class="col-xs-12 col-md-6 col-md-height"> <div class="col-xs-12 col-md-4 col-md-height">
<div class="inside inside-full-height"> <div class="inside inside-full-height">
<fieldset> <fieldset>
<legend>{|Finanzbuchhaltung Export Kontenrahmen|}</legend> <legend>{|Finanzbuchhaltung Export Erl&ouml;se|}</legend>
<table border="0" width="100%"> <table border="0" width="100%">
<tr>
<td width="300"></td><td>Erl&ouml;se</td>
</tr>
<tr> <tr>
<td width="300">Inland (normal):</td><td>[STEUER_ERLOESE_INLAND_NORMAL][MSGSTEUER_ERLOESE_INLAND_NORMAL]</td> <td width="300">Inland (normal):</td><td>[STEUER_ERLOESE_INLAND_NORMAL][MSGSTEUER_ERLOESE_INLAND_NORMAL]</td>
</tr> </tr>
@@ -380,13 +377,11 @@
</fieldset> </fieldset>
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-6 col-md-height"> <div class="col-xs-12 col-md-4 col-md-height">
<div class="inside inside-full-height"> <div class="inside inside-full-height">
<fieldset> <fieldset>
<legend>{|Finanzbuchhaltung Export Aufwendungen|}</legend>
<table> <table>
<tr>
<td width="300"></td><td>Aufwendungen</td>
</tr>
<tr> <tr>
<td width="300">Inland (normal):</td><td>[STEUER_AUFWENDUNG_INLAND_NORMAL][MSGSTEUER_AUFWENDUNG_INLAND_NORMAL]</td> <td width="300">Inland (normal):</td><td>[STEUER_AUFWENDUNG_INLAND_NORMAL][MSGSTEUER_AUFWENDUNG_INLAND_NORMAL]</td>
</tr> </tr>
@@ -412,6 +407,27 @@
</fieldset> </fieldset>
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-4 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Finanzbuchhaltung Export Einstellungen|}</legend>
<table>
<tr>
<td width="300">Berater:</td><td>[BUCHHALTUNG_BERATER]</td>
</tr>
<tr>
<td width="300">Mandant:</td><td>[BUCHHALTUNG_MANDANT]</td>
</tr>
<tr>
<td width="300">Wirtschaftsjahr Beginn (MMDD):</td><td>[BUCHHALTUNG_WJ_BEGINN]</td>
</tr>
<tr>
<td width="300">Sachkontenl&auml;nge (4-8):</td><td>[BUCHHALTUNG_SACHKONTENLAENGE]</td>
</tr>
</table>
</fieldset>
</div>
</div>
</div> </div>
</div> </div>
<br /> <br />