Compare commits
200
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f135f6852 | ||
|
|
75aaf5e2af | ||
|
|
e9cec0ce30 | ||
|
|
226a2dffdf | ||
|
|
44781b52bb | ||
|
|
245e2d1545 | ||
|
|
e2fc1e15e8 | ||
|
|
49c934ede4 | ||
|
|
61047af440 | ||
|
|
cb8b2487d7 | ||
|
|
2ffee66e00 | ||
|
|
37a6fecc36 | ||
|
|
d35a4f41b9 | ||
|
|
aae29d6281 | ||
|
|
d846a251ca | ||
|
|
c00ae0eb5b | ||
|
|
05714cfd21 | ||
|
|
4be2d5af23 | ||
|
|
1e371e7377 | ||
|
|
2397fda1e6 | ||
|
|
ad3207d67c | ||
|
|
e0a049608e | ||
|
|
0572295637 | ||
|
|
770a36b183 | ||
|
|
826923fd51 | ||
|
|
9657e16797 | ||
|
|
aff5eef945 | ||
|
|
3d8c7a13e3 | ||
|
|
6bb54be5a3 | ||
|
|
9a45653eaf | ||
|
|
9daaf58281 | ||
|
|
0eb3ba50f2 | ||
|
|
f0bebba1ff | ||
|
|
da0b7d2720 | ||
|
|
00dc3414a2 | ||
|
|
ce11caac12 | ||
|
|
bb3a68042d | ||
|
|
f8bfe19f1d | ||
|
|
d89c23ad0e | ||
|
|
cb3191393a | ||
|
|
0b4be37433 | ||
|
|
9a721758a9 | ||
|
|
424d77a795 | ||
|
|
357497f10f | ||
|
|
f9550ca18b | ||
|
|
99eed95d85 | ||
|
|
c9a24e7f75 | ||
|
|
f535679263 | ||
|
|
613d45b1cc | ||
|
|
1fdd6dbf95 | ||
|
|
cad0103b7f | ||
|
|
57d0592a9a | ||
|
|
f76400e248 | ||
|
|
3c7e189acb | ||
|
|
c006c1c474 | ||
|
|
2844c1cc67 | ||
|
|
14bf992b2b | ||
|
|
78e56ab160 | ||
|
|
ab65feb455 | ||
|
|
93e3b01a25 | ||
|
|
5b74049f5c | ||
|
|
aa3dea0277 | ||
|
|
67d7a63898 | ||
|
|
2acc8aceb9 | ||
|
|
1f661b9a2b | ||
|
|
45164166f5 | ||
|
|
d94c05383a | ||
|
|
135017158c | ||
|
|
71861079e3 | ||
|
|
0648e57b63 | ||
|
|
bb9fd68613 | ||
|
|
143e4e96bd | ||
|
|
2cfe710c9a | ||
|
|
0afc12e718 | ||
|
|
529587c0f5 | ||
|
|
35f6532520 | ||
|
|
84eaf1b495 | ||
|
|
c519d8030a | ||
|
|
0848148b9e | ||
|
|
6c9d8b7594 | ||
|
|
51f9929228 | ||
|
|
508ee0ae8e | ||
|
|
ca9b48cb58 | ||
|
|
817dd802aa | ||
|
|
6a5679ba23 | ||
|
|
724c57d309 | ||
|
|
5ccd0edbb9 | ||
|
|
0ad4b9600c | ||
|
|
a731d0f5df | ||
|
|
3ea5c0e478 | ||
|
|
68554f91c1 | ||
|
|
d44fa8ddb0 | ||
|
|
7a530e1274 | ||
|
|
e3b7634581 | ||
|
|
87e941516e | ||
|
|
e5637b226e | ||
|
|
08262cce5c | ||
|
|
ce268dca0e | ||
|
|
77393c186e | ||
|
|
8159ae4346 | ||
|
|
264bc56365 | ||
|
|
e4773da6f0 | ||
|
|
c248cb16fb | ||
|
|
23f390a74f | ||
|
|
8cc64aee19 | ||
|
|
36501a5013 | ||
|
|
c1c963624d | ||
|
|
a041c6a82c | ||
|
|
4815e61883 | ||
|
|
1a343b4b55 | ||
|
|
b70676f4a0 | ||
|
|
6df7be74b7 | ||
|
|
a3c253a13b | ||
|
|
b5926ee039 | ||
|
|
9b62b7c247 | ||
|
|
d41745ceda | ||
|
|
8c1eb6c3cc | ||
|
|
d6dcc9f4c6 | ||
|
|
ae261d7a47 | ||
|
|
c443496462 | ||
|
|
5d1319b419 | ||
|
|
d31c7a8961 | ||
|
|
1351def3bd | ||
|
|
cdfb234393 | ||
|
|
483a002014 | ||
|
|
e25ffdd1f1 | ||
|
|
84483f0444 | ||
|
|
1c955a5bca | ||
|
|
6dad06e07d | ||
|
|
9da2e33077 | ||
|
|
9087f4f01d | ||
|
|
e82685d280 | ||
|
|
e2869af239 | ||
|
|
beb004f374 | ||
|
|
e6baa612a5 | ||
|
|
c641d41219 | ||
|
|
76603076cd | ||
|
|
461b262e16 | ||
|
|
17fa438529 | ||
|
|
14e64b8f4b | ||
|
|
df028888e9 | ||
|
|
625b9627e8 | ||
|
|
3ee518af03 | ||
|
|
8518e327aa | ||
|
|
84cdd8754a | ||
|
|
7c468dbced | ||
|
|
ba31fc62cf | ||
|
|
f6a1315192 | ||
|
|
c219c32212 | ||
|
|
e1b8b7864f | ||
|
|
822960b9f0 | ||
|
|
0fef7146c6 | ||
|
|
27d48a55bb | ||
|
|
06dbb9b8b8 | ||
|
|
99d5804ffa | ||
|
|
c601ac17df | ||
|
|
3d37049ea1 | ||
|
|
1bf8f567b4 | ||
|
|
39e741a595 | ||
|
|
e2120d1862 | ||
|
|
8c67d97728 | ||
|
|
3b804ef745 | ||
|
|
aea469320f | ||
|
|
a9cab336d0 | ||
|
|
4b27887dd2 | ||
|
|
230d1b03f2 | ||
|
|
8c559bf5cf | ||
|
|
ef8b6f7a1f | ||
|
|
348d946637 | ||
|
|
cadbf08376 | ||
|
|
68723b7c4b | ||
|
|
e6188d9153 | ||
|
|
ea5ac90b13 | ||
|
|
20c64a97ea | ||
|
|
8032bf779a | ||
|
|
ed5d1690ef | ||
|
|
c0380142ba | ||
|
|
cfbc602443 | ||
|
|
e249d5a715 | ||
|
|
e39f56cb24 | ||
|
|
411ab85359 | ||
|
|
9f616fc0e5 | ||
|
|
2e6d57e93a | ||
|
|
dc6827fc1e | ||
|
|
13d776750e | ||
|
|
20e69d9291 | ||
|
|
202892b9da | ||
|
|
d774d9d349 | ||
|
|
a277250ee0 | ||
|
|
f0b1f1731e | ||
|
|
d5f60e73c1 | ||
|
|
2b5d01b52a | ||
|
|
7e73d30805 | ||
|
|
feddd00896 | ||
|
|
d1991b3f72 | ||
|
|
880f4cbdf1 | ||
|
|
278d4b631b | ||
|
|
debe733f13 | ||
|
|
a243d3b330 | ||
|
|
bbcb6f5c52 |
@@ -0,0 +1,4 @@
|
||||
conf/user.inc.php
|
||||
conf/user_defined.php
|
||||
userdata
|
||||
www/cache/
|
||||
@@ -0,0 +1,19 @@
|
||||
# Generated file from class.acl.php
|
||||
# For detection of htaccess functionality
|
||||
SetEnv OPENXE_HTACCESS on
|
||||
# Disable directory browsing
|
||||
Options -Indexes
|
||||
# Set default page to index.php
|
||||
DirectoryIndex "index.php"
|
||||
# Deny general access
|
||||
Order deny,allow
|
||||
<FilesMatch ".">
|
||||
Order Allow,Deny
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
# Allow index.php
|
||||
<Files "index.php">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</Files>
|
||||
# end
|
||||
+1
-1
@@ -44,7 +44,7 @@ upload_max_filesize = 100M
|
||||
max_execution_time = 3600
|
||||
max_input_time = 3600
|
||||
magic_quotes_gpc = Off
|
||||
file_uploads = Yes (gesetzt: file_uploads = On)
|
||||
file_uploads = Yes
|
||||
max_file_uploads = 20
|
||||
short_open_tag = On
|
||||
max_input_vars=3000
|
||||
|
||||
@@ -66,7 +66,7 @@ final class DatabaseLogHandler extends AbstractLogHandler
|
||||
$sql = 'INSERT INTO `log`
|
||||
(`log_time`, `level`, `message`, `class`, `method`, `line`, `origin_type`, `origin_detail`, `dump`)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,44 +51,99 @@ class MailAttachmentData implements MailAttachmentInterface
|
||||
$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
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return 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');
|
||||
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
|
||||
$UTF_pos = strpos($filename,'UTF-8\'\'');
|
||||
if ($UTF_pos !== false) {
|
||||
|
||||
if ($UTF_pos !== false) {
|
||||
$wasUTF = "JA";
|
||||
|
||||
$filename = substr($filename,$UTF_pos);
|
||||
$filename = rawurldecode($filename);
|
||||
}
|
||||
|
||||
|
||||
$cid = null;
|
||||
$contentIdHeader = $part->getHeader('content-id');
|
||||
if ($contentIdHeader !== null) {
|
||||
@@ -97,13 +152,24 @@ class MailAttachmentData implements MailAttachmentInterface
|
||||
$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(
|
||||
$filename,
|
||||
$part->getContent(),
|
||||
$content,
|
||||
$part->getContentType(),
|
||||
$encoding,
|
||||
$isInline,
|
||||
$content_transfer_encoding,
|
||||
$attachmenttype == 'inline',
|
||||
$cid
|
||||
);
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
|
||||
$parts = [];
|
||||
$this->findAttachmentParts($this->contentPart, $parts);
|
||||
$attachments = [];
|
||||
|
||||
foreach ($parts as $part) {
|
||||
$attachments[] = MailAttachmentData::fromMailMessagePart($part);
|
||||
}
|
||||
@@ -161,19 +162,17 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
|
||||
* @return 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;
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
if ($part->isMultipart()) {
|
||||
// Recurse subparts
|
||||
for ($i = 0; $i < $part->countParts(); $i++) {
|
||||
$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) {
|
||||
return null;
|
||||
}
|
||||
$dateTime = DateTime::createFromFormat(DateTimeInterface::RFC2822, $date->getValue());
|
||||
if ($dateTime === false) {
|
||||
$dateTime = DateTime::createFromFormat(DateTimeInterface::RFC822, $date->getValue());
|
||||
}
|
||||
$dateTime = date_create($date->getValue());
|
||||
if ($dateTime === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,18 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
|
||||
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
|
||||
*/
|
||||
@@ -97,6 +109,33 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
|
||||
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
|
||||
*/
|
||||
@@ -116,17 +155,30 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDecodedContent(): ?string
|
||||
public function getDecodedContent(string $to_charset = 'UTF-8'): ?string
|
||||
{
|
||||
$result = '';
|
||||
if ($this->content === null) {
|
||||
return null;
|
||||
}
|
||||
$encodingHeader = $this->getHeader('content-transfer-encoding');
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,11 @@ final class MultiDbArrayHydrator
|
||||
$description = !empty($item['description']) ? $item['description'] : $defaultConfig->WFdbname;
|
||||
|
||||
// Cronjobs nur aktivieren, wenn Einstellung vorhanden und gesetzt (Default `false`).
|
||||
$cronjobsActive = (int)$item['cronjob'] === 1;
|
||||
if (array_key_exists('cronjob',$item)) {
|
||||
$cronjobsActive = (int)$item['cronjob'] === 1;
|
||||
} else {
|
||||
$cronjobsActive = false;
|
||||
}
|
||||
|
||||
if(!empty($item['dbname']) && $defaultConfig->WFdbname === $item['dbname']) {
|
||||
$item = [];
|
||||
|
||||
@@ -22,12 +22,22 @@ class TicketFormatter
|
||||
*/
|
||||
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,
|
||||
'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);
|
||||
}
|
||||
|
||||
if ($loopCounter > 99) {
|
||||
if ($loopCounter > 9999) {
|
||||
throw new NumberGeneratorException('ticket number generation failed');
|
||||
}
|
||||
$loopCounter++;
|
||||
@@ -289,10 +289,10 @@ class TicketImportHelper
|
||||
FROM `ticket_regeln` AS `tr`
|
||||
WHERE
|
||||
tr.aktiv = 1
|
||||
AND ('".$recipientMail."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '')
|
||||
AND ('".$senderMail."' LIKE tr.sender_email OR tr.sender_email = '')
|
||||
AND ('".$senderMail."' LIKE tr.name OR tr.name = '')
|
||||
AND ('".$subject."' LIKE tr.betreff OR tr.betreff = '')";
|
||||
AND ('".$this->db->real_escape_string($recipientMail)."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '')
|
||||
AND ('".$this->db->real_escape_string($senderMail)."' LIKE tr.sender_email OR tr.sender_email = '')
|
||||
AND ('".$this->db->real_escape_string($senderMail)."' LIKE tr.name OR tr.name = '')
|
||||
AND ('".$this->db->real_escape_string($subject)."' LIKE tr.betreff OR tr.betreff = '')";
|
||||
|
||||
$this->logger->debug('ticket rule',['sql' => $sql]);
|
||||
|
||||
@@ -337,7 +337,7 @@ class TicketImportHelper
|
||||
if (!empty($queue_id)) {
|
||||
$queue_label = $this->db->Select("SELECT label FROM warteschlangen WHERE id = ".$queue_id." LIMIT 1");
|
||||
}
|
||||
|
||||
|
||||
$insertTicket = "INSERT INTO `ticket` (
|
||||
`schluessel`, `zeit`, `projekt`, `quelle`, `status`, `kunde`,
|
||||
`mailadresse`, `prio`, `betreff`,`warteschlange`,`adresse`
|
||||
@@ -347,10 +347,10 @@ class TicketImportHelper
|
||||
'".$projectId."',
|
||||
'".$this->mailAccount->getEmailAddress()."',
|
||||
'".$status."',
|
||||
'".$senderName."',
|
||||
'".$senderAddress."',
|
||||
'".$this->db->real_escape_string($senderName)."',
|
||||
'".$this->db->real_escape_string($senderAddress)."',
|
||||
'".'3'."',
|
||||
'".$subject."',
|
||||
'".$this->db->real_escape_string($subject)."',
|
||||
'".$queue_label."',
|
||||
'".$AddressId."');";
|
||||
|
||||
@@ -383,14 +383,14 @@ class TicketImportHelper
|
||||
) VALUES (
|
||||
'".$ticketNumber."',
|
||||
'".date('Y-m-d H:i:s', $timestamp)."',
|
||||
'".$message."',
|
||||
'".$subject."',
|
||||
'".$this->db->real_escape_string($message)."',
|
||||
'".$this->db->real_escape_string($subject)."',
|
||||
'".'email'."',
|
||||
'".$senderName."',
|
||||
'".$senderAddress."',
|
||||
'".$this->db->real_escape_string($senderName)."',
|
||||
'".$this->db->real_escape_string($senderAddress)."',
|
||||
'".$status."',
|
||||
'".$replyToName."',
|
||||
'".$replyToAddress."');";
|
||||
'".$this->db->real_escape_string($replyToName)."',
|
||||
'".$this->db->real_escape_string($replyToAddress)."');";
|
||||
|
||||
$this->logger->debug('database insert',['query' => $sql]);
|
||||
$this->db->Insert($sql);
|
||||
@@ -483,6 +483,9 @@ class TicketImportHelper
|
||||
{
|
||||
$insertedMailsCount = 0;
|
||||
foreach ($inboxMessageIds as $messageNumber) {
|
||||
|
||||
$this->logger->debug("Fetch $messageNumber", ['']);
|
||||
|
||||
try {
|
||||
$message = $this->mailClient->fetchMessage((int)$messageNumber);
|
||||
} catch (Throwable $e) {
|
||||
@@ -491,17 +494,24 @@ class TicketImportHelper
|
||||
}
|
||||
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);
|
||||
$insertedMailsCount++;
|
||||
if ($this->mailAccount->isDeleteAfterImportEnabled()) {
|
||||
$this->mailClient->deleteMessage((int)$messageNumber);
|
||||
$result = $this->importMessage($message);
|
||||
|
||||
if ($result === true) {
|
||||
$insertedMailsCount++;
|
||||
if ($this->mailAccount->isDeleteAfterImportEnabled()) {
|
||||
$this->mailClient->deleteMessage((int)$messageNumber);
|
||||
} else {
|
||||
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
|
||||
}
|
||||
} else {
|
||||
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
|
||||
$this->logger->error('Error during email import '.$messageNumber, ['message' => substr(print_r($message,true),0,1000)]);
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -517,12 +527,10 @@ class TicketImportHelper
|
||||
/**
|
||||
* @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
|
||||
$subject = $this->formatter->encodeToUtf8($message->getSubject());
|
||||
$from = $this->formatter->encodeToUtf8($message->getSender()->getEmail());
|
||||
@@ -542,18 +550,33 @@ class TicketImportHelper
|
||||
$htmlBody = $message->getHtmlBody();
|
||||
if ($htmlBody === null) {
|
||||
$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_html = $this->formatter->encodeToUtf8($htmlBody);
|
||||
if (strlen($action_html) < strlen($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();
|
||||
if (is_null($date)) { // This should not be happening -> Todo check getDate function
|
||||
$this->logger->debug('Null date',['subject' => $message->getSubject()]);
|
||||
$frommd5 = md5($from . $subject);
|
||||
$this->logger->debug('Null date',['subject' => $message->getSubject(), $message->getHeader('date')->getValue()]);
|
||||
return(false);
|
||||
} else {
|
||||
$timestamp = $date->getTimestamp();
|
||||
$frommd5 = md5($from . $subject . $timestamp);
|
||||
@@ -563,21 +586,29 @@ class TicketImportHelper
|
||||
FROM `emailbackup_mails`
|
||||
WHERE `checksum`='$frommd5'
|
||||
AND `empfang`='$empfang'
|
||||
AND `ticketnachricht` != 0
|
||||
AND `webmail`='" . $this->mailAccount->getId() . "'";
|
||||
|
||||
|
||||
$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();
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$this->logger->error('Error while getting attachments',['exception' => $e]);
|
||||
return(false);
|
||||
}
|
||||
|
||||
$attachments = $message->getAttachments();
|
||||
$anhang = count($attachments) > 0 ? 1 : 0;
|
||||
$mailacc = $this->mailAccount->getEmailAddress();
|
||||
if (empty($mailacc) && count($message->getRecipients()) > 0) {
|
||||
$mailacc = array_values($message->getRecipients())[0]->getEmail();
|
||||
}
|
||||
$mailaccid = $this->mailAccount->getId();
|
||||
|
||||
if (!$this->erpApi->isMailAdr($from)) {
|
||||
@@ -604,23 +635,24 @@ class TicketImportHelper
|
||||
'$empfang','$anhang','$frommd5'
|
||||
)";
|
||||
|
||||
$id = null;
|
||||
if ($DEBUG) {
|
||||
echo $sql;
|
||||
} else {
|
||||
$this->db->InsertWithoutLog($sql);
|
||||
$id = $this->db->GetInsertID();
|
||||
}
|
||||
}
|
||||
|
||||
if ($DEBUG) {
|
||||
echo "ticket suchen oder anlegen\n";
|
||||
}
|
||||
$this->db->InsertWithoutLog($sql);
|
||||
$emailbackup_mails_id = $this->db->GetInsertID();
|
||||
} else {
|
||||
$this->logger->debug('Message already imported.',['']);
|
||||
return(true);
|
||||
}
|
||||
|
||||
$this->logger->debug('Message emailbackup_mails imported.',['id' => $emailbackup_mails_id]);
|
||||
// END database import emailbackup
|
||||
|
||||
// Find ticket and add or create new ticket
|
||||
$ticketNumber = null;
|
||||
$ticketexists = null;
|
||||
if (preg_match("/Ticket #[0-9]{12}/i", $subject, $matches)) {
|
||||
$ticketNumber = str_replace('Ticket #', '', $matches[0]);
|
||||
|
||||
$this->logger->debug('Check for number',['ticketnummer' => $ticketNumber]);
|
||||
|
||||
$ticketexists = $this->db->Select(
|
||||
"SELECT schluessel
|
||||
FROM ticket
|
||||
@@ -648,7 +680,7 @@ class TicketImportHelper
|
||||
$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(
|
||||
(string) $ticketNumber,
|
||||
$timestamp,
|
||||
@@ -661,11 +693,11 @@ class TicketImportHelper
|
||||
$from
|
||||
);
|
||||
|
||||
if ($ticketnachricht > 0 && $id > 0) {
|
||||
if ($ticketnachricht > 0 && $emailbackup_mails_id > 0) {
|
||||
$this->db->Update(
|
||||
"UPDATE `emailbackup_mails`
|
||||
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);
|
||||
}
|
||||
|
||||
// Prüfen ob Ordner vorhanden ansonsten anlegen
|
||||
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id";
|
||||
if (!is_dir($ordner) && $id > 0) {
|
||||
// END database import ticket
|
||||
|
||||
// File management folder with raw text
|
||||
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$emailbackup_mails_id";
|
||||
if (!is_dir($ordner) && $emailbackup_mails_id > 0) {
|
||||
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();
|
||||
file_put_contents($ordner . '/mail.txt', $raw_full_email);
|
||||
}
|
||||
|
||||
//speichere anhang als datei
|
||||
if ($anhang == 1 && $id > 0) {
|
||||
// File management attachments
|
||||
if ($anhang == 1 && $emailbackup_mails_id > 0) {
|
||||
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname;
|
||||
if (!is_dir($ordner)) {
|
||||
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
|
||||
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
|
||||
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
// 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 ($DEBUG) {
|
||||
echo "mkdir $ordner\n";
|
||||
} else {
|
||||
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
|
||||
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $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);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->debug('Add attachments',['ticketnummer' => $ticketNumber, 'nachricht' => $ticketnachricht, 'count' => count($attachments)]);
|
||||
|
||||
$this->logger->debug('Add '.count($attachments).' attachments',['']);
|
||||
|
||||
foreach ($attachments as $attachment) {
|
||||
if ($attachment->getFileName() !== '') {
|
||||
if ($DEBUG) {
|
||||
} else {
|
||||
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
|
||||
if ($handle) {
|
||||
fwrite($handle, $attachment->getContent());
|
||||
fclose($handle);
|
||||
}
|
||||
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
|
||||
if ($handle) {
|
||||
fwrite($handle, $attachment->getContent());
|
||||
fclose($handle);
|
||||
}
|
||||
//Schreibe Anhänge in Datei-Tabelle
|
||||
$datei = $ordner . '/' . $attachment->getFileName();
|
||||
$dateiname = $attachment->getFileName();
|
||||
|
||||
$this->logger->debug("Attachment", ['filename' => $dateiname]);
|
||||
|
||||
if (stripos(strtoupper($dateiname), '=?UTF-8') !== false) {
|
||||
$dateiname = $this->formatter->encodeToUtf8($dateiname);
|
||||
$dateiname = htmlspecialchars_decode($dateiname);
|
||||
@@ -774,42 +808,31 @@ class TicketImportHelper
|
||||
$dateiname = htmlspecialchars_decode($dateiname);
|
||||
}
|
||||
|
||||
$this->logger->debug("Attachment cleaned", ['filename' => $dateiname]);
|
||||
$tmpid = $this->erpApi->CreateDatei(
|
||||
$dateiname,
|
||||
$dateiname,
|
||||
'',
|
||||
'',
|
||||
$datei,
|
||||
'Support Mail',
|
||||
true,
|
||||
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname
|
||||
);
|
||||
|
||||
if ($DEBUG) {
|
||||
echo "CreateDatei($dateiname,{$dateiname},\"\",\"\",\"datei\",\"Support Mail\",true,"
|
||||
. $this->config->WFuserdata . "/dms/" . $this->config->WFdbname . ")\n";
|
||||
} else {
|
||||
$tmpid = $this->erpApi->CreateDatei(
|
||||
$dateiname,
|
||||
$dateiname,
|
||||
'',
|
||||
'',
|
||||
$datei,
|
||||
'Support Mail',
|
||||
true,
|
||||
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname
|
||||
);
|
||||
}
|
||||
$this->logger->debug('Add attachment',['filename' => $dateiname, 'ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
|
||||
|
||||
if ($DEBUG) {
|
||||
echo "AddDateiStichwort $tmpid,'Anhang','Ticket',$ticketnachricht,true)\n";
|
||||
} else {
|
||||
|
||||
$this->logger->debug('Add attachment',['ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
|
||||
|
||||
$this->erpApi->AddDateiStichwort(
|
||||
$tmpid,
|
||||
'Anhang',
|
||||
'Ticket',
|
||||
$ticketnachricht,
|
||||
true
|
||||
);
|
||||
}
|
||||
$this->erpApi->AddDateiStichwort(
|
||||
$tmpid,
|
||||
'Anhang',
|
||||
'Ticket',
|
||||
$ticketnachricht,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // END File management
|
||||
|
||||
// Autoresponder
|
||||
if (
|
||||
$this->mailAccount->isAutoresponseEnabled()
|
||||
&& $this->mailAccount->getAutoresponseText() !== ''
|
||||
@@ -843,5 +866,7 @@ class TicketImportHelper
|
||||
$text
|
||||
);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (c) 2022 OpenXE-org */
|
||||
/*
|
||||
Refresh the githash number in githash.txt
|
||||
*/
|
||||
$path = '../.git/';
|
||||
if (!is_dir($path)) {
|
||||
return;
|
||||
}
|
||||
$head = trim(substr(file_get_contents($path . 'HEAD'), 4));
|
||||
$hash = trim(file_get_contents(sprintf($path . $head)));
|
||||
|
||||
if (!empty($hash)) {
|
||||
file_put_contents("../githash.txt", $hash);
|
||||
}
|
||||
?>
|
||||
@@ -34,7 +34,7 @@ if(empty($app->remote)) {
|
||||
$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'");
|
||||
|
||||
@@ -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');
|
||||
if(empty($shops)) {
|
||||
|
||||
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende: Keine aktiven Shops");
|
||||
|
||||
return;
|
||||
}
|
||||
$shopByIds = [];
|
||||
@@ -97,6 +100,9 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
|
||||
);
|
||||
|
||||
if(empty($lagerartikel)) {
|
||||
|
||||
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende: Keine fälligen Artikel");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,7 +116,7 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
|
||||
}
|
||||
|
||||
$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) {
|
||||
$app->DB->Update(
|
||||
"UPDATE `prozessstarter`
|
||||
@@ -172,9 +178,10 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
|
||||
}
|
||||
}
|
||||
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");
|
||||
|
||||
|
||||
|
||||
@@ -9571,7 +9571,7 @@ CREATE TABLE IF NOT EXISTS `produktion` (
|
||||
`angebot` varchar(255) NOT NULL,
|
||||
`freitext` text NOT NULL,
|
||||
`internebemerkung` text NOT NULL,
|
||||
`status` varchar(64) NOT NULL,
|
||||
`status` varchar(64) NOT NULL default 'angelegt',
|
||||
`adresse` int(11) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`abteilung` varchar(255) NOT NULL,
|
||||
@@ -16728,7 +16728,9 @@ INSERT INTO `firmendaten_werte` (`id`, `name`, `typ`, `typ1`, `typ2`, `wert`, `d
|
||||
(385, 'cleaner_shopimport', 'tinyint', '1', '', '1', '1', 0, 0),
|
||||
(386, 'cleaner_shopimport_tage', 'int', '11', '', '90', '90', 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
|
||||
(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,8 +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, ''),
|
||||
(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, ''),
|
||||
(9, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, ''),
|
||||
(10, 'Git Revision einlesen', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '120', 'cronjob', 'githash', 1, 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
|
||||
(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 +0,0 @@
|
||||
f64f6f64cbe6499f4060a487603626a6d712a484
|
||||
@@ -1083,9 +1083,9 @@ $tooltip['produktionszentrum']['abschluss']['#auftragmengenanpassen']="Die Menge
|
||||
|
||||
$tooltip['produktion']['abschluss']['#mengeerfolgreich'] = 'Höhere Mengen als die geplante Menge können nur mit der deaktivierten (kein Haken setzen) Systemeinstellung "Produktionskorrektur nicht verwenden" verbucht werden. ';
|
||||
$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']['#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 */
|
||||
|
||||
@@ -1460,4 +1460,4 @@ $tooltip['coppersurcharge']['list']['surcharge-invoice'] = '(Pflichtfeld) Welche
|
||||
$tooltip['coppersurcharge']['list']['surcharge-delivery-costs'] = '(Pflichtfeld) Bezugskosten sind eine Grundlage der Berechnungsformel (in %): Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100. Der Standard sind derzeit 1%';
|
||||
$tooltip['coppersurcharge']['list']['surcharge-copper-base-standard'] = '(Pflichtfeld) Die Kupferbasis ist eine Grundlage der Berechnungsformel: Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100. Der Standard sind derzeit 150 EUR pro 100kg';
|
||||
$tooltip['coppersurcharge']['list']['surcharge-copper-base'] = 'Falls ein Artikel eine abweichende Kupferbasis haben soll kann diese in einem Freifeld gepflegt werden. Dieses kann hier ausgewählt werden.';
|
||||
$tooltip['coppersurcharge']['list']['surcharge-copper-number'] = '(Pflichtfeld) In diesem Freifeld kann die artikelspezifische Kupferzahl (km/kg) gepflegt werden. Sie ist Grundlage der Berechnung: Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100.';
|
||||
$tooltip['coppersurcharge']['list']['surcharge-copper-number'] = '(Pflichtfeld) In diesem Freifeld kann die artikelspezifische Kupferzahl (km/kg) gepflegt werden. Sie ist Grundlage der Berechnung: Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100.';
|
||||
|
||||
+124
-5
@@ -197,7 +197,7 @@ class Acl
|
||||
break;
|
||||
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)));
|
||||
|
||||
//TODO datei_stichwoerter.objekt ist nicht zuverlässig für alle Datentypen. Deswegen nur zur Absicherung der bekannten Fälle #604706
|
||||
@@ -570,10 +570,23 @@ class Acl
|
||||
|
||||
public function Login()
|
||||
{
|
||||
$this->app->Tpl->Set('LOGINWARNING', 'display:none;visibility:hidden;');
|
||||
if($this->IsInLoginLockMode() === true){
|
||||
$this->app->Tpl->Set('LOGINWARNING', '');
|
||||
return;
|
||||
|
||||
$this->refresh_githash();
|
||||
include dirname(__DIR__).'/../version.php';
|
||||
$this->app->Tpl->Set('XENTRALVERSION',"V.".$version_revision);
|
||||
|
||||
$this->app->Tpl->Set('LOGINWARNING_VISIBLE', 'hidden');
|
||||
|
||||
$result = $this->CheckHtaccess();
|
||||
if ($result !== true) {
|
||||
$this->app->Tpl->Set('LOGINWARNING_VISIBLE', '');
|
||||
$this->app->Tpl->Set('LOGINWARNING_TEXT', "Achtung: Zugriffskonfiguration (htaccess) fehlerhaft. Bitte wenden Sie sich an Ihren an Ihren Administrator. <br>($result)");
|
||||
}
|
||||
|
||||
if($this->IsInLoginLockMode() === true)
|
||||
{
|
||||
$this->app->Tpl->Set('LOGINWARNING_VISIBLE', '');
|
||||
$this->app->Tpl->Set('LOGINWARNING_TEXT', 'Achtung: Es werden gerade Wartungsarbeiten in Ihrem System (z.B. Update oder Backup) durch Ihre IT-Abteilung durchgeführt. Das System sollte in wenigen Minuten wieder erreichbar sein. Für Rückfragen wenden Sie sich bitte an Ihren Administrator.');
|
||||
}
|
||||
|
||||
$multidbs = $this->app->getDbs();
|
||||
@@ -1206,4 +1219,110 @@ class Acl
|
||||
|
||||
}
|
||||
|
||||
// HTACCESS SECURITY
|
||||
// Check for correct .htaccess settings
|
||||
// true if ok, else error text
|
||||
protected function CheckHtaccess() {
|
||||
|
||||
$nominal = array('
|
||||
# Generated file from class.acl.php
|
||||
# For detection of htaccess functionality
|
||||
SetEnv OPENXE_HTACCESS on
|
||||
# Disable directory browsing
|
||||
Options -Indexes
|
||||
# Set default page to index.php
|
||||
DirectoryIndex "index.php"
|
||||
# Deny general access
|
||||
Order deny,allow
|
||||
<FilesMatch ".">
|
||||
Order Allow,Deny
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
# Allow index.php
|
||||
<Files "index.php">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</Files>
|
||||
# end
|
||||
',
|
||||
'
|
||||
# Generated file from class.acl.php
|
||||
# Disable directory browsing
|
||||
Options -Indexes
|
||||
# Deny access to all *.php
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
<FilesMatch "\.(css|jpg|jpeg|gif|png|svg|js)$">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</FilesMatch>
|
||||
# Allow access to index.php
|
||||
<Files index.php>
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</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
|
||||
');
|
||||
|
||||
$script_file_name = $_SERVER['SCRIPT_FILENAME'];
|
||||
$htaccess_path = array(
|
||||
dirname(dirname($script_file_name))."/.htaccess", // root
|
||||
dirname($script_file_name)."/.htaccess"); // www
|
||||
|
||||
for ($count = 0;$count < 2;$count++) {
|
||||
$htaccess = file_get_contents($htaccess_path[$count]);
|
||||
|
||||
if ($htaccess === false) {
|
||||
$missing = true;
|
||||
} else {
|
||||
$htaccess = trim($htaccess);
|
||||
}
|
||||
$htaccess_nominal = trim($nominal[$count]);
|
||||
$result = strcmp($htaccess,$htaccess_nominal);
|
||||
|
||||
if ($htaccess === false) {
|
||||
return($htaccess_path[$count]." nicht vorhanden.");
|
||||
}
|
||||
|
||||
if ($result !== 0) {
|
||||
return($htaccess_path[$count]." fehlerhaft.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_SERVER['OPENXE_HTACCESS'])) {
|
||||
return("htaccess nicht aktiv.");
|
||||
}
|
||||
|
||||
return(true);
|
||||
// HTACCESS SECURITY END
|
||||
}
|
||||
|
||||
function refresh_githash() {
|
||||
$path = '../.git/';
|
||||
if (!is_dir($path)) {
|
||||
return;
|
||||
}
|
||||
$head = trim(file_get_contents($path . 'HEAD'));
|
||||
$refs = trim(substr($head,0,4));
|
||||
if ($refs == 'ref:') {
|
||||
$ref = substr($head,5);
|
||||
$hash = trim(file_get_contents($path . $ref));
|
||||
} else {
|
||||
$hash = $head;
|
||||
}
|
||||
if (!empty($hash)) {
|
||||
file_put_contents("../githash.txt", $hash);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,726 +0,0 @@
|
||||
<?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 ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
final class DatabaseUpgrade
|
||||
{
|
||||
/** @var Application $app */
|
||||
private $app;
|
||||
|
||||
/** @var array $CheckColumnTableCache */
|
||||
private $CheckColumnTableCache;
|
||||
|
||||
/** @var bool $check_column_missing_run */
|
||||
private $check_column_missing_run=false;
|
||||
|
||||
/** @var array $check_column_missing */
|
||||
private $check_column_missing=array();
|
||||
|
||||
/** @var array $check_index_missing */
|
||||
private $check_index_missing=array();
|
||||
|
||||
/** @var array */
|
||||
private $allTables = [];
|
||||
|
||||
/** @var array */
|
||||
private $indexe = [];
|
||||
|
||||
/**
|
||||
* @param Application $app
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function emptyTableCache(){
|
||||
$this->CheckColumnTableCache = [];
|
||||
$this->allTables = [];
|
||||
$this->indexe = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @var bool $force
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllTables($force = false)
|
||||
{
|
||||
if($force || empty($this->allTables)) {
|
||||
$this->allTables = $this->app->DB->SelectFirstCols('SHOW TABLES');
|
||||
}
|
||||
|
||||
return $this->allTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $pk
|
||||
*/
|
||||
public function createTable($table, $pk = 'id')
|
||||
{
|
||||
$sql = "CREATE TABLE `$table` (`".$pk."` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`".$pk."`)) ENGINE = InnoDB DEFAULT CHARSET=utf8";
|
||||
$this->app->DB->Query($sql);
|
||||
$this->addPrimary($table, $pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $pk
|
||||
*/
|
||||
public function addPrimary($table, $pk = 'id')
|
||||
{
|
||||
$this->CheckAlterTable(
|
||||
"ALTER TABLE `$table`
|
||||
ADD PRIMARY KEY (`".$pk."`)",
|
||||
true
|
||||
);
|
||||
$this->CheckAlterTable(
|
||||
"ALTER TABLE `$table`
|
||||
MODIFY `".$pk."` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1",
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param bool $force
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexeCached($table, $force = false)
|
||||
{
|
||||
if($force || !isset($this->indexe[$table])){
|
||||
$this->indexe[$table] = $this->app->DB->SelectArr(sprintf('SHOW INDEX FROM `%s`', $table));
|
||||
if($this->indexe[$table] === null) {
|
||||
$this->indexe[$table] = [];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->indexe[$table];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*/
|
||||
public function clearIndexCached($table)
|
||||
{
|
||||
if(!isset($this->indexe[$table])) {
|
||||
return;
|
||||
}
|
||||
unset($this->indexe[$table]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $pk
|
||||
*/
|
||||
public function hasPrimaryKey($table, $pk = 'id')
|
||||
{
|
||||
$indexe = $this->getIndexeCached($table);
|
||||
if(empty($indexe)) {
|
||||
return false;
|
||||
}
|
||||
foreach($indexe as $index) {
|
||||
if($index['Column_name'] === $pk
|
||||
&& $index['Key_name'] === 'PRIMARY'
|
||||
&& (int)$index['Non_unique'] === 0
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $pk
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function CheckTable($table, $pk = 'id')
|
||||
{
|
||||
if($pk === 'id') {
|
||||
$tables = $this->getAllTables();
|
||||
if(!empty($tables)){
|
||||
if(!in_array($table, $tables)){
|
||||
$this->createTable($table, $pk);
|
||||
return;
|
||||
}
|
||||
if(!$this->hasPrimaryKey($table, $pk)) {
|
||||
$this->addPrimary($table, $pk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
$found = false;
|
||||
$tables = $this->getAllTables(true);
|
||||
if($tables) {
|
||||
$found = in_array($table, $tables);
|
||||
}
|
||||
else{
|
||||
$check = $this->app->DB->Select("SELECT $pk FROM `$table` LIMIT 1");
|
||||
if($check) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if($found==false)
|
||||
{
|
||||
$sql = "CREATE TABLE `$table` (`".$pk."` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`".$pk."`)) ENGINE = InnoDB DEFAULT CHARSET=utf8";
|
||||
$this->app->DB->Update($sql);
|
||||
$this->CheckAlterTable("ALTER TABLE `$table`
|
||||
ADD PRIMARY KEY (`".$pk."`)");
|
||||
$this->CheckAlterTable("ALTER TABLE `$table`
|
||||
MODIFY `".$pk."` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1");
|
||||
}
|
||||
if($pk !== 'id') {
|
||||
$this->CheckColumn('created_at','timestamp',$table,"DEFAULT CURRENT_TIMESTAMP NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param string $type
|
||||
* @param string $table
|
||||
* @param string $default
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function UpdateColumn($column,$type,$table,$default="NOT NULL")
|
||||
{
|
||||
$fields = $this->app->DB->SelectArr("show columns from `".$table."`");
|
||||
if($fields)
|
||||
{
|
||||
foreach($fields as $val)
|
||||
{
|
||||
$field_array[] = $val['Field'];
|
||||
}
|
||||
}
|
||||
if (in_array($column, $field_array))
|
||||
{
|
||||
$this->app->DB->Query('ALTER TABLE `'.$table.'` CHANGE `'.$column.'` `'.$column.'` '.$type.' '.$default.';');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param string $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function DeleteColumn($column,$table)
|
||||
{
|
||||
$this->app->DB->Query('ALTER TABLE `'.$table.'` DROP `'.$column.'`;');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param string $type
|
||||
* @param string $table
|
||||
* @param string $default
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function CheckColumn($column,$type,$table,$default="")
|
||||
{
|
||||
if($table === 'firmendaten')
|
||||
{
|
||||
if($this->app->DB->Select("SELECT `id` FROM `firmendaten_werte` WHERE `name` = '$column' LIMIT 1"))return;
|
||||
}
|
||||
if(!isset($this->CheckColumnTableCache[$table]))
|
||||
{
|
||||
$tmp=$this->app->DB->SelectArr("show columns from `".$table."`");
|
||||
if($tmp)
|
||||
{
|
||||
foreach($tmp as $val)
|
||||
{
|
||||
$this->CheckColumnTableCache[$table][] = $val['Field'];
|
||||
//$types[$val['Field']] = strtolower($val['Type']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($this->CheckColumnTableCache[$table]) && !in_array($column, $this->CheckColumnTableCache[$table]))
|
||||
{
|
||||
if($this->check_column_missing_run)
|
||||
{
|
||||
//$result = mysqli_query($this->app->DB->connection,'ALTER TABLE `'.$table.'` ADD `'.$column.'` '.$type.' '.$default.';');
|
||||
$this->check_column_missing[$table][]=$column;
|
||||
} else {
|
||||
$result = $this->app->DB->Query('ALTER TABLE `'.$table.'` ADD `'.$column.'` '.$type.' '.$default.';');
|
||||
if($table === 'firmendaten' && $this->app->DB->error())
|
||||
{
|
||||
if((method_exists($this->app->DB, 'errno2') && $this->app->DB->errno() == '1118')
|
||||
|| strpos($this->app->DB->error(),'Row size too large') !== false
|
||||
)
|
||||
{
|
||||
$this->ChangeFirmendatenToMyIsam();
|
||||
$this->app->DB->Query('ALTER TABLE `'.$table.'` ADD `'.$column.'` '.$type.' '.$default.';');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $indexe
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getGroupedIndexe($indexe)
|
||||
{
|
||||
if(empty($indexe)) {
|
||||
return $indexe;
|
||||
}
|
||||
$return = [];
|
||||
foreach($indexe as $index) {
|
||||
$keyName = $index['Key_name'];
|
||||
$isUnique = $index['Non_unique'] == '0';
|
||||
$seq = $index['Seq_in_index'];
|
||||
$columnName = $index['Column_name'];
|
||||
$return[$isUnique?'unique':'index'][$keyName][(int)$seq - 1] = $columnName;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $indexe
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDoubleIndexeFromGroupedIndexe($indexe)
|
||||
{
|
||||
if(empty($indexe)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
foreach($indexe as $type => $indexArrs) {
|
||||
$columnStrings = [];
|
||||
foreach($indexArrs as $indexKey => $columns) {
|
||||
$columnString = implode('|', $columns);
|
||||
if(in_array($columnString, $columnStrings)) {
|
||||
$ret[$type][] = $indexKey;
|
||||
continue;
|
||||
}
|
||||
$columnStrings[] = $columnString;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param array $indexe
|
||||
* @param bool $noCache
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function CheckDoubleIndex($table, $indexe, $noCache = false)
|
||||
{
|
||||
$query = $noCache?null:$this->CheckAlterTable("SHOW INDEX FROM `$table`");
|
||||
if(!$query) {
|
||||
$indexeGrouped = $this->getGroupedIndexe($indexe);
|
||||
$doubleIndexe = $this->getDoubleIndexeFromGroupedIndexe($indexeGrouped);
|
||||
if(!empty($doubleIndexe)) {
|
||||
$indexe = $this->getIndexeCached($table, true);
|
||||
$indexeGrouped = $this->getGroupedIndexe($indexe);
|
||||
$doubleIndexe = $this->getDoubleIndexeFromGroupedIndexe($indexeGrouped);
|
||||
if(empty($doubleIndexe)) {
|
||||
return $indexe;
|
||||
}
|
||||
|
||||
foreach($doubleIndexe as $type => $doubleIndex) {
|
||||
foreach($doubleIndex as $indexName) {
|
||||
$this->app->DB->Query("ALTER TABLE `".$table."` DROP INDEX `".$indexName."`");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($noCache) {
|
||||
return $indexe;
|
||||
}
|
||||
$this->CheckAlterTable("SHOW INDEX FROM `$table`", true);
|
||||
|
||||
return $this->getIndexeCached($table, true);
|
||||
}
|
||||
if(empty($indexe) || count($indexe) == 1){
|
||||
return $indexe;
|
||||
}
|
||||
$uniquearr = array();
|
||||
$indexarr = array();
|
||||
foreach($indexe as $index)
|
||||
{
|
||||
if($index['Key_name'] !== 'PRIMARY' && !empty($index['Column_name']))
|
||||
{
|
||||
if($index['Non_unique'])
|
||||
{
|
||||
$indexarr[$index['Key_name']][] = $index['Column_name'];
|
||||
}else{
|
||||
$uniquearr[$index['Key_name']][] = $index['Column_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$cindex = count($indexarr);
|
||||
$cuniqe = count($uniquearr);
|
||||
$changed = false;
|
||||
if($cindex > 1)
|
||||
{
|
||||
$check = array();
|
||||
foreach($indexarr as $key => $value)
|
||||
{
|
||||
if(empty($value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(count($value) > 1){
|
||||
sort($value);
|
||||
}
|
||||
$vstr = implode(',', $value);
|
||||
if(in_array($vstr, $check))
|
||||
{
|
||||
$this->app->DB->Query("DROP INDEX `".$key."` ON `".$table."`");
|
||||
$changed = true;
|
||||
}else{
|
||||
$check[] = $vstr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($cuniqe > 1)
|
||||
{
|
||||
$check = array();
|
||||
foreach($uniquearr as $key => $value)
|
||||
{
|
||||
if(empty($value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(count($value) > 1){
|
||||
sort($value);
|
||||
}
|
||||
$vstr = implode(',', $value);
|
||||
if(in_array($vstr, $check))
|
||||
{
|
||||
$this->app->DB->Query("DROP UNIQUE `".$key."` ON `".$table."`");
|
||||
$changed = true;
|
||||
}else{
|
||||
$check[] = $vstr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($changed) {
|
||||
return $this->getIndexeCached($table, true);
|
||||
}
|
||||
return $indexe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string|array $column
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function CheckFulltextIndex($table,$column)
|
||||
{
|
||||
if(empty($table) || empty($column))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(!is_array($column))
|
||||
{
|
||||
$column = [$column];
|
||||
}
|
||||
$columnmasked = [];
|
||||
foreach($column as $keyColumn => $valueColumn)
|
||||
{
|
||||
if(!empty($valueColumn))
|
||||
{
|
||||
$columnmasked[] = "`$valueColumn`";
|
||||
}else{
|
||||
unset($column[$keyColumn]);
|
||||
}
|
||||
}
|
||||
if(empty($column))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$columnsFound = [];
|
||||
$indexe = $this->getIndexeCached($table, true);
|
||||
$indexeFound = [];
|
||||
if(!empty($indexe))
|
||||
{
|
||||
foreach($indexe as $index)
|
||||
{
|
||||
if($index['Index_type'] === 'FULLTEXT')
|
||||
{
|
||||
$indexeFound[] = $index['Column_name'];
|
||||
if(!in_array($index['Column_name'], $columnsFound))
|
||||
{
|
||||
$columnsFound[] = $index['Column_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$cindexeFound = count($indexeFound);
|
||||
$column = count($column);
|
||||
if(($column === $cindexeFound) && (count($columnsFound) === $column))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if($cindexeFound > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
$this->app->DB->Query(
|
||||
"ALTER TABLE `$table`
|
||||
ADD FULLTEXT INDEX `FullText`
|
||||
(".implode(',',$columnmasked).");"
|
||||
);
|
||||
$error = $this->app->DB->error();
|
||||
|
||||
return empty($error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $column
|
||||
* @param bool $unique
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function CheckIndex($table, $column, $unique = false)
|
||||
{
|
||||
$indexex = null;
|
||||
$indexexother = null;
|
||||
$indexe = $this->getIndexeCached($table);
|
||||
if($indexe)
|
||||
{
|
||||
$indexe = $this->CheckDoubleIndex($table, $indexe, true);
|
||||
foreach($indexe as $index)
|
||||
{
|
||||
if(is_array($column) && $index['Key_name'] !== 'PRIMARY')
|
||||
{
|
||||
if($unique && !$index['Non_unique'])
|
||||
{
|
||||
if(in_array($index['Column_name'], $column))
|
||||
{
|
||||
$indexex[$index['Key_name']][$index['Column_name']] = true;
|
||||
}else{
|
||||
$indexexother[$index['Key_name']][$index['Column_name']] = true;
|
||||
}
|
||||
}
|
||||
elseif(!$unique){
|
||||
if(in_array($index['Column_name'], $column)) {
|
||||
$indexex[$index['Key_name']][$index['Column_name']] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(!is_array($column)){
|
||||
if($index['Column_name'] == $column)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($this->check_column_missing_run)
|
||||
{
|
||||
$this->check_index_missing[$table][] = $column;
|
||||
}
|
||||
if(!$unique)
|
||||
{
|
||||
if(is_array($column))
|
||||
{
|
||||
if($indexex)
|
||||
{
|
||||
foreach($indexex as $k => $v) {
|
||||
if(count($v) === 1 && count($column) > 1) {
|
||||
$this->app->DB->Query("DROP INDEX `".$k."` ON `".$table."`");
|
||||
$this->clearIndexCached($table);
|
||||
unset($indexex[$k]);
|
||||
}
|
||||
}
|
||||
foreach($indexex as $k => $v)
|
||||
{
|
||||
if(count($v) == count($column)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach($indexex as $k => $v)
|
||||
{
|
||||
if(!isset($indexexother[$k]))
|
||||
{
|
||||
$this->app->DB->Query("DROP INDEX `".$k."` ON `".$table."`");
|
||||
$cols = null;
|
||||
foreach($column as $c) {
|
||||
$cols[] = "`$c`";
|
||||
}
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(".implode(', ',$cols)."); ",true);
|
||||
$this->clearIndexCached($table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cols = null;
|
||||
foreach($column as $c) {
|
||||
$cols[] = "`$c`";
|
||||
}
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(".implode(', ',$cols)."); ", true);
|
||||
$this->clearIndexCached($table);
|
||||
}
|
||||
else{
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(`$column`); ", true);
|
||||
$this->clearIndexCached($table);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(is_array($column))
|
||||
{
|
||||
if($indexex)
|
||||
{
|
||||
foreach($indexex as $k => $v)
|
||||
{
|
||||
if(count($v) == count($column))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach($indexex as $k => $v)
|
||||
{
|
||||
if(!isset($indexexother[$k]))
|
||||
{
|
||||
$this->app->DB->Query("DROP INDEX `".$k."` ON `".$table."`");
|
||||
$cols = null;
|
||||
foreach($column as $c) {
|
||||
$cols[] = "`$c`";
|
||||
}
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(".implode(', ',$cols)."); ", true);
|
||||
$this->clearIndexCached($table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cols = null;
|
||||
foreach($column as $c) {
|
||||
$cols[] = "`$c`";
|
||||
}
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(".implode(', ',$cols)."); ", true);
|
||||
$this->clearIndexCached($table);
|
||||
}else{
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(`$column`); ", true);
|
||||
$this->clearIndexCached($table);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(!is_array($column))
|
||||
{
|
||||
if(!$unique)
|
||||
{
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(`$column`); ");
|
||||
}else{
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(`$column`); ");
|
||||
}
|
||||
$this->clearIndexCached($table);
|
||||
}
|
||||
elseif(is_array($column))
|
||||
{
|
||||
$cols = null;
|
||||
foreach($column as $c) {
|
||||
$cols[] = "`$c`";
|
||||
}
|
||||
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(".implode(', ',$cols)."); ");
|
||||
$this->clearIndexCached($table);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sql
|
||||
* @param bool $force
|
||||
*
|
||||
* @return mysqli_result|bool
|
||||
*/
|
||||
function CheckAlterTable($sql, $force = false)
|
||||
{
|
||||
$sqlmd5 = md5($sql);
|
||||
$check = $this->app->DB->Select("SELECT id FROM checkaltertable WHERE checksum='$sqlmd5' LIMIT 1");
|
||||
if($check > 0 && !$force) return;
|
||||
$query = $this->app->DB->Query($sql);
|
||||
if($query && empty($check) && !$this->app->DB->error()){
|
||||
$this->app->DB->Insert("INSERT INTO checkaltertable (id,checksum) VALUES ('','$sqlmd5')");
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function ChangeFirmendatenToMyIsam()
|
||||
{
|
||||
$this->app->DB->Query("ALTER TABLE firmendaten ENGINE = MyISAM;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSortedIndexColumnsByIndexName($table): array
|
||||
{
|
||||
$indexesByName = [];
|
||||
$indexes = $this->app->DB->SelectArr(sprintf('SHOW INDEX FROM `%s`', $table));
|
||||
if(empty($indexes)) {
|
||||
return $indexesByName;
|
||||
}
|
||||
foreach($indexes as $index) {
|
||||
$indexesByName[$index['Key_name']][] = $index['Column_name'];
|
||||
}
|
||||
foreach($indexesByName as $indexName => $columns) {
|
||||
$columns = array_unique($columns);
|
||||
sort($columns);
|
||||
$indexesByName[$indexName] = $columns;
|
||||
}
|
||||
|
||||
return $indexesByName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in 21.4
|
||||
*
|
||||
* @param string $table
|
||||
* @param array $columns
|
||||
*/
|
||||
public function dropIndex($table, $columns): void
|
||||
{
|
||||
if(empty($table) || empty($columns)) {
|
||||
return;
|
||||
}
|
||||
$columns = array_unique($columns);
|
||||
sort($columns);
|
||||
$countColumns = count($columns);
|
||||
$indexes = $this->getSortedIndexColumnsByIndexName($table);
|
||||
if(empty($indexes)) {
|
||||
return;
|
||||
}
|
||||
foreach($indexes as $indexName => $indexColumns) {
|
||||
if(count($indexColumns) !== $countColumns) {
|
||||
continue;
|
||||
}
|
||||
if(count(array_intersect($indexColumns, $columns)) === $countColumns) {
|
||||
$this->app->DB->Query(sprintf('ALTER TABLE `%s` DROP INDEX `%s`', $table, $indexName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+341
-337
@@ -1,340 +1,344 @@
|
||||
<?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 & 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 ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/// Secure Layer, SQL Inject. Check, Syntax Check
|
||||
class Secure
|
||||
{
|
||||
public $GET;
|
||||
public $POST;
|
||||
|
||||
/**
|
||||
* Secure constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
*/
|
||||
public function __construct($app){
|
||||
$this->app = $app;
|
||||
// clear global variables, that everybody have to go over secure layer
|
||||
$this->GET = $_GET;
|
||||
if(isset($this->GET['msgs']) && isset($this->app->Location)) {
|
||||
$this->GET['msg'] = $this->app->Location->getMessage($this->GET['msgs']);
|
||||
}
|
||||
// $_GET="";
|
||||
$this->POST = $_POST;
|
||||
// $_POST="";
|
||||
if(!isset($this->app->stringcleaner) && file_exists(__DIR__. '/class.stringcleaner.php')) {
|
||||
if(!class_exists('StringCleaner')) {
|
||||
require_once __DIR__ . '/class.stringcleaner.php';
|
||||
}
|
||||
$this->app->stringcleaner = new StringCleaner($this->app);
|
||||
}
|
||||
|
||||
$this->AddRule('notempty','reg','.'); // at least one sign
|
||||
$this->AddRule('alpha','reg','[a-zA-Z]');
|
||||
$this->AddRule('digit','reg','[0-9]');
|
||||
$this->AddRule('space','reg','[ ]');
|
||||
$this->AddRule('specialchars','reg','[_-]');
|
||||
$this->AddRule('email','reg','^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$');
|
||||
$this->AddRule('datum','reg','([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})');
|
||||
|
||||
$this->AddRule('username','glue','alpha+digit');
|
||||
$this->AddRule('password','glue','alpha+digit+specialchars');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param null $rule
|
||||
* @param string $maxlength
|
||||
* @param string $sqlcheckoff
|
||||
*
|
||||
* @return array|mixed|string
|
||||
*/
|
||||
public function GetGET($name,$rule=null,$maxlength='',$sqlcheckoff='')
|
||||
{
|
||||
if($name === 'msg' && isset($this->app->erp) && method_exists($this, 'xss_clean')) {
|
||||
$ret = $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'','',$maxlength,$sqlcheckoff);
|
||||
$ret = $this->app->erp->base64_url_decode($ret);
|
||||
if(strpos($ret,'"button"') === false){
|
||||
$ret = $this->xss_clean($ret);
|
||||
}
|
||||
|
||||
return $this->app->erp->base64_url_encode($ret);
|
||||
}
|
||||
if($rule === null) {
|
||||
$rule = $this->NameToRule($name);
|
||||
}
|
||||
return $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'',$rule,$maxlength,$sqlcheckoff);
|
||||
}
|
||||
|
||||
function NameToRule($name)
|
||||
{
|
||||
switch($name)
|
||||
{
|
||||
case 'id':
|
||||
return 'doppelid';
|
||||
break;
|
||||
case 'sid':
|
||||
return 'alphadigits';
|
||||
break;
|
||||
case 'module':
|
||||
case 'smodule':
|
||||
case 'action':
|
||||
case 'saction':
|
||||
return 'module';
|
||||
break;
|
||||
case 'cmd':
|
||||
return 'moduleminus';
|
||||
break;
|
||||
}
|
||||
return 'nothtml';
|
||||
}
|
||||
|
||||
public function GetPOST($name,$rule=null,$maxlength="",$sqlcheckoff="")
|
||||
{
|
||||
if($rule === null) {
|
||||
$rule = $this->NameToRule($name);
|
||||
if(isset($this->POST['ishtml_cke_'.$name]) && $this->POST['ishtml_cke_'.$name]) {
|
||||
$rule = 'nojs';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->Syntax(isset($this->POST[$name])?$this->POST[$name]:'',$rule,$maxlength,$sqlcheckoff);
|
||||
}
|
||||
|
||||
public function GetPOSTForForms($name,$rule="",$maxlength="",$sqlcheckoff="")
|
||||
{
|
||||
return $this->SyntaxForForms($this->POST[$name],$rule,$maxlength,$sqlcheckoff);
|
||||
}
|
||||
|
||||
public function CleanString($string, $rule='nohtml',$sqlcheckoff='')
|
||||
{
|
||||
return $this->Syntax($string, $rule, '', $sqlcheckoff);
|
||||
}
|
||||
|
||||
public function xss_clean($data)
|
||||
{
|
||||
return $this->app->stringcleaner->xss_clean($data);
|
||||
}
|
||||
|
||||
public function GetPOSTArray()
|
||||
{
|
||||
if(!empty($this->POST) && count($this->POST)>0)
|
||||
{
|
||||
foreach($this->POST as $key=>$value)
|
||||
{
|
||||
$key = $this->GetPOST($key,"alpha+digit+specialchars",20);
|
||||
$ret[$key]=$this->GetPOST($value);
|
||||
}
|
||||
}
|
||||
if(!empty($ret))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function GetGETArray()
|
||||
{
|
||||
if(!empty($this->GET) && count($this->GET)>0)
|
||||
{
|
||||
foreach($this->GET as $key=>$value)
|
||||
{
|
||||
$key = $this->GetGET($key,"alpha+digit+specialchars",20);
|
||||
$ret[$key]=$this->GetGET($value);
|
||||
}
|
||||
}
|
||||
if(!empty($ret))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function stripallslashes($string) {
|
||||
|
||||
while(strstr($string,'\\')) {
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function smartstripslashes($str) {
|
||||
$cd1 = substr_count($str, "\"");
|
||||
$cd2 = substr_count($str, "\\\"");
|
||||
$cs1 = substr_count($str, "'");
|
||||
$cs2 = substr_count($str, "\\'");
|
||||
$tmp = strtr($str, array("\\\"" => "", "\\'" => ""));
|
||||
$cb1 = substr_count($tmp, "\\");
|
||||
$cb2 = substr_count($tmp, "\\\\");
|
||||
if ($cd1 == $cd2 && $cs1 == $cs2 && $cb1 == 2 * $cb2) {
|
||||
return strtr($str, array("\\\"" => "\"", "\\'" => "'", "\\\\" => "\\"));
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function SyntaxForForms($value,$rule,$maxlength="",$sqlcheckoff="")
|
||||
{
|
||||
return $value;//mysqli_real_escape_string($this->app->DB->connection,$value);//mysqli_real_escape_string($value);
|
||||
}
|
||||
|
||||
// check actual value with given rule
|
||||
public function Syntax($value,$rule,$maxlength='',$sqlcheckoff='')
|
||||
{
|
||||
$striptags = false;
|
||||
if(is_array($value))
|
||||
{
|
||||
if($sqlcheckoff != '')
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
foreach($value as $k => $v)
|
||||
{
|
||||
if(is_array($v))
|
||||
{
|
||||
$value[$k] = $v;
|
||||
}else{
|
||||
$v = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$v);
|
||||
if($striptags){
|
||||
$v = $this->stripallslashes($v);
|
||||
$v = $this->smartstripslashes($v);
|
||||
$v = $this->app->erp->superentities($v);
|
||||
}
|
||||
$value[$k] = $this->app->DB->real_escape_string($v);
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
$value = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$value);
|
||||
|
||||
if($striptags){
|
||||
$value = $this->stripallslashes($value);
|
||||
$value = $this->smartstripslashes($value);
|
||||
|
||||
$value = $this->app->erp->superentities($value);
|
||||
}
|
||||
|
||||
if(!empty($this->app->stringcleaner)) {
|
||||
if( $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string($this->app->stringcleaner->CleanString($value, $rule));
|
||||
}
|
||||
return $this->app->stringcleaner->CleanString($value, $rule);
|
||||
}
|
||||
|
||||
if($rule === 'nohtml') {
|
||||
if( $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string(strip_tags($value));
|
||||
}
|
||||
|
||||
return strip_tags($value);
|
||||
|
||||
}
|
||||
if($rule === 'nojs') {
|
||||
if( $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string($this->xss_clean($value));
|
||||
}
|
||||
|
||||
return $this->xss_clean($value);
|
||||
}
|
||||
|
||||
if($rule=='' && $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
|
||||
}
|
||||
if($rule=='' && $sqlcheckoff != '') {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// build complete regexp
|
||||
|
||||
// check if rule exists
|
||||
|
||||
if($this->GetRegexp($rule)!=''){
|
||||
//$v = '/^['.$this->GetRegexp($rule).']+$/';
|
||||
$v = $this->GetRegexp($rule);
|
||||
if (preg_match_all('/'.$v.'/i', $value, $teffer) ) {
|
||||
if($sqlcheckoff==''){
|
||||
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
echo "<table border=\"1\" width=\"100%\" bgcolor=\"#FFB6C1\">
|
||||
<tr><td>Rule <b>$rule</b> doesn't exists!</td></tr></table>";
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function RuleCheck($value,$rule)
|
||||
{
|
||||
$found = false;
|
||||
if(!empty($this->app->stringcleaner)) {
|
||||
$value_ = $this->app->stringcleaner->RuleCheck($value, $rule, $found);
|
||||
if($found) {
|
||||
if($value_) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$v = $this->GetRegexp($rule);
|
||||
if (preg_match_all('/'.$v.'/i', $value, $teffer) ){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function AddRule($name,$type,$rule)
|
||||
{
|
||||
// type: reg = regular expression
|
||||
// type: glue ( already exists rules copy to new e.g. number+digit)
|
||||
$this->rules[$name]=array('type'=>$type,'rule'=>$rule);
|
||||
}
|
||||
|
||||
// get complete regexp by rule name
|
||||
function GetRegexp($rule)
|
||||
{
|
||||
$rules = explode('+',$rule);
|
||||
$ret = '';
|
||||
foreach($rules as $key) {
|
||||
// check if rule is last in glue string
|
||||
if($this->rules[$key]['type']==='glue') {
|
||||
$subrules = explode('+',$this->rules[$key]['rule']);
|
||||
if(count($subrules)>0) {
|
||||
foreach($subrules as $subkey) {
|
||||
$ret .= $this->GetRegexp($subkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($this->rules[$key]['type']==='reg') {
|
||||
$ret .= $this->rules[$key]['rule'];
|
||||
}
|
||||
}
|
||||
if($ret==''){
|
||||
$ret = 'none';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
/// Secure Layer, SQL Inject. Check, Syntax Check
|
||||
class Secure
|
||||
{
|
||||
public $GET;
|
||||
public $POST;
|
||||
|
||||
/**
|
||||
* Secure constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
*/
|
||||
public function __construct($app){
|
||||
$this->app = $app;
|
||||
// clear global variables, that everybody have to go over secure layer
|
||||
$this->GET = $_GET;
|
||||
if(isset($this->GET['msgs']) && isset($this->app->Location)) {
|
||||
$this->GET['msg'] = $this->app->Location->getMessage($this->GET['msgs']);
|
||||
}
|
||||
// $_GET="";
|
||||
$this->POST = $_POST;
|
||||
// $_POST="";
|
||||
if(!isset($this->app->stringcleaner) && file_exists(__DIR__. '/class.stringcleaner.php')) {
|
||||
if(!class_exists('StringCleaner')) {
|
||||
require_once __DIR__ . '/class.stringcleaner.php';
|
||||
}
|
||||
$this->app->stringcleaner = new StringCleaner($this->app);
|
||||
}
|
||||
|
||||
$this->AddRule('notempty','reg','.'); // at least one sign
|
||||
$this->AddRule('alpha','reg','[a-zA-Z]');
|
||||
$this->AddRule('digit','reg','[0-9]');
|
||||
$this->AddRule('space','reg','[ ]');
|
||||
$this->AddRule('specialchars','reg','[_-]');
|
||||
$this->AddRule('email','reg','^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$');
|
||||
$this->AddRule('datum','reg','([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})');
|
||||
|
||||
$this->AddRule('username','glue','alpha+digit');
|
||||
$this->AddRule('password','glue','alpha+digit+specialchars');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param null $rule
|
||||
* @param string $maxlength
|
||||
* @param string $sqlcheckoff
|
||||
*
|
||||
* @return array|mixed|string
|
||||
*/
|
||||
public function GetGET($name,$rule=null,$maxlength='',$sqlcheckoff='')
|
||||
{
|
||||
if($name === 'msg' && isset($this->app->erp) && method_exists($this, 'xss_clean')) {
|
||||
$ret = $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'','',$maxlength,$sqlcheckoff);
|
||||
$ret = $this->app->erp->base64_url_decode($ret);
|
||||
if(strpos($ret,'"button"') === false){
|
||||
$ret = $this->xss_clean($ret);
|
||||
}
|
||||
|
||||
return $this->app->erp->base64_url_encode($ret);
|
||||
}
|
||||
if($rule === null) {
|
||||
$rule = $this->NameToRule($name);
|
||||
}
|
||||
return $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'',$rule,$maxlength,$sqlcheckoff);
|
||||
}
|
||||
|
||||
function NameToRule($name)
|
||||
{
|
||||
switch($name)
|
||||
{
|
||||
case 'id':
|
||||
return 'doppelid';
|
||||
break;
|
||||
case 'sid':
|
||||
return 'alphadigits';
|
||||
break;
|
||||
case 'module':
|
||||
case 'smodule':
|
||||
case 'action':
|
||||
case 'saction':
|
||||
return 'module';
|
||||
break;
|
||||
case 'cmd':
|
||||
return 'moduleminus';
|
||||
break;
|
||||
}
|
||||
return 'nothtml';
|
||||
}
|
||||
|
||||
public function GetPOST($name,$rule=null,$maxlength="",$sqlcheckoff="")
|
||||
{
|
||||
if($rule === null) {
|
||||
$rule = $this->NameToRule($name);
|
||||
if(isset($this->POST['ishtml_cke_'.$name]) && $this->POST['ishtml_cke_'.$name]) {
|
||||
$rule = 'nojs';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->Syntax(isset($this->POST[$name])?$this->POST[$name]:'',$rule,$maxlength,$sqlcheckoff);
|
||||
}
|
||||
|
||||
public function GetPOSTForForms($name,$rule="",$maxlength="",$sqlcheckoff="")
|
||||
{
|
||||
return $this->SyntaxForForms($this->POST[$name],$rule,$maxlength,$sqlcheckoff);
|
||||
}
|
||||
|
||||
public function CleanString($string, $rule='nohtml',$sqlcheckoff='')
|
||||
{
|
||||
return $this->Syntax($string, $rule, '', $sqlcheckoff);
|
||||
}
|
||||
|
||||
public function xss_clean($data)
|
||||
{
|
||||
return $this->app->stringcleaner->xss_clean($data);
|
||||
}
|
||||
|
||||
public function GetPOSTArray()
|
||||
{
|
||||
if(!empty($this->POST) && count($this->POST)>0)
|
||||
{
|
||||
foreach($this->POST as $key=>$value)
|
||||
{
|
||||
$value = $this->GetPOST($key);
|
||||
if ($value !== null) {
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!empty($ret))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function GetGETArray()
|
||||
{
|
||||
if(!empty($this->GET) && count($this->GET)>0)
|
||||
{
|
||||
foreach($this->GET as $key=>$value)
|
||||
{
|
||||
$value = $this->GetGET($key);
|
||||
if ($value !== null) {
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!empty($ret))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function stripallslashes($string) {
|
||||
|
||||
while(strstr($string,'\\')) {
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function smartstripslashes($str) {
|
||||
$cd1 = substr_count($str, "\"");
|
||||
$cd2 = substr_count($str, "\\\"");
|
||||
$cs1 = substr_count($str, "'");
|
||||
$cs2 = substr_count($str, "\\'");
|
||||
$tmp = strtr($str, array("\\\"" => "", "\\'" => ""));
|
||||
$cb1 = substr_count($tmp, "\\");
|
||||
$cb2 = substr_count($tmp, "\\\\");
|
||||
if ($cd1 == $cd2 && $cs1 == $cs2 && $cb1 == 2 * $cb2) {
|
||||
return strtr($str, array("\\\"" => "\"", "\\'" => "'", "\\\\" => "\\"));
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function SyntaxForForms($value,$rule,$maxlength="",$sqlcheckoff="")
|
||||
{
|
||||
return $value;//mysqli_real_escape_string($this->app->DB->connection,$value);//mysqli_real_escape_string($value);
|
||||
}
|
||||
|
||||
// check actual value with given rule
|
||||
public function Syntax($value,$rule,$maxlength='',$sqlcheckoff='')
|
||||
{
|
||||
$striptags = false;
|
||||
if(is_array($value))
|
||||
{
|
||||
if($sqlcheckoff != '')
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
foreach($value as $k => $v)
|
||||
{
|
||||
if(is_array($v))
|
||||
{
|
||||
$value[$k] = $v;
|
||||
}else{
|
||||
$v = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$v);
|
||||
if($striptags){
|
||||
$v = $this->stripallslashes($v);
|
||||
$v = $this->smartstripslashes($v);
|
||||
$v = $this->app->erp->superentities($v);
|
||||
}
|
||||
$value[$k] = $this->app->DB->real_escape_string($v);
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
$value = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$value);
|
||||
|
||||
if($striptags){
|
||||
$value = $this->stripallslashes($value);
|
||||
$value = $this->smartstripslashes($value);
|
||||
|
||||
$value = $this->app->erp->superentities($value);
|
||||
}
|
||||
|
||||
if(!empty($this->app->stringcleaner)) {
|
||||
if( $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string($this->app->stringcleaner->CleanString($value, $rule));
|
||||
}
|
||||
return $this->app->stringcleaner->CleanString($value, $rule);
|
||||
}
|
||||
|
||||
if($rule === 'nohtml') {
|
||||
if( $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string(strip_tags($value));
|
||||
}
|
||||
|
||||
return strip_tags($value);
|
||||
|
||||
}
|
||||
if($rule === 'nojs') {
|
||||
if( $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string($this->xss_clean($value));
|
||||
}
|
||||
|
||||
return $this->xss_clean($value);
|
||||
}
|
||||
|
||||
if($rule=='' && $sqlcheckoff == '') {
|
||||
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
|
||||
}
|
||||
if($rule=='' && $sqlcheckoff != '') {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// build complete regexp
|
||||
|
||||
// check if rule exists
|
||||
|
||||
if($this->GetRegexp($rule)!=''){
|
||||
//$v = '/^['.$this->GetRegexp($rule).']+$/';
|
||||
$v = $this->GetRegexp($rule);
|
||||
if (preg_match_all('/'.$v.'/i', $value, $teffer) ) {
|
||||
if($sqlcheckoff==''){
|
||||
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
echo "<table border=\"1\" width=\"100%\" bgcolor=\"#FFB6C1\">
|
||||
<tr><td>Rule <b>$rule</b> doesn't exists!</td></tr></table>";
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function RuleCheck($value,$rule)
|
||||
{
|
||||
$found = false;
|
||||
if(!empty($this->app->stringcleaner)) {
|
||||
$value_ = $this->app->stringcleaner->RuleCheck($value, $rule, $found);
|
||||
if($found) {
|
||||
if($value_) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$v = $this->GetRegexp($rule);
|
||||
if (preg_match_all('/'.$v.'/i', $value, $teffer) ){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function AddRule($name,$type,$rule)
|
||||
{
|
||||
// type: reg = regular expression
|
||||
// type: glue ( already exists rules copy to new e.g. number+digit)
|
||||
$this->rules[$name]=array('type'=>$type,'rule'=>$rule);
|
||||
}
|
||||
|
||||
// get complete regexp by rule name
|
||||
function GetRegexp($rule)
|
||||
{
|
||||
$rules = explode('+',$rule);
|
||||
$ret = '';
|
||||
foreach($rules as $key) {
|
||||
// check if rule is last in glue string
|
||||
if($this->rules[$key]['type']==='glue') {
|
||||
$subrules = explode('+',$this->rules[$key]['rule']);
|
||||
if(count($subrules)>0) {
|
||||
foreach($subrules as $subkey) {
|
||||
$ret .= $this->GetRegexp($subkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($this->rules[$key]['type']==='reg') {
|
||||
$ret .= $this->rules[$key]['rule'];
|
||||
}
|
||||
}
|
||||
if($ret==''){
|
||||
$ret = 'none';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3552,6 +3552,67 @@ class YUI {
|
||||
'</td></tr></table>')";
|
||||
}
|
||||
|
||||
function IconsSQL_produktion($tablename) {
|
||||
$freigegeben = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/produkton_laeuft.png\" title=\"Produktion freigegeben\" border=\"0\" style=\"margin-right:1px\">";
|
||||
$angelegt = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/blue.png\" title=\"Produktion angelegt\" border=\"0\" style=\"margin-right:1px\">";
|
||||
$abgeschlossen = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/grey.png\" title=\"Produktion abgeschlossen\" border=\"0\" style=\"margin-right:1px\">";
|
||||
$gestartet = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/produkton_green.png\" title=\"Produktion gestartet\" border=\"0\" style=\"margin-right:1px\">";
|
||||
$storniert = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/storno.png\" title=\"Produktion storniert\" border=\"0\" style=\"margin-right:1px\">";
|
||||
|
||||
for ($z = 0;$z < 6;$z++) {
|
||||
$angelegt_6 .= $angelegt;
|
||||
$abgeschlossen_6 .= $abgeschlossen;
|
||||
$storniert_6 .= $storniert;
|
||||
}
|
||||
|
||||
$lager_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagergo.png\" style=\"margin-right:1px\" title=\"Artikel ist im Lager\" border=\"0\">";
|
||||
$lager_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagerstop.png\" style=\"margin-right:1px\" title=\"Artikel fehlt im Lager\" border=\"0\">";
|
||||
|
||||
$reserviert_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ware_bestellt.png\" style=\"margin-right:1px\" title=\"Artikel reserviert\" border=\"0\">";
|
||||
$reserviert_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ware_nicht_bestellt.png\" style=\"margin-right:1px\" title=\"Artikel nicht reserviert\" border=\"0\">";
|
||||
|
||||
$auslagern_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ausgelagert.png\" title=\"Produktion ausgelagert\" border=\"0\" style=\"margin-right:1px\">";
|
||||
$auslagern_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_ausgelagert.png\" title=\"Produktion ausgelagert\" border=\"0\" style=\"margin-right:1px\">";
|
||||
|
||||
$einlagern_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/eingelagert.png\" title=\"Produktion eingelagert\" border=\"0\" style=\"margin-right:1px\">";
|
||||
$einlagern_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_eingelagert.png\" title=\"Produktion eingelagert\" border=\"0\" style=\"margin-right:1px\">";
|
||||
|
||||
$zeit_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/zeit_dreiviertel.png\" style=\"margin-right:1px\" title=\"Zeiten erfasst\" border=\"0\">";
|
||||
$zeit_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/keine_zeiten.png\" style=\"margin-right:1px\" title=\"Zeiten nicht erfasst\" border=\"0\">";
|
||||
|
||||
$versand_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrego.png\" style=\"margin-right:1px\" title=\"Versand ok\" border=\"0\">";
|
||||
$versand_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrestop.png\" style=\"margin-right:1px\" title=\"Versand nicht ok\" border=\"0\">";
|
||||
|
||||
return "CONCAT('<table><tr><td nowrap>',
|
||||
CASE
|
||||
WHEN $tablename.status = 'freigegeben' THEN '$freigegeben'
|
||||
WHEN $tablename.status = 'abgeschlossen' THEN '$abgeschlossen'
|
||||
WHEN $tablename.status = 'angelegt' THEN '$angelegt'
|
||||
WHEN $tablename.status = 'gestartet' THEN '$gestartet'
|
||||
ELSE
|
||||
'$storniert'
|
||||
end,
|
||||
CASE
|
||||
WHEN FIND_IN_SET($tablename.status, 'freigegeben,gestartet') THEN
|
||||
CONCAT (
|
||||
if($tablename.lager_ok,'$lager_ok','$lager_nicht_ok'),
|
||||
if($tablename.reserviert_ok,'$reserviert_ok','$reserviert_nicht_ok'),
|
||||
if($tablename.auslagern_ok,'$auslagern_ok','$auslagern_nicht_ok'),
|
||||
if($tablename.einlagern_ok,'$einlagern_ok','$einlagern_nicht_ok'),
|
||||
if($tablename.zeit_ok,'$zeit_ok','$zeit_nicht_ok'),
|
||||
if($tablename.versand_ok,'$versand_ok','$versand_nicht_ok')
|
||||
)
|
||||
ELSE
|
||||
CASE
|
||||
WHEN $tablename.status = 'angelegt' THEN '$angelegt_6'
|
||||
WHEN $tablename.status = 'abgeschlossen' THEN '$abgeschlossen_6'
|
||||
ELSE
|
||||
'$storniert_6'
|
||||
END
|
||||
END,
|
||||
'</td></tr></table>')";
|
||||
}
|
||||
|
||||
function TablePositionSearch($parsetarget, $name, $callback = "show", $gener) {
|
||||
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
@@ -7807,10 +7868,10 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
|
||||
|
||||
// headings
|
||||
|
||||
$heading = array('', '', 'Angebot', 'Vom', 'Kd-Nr.', 'Kunde', 'Land', 'Projekt', 'Zahlung', 'Betrag (brutto)', 'Status', 'Menü');
|
||||
$heading = array('', '', 'Angebot', 'Vom', 'Kd-Nr.', 'Kunde', 'Land', 'Projekt', 'Zahlung', 'Betrag (brutto)', 'Status','Bearbeiter', 'Menü');
|
||||
$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');
|
||||
$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');
|
||||
$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','a.bearbeiter', 'adr.freifeld1','a.internebezeichnung');
|
||||
$defaultorder = 12; //Optional wenn andere Reihenfolge gewuenscht
|
||||
|
||||
$defaultorderdesc = 1;
|
||||
@@ -7843,7 +7904,7 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
|
||||
."<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>"
|
||||
."</td></tr></table>";
|
||||
$menucol = 11;
|
||||
$menucol = 12;
|
||||
|
||||
$parameter = $this->app->User->GetParameter('table_filter_angebot');
|
||||
$parameter = base64_decode($parameter);
|
||||
@@ -7864,6 +7925,7 @@ a.land as land, p.abkuerzung as projekt, a.zahlungsweise as zahlungsweise,
|
||||
a.zahlungsweise as zahlungsweise,
|
||||
FORMAT(a.gesamtsumme,2{$extended_mysql55}) as betrag,
|
||||
UPPER(a.status) as status,
|
||||
a.bearbeiter,
|
||||
a.id
|
||||
";
|
||||
|
||||
|
||||
@@ -13,17 +13,21 @@
|
||||
* PLACEHOLDER_EDIT
|
||||
* PLACEHOLDER_DELETE
|
||||
* PLACEHOLDER_SQL_LIST
|
||||
* PLACEHOLDER_SQL_LIST
|
||||
* PLACEHOLDER_DROPNBOX
|
||||
* PLACEHOLDER_GET_INPUT
|
||||
* PLACEHOLDER_SET_INPUT
|
||||
* PLACEHOLDER_COLUMNS
|
||||
* PLACEHOLDER_ID_COLUMN
|
||||
* PLACEHOLDER_HEADERS
|
||||
* PLACEHOLDER_SET_TPL
|
||||
*/
|
||||
|
||||
$host = 'localhost';
|
||||
$user = 'openxedev';
|
||||
$passwd = 'openxedev';
|
||||
$schema = 'openxedev';
|
||||
$user = 'openxe';
|
||||
$passwd = 'openxe';
|
||||
$schema = 'openxe';
|
||||
|
||||
echo("\n");
|
||||
|
||||
if ($argc >= 2) {
|
||||
|
||||
@@ -39,12 +43,34 @@ if ($argc >= 2) {
|
||||
$force = false;
|
||||
}
|
||||
|
||||
if (!str_starts_with($argv[1],'-')) {
|
||||
$module_name = $argv[1];
|
||||
if (strpos($argv[1],'-') == 0) {
|
||||
$module_name = $argv[1];
|
||||
} else {
|
||||
info();
|
||||
exit;
|
||||
}
|
||||
|
||||
// column selection
|
||||
$selected_columns = array();
|
||||
|
||||
// Set selected_columns here or per parameter -c col1,col2,col3
|
||||
// $selected_columns = array('belegnr','adresse','projekt');
|
||||
|
||||
if (in_array('-c', $argv)) {
|
||||
$pos = array_keys($argv, '-c')[0];
|
||||
$pos++;
|
||||
|
||||
if (isset($argv[$pos])) {
|
||||
$selected_columns = explode(',',$argv[$pos]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($selected_columns)) {
|
||||
echo("Selected all columns.\n");
|
||||
} else {
|
||||
echo("Selected ".count($selected_columns)." columns,\n");
|
||||
}
|
||||
|
||||
$module_class_name = ucfirst($module_name);
|
||||
$php_file_name = $module_name . ".php";
|
||||
$php_template_file_name = "module_creator_php_template.txt";
|
||||
@@ -85,49 +111,72 @@ if ($argc >= 2) {
|
||||
$columns = array();
|
||||
$sql_columns = array();
|
||||
$edit_form = "";
|
||||
$tab_pos = " "; // Tab position
|
||||
|
||||
/* Iterate through the result set */
|
||||
echo "FIELD\t\t\t\tType\t\tNull\tKey\tDefault\tExtra\n";
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
foreach ($row as $key => $value) {
|
||||
echo($value);
|
||||
|
||||
switch ($key) {
|
||||
case 'Field':
|
||||
$colwidth = 32;
|
||||
$column_processed = false;
|
||||
|
||||
if ($value != 'id') {
|
||||
$columns[] = $value;
|
||||
$sql_columns[] = $table_short_name.".".$value;
|
||||
}
|
||||
if (empty($selected_columns) || in_array($row['Field'],$selected_columns) || $row['Field'] == 'id') {
|
||||
|
||||
break;
|
||||
case 'Type':
|
||||
$colwidth = 16;
|
||||
break;
|
||||
default:
|
||||
$colwidth = 8;
|
||||
break;
|
||||
foreach ($row as $key => $value) {
|
||||
|
||||
echo($value);
|
||||
|
||||
switch ($key) {
|
||||
case 'Field':
|
||||
$colwidth = 32;
|
||||
|
||||
if ($value != 'id') {
|
||||
$column_processed = true;
|
||||
$columns[] = $value;
|
||||
$sql_columns[] = $table_short_name.".".$value;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'Type':
|
||||
$colwidth = 16;
|
||||
break;
|
||||
default:
|
||||
$colwidth = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
for ($filler = strlen($value); $filler < $colwidth; $filler++) {
|
||||
echo(" ");
|
||||
}
|
||||
}
|
||||
|
||||
for ($filler = strlen($value); $filler < $colwidth; $filler++) {
|
||||
echo(" ");
|
||||
}
|
||||
// Build edit form
|
||||
// <tr><td>{|Bezeichnung|}:*</td><td><input type="text" id="bezeichnung" name="bezeichnung" value="[BEZEICHNUNG]" size="40"></td></tr>
|
||||
|
||||
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>
|
||||
';
|
||||
}
|
||||
echo("\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Build edit form
|
||||
// <tr><td>{|Bezeichnung|}:*</td><td><input type="text" id="bezeichnung" name="bezeichnung" value="[BEZEICHNUNG]" size="40"></td></tr>
|
||||
|
||||
if ($row['Field'] != 'id') {
|
||||
$edit_form = $edit_form . '<tr><td>{|' . ucfirst($row['Field']) . '|}:</td><td><input type="text" name="' . $row['Field'] . '" value="[' . strtoupper($row['Field']) . ']" size="40"></td></tr>' . "\n";
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
if (empty($columns)) {
|
||||
echo("No matching columns found!\n");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Create php file
|
||||
|
||||
$list_of_columns = implode(', ', $columns);
|
||||
$list_of_columns_headers_in_quotes = "'" . implode('\', \'', array_map('ucfirst',$columns)) . "'";
|
||||
$list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'";
|
||||
$sql_list_of_columns = implode(', ', $sql_columns);
|
||||
$sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'";
|
||||
@@ -152,11 +201,14 @@ if ($argc >= 2) {
|
||||
$php_file_contents = str_replace('PLACEHOLDER_LIST', $module_name . "_list", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_EDIT', $module_name . "_edit", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_DELETE', $module_name . "_delete", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_SQL_LIST', "SELECT SQL_CALC_FOUND_ROWS $table_short_name.id, $sql_list_of_columns, $table_short_name.id FROM $module_name $table_short_name", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_DROPNBOX',"'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\\\"checkbox\\\" name=\\\"auswahl[]\\\" value=\\\"',".$table_short_name.".id,'\\\" />') AS `auswahl`", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_SQL_LIST', "SELECT SQL_CALC_FOUND_ROWS $table_short_name.id, \$dropnbox, $sql_list_of_columns, $table_short_name.id FROM $module_name $table_short_name", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_SQL_EDIT', "INSERT INTO $module_name ($list_of_columns, id) values ('\".implode('\', \'',\$input).\"', \$id) ON DUPLICATE KEY UPDATE SET ", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_GET_INPUT', $get_input, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_SET_INPUT', $set_input, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_COLUMNS', $list_of_columns_in_quotes, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_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 = fopen($target_php_folder . $php_file_name, "w");
|
||||
@@ -221,6 +273,8 @@ function info() {
|
||||
echo("arg1: SQL table name\n");
|
||||
echo("Options\n");
|
||||
echo("\t-v: verbose output\n");
|
||||
echo("\t-f: force override of existing files\n");
|
||||
echo("\t-c: select columns like this: -c col1,col2,col3,col3\n");
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,15 +30,20 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
switch ($name) {
|
||||
case "PLACEHOLDER_LIST":
|
||||
$allowed['PLACEHOLDER_LIST'] = array('list');
|
||||
$heading = array(PLACEHOLDER_COLUMNS, 'Menü');
|
||||
$width = array('10%'); // Fill out manually later
|
||||
$heading = array('','',PLACEHOLDER_HEADERS, 'Menü');
|
||||
$width = array('1%','1%','10%'); // Fill out manually later
|
||||
|
||||
$findcols = array(PLACEHOLDER_SQL_COLUMNS);
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS);
|
||||
$searchsql = array(PLACEHOLDER_SQL_COLUMNS);
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$dropnbox = "PLACEHOLDER_DROPNBOX";
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=PLACEHOLDER_MODULENAME&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=PLACEHOLDER_MODULENAME&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
|
||||
$sql = "PLACEHOLDER_SQL_LIST";
|
||||
@@ -86,6 +91,12 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
|
||||
function PLACEHOLDER_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);
|
||||
|
||||
@@ -141,6 +152,7 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
|
||||
|
||||
// Load values again from database
|
||||
$dropnbox = "PLACEHOLDER_DROPNBOX";
|
||||
$result = $this->app->DB->SelectArr("PLACEHOLDER_SQL_LIST"." WHERE id=$id");
|
||||
|
||||
foreach ($result[0] as $key => $value) {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
<?php
|
||||
header('Location: ./www/update.php?rand=' . sha1(mt_rand()));
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php
|
||||
include("upgradesystemclient2.php");
|
||||
include("upgradedbonly.php");
|
||||
@@ -0,0 +1,19 @@
|
||||
OpenXE upgrade system
|
||||
|
||||
NOTE:
|
||||
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
|
||||
2. run database upgrade
|
||||
|
||||
Files in this directory:
|
||||
UPGRADE.md -> This file
|
||||
upgrade.sh -> The upgrade starter, execute with "./upgrade.sh". Execute without parameters to view possible options.
|
||||
|
||||
Files in the data subdirectory:
|
||||
upgrade.php -> The upgrade program
|
||||
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
|
||||
upgrade.log -> Contains the output from the last run that was started from within OpenXE
|
||||
+114364
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "https://github.com/openxe-org/openxe.git",
|
||||
"branch": "master"
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Upgrader using git for file upgrade and mustal to update the database definition
|
||||
*
|
||||
* Copyright (c) 2022 OpenXE project
|
||||
*
|
||||
*/
|
||||
|
||||
$upgrade_echo_out_file_name = "";
|
||||
|
||||
function upgrade_set_out_file_name(string $filename) {
|
||||
|
||||
GLOBAL $upgrade_echo_out_file_name;
|
||||
|
||||
$upgrade_echo_out_file_name = $filename;
|
||||
}
|
||||
|
||||
function echo_out(string $text) {
|
||||
|
||||
GLOBAL $upgrade_echo_out_file_name;
|
||||
|
||||
if ($upgrade_echo_out_file_name == "") {
|
||||
echo($text);
|
||||
} else {
|
||||
file_put_contents($upgrade_echo_out_file_name,$text, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
function echo_output(array $output) {
|
||||
echo_out(implode("\n",$output)."\n");
|
||||
}
|
||||
|
||||
function abort(string $message) {
|
||||
echo_out($message."\n");
|
||||
echo_out("--------------- Aborted! ---------------\n");
|
||||
echo_out("--------------- ".date("Y-m-d H:i:s")." ---------------\n");
|
||||
}
|
||||
|
||||
function git(string $command, &$output, bool $show_command, bool $show_output, string $error_text) : int {
|
||||
$output = array();
|
||||
if ($show_command) {
|
||||
echo_out("git ".$command."\n");
|
||||
}
|
||||
exec("git ".$command,$output,$retval);
|
||||
if (!empty($output)) {
|
||||
if ($show_output || $retval != 0) {
|
||||
echo_output($output);
|
||||
}
|
||||
}
|
||||
if ($retval != 0) {
|
||||
echo_out($error_text."\n");
|
||||
}
|
||||
return($retval);
|
||||
}
|
||||
|
||||
// -------------------------------- START
|
||||
|
||||
// Check for correct call method
|
||||
if (php_sapi_name() == "cli") {
|
||||
|
||||
$directory = getcwd();
|
||||
if (basename($directory) != 'upgrade') {
|
||||
abort("Must be executed from 'upgrade' directory.");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
$check_git = false;
|
||||
$do_git = false;
|
||||
$check_db = false;
|
||||
$do_db = false;
|
||||
$do = false;
|
||||
|
||||
if ($argc > 1) {
|
||||
|
||||
if (in_array('-v', $argv)) {
|
||||
$verbose = true;
|
||||
} else {
|
||||
$verbose = false;
|
||||
}
|
||||
|
||||
if (in_array('-e', $argv)) {
|
||||
$export_db = true;
|
||||
} else {
|
||||
$export_db = false;
|
||||
}
|
||||
|
||||
if (in_array('-f', $argv)) {
|
||||
$force = true;
|
||||
} else {
|
||||
$force = false;
|
||||
}
|
||||
|
||||
if (in_array('-o', $argv)) {
|
||||
$origin = true;
|
||||
} else {
|
||||
$origin = false;
|
||||
}
|
||||
|
||||
if (in_array('-connection', $argv)) {
|
||||
$connection = true;
|
||||
} else {
|
||||
$connection = false;
|
||||
}
|
||||
|
||||
if (in_array('-s', $argv)) {
|
||||
$check_git = true;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (in_array('-db', $argv)) {
|
||||
$check_db = true;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (in_array('-do', $argv)) {
|
||||
if (!$check_git && !$check_db) {
|
||||
$do_git = true;
|
||||
$do_db = true;
|
||||
}
|
||||
if ($check_git) {
|
||||
$do_git = true;
|
||||
}
|
||||
if ($check_db) {
|
||||
$do_db = true;
|
||||
}
|
||||
}
|
||||
|
||||
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,$origin);
|
||||
} else {
|
||||
info();
|
||||
}
|
||||
|
||||
} else {
|
||||
info();
|
||||
}
|
||||
|
||||
}
|
||||
// -------------------------------- 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, bool $origin) {
|
||||
|
||||
$mainfolder = dirname($directory);
|
||||
$datafolder = $directory."/data";
|
||||
$lockfile_name = $datafolder."/.in_progress.flag";
|
||||
$remote_file_name = $datafolder."/remote.json";
|
||||
$schema_file_name = "db_schema.json";
|
||||
|
||||
echo_out("--------------- OpenXE upgrade ---------------\n");
|
||||
echo_out("--------------- ".date("Y-m-d H:i:s")." ---------------\n");
|
||||
|
||||
//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);
|
||||
if (!$remote_info_contents) {
|
||||
abort("Unable to load $remote_file_name");
|
||||
return(-1);
|
||||
}
|
||||
$remote_info = json_decode($remote_info_contents, true);
|
||||
}
|
||||
|
||||
if ($check_git || $do_git) {
|
||||
|
||||
$retval = git("log HEAD --", $output,$verbose,false,"");
|
||||
// Not a git repository -> Create it and then go ahead
|
||||
if ($retval == 128) {
|
||||
if (!$do_git) {
|
||||
abort("Git not initialized, use -do to initialize.");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
echo_out("Setting up git...");
|
||||
$retval = git("init $mainfolder", $output,$verbose,$verbose,"Error while initializing git!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
$retval = git("add $mainfolder", $output,$verbose,$verbose,"Error while initializing git!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
$retval = git("fetch ".$remote_info['host']." ".$remote_info['branch'],$output,$verbose,$verbose,"Error while initializing git!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
$retval = git("checkout FETCH_HEAD -f --", $output,$verbose,$verbose,"Error while initializing git!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
} else if ($retval != 0) {
|
||||
abort("Error while executing git!");
|
||||
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) {
|
||||
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!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
echo_out("--------------- Current version ---------------\n");
|
||||
$retval = git("log -1 --date=short-local --pretty=\"%cd (%h): %s\" HEAD --",$output,$verbose,true,"Error while showing history!");
|
||||
if ($retval != 0) {
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_git) {
|
||||
|
||||
if ($modified_files && !$force) {
|
||||
abort("Clear modified files or use -f");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
echo_out("--------------- Pulling files... ---------------\n");
|
||||
|
||||
if ($force) {
|
||||
$retval = git("reset --hard",$output,$verbose,$verbose,"Error while resetting modified files!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
$retval = git("pull ".$remote_info['host']." ".$remote_info['branch'],$output,$verbose,$verbose,"Error while pulling files!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
$retval = git("reset --hard",$output,$verbose,$verbose,"Error while applying files!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
echo_out("--------------- Files upgrade completed ---------------\n");
|
||||
$retval = git("log -1 ",$output,$verbose,$verbose,"Error while checking files!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
return(-1);
|
||||
}
|
||||
echo_output($output);
|
||||
} // $do_git
|
||||
else { // Dry run
|
||||
echo_out("--------------- Dry run, use -do to upgrade ---------------\n");
|
||||
echo_out("--------------- Fetching files... ---------------\n");
|
||||
|
||||
$retval = git("fetch ".$remote_info['host']." ".$remote_info['branch'],$output,$verbose,$verbose,"Error while fetching files!");
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
}
|
||||
|
||||
echo_out("--------------- Pending upgrades: ---------------\n");
|
||||
|
||||
$retval = git("log --date=short-local --pretty=\"%cd (%h): %s\" FETCH_HEAD --not HEAD",$output,$verbose,true,"Error while fetching files!");
|
||||
if (empty($output)) {
|
||||
echo_out("No upgrades pending.\n");
|
||||
}
|
||||
if ($retval != 0) {
|
||||
abort("");
|
||||
}
|
||||
} // Dry run
|
||||
} // $check_git
|
||||
|
||||
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");
|
||||
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
|
||||
|
||||
if (empty($db_def)) {
|
||||
echo_out("Could not load from $schema@$host\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($export_db) {
|
||||
$export_file_name = "exported_db_schema.json";
|
||||
if (mustal_save_tables_to_json($db_def, $datafolder, $export_file_name, true) == 0) {
|
||||
echo_out("Database exported to $datafolder/$export_file_name\n");
|
||||
}
|
||||
else {
|
||||
echo_out("Could not export database to $datafolder/$export_file_name\n");
|
||||
}
|
||||
}
|
||||
|
||||
$compare_differences = array();
|
||||
|
||||
echo_out("--------------- Loading from JSON... ---------------\n");
|
||||
$compare_def = mustal_load_tables_from_json($datafolder, $schema_file_name);
|
||||
|
||||
if (empty($compare_def)) {
|
||||
abort("Could not load from JSON $schema_file_name\n");
|
||||
return(-1);
|
||||
}
|
||||
echo_out("Table count database ".count($db_def['tables'])." vs. JSON ".count($compare_def['tables'])."\n");
|
||||
echo_out("--------------- Comparing JSON '".$compare_def['database']."@".$compare_def['host']."' vs. database '$schema@$host' ---------------\n");
|
||||
$compare_differences = mustal_compare_table_array($db_def,"in DB",$compare_def,"in JSON",false,true);
|
||||
if ($verbose) {
|
||||
foreach ($compare_differences as $compare_difference) {
|
||||
$comma = "";
|
||||
foreach ($compare_difference as $key => $value) {
|
||||
echo_out($comma."$key => [$value]");
|
||||
$comma = ", ";
|
||||
}
|
||||
echo_out("\n");
|
||||
}
|
||||
}
|
||||
echo_out((empty($compare_differences)?0:count($compare_differences))." differences.\n");
|
||||
|
||||
echo_out("--------------- 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,true);
|
||||
if ($verbose) {
|
||||
foreach ($compare_differences as $compare_difference) {
|
||||
$comma = "";
|
||||
foreach ($compare_difference as $key => $value) {
|
||||
echo_out($comma."$key => [$value]");
|
||||
$comma = ", ";
|
||||
}
|
||||
echo_out("\n");
|
||||
}
|
||||
}
|
||||
echo_out((empty($compare_differences)?0:count($compare_differences))." differences.\n");
|
||||
|
||||
echo_out("--------------- Calculating database upgrade for '$schema@$host'... ---------------\n");
|
||||
|
||||
$upgrade_sql = array();
|
||||
$result = mustal_calculate_db_upgrade($compare_def, $db_def, $upgrade_sql, $mustal_replacers);
|
||||
|
||||
if (!empty($result)) {
|
||||
abort(count($result)." errors.\n");
|
||||
if ($verbose) {
|
||||
foreach($result as $error) {
|
||||
echo_out("Code: ".$error[0]." '".$error[1]."'\n");
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
foreach($upgrade_sql as $statement) {
|
||||
echo_out($statement."\n");
|
||||
}
|
||||
}
|
||||
|
||||
echo_out(count($upgrade_sql)." upgrade statements\n");
|
||||
|
||||
if ($do_db) {
|
||||
echo_out("--------------- Executing database upgrade for '$schema@$host' database... ---------------\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_out("\rUpgrade step $counter of $number_of_statements... ");
|
||||
|
||||
$query_result = mysqli_query($mysqli, $sql);
|
||||
if (!$query_result) {
|
||||
$error = " not ok: ". mysqli_error($mysqli);
|
||||
echo_out($error);
|
||||
echo_out("\n");
|
||||
// file_put_contents("./errors.txt",date()." ".$error.$sql."\n",FILE_APPEND);
|
||||
$error_counter++;
|
||||
} else {
|
||||
echo_out("ok.\r");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo_out("\n");
|
||||
echo_out("$error_counter errors.\n");
|
||||
if ($error_counter > 0) {
|
||||
// echo_out("See 'errors.txt'\n");
|
||||
}
|
||||
|
||||
echo_out("--------------- Checking database upgrade for '$schema@$host'... ---------------\n");
|
||||
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
|
||||
|
||||
echo_out("--------------- 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,true);
|
||||
echo_out((empty($compare_differences)?0:count($compare_differences))." differences.\n");
|
||||
}
|
||||
} // $do_db
|
||||
} // $check_db
|
||||
|
||||
/*
|
||||
echo_out("--------------- Locking system ---------------\n");
|
||||
if (file_exists($lockfile_name)) {
|
||||
echo_out("System is already locked.\n");
|
||||
} else {
|
||||
file_put_contents($lockfile_name," ");
|
||||
}
|
||||
|
||||
echo_out("--------------- Unlocking system ---------------\n");
|
||||
unlink($lockfile_name);
|
||||
*/
|
||||
|
||||
echo_out("--------------- Done! ---------------\n");
|
||||
echo_out("--------------- ".date("Y-m-d H:i:s")." ---------------\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
function info() {
|
||||
echo_out("OpenXE upgrade tool\n");
|
||||
echo_out("Copyright 2022 (c) OpenXE project\n");
|
||||
echo_out("\n");
|
||||
echo_out("Upgrade files and database\n");
|
||||
echo_out("Options:\n");
|
||||
echo_out("\t-s: check/do system upgrades\n");
|
||||
echo_out("\t-db: check/do database upgrades\n");
|
||||
echo_out("\t-e: export database schema\n");
|
||||
echo_out("\t-do: execute all upgrades\n");
|
||||
echo_out("\t-v: verbose output\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-clean: (not yet implemented) create the needed SQL to remove items from the database not in the JSON\n");
|
||||
echo_out("\n");
|
||||
}
|
||||
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
sudo -u www-data php data/upgrade.php "$@"
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
//include("wawision.inc.php");
|
||||
|
||||
use Xentral\Core\Installer\Installer;
|
||||
use Xentral\Core\Installer\InstallerCacheConfig;
|
||||
use Xentral\Core\Installer\InstallerCacheWriter;
|
||||
use Xentral\Core\Installer\ClassMapGenerator;
|
||||
use Xentral\Core\Installer\Psr4ClassNameResolver;
|
||||
use Xentral\Core\Installer\TableSchemaEnsurer;
|
||||
use Xentral\Components\Database\DatabaseConfig;
|
||||
|
||||
// Nur einfache Fehler melden
|
||||
error_reporting(E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR | E_PARSE);
|
||||
if(file_exists(__DIR__.'/xentral_autoloader.php')){
|
||||
include_once (__DIR__.'/xentral_autoloader.php');
|
||||
}
|
||||
|
||||
include_once("conf/main.conf.php");
|
||||
include_once("phpwf/plugins/class.mysql.php");
|
||||
include_once("www/lib/class.erpapi.php");
|
||||
if(file_exists("www/lib/class.erpapi_custom.php")){
|
||||
include_once("www/lib/class.erpapi_custom.php");
|
||||
}
|
||||
/*
|
||||
class app_t
|
||||
{
|
||||
var $DB;
|
||||
var $user;
|
||||
var $Conf;
|
||||
}
|
||||
|
||||
$app = new app_t();
|
||||
*/
|
||||
|
||||
$config = new Config();
|
||||
|
||||
// Delete ServiceMap-CacheFile
|
||||
$installConf = new InstallerCacheConfig($config->WFuserdata . '/tmp/' . $config->WFdbname);
|
||||
$serviceCacheFile = $installConf->getServiceCacheFile();
|
||||
@unlink($serviceCacheFile);
|
||||
|
||||
$app = new ApplicationCore();
|
||||
|
||||
$DEBUG = 0;
|
||||
|
||||
$app->Conf = $config;
|
||||
$app->DB = new DB($app->Conf->WFdbhost,$app->Conf->WFdbname,$app->Conf->WFdbuser,$app->Conf->WFdbpass, $app, $app->Conf->WFdbport);
|
||||
if(class_exists('erpAPICustom'))
|
||||
{
|
||||
$erp = new erpAPICustom($app);
|
||||
}else{
|
||||
$erp = new erpAPI($app);
|
||||
}
|
||||
|
||||
echo "STARTE DB Upgrade\r\n";
|
||||
$erp->UpgradeDatabase();
|
||||
echo "ENDE DB Upgrade\r\n\r\n";
|
||||
|
||||
try {
|
||||
echo "STARTE Installer\r\n";
|
||||
|
||||
$resolver = new Psr4ClassNameResolver();
|
||||
$resolver->addNamespace('Xentral\\', __DIR__ . '/classes');
|
||||
$resolver->excludeFile(__DIR__ . '/classes/bootstrap.php');
|
||||
|
||||
$generator = new ClassMapGenerator($resolver, __DIR__);
|
||||
$installer = new Installer($generator, $resolver);
|
||||
$writer = new InstallerCacheWriter($installConf, $installer);
|
||||
|
||||
$dbConfig = new DatabaseConfig(
|
||||
$app->Conf->WFdbhost,
|
||||
$app->Conf->WFdbuser,
|
||||
$app->Conf->WFdbpass,
|
||||
$app->Conf->WFdbname,
|
||||
null,
|
||||
$app->Conf->WFdbport
|
||||
);
|
||||
$tableSchemaCreator = new TableSchemaEnsurer(
|
||||
$app->Container->get('SchemaCreator'),
|
||||
$installConf,
|
||||
$dbConfig
|
||||
);
|
||||
|
||||
echo "SCHREIBE ServiceMap\r\n";
|
||||
$writer->writeServiceCache();
|
||||
|
||||
echo "SCHREIBE JavascriptMap\r\n";
|
||||
$writer->writeJavascriptCache();
|
||||
|
||||
echo "ERZEUGE Table Schemas\r\n";
|
||||
$schemaCollection = $installer->getTableSchemas();
|
||||
$tableSchemaCreator->ensureSchemas($schemaCollection);
|
||||
|
||||
echo "ENDE Installer\r\n";
|
||||
//
|
||||
} catch (Exception $e) {
|
||||
echo "FEHLER " . $e->getMessage() . "\r\n";
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
$intern = true;
|
||||
if(!empty($argv[1]) && strtolower($argv[1]) === 'changeversion'){
|
||||
$allowChangeVersion = true;
|
||||
}
|
||||
|
||||
include __DIR__.'/www/update.php';
|
||||
@@ -1,812 +0,0 @@
|
||||
<?php
|
||||
//include("wawision.inc.php");
|
||||
|
||||
// Nur einfache Fehler melden
|
||||
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
include_once("conf/main.conf.php");
|
||||
include_once("phpwf/plugins/class.mysql.php");
|
||||
include_once("www/lib/class.erpapi.php");
|
||||
|
||||
class app_t {
|
||||
var $DB;
|
||||
var $user;
|
||||
var $Conf;
|
||||
}
|
||||
|
||||
$app = new app_t();
|
||||
|
||||
$DEBUG = 0;
|
||||
|
||||
$app->Conf = new Config();
|
||||
$app->DB = new DB($app->Conf->WFdbhost,$app->Conf->WFdbname,$app->Conf->WFdbuser,$app->Conf->WFdbpass,null,$app->Conf->WFdbport);
|
||||
$erp = new erpAPI($app);
|
||||
|
||||
$WAWISION['host'] = $app->Conf->updateHost ?? 'removed.upgrade.host';
|
||||
$WAWISION['port']="443";
|
||||
|
||||
$myUpd = new UpgradeClient($WAWISION);
|
||||
|
||||
|
||||
echo "STARTE UPDATE\n";
|
||||
echo "Im folgenden stehen die Dateien die geaendert wurden.\n
|
||||
Erscheinen keine Dateien sind Sie auf der neusten Version.\n";
|
||||
|
||||
$myUpd->Connect();
|
||||
//$myUpd->CheckCRT();
|
||||
$myUpd->CheckUpdate();
|
||||
$myUpd->CheckUpdateCustom();
|
||||
$myUpd->CheckUpdateModules();
|
||||
|
||||
echo "ENDE UPDATE\n";
|
||||
|
||||
//echo "STARTE DB UPGRADE\n";
|
||||
//$erp->UpgradeDatabase();
|
||||
//echo "ENDE DB UPGRADE\n";
|
||||
|
||||
//include("version.php");
|
||||
//echo "\r\nRevision: $version_revision\r\n";
|
||||
|
||||
|
||||
//$myUpd->Request();
|
||||
|
||||
|
||||
|
||||
//echo
|
||||
|
||||
|
||||
|
||||
class UpgradeClient
|
||||
{
|
||||
var $localmd5sums;
|
||||
|
||||
function __construct($conf)
|
||||
{
|
||||
$this->conf = $conf;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Connect()
|
||||
{
|
||||
// check connection then stop
|
||||
|
||||
}
|
||||
|
||||
|
||||
function CheckCRT()
|
||||
{
|
||||
$cert = shell_exec("openssl s_client -connect {$this->conf['host']}:{$this->conf['port']} < /dev/null 2>/dev/null | openssl x509 -in /dev/stdin");
|
||||
if($cert==$this->conf['cert']."\n") return 1;
|
||||
else {
|
||||
echo "wrong\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CheckUpdate()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5list",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Updates: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
|
||||
$file = $single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$file;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update <- $file\n";
|
||||
$result = $this->Request("getfile",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfile",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function CheckUpdateModules()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5listmodules",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Modules: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
|
||||
$file = $single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$file;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update (M) <- $file\n";
|
||||
$result = $this->Request("getfilemodules",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update (M) ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei (M) <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis (M) <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfilemodules",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei (M) ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CheckUpdateCustom()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5listcustom",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Custom: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
|
||||
$file = $single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$file;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update (C) <- $file\n";
|
||||
$result = $this->Request("getfilecustom",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update (C) ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei (C) <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis (C) <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfilecustom",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei (C) ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function DownloadUpdate()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CheckDownloadedUpdate()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function ExecuteUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Request($command,$parameter)
|
||||
{
|
||||
global $erp;
|
||||
$auth['serial']=trim($erp->Firmendaten("lizenz"));//$this->conf['serial'];
|
||||
$auth['authkey']=trim($erp->Firmendaten("schluessel"));//$this->conf['authkey'];
|
||||
|
||||
$auth = base64_encode(json_encode($auth));
|
||||
$parameter = base64_encode(json_encode($parameter));
|
||||
|
||||
$client = new HttpClient($this->conf['host'],$this->conf['port']);
|
||||
$client->post('/upgradesystem.php', array( "authjson" => $auth, "parameterjson"=>$parameter,"command"=>"$command" ));
|
||||
$pageContents = $client->getContent();
|
||||
return $pageContents;
|
||||
}
|
||||
|
||||
function dir_rekursiv($verzeichnis)
|
||||
{
|
||||
$handle = opendir($verzeichnis);
|
||||
|
||||
while ($datei = readdir($handle))
|
||||
{
|
||||
if ($datei != "." && $datei != "..")
|
||||
{
|
||||
if (is_dir($verzeichnis.$datei)) // Wenn Verzeichniseintrag ein Verzeichnis ist
|
||||
{
|
||||
// Erneuter Funktionsaufruf, um das aktuelle Verzeichnis auszulesen
|
||||
$this->dir_rekursiv($verzeichnis.$datei.'/');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wenn Verzeichnis-Eintrag eine Datei ist, diese ausgeben
|
||||
$this->localmd5sums[$verzeichnis.$datei] = md5_file($verzeichnis.$datei);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
|
||||
Manual: http://scripts.incutio.com/httpclient/
|
||||
*/
|
||||
|
||||
class HttpClient {
|
||||
// Request vars
|
||||
var $host;
|
||||
var $port;
|
||||
var $path;
|
||||
var $method;
|
||||
var $postdata = '';
|
||||
var $cookies = array();
|
||||
var $referer;
|
||||
var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
|
||||
var $accept_encoding = 'gzip';
|
||||
var $accept_language = 'en-us';
|
||||
var $user_agent = 'Incutio HttpClient v0.9';
|
||||
// Options
|
||||
var $timeout = 20;
|
||||
var $use_gzip = true;
|
||||
var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request
|
||||
// Note: This currently ignores the cookie path (and time) completely. Time is not important,
|
||||
// but path could possibly lead to security problems.
|
||||
var $persist_referers = true; // For each request, sends path of last request as referer
|
||||
var $debug = false;
|
||||
var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
|
||||
var $max_redirects = 5;
|
||||
var $headers_only = false; // If true, stops receiving once headers have been read.
|
||||
// Basic authorization variables
|
||||
var $username;
|
||||
var $password;
|
||||
// Response vars
|
||||
var $status;
|
||||
var $headers = array();
|
||||
var $content = '';
|
||||
var $errormsg;
|
||||
// Tracker variables
|
||||
var $redirect_count = 0;
|
||||
var $cookie_host = '';
|
||||
function __construct($host, $port=80) {
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
}
|
||||
function get($path, $data = false) {
|
||||
$this->path = $path;
|
||||
$this->method = 'GET';
|
||||
if ($data) {
|
||||
$this->path .= '?'.$this->buildQueryString($data);
|
||||
}
|
||||
return $this->doRequest();
|
||||
}
|
||||
function post($path, $data) {
|
||||
$this->path = $path;
|
||||
$this->method = 'POST';
|
||||
$this->postdata = $this->buildQueryString($data);
|
||||
return $this->doRequest();
|
||||
}
|
||||
function buildQueryString($data) {
|
||||
$querystring = '';
|
||||
if (is_array($data)) {
|
||||
// Change data in to postable data
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $val2) {
|
||||
$querystring .= urlencode($key).'='.urlencode($val2).'&';
|
||||
}
|
||||
} else {
|
||||
$querystring .= urlencode($key).'='.urlencode($val).'&';
|
||||
}
|
||||
}
|
||||
$querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
|
||||
} else {
|
||||
$querystring = $data;
|
||||
}
|
||||
return $querystring;
|
||||
}
|
||||
function doRequest() {
|
||||
// Performs the actual HTTP request, returning true or false depending on outcome
|
||||
|
||||
if(!fsockopen("ssl://".$this->host, $this->port, $errno, $errstr, $this->timeout) && $this->port==443)
|
||||
{
|
||||
$this->port=80;
|
||||
}
|
||||
|
||||
if($this->port==443)
|
||||
$url = "ssl://".$this->host;
|
||||
else
|
||||
$url = $this->host;
|
||||
|
||||
if (!$fp = @fsockopen($url, $this->port, $errno, $errstr, $this->timeout)) {
|
||||
// Set error message
|
||||
switch($errno) {
|
||||
case -3:
|
||||
$this->errormsg = 'Socket creation failed (-3)';
|
||||
case -4:
|
||||
$this->errormsg = 'DNS lookup failure (-4)';
|
||||
case -5:
|
||||
$this->errormsg = 'Connection refused or timed out (-5)';
|
||||
default:
|
||||
$this->errormsg = 'Connection failed ('.$errno.')';
|
||||
$this->errormsg .= ' '.$errstr;
|
||||
$this->debug($this->errormsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
stream_set_timeout($fp, $this->timeout);
|
||||
$request = $this->buildRequest();
|
||||
$this->debug('Request', $request);
|
||||
fwrite($fp, $request);
|
||||
// Reset all the variables that should not persist between requests
|
||||
$this->headers = array();
|
||||
$this->content = '';
|
||||
$this->errormsg = '';
|
||||
// Set a couple of flags
|
||||
$inHeaders = true;
|
||||
$atStart = true;
|
||||
// Now start reading back the response
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp, 4096);
|
||||
if ($atStart) {
|
||||
// Deal with first line of returned data
|
||||
$atStart = false;
|
||||
if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
|
||||
$this->errormsg = "Status code line invalid: ".htmlentities($line);
|
||||
$this->debug($this->errormsg);
|
||||
//return false;
|
||||
}
|
||||
$http_version = $m[1]; // not used
|
||||
$this->status = $m[2];
|
||||
$status_string = $m[3]; // not used
|
||||
$this->debug(trim($line));
|
||||
continue;
|
||||
}
|
||||
if ($inHeaders) {
|
||||
if (trim($line) == '') {
|
||||
$inHeaders = false;
|
||||
$this->debug('Received Headers', $this->headers);
|
||||
if ($this->headers_only) {
|
||||
break; // Skip the rest of the input
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
|
||||
// Skip to the next header
|
||||
continue;
|
||||
}
|
||||
$key = strtolower(trim($m[1]));
|
||||
$val = trim($m[2]);
|
||||
// Deal with the possibility of multiple headers of same name
|
||||
if (isset($this->headers[$key])) {
|
||||
if (is_array($this->headers[$key])) {
|
||||
$this->headers[$key][] = $val;
|
||||
} else {
|
||||
$this->headers[$key] = array($this->headers[$key], $val);
|
||||
}
|
||||
} else {
|
||||
$this->headers[$key] = $val;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// We're not in the headers, so append the line to the contents
|
||||
$this->content .= $line;
|
||||
}
|
||||
fclose($fp);
|
||||
// If data is compressed, uncompress it
|
||||
if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
|
||||
$this->debug('Content is gzip encoded, unzipping it');
|
||||
$this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
|
||||
$this->content = gzinflate($this->content);
|
||||
}
|
||||
// If $persist_cookies, deal with any cookies
|
||||
if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
|
||||
$cookies = $this->headers['set-cookie'];
|
||||
if (!is_array($cookies)) {
|
||||
$cookies = array($cookies);
|
||||
}
|
||||
foreach ($cookies as $cookie) {
|
||||
if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
|
||||
$this->cookies[$m[1]] = $m[2];
|
||||
}
|
||||
}
|
||||
// Record domain of cookies for security reasons
|
||||
$this->cookie_host = $this->host;
|
||||
}
|
||||
// If $persist_referers, set the referer ready for the next request
|
||||
if ($this->persist_referers) {
|
||||
$this->debug('Persisting referer: '.$this->getRequestURL());
|
||||
$this->referer = $this->getRequestURL();
|
||||
}
|
||||
// Finally, if handle_redirects and a redirect is sent, do that
|
||||
if ($this->handle_redirects) {
|
||||
if (++$this->redirect_count >= $this->max_redirects) {
|
||||
$this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
|
||||
$this->debug($this->errormsg);
|
||||
$this->redirect_count = 0;
|
||||
return false;
|
||||
}
|
||||
$location = isset($this->headers['location']) ? $this->headers['location'] : '';
|
||||
$uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
|
||||
if ($location || $uri) {
|
||||
$url = parse_url($location.$uri);
|
||||
// This will FAIL if redirect is to a different site
|
||||
return $this->get($url['path']);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function buildRequest() {
|
||||
$headers = array();
|
||||
$headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
|
||||
$headers[] = "Host: {$this->host}";
|
||||
$headers[] = "User-Agent: {$this->user_agent}";
|
||||
$headers[] = "Accept: {$this->accept}";
|
||||
if ($this->use_gzip) {
|
||||
$headers[] = "Accept-encoding: {$this->accept_encoding}";
|
||||
}
|
||||
$headers[] = "Accept-language: {$this->accept_language}";
|
||||
if ($this->referer) {
|
||||
$headers[] = "Referer: {$this->referer}";
|
||||
}
|
||||
// Cookies
|
||||
if ($this->cookies) {
|
||||
$cookie = 'Cookie: ';
|
||||
foreach ($this->cookies as $key => $value) {
|
||||
$cookie .= "$key=$value; ";
|
||||
}
|
||||
$headers[] = $cookie;
|
||||
}
|
||||
// Basic authentication
|
||||
if ($this->username && $this->password) {
|
||||
$headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
|
||||
}
|
||||
// If this is a POST, set the content type and length
|
||||
if ($this->postdata) {
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
||||
$headers[] = 'Content-Length: '.strlen($this->postdata);
|
||||
}
|
||||
$request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
|
||||
return $request;
|
||||
}
|
||||
function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
function getContent() {
|
||||
return $this->content;
|
||||
}
|
||||
function getHeaders() {
|
||||
return $this->headers;
|
||||
}
|
||||
function getHeader($header) {
|
||||
$header = strtolower($header);
|
||||
if (isset($this->headers[$header])) {
|
||||
return $this->headers[$header];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function getError() {
|
||||
return $this->errormsg;
|
||||
}
|
||||
function getCookies() {
|
||||
return $this->cookies;
|
||||
}
|
||||
function getRequestURL() {
|
||||
$url = 'http://'.$this->host;
|
||||
if ($this->port != 80) {
|
||||
$url .= ':'.$this->port;
|
||||
}
|
||||
$url .= $this->path;
|
||||
return $url;
|
||||
}
|
||||
// Setter methods
|
||||
function setUserAgent($string) {
|
||||
$this->user_agent = $string;
|
||||
}
|
||||
function setAuthorization($username, $password) {
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
function setCookies($array) {
|
||||
$this->cookies = $array;
|
||||
}
|
||||
// Option setting methods
|
||||
function useGzip($boolean) {
|
||||
$this->use_gzip = $boolean;
|
||||
}
|
||||
function setPersistCookies($boolean) {
|
||||
$this->persist_cookies = $boolean;
|
||||
}
|
||||
function setPersistReferers($boolean) {
|
||||
$this->persist_referers = $boolean;
|
||||
}
|
||||
function setHandleRedirects($boolean) {
|
||||
$this->handle_redirects = $boolean;
|
||||
}
|
||||
function setMaxRedirects($num) {
|
||||
$this->max_redirects = $num;
|
||||
}
|
||||
function setHeadersOnly($boolean) {
|
||||
$this->headers_only = $boolean;
|
||||
}
|
||||
function setDebug($boolean) {
|
||||
$this->debug = $boolean;
|
||||
}
|
||||
// "Quick" static methods
|
||||
function quickGet($url) {
|
||||
$bits = parse_url($url);
|
||||
$host = $bits['host'];
|
||||
$port = isset($bits['port']) ? $bits['port'] : 80;
|
||||
$path = isset($bits['path']) ? $bits['path'] : '/';
|
||||
if (isset($bits['query'])) {
|
||||
$path .= '?'.$bits['query'];
|
||||
}
|
||||
$client = new HttpClient($host, $port);
|
||||
if (!$client->get($path)) {
|
||||
return false;
|
||||
} else {
|
||||
return $client->getContent();
|
||||
}
|
||||
}
|
||||
function quickPost($url, $data) {
|
||||
$bits = parse_url($url);
|
||||
$host = $bits['host'];
|
||||
$port = isset($bits['port']) ? $bits['port'] : 80;
|
||||
$path = isset($bits['path']) ? $bits['path'] : '/';
|
||||
$client = new HttpClient($host, $port);
|
||||
if (!$client->post($path, $data)) {
|
||||
return false;
|
||||
} else {
|
||||
return $client->getContent();
|
||||
}
|
||||
}
|
||||
function debug($msg, $object = false) {
|
||||
if ($this->debug) {
|
||||
print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
|
||||
if ($object) {
|
||||
ob_start();
|
||||
print_r($object);
|
||||
$content = htmlentities(ob_get_contents());
|
||||
ob_end_clean();
|
||||
print '<pre>'.$content.'</pre>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,783 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/xentral_autoloader.php';
|
||||
if (class_exists(Config::class)){
|
||||
$config = new Config();
|
||||
$updateHost = $config->updateHost ?: 'removed.upgrade.host';
|
||||
}else{
|
||||
$updateHost = 'removed.upgrade.host';
|
||||
}
|
||||
|
||||
$WAWISION['host']=$updateHost;
|
||||
$WAWISION['port']="443";
|
||||
|
||||
$myUpd = new UpgradeClient($WAWISION,$this->app);
|
||||
|
||||
|
||||
echo "STARTE UPDATE\n";
|
||||
echo "Im folgenden stehen die Dateien die geaendert wurden.\n
|
||||
Erscheinen keine Dateien sind Sie auf der neusten Version.\n";
|
||||
|
||||
$myUpd->Connect();
|
||||
//$myUpd->CheckCRT();
|
||||
$myUpd->CheckUpdate();
|
||||
$myUpd->CheckUpdateCustom();
|
||||
$myUpd->CheckUpdateModules();
|
||||
|
||||
|
||||
class UpgradeClient
|
||||
{
|
||||
var $localmd5sums;
|
||||
|
||||
function __construct($conf,&$app)
|
||||
{
|
||||
$this->conf = $conf;
|
||||
$this->app=&$app;
|
||||
}
|
||||
|
||||
|
||||
function Connect()
|
||||
{
|
||||
// check connection then stop
|
||||
|
||||
}
|
||||
|
||||
|
||||
function CheckCRT()
|
||||
{
|
||||
|
||||
$cert = shell_exec("openssl s_client -connect update.embedded-projects.net:443 < /dev/null 2>/dev/null | openssl x509 -in /dev/stdin");
|
||||
if($cert==$this->conf['cert']."\n") return 1;
|
||||
else {
|
||||
echo "wrong\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CheckUpdate()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5list",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Updates: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
|
||||
$filename = $single_row[0];
|
||||
$file = __DIR__."/".$single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$filename;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update <- $file\n";
|
||||
$result = $this->Request("getfile",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfile",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function CheckUpdateModules()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5listmodules",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Modules: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
$filename = $single_row[0];
|
||||
$file = dirname(__FILE__)."/".$single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$filename;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update (M) <- $file\n";
|
||||
$result = $this->Request("getfilemodules",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update (M) ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei (M) <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis (M) <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfilemodules",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei (M) ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CheckUpdateCustom()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5listcustom",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Custom: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
$filename = $single_row[0];
|
||||
$file = __DIR__."/".$single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$filename;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update (C) <- $file\n";
|
||||
$result = $this->Request("getfilecustom",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update (C) ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei (C) <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis (C) <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfilecustom",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei (C) ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function DownloadUpdate()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CheckDownloadedUpdate()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function ExecuteUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Request($command,$parameter)
|
||||
{
|
||||
global $erp;
|
||||
$auth['serial']=$this->app->erp->Firmendaten("lizenz");//$this->conf['serial'];
|
||||
$auth['authkey']=$this->app->erp->Firmendaten("schluessel");//$this->conf['authkey'];
|
||||
|
||||
$auth = base64_encode(json_encode($auth));
|
||||
$parameter = base64_encode(json_encode($parameter));
|
||||
$client = new HttpClientUpgrade($this->conf['host'],$this->conf['port']);
|
||||
$client->post('/upgradesystem.php', array( "authjson" => $auth, "parameterjson"=>$parameter,"command"=>"$command" ));
|
||||
$pageContents = $client->getContent();
|
||||
return $pageContents;
|
||||
}
|
||||
|
||||
function dir_rekursiv($verzeichnis)
|
||||
{
|
||||
$handle = opendir($verzeichnis);
|
||||
|
||||
while ($datei = readdir($handle))
|
||||
{
|
||||
if ($datei != "." && $datei != "..")
|
||||
{
|
||||
if (is_dir($verzeichnis.$datei)) // Wenn Verzeichniseintrag ein Verzeichnis ist
|
||||
{
|
||||
// Erneuter Funktionsaufruf, um das aktuelle Verzeichnis auszulesen
|
||||
$this->dir_rekursiv($verzeichnis.$datei.'/');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wenn Verzeichnis-Eintrag eine Datei ist, diese ausgeben
|
||||
$this->localmd5sums[$verzeichnis.$datei] = md5_file($verzeichnis.$datei);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
|
||||
Manual: http://scripts.incutio.com/httpclient/
|
||||
*/
|
||||
|
||||
class HttpClientUpgrade {
|
||||
// Request vars
|
||||
var $host;
|
||||
var $port;
|
||||
var $path;
|
||||
var $method;
|
||||
var $postdata = '';
|
||||
var $cookies = array();
|
||||
var $referer;
|
||||
var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
|
||||
var $accept_encoding = 'gzip';
|
||||
var $accept_language = 'en-us';
|
||||
var $user_agent = 'Incutio HttpClientUpgrade v0.9';
|
||||
// Options
|
||||
var $timeout = 20;
|
||||
var $use_gzip = true;
|
||||
var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request
|
||||
// Note: This currently ignores the cookie path (and time) completely. Time is not important,
|
||||
// but path could possibly lead to security problems.
|
||||
var $persist_referers = true; // For each request, sends path of last request as referer
|
||||
var $debug = false;
|
||||
var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
|
||||
var $max_redirects = 5;
|
||||
var $headers_only = false; // If true, stops receiving once headers have been read.
|
||||
// Basic authorization variables
|
||||
var $username;
|
||||
var $password;
|
||||
// Response vars
|
||||
var $status;
|
||||
var $headers = array();
|
||||
var $content = '';
|
||||
var $errormsg;
|
||||
// Tracker variables
|
||||
var $redirect_count = 0;
|
||||
var $cookie_host = '';
|
||||
function __construct($host, $port=80) {
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
}
|
||||
function get($path, $data = false) {
|
||||
$this->path = $path;
|
||||
$this->method = 'GET';
|
||||
if ($data) {
|
||||
$this->path .= '?'.$this->buildQueryString($data);
|
||||
}
|
||||
return $this->doRequest();
|
||||
}
|
||||
function post($path, $data) {
|
||||
$this->path = $path;
|
||||
$this->method = 'POST';
|
||||
$this->postdata = $this->buildQueryString($data);
|
||||
return $this->doRequest();
|
||||
}
|
||||
function buildQueryString($data) {
|
||||
$querystring = '';
|
||||
if (is_array($data)) {
|
||||
// Change data in to postable data
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $val2) {
|
||||
$querystring .= urlencode($key).'='.urlencode($val2).'&';
|
||||
}
|
||||
} else {
|
||||
$querystring .= urlencode($key).'='.urlencode($val).'&';
|
||||
}
|
||||
}
|
||||
$querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
|
||||
} else {
|
||||
$querystring = $data;
|
||||
}
|
||||
return $querystring;
|
||||
}
|
||||
function doRequest() {
|
||||
// Performs the actual HTTP request, returning true or false depending on outcome
|
||||
// check if port is available
|
||||
if(!fsockopen("ssl://".$this->host, $this->port, $errno, $errstr, $this->timeout) && $this->port==443)
|
||||
{
|
||||
$this->port=80;
|
||||
}
|
||||
|
||||
if($this->port==443)
|
||||
$url = "ssl://".$this->host;
|
||||
else
|
||||
$url = $this->host;
|
||||
|
||||
if (!$fp = @fsockopen($url, $this->port, $errno, $errstr, $this->timeout)) {
|
||||
// Set error message
|
||||
switch($errno) {
|
||||
case -3:
|
||||
$this->errormsg = 'Socket creation failed (-3)';
|
||||
case -4:
|
||||
$this->errormsg = 'DNS lookup failure (-4)';
|
||||
case -5:
|
||||
$this->errormsg = 'Connection refused or timed out (-5)';
|
||||
default:
|
||||
$this->errormsg = 'Connection failed ('.$errno.')';
|
||||
$this->errormsg .= ' '.$errstr;
|
||||
$this->debug($this->errormsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
stream_set_timeout($fp, $this->timeout);
|
||||
$request = $this->buildRequest();
|
||||
$this->debug('Request', $request);
|
||||
fwrite($fp, $request);
|
||||
// Reset all the variables that should not persist between requests
|
||||
$this->headers = array();
|
||||
$this->content = '';
|
||||
$this->errormsg = '';
|
||||
// Set a couple of flags
|
||||
$inHeaders = true;
|
||||
$atStart = true;
|
||||
// Now start reading back the response
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp, 4096);
|
||||
if ($atStart) {
|
||||
// Deal with first line of returned data
|
||||
$atStart = false;
|
||||
if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
|
||||
$this->errormsg = "Status code line invalid: ".htmlentities($line);
|
||||
$this->debug($this->errormsg);
|
||||
//return false;
|
||||
}
|
||||
$http_version = $m[1]; // not used
|
||||
$this->status = $m[2];
|
||||
$status_string = $m[3]; // not used
|
||||
$this->debug(trim($line));
|
||||
continue;
|
||||
}
|
||||
if ($inHeaders) {
|
||||
if (trim($line) == '') {
|
||||
$inHeaders = false;
|
||||
$this->debug('Received Headers', $this->headers);
|
||||
if ($this->headers_only) {
|
||||
break; // Skip the rest of the input
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
|
||||
// Skip to the next header
|
||||
continue;
|
||||
}
|
||||
$key = strtolower(trim($m[1]));
|
||||
$val = trim($m[2]);
|
||||
// Deal with the possibility of multiple headers of same name
|
||||
if (isset($this->headers[$key])) {
|
||||
if (is_array($this->headers[$key])) {
|
||||
$this->headers[$key][] = $val;
|
||||
} else {
|
||||
$this->headers[$key] = array($this->headers[$key], $val);
|
||||
}
|
||||
} else {
|
||||
$this->headers[$key] = $val;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// We're not in the headers, so append the line to the contents
|
||||
$this->content .= $line;
|
||||
}
|
||||
fclose($fp);
|
||||
// If data is compressed, uncompress it
|
||||
if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
|
||||
$this->debug('Content is gzip encoded, unzipping it');
|
||||
$this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
|
||||
$this->content = gzinflate($this->content);
|
||||
}
|
||||
// If $persist_cookies, deal with any cookies
|
||||
if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
|
||||
$cookies = $this->headers['set-cookie'];
|
||||
if (!is_array($cookies)) {
|
||||
$cookies = array($cookies);
|
||||
}
|
||||
foreach ($cookies as $cookie) {
|
||||
if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
|
||||
$this->cookies[$m[1]] = $m[2];
|
||||
}
|
||||
}
|
||||
// Record domain of cookies for security reasons
|
||||
$this->cookie_host = $this->host;
|
||||
}
|
||||
// If $persist_referers, set the referer ready for the next request
|
||||
if ($this->persist_referers) {
|
||||
$this->debug('Persisting referer: '.$this->getRequestURL());
|
||||
$this->referer = $this->getRequestURL();
|
||||
}
|
||||
// Finally, if handle_redirects and a redirect is sent, do that
|
||||
if ($this->handle_redirects) {
|
||||
if (++$this->redirect_count >= $this->max_redirects) {
|
||||
$this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
|
||||
$this->debug($this->errormsg);
|
||||
$this->redirect_count = 0;
|
||||
return false;
|
||||
}
|
||||
$location = isset($this->headers['location']) ? $this->headers['location'] : '';
|
||||
$uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
|
||||
if ($location || $uri) {
|
||||
$url = parse_url($location.$uri);
|
||||
// This will FAIL if redirect is to a different site
|
||||
return $this->get($url['path']);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function buildRequest() {
|
||||
$headers = array();
|
||||
$headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
|
||||
$headers[] = "Host: {$this->host}";
|
||||
$headers[] = "User-Agent: {$this->user_agent}";
|
||||
$headers[] = "Accept: {$this->accept}";
|
||||
if ($this->use_gzip) {
|
||||
$headers[] = "Accept-encoding: {$this->accept_encoding}";
|
||||
}
|
||||
$headers[] = "Accept-language: {$this->accept_language}";
|
||||
if ($this->referer) {
|
||||
$headers[] = "Referer: {$this->referer}";
|
||||
}
|
||||
// Cookies
|
||||
if ($this->cookies) {
|
||||
$cookie = 'Cookie: ';
|
||||
foreach ($this->cookies as $key => $value) {
|
||||
$cookie .= "$key=$value; ";
|
||||
}
|
||||
$headers[] = $cookie;
|
||||
}
|
||||
// Basic authentication
|
||||
if ($this->username && $this->password) {
|
||||
$headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
|
||||
}
|
||||
// If this is a POST, set the content type and length
|
||||
if ($this->postdata) {
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
||||
$headers[] = 'Content-Length: '.strlen($this->postdata);
|
||||
}
|
||||
$request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
|
||||
return $request;
|
||||
}
|
||||
function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
function getContent() {
|
||||
return $this->content;
|
||||
}
|
||||
function getHeaders() {
|
||||
return $this->headers;
|
||||
}
|
||||
function getHeader($header) {
|
||||
$header = strtolower($header);
|
||||
if (isset($this->headers[$header])) {
|
||||
return $this->headers[$header];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function getError() {
|
||||
return $this->errormsg;
|
||||
}
|
||||
function getCookies() {
|
||||
return $this->cookies;
|
||||
}
|
||||
function getRequestURL() {
|
||||
$url = 'http://'.$this->host;
|
||||
if ($this->port != 80) {
|
||||
$url .= ':'.$this->port;
|
||||
}
|
||||
$url .= $this->path;
|
||||
return $url;
|
||||
}
|
||||
// Setter methods
|
||||
function setUserAgent($string) {
|
||||
$this->user_agent = $string;
|
||||
}
|
||||
function setAuthorization($username, $password) {
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
function setCookies($array) {
|
||||
$this->cookies = $array;
|
||||
}
|
||||
// Option setting methods
|
||||
function useGzip($boolean) {
|
||||
$this->use_gzip = $boolean;
|
||||
}
|
||||
function setPersistCookies($boolean) {
|
||||
$this->persist_cookies = $boolean;
|
||||
}
|
||||
function setPersistReferers($boolean) {
|
||||
$this->persist_referers = $boolean;
|
||||
}
|
||||
function setHandleRedirects($boolean) {
|
||||
$this->handle_redirects = $boolean;
|
||||
}
|
||||
function setMaxRedirects($num) {
|
||||
$this->max_redirects = $num;
|
||||
}
|
||||
function setHeadersOnly($boolean) {
|
||||
$this->headers_only = $boolean;
|
||||
}
|
||||
function setDebug($boolean) {
|
||||
$this->debug = $boolean;
|
||||
}
|
||||
// "Quick" static methods
|
||||
function quickGet($url) {
|
||||
$bits = parse_url($url);
|
||||
$host = $bits['host'];
|
||||
$port = isset($bits['port']) ? $bits['port'] : 80;
|
||||
$path = isset($bits['path']) ? $bits['path'] : '/';
|
||||
if (isset($bits['query'])) {
|
||||
$path .= '?'.$bits['query'];
|
||||
}
|
||||
$client = new HttpClientUpgrade($host, $port);
|
||||
if (!$client->get($path)) {
|
||||
return false;
|
||||
} else {
|
||||
return $client->getContent();
|
||||
}
|
||||
}
|
||||
function quickPost($url, $data) {
|
||||
$bits = parse_url($url);
|
||||
$host = $bits['host'];
|
||||
$port = isset($bits['port']) ? $bits['port'] : 80;
|
||||
$path = isset($bits['path']) ? $bits['path'] : '/';
|
||||
$client = new HttpClientUpgrade($host, $port);
|
||||
if (!$client->post($path, $data)) {
|
||||
return false;
|
||||
} else {
|
||||
return $client->getContent();
|
||||
}
|
||||
}
|
||||
function debug($msg, $object = false) {
|
||||
if ($this->debug) {
|
||||
print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClientUpgrade Debug:</strong> '.$msg;
|
||||
if ($object) {
|
||||
ob_start();
|
||||
print_r($object);
|
||||
$content = htmlentities(ob_get_contents());
|
||||
ob_end_clean();
|
||||
print '<pre>'.$content.'</pre>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,928 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/xentral_autoloader.php';
|
||||
if (class_exists(Config::class)){
|
||||
$config = new Config();
|
||||
$updateHost = $config->updateHost ?: 'removed.upgrade.host';
|
||||
}else{
|
||||
$updateHost = 'removed.upgrade.host';
|
||||
}
|
||||
define('XENTRAL_UPDATE_HOST', $updateHost);
|
||||
|
||||
$WAWISION['host']=XENTRAL_UPDATE_HOST;
|
||||
$WAWISION['port']="443";
|
||||
|
||||
$myUpd = new UpgradeClient($WAWISION,$this->app);
|
||||
|
||||
|
||||
$myUpd->Connect();
|
||||
if(isset($sendStats)) {
|
||||
}
|
||||
elseif(isset($buy)) {
|
||||
}
|
||||
elseif(isset($getBuyList)) {
|
||||
}
|
||||
elseif(isset($getBuyInfo)) {
|
||||
}
|
||||
elseif(isset($setBeta)) {
|
||||
}
|
||||
elseif(isset($setDevelopmentVersion)) {
|
||||
}
|
||||
elseif(isset($buyFromDemo)) {
|
||||
}
|
||||
elseif(isset($resetXentral)) {
|
||||
}
|
||||
elseif(isset($fiskalyCommand)) {
|
||||
}
|
||||
elseif(isset($createFiskalyClientFromClientId) && isset($tseId) && isset($organizationId)) {
|
||||
}
|
||||
elseif(isset($sma) && isset($sendSmaErrorMessage)) {
|
||||
}
|
||||
else{
|
||||
}
|
||||
if(!class_exists('Md5Dateien'))
|
||||
{
|
||||
class Md5Dateien
|
||||
{
|
||||
var $Dateien;
|
||||
function __construct($quellverzeichnis)
|
||||
{
|
||||
$this->getVerzeichnis($quellverzeichnis, '', 0, '');
|
||||
}
|
||||
|
||||
function getVerzeichnis($quellverzeichnis, $zielverzeichnis, $lvl, $relativ){
|
||||
//echo "Verzeichnis: ".$quellverzeichnis." ".$zielverzeichnis. "\r\n";
|
||||
|
||||
$quelllast = $quellverzeichnis;
|
||||
if($quellverzeichnis[strlen($quellverzeichnis) - 1] == '/')$quelllast = substr($quellverzeichnis, 0, strlen($quellverzeichnis) - 1);
|
||||
|
||||
$path_parts = pathinfo($quelllast);
|
||||
|
||||
$quelllast = $path_parts['basename'];
|
||||
|
||||
if(file_exists($quellverzeichnis))
|
||||
{
|
||||
if($quelllast != 'importer' || $lvl != 1){
|
||||
if ($handle = opendir($quellverzeichnis)) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
|
||||
if($entry != '.' && $entry != '..' && $entry != '.git' && $entry != '.svn' && $entry != 'main.conf.php' && $entry != 'user.inc.php' && $entry != 'user_db_version.php' && $entry != 'pygen')
|
||||
{
|
||||
if(is_dir($quellverzeichnis.'/'.$entry))
|
||||
{
|
||||
if(!($lvl == 1 && $entry == 'vorlagen' && strpos($quellverzeichnis,'www')))
|
||||
$this->getVerzeichnis($quellverzeichnis.(strrpos($quellverzeichnis,'/')!==strlen($quellverzeichnis)-1?'/':'').$entry,$zielverzeichnis .(strrpos($zielverzeichnis,'/')!==strlen($zielverzeichnis)-1?'/':'').$entry, $lvl + 1,$relativ.'/'.$entry);
|
||||
} else {
|
||||
if(!($lvl == 0 && ($entry == 'INSTALL' || $entry == 'LICENSE_LIST' || $entry == 'LICENSE' || $entry == 'README' || $entry == 'gitlog.txt')))
|
||||
{
|
||||
//$this->getFile($quellverzeichnis.(strrpos($quellverzeichnis,'/')!==strlen($quellverzeichnis)-1?'/':'').$entry,$zielverzeichnis .(strrpos($zielverzeichnis,'/')!==strlen($zielverzeichnis)-1?'/':'').$entry,$relativ.'/'.$entry);
|
||||
if(strtolower(substr($entry,-4)) == '.php')$this->Dateien[$relativ.'/'.$entry] = md5_file($quellverzeichnis.(strrpos($quellverzeichnis,'/')!==strlen($quellverzeichnis)-1?'/':'').$entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@closedir($handle);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UpgradeClient
|
||||
{
|
||||
var $localmd5sums;
|
||||
|
||||
/**
|
||||
* UpgradeClient constructor.
|
||||
*
|
||||
* @param Config $conf
|
||||
* @param ApplicationCore $app
|
||||
*/
|
||||
public function __construct($conf, $app)
|
||||
{
|
||||
$this->conf = $conf;
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
|
||||
function Connect()
|
||||
{
|
||||
// check connection then stop
|
||||
|
||||
}
|
||||
|
||||
|
||||
function CheckCRT()
|
||||
{
|
||||
$updateHost = XENTRAL_UPDATE_HOST;
|
||||
$cert = shell_exec("openssl s_client -connect {$updateHost}:443 < /dev/null 2>/dev/null | openssl x509 -in /dev/stdin");
|
||||
if($cert==$this->conf['cert']."\n") return 1;
|
||||
else {
|
||||
echo "wrong\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CheckUpdate()
|
||||
{
|
||||
//$this->dir_rekursiv("./");
|
||||
//$parameter['md5sums'] = $this->localmd5sums;
|
||||
//shell_exec('find ./ -exec md5sum "{}" \;');
|
||||
$lines = null;
|
||||
$funktions_ind = null;
|
||||
$dateien = new Md5Dateien(__DIR__.'/');
|
||||
if(!empty($dateien->Dateien) && is_array($dateien->Dateien)) {
|
||||
foreach($dateien->Dateien as $k => $v) {
|
||||
if(
|
||||
strtolower(substr($k,-4)) === '.php'
|
||||
&& strpos($k, '_custom') !== false
|
||||
&& strpos($k,'/vendor/') === false
|
||||
) {
|
||||
$datei = __DIR__.$k;
|
||||
if(!file_exists($datei)) {
|
||||
continue;
|
||||
}
|
||||
$fh = fopen($datei, 'r');
|
||||
if(!$fh) {
|
||||
continue;
|
||||
}
|
||||
$f_ind = -1;
|
||||
if(isset($lines)) {
|
||||
unset($lines);
|
||||
}
|
||||
$i = -1;
|
||||
while(($line = fgets($fh)) !== false) {
|
||||
$i++;
|
||||
$lines[$i] = $line;
|
||||
if(isset($funktions_ind) && isset($funktions_ind[$k])) {
|
||||
foreach($funktions_ind[$k] as $k2 => $v2) {
|
||||
if($v2 + 5 >= $i) {
|
||||
$funktions[$k][$k2][] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strpos($line, 'function') !== false) {
|
||||
$f_ind++;
|
||||
for($j = $i-5; $j <= $i; $j++) {
|
||||
if($j > -1) {
|
||||
$funktions[$k][$f_ind][] = $lines[$j];
|
||||
}
|
||||
}
|
||||
$funktions_ind[$k][$f_ind] = $i;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
}
|
||||
}
|
||||
}
|
||||
$parameter['version'] = @$this->conf['version'];
|
||||
if(isset($funktions)) {
|
||||
$parameter['funktionen'] = $funktions;
|
||||
$this->Request("versionen", $parameter);
|
||||
}
|
||||
|
||||
if (is_file(__DIR__ . '/marketing_labels.txt')) {
|
||||
$parameter['marketing_labels'] = explode(',', (string)@file_get_contents(__DIR__ . '/marketing_labels.txt'));
|
||||
}
|
||||
$result = $this->Request("md5list",$parameter);
|
||||
|
||||
if($result==="ERROR") {
|
||||
echo "Updates: ERROR FROM SERVER (Perhaps a wrong license?)\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
|
||||
$filename = $single_row[0];
|
||||
$file = __DIR__."/".$single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$filename;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
|
||||
if($file==="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update <- $file\n";
|
||||
$result = $this->Request("getfile",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfile",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function CheckUpdateModules()
|
||||
{
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request("md5listmodules",$parameter);
|
||||
|
||||
if($result=="ERROR") { echo "Modules: ERROR FROM SERVER (Perhaps a wrong license?)\n"; return;}
|
||||
|
||||
$rows = explode(";",$result);
|
||||
|
||||
if(count($rows)>0)
|
||||
{
|
||||
foreach($rows as $value)
|
||||
{
|
||||
unset($single_row);
|
||||
$single_row = explode(":",$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3)
|
||||
{
|
||||
$filename = $single_row[0];
|
||||
$file = dirname(__FILE__)."/".$single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$filename;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
if($file=="./upgradesystemclient.php")
|
||||
{
|
||||
|
||||
}
|
||||
else if(is_file($file))
|
||||
{
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum)
|
||||
{
|
||||
// wenn update dann UPD_
|
||||
echo "update (M) <- $file\n";
|
||||
$result = $this->Request("getfilemodules",$parameter);
|
||||
$output = (base64_decode($result));
|
||||
//$output = preg_replace('/[^(\x22-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."UPD", $output);
|
||||
/*
|
||||
$fp = fopen($file."UPD","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
// pruefsuemme neu berechnen wenn passt umbenennen und ins archiv
|
||||
echo md5_file($file."UPD");
|
||||
echo "-".$md5sum."\n";
|
||||
if(md5_file($file."UPD")==$md5sum)
|
||||
{
|
||||
echo "update (M) ok $file\n";
|
||||
rename($file."UPD",$file);
|
||||
}
|
||||
}
|
||||
} else if($file!="") {
|
||||
echo "datei (M) <- $file\n";
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis))
|
||||
{
|
||||
echo "verzeichnis (M) <- $verzeichnis\n";
|
||||
mkdir($verzeichnis,0777,true);
|
||||
}
|
||||
$result = $this->Request("getfilemodules",$parameter);
|
||||
$output = base64_decode($result);
|
||||
//$output = iconv("UTF-8","ISO-8859-1//IGNORE",$output);
|
||||
//$output = iconv("ISO-8859-1","UTF-8",$output);
|
||||
//$output = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $output);
|
||||
file_put_contents($file."NEW", $output);
|
||||
/*$fp = fopen($file."NEW","wb+");
|
||||
fwrite($fp,base64_decode($result));
|
||||
fclose($fp);
|
||||
*/
|
||||
if(md5_file($file."NEW")==$md5sum)
|
||||
{
|
||||
echo "datei (M) ok $file\n";
|
||||
rename($file."NEW",$file);
|
||||
} else {
|
||||
// echo "datei XX $file local: ".md5_file($file."NEW")." remote: ".$md5sum."\n";
|
||||
|
||||
}
|
||||
} else { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//pruefe, update, lege verzeichnis an, lege datei an, loesche datei????
|
||||
|
||||
|
||||
|
||||
// download all files with UPD_ prefix
|
||||
|
||||
|
||||
// get md5 liste von server
|
||||
|
||||
// pruefe ob alle dateien passen, wenn ja dann alle updaten am schluss
|
||||
|
||||
// wenn nein fehler abbrechen und ganzen prozess nochmal starten
|
||||
|
||||
//echo $md5sums;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function sendSetDevelopmentStatus($data)
|
||||
{
|
||||
$parameter['version'] = isset($this->conf['version']) ? $this->conf['version']: null;
|
||||
$parameter['data'] = $data;
|
||||
|
||||
return $this->Request('setdevelopmentversion', $parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function sendSetBetaStatus($data)
|
||||
{
|
||||
$parameter['version'] = isset($this->conf['version']) ? $this->conf['version']: null;
|
||||
$parameter['data'] = $data;
|
||||
|
||||
return $this->Request('setbeta', $parameter);
|
||||
}
|
||||
|
||||
|
||||
function CheckUpdateKey()
|
||||
{
|
||||
$parameter['SERVER_NAME'] = $_SERVER['SERVER_NAME'];
|
||||
if(!empty($_SERVER['HTTP_HOST']) && (empty($parameter['SERVER_NAME']) || $parameter['SERVER_NAME'] === '_')) {
|
||||
$parameter['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
$parameter['phpversion'] = (String)phpversion();
|
||||
$parameter['mysqlversion'] = $this->app->DB->GetVersion();
|
||||
$parameter['version']=@$this->conf['version'];
|
||||
$result = $this->Request('md5listcustom',$parameter);
|
||||
|
||||
if($result==='ERROR') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$rows = explode(';',$result);
|
||||
|
||||
$return = false;
|
||||
|
||||
if(count($rows) <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($rows as $value) {
|
||||
unset($single_row);
|
||||
$single_row = explode(':',$value);
|
||||
|
||||
if(count($single_row)>=2 && strlen($single_row[0])>3 && strlen($single_row[1])>3) {
|
||||
$filename = $single_row[0];
|
||||
$file = __DIR__.'/'.$single_row[0];
|
||||
$md5sum = $single_row[1];
|
||||
|
||||
$parameter['file']=$filename;
|
||||
$parameter['md5sum']=$md5sum;
|
||||
|
||||
$fileOk = $filename === './key.php';
|
||||
if(!$fileOk && strpos($md5sum, 'DEL') === false) {
|
||||
if($filename === './www/themes/new/templates/loginslider.tpl') {
|
||||
$fileOk = true;
|
||||
}
|
||||
elseif(strpos($filename ,'./www/themes/new/templates/') === 0
|
||||
&& (substr($filename,-4) === '.jpg' || substr($filename,-5) === '.jpeg')
|
||||
&& strpos($filename, '/', 28) === false) {
|
||||
$fileOk = true;
|
||||
}
|
||||
}
|
||||
if(!$fileOk) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(is_file($file)) {
|
||||
|
||||
// pruefe md5sum
|
||||
if(md5_file($file)!=$md5sum) {
|
||||
// wenn update dann UPD_
|
||||
$result = $this->Request('getfilecustom',$parameter);
|
||||
$output = (base64_decode($result));
|
||||
file_put_contents($file.'UPD', $output);
|
||||
|
||||
if(md5_file($file.'UPD')==$md5sum && $result) {
|
||||
$return = rename($file.'UPD',$file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$return = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// pruefe ob es verzeichnis gibt
|
||||
$verzeichnis = dirname($file);
|
||||
if(!is_dir($verzeichnis) && !mkdir($verzeichnis,0777,true) && !is_dir($verzeichnis)) {
|
||||
}
|
||||
$result = $this->Request('getfilecustom',$parameter);
|
||||
$output = base64_decode($result);
|
||||
file_put_contents($file.'NEW', $output);
|
||||
if(md5_file($file.'NEW')==$md5sum) {
|
||||
$return = rename($file.'NEW',$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function DownloadUpdate()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CheckDownloadedUpdate()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function ExecuteUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Request($command,$parameter)
|
||||
{
|
||||
global $erp;
|
||||
$auth['serial']=$this->app->erp->Firmendaten("lizenz");//$this->conf['serial'];
|
||||
$auth['authkey']=$this->app->erp->Firmendaten("schluessel");//$this->conf['authkey'];
|
||||
$auth['SERVER_NAME'] = (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] != '')?$_SERVER['SERVER_NAME']:(isset($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST']:'');
|
||||
$auth = base64_encode(json_encode($auth));
|
||||
$parameter = base64_encode(json_encode($parameter));
|
||||
$client = new HttpClientUpgrade($this->conf['host'],$this->conf['port']);
|
||||
$client->post('/upgradesystem.php', array( "authjson" => $auth, "parameterjson"=>$parameter,"command"=>"$command" ));
|
||||
$pageContents = $client->getContent();
|
||||
return $pageContents;
|
||||
}
|
||||
|
||||
function dir_rekursiv($verzeichnis)
|
||||
{
|
||||
$handle = opendir($verzeichnis);
|
||||
|
||||
while ($datei = readdir($handle))
|
||||
{
|
||||
if ($datei != "." && $datei != "..")
|
||||
{
|
||||
if (is_dir($verzeichnis.$datei)) // Wenn Verzeichniseintrag ein Verzeichnis ist
|
||||
{
|
||||
// Erneuter Funktionsaufruf, um das aktuelle Verzeichnis auszulesen
|
||||
$this->dir_rekursiv($verzeichnis.$datei.'/');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wenn Verzeichnis-Eintrag eine Datei ist, diese ausgeben
|
||||
$this->localmd5sums[$verzeichnis.$datei] = md5_file($verzeichnis.$datei);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
|
||||
Manual: http://scripts.incutio.com/httpclient/
|
||||
*/
|
||||
|
||||
class HttpClientUpgrade {
|
||||
// Request vars
|
||||
var $host;
|
||||
var $port;
|
||||
var $path;
|
||||
var $method;
|
||||
var $postdata = '';
|
||||
var $cookies = array();
|
||||
var $referer;
|
||||
var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
|
||||
var $accept_encoding = 'gzip';
|
||||
var $accept_language = 'en-us';
|
||||
var $user_agent = 'Incutio HttpClientUpgrade v0.9';
|
||||
// Options
|
||||
var $timeout = 20;
|
||||
var $use_gzip = true;
|
||||
var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request
|
||||
// Note: This currently ignores the cookie path (and time) completely. Time is not important,
|
||||
// but path could possibly lead to security problems.
|
||||
var $persist_referers = true; // For each request, sends path of last request as referer
|
||||
var $debug = false;
|
||||
var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
|
||||
var $max_redirects = 5;
|
||||
var $headers_only = false; // If true, stops receiving once headers have been read.
|
||||
// Basic authorization variables
|
||||
var $username;
|
||||
var $password;
|
||||
// Response vars
|
||||
var $status;
|
||||
var $headers = array();
|
||||
var $content = '';
|
||||
var $errormsg;
|
||||
// Tracker variables
|
||||
var $redirect_count = 0;
|
||||
var $cookie_host = '';
|
||||
function __construct($host, $port=80) {
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
}
|
||||
function get($path, $data = false) {
|
||||
$this->path = $path;
|
||||
$this->method = 'GET';
|
||||
if ($data) {
|
||||
$this->path .= '?'.$this->buildQueryString($data);
|
||||
}
|
||||
return $this->doRequest();
|
||||
}
|
||||
function post($path, $data) {
|
||||
$this->path = $path;
|
||||
$this->method = 'POST';
|
||||
$this->postdata = $this->buildQueryString($data);
|
||||
return $this->doRequest();
|
||||
}
|
||||
function buildQueryString($data) {
|
||||
$querystring = '';
|
||||
if (is_array($data)) {
|
||||
// Change data in to postable data
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $val2) {
|
||||
$querystring .= urlencode($key).'='.urlencode($val2).'&';
|
||||
}
|
||||
} else {
|
||||
$querystring .= urlencode($key).'='.urlencode($val).'&';
|
||||
}
|
||||
}
|
||||
$querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
|
||||
} else {
|
||||
$querystring = $data;
|
||||
}
|
||||
return $querystring;
|
||||
}
|
||||
function doRequest() {
|
||||
// Performs the actual HTTP request, returning true or false depending on outcome
|
||||
// check if port is available
|
||||
if(!fsockopen("ssl://".$this->host, $this->port, $errno, $errstr, $this->timeout) && $this->port==443)
|
||||
{
|
||||
$this->port=80;
|
||||
}
|
||||
|
||||
if($this->port==443)
|
||||
$url = "ssl://".$this->host;
|
||||
else
|
||||
$url = $this->host;
|
||||
|
||||
if (!$fp = @fsockopen($url, $this->port, $errno, $errstr, $this->timeout)) {
|
||||
// Set error message
|
||||
switch($errno) {
|
||||
case -3:
|
||||
$this->errormsg = 'Socket creation failed (-3)';
|
||||
case -4:
|
||||
$this->errormsg = 'DNS lookup failure (-4)';
|
||||
case -5:
|
||||
$this->errormsg = 'Connection refused or timed out (-5)';
|
||||
default:
|
||||
$this->errormsg = 'Connection failed ('.$errno.')';
|
||||
$this->errormsg .= ' '.$errstr;
|
||||
$this->debug($this->errormsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
socket_set_timeout($fp, $this->timeout);
|
||||
$request = $this->buildRequest();
|
||||
$this->debug('Request', $request);
|
||||
fwrite($fp, $request);
|
||||
// Reset all the variables that should not persist between requests
|
||||
$this->headers = array();
|
||||
$this->content = '';
|
||||
$this->errormsg = '';
|
||||
// Set a couple of flags
|
||||
$inHeaders = true;
|
||||
$atStart = true;
|
||||
// Now start reading back the response
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp, 4096);
|
||||
if ($atStart) {
|
||||
// Deal with first line of returned data
|
||||
$atStart = false;
|
||||
if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
|
||||
$this->errormsg = "Status code line invalid: ".htmlentities($line);
|
||||
$this->debug($this->errormsg);
|
||||
//return false;
|
||||
}
|
||||
$http_version = $m[1]; // not used
|
||||
$this->status = $m[2];
|
||||
$status_string = $m[3]; // not used
|
||||
$this->debug(trim($line));
|
||||
continue;
|
||||
}
|
||||
if ($inHeaders) {
|
||||
if (trim($line) == '') {
|
||||
$inHeaders = false;
|
||||
$this->debug('Received Headers', $this->headers);
|
||||
if ($this->headers_only) {
|
||||
break; // Skip the rest of the input
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
|
||||
// Skip to the next header
|
||||
continue;
|
||||
}
|
||||
$key = strtolower(trim($m[1]));
|
||||
$val = trim($m[2]);
|
||||
// Deal with the possibility of multiple headers of same name
|
||||
if (isset($this->headers[$key])) {
|
||||
if (is_array($this->headers[$key])) {
|
||||
$this->headers[$key][] = $val;
|
||||
} else {
|
||||
$this->headers[$key] = array($this->headers[$key], $val);
|
||||
}
|
||||
} else {
|
||||
$this->headers[$key] = $val;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// We're not in the headers, so append the line to the contents
|
||||
$this->content .= $line;
|
||||
}
|
||||
fclose($fp);
|
||||
// If data is compressed, uncompress it
|
||||
if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
|
||||
$this->debug('Content is gzip encoded, unzipping it');
|
||||
$this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
|
||||
$this->content = gzinflate($this->content);
|
||||
}
|
||||
// If $persist_cookies, deal with any cookies
|
||||
if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
|
||||
$cookies = $this->headers['set-cookie'];
|
||||
if (!is_array($cookies)) {
|
||||
$cookies = array($cookies);
|
||||
}
|
||||
foreach ($cookies as $cookie) {
|
||||
if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
|
||||
$this->cookies[$m[1]] = $m[2];
|
||||
}
|
||||
}
|
||||
// Record domain of cookies for security reasons
|
||||
$this->cookie_host = $this->host;
|
||||
}
|
||||
// If $persist_referers, set the referer ready for the next request
|
||||
if ($this->persist_referers) {
|
||||
$this->debug('Persisting referer: '.$this->getRequestURL());
|
||||
$this->referer = $this->getRequestURL();
|
||||
}
|
||||
// Finally, if handle_redirects and a redirect is sent, do that
|
||||
if ($this->handle_redirects) {
|
||||
if (++$this->redirect_count >= $this->max_redirects) {
|
||||
$this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
|
||||
$this->debug($this->errormsg);
|
||||
$this->redirect_count = 0;
|
||||
return false;
|
||||
}
|
||||
$location = isset($this->headers['location']) ? $this->headers['location'] : '';
|
||||
$uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
|
||||
if ($location || $uri) {
|
||||
$url = parse_url($location.$uri);
|
||||
// This will FAIL if redirect is to a different site
|
||||
return $this->get($url['path']);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function buildRequest() {
|
||||
$headers = array();
|
||||
$headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
|
||||
$headers[] = "Host: {$this->host}";
|
||||
$headers[] = "User-Agent: {$this->user_agent}";
|
||||
$headers[] = "Accept: {$this->accept}";
|
||||
if ($this->use_gzip) {
|
||||
$headers[] = "Accept-encoding: {$this->accept_encoding}";
|
||||
}
|
||||
$headers[] = "Accept-language: {$this->accept_language}";
|
||||
if ($this->referer) {
|
||||
$headers[] = "Referer: {$this->referer}";
|
||||
}
|
||||
// Cookies
|
||||
if ($this->cookies) {
|
||||
$cookie = 'Cookie: ';
|
||||
foreach ($this->cookies as $key => $value) {
|
||||
$cookie .= "$key=$value; ";
|
||||
}
|
||||
$headers[] = $cookie;
|
||||
}
|
||||
// Basic authentication
|
||||
if ($this->username && $this->password) {
|
||||
$headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
|
||||
}
|
||||
// If this is a POST, set the content type and length
|
||||
if ($this->postdata) {
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
||||
$headers[] = 'Content-Length: '.strlen($this->postdata);
|
||||
}
|
||||
$request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
|
||||
return $request;
|
||||
}
|
||||
function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
function getContent() {
|
||||
return $this->content;
|
||||
}
|
||||
function getHeaders() {
|
||||
return $this->headers;
|
||||
}
|
||||
function getHeader($header) {
|
||||
$header = strtolower($header);
|
||||
if (isset($this->headers[$header])) {
|
||||
return $this->headers[$header];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function getError() {
|
||||
return $this->errormsg;
|
||||
}
|
||||
function getCookies() {
|
||||
return $this->cookies;
|
||||
}
|
||||
function getRequestURL() {
|
||||
$url = 'http://'.$this->host;
|
||||
if ($this->port != 80) {
|
||||
$url .= ':'.$this->port;
|
||||
}
|
||||
$url .= $this->path;
|
||||
return $url;
|
||||
}
|
||||
// Setter methods
|
||||
function setUserAgent($string) {
|
||||
$this->user_agent = $string;
|
||||
}
|
||||
function setAuthorization($username, $password) {
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
}
|
||||
function setCookies($array) {
|
||||
$this->cookies = $array;
|
||||
}
|
||||
// Option setting methods
|
||||
function useGzip($boolean) {
|
||||
$this->use_gzip = $boolean;
|
||||
}
|
||||
function setPersistCookies($boolean) {
|
||||
$this->persist_cookies = $boolean;
|
||||
}
|
||||
function setPersistReferers($boolean) {
|
||||
$this->persist_referers = $boolean;
|
||||
}
|
||||
function setHandleRedirects($boolean) {
|
||||
$this->handle_redirects = $boolean;
|
||||
}
|
||||
function setMaxRedirects($num) {
|
||||
$this->max_redirects = $num;
|
||||
}
|
||||
function setHeadersOnly($boolean) {
|
||||
$this->headers_only = $boolean;
|
||||
}
|
||||
function setDebug($boolean) {
|
||||
$this->debug = $boolean;
|
||||
}
|
||||
// "Quick" static methods
|
||||
function quickGet($url) {
|
||||
$bits = parse_url($url);
|
||||
$host = $bits['host'];
|
||||
$port = isset($bits['port']) ? $bits['port'] : 80;
|
||||
$path = isset($bits['path']) ? $bits['path'] : '/';
|
||||
if (isset($bits['query'])) {
|
||||
$path .= '?'.$bits['query'];
|
||||
}
|
||||
$client = new HttpClientUpgrade($host, $port);
|
||||
if (!$client->get($path)) {
|
||||
return false;
|
||||
} else {
|
||||
return $client->getContent();
|
||||
}
|
||||
}
|
||||
function quickPost($url, $data) {
|
||||
$bits = parse_url($url);
|
||||
$host = $bits['host'];
|
||||
$port = isset($bits['port']) ? $bits['port'] : 80;
|
||||
$path = isset($bits['path']) ? $bits['path'] : '/';
|
||||
$client = new HttpClientUpgrade($host, $port);
|
||||
if (!$client->post($path, $data)) {
|
||||
return false;
|
||||
} else {
|
||||
return $client->getContent();
|
||||
}
|
||||
}
|
||||
function debug($msg, $object = false) {
|
||||
if ($this->debug) {
|
||||
print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClientUpgrade Debug:</strong> '.$msg;
|
||||
if ($object) {
|
||||
ob_start();
|
||||
print_r($object);
|
||||
$content = htmlentities(ob_get_contents());
|
||||
ob_end_clean();
|
||||
print '<pre>'.$content.'</pre>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@ class ContentDisposition implements UnstructuredInterface
|
||||
*
|
||||
* @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
|
||||
|
||||
+748
@@ -0,0 +1,748 @@
|
||||
<?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, array $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 WHERE Table_type = 'BASE TABLE'";
|
||||
$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);
|
||||
|
||||
$sql = "SHOW FULL tables WHERE Table_type = 'VIEW'";
|
||||
$query_result = mysqli_query($mysqli, $sql);
|
||||
if (!$query_result) {
|
||||
return(array());
|
||||
}
|
||||
while ($row = mysqli_fetch_assoc($query_result)) {
|
||||
$view = array();
|
||||
$view['name'] = $row['Tables_in_'.$schema];
|
||||
$view['type'] = $row['Table_type'];
|
||||
$views[] = $view; // Add view to list of views
|
||||
}
|
||||
|
||||
foreach ($views as &$view) {
|
||||
$sql = "SHOW CREATE VIEW ".$view['name'];
|
||||
$query_result = mysqli_query($mysqli, $sql);
|
||||
if (!$query_result) {
|
||||
return(array());
|
||||
}
|
||||
$viewdef = mysqli_fetch_assoc($query_result);
|
||||
|
||||
// Remove the security info from view definition
|
||||
$view['Create'] = "CREATE ".stristr($viewdef['Create View'],"VIEW");
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['host'] = $host;
|
||||
$result['database'] = $schema;
|
||||
$result['user'] = $user;
|
||||
$result['tables'] = $tables;
|
||||
$result['views'] = $views;
|
||||
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
|
||||
|
||||
function mustal_compare_table_array(array $nominal, string $nominal_name, array $actual, string $actual_name, bool $check_column_definitions, bool $utf8fix) : array {
|
||||
|
||||
$compare_differences = array();
|
||||
|
||||
|
||||
if($utf8fix) {
|
||||
$column_collation_aliases = array(
|
||||
['utf8mb3_general_ci','utf8_general_ci'],
|
||||
['utf8mb3_unicode_ci','utf8_unicode_ci'],
|
||||
['utf8mb3_bin','utf8_bin']
|
||||
);
|
||||
} else {
|
||||
$column_collation_aliases = array();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
foreach ($nominal['views'] as $database_view) {
|
||||
$found_view = array();
|
||||
foreach ($actual['views'] as $compare_view) {
|
||||
if ($database_view['name'] == $compare_view['name']) {
|
||||
$found_view = $compare_view;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($compare_view);
|
||||
|
||||
if ($found_view) {
|
||||
|
||||
if (trim($database_view['Create']) != trim($found_view['Create'])) {
|
||||
$compare_difference = array();
|
||||
$compare_difference['type'] = "View definition";
|
||||
$compare_difference[$nominal_name] = $database_view['name'];
|
||||
$compare_differences[] = $compare_difference;
|
||||
}
|
||||
|
||||
} else {
|
||||
$compare_difference = array();
|
||||
$compare_difference['type'] = "View existence";
|
||||
$compare_difference[$nominal_name] = $database_view['name'];
|
||||
$compare_differences[] = $compare_difference;
|
||||
}
|
||||
}
|
||||
|
||||
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,true);
|
||||
|
||||
foreach ($compare_differences as $compare_difference) {
|
||||
|
||||
$drop_view = false;
|
||||
|
||||
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;
|
||||
case 'View definition':
|
||||
$drop_view = true;
|
||||
// intentionally omitted break;
|
||||
case 'View existence':
|
||||
$view_name = $compare_difference['in JSON'];
|
||||
$view_key = array_search($view_name,array_column($compare_def['views'],'name'));
|
||||
|
||||
if ($view_key !== false) {
|
||||
$view = $compare_def['views'][$view_key];
|
||||
|
||||
switch ($view['type']) {
|
||||
case 'VIEW':
|
||||
|
||||
if ($drop_view === true) {
|
||||
$sql = "DROP VIEW ".$view['name'];
|
||||
$upgrade_sql[] = $sql;
|
||||
}
|
||||
|
||||
// Create view in DB
|
||||
$upgrade_sql[] = $view['Create'];
|
||||
break;
|
||||
default:
|
||||
$result[] = array(1,"Upgrade type '".$view['type']."' on view '".$view['name']."' not supported.");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$result[] = array(2,"Error view_key while creating upgrade for view existence `$view_name`.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$result[] = array(12,"Upgrade type '".$compare_difference['type']."' not supported.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$upgrade_sql = array_unique($upgrade_sql);
|
||||
|
||||
if (count($upgrade_sql) > 0) {
|
||||
|
||||
array_unshift($upgrade_sql,"SET SQL_MODE='ALLOW_INVALID_DATES';","SET SESSION innodb_strict_mode=OFF;");
|
||||
}
|
||||
|
||||
|
||||
return($result);
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$version="OSS";
|
||||
$version_revision="1.5";
|
||||
$version_revision="1.8";
|
||||
$githash = file_get_contents("../githash.txt");
|
||||
if (!empty($githash)) {
|
||||
$version_revision .= " (".substr($githash,0,8).")";
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Generated file from class.acl.php
|
||||
# Disable directory browsing
|
||||
Options -Indexes
|
||||
# Deny access to all *.php
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
<FilesMatch "\.(css|jpg|jpeg|gif|png|svg|js)$">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</FilesMatch>
|
||||
# Allow access to index.php
|
||||
<Files index.php>
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</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
|
||||
+132
-5375
File diff suppressed because it is too large
Load Diff
+551
-551
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ class AuftragPDF extends BriefpapierCustom {
|
||||
{
|
||||
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,11 @@ class Briefpapier extends SuperFPDF {
|
||||
/** @var array **/
|
||||
private $styleData;
|
||||
|
||||
// Typed variables to get rid of the typos, $border omitted intenionally
|
||||
function Cell_typed(int $w, int $h = 0, string $txt = '', $border = 0, int $ln = 0, string $align = '', bool $fill = false, string $link = '') {
|
||||
return($this->Cell($w,$h,$txt,$border,$ln,$align,$fill,$link));
|
||||
}
|
||||
|
||||
/**
|
||||
* Briefpapier constructor.
|
||||
*
|
||||
@@ -1006,9 +1011,9 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->cMargin=-3;
|
||||
|
||||
if($this->getStyleElement("seite_belegnr"))
|
||||
$this->Cell(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb} '.$this->zusatzfooter,0,0,$this->seite_von_ausrichtung);
|
||||
$this->Cell_typed(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb} '.$this->zusatzfooter,0,0,$this->seite_von_ausrichtung);
|
||||
else
|
||||
$this->Cell(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb}',0,0,$this->seite_von_ausrichtung);
|
||||
$this->Cell_typed(0,8,$this->app->erp->Beschriftung("dokument_seite").' '.$this->PageNo().' '.$this->app->erp->Beschriftung("dokument_seitevon").' {nb}',0,0,$this->seite_von_ausrichtung);
|
||||
|
||||
$this->cMargin = $tmpc;
|
||||
|
||||
@@ -1836,8 +1841,10 @@ class Briefpapier extends SuperFPDF {
|
||||
//$this->setStationery("/home/eproo/eproo-master/app/main/www/lib/dokumente/demo.pdf");
|
||||
$this->SetDisplayMode("real","single");
|
||||
|
||||
/*
|
||||
if($this->getStyleElement("abstand_seitenrandrechts")=="")
|
||||
$this->getStyleElementSet("abstand_seitenrandrechts",$this->getStyleElement("abstand_seitenrandlinks"));
|
||||
*/
|
||||
|
||||
$this->SetMargins($this->getStyleElement("abstand_seitenrandlinks"),50,$this->getStyleElement("abstand_seitenrandrechts"));
|
||||
$this->SetAutoPageBreak(true,$this->getStyleElement("abstand_umbruchunten"));
|
||||
@@ -1886,7 +1893,7 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->SetTextColor(0,0,0);
|
||||
if($this->doctype!="lieferschein" && $this->doctype!="preisanfrage" && !$this->nichtsichtbar_summe) {
|
||||
$this->renderTotals();
|
||||
} else $this->Cell(1,5,'',0);
|
||||
} else $this->Cell_typed(1,5,'',0);
|
||||
}
|
||||
$this->renderFooter();
|
||||
$this->logofile = "";
|
||||
@@ -1928,7 +1935,7 @@ class Briefpapier extends SuperFPDF {
|
||||
if($this->recipient['anrede']!="" && $this->getStyleElement('typimdokument'))
|
||||
{
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,$this->recipient['anrede'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['anrede'],0,1);
|
||||
}
|
||||
|
||||
$this->SetMargins($this->getStyleElement("abstand_adresszeilelinks"),50);
|
||||
@@ -1940,10 +1947,10 @@ class Briefpapier extends SuperFPDF {
|
||||
$array = explode( "\n", wordwrap($this->recipient['enterprise'], $charlimit));
|
||||
foreach($array as $row)
|
||||
{
|
||||
$this->Cell(80,5,$this->app->erp->ReadyForPDF($row),0,1);
|
||||
$this->Cell_typed(80,5,$this->app->erp->ReadyForPDF($row),0,1);
|
||||
}
|
||||
} else {
|
||||
$this->Cell(80,5,$this->app->erp->ReadyForPDF($this->recipient['enterprise']),0,1);
|
||||
$this->Cell_typed(80,5,$this->app->erp->ReadyForPDF($this->recipient['enterprise']),0,1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1952,30 +1959,30 @@ class Briefpapier extends SuperFPDF {
|
||||
if($this->recipient['firstname']!="")
|
||||
{
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,$this->recipient['firstname'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['firstname'],0,1);
|
||||
}
|
||||
|
||||
if($this->recipient['address2']!="") {
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,$this->recipient['address2'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['address2'],0,1);
|
||||
}
|
||||
|
||||
if($this->recipient['address3']!="")
|
||||
{
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,$this->recipient['address3'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['address3'],0,1);
|
||||
}
|
||||
|
||||
if($this->recipient['address4']!="")
|
||||
{
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,$this->recipient['address4'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['address4'],0,1);
|
||||
}
|
||||
|
||||
|
||||
//$this->Cell(80,5,$this->recipient['firstname']." ".$this->recipient['familyname'],0,1);
|
||||
//$this->Cell_typed(80,5,$this->recipient['firstname']." ".$this->recipient['familyname'],0,1);
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,$this->recipient['address1'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['address1'],0,1);
|
||||
|
||||
|
||||
$this->SetFont($this->GetFont(),'',10);
|
||||
@@ -1987,22 +1994,22 @@ class Briefpapier extends SuperFPDF {
|
||||
$inland = $this->getStyleElement("land");
|
||||
if($this->recipient['country']!=$inland)
|
||||
{
|
||||
//$this->Cell(80,5,$this->recipient['country']."-".$this->recipient['areacode']." ".$this->recipient['city'],0,1);
|
||||
//$this->Cell_typed(80,5,$this->recipient['country']."-".$this->recipient['areacode']." ".$this->recipient['city'],0,1);
|
||||
|
||||
if(function_exists('mb_strtoupper'))
|
||||
$this->Cell(80,5,mb_strtoupper($this->recipient['areacode']." ".$this->recipient['city'],"UTF-8"),0,1);
|
||||
$this->Cell_typed(80,5,mb_strtoupper($this->recipient['areacode']." ".$this->recipient['city'],"UTF-8"),0,1);
|
||||
else
|
||||
$this->Cell(80,5,strtoupper($this->recipient['areacode']." ".$this->recipient['city']),0,1);
|
||||
$this->Cell_typed(80,5,strtoupper($this->recipient['areacode']." ".$this->recipient['city']),0,1);
|
||||
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
$this->Cell(80,5,strtoupper($this->app->erp->UmlauteEntfernen($this->app->GetLandLang($this->recipient['country'],$this->sprache))),0,1);
|
||||
$this->Cell_typed(80,5,strtoupper($this->app->erp->UmlauteEntfernen($this->app->GetLandLang($this->recipient['country'],$this->sprache))),0,1);
|
||||
|
||||
}
|
||||
else {
|
||||
$this->Cell(80,5,$this->recipient['areacode']." ".$this->recipient['city'],0,1);
|
||||
$this->Cell_typed(80,5,$this->recipient['areacode']." ".$this->recipient['city'],0,1);
|
||||
}
|
||||
//$this->SetFont($this->GetFont(),'',9);
|
||||
//if(isset($this->recipient['country'])) $this->Cell(80,5,$this->recipient['country'],0,1);
|
||||
//if(isset($this->recipient['country'])) $this->Cell_typed(80,5,$this->recipient['country'],0,1);
|
||||
|
||||
|
||||
//FREITEXT1
|
||||
@@ -2074,9 +2081,9 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->SetX($this->getStyleElement("abstand_adresszeilelinks"));
|
||||
|
||||
if($this->getStyleElement("absenderunterstrichen")=="1")
|
||||
$this->Cell($this->GetStringWidth($cellStr)+2,5,$cellStr,'B');
|
||||
$this->Cell_typed($this->GetStringWidth($cellStr)+2,5,$cellStr,'B');
|
||||
else
|
||||
$this->Cell($this->GetStringWidth($cellStr)+2,5,$cellStr,'');
|
||||
$this->Cell_typed($this->GetStringWidth($cellStr)+2,5,$cellStr,'');
|
||||
}
|
||||
|
||||
if($this->nichtsichtbar_rechtsoben!=true)
|
||||
@@ -2088,70 +2095,70 @@ class Briefpapier extends SuperFPDF {
|
||||
|
||||
$this->SetXY($xOffset,10);
|
||||
$this->SetFont($this->GetFont(),'',9);
|
||||
$this->Cell(30,$lineHeight,"Name der Gesellschaft: ",0,0,'R');
|
||||
$this->Cell_typed(30,$lineHeight,"Name der Gesellschaft: ",0,0,'R');
|
||||
$this->SetFont($this->GetFont(),'B',9);
|
||||
$this->Cell(60,$lineHeight,$this->sender['enterprise'],0,2);
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['enterprise'],0,2);
|
||||
if(isset($this->sender['enterprise2']))
|
||||
$this->Cell(60,$lineHeight,$this->sender['enterprise2'],0,2);
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['enterprise2'],0,2);
|
||||
|
||||
$this->SetXY($xOffset,$this->GetY());
|
||||
$this->SetFont($this->GetFont(),'',9);
|
||||
$this->Cell(30,$lineHeight,"Sitz der Gesellschaft: ",0,0,'R');
|
||||
$this->Cell_typed(30,$lineHeight,"Sitz der Gesellschaft: ",0,0,'R');
|
||||
$this->SetFont($this->GetFont(),'B',9);
|
||||
$this->Cell(60,$lineHeight,$this->sender['address1'],0,2);
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['address1'],0,2);
|
||||
if(isset($this->sender['address2']))
|
||||
$this->Cell(60,$lineHeight,$this->sender['address2'],0,2);
|
||||
$this->Cell(60,$lineHeight,$this->sender['areacode']." ".$this->sender['city'],0,2);
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['address2'],0,2);
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['areacode']." ".$this->sender['city'],0,2);
|
||||
|
||||
$this->SetXY($xOffset,$this->GetY()+$absatz); //abstand
|
||||
$this->SetFont($this->GetFont(),'',9);
|
||||
if(isset($this->sender['phone1'])) {
|
||||
$this->Cell(30,$lineHeight,"Fon: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['phone1'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"Fon: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['phone1'],0,2);
|
||||
}
|
||||
|
||||
if(isset($this->sender['fax'])) {
|
||||
$this->SetXY($xOffset,$this->GetY());
|
||||
$this->Cell(30,$lineHeight,"Fax: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['fax'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"Fax: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['fax'],0,2);
|
||||
}
|
||||
|
||||
|
||||
$this->SetXY($xOffset, $this->GetY()+$absatz); //abstand
|
||||
if(isset($this->sender['email'])) {
|
||||
$this->Cell(30,$lineHeight,"Mail: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['email'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"Mail: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['email'],0,2);
|
||||
}
|
||||
|
||||
if(isset($this->sender['web'])) {
|
||||
$this->SetXY($xOffset,$this->GetY());
|
||||
$this->Cell(30,$lineHeight,"Web: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['web'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"Web: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['web'],0,2);
|
||||
}
|
||||
|
||||
$this->SetXY($xOffset, $this->GetY()+$absatz); //abstand
|
||||
if(isset($this->sender['ustid'])) {
|
||||
$this->Cell(30,$lineHeight,"UST-ID: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['ustid'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"UST-ID: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['ustid'],0,2);
|
||||
}
|
||||
if(isset($this->sender['taxnr'])) {
|
||||
$this->SetXY($xOffset,$this->GetY());
|
||||
$this->Cell(30,$lineHeight,"Steuer-Nr.: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['taxnr'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"Steuer-Nr.: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['taxnr'],0,2);
|
||||
}
|
||||
if(isset($this->sender['hreg'])) {
|
||||
$this->SetXY($xOffset,$this->GetY());
|
||||
$this->Cell(30,$lineHeight,"Handelsregister: ",0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['hreg'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,"Handelsregister: ",0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['hreg'],0,2);
|
||||
}
|
||||
|
||||
$this->SetXY($xOffset,$this->GetY());
|
||||
$this->Cell(30,$lineHeight,utf8_encode("Gesch�ftsf�hrung: "),0,0,'R');
|
||||
$this->Cell(60,$lineHeight,$this->sender['firstname'].' '.$this->sender['familyname'],0,2);
|
||||
$this->Cell_typed(30,$lineHeight,utf8_encode("Gesch�ftsf�hrung: "),0,0,'R');
|
||||
$this->Cell_typed(60,$lineHeight,$this->sender['firstname'].' '.$this->sender['familyname'],0,2);
|
||||
|
||||
//$this->SetXY($xOffset, $this->GetY()+$absatz+2); //abstand
|
||||
//$this->Cell(30,$lineHeight,"Datum: ",0,0,'R');
|
||||
//$this->Cell(60,$lineHeight,utf8_encode($date),0,2);
|
||||
//$this->Cell_typed(30,$lineHeight,"Datum: ",0,0,'R');
|
||||
//$this->Cell_typed(60,$lineHeight,utf8_encode($date),0,2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2270,7 +2277,7 @@ class Briefpapier extends SuperFPDF {
|
||||
|
||||
$this->SetFont($this->GetFont(),'B',$betreffszeile);
|
||||
$this->SetY($this->GetY()+$this->abstand_betreffzeileoben);
|
||||
//$this->Cell(85,6,$this->doctypeOrig);
|
||||
//$this->Cell_typed(85,6,$this->doctypeOrig);
|
||||
$this->MultiCell(210-83+$this->abstand_boxrechtsoben_lr-$this->getStyleElement("abstand_seitenrandlinks")-5,6,html_entity_decode($this->doctypeOrig,ENT_QUOTES),0,'L');
|
||||
$this->SetY($this->GetY()-$this->abstand_betreffzeileoben);
|
||||
|
||||
@@ -2593,76 +2600,76 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->SetX($this->getStyleElement('abstand_seitenrandlinks')+1); // eventuell einstellbar per GUI
|
||||
|
||||
$this->SetFont($this->GetFont(),'B',$tabellenbeschriftung);
|
||||
$this->Cell($posWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_position'),0,0,'C'));
|
||||
$this->Cell_typed($posWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_position'),0,0,'C'));
|
||||
if($this->doctype!='arbeitsnachweis')
|
||||
{
|
||||
if($this->doctype=='zahlungsavis')
|
||||
{
|
||||
$this->Cell($itemNoWidth,6,'Nummer');
|
||||
$this->Cell($descWidth-$einheitWidth+$taxWidth+$priceWidth+$rabattWidth,6,'Beleg');
|
||||
$this->Cell_typed($itemNoWidth,6,'Nummer');
|
||||
$this->Cell_typed($descWidth-$einheitWidth+$taxWidth+$priceWidth+$rabattWidth,6,'Beleg');
|
||||
|
||||
$this->Cell($amWidth,6,'',0,0,'R');
|
||||
$this->Cell_typed($amWidth,6,'',0,0,'R');
|
||||
}
|
||||
else {
|
||||
$this->Cell($itemNoWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikelnummer')));
|
||||
$this->Cell_typed($itemNoWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikelnummer')));
|
||||
if($this->getStyleElement('artikeleinheit')=='1'){
|
||||
$this->Cell($descWidth - $einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
|
||||
$this->Cell_typed($descWidth - $einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
|
||||
}
|
||||
else{
|
||||
$this->Cell($descWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
|
||||
$this->Cell_typed($descWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_artikel')));
|
||||
}
|
||||
$this->Cell($amWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_menge')),0,0,'R');
|
||||
$this->Cell_typed($amWidth,6,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_menge')),0,0,'R');
|
||||
}
|
||||
} else {
|
||||
$this->Cell($taxWidth,6,'Mitarbeiter');
|
||||
$this->Cell($itemNoWidth,6,'Ort');
|
||||
$this->Cell($descWidth,6,'Tätigkeit');
|
||||
$this->Cell($amWidth,6,'Stunden',0,0,'R');
|
||||
$this->Cell_typed($taxWidth,6,'Mitarbeiter');
|
||||
$this->Cell_typed($itemNoWidth,6,'Ort');
|
||||
$this->Cell_typed($descWidth,6,'Tätigkeit');
|
||||
$this->Cell_typed($amWidth,6,'Stunden',0,0,'R');
|
||||
}
|
||||
|
||||
if($this->doctype!='lieferschein' && $this->doctype!='arbeitsnachweis' && $this->doctype!='produktion' && $this->doctype!='zahlungsavis' && $this->doctype!='preisanfrage'){
|
||||
if($this->getStyleElement('artikeleinheit')=='1'){
|
||||
$this->Cell($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
|
||||
$this->Cell_typed($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
|
||||
}
|
||||
|
||||
if($this->ust_spalteausblende){
|
||||
$this->Cell($taxWidth, 6, '', 0, 0, 'R');
|
||||
$this->Cell_typed($taxWidth, 6, '', 0, 0, 'R');
|
||||
}
|
||||
else{
|
||||
$this->Cell($taxWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_mwst')), 0, 0, 'R');
|
||||
$this->Cell_typed($taxWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_mwst')), 0, 0, 'R');
|
||||
}
|
||||
|
||||
if($this->getStyleElement('artikeleinheit')=='1'){
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einzel')), 0, 0, 'R');
|
||||
$this->Cell_typed($priceWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einzel')), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth, 6, $this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_stueck'))), 0, 0, 'R');
|
||||
$this->Cell_typed($priceWidth, 6, $this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_stueck'))), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
|
||||
if($this->rabatt=='1') {
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($rabattWidth,6,$this->app->erp->Beschriftung('dokument_rabatt'),0,0,'R');
|
||||
$this->Cell($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
|
||||
$this->Cell_typed($rabattWidth,6,$this->app->erp->Beschriftung('dokument_rabatt'),0,0,'R');
|
||||
$this->Cell_typed($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
|
||||
}
|
||||
} else {
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
|
||||
$this->Cell_typed($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($this->doctype=='lieferschein' || $this->doctype=='preisanfrage')
|
||||
{
|
||||
if($this->getStyleElement("artikeleinheit")=='1'){
|
||||
$this->Cell($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
|
||||
$this->Cell_typed($einheitWidth, 6, $this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_einheit')), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
else if ($this->doctype=='zahlungsavis')
|
||||
{
|
||||
$this->Cell($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
|
||||
$this->Cell_typed($sumWidth,6,$this->app->erp->ParseUserVars($this->doctype, $this->id,$this->app->erp->ReadyForPDF($this->app->erp->Beschriftung('dokument_gesamt'))),0,0,'R');
|
||||
}
|
||||
|
||||
$this->Ln();
|
||||
@@ -2748,7 +2755,7 @@ class Briefpapier extends SuperFPDF {
|
||||
$posWidthold = $posWidth;
|
||||
if($belege_stuecklisteneinrueckenmm && $newlvl > 0)
|
||||
{
|
||||
$this->Cell($belege_stuecklisteneinrueckenmm * $newlvl,$cellhoehe,'');
|
||||
$this->Cell_typed($belege_stuecklisteneinrueckenmm * $newlvl,$cellhoehe,'');
|
||||
$posWidth -= $belege_stuecklisteneinrueckenmm * $newlvl;
|
||||
if($posWidth < 2* strlen($posstr))
|
||||
{
|
||||
@@ -2760,11 +2767,11 @@ class Briefpapier extends SuperFPDF {
|
||||
if($belege_subpositionenstuecklisten)$posstr = $this->CalcPosString($posstr,$oldpostr, $hauptnummer, $oldlvl, $newlvl);
|
||||
$oldpostr = $posstr;
|
||||
$oldlvl = isset($item['lvl'])?(int)$item['lvl']:0;
|
||||
$this->Cell($posWidth,$cellhoehe,$posstr,0,0,$belege_stuecklisteneinrueckenmm?'':'C');
|
||||
$this->Cell_typed($posWidth,$cellhoehe,$posstr,0,0,$belege_stuecklisteneinrueckenmm?'':'C');
|
||||
//artikelnummer
|
||||
if($this->doctype==='arbeitsnachweis')
|
||||
{
|
||||
$this->Cell($taxWidth,$cellhoehe,trim($item['person']),0);
|
||||
$this->Cell_typed($taxWidth,$cellhoehe,trim($item['person']),0);
|
||||
|
||||
$zeilenuntertext = $this->getStyleElement('zeilenuntertext');
|
||||
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
|
||||
@@ -2785,10 +2792,10 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->SetFont($this->GetFont(), '', $tabelleninhalt);
|
||||
}
|
||||
if(isset($item['itemno'])) {
|
||||
$this->Cell($itemNoWidth,$cellhoehe,$item['itemno'],0);
|
||||
$this->Cell_typed($itemNoWidth,$cellhoehe,$item['itemno'],0);
|
||||
}
|
||||
else {
|
||||
$this->Cell($itemNoWidth);
|
||||
$this->Cell_typed($itemNoWidth);
|
||||
}
|
||||
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
|
||||
}
|
||||
@@ -2837,10 +2844,10 @@ class Briefpapier extends SuperFPDF {
|
||||
// Menge
|
||||
|
||||
if($this->doctype==='zahlungsavis'){
|
||||
$this->Cell($amWidth, $cellhoehe, '', 0, 0, 'R');
|
||||
$this->Cell_typed($amWidth, $cellhoehe, '', 0, 0, 'R');
|
||||
}
|
||||
else{
|
||||
$this->Cell($amWidth, $cellhoehe, $item['amount'], 0, 0, 'R');
|
||||
$this->Cell_typed($amWidth, $cellhoehe, $item['amount'], 0, 0, 'R');
|
||||
}
|
||||
|
||||
if($this->doctype!=='lieferschein' && $this->doctype!=='arbeitsnachweis' && $this->doctype!=='produktion' && $this->doctype!=='preisanfrage') {
|
||||
@@ -2877,7 +2884,7 @@ class Briefpapier extends SuperFPDF {
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
|
||||
$this->Cell_typed($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
|
||||
}
|
||||
|
||||
// if($item['tax']=="hidden") $item['tax']=="hidden";
|
||||
@@ -2905,21 +2912,21 @@ class Briefpapier extends SuperFPDF {
|
||||
// standard anzeige mit steuer
|
||||
if(!$this->ust_spalteausblende){
|
||||
if($item['tax']==='hidden'){
|
||||
$this->Cell($taxWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($taxWidth,$cellhoehe,"",0,0,'R');
|
||||
} else {
|
||||
$tax = $item['tax']; //= $tax; //="USTV"?0.19:0.07;
|
||||
$tax *= 100; $tax = $tax.'%';
|
||||
|
||||
if($this->doctype==='zahlungsavis'){
|
||||
$this->Cell($taxWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($taxWidth,$cellhoehe,"",0,0,'R');
|
||||
}
|
||||
else{
|
||||
$this->Cell($taxWidth, $cellhoehe, $item['ohnepreis'] ? '' : $tax, 0, 0, 'R');
|
||||
$this->Cell_typed($taxWidth, $cellhoehe, $item['ohnepreis'] ? '' : $tax, 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//kleinunternehmer
|
||||
$this->Cell($taxWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($taxWidth,$cellhoehe,"",0,0,'R');
|
||||
}
|
||||
|
||||
if($this->doctype!=='lieferschein' && $this->doctype!=='produktion' && $this->doctype!=='preisanfrage') {
|
||||
@@ -2933,29 +2940,29 @@ class Briefpapier extends SuperFPDF {
|
||||
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
//&& $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price']), 0, 0, 'R');
|
||||
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
|
||||
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if($item['ohnepreis']==2) {
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth,$cellhoehe,$item['price'],0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,$item['price'],0,0,'R');
|
||||
}
|
||||
} // text alternativ zu preis
|
||||
else {
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->Cell($priceWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,"",0,0,'R');
|
||||
}
|
||||
|
||||
// zentale rabatt spalte
|
||||
@@ -3023,7 +3030,7 @@ class Briefpapier extends SuperFPDF {
|
||||
} else {
|
||||
if($item['rabatt']<>0){
|
||||
// && $item['keinrabatterlaubt']!="1")
|
||||
$this->Cell($rabattWidth, $cellhoehe, $item['ohnepreis'] ? '' : $item['rabatt'] . " %", 0, 0, 'R');
|
||||
$this->Cell_typed($rabattWidth, $cellhoehe, $item['ohnepreis'] ? '' : $item['rabatt'] . " %", 0, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3032,13 +3039,13 @@ class Briefpapier extends SuperFPDF {
|
||||
$rabatt_or_porto = $this->app->DB->Select("SELECT id FROM artikel WHERE
|
||||
nummer='".$item['itemno']."' AND (porto='1' OR rabatt='1') LIMIT 1");
|
||||
if($rabatt_or_porto){
|
||||
$this->Cell($rabattWidth, $cellhoehe, '', 0, 0, 'R');
|
||||
$this->Cell_typed($rabattWidth, $cellhoehe, '', 0, 0, 'R');
|
||||
}
|
||||
else{
|
||||
$this->Cell($rabattWidth, $cellhoehe, 'SNP', 0, 0, 'R');
|
||||
$this->Cell_typed($rabattWidth, $cellhoehe, 'SNP', 0, 0, 'R');
|
||||
}
|
||||
} else {
|
||||
$this->Cell($rabattWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($rabattWidth,$cellhoehe,"",0,0,'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3046,7 +3053,7 @@ class Briefpapier extends SuperFPDF {
|
||||
else {
|
||||
// anzeige ohne zentrale rabatt spalte
|
||||
if ($item['tax']==="hidden"){
|
||||
$this->Cell($priceWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,"",0,0,'R');
|
||||
}
|
||||
else {
|
||||
if($anzeigeBelegNettoAdrese)
|
||||
@@ -3054,16 +3061,16 @@ class Briefpapier extends SuperFPDF {
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['tprice']),0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['tprice']),0,0,'R');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
|
||||
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($rabattWidth,$cellhoehe,"",0,0,'R');
|
||||
$this->Cell_typed($rabattWidth,$cellhoehe,"",0,0,'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3072,20 +3079,20 @@ class Briefpapier extends SuperFPDF {
|
||||
// if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,$item['ohnepreis']?'':$this->formatMoney((double)$item['price']),0,0,'R');
|
||||
}
|
||||
else{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
|
||||
$this->Cell_typed($priceWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['price'] * $item['tmptax']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
//$this->Cell($sumWidth,$cellhoehe,$this->formatMoney($item['tprice']).' '.$item['currency'],0,0,'R');
|
||||
//$this->Cell_typed($sumWidth,$cellhoehe,$this->formatMoney($item['tprice']).' '.$item['currency'],0,0,'R');
|
||||
if($this->rabatt=='1')
|
||||
{
|
||||
//gesamt preis
|
||||
if ($item['tax']==='hidden'){
|
||||
$this->Cell($priceWidth,$cellhoehe,'',0,0,'R');
|
||||
$this->Cell_typed($priceWidth,$cellhoehe,'',0,0,'R');
|
||||
}
|
||||
else {
|
||||
if($this->rabatt=='1'){
|
||||
@@ -3093,12 +3100,12 @@ class Briefpapier extends SuperFPDF {
|
||||
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
|
||||
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
|
||||
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3107,12 +3114,12 @@ class Briefpapier extends SuperFPDF {
|
||||
// if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
|
||||
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!$inventurohnepreis){
|
||||
$this->Cell($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
|
||||
$this->Cell_typed($sumWidth, $cellhoehe, $item['ohnepreis'] ? '' : $this->formatMoney((double)$item['tprice'] * $item['tmptax']), 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3148,7 +3155,7 @@ class Briefpapier extends SuperFPDF {
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
|
||||
$this->Cell_typed($einheitWidth,$cellhoehe,$this->app->erp->ReadyForPDF($einheit),0,0,'R');
|
||||
}
|
||||
|
||||
$this->Ln();
|
||||
@@ -3298,12 +3305,12 @@ class Briefpapier extends SuperFPDF {
|
||||
$yBeforeDescription = $this->GetY();
|
||||
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
|
||||
if($belege_stuecklisteneinrueckenmm && $newlvl > 0){
|
||||
$this->Cell($belege_stuecklisteneinrueckenmm * $newlvl, $cellhoehe, '');
|
||||
$this->Cell_typed($belege_stuecklisteneinrueckenmm * $newlvl, $cellhoehe, '');
|
||||
}
|
||||
$this->Cell($posWidth);
|
||||
$this->Cell($itemNoWidth);
|
||||
$this->Cell_typed($posWidth);
|
||||
$this->Cell_typed($itemNoWidth);
|
||||
if($this->doctype==='arbeitsnachweis') {
|
||||
$this->Cell($taxWidth);
|
||||
$this->Cell_typed($taxWidth);
|
||||
}
|
||||
|
||||
if($this->doctype==='lieferschein' && $this->getStyleElement('modul_verband')=='1'){
|
||||
@@ -3392,17 +3399,17 @@ class Briefpapier extends SuperFPDF {
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($taxWidth);
|
||||
$this->Cell($amWidth);
|
||||
$this->Cell_typed($taxWidth);
|
||||
$this->Cell_typed($amWidth);
|
||||
$this->Ln();
|
||||
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
|
||||
|
||||
$zeilenuntertext = $this->getStyleElement('zeilenuntertext');
|
||||
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
|
||||
$this->Cell($posWidth);
|
||||
$this->Cell($itemNoWidth);
|
||||
$this->Cell_typed($posWidth);
|
||||
$this->Cell_typed($itemNoWidth);
|
||||
if($this->doctype==='arbeitsnachweis') {
|
||||
$this->Cell($taxWidth);
|
||||
$this->Cell_typed($taxWidth);
|
||||
}
|
||||
if($this->getStyleElement('artikeleinheit')=='1'){
|
||||
$this->MultiCell($descWidth - $einheitWidth, 4, '', 0); // 4 = abstand zwischen Artikeln
|
||||
@@ -3410,8 +3417,8 @@ class Briefpapier extends SuperFPDF {
|
||||
else{
|
||||
$this->MultiCell($descWidth, 4, '', 0); // 4 = abstand zwischen Artikeln
|
||||
}
|
||||
$this->Cell($taxWidth);
|
||||
$this->Cell($amWidth);
|
||||
$this->Cell_typed($taxWidth);
|
||||
$this->Cell_typed($amWidth);
|
||||
$this->Ln();
|
||||
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
|
||||
$yAfterDescription = $this->GetY();
|
||||
@@ -3421,11 +3428,11 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->SetY($position_y_end_name);
|
||||
$yBeforeDescription = $this->GetY();
|
||||
$this->SetFont($this->GetFont(),'',$zeilenuntertext);
|
||||
$this->Cell($posWidth);
|
||||
$this->Cell($itemNoWidth);
|
||||
$this->Cell_typed($posWidth);
|
||||
$this->Cell_typed($itemNoWidth);
|
||||
if($this->doctype==='arbeitsnachweis')
|
||||
{
|
||||
$this->Cell($taxWidth);
|
||||
$this->Cell_typed($taxWidth);
|
||||
}
|
||||
if($this->getStyleElement('artikeleinheit')=='1')
|
||||
{
|
||||
@@ -3450,8 +3457,8 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->MultiCell($posWidth+$itemNoWidth+$descWidth+$amWidth+$taxWidth+$sumWidth+$priceWidth,($zeilenuntertext/2),trim($staffelpreistext),0,'R');
|
||||
}
|
||||
|
||||
$this->Cell($taxWidth);
|
||||
$this->Cell($amWidth);
|
||||
$this->Cell_typed($taxWidth);
|
||||
$this->Cell_typed($amWidth);
|
||||
$this->Ln();
|
||||
$this->SetFont($this->GetFont(),'',$tabelleninhalt);
|
||||
$yAfterDescription = $this->GetY();
|
||||
@@ -3805,7 +3812,7 @@ class Briefpapier extends SuperFPDF {
|
||||
$this->Image($dateiname, $this->GetX(), $this->GetY(),$width / 10, $hoehe / 10, 'jpg');
|
||||
if($nochtext == '')
|
||||
{
|
||||
$this->Cell($picwidth,6,'',0,0,'C');
|
||||
$this->Cell_typed($picwidth,6,'',0,0,'C');
|
||||
}
|
||||
$this->SetXY($this->GetX(), $y + $height / 10 + ($nochtext == ''?5:0));
|
||||
}
|
||||
@@ -4016,7 +4023,7 @@ class Briefpapier extends SuperFPDF {
|
||||
}
|
||||
|
||||
$this->SetX($x+$abstand_links);
|
||||
$this->Cell($descWidth,4,$this->WriteHTML($html));
|
||||
$this->Cell_typed($descWidth,4,$this->WriteHTML($html));
|
||||
$this->SetX($x+$abstand_links+$descWidth);
|
||||
//$this->SetX($x);
|
||||
|
||||
@@ -4050,7 +4057,7 @@ class Briefpapier extends SuperFPDF {
|
||||
{
|
||||
$ausrichtung = $data['Text_Ausrichtung'];
|
||||
}
|
||||
$this->Cell($priceWidth+$amWidth+$taxWidth+$priceWidth,4,$summe,$rahmen,0,$ausrichtung);
|
||||
$this->Cell_typed($priceWidth+$amWidth+$taxWidth+$priceWidth,4,$summe,$rahmen,0,$ausrichtung);
|
||||
if(!empty($data['Abstand_Unten']))
|
||||
{
|
||||
$this->Ln((int)$data['Abstand_Unten']);
|
||||
@@ -4098,19 +4105,19 @@ class Briefpapier extends SuperFPDF {
|
||||
//$this->Line(110, $this->GetY(), 190, $this->GetY());
|
||||
$this->Ln(1);
|
||||
$this->SetFont($this->GetFont(),'',$this->getStyleElement('schriftgroesse_gesamt'));
|
||||
$this->Cell($differenz_wegen_abstand,2,'',0);
|
||||
$this->Cell_typed($differenz_wegen_abstand,2,'',0);
|
||||
if($this->getStyleElement('kleinunternehmer')!='1' && $this->doctype!='zahlungsavis'){
|
||||
$nettoText = $this->app->erp->Beschriftung('dokument_gesamtnetto');
|
||||
$nettoAmount = $this->formatMoney(round((double)$this->totals['totalArticles'], 2), 2).' '.$this->waehrung;
|
||||
$doctype = $this->doctype;
|
||||
$doctypeid = !empty($this->doctypeid)?$this->doctypeid: $this->id;
|
||||
$this->app->erp->RunHook('class_briefpapier_render_netto', 4, $doctype, $doctypeid, $nettoText, $nettoAmount);
|
||||
$this->Cell(30,5,$nettoText,0,0,'L');
|
||||
$this->Cell(40,5,$nettoAmount,0,'L','R');
|
||||
$this->Cell_typed(30,5,$nettoText,0,0,'L');
|
||||
$this->Cell_typed(40,5,$nettoAmount,0,0,'R');
|
||||
} else {
|
||||
//kleinunzernehmer
|
||||
$this->Cell(30,5,'',0,0,'L');
|
||||
$this->Cell(40,5,'',0,'L','R');
|
||||
$this->Cell_typed(30,5,'',0,0,'L');
|
||||
$this->Cell_typed(40,5,'',0,0,'R');
|
||||
}
|
||||
$this->Ln();
|
||||
|
||||
@@ -4121,16 +4128,16 @@ class Briefpapier extends SuperFPDF {
|
||||
$versand = 'Versandkosten: ';
|
||||
}
|
||||
if(isset($this->totals['priceOfDispatch'])) {
|
||||
$this->Cell($differenz_wegen_abstand,2,'',0);
|
||||
$this->Cell(30,5,$versand,0,'L','L');
|
||||
$this->Cell(40,5,$this->formatMoney((double)$this->totals['priceOfDispatch'], 2).' '.$this->waehrung,0,'L','R');
|
||||
$this->Cell_typed($differenz_wegen_abstand,2,'',0);
|
||||
$this->Cell_typed(30,5,$versand,0,'L','L');
|
||||
$this->Cell_typed(40,5,$this->formatMoney((double)$this->totals['priceOfDispatch'], 2).' '.$this->waehrung,0,0,'R');
|
||||
}
|
||||
//$this->Ln();
|
||||
|
||||
if(isset($this->totals['priceOfPayment']) && $this->totals['priceOfPayment']!='0.00'){
|
||||
$this->Cell($differenz_wegen_abstand,2,'',0);
|
||||
$this->Cell(30,5,$this->totals['modeOfPayment'],0,'L','L');
|
||||
$this->Cell(40,5,$this->formatMoney((double)$this->totals['priceOfPayment'], 2).' '.$this->waehrung,0,'L','R');
|
||||
$this->Cell_typed($differenz_wegen_abstand,2,'',0);
|
||||
$this->Cell_typed(30,5,$this->totals['modeOfPayment'],0,'L','L');
|
||||
$this->Cell_typed(40,5,$this->formatMoney((double)$this->totals['priceOfPayment'], 2).' '.$this->waehrung,0,0,'R');
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
@@ -4139,7 +4146,7 @@ class Briefpapier extends SuperFPDF {
|
||||
|
||||
|
||||
if(isset($this->totals['totalTaxV']) && $this->totals['totalTaxV']!="0.00"){
|
||||
$this->Cell($differenz_wegen_abstand,1,'',0);
|
||||
$this->Cell_typed($differenz_wegen_abstand,1,'',0);
|
||||
|
||||
if($this->getStyleElement('kleinunternehmer')!='1'){
|
||||
if(!empty($this->doctype) && !empty($this->id) && is_numeric($this->id)){
|
||||
@@ -4154,23 +4161,23 @@ class Briefpapier extends SuperFPDF {
|
||||
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
{
|
||||
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,'L','L'); //1
|
||||
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,0,'L'); //1
|
||||
}
|
||||
else {
|
||||
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,'L','L');
|
||||
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzNormal(false,$this->id,$this->table).' %',0,0,'L');
|
||||
}
|
||||
$this->Cell(40,3,$this->formatMoney((double)$this->totals['totalTaxV'], 2).' '.$this->waehrung,0,'L','R');
|
||||
$this->Cell_typed(40,3,$this->formatMoney((double)$this->totals['totalTaxV'], 2).' '.$this->waehrung,0,0,'R');
|
||||
} else {
|
||||
//kleinunternehmer
|
||||
$this->Cell(30,3,'',0,'L','L');
|
||||
$this->Cell(40,3,'',0,'L','R');
|
||||
$this->Cell_typed(30,3,'',0,0,'L');
|
||||
$this->Cell_typed(40,3,'',0,0,'R');
|
||||
}
|
||||
$this->Ln();
|
||||
}
|
||||
$projekt = $this->projekt;
|
||||
$adresse = $this->app->DB->Select("SELECT adresse FROM ".($this->table?$this->table:$this->doctype)." WHERE id = '".$this->id."' LIMIT 1");
|
||||
if(!empty($this->totals['totalTaxR']) && $this->totals['totalTaxR']!='0.00'){
|
||||
$this->Cell($differenz_wegen_abstand,1,'',0);
|
||||
$this->Cell_typed($differenz_wegen_abstand,1,'',0);
|
||||
|
||||
if($this->getStyleElement('kleinunternehmer')!='1'){
|
||||
|
||||
@@ -4178,17 +4185,17 @@ class Briefpapier extends SuperFPDF {
|
||||
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
{
|
||||
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,'L','L'); //1
|
||||
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,0,'L'); //1
|
||||
}
|
||||
else {
|
||||
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,'L','L');
|
||||
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$this->app->erp->GetSteuersatzErmaessigt(false,$this->id,$this->table).' %',0,0,'L');
|
||||
}
|
||||
|
||||
$this->Cell(40,3,$this->formatMoney(round((double)$this->totals['totalTaxR'],2), 2).' '.$this->waehrung,0,'L','R');
|
||||
$this->Cell_typed(40,3,$this->formatMoney(round((double)$this->totals['totalTaxR'],2), 2).' '.$this->waehrung,0,0,'R');
|
||||
} else {
|
||||
//kleinunternehmer
|
||||
$this->Cell(30,3,'',0,'L','L');
|
||||
$this->Cell(40,3,"",0,'L','R');
|
||||
$this->Cell_typed(30,3,'',0,0,'L');
|
||||
$this->Cell_typed(40,3,"",0,0,'R');
|
||||
}
|
||||
|
||||
$this->Ln();
|
||||
@@ -4203,24 +4210,24 @@ class Briefpapier extends SuperFPDF {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$this->Cell($differenz_wegen_abstand,1,'',0);
|
||||
$this->Cell_typed($differenz_wegen_abstand,1,'',0);
|
||||
|
||||
if($this->getStyleElement('kleinunternehmer')!='1'){
|
||||
if($this->app->erp->AnzeigeBelegNettoAdresse($this->anrede, $this->doctype, $projekt, $adresse,$this->id))
|
||||
//if(($this->anrede=="firma" || $this->app->erp->AnzeigeBelegNetto($this->anrede,$projekt) || $this->doctype=="bestellung" || $this->getStyleElement("immernettorechnungen",$projekt)=="1")
|
||||
// && $this->getStyleElement("immerbruttorechnungen",$projekt)!="1")
|
||||
{
|
||||
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,'L','L'); //1
|
||||
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,0,'L'); //1
|
||||
}else {
|
||||
//$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$k.' %',0,'L','L'); 09.12.2018 ab heute auskommentiert wegen 829087
|
||||
$this->Cell(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,'L','L');
|
||||
//$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_inklmwst').' '.$k.' %',0,'L','L'); 09.12.2018 ab heute auskommentiert wegen 829087
|
||||
$this->Cell_typed(30,3,$this->app->erp->Beschriftung('dokument_zzglmwst').' '.$k.' %',0,0,'L');
|
||||
}
|
||||
|
||||
$this->Cell(40,3,$this->formatMoney(round($value,2), 2).' '.$this->waehrung,0,'L','R');
|
||||
$this->Cell_typed(40,3,$this->formatMoney(round($value,2), 2).' '.$this->waehrung,0,0,'R');
|
||||
} else {
|
||||
//kleinunternehmer
|
||||
$this->Cell(30,3,'',0,'L','L');
|
||||
$this->Cell(40,3,"",0,'L','R');
|
||||
$this->Cell_typed(30,3,'',0,0,'L');
|
||||
$this->Cell_typed(40,3,"",0,0,'R');
|
||||
}
|
||||
|
||||
$this->Ln();
|
||||
@@ -4231,7 +4238,7 @@ class Briefpapier extends SuperFPDF {
|
||||
|
||||
if(!isset($this->totals['totalTaxR']) && !isset($this->totals['totalTaxV']) && !isset($this->totals['summen']) && $this->doctype!="zahlungsavis")
|
||||
{
|
||||
$this->Cell($differenz_wegen_abstand,3,'',0);
|
||||
$this->Cell_typed($differenz_wegen_abstand,3,'',0);
|
||||
|
||||
if($this->getStyleElement('kleinunternehmer')!='1')
|
||||
{
|
||||
@@ -4241,24 +4248,24 @@ class Briefpapier extends SuperFPDF {
|
||||
{
|
||||
if(!($this->ust_befreit==3 && $this->getStyleElement('steuerfrei_inland_ausblenden')=='1')) //steuerfrei inland
|
||||
{
|
||||
$this->Cell(30, 3, $this->app->erp->Beschriftung('dokument_zzglmwst') . ' 0.00 %', 0, 'L', 'L'); //1
|
||||
$this->Cell_typed(30, 3, $this->app->erp->Beschriftung('dokument_zzglmwst') . ' 0.00 %', 0, 0, 'L'); //1
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!($this->ust_befreit==3 && $this->getStyleElement('steuerfrei_inland_ausblenden')=='1')) //steuerfrei inland
|
||||
{
|
||||
$this->Cell(30, 3, $this->app->erp->Beschriftung('dokument_inklmwst') . ' 0.00 %', 0, 'L', 'L');
|
||||
$this->Cell_typed(30, 3, $this->app->erp->Beschriftung('dokument_inklmwst') . ' 0.00 %', 0, 0, 'L');
|
||||
}
|
||||
}
|
||||
|
||||
if(!($this->ust_befreit==3 && $this->getStyleElement('steuerfrei_inland_ausblenden')=='1')) //steuerfrei inland
|
||||
{
|
||||
$this->Cell(40, 3, '0,00 ' . $this->waehrung, 0, 'L', 'R');
|
||||
$this->Cell_typed(40, 3, '0,00 ' . $this->waehrung, 0, 0, 'R');
|
||||
}
|
||||
} else {
|
||||
//kleinunternehmer
|
||||
$this->Cell(30,3,'',0,'L','L');
|
||||
$this->Cell(40,3,'',0,'L','R');
|
||||
$this->Cell_typed(30,3,'',0,0,'L');
|
||||
$this->Cell_typed(40,3,'',0,0,'R');
|
||||
}
|
||||
$this->Ln();
|
||||
}
|
||||
@@ -4267,32 +4274,32 @@ class Briefpapier extends SuperFPDF {
|
||||
}
|
||||
|
||||
$this->SetFont($this->GetFont(),'B',$this->getStyleElement('schriftgroesse_gesamt'));
|
||||
$this->Cell($differenz_wegen_abstand,5,'',0);
|
||||
$this->Cell_typed($differenz_wegen_abstand,5,'',0);
|
||||
if($this->doctype=='offer'){
|
||||
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
|
||||
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
|
||||
}
|
||||
elseif($this->doctype=='creditnote'){
|
||||
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
|
||||
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
|
||||
}
|
||||
else if($this->doctype=='arbeitsnachweis'){
|
||||
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
|
||||
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
|
||||
}
|
||||
else if($this->doctype=='zahlungsavis'){
|
||||
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
|
||||
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
|
||||
}
|
||||
else{
|
||||
$this->Cell(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 'L', 'L');
|
||||
$this->Cell_typed(30, 5, $this->app->erp->Beschriftung('dokument_gesamt_total'), 0, 0, 'L');
|
||||
}
|
||||
|
||||
if($this->doctype=='arbeitsnachweis'){
|
||||
$this->Cell(40, 5, $this->totals['total'] . ' ', 0, 'L', 'R');
|
||||
$this->Cell_typed(40, 5, $this->totals['total'] . ' ', 0, 0, 'R');
|
||||
}
|
||||
else {
|
||||
if($this->getStyleElement('kleinunternehmer')!='1'){
|
||||
$this->Cell(40, 5, $this->formatMoney(round((double)$this->totals['total'], 2), 2) . ' ' . $this->waehrung, 0, 'L', 'R');
|
||||
$this->Cell_typed(40, 5, $this->formatMoney(round((double)$this->totals['total'], 2), 2) . ' ' . $this->waehrung, 0, 0, 'R');
|
||||
}
|
||||
else{
|
||||
$this->Cell(40, 5, $this->formatMoney(round((double)$this->totals['totalArticles'], 2), 2) . ' ' . $this->waehrung, 0, 'L', 'R');
|
||||
$this->Cell_typed(40, 5, $this->formatMoney(round((double)$this->totals['totalArticles'], 2), 2) . ' ' . $this->waehrung, 0, 0, 'R');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,491 +1,491 @@
|
||||
<?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 & 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 ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
if(!class_exists('BriefpapierCustom'))
|
||||
{
|
||||
class BriefpapierCustom extends Briefpapier
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class GutschriftPDF extends BriefpapierCustom {
|
||||
public $doctype;
|
||||
|
||||
function __construct($app,$projekt="")
|
||||
{
|
||||
$this->app=$app;
|
||||
//parent::Briefpapier();
|
||||
$this->doctype="gutschrift";
|
||||
$this->doctypeOrig="Gutschrift";
|
||||
parent::__construct($this->app,$projekt);
|
||||
}
|
||||
|
||||
|
||||
function GetGutschrift($id)
|
||||
{
|
||||
$this->doctypeid = $id;
|
||||
|
||||
if($this->app->erp->Firmendaten("steuerspalteausblenden")=="1")
|
||||
{
|
||||
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
|
||||
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
|
||||
if(count($check)>1)$this->ust_spalteausblende=false;
|
||||
else $this->ust_spalteausblende=true;
|
||||
}
|
||||
|
||||
$briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden');
|
||||
$briefpapier_vertrieb_ausblenden = $this->app->erp->Firmendaten('briefpapier_vertrieb_ausblenden');
|
||||
//$this->setRecipientDB($adresse);
|
||||
$this->setRecipientLieferadresse($id,"gutschrift");
|
||||
|
||||
$data = $this->app->DB->SelectRow(
|
||||
"SELECT adresse,kundennummer, sprache, rechnungid, buchhaltung, bearbeiter, vertrieb,
|
||||
lieferschein AS lieferscheinid, DATE_FORMAT(datum,'%d.%m.%Y') AS datum,
|
||||
DATE_FORMAT(lieferdatum,'%d.%m.%Y') AS lieferdatum, belegnr, freitext, ustid, ust_befreit,
|
||||
stornorechnung, keinsteuersatz, land, typ, zahlungsweise, zahlungsstatus, zahlungszieltage,
|
||||
zahlungszielskonto, projekt, waehrung, bodyzusatz,
|
||||
DATE_FORMAT(DATE_ADD(datum, INTERVAL zahlungszieltage DAY),'%d.%m.%Y') AS zahlungsdatum,
|
||||
ohne_briefpapier, ihrebestellnummer,DATE_FORMAT(datum,'%Y%m%d') as datum2, email, telefon
|
||||
FROM gutschrift WHERE id='$id' LIMIT 1"
|
||||
);
|
||||
extract($data,EXTR_OVERWRITE);
|
||||
$adresse = $data['adresse'];
|
||||
$kundennummer = $data['kundennummer'];
|
||||
$sprache = $data['sprache'];
|
||||
$rechnungid = $data['rechnungid'];
|
||||
$buchhaltung = $data['buchhaltung'];
|
||||
$email = $data['email'];
|
||||
$telefon = $data['telefon'];
|
||||
$bearbeiter = $data['bearbeiter'];
|
||||
$vertrieb = $data['vertrieb'];
|
||||
$lieferscheinid = $data['lieferscheinid'];
|
||||
$datum = $data['datum'];
|
||||
$lieferdatum = $data['lieferdatum'];
|
||||
$belegnr = $data['belegnr'];
|
||||
$freitext = $data['freitext'];
|
||||
$ustid = $data['ustid'];
|
||||
$ust_befreit = $data['ust_befreit'];
|
||||
$stornorechnung = $data['stornorechnung'];
|
||||
$keinsteuersatz = $data['keinsteuersatz'];
|
||||
$land = $data['land'];
|
||||
$typ = $data['typ'];
|
||||
$zahlungsweise = $data['zahlungsweise'];
|
||||
$zahlungszieltage = $data['zahlungszieltage'];
|
||||
|
||||
$zahlungszielskonto = $data['zahlungszielskonto'];
|
||||
$projekt = $data['projekt'];
|
||||
$waehrung = $data['waehrung'];
|
||||
$bodyzusatz = $data['bodyzusatz'];
|
||||
$zahlungsdatum = $data['zahlungsdatum'];
|
||||
$ohne_briefpapier = $data['ohne_briefpapier'];
|
||||
$ihrebestellnummer = $data['ihrebestellnummer'];
|
||||
$datum2 = $data['datum2'];
|
||||
$projektabkuerzung = $this->app->DB->Select(sprintf('SELECT abkuerzung FROM projekt WHERE id = %d', $projekt));
|
||||
$kundennummer = $this->app->DB->Select("SELECT kundennummer FROM adresse WHERE id='$adresse' LIMIT 1");
|
||||
if(empty($sprache)){
|
||||
$sprache = $this->app->DB->Select("SELECT sprache FROM adresse WHERE id='$adresse' LIMIT 1");
|
||||
}
|
||||
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1");
|
||||
$lieferscheindatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM lieferschein WHERE id = '$lieferscheinid' LIMIT 1");
|
||||
$rechnung = $this->app->DB->Select("SELECT belegnr FROM rechnung WHERE id='$rechnungid' LIMIT 1");
|
||||
$rechnungsdatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
|
||||
$auftrag = $this->app->DB->Select("SELECT auftrag FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
|
||||
|
||||
$ihrebestellnummer = $this->app->erp->ReadyForPDF($ihrebestellnummer);
|
||||
$bearbeiter = $this->app->erp->ReadyForPDF($bearbeiter);
|
||||
$vertrieb = $this->app->erp->ReadyForPDF($vertrieb);
|
||||
|
||||
$this->app->erp->BeschriftungSprache($sprache);
|
||||
if($waehrung)$this->waehrung = $waehrung;
|
||||
$this->sprache = $sprache;
|
||||
$this->projekt = $projekt;
|
||||
$this->anrede = $typ;
|
||||
|
||||
if($vertrieb==$bearbeiter && (!$briefpapier_bearbeiter_ausblenden && !$briefpapier_vertrieb_ausblenden)) $vertrieb="";
|
||||
|
||||
if($ohne_briefpapier=="1")
|
||||
{
|
||||
$this->logofile = "";
|
||||
$this->briefpapier="";
|
||||
$this->briefpapier2="";
|
||||
}
|
||||
|
||||
// $zahlungsweise = strtolower($zahlungsweise);
|
||||
|
||||
if($zahlungsweise=="lastschrift" || $zahlungsweise=="einzugsermaechtigung")
|
||||
{
|
||||
$zahlungsweisetext = "\n".$this->app->erp->Beschriftung("dokument_offene_lastschriften");
|
||||
}
|
||||
|
||||
//if($zahlungszielskonto>0) $zahlungsweisetext .= "\n".$this->app->erp->Beschriftung("dokument_skonto")." $zahlungszielskonto% ".$this->app->erp->Beschriftung("dokument_auszahlungskonditionen");
|
||||
|
||||
if($zahlungszielskonto!=0)
|
||||
$zahlungsweisetext .="\r\n".$this->app->erp->Beschriftung("dokument_skontoanderezahlungsweisen");
|
||||
|
||||
$zahlungsweisetext = str_replace('{ZAHLUNGSZIELSKONTO}',number_format($zahlungszielskonto,2,',','.'),$zahlungsweisetext);
|
||||
|
||||
if($belegnr=="" || $belegnr=="0") $belegnr = "- ".$this->app->erp->Beschriftung("dokument_entwurf");
|
||||
|
||||
|
||||
if($stornorechnung)
|
||||
$this->doctypeOrig=$this->app->erp->Beschriftung("bezeichnungstornorechnung")." $belegnr";
|
||||
else
|
||||
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_gutschrift")." $belegnr";
|
||||
|
||||
if($gutschrift=="") $gutschrift = "-";
|
||||
if($kundennummer=="") $kundennummer= "-";
|
||||
|
||||
if($auftrag=="0") $auftrag = "-";
|
||||
if($lieferschein=="0") $lieferschein= "-";
|
||||
|
||||
$bearbeiteremail = $this->app->DB->Select("SELECT b.email FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
|
||||
$bearbeitertelefon = $this->app->DB->Select("SELECT b.telefon FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
|
||||
|
||||
/** @var \Xentral\Modules\Company\Service\DocumentCustomizationService $service */
|
||||
$service = $this->app->Container->get('DocumentCustomizationService');
|
||||
if($block = $service->findActiveBlock('corr', 'credit_note', $projekt)) {
|
||||
$sCD = $service->parseBlockAsArray($this->getLanguageCodeFrom($this->sprache),'corr', 'credit_note',[
|
||||
'GUTSCHRIFTSNUMMER' => $belegnr,
|
||||
'DATUM' => $datum,
|
||||
'RECHNUNGSNUMMER' => $rechnung,
|
||||
'RECHNUNGSDATUM' => $rechnungsdatum,
|
||||
'KUNDENNUMMER' => $kundennummer,
|
||||
'BEARBEITER' => $bearbeiter,
|
||||
'BEARBEITEREMAIL' => $bearbeiteremail,
|
||||
'BEARBEITERTELEFON' => $bearbeitertelefon,
|
||||
'VERTRIEB' => $vertrieb,
|
||||
'PROJEKT' => $projektabkuerzung,
|
||||
'AUFTRAGSNUMMER' => $auftrag,
|
||||
'LIEFERSCHEINNUMMER' => $lieferschein,
|
||||
'LIEFERSCHEINDATUM' => $lieferscheindatum,
|
||||
'EMAIL' => $email,
|
||||
'TELEFON' => $telefon
|
||||
|
||||
|
||||
|
||||
], $projekt);
|
||||
if(!empty($sCD)) {
|
||||
switch($block['fontstyle']) {
|
||||
case 'f':
|
||||
$this->setBoldCorrDetails($sCD);
|
||||
break;
|
||||
case 'i':
|
||||
$this->setItalicCorrDetails($sCD);
|
||||
break;
|
||||
case 'fi':
|
||||
$this->setItalicBoldCorrDetails($sCD);
|
||||
break;
|
||||
default:
|
||||
$this->setCorrDetails($sCD, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
//$this->setCorrDetails(array("Auftrag"=>$auftrag,"Datum"=>$datum,"Ihre Kunden-Nr."=>$kundennummer,"Lieferschein"=>$lieferschein,"Buchhaltung"=>$buchhaltung));
|
||||
if($briefpapier_bearbeiter_ausblenden || $briefpapier_vertrieb_ausblenden){
|
||||
if($rechnung != ""){
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer);
|
||||
}else{
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer);
|
||||
//$this->setCorrDetails(array($this->app->erp->Beschriftung("dokument_datum")=>$datum,$this->app->erp->Beschriftung("bezeichnungkundennummer")=>$kundennummer,$this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer")=>$ihrebestellnummer));
|
||||
}
|
||||
if(!$briefpapier_bearbeiter_ausblenden){
|
||||
if($bearbeiter) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter")] = $bearbeiter;
|
||||
}elseif(!$briefpapier_vertrieb_ausblenden){
|
||||
if($vertrieb) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb")] = $vertrieb;
|
||||
}
|
||||
|
||||
}else{
|
||||
if($rechnung != "")
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
|
||||
else
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
|
||||
}
|
||||
|
||||
if($lieferdatum != "00.00.0000")
|
||||
$sCD[$this->app->erp->Beschriftung("dokument_lieferdatum")] = $lieferdatum;
|
||||
|
||||
|
||||
$this->setCorrDetails($sCD);
|
||||
}
|
||||
|
||||
if($keinsteuersatz!="1")
|
||||
{
|
||||
|
||||
if($ust_befreit==2)//$this->app->erp->Export($land))
|
||||
$steuer = $this->app->erp->Beschriftung("export_lieferung_vermerk");
|
||||
else {
|
||||
if($ust_befreit==1 && $ustid!="")//$this->app->erp->IstEU($land))
|
||||
$steuer = $this->app->erp->Beschriftung("eu_lieferung_vermerk");
|
||||
}
|
||||
$steuer = str_replace('{USTID}',$ustid,$steuer);
|
||||
$steuer = str_replace('{LAND}',$land,$steuer);
|
||||
}
|
||||
|
||||
$gutschrift_header=$this->app->erp->Beschriftung("gutschrift_header");
|
||||
if($bodyzusatz!="") $gutschrift_header=$gutschrift_header."\r\n".$bodyzusatz;
|
||||
|
||||
if($stornorechnung)
|
||||
{
|
||||
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("bezeichnungstornorechnung"),$gutschrift_header);
|
||||
} else {
|
||||
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("dokument_gutschrift"),$gutschrift_header);
|
||||
}
|
||||
|
||||
$gutschrift_header = $this->app->erp->ParseUserVars("gutschrift",$id,$gutschrift_header);
|
||||
|
||||
|
||||
if($this->app->erp->Firmendaten("footer_reihenfolge_gutschrift_aktivieren")=="1") {
|
||||
$footervorlage = $this->app->erp->Firmendaten("footer_reihenfolge_gutschrift");
|
||||
if($footervorlage=="")
|
||||
$footervorlage = "{FOOTERFREITEXT}\r\n{FOOTERTEXTVORLAGEGUTSCHRIFT}\r\n{FOOTERSTEUER}\r\n{FOOTERZAHLUNGSWEISETEXT}";
|
||||
|
||||
$footervorlage = str_replace('{FOOTERFREITEXT}',$freitext,$footervorlage);
|
||||
$footervorlage = str_replace('{FOOTERTEXTVORLAGEGUTSCHRIFT}',$this->app->erp->Beschriftung("gutschrift_footer"),$footervorlage);
|
||||
$footervorlage = str_replace('{FOOTERSTEUER}',$steuer,$footervorlage);
|
||||
$footervorlage = str_replace('{FOOTERZAHLUNGSWEISETEXT}',$zahlungsweisetext,$footervorlage);
|
||||
$footervorlage = $this->app->erp->ParseUserVars("gutschrift",$id,$footervorlage);
|
||||
$footer = $footervorlage;
|
||||
} else {
|
||||
$footer = "$freitext"."\r\n".$this->app->erp->ParseUserVars("gutschrift",$id,$this->app->erp->Beschriftung("gutschrift_footer"))."\r\n$zahlungsweisetext\r\n$steuer";
|
||||
}
|
||||
|
||||
|
||||
$this->setTextDetails(array(
|
||||
"body"=>$gutschrift_header,
|
||||
"footer"=>$footer));
|
||||
|
||||
$artikel = $this->app->DB->SelectArr("SELECT * FROM gutschrift_position WHERE gutschrift='$id' ORDER By sort");
|
||||
|
||||
if(!$this->app->erp->GutschriftMitUmsatzeuer($id)) $this->ust_befreit=true;
|
||||
|
||||
$summe_rabatt = $this->app->DB->Select("SELECT SUM(rabatt) FROM gutschrift_position WHERE gutschrift='$id'");
|
||||
if($summe_rabatt <> 0) $this->rabatt=1;
|
||||
|
||||
if($this->app->erp->Firmendaten("modul_verband")=="1") $this->rabatt=1;
|
||||
|
||||
//$waehrung = $this->app->DB->Select("SELECT waehrung FROM gutschrift_position WHERE gutschrift='$id' LIMIT 1");
|
||||
$steuersatzV = $this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift");
|
||||
$steuersatzR = $this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift");
|
||||
$gesamtsteuern = 0;
|
||||
$mitumsatzsteuer = $this->app->erp->GutschriftMitUmsatzeuer($id);
|
||||
$belege_subpositionenstuecklisten = $this->app->erp->Firmendaten('belege_subpositionenstuecklisten');
|
||||
$belege_stuecklisteneinrueckenmm = $this->app->erp->Firmendaten('belege_stuecklisteneinrueckenmm');
|
||||
//$positionenkaufmaenischrunden = $this->app->erp->Firmendaten('positionenkaufmaenischrunden');
|
||||
$positionenkaufmaenischrunden = $this->app->erp->Projektdaten($projekt,"preisberechnung");
|
||||
$viernachkommastellen_belege = $this->app->erp->Firmendaten('viernachkommastellen_belege');
|
||||
foreach($artikel as $key=>$value)
|
||||
{
|
||||
if($value['umsatzsteuer'] != "ermaessigt" && $value['umsatzsteuer'] != "befreit") $value['umsatzsteuer'] = "normal";
|
||||
$tmpsteuersatz = null;
|
||||
$tmpsteuertext = null;
|
||||
$this->app->erp->GetSteuerPosition('gutschrift', $value['id'],$tmpsteuersatz, $tmpsteuertext);
|
||||
if(is_null($value['steuersatz']) || $value['steuersatz'] < 0)
|
||||
{
|
||||
if($value['umsatzsteuer'] == "ermaessigt")
|
||||
{
|
||||
$value['steuersatz'] = $steuersatzR;
|
||||
}elseif($value['umsatzsteuer'] == "befreit")
|
||||
{
|
||||
$value['steuersatz'] = $steuersatzR;
|
||||
}else{
|
||||
$value['steuersatz'] = $steuersatzV;
|
||||
}
|
||||
if(!is_null($tmpsteuersatz))$value['steuersatz'] = $tmpsteuersatz;
|
||||
}
|
||||
if($tmpsteuertext && !$value['steuertext'])$value['steuertext'] = $tmpsteuertext;
|
||||
if(!$mitumsatzsteuer)$value['steuersatz'] = 0;
|
||||
// negative Darstellung bei Stornorechnung
|
||||
if($stornorechnung) $value['preis'] = $value['preis'] *-1;
|
||||
|
||||
if(!$this->app->erp->Export($land))
|
||||
{
|
||||
$value['zolltarifnummer']="";
|
||||
$value['herkunftsland']="";
|
||||
}
|
||||
|
||||
$value = $this->CheckPosition($value,"gutschrift",$this->doctypeid,$value['id']);
|
||||
|
||||
$value['menge'] = floatval($value['menge']);
|
||||
|
||||
if($value['explodiert_parent_artikel'] > 0)
|
||||
{
|
||||
if($belege_subpositionenstuecklisten || $belege_stuecklisteneinrueckenmm)$value['bezeichnung'] = ltrim(ltrim($value['bezeichnung'],'*'));
|
||||
if(isset($lvl) && isset($lvl[$value['explodiert_parent_artikel']]))
|
||||
{
|
||||
$value['lvl'] = $lvl[$value['explodiert_parent_artikel']] + 1;
|
||||
}else{
|
||||
$value['lvl'] = 1;
|
||||
}
|
||||
$lvl[$value['artikel']] = $value['lvl'];
|
||||
$check_ausblenden = $this->app->DB->Select("SELECT keineeinzelartikelanzeigen FROM artikel WHERE id='".$value['explodiert_parent_artikel']."' LIMIT 1");
|
||||
if(!$check_ausblenden && isset($ausblenden) && in_array($value['explodiert_parent_artikel'], $ausblenden))
|
||||
{
|
||||
$check_ausblenden = true;
|
||||
}
|
||||
if($check_ausblenden)
|
||||
{
|
||||
$ausblenden[] = $value['artikel'];
|
||||
}
|
||||
} else
|
||||
{
|
||||
$check_ausblenden=0;
|
||||
$lvl[$value['artikel']] = 0;
|
||||
$value['lvl'] = 0;
|
||||
}
|
||||
|
||||
if($value['ausblenden_im_pdf']) $check_ausblenden=1;
|
||||
|
||||
$ohne_artikeltext = $this->app->DB->Select("SELECT ohne_artikeltext FROM ".$this->table." WHERE id='".$this->id."' LIMIT 1");
|
||||
if($ohne_artikeltext=="1") $value['beschreibung']="";
|
||||
|
||||
if($check_ausblenden!=1)
|
||||
{
|
||||
$this->addItem(array('currency'=>$value['waehrung'],'lvl'=>isset($value['lvl'])?$value['lvl']:0,
|
||||
'amount'=>$value['menge'],
|
||||
'price'=>$value['preis'],
|
||||
'tax'=>$value['umsatzsteuer'],
|
||||
'steuersatz'=>$value['steuersatz'],
|
||||
'steuertext'=>$value['steuertext'],
|
||||
'itemno'=>$value['nummer'],
|
||||
'artikel'=>$value['artikel'],
|
||||
'unit'=>$value['einheit'],
|
||||
'desc'=>$value['beschreibung'],
|
||||
"name"=>ltrim($value['bezeichnung']),
|
||||
'artikelnummerkunde'=>$value['artikelnummerkunde'],
|
||||
'lieferdatum'=>$value['lieferdatum'],
|
||||
'lieferdatumkw'=>$value['lieferdatumkw'],
|
||||
'zolltarifnummer'=>$value['zolltarifnummer'],
|
||||
'herkunftsland'=>$value['herkunftsland'],
|
||||
'ohnepreis'=>$value['ohnepreis'],
|
||||
'grundrabatt'=>$value['grundrabatt'],
|
||||
'rabatt1'=>$value['rabatt1'],
|
||||
'rabatt2'=>$value['rabatt2'],
|
||||
'rabatt3'=>$value['rabatt3'],
|
||||
'rabatt4'=>$value['rabatt4'],
|
||||
'rabatt5'=>$value['rabatt5'],
|
||||
'freifeld1'=>$value['freifeld1'],
|
||||
'freifeld2'=>$value['freifeld2'],
|
||||
'freifeld3'=>$value['freifeld3'],
|
||||
'freifeld4'=>$value['freifeld4'],
|
||||
'freifeld5'=>$value['freifeld5'],
|
||||
'freifeld6'=>$value['freifeld6'],
|
||||
'freifeld7'=>$value['freifeld7'],
|
||||
'freifeld8'=>$value['freifeld8'],
|
||||
'freifeld9'=>$value['freifeld9'],
|
||||
'freifeld10'=>$value['freifeld10'],
|
||||
'freifeld11'=>$value['freifeld11'],
|
||||
'freifeld12'=>$value['freifeld12'],
|
||||
'freifeld13'=>$value['freifeld13'],
|
||||
'freifeld14'=>$value['freifeld14'],
|
||||
'freifeld15'=>$value['freifeld15'],
|
||||
'freifeld16'=>$value['freifeld16'],
|
||||
'freifeld17'=>$value['freifeld17'],
|
||||
'freifeld18'=>$value['freifeld18'],
|
||||
'freifeld19'=>$value['freifeld19'],
|
||||
'freifeld20'=>$value['freifeld20'],
|
||||
'freifeld21'=>$value['freifeld21'],
|
||||
'freifeld22'=>$value['freifeld22'],
|
||||
'freifeld23'=>$value['freifeld23'],
|
||||
'freifeld24'=>$value['freifeld24'],
|
||||
'freifeld25'=>$value['freifeld25'],
|
||||
'freifeld26'=>$value['freifeld26'],
|
||||
'freifeld27'=>$value['freifeld27'],
|
||||
'freifeld28'=>$value['freifeld28'],
|
||||
'freifeld29'=>$value['freifeld29'],
|
||||
'freifeld30'=>$value['freifeld30'],
|
||||
'freifeld31'=>$value['freifeld31'],
|
||||
'freifeld32'=>$value['freifeld32'],
|
||||
'freifeld33'=>$value['freifeld33'],
|
||||
'freifeld34'=>$value['freifeld34'],
|
||||
'freifeld35'=>$value['freifeld35'],
|
||||
'freifeld36'=>$value['freifeld36'],
|
||||
'freifeld37'=>$value['freifeld37'],
|
||||
'freifeld38'=>$value['freifeld38'],
|
||||
'freifeld39'=>$value['freifeld39'],
|
||||
'freifeld40'=>$value['freifeld40'],
|
||||
"keinrabatterlaubt"=>$value['keinrabatterlaubt'],
|
||||
"rabatt"=>$value['rabatt']));
|
||||
}
|
||||
if($positionenkaufmaenischrunden == 3){
|
||||
$netto_gesamt = $value['menge'] * round($value['preis'] - ($value['preis'] / 100 * $value['rabatt']),2);
|
||||
}else{
|
||||
$netto_gesamt = $value['menge'] * ($value['preis'] - ($value['preis'] / 100 * $value['rabatt']));
|
||||
}
|
||||
if($positionenkaufmaenischrunden)
|
||||
{
|
||||
$netto_gesamt = round($netto_gesamt, 2);
|
||||
}
|
||||
$summe = $summe + $netto_gesamt;
|
||||
if(!isset($summen[$value['steuersatz']]))$summen[$value['steuersatz']] = 0;
|
||||
$summen[$value['steuersatz']] += ($netto_gesamt/100)*$value['steuersatz'];
|
||||
$gesamtsteuern +=($netto_gesamt/100)*$value['steuersatz'];
|
||||
/*
|
||||
if($value['umsatzsteuer']=="" || $value['umsatzsteuer']=="normal")
|
||||
{
|
||||
$summeV = $summeV + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift"));
|
||||
}
|
||||
else {
|
||||
$summeR = $summeR + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift"));
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
if($positionenkaufmaenischrunden && isset($summen) && is_array($summen))
|
||||
{
|
||||
$gesamtsteuern = 0;
|
||||
foreach($summen as $k => $v)
|
||||
{
|
||||
$summen[$k] = round($v, 2);
|
||||
$gesamtsteuern += round($v, 2);
|
||||
}
|
||||
}
|
||||
if($positionenkaufmaenischrunden)
|
||||
{
|
||||
list($summe,$gesamtsumme, $summen) = $this->app->erp->steuerAusBelegPDF($this->table, $this->id);
|
||||
$gesamtsteuern = $gesamtsumme - $summe;
|
||||
}
|
||||
|
||||
/*
|
||||
$summe = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id'");
|
||||
|
||||
$summeV = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND (umsatzsteuer='normal' or umsatzsteuer='')")/100 * 19;
|
||||
$summeR = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND umsatzsteuer='ermaessigt'")/100 * 7;
|
||||
*/
|
||||
if($this->app->erp->GutschriftMitUmsatzeuer($id))
|
||||
{
|
||||
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $gesamtsteuern,"summen"=>$summen,"totalTaxV"=>0,"totalTaxR"=>0));
|
||||
//$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $summeV + $summeR,"totalTaxV"=>$summeV,"totalTaxR"=>$summeR));
|
||||
} else
|
||||
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe));
|
||||
|
||||
/* Dateiname */
|
||||
$tmp_name = str_replace(' ','',trim($this->recipient['enterprise']));
|
||||
$tmp_name = str_replace('.','',$tmp_name);
|
||||
|
||||
if($stornorechnung)
|
||||
$this->filename = $datum2."_STORNO_".$belegnr.".pdf";
|
||||
else
|
||||
$this->filename = $datum2."_GS".$belegnr.".pdf";
|
||||
|
||||
$this->setBarcode($belegnr);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
<?php
|
||||
if(!class_exists('BriefpapierCustom'))
|
||||
{
|
||||
class BriefpapierCustom extends Briefpapier
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class GutschriftPDF extends BriefpapierCustom {
|
||||
public $doctype;
|
||||
|
||||
function __construct($app,$projekt="")
|
||||
{
|
||||
$this->app=$app;
|
||||
//parent::Briefpapier();
|
||||
$this->doctype="gutschrift";
|
||||
$this->doctypeOrig="Gutschrift";
|
||||
parent::__construct($this->app,$projekt);
|
||||
}
|
||||
|
||||
|
||||
function GetGutschrift($id)
|
||||
{
|
||||
$this->doctypeid = $id;
|
||||
|
||||
if($this->app->erp->Firmendaten("steuerspalteausblenden")=="1")
|
||||
{
|
||||
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
|
||||
$check = $this->app->erp->SteuerAusBeleg($this->doctype,$id);
|
||||
if(!empty($check)?count($check):0>1)$this->ust_spalteausblende=false;
|
||||
else $this->ust_spalteausblende=true;
|
||||
}
|
||||
|
||||
$briefpapier_bearbeiter_ausblenden = $this->app->erp->Firmendaten('briefpapier_bearbeiter_ausblenden');
|
||||
$briefpapier_vertrieb_ausblenden = $this->app->erp->Firmendaten('briefpapier_vertrieb_ausblenden');
|
||||
//$this->setRecipientDB($adresse);
|
||||
$this->setRecipientLieferadresse($id,"gutschrift");
|
||||
|
||||
$data = $this->app->DB->SelectRow(
|
||||
"SELECT adresse,kundennummer, sprache, rechnungid, buchhaltung, bearbeiter, vertrieb,
|
||||
lieferschein AS lieferscheinid, DATE_FORMAT(datum,'%d.%m.%Y') AS datum,
|
||||
DATE_FORMAT(lieferdatum,'%d.%m.%Y') AS lieferdatum, belegnr, freitext, ustid, ust_befreit,
|
||||
stornorechnung, keinsteuersatz, land, typ, zahlungsweise, zahlungsstatus, zahlungszieltage,
|
||||
zahlungszielskonto, projekt, waehrung, bodyzusatz,
|
||||
DATE_FORMAT(DATE_ADD(datum, INTERVAL zahlungszieltage DAY),'%d.%m.%Y') AS zahlungsdatum,
|
||||
ohne_briefpapier, ihrebestellnummer,DATE_FORMAT(datum,'%Y%m%d') as datum2, email, telefon
|
||||
FROM gutschrift WHERE id='$id' LIMIT 1"
|
||||
);
|
||||
extract($data,EXTR_OVERWRITE);
|
||||
$adresse = $data['adresse'];
|
||||
$kundennummer = $data['kundennummer'];
|
||||
$sprache = $data['sprache'];
|
||||
$rechnungid = $data['rechnungid'];
|
||||
$buchhaltung = $data['buchhaltung'];
|
||||
$email = $data['email'];
|
||||
$telefon = $data['telefon'];
|
||||
$bearbeiter = $data['bearbeiter'];
|
||||
$vertrieb = $data['vertrieb'];
|
||||
$lieferscheinid = $data['lieferscheinid'];
|
||||
$datum = $data['datum'];
|
||||
$lieferdatum = $data['lieferdatum'];
|
||||
$belegnr = $data['belegnr'];
|
||||
$freitext = $data['freitext'];
|
||||
$ustid = $data['ustid'];
|
||||
$ust_befreit = $data['ust_befreit'];
|
||||
$stornorechnung = $data['stornorechnung'];
|
||||
$keinsteuersatz = $data['keinsteuersatz'];
|
||||
$land = $data['land'];
|
||||
$typ = $data['typ'];
|
||||
$zahlungsweise = $data['zahlungsweise'];
|
||||
$zahlungszieltage = $data['zahlungszieltage'];
|
||||
|
||||
$zahlungszielskonto = $data['zahlungszielskonto'];
|
||||
$projekt = $data['projekt'];
|
||||
$waehrung = $data['waehrung'];
|
||||
$bodyzusatz = $data['bodyzusatz'];
|
||||
$zahlungsdatum = $data['zahlungsdatum'];
|
||||
$ohne_briefpapier = $data['ohne_briefpapier'];
|
||||
$ihrebestellnummer = $data['ihrebestellnummer'];
|
||||
$datum2 = $data['datum2'];
|
||||
$projektabkuerzung = $this->app->DB->Select(sprintf('SELECT abkuerzung FROM projekt WHERE id = %d', $projekt));
|
||||
$kundennummer = $this->app->DB->Select("SELECT kundennummer FROM adresse WHERE id='$adresse' LIMIT 1");
|
||||
if(empty($sprache)){
|
||||
$sprache = $this->app->DB->Select("SELECT sprache FROM adresse WHERE id='$adresse' LIMIT 1");
|
||||
}
|
||||
$lieferschein = $this->app->DB->Select("SELECT belegnr FROM lieferschein WHERE id='$lieferscheinid' LIMIT 1");
|
||||
$lieferscheindatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM lieferschein WHERE id = '$lieferscheinid' LIMIT 1");
|
||||
$rechnung = $this->app->DB->Select("SELECT belegnr FROM rechnung WHERE id='$rechnungid' LIMIT 1");
|
||||
$rechnungsdatum = $this->app->DB->Select("SELECT DATE_FORMAT(datum, '%d.%m.%Y') AS datum FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
|
||||
$auftrag = $this->app->DB->Select("SELECT auftrag FROM rechnung WHERE id = '$rechnungid' LIMIT 1");
|
||||
|
||||
$ihrebestellnummer = $this->app->erp->ReadyForPDF($ihrebestellnummer);
|
||||
$bearbeiter = $this->app->erp->ReadyForPDF($bearbeiter);
|
||||
$vertrieb = $this->app->erp->ReadyForPDF($vertrieb);
|
||||
|
||||
$this->app->erp->BeschriftungSprache($sprache);
|
||||
if($waehrung)$this->waehrung = $waehrung;
|
||||
$this->sprache = $sprache;
|
||||
$this->projekt = $projekt;
|
||||
$this->anrede = $typ;
|
||||
|
||||
if($vertrieb==$bearbeiter && (!$briefpapier_bearbeiter_ausblenden && !$briefpapier_vertrieb_ausblenden)) $vertrieb="";
|
||||
|
||||
if($ohne_briefpapier=="1")
|
||||
{
|
||||
$this->logofile = "";
|
||||
$this->briefpapier="";
|
||||
$this->briefpapier2="";
|
||||
}
|
||||
|
||||
// $zahlungsweise = strtolower($zahlungsweise);
|
||||
|
||||
if($zahlungsweise=="lastschrift" || $zahlungsweise=="einzugsermaechtigung")
|
||||
{
|
||||
$zahlungsweisetext = "\n".$this->app->erp->Beschriftung("dokument_offene_lastschriften");
|
||||
}
|
||||
|
||||
//if($zahlungszielskonto>0) $zahlungsweisetext .= "\n".$this->app->erp->Beschriftung("dokument_skonto")." $zahlungszielskonto% ".$this->app->erp->Beschriftung("dokument_auszahlungskonditionen");
|
||||
|
||||
if($zahlungszielskonto!=0)
|
||||
$zahlungsweisetext .="\r\n".$this->app->erp->Beschriftung("dokument_skontoanderezahlungsweisen");
|
||||
|
||||
$zahlungsweisetext = str_replace('{ZAHLUNGSZIELSKONTO}',number_format($zahlungszielskonto,2,',','.'),$zahlungsweisetext);
|
||||
|
||||
if($belegnr=="" || $belegnr=="0") $belegnr = "- ".$this->app->erp->Beschriftung("dokument_entwurf");
|
||||
|
||||
|
||||
if($stornorechnung)
|
||||
$this->doctypeOrig=$this->app->erp->Beschriftung("bezeichnungstornorechnung")." $belegnr";
|
||||
else
|
||||
$this->doctypeOrig=$this->app->erp->Beschriftung("dokument_gutschrift")." $belegnr";
|
||||
|
||||
if($gutschrift=="") $gutschrift = "-";
|
||||
if($kundennummer=="") $kundennummer= "-";
|
||||
|
||||
if($auftrag=="0") $auftrag = "-";
|
||||
if($lieferschein=="0") $lieferschein= "-";
|
||||
|
||||
$bearbeiteremail = $this->app->DB->Select("SELECT b.email FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
|
||||
$bearbeitertelefon = $this->app->DB->Select("SELECT b.telefon FROM gutschrift g LEFT JOIN adresse b ON b.id=g.bearbeiterid WHERE g.id='$id' LIMIT 1");
|
||||
|
||||
/** @var \Xentral\Modules\Company\Service\DocumentCustomizationService $service */
|
||||
$service = $this->app->Container->get('DocumentCustomizationService');
|
||||
if($block = $service->findActiveBlock('corr', 'credit_note', $projekt)) {
|
||||
$sCD = $service->parseBlockAsArray($this->getLanguageCodeFrom($this->sprache),'corr', 'credit_note',[
|
||||
'GUTSCHRIFTSNUMMER' => $belegnr,
|
||||
'DATUM' => $datum,
|
||||
'RECHNUNGSNUMMER' => $rechnung,
|
||||
'RECHNUNGSDATUM' => $rechnungsdatum,
|
||||
'KUNDENNUMMER' => $kundennummer,
|
||||
'BEARBEITER' => $bearbeiter,
|
||||
'BEARBEITEREMAIL' => $bearbeiteremail,
|
||||
'BEARBEITERTELEFON' => $bearbeitertelefon,
|
||||
'VERTRIEB' => $vertrieb,
|
||||
'PROJEKT' => $projektabkuerzung,
|
||||
'AUFTRAGSNUMMER' => $auftrag,
|
||||
'LIEFERSCHEINNUMMER' => $lieferschein,
|
||||
'LIEFERSCHEINDATUM' => $lieferscheindatum,
|
||||
'EMAIL' => $email,
|
||||
'TELEFON' => $telefon
|
||||
|
||||
|
||||
|
||||
], $projekt);
|
||||
if(!empty($sCD)) {
|
||||
switch($block['fontstyle']) {
|
||||
case 'f':
|
||||
$this->setBoldCorrDetails($sCD);
|
||||
break;
|
||||
case 'i':
|
||||
$this->setItalicCorrDetails($sCD);
|
||||
break;
|
||||
case 'fi':
|
||||
$this->setItalicBoldCorrDetails($sCD);
|
||||
break;
|
||||
default:
|
||||
$this->setCorrDetails($sCD, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
//$this->setCorrDetails(array("Auftrag"=>$auftrag,"Datum"=>$datum,"Ihre Kunden-Nr."=>$kundennummer,"Lieferschein"=>$lieferschein,"Buchhaltung"=>$buchhaltung));
|
||||
if($briefpapier_bearbeiter_ausblenden || $briefpapier_vertrieb_ausblenden){
|
||||
if($rechnung != ""){
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer);
|
||||
}else{
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer);
|
||||
//$this->setCorrDetails(array($this->app->erp->Beschriftung("dokument_datum")=>$datum,$this->app->erp->Beschriftung("bezeichnungkundennummer")=>$kundennummer,$this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer")=>$ihrebestellnummer));
|
||||
}
|
||||
if(!$briefpapier_bearbeiter_ausblenden){
|
||||
if($bearbeiter) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter")] = $bearbeiter;
|
||||
}elseif(!$briefpapier_vertrieb_ausblenden){
|
||||
if($vertrieb) $sCD[$this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb")] = $vertrieb;
|
||||
}
|
||||
|
||||
}else{
|
||||
if($rechnung != "")
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_rechnung") => $rechnung, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
|
||||
else
|
||||
$sCD = array($this->app->erp->Beschriftung("dokument_datum") => $datum, $this->app->erp->Beschriftung("bezeichnungkundennummer") => $kundennummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bestellnummer") => $ihrebestellnummer, $this->app->erp->Beschriftung("auftrag_bezeichnung_bearbeiter") => $bearbeiter, $this->app->erp->Beschriftung("auftrag_bezeichnung_vertrieb") => $vertrieb);
|
||||
}
|
||||
|
||||
if($lieferdatum != "00.00.0000")
|
||||
$sCD[$this->app->erp->Beschriftung("dokument_lieferdatum")] = $lieferdatum;
|
||||
|
||||
|
||||
$this->setCorrDetails($sCD);
|
||||
}
|
||||
|
||||
if($keinsteuersatz!="1")
|
||||
{
|
||||
|
||||
if($ust_befreit==2)//$this->app->erp->Export($land))
|
||||
$steuer = $this->app->erp->Beschriftung("export_lieferung_vermerk");
|
||||
else {
|
||||
if($ust_befreit==1 && $ustid!="")//$this->app->erp->IstEU($land))
|
||||
$steuer = $this->app->erp->Beschriftung("eu_lieferung_vermerk");
|
||||
}
|
||||
$steuer = str_replace('{USTID}',$ustid,$steuer);
|
||||
$steuer = str_replace('{LAND}',$land,$steuer);
|
||||
}
|
||||
|
||||
$gutschrift_header=$this->app->erp->Beschriftung("gutschrift_header");
|
||||
if($bodyzusatz!="") $gutschrift_header=$gutschrift_header."\r\n".$bodyzusatz;
|
||||
|
||||
if($stornorechnung)
|
||||
{
|
||||
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("bezeichnungstornorechnung"),$gutschrift_header);
|
||||
} else {
|
||||
$gutschrift_header = str_replace('{ART}',$this->app->erp->Beschriftung("dokument_gutschrift"),$gutschrift_header);
|
||||
}
|
||||
|
||||
$gutschrift_header = $this->app->erp->ParseUserVars("gutschrift",$id,$gutschrift_header);
|
||||
|
||||
|
||||
if($this->app->erp->Firmendaten("footer_reihenfolge_gutschrift_aktivieren")=="1") {
|
||||
$footervorlage = $this->app->erp->Firmendaten("footer_reihenfolge_gutschrift");
|
||||
if($footervorlage=="")
|
||||
$footervorlage = "{FOOTERFREITEXT}\r\n{FOOTERTEXTVORLAGEGUTSCHRIFT}\r\n{FOOTERSTEUER}\r\n{FOOTERZAHLUNGSWEISETEXT}";
|
||||
|
||||
$footervorlage = str_replace('{FOOTERFREITEXT}',$freitext,$footervorlage);
|
||||
$footervorlage = str_replace('{FOOTERTEXTVORLAGEGUTSCHRIFT}',$this->app->erp->Beschriftung("gutschrift_footer"),$footervorlage);
|
||||
$footervorlage = str_replace('{FOOTERSTEUER}',$steuer,$footervorlage);
|
||||
$footervorlage = str_replace('{FOOTERZAHLUNGSWEISETEXT}',$zahlungsweisetext,$footervorlage);
|
||||
$footervorlage = $this->app->erp->ParseUserVars("gutschrift",$id,$footervorlage);
|
||||
$footer = $footervorlage;
|
||||
} else {
|
||||
$footer = "$freitext"."\r\n".$this->app->erp->ParseUserVars("gutschrift",$id,$this->app->erp->Beschriftung("gutschrift_footer"))."\r\n$zahlungsweisetext\r\n$steuer";
|
||||
}
|
||||
|
||||
|
||||
$this->setTextDetails(array(
|
||||
"body"=>$gutschrift_header,
|
||||
"footer"=>$footer));
|
||||
|
||||
$artikel = $this->app->DB->SelectArr("SELECT * FROM gutschrift_position WHERE gutschrift='$id' ORDER By sort");
|
||||
|
||||
if(!$this->app->erp->GutschriftMitUmsatzeuer($id)) $this->ust_befreit=true;
|
||||
|
||||
$summe_rabatt = $this->app->DB->Select("SELECT SUM(rabatt) FROM gutschrift_position WHERE gutschrift='$id'");
|
||||
if($summe_rabatt <> 0) $this->rabatt=1;
|
||||
|
||||
if($this->app->erp->Firmendaten("modul_verband")=="1") $this->rabatt=1;
|
||||
|
||||
//$waehrung = $this->app->DB->Select("SELECT waehrung FROM gutschrift_position WHERE gutschrift='$id' LIMIT 1");
|
||||
$steuersatzV = $this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift");
|
||||
$steuersatzR = $this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift");
|
||||
$gesamtsteuern = 0;
|
||||
$mitumsatzsteuer = $this->app->erp->GutschriftMitUmsatzeuer($id);
|
||||
$belege_subpositionenstuecklisten = $this->app->erp->Firmendaten('belege_subpositionenstuecklisten');
|
||||
$belege_stuecklisteneinrueckenmm = $this->app->erp->Firmendaten('belege_stuecklisteneinrueckenmm');
|
||||
//$positionenkaufmaenischrunden = $this->app->erp->Firmendaten('positionenkaufmaenischrunden');
|
||||
$positionenkaufmaenischrunden = $this->app->erp->Projektdaten($projekt,"preisberechnung");
|
||||
$viernachkommastellen_belege = $this->app->erp->Firmendaten('viernachkommastellen_belege');
|
||||
foreach($artikel as $key=>$value)
|
||||
{
|
||||
if($value['umsatzsteuer'] != "ermaessigt" && $value['umsatzsteuer'] != "befreit") $value['umsatzsteuer'] = "normal";
|
||||
$tmpsteuersatz = null;
|
||||
$tmpsteuertext = null;
|
||||
$this->app->erp->GetSteuerPosition('gutschrift', $value['id'],$tmpsteuersatz, $tmpsteuertext);
|
||||
if(is_null($value['steuersatz']) || $value['steuersatz'] < 0)
|
||||
{
|
||||
if($value['umsatzsteuer'] == "ermaessigt")
|
||||
{
|
||||
$value['steuersatz'] = $steuersatzR;
|
||||
}elseif($value['umsatzsteuer'] == "befreit")
|
||||
{
|
||||
$value['steuersatz'] = $steuersatzR;
|
||||
}else{
|
||||
$value['steuersatz'] = $steuersatzV;
|
||||
}
|
||||
if(!is_null($tmpsteuersatz))$value['steuersatz'] = $tmpsteuersatz;
|
||||
}
|
||||
if($tmpsteuertext && !$value['steuertext'])$value['steuertext'] = $tmpsteuertext;
|
||||
if(!$mitumsatzsteuer)$value['steuersatz'] = 0;
|
||||
// negative Darstellung bei Stornorechnung
|
||||
if($stornorechnung) $value['preis'] = $value['preis'] *-1;
|
||||
|
||||
if(!$this->app->erp->Export($land))
|
||||
{
|
||||
$value['zolltarifnummer']="";
|
||||
$value['herkunftsland']="";
|
||||
}
|
||||
|
||||
$value = $this->CheckPosition($value,"gutschrift",$this->doctypeid,$value['id']);
|
||||
|
||||
$value['menge'] = floatval($value['menge']);
|
||||
|
||||
if($value['explodiert_parent_artikel'] > 0)
|
||||
{
|
||||
if($belege_subpositionenstuecklisten || $belege_stuecklisteneinrueckenmm)$value['bezeichnung'] = ltrim(ltrim($value['bezeichnung'],'*'));
|
||||
if(isset($lvl) && isset($lvl[$value['explodiert_parent_artikel']]))
|
||||
{
|
||||
$value['lvl'] = $lvl[$value['explodiert_parent_artikel']] + 1;
|
||||
}else{
|
||||
$value['lvl'] = 1;
|
||||
}
|
||||
$lvl[$value['artikel']] = $value['lvl'];
|
||||
$check_ausblenden = $this->app->DB->Select("SELECT keineeinzelartikelanzeigen FROM artikel WHERE id='".$value['explodiert_parent_artikel']."' LIMIT 1");
|
||||
if(!$check_ausblenden && isset($ausblenden) && in_array($value['explodiert_parent_artikel'], $ausblenden))
|
||||
{
|
||||
$check_ausblenden = true;
|
||||
}
|
||||
if($check_ausblenden)
|
||||
{
|
||||
$ausblenden[] = $value['artikel'];
|
||||
}
|
||||
} else
|
||||
{
|
||||
$check_ausblenden=0;
|
||||
$lvl[$value['artikel']] = 0;
|
||||
$value['lvl'] = 0;
|
||||
}
|
||||
|
||||
if($value['ausblenden_im_pdf']) $check_ausblenden=1;
|
||||
|
||||
$ohne_artikeltext = $this->app->DB->Select("SELECT ohne_artikeltext FROM ".$this->table." WHERE id='".$this->id."' LIMIT 1");
|
||||
if($ohne_artikeltext=="1") $value['beschreibung']="";
|
||||
|
||||
if($check_ausblenden!=1)
|
||||
{
|
||||
$this->addItem(array('currency'=>$value['waehrung'],'lvl'=>isset($value['lvl'])?$value['lvl']:0,
|
||||
'amount'=>$value['menge'],
|
||||
'price'=>$value['preis'],
|
||||
'tax'=>$value['umsatzsteuer'],
|
||||
'steuersatz'=>$value['steuersatz'],
|
||||
'steuertext'=>$value['steuertext'],
|
||||
'itemno'=>$value['nummer'],
|
||||
'artikel'=>$value['artikel'],
|
||||
'unit'=>$value['einheit'],
|
||||
'desc'=>$value['beschreibung'],
|
||||
"name"=>ltrim($value['bezeichnung']),
|
||||
'artikelnummerkunde'=>$value['artikelnummerkunde'],
|
||||
'lieferdatum'=>$value['lieferdatum'],
|
||||
'lieferdatumkw'=>$value['lieferdatumkw'],
|
||||
'zolltarifnummer'=>$value['zolltarifnummer'],
|
||||
'herkunftsland'=>$value['herkunftsland'],
|
||||
'ohnepreis'=>$value['ohnepreis'],
|
||||
'grundrabatt'=>$value['grundrabatt'],
|
||||
'rabatt1'=>$value['rabatt1'],
|
||||
'rabatt2'=>$value['rabatt2'],
|
||||
'rabatt3'=>$value['rabatt3'],
|
||||
'rabatt4'=>$value['rabatt4'],
|
||||
'rabatt5'=>$value['rabatt5'],
|
||||
'freifeld1'=>$value['freifeld1'],
|
||||
'freifeld2'=>$value['freifeld2'],
|
||||
'freifeld3'=>$value['freifeld3'],
|
||||
'freifeld4'=>$value['freifeld4'],
|
||||
'freifeld5'=>$value['freifeld5'],
|
||||
'freifeld6'=>$value['freifeld6'],
|
||||
'freifeld7'=>$value['freifeld7'],
|
||||
'freifeld8'=>$value['freifeld8'],
|
||||
'freifeld9'=>$value['freifeld9'],
|
||||
'freifeld10'=>$value['freifeld10'],
|
||||
'freifeld11'=>$value['freifeld11'],
|
||||
'freifeld12'=>$value['freifeld12'],
|
||||
'freifeld13'=>$value['freifeld13'],
|
||||
'freifeld14'=>$value['freifeld14'],
|
||||
'freifeld15'=>$value['freifeld15'],
|
||||
'freifeld16'=>$value['freifeld16'],
|
||||
'freifeld17'=>$value['freifeld17'],
|
||||
'freifeld18'=>$value['freifeld18'],
|
||||
'freifeld19'=>$value['freifeld19'],
|
||||
'freifeld20'=>$value['freifeld20'],
|
||||
'freifeld21'=>$value['freifeld21'],
|
||||
'freifeld22'=>$value['freifeld22'],
|
||||
'freifeld23'=>$value['freifeld23'],
|
||||
'freifeld24'=>$value['freifeld24'],
|
||||
'freifeld25'=>$value['freifeld25'],
|
||||
'freifeld26'=>$value['freifeld26'],
|
||||
'freifeld27'=>$value['freifeld27'],
|
||||
'freifeld28'=>$value['freifeld28'],
|
||||
'freifeld29'=>$value['freifeld29'],
|
||||
'freifeld30'=>$value['freifeld30'],
|
||||
'freifeld31'=>$value['freifeld31'],
|
||||
'freifeld32'=>$value['freifeld32'],
|
||||
'freifeld33'=>$value['freifeld33'],
|
||||
'freifeld34'=>$value['freifeld34'],
|
||||
'freifeld35'=>$value['freifeld35'],
|
||||
'freifeld36'=>$value['freifeld36'],
|
||||
'freifeld37'=>$value['freifeld37'],
|
||||
'freifeld38'=>$value['freifeld38'],
|
||||
'freifeld39'=>$value['freifeld39'],
|
||||
'freifeld40'=>$value['freifeld40'],
|
||||
"keinrabatterlaubt"=>$value['keinrabatterlaubt'],
|
||||
"rabatt"=>$value['rabatt']));
|
||||
}
|
||||
if($positionenkaufmaenischrunden == 3){
|
||||
$netto_gesamt = $value['menge'] * round($value['preis'] - ($value['preis'] / 100 * $value['rabatt']),2);
|
||||
}else{
|
||||
$netto_gesamt = $value['menge'] * ($value['preis'] - ($value['preis'] / 100 * $value['rabatt']));
|
||||
}
|
||||
if($positionenkaufmaenischrunden)
|
||||
{
|
||||
$netto_gesamt = round($netto_gesamt, 2);
|
||||
}
|
||||
$summe = $summe + $netto_gesamt;
|
||||
if(!isset($summen[$value['steuersatz']]))$summen[$value['steuersatz']] = 0;
|
||||
$summen[$value['steuersatz']] += ($netto_gesamt/100)*$value['steuersatz'];
|
||||
$gesamtsteuern +=($netto_gesamt/100)*$value['steuersatz'];
|
||||
/*
|
||||
if($value['umsatzsteuer']=="" || $value['umsatzsteuer']=="normal")
|
||||
{
|
||||
$summeV = $summeV + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzNormal(false,$id,"gutschrift"));
|
||||
}
|
||||
else {
|
||||
$summeR = $summeR + (($netto_gesamt/100)*$this->app->erp->GetSteuersatzErmaessigt(false,$id,"gutschrift"));
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
if($positionenkaufmaenischrunden && isset($summen) && is_array($summen))
|
||||
{
|
||||
$gesamtsteuern = 0;
|
||||
foreach($summen as $k => $v)
|
||||
{
|
||||
$summen[$k] = round($v, 2);
|
||||
$gesamtsteuern += round($v, 2);
|
||||
}
|
||||
}
|
||||
if($positionenkaufmaenischrunden)
|
||||
{
|
||||
list($summe,$gesamtsumme, $summen) = $this->app->erp->steuerAusBelegPDF($this->table, $this->id);
|
||||
$gesamtsteuern = $gesamtsumme - $summe;
|
||||
}
|
||||
|
||||
/*
|
||||
$summe = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id'");
|
||||
|
||||
$summeV = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND (umsatzsteuer='normal' or umsatzsteuer='')")/100 * 19;
|
||||
$summeR = $this->app->DB->Select("SELECT SUM(menge*preis) FROM gutschrift_position WHERE gutschrift='$id' AND umsatzsteuer='ermaessigt'")/100 * 7;
|
||||
*/
|
||||
if($this->app->erp->GutschriftMitUmsatzeuer($id))
|
||||
{
|
||||
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $gesamtsteuern,"summen"=>$summen,"totalTaxV"=>0,"totalTaxR"=>0));
|
||||
//$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe + $summeV + $summeR,"totalTaxV"=>$summeV,"totalTaxR"=>$summeR));
|
||||
} else
|
||||
$this->setTotals(array("totalArticles"=>$summe,"total"=>$summe));
|
||||
|
||||
/* Dateiname */
|
||||
$tmp_name = str_replace(' ','',trim($this->recipient['enterprise']));
|
||||
$tmp_name = str_replace('.','',$tmp_name);
|
||||
|
||||
if($stornorechnung)
|
||||
$this->filename = $datum2."_STORNO_".$belegnr.".pdf";
|
||||
else
|
||||
$this->filename = $datum2."_GS".$belegnr.".pdf";
|
||||
|
||||
$this->setBarcode($belegnr);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ class RechnungPDF extends BriefpapierCustom {
|
||||
{
|
||||
// pruefe ob es mehr als ein steuersatz gibt // wenn ja dann darf man sie nicht ausblenden
|
||||
$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;
|
||||
}
|
||||
$lvl = null;
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1289,7 +1289,7 @@ class Ajax {
|
||||
}
|
||||
break;
|
||||
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;
|
||||
for($i = 0; $i < $carr; $i++) {
|
||||
$newarr[] = "{$arr[$i]['result']}";
|
||||
|
||||
+20
-7
@@ -288,9 +288,15 @@ class Artikel extends GenArtikel {
|
||||
case 'lieferantartikelpreise':
|
||||
$id = (int)$this->app->Secure->GetGET('id');
|
||||
$allowed['artikel'] = array('profisuche');
|
||||
// alle artikel die ein Kunde kaufen kann mit preisen netto brutto
|
||||
$cmd = $this->app->Secure->GetGET('smodule');
|
||||
$adresse = $this->app->DB->Select("SELECT adresse FROM {$cmd} WHERE id='$id' LIMIT 1");
|
||||
|
||||
$cmd = $this->app->Secure->GetGET('cmd');
|
||||
$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
|
||||
$heading = array('', 'Nummer', 'Artikel', 'Ab', 'Preis', 'Lager', 'Res.', 'Menge', 'Projekt', 'Menü');
|
||||
@@ -340,8 +346,15 @@ class Artikel extends GenArtikel {
|
||||
}
|
||||
|
||||
// alle artikel die ein Kunde kaufen kann mit preisen netto brutto
|
||||
$cmd = $this->app->Secure->GetGET('smodule');
|
||||
$adresse = $this->app->DB->Select(sprintf('SELECT adresse FROM `%s` WHERE id=%d LIMIT 1',$cmd,$id));
|
||||
$cmd = $this->app->Secure->GetGET('cmd');
|
||||
$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');
|
||||
if ($sEcho === 1) {
|
||||
@@ -3145,12 +3158,12 @@ class Artikel extends GenArtikel {
|
||||
$vpe = '';
|
||||
|
||||
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){
|
||||
$projekt = $this->app->DB->Select("SELECT projekt FROM {$cmd} WHERE id='$id' LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
if($waehrung==''){
|
||||
$waehrung = $this->app->DB->Select("SELECT waehrung FROM {$cmd} WHERE id='$id' LIMIT 1");
|
||||
|
||||
+295
-7
@@ -40,6 +40,7 @@ class Auftrag extends GenAuftrag
|
||||
*/
|
||||
public function TableSearch($app, $name, $erlaubtevars)
|
||||
{
|
||||
|
||||
switch($name)
|
||||
{
|
||||
case 'auftraege':
|
||||
@@ -661,7 +662,7 @@ class Auftrag extends GenAuftrag
|
||||
$menu .= "</a>";
|
||||
|
||||
$moreinfo = true; // Minidetail active
|
||||
$menucol = 9; // For minidetail
|
||||
$menucol = 11; // For minidetail
|
||||
|
||||
break;
|
||||
case 'auftraegeoffeneautowartend':
|
||||
@@ -707,10 +708,162 @@ class Auftrag extends GenAuftrag
|
||||
$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 .= "</a>";
|
||||
$menucol = 9; // For moredata
|
||||
$menucol = 11; // For moredata
|
||||
|
||||
|
||||
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üngliches Lieferdatum','Kunde','Auftrag','Position','ArtikelNr.','Artikel','Menge','Auftragsvolumen','Lagermenge','Monitor','Menü');
|
||||
// $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 = [];
|
||||
@@ -765,7 +918,7 @@ class Auftrag extends GenAuftrag
|
||||
$this->app->ActionHandler("rechnung","AuftragRechnung");
|
||||
$this->app->ActionHandler("lieferschein","AuftragLieferschein");
|
||||
$this->app->ActionHandler("lieferscheinrechnung","AuftragLieferscheinRechnung");
|
||||
|
||||
$this->app->ActionHandler("teillieferung","AuftragTeillieferung");
|
||||
$this->app->ActionHandler("nachlieferung","AuftragNachlieferung");
|
||||
// $this->app->ActionHandler("versand","AuftragVersand");
|
||||
$this->app->ActionHandler("freigabe","AuftragFreigabe");
|
||||
@@ -798,6 +951,8 @@ class Auftrag extends GenAuftrag
|
||||
$this->app->ActionHandler("steuer", "AuftragSteuer");
|
||||
$this->app->ActionHandler("berechnen", "Auftraegeberechnen");
|
||||
|
||||
$this->app->ActionHandler("offene", "AuftragOffenePositionen");
|
||||
|
||||
$this->app->DefaultActionHandler("list");
|
||||
|
||||
$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");
|
||||
//$art = $this->app->DB->Select("SELECT art FROM auftrag WHERE id='$id' LIMIT 1");
|
||||
$alleartikelreservieren = '';
|
||||
$teillieferungen = '';
|
||||
|
||||
if ($status==='angelegt' || $status==='freigegeben') {
|
||||
$teillieferungen = '<option value="teillieferung">Teilauftrag erstellen</option>';
|
||||
}
|
||||
|
||||
if($status==='freigegeben') {
|
||||
$alleartikelreservieren = "<option value=\"reservieren\">alle Artikel reservieren</option>";
|
||||
|
||||
@@ -1369,9 +1528,14 @@ class Auftrag extends GenAuftrag
|
||||
{
|
||||
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 '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 '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 '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 '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;
|
||||
@@ -6128,6 +6292,7 @@ Die Gesamtsumme stimmt nicht mehr mit ursprünglich festgelegten Betrag '.
|
||||
|
||||
$this->app->erp->MenuEintrag('index.php?module=auftrag&action=list','Übersicht');
|
||||
$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');
|
||||
|
||||
if(strlen($backurl)>5){
|
||||
@@ -7004,4 +7169,127 @@ Die Gesamtsumme stimmt nicht mehr mit ursprünglich festgelegten Betrag '.
|
||||
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ü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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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> <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ä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", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=bestellvorschlag&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurü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ö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ück zur Ü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 ü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']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +1,35 @@
|
||||
<!-- 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">
|
||||
<div class="info">Teillieferung: Auswahl der Artikel für eine Teillieferung. Bestimmen Sie welche Artikel als Teillieferung vorab versendet werden sollen,<br>
|
||||
und wann die Rechnung versendet wird (bei aktueller oder nächster Lieferung).</div>
|
||||
<br>
|
||||
<form action="" method="post">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- tab view schließen -->
|
||||
<div id="tabs-1">
|
||||
<div class="info">[INFOTEXT]</div>
|
||||
<br>
|
||||
<form action="" method="post">
|
||||
[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>
|
||||
[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>
|
||||
</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ü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ü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" /> alle markieren
|
||||
</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,5 @@
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
@@ -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>
|
||||
|
||||
@@ -1059,6 +1059,30 @@
|
||||
<!--<tr>
|
||||
<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>
|
||||
<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änge (4-8):</td>
|
||||
<td>
|
||||
<input type="text" name="buchhaltung_sachkontenlaenge" size="10" value="[BUCHHALTUNG_SACHKONTENLAENGE]">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<li><a href="#tabs-3">{|Zeiterfassung|}</a></li>
|
||||
<li><a href="#tabs-4">{|Wiedervorlagen|}</a></li>
|
||||
<li><a href="#tabs-5">{|Notizen|}</a></li>
|
||||
<li><a href="#tabs-6">{|Kontorahmen|}</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="tabs-1">
|
||||
@@ -503,4 +504,51 @@
|
||||
</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ö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>
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
<tr><td colspan="99"> </td></tr>
|
||||
<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=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%"> </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 align="center">
|
||||
<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> </td>
|
||||
<!--<td><a href="index.php?module=shopexport&action=list">Export<br>(Online-Shop)</a></td>-->
|
||||
</tr>
|
||||
<!--<tr><td colspan="4"><br></td></tr>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,333 +1,30 @@
|
||||
<!-- gehort zu tabview -->
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT]</a></li>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<!-- ende gehort zu tabview -->
|
||||
|
||||
<!-- erstes tab -->
|
||||
<form method="post">
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
|
||||
[TAB1]
|
||||
|
||||
<fieldset>
|
||||
<legend>{|Stapelverarbeitung|}</legend>
|
||||
<input type="checkbox" id="auswahlalle" onchange="kontorahmenmarkieren();" /> {|alle markieren|}
|
||||
<input type="submit" class="btnBlue" name="loeschen" id="loeschen" value="Alle markierten löschen" />
|
||||
</fieldset>
|
||||
|
||||
|
||||
<!--<fieldset>
|
||||
<legend>Anlegen</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="40">Konto:</td><td width="170"><input type="text" name="konto" id="konto"></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ö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ö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>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-1">
|
||||
<form action="#tabs-1" id="frmauto" name="frmauto" method="post">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
<fieldset>
|
||||
<table>
|
||||
<legend>Stapelverarbeitung</legend>
|
||||
<tr>
|
||||
<td><input type="checkbox" value="1" id="autoalle" /> alle markieren </td><td><input type="submit" class="btnBlue" name="ausfuehren" value="{|Löschen|}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#editkonto').focus();
|
||||
|
||||
$("#editKontorahmen").dialog({
|
||||
modal: true,
|
||||
bgiframe: true,
|
||||
closeOnEscape:false,
|
||||
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);
|
||||
}
|
||||
}
|
||||
$('#autoalle').on('change',function(){
|
||||
var wert = $(this).prop('checked');
|
||||
$('#kontorahmen_list').find('input[type="checkbox"]').prop('checked',wert);
|
||||
$('#kontorahmen_list').find('input[type="checkbox"]').first().trigger('change');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
@@ -31,30 +31,21 @@
|
||||
<form method="POST">
|
||||
<table class="option-table">
|
||||
<tr>
|
||||
<td>{|Datum|}:</td><td><input type="text" [DATUMDISABLED] id="datum" name="datum" value="[DATUM]" onchange="holedatum()"/></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>{|Datum|}:</td><td><input type="text" id="datum" name="datum" value="[DATUM]"/></td>
|
||||
<td>{|Preis|}:</td>
|
||||
<td>
|
||||
<select id="preisart" name="preisart">
|
||||
<option value="letzterek" [LETZTEREK]>{|Letzter EK (live mit aktuellem Wert)|}</option>
|
||||
<option value="kalkulierterek" [KALKULIERTEREK]>{|kalkulierter EK (live mit aktuellem Wert)|}</option>
|
||||
<option value="inventurwert" [INVENTURWERT]>{|Inventurwert (live mit aktuellem Wert)|}</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>
|
||||
<option value="letzterek" [LETZTEREK]>{|EK aus Einkaufspreisen|}</option>
|
||||
<option value="kalkulierterek" [KALKULIERTEREK]>{|Kalkulierter EK (wenn vorhanden)|}</option>
|
||||
<option value="inventurwert" [INVENTURWERT]>{|Inventurwert (wenn vorhanden)|}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="gruppierenlager" name="gruppierenlager" [GRUPPIERENLAGER]/>
|
||||
<label for="gruppierenlager">{|Gruppieren Lager|}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="preiseineuro" name="preiseineuro" [PREISEINEURO]/>
|
||||
<label for="preiseineuro">{|alle Preise in EUR anzeigen|}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="submit" value="{|laden|}" name="laden"/>
|
||||
<input type="submit" value="{|Laden|}" name="laden"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -66,26 +57,3 @@
|
||||
<!-- tab view schließen -->
|
||||
</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ür Lagerbewegungen vor.</div>';
|
||||
}
|
||||
},
|
||||
beforeSend: function() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">Allgemein</a></li>
|
||||
<li><a href="#tabs-2">Produktion</a></li>
|
||||
<li><a href="#tabs-3">Positionen</a></li>
|
||||
<li><a href="#tabs-4">Protokoll</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>{|<b>Produktion <font color="blue">[BELEGNR]</font></b>|}</legend>
|
||||
[STATUSICONS]
|
||||
[TEILPRODUKTIONINFO]
|
||||
</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">
|
||||
<fieldset>
|
||||
<legend>{|Allgemein|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Kunde|}:</td><td><input type="text" name="kundennummer" id="kundennummer" value="[KUNDENNUMMER]" size="20"></td></tr>
|
||||
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
|
||||
<tr><td>{|Auftrag|}:</td><td><input type="text" name="auftragid" id="auftragid" value="[AUFTRAGID]" size="20"></td></tr>
|
||||
<tr><td>{|Interne Bezeichnung|}:</td><td><input type="text" name="internebezeichnung" value="[INTERNEBEZEICHNUNG]" size="20"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Status|}:</td><td><input disabled type="text" name="status" value="[STATUS]" size="20"></td></tr>
|
||||
<tr><td>{|Angelegt am|}:</td><td><input type="text" name="datum" id="datum" value="[DATUM]" size="10"></td></tr>
|
||||
<tr><td>{|Materiallager|}:</td><td><input type="text" name="standardlager" id="standardlager" value="[STANDARDLAGER]" size="20"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<legend>{|Aktionen|}</legend>
|
||||
<tr><td><button [AKTION_SPEICHERN_DISABLED] name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button></td></tr>
|
||||
<tr [AKTION_FREIGEBEN_VISIBLE]><td><button name="submit" value="freigeben" class="ui-button-icon" style="width:100%;">Freigeben</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">
|
||||
<fieldset>
|
||||
<legend>{|Einstellungen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Reservierart|}:</td><td><input disabled type="text" name="reservierart" value="[RESERVIERART]" size="20"></td></tr>
|
||||
<tr><td>{|Auslagerart|}:</td><td><input disabled type="text" name="auslagerart" value="[AUSLAGERART]" size="20"></td></tr>
|
||||
<tr><td>{|Unterstücklisten auflösen|}:</td><td><input disabled type="checkbox" name="unterlistenexplodieren" value=1 [UNTERLISTENEXPLODIEREN] size="20"></td></tr>
|
||||
<tr><td>{|Funktionstest|}:</td><td><input disabled type="checkbox" name="funktionstest" value=1 [FUNKTIONSTEST] size="20"></td></tr>
|
||||
<tr><td>{|Beschreibungen von Arbeitsschritten anzeigen|}:</td><td><input disabled type="checkbox" name="arbeitsschrittetextanzeigen" value=1 [ARBEITSSCHRITTETEXTANZEIGEN] size="20"></td></tr>
|
||||
<tr><td>{|Seriennummer erstellen|}:</td><td><input disabled type="checkbox" name="seriennummer_erstellen" value=1 [SERIENNUMMER_ERSTELLEN] size="20"></td></tr>
|
||||
<tr><td>{|Unterseriennummer erfassen|}:</td><td><input disabled type="checkbox" name="unterseriennummer_erfassen" value=1 [UNTERSERIENNUMMER_ERFASSEN] 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">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Auslieferung Lager|}:</td><td><input type="text" name="datumauslieferung" id="datumauslieferung" value="[DATUMAUSLIEFERUNG]" size="10"></td></tr>
|
||||
<tr><td>{|Bereitstellung Start|}:</td><td><input type="text" name="datumbereitstellung" id="datumbereitstellung" value="[DATUMBEREITSTELLUNG]" size="10"></td></tr>
|
||||
<tr><td>{|Produktion Start|}:</td><td><input type="text" name="datumproduktion" id="datumproduktion" value="[DATUMPRODUKTION]" size="10"></td></tr>
|
||||
<tr><td>{|Produktion Ende|}:</td><td><input type="text" name="datumproduktionende" id="datumproduktionende" value="[DATUMPRODUKTIONENDE]" size="10"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>{|Freitext|}</legend>
|
||||
<textarea name="freitext" id="freitext" style="min-height: 180px;">[FREITEXT]</textarea>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>{|Interne Bemerkung|}</legend>
|
||||
<textarea name="internebemerkung" id="internebemerkung" style="min-height: 180px;">[INTERNEBEMERKUNG]</textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div [POSITIONEN_TAB_VISIBLE]>
|
||||
<div id="tabs-2">
|
||||
[MESSAGE]
|
||||
<form action="#tabs-2" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<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>{|<b>Produktion <font color="blue">[BELEGNR]</font></b>|}</legend>
|
||||
[STATUSICONS]
|
||||
[TEILPRODUKTIONINFO]
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-14 col-md-5 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend [AKTION_PLANEN_VISIBLE]>{|Zu produzierende Artikel|}</legend>
|
||||
<legend [ARTIKEL_MENGE_VISIBLE]>{|Produktionsfortschritt|}</legend>
|
||||
<table width="100%" border="0">
|
||||
<tr [AKTION_PLANEN_VISIBLE]><td>{|Artikel|}:</td></tr>
|
||||
<tr [AKTION_PLANEN_VISIBLE]><td><input type="text" name="artikel_planen" id="artikel_planen" value="[ARTIKEL_PLANEN]" size="20"></td></tr>
|
||||
<tr [AKTION_PLANEN_VISIBLE]><td>{|Planmenge|}:</td></tr>
|
||||
<tr [AKTION_PLANEN_VISIBLE]><td><input type="text" name="artikel_planen_menge" id="artikel_planen_menge" value="[ARTIKEL_PLANEN_MENGE]" size="20"></td></tr>
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Geplant|}:</td>
|
||||
<td>[MENGE_GEPLANT]</td>
|
||||
<td>{|Offen:|}</td>
|
||||
<td>[MENGE_OFFEN]</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Produziert|}:</td>
|
||||
<td>[MENGE_PRODUZIERT]</td>
|
||||
<td>{|Reserviert:|}</td>
|
||||
<td>[MENGE_RESERVIERT]</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Erfolgreich|}:</td>
|
||||
<td>[MENGE_ERFOLGREICH]</td>
|
||||
<td>{|Produzierbar:|}</td>
|
||||
<td>[MENGE_PRODUZIERBAR]</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Ausschuss|}:</td>
|
||||
<td>[MENGE_AUSSCHUSS]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-5 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend [AKTION_PRODUZIEREN_VISIBLE]>{|Parameter|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr [AKTION_PRODUZIEREN_VISIBLE]>
|
||||
<td>{|Menge|}:</td>
|
||||
<td><input type="number" min="0" name="menge_produzieren" id="menge_produzieren" value="[MENGE_PRODUZIEREN]" size="20""></td>
|
||||
</tr>
|
||||
<tr [AKTION_PRODUZIEREN_VISIBLE]>
|
||||
<td>{|Ausschuss|}:</td>
|
||||
<td><input type="number" min="0" name="menge_ausschuss_produzieren" id="menge_ausschuss_produzieren" value="[MENGE_AUSSCHUSS_PRODUZIEREN]" size="20"></td>
|
||||
</tr>
|
||||
<tr [AKTION_PRODUZIEREN_VISIBLE]>
|
||||
<td>{|Ziellager|}:</td>
|
||||
<td><input type="text" name="ziellager" id="ziellager" value="[ZIELLAGER]" size="20"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<legend>{|Anpassen|}</legend>
|
||||
<tr [AKTION_PLANEN_VISIBLE]><td><button name="submit" value="planen" class="ui-button-icon" style="width:100%;">Planen</button></td></tr>
|
||||
<tr [AKTION_LEEREN_VISIBLE]><td><button name="submit" value="leeren" class="ui-button-icon" style="width:100%;">Leeren</button></td></tr>
|
||||
<tr [AKTION_FREIGEBEN_VISIBLE]><td><button name="submit" value="freigeben" class="ui-button-icon" style="width:100%;">Freigeben</button></td></tr>
|
||||
<tr [AKTION_PRODUZIEREN_VISIBLE]><td><button name="submit" value="teilen" class="ui-button-icon" style="width:100%;">Teilen</button></td></tr>
|
||||
<tr [AKTION_PRODUZIEREN_VISIBLE]><td><button name="submit" value="anpassen" class="ui-button-icon" style="width:100%;">Anpassen</button></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<legend>{|Produzieren|}</legend>
|
||||
<tr [AKTION_RESERVIEREN_VISIBLE]><td><button name="submit" value="reservieren" class="ui-button-icon" style="width:100%;">Reservieren</button></td></tr>
|
||||
<tr [AKTION_PRODUZIEREN_VISIBLE]><td><button name="submit" value="produzieren" class="ui-button-icon" style="width:100%;">Produzieren</button></td></tr>
|
||||
<tr [AKTION_ABSCHLIESSEN_VISIBLE]><td><button name="submit" value="abschliessen" class="ui-button-icon" style="width:100%;">Abschliessen</button></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div [ARTIKEL_MENGE_VISIBLE] 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>{|Materialbedarf|}</legend>
|
||||
</fieldset>
|
||||
[PRODUKTION_POSITION_SOURCE_TABELLE]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-3">
|
||||
[MESSAGE]
|
||||
<form action="index.php?module=produktion_position&action=edit&produktion=[PRODUKTION_ID]" 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>{|Positionen|}</legend>
|
||||
[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ügen</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="tabs-4">
|
||||
[MESSAGE]
|
||||
<form action="" method="post">
|
||||
[MINIDETAILINEDIT]
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="#tabs-1" id="frmauto" name="frmauto" method="post">
|
||||
<div class="filter-box filter-usersave">
|
||||
<div class="filter-block filter-inline">
|
||||
<div class="filter-title">{|Filter|}</div>
|
||||
<ul class="filter-list">
|
||||
[STATUSFILTER]
|
||||
<li class="filter-item">
|
||||
<label for="angelegte" class="switch">
|
||||
<input type="checkbox" id="angelegte">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="angelegte">{|Angelegt|}</label>
|
||||
</li>
|
||||
<li class="filter-item">
|
||||
<label for="offene" class="switch">
|
||||
<input type="checkbox" id="offene">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="offene">{|Offen|}</label>
|
||||
</li>
|
||||
<li class="filter-item">
|
||||
<label for="geschlossene" class="switch">
|
||||
<input type="checkbox" id="geschlossene">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="geschlossene">{|Abgeschlossen|}</label>
|
||||
</li>
|
||||
<li class="filter-item">
|
||||
<label for="stornierte" class="switch">
|
||||
<input type="checkbox" id="stornierte">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="stornierte">{|Papierkorb|}</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,281 +1,46 @@
|
||||
<style>
|
||||
|
||||
|
||||
.auftraginfo_cell {
|
||||
color: #636363;border: 1px solid #ccc;padding: 5px;
|
||||
}
|
||||
|
||||
.auftrag_cell {
|
||||
color: #636363;border: 1px solid #fff;padding: 0px; margin:0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<table width="100%" border="0" cellpadding="10" cellspacing="5">
|
||||
<tr valign="top">
|
||||
<td width="">
|
||||
|
||||
<br>
|
||||
<center>[MENU]</center>
|
||||
<br>
|
||||
|
||||
<h2 class="greyh2">Artikel für Produktion</h2>
|
||||
<div style="padding:10px;">[ARTIKEL]</div>
|
||||
[MINIDETAILNACHARTIKEL]
|
||||
<h2 class="greyh2">Externe Produktionsschritte</h2>
|
||||
<div style="padding:10px;" id="[RAND]bestellungen">[BESTELLUNGEN]</div>
|
||||
|
||||
|
||||
<h2 class="greyh2">Zeiterfassung</h2>
|
||||
<div style="padding:10px;">[ZEITERFASSUNG]</div>
|
||||
<h2 class="greyh2">Arbeitsschritte</h2>
|
||||
<div style="padding:10px;">[ARBEITSSCHRITTE]</div>
|
||||
<h2 class="greyh2">Abschlussbemerkung</h2>
|
||||
<div style="padding:10px;">[ABSCHLUSSBEMERKUNG]</div>
|
||||
<div style="padding:10px;">
|
||||
<table width="100%>">
|
||||
<tr>
|
||||
<td>Zeit Geplant in Stunden</td>
|
||||
<td>Zeit Tatsächlich in Stunden</td>
|
||||
<td>Arbeitsplatzgruppe Kosten Geplant in EUR</td>
|
||||
<td>Arbeitsplatzgruppe Kosten Tatsächlich in EUR</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="greybox" width="25%">[ZEITGEPLANT]</td>
|
||||
<td class="greybox" width="25%">[ZEITGEBUCHT]</td>
|
||||
<td class="greybox" width="25%">[KOSTENGEPLANT]</td>
|
||||
<td class="greybox" width="25%">[KOSTENGEBUCHT]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<td width="450">
|
||||
<div style="overflow:auto; min-width:450px; max-height:550px;">
|
||||
<div style="background-color:white">
|
||||
|
||||
<h2 class="greyh2">Produktionszentrum</h2>
|
||||
<div style="padding:10px;">
|
||||
<center>
|
||||
[BUTTONS]
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div style="background-color:white">
|
||||
<h2 class="greyh2">Protokoll</h2>
|
||||
<div style="padding:10px;">
|
||||
[PROTOKOLL]
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<h2 class="greyh2">Datei Anhang</h2>
|
||||
<div style="padding:10px;">[DATEIANHANGLISTE]</div>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<h2 class="greyh2">Arbeitsschritte</h2>
|
||||
<div style="padding:10px">
|
||||
<table width="100%>">
|
||||
<tr><td>Fertigstellung in %</td><td>Anzahl Schritte</td></tr>
|
||||
<tr>
|
||||
<td class="greybox" width="25%">[DECKUNGSBEITRAG]</td>
|
||||
<td class="greybox" width="25%">[DBPROZENT]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<h2 class="greyh2">Abschluss Bericht</h2>
|
||||
<div style="padding:10px;">
|
||||
<table width="100%>">
|
||||
<tr>
|
||||
<td>Menge Geplant</td>
|
||||
<td>Menge Ausschuss</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="greybox" width="25%">[MENGEGEPLANT]</td>
|
||||
<td class="greybox" width="25%">[MENGEAUSSCHUSS]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2 class="greyh2">Deckungsbeitrag</h2>
|
||||
<div style="padding:10px">
|
||||
<table width="100%>">
|
||||
<tr>
|
||||
<td>Deckungsbeitrag in EUR</td>
|
||||
<td>DB in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="greybox" width="25%">[DECKUNGSBEITRAG]</td>
|
||||
<td class="greybox" width="25%">[DBPROZENT]</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<legend>{|Produktionsfortschritt|}</legend>
|
||||
<div class="inside inside-full-height">
|
||||
<table width="100%" border="0">
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Geplant|}:</td>
|
||||
<td>[MINI_MENGE_GEPLANT]</td>
|
||||
<td>{|Offen:|}</td>
|
||||
<td>[MINI_MENGE_OFFEN]</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Produziert|}:</td>
|
||||
<td>[MINI_MENGE_PRODUZIERT]</td>
|
||||
<td>{|Reserviert:|}</td>
|
||||
<td>[MINI_MENGE_RESERVIERT]</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_MENGE_VISIBLE]>
|
||||
<td>{|Erfolgreich|}:</td>
|
||||
<td>[MINI_MENGEERFOLGREICH]</td>
|
||||
<td>{|Produzierbar:|}</td>
|
||||
<td>[MINI_MENGE_PRODUZIERBAR]</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<td>{|Ausschuss|}:</td>
|
||||
<td>[MINI_MENGEAUSSCHUSS]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<legend>{|Protokoll|}</legend>
|
||||
<div class="inside inside-full-height">
|
||||
[PROTOKOLL]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="[RAND]createdocdialog">
|
||||
<form id="[RAND]createdocfrom">
|
||||
<fieldset><legend>{|Artikel|}</legend>
|
||||
<div id="[RAND]createdocdialoginfo"></div>
|
||||
|
||||
<input type="hidden" name="[RAND]createdocsid" id="[RAND]createdocsid" />
|
||||
<table class="mkTable" width="100%" id="[RAND]createdocdialogtable">
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset><legend>{|Bestellung bei externen Produzent|}</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td nowrap>
|
||||
<input type="radio" id="[RAND]createdoctypecreatebestellung" name="[RAND]createdoctypebestellungtyp" value="createbestellung" checked="checked" />
|
||||
<label for="[RAND]createdoctypecreatebestellung">{|neue Bestellung anlegen|}</label>
|
||||
<label for="[RAND]createdocadresse">{|bei Lieferant|}:</label>
|
||||
</td><td nowrap>
|
||||
<input type="text" id="[RAND]createdocadresse" name="[RAND]createdocadresse" size="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="[RAND]createdoctypetrlieferant"><td></td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" id="[RAND]createdoctypeaddtobestellung" name="[RAND]createdoctypebestellungtyp" value="addtobestellung" /> <label for="[RAND]createdoctypeaddtobestellung">{|zu bestehender Bestellung anlegen|}:</label>
|
||||
</td><td>
|
||||
<input id="[RAND]createdocbestellung" name="[RAND]createdocbestellung" type="text" size="30"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="[RAND]createdoctrbestellungnoprice">
|
||||
<td colspan="2">
|
||||
<input type="checkbox" id="[RAND]createdoctypebestellungnoprice" name="[RAND]createdoctypebestellungnoprice" value="1" [NEWSUPPLIERSORDERHASPRICE]/>
|
||||
<label for="[RAND]createdoctypebestellungnoprice">{|Preis für Hauptprodukt nicht setzen|}</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset><legend>{|Beistellen des Materials|}</legend>
|
||||
<table>
|
||||
<tr id="[RAND]createdoctrtypebestellung">
|
||||
<td colspan="2">
|
||||
<input type="radio" id="[RAND]createdoctypebestellung" name="[RAND]createdoctype" value="bestellung" checked="checked" />
|
||||
<label for="[RAND]createdoctypebestellung">{|Artikel sofort auslagern (basierend auf Bestellung)|}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="[RAND]createdoctrtypeauftrag">
|
||||
<td colspan="2">
|
||||
<input type="radio" id="[RAND]createdoctypeauftrag" name="[RAND]createdoctype" value="auftrag" />
|
||||
<label for="[RAND]createdoctypeauftrag">{|Auftrag für Beistellung anlegen|}</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend>{|Produktion|}</legend>
|
||||
<table>
|
||||
<tr id="[RAND]createdoctrprodstarten">
|
||||
<td colspan="2">
|
||||
<input type="checkbox" id="[RAND]createdocstartprod" name="[RAND]createdocstartprod" value="1" />
|
||||
<label for="[RAND]createdocstartprod">{|Produktion starten|}</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<script type="application/javascript">
|
||||
[AUTOCOMPLETE]
|
||||
$(document).ready(function() {
|
||||
$('#[RAND]createdocdialog').dialog(
|
||||
{
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
minWidth: 940,
|
||||
title: 'Auftrag/Bestellung anlegen',
|
||||
buttons: {
|
||||
'OK': function () {
|
||||
var $addr = $('#[RAND]createdocadresse');
|
||||
var $best = $('#[RAND]createdocbestellung');
|
||||
var allempty = ($($addr).val()+'' === '') &&
|
||||
($($best).length === 0 || $($best).val()+'' === '');
|
||||
if(allempty) {
|
||||
alert('Bitte eine Adresse oder Bestellung auswählen');
|
||||
} else {
|
||||
if($('#[RAND]createdoctypebestellung').prop('checked') || $('#[RAND]createdoctypeauftrag').prop('checked')) {
|
||||
$.ajax({
|
||||
url: 'index.php?module=produktion&action=edit&cmd=createdocument&id=[ID]&frame=[FRAMEPARAM]',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: $('#[RAND]createdocfrom').serialize(),
|
||||
success: function (data) {
|
||||
//$('#[RAND]createdocdialog').dialog('close');
|
||||
$('#[RAND]createdocdialoginfo').html(typeof data.html != 'undefined'? data.html:'');
|
||||
if(data.html != '') {
|
||||
$('input.[RAND]createdoc').remove();
|
||||
}
|
||||
$('#[RAND]createdocdialog').dialog('close');
|
||||
if(typeof data.deliverynoteinfo != 'undefined') {
|
||||
$('#[RAND]bestellungen').html(data.deliverynoteinfo);
|
||||
bindButton[RAND]();
|
||||
}
|
||||
},
|
||||
beforeSend: function () {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
'ABBRECHEN': function () {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function (event, ui) {
|
||||
|
||||
}
|
||||
});
|
||||
bindButton[RAND]();
|
||||
});
|
||||
|
||||
function bindButton[RAND](){
|
||||
$('input.[RAND]createdoc').on('click', function () {
|
||||
$('#[RAND]createdocsid').val($(this).data('sid'));
|
||||
|
||||
$.ajax({
|
||||
url: 'index.php?module=produktion&action=edit&cmd=gettableforcreatedocument&id=[ID]',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {sid: $(this).data('sid'),rand:'[RAND]'},
|
||||
success: function (data) {
|
||||
$('#[RAND]createdocdialoginfo').html(typeof data.info != 'undefined'? data.info:'');
|
||||
$('#[RAND]createdocdialogtable').html(data.html);
|
||||
$('#[RAND]createdocadresse').val(data.adresse);
|
||||
$('#[RAND]createdocbestellung').html(data.bestellung);
|
||||
$('#[RAND]createdocauftrag').html(data.auftrag);
|
||||
$('#[RAND]createdocdialog').dialog('open');
|
||||
if(data.displayprodstart) {
|
||||
$('#[RAND]createdoctrprodstarten').show();
|
||||
} else {
|
||||
$('#[RAND]createdoctrprodstarten').hide();
|
||||
}
|
||||
addClicklupe();
|
||||
lupeclickevent();
|
||||
|
||||
// AutoComplete-Ergebnisboxen an Dialog-Fenster anhängen.
|
||||
// Ansonsten wird AutoComplete-Ergebnis evtl. nicht sichtbar unterhalb des Dialog-Fensters angezeigt.
|
||||
var $uiDialog = $('#[RAND]createdocdialog').first();
|
||||
$($uiDialog).find('input.ui-autocomplete-input').autocomplete('option', 'appendTo', $uiDialog);
|
||||
},
|
||||
beforeSend: function () {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<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>{|<a href="index.php?module=produktion&action=edit&id=[PRODUKTIONID]#tabs-3">PRODUKTION [PRODUKTIONBELEGNR]<a>|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Artikel|}:</td><td><input type="text" id="artikel" name="artikel" value="[ARTIKEL]" size="40"></td></tr>
|
||||
<tr><td>{|Menge|}:</td><td><input type="text" name="menge" value="[MENGE]" size="40"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||
</form>
|
||||
</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" /> alle markieren </td><td><input type="submit" class="btnBlue" name="delcacheselected" value="{|Lagerzahlencache zurü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ü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>
|
||||
<legend>{|Aktionen|}</legend>
|
||||
|
||||
<input type="submit" class="btnBlueNew" value="{|Lagerzahlcache zurücksetzen|}" name="delcache"><br>
|
||||
<input type="submit" class="btnBlueNew" value="{|Lagerzahlcache für Shopartikel mit Menge 0 zurücksetzen|}" name="delzerostockcache"><br>
|
||||
<input type="submit" class="btnBlueNew" value="{|Lagerzahlencache zurücksetzen|}" name="delcache"><br>
|
||||
<input type="submit" class="btnBlueNew" value="{|Lagerzahlencache für Shopartikel mit Menge 0 zurücksetzen|}" name="delzerostockcache"><br>
|
||||
<input type="submit" class="btnBlueNew" value="{|Artikelcache zurü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 geä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>
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<legend>{|[STATUSICON]<b>Ticket <font color="blue">#[SCHLUESSEL]</font></b>|}</legend>
|
||||
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" id="betreff" value="[BETREFF]" size="20"></td></tr>
|
||||
<tr><td>{|Letzte Aktion|}:</td><td>[ZEIT]</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[MAILADRESSE] ([KUNDE])</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[KUNDE] [MAILADRESSE]</td></tr>
|
||||
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
|
||||
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="20"><a href="index.php?module=adresse&action=edit&id=[ADRESSE_ID]"><img src="./themes/new/images/forward.svg" border="0" style="top:6px; position:relative"></a></td></tr>
|
||||
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" id="tags" value="[TAGS]" size="20"></td></tr>
|
||||
<tr><td>{|Letzte Aktion|}:</td><td>[ZEIT]</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,34 @@
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-10 col-md-height" style="float:[NACHRICHT_FLOAT];">
|
||||
<div class="inside inside-full-height" style= "border:1px solid black;">
|
||||
<fieldset>
|
||||
<legend>{|<b>[NACHRICHT_BETREFF]</b>|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Zeit|}:</td><td>[NACHRICHT_ZEIT]</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[NACHRICHT_SENDER]</td></tr>
|
||||
<tr><td>{|An|}:</td><td>[NACHRICHT_RECIPIENTS]</td></tr>
|
||||
<tr><td>{|CC|}:</td><td>[NACHRICHT_CC_RECIPIENTS]</td></tr>
|
||||
<tr><td colspan=2><hr style="border-style:solid; border-width:1px"></td></tr>
|
||||
<tr><td colspan=2><div id="body" class="ticket_text_div">[NACHRICHT_TEXT]</div></td></tr>
|
||||
<tr><td colspan=2><div id="body" class="ticket_attachments">[NACHRICHT_ANHANG]</div></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<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>
|
||||
<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>{|Von|}:</td><td>[NACHRICHT_SENDER]</td></tr>
|
||||
<tr><td>{|An|}:</td><td>[NACHRICHT_RECIPIENTS]</td></tr>
|
||||
<tr><td>{|CC|}:</td><td>[NACHRICHT_CC_RECIPIENTS]</td></tr>
|
||||
<tr><td colspan=2><div id="body" class="ticket_attachments">[NACHRICHT_ANHANG]</div></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</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>
|
||||
|
||||
@@ -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>{|Ü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>{|Ü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>
|
||||
|
||||
@@ -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>
|
||||
@@ -0,0 +1,108 @@
|
||||
<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]
|
||||
<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ä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öschen und das Upgrade in der Konsole erneut durchführen.
|
||||
Dazu im Unterordner "upgrade" diesen Befehl starten: <pre>./upgrade.sh -do</pre>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form action="" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-14 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<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>{|Aktuelle Version|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<b>OpenXE [CURRENT]</b>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>{|Ausgabe|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
[OUTPUT_FROM_CLI]
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Aktionen|}</legend>
|
||||
<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="check_upgrade" class="ui-button-icon" style="width:100%;">Upgrades prüfen</button></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" 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 [ERZWINGEN] size="20"></td></tr>
|
||||
<tr><td colspan=2><button name="submit" value="check_db" class="ui-button-icon" style="width:100%;">Datenbank prüfen</button></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" formtarget="_blank" value="do_db_upgrade" class="ui-button-icon" style="width:100%;">Datenbank UPGRADE</button></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<fieldset><legend>{|Umrechnung|}</legend>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td>
|
||||
<table align="center" border="0" cellspacing="0" cellpadding="3">
|
||||
<tr><td>Währung von</td><td><input type="text" name="waehrung_von" value="[WAEHRUNG_VON]" /></td></tr>
|
||||
<tr><td>Währung nach</td><td><input type="text" name="waehrung_nach" value="[WAEHRUNG_NACH]" /></td></tr>
|
||||
<tr><td>Kurs:</td><td><input type="text" name="kurs" value="[KURS]" /></td></tr>
|
||||
<tr><td>Währung von</td><td><select name="waehrung_von">[WAEHRUNG_VON]</select></td></tr>
|
||||
<tr><td>Währung nach</td><td><select name="waehrung_nach">[WAEHRUNG_NACH]</select></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ü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>
|
||||
</tr></td></table>
|
||||
</fieldset>
|
||||
@@ -27,3 +27,6 @@
|
||||
<!-- tab view schließen -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
<!--
|
||||
<form method="post">
|
||||
<table width="100%"><tr><td width="100%" align="center">
|
||||
<input type="submit" name="abgleich" value="Nur angelegte Kurse von der ECB holen" />
|
||||
@@ -17,6 +18,7 @@
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<!-- 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>
|
||||
@@ -95,15 +95,15 @@ class Dateien {
|
||||
$heading = array('ID','Titel', 'Beschreibung', 'Verknüpfung', 'Geloescht', 'Logdatei', 'Menü');
|
||||
$width = array('10%'); // Fill out manually later
|
||||
|
||||
$findcols = array('d.id','d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei');
|
||||
$searchsql = array('d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei');
|
||||
$findcols = array('d.id','d.titel', 'd.beschreibung', 'ds.objekt', 'd.geloescht', 'd.logdatei');
|
||||
$searchsql = array('d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei','ds.objekt');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=dateien&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS d.id, d.id, d.titel, d.beschreibung, GROUP_CONCAT(ds.objekt SEPARATOR ', '), d.geloescht, d.logdatei, d.id FROM datei d LEFT join datei_stichwoerter ds ON ds.datei = d.id";
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS d.id, d.id, d.titel, d.beschreibung, GROUP_CONCAT(ds.objekt SEPARATOR ', ') as verknuepfung, d.geloescht, d.logdatei, d.id FROM datei d LEFT join datei_stichwoerter ds ON ds.datei = d.id";
|
||||
|
||||
$where = "1";
|
||||
$count = "SELECT count(DISTINCT id) FROM datei WHERE $where";
|
||||
|
||||
@@ -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ä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ü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", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=importvorlage&action=uebersicht", "Zurü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 |
|
||||
*/
|
||||
+58
-63
@@ -569,6 +569,10 @@ class Firmendaten {
|
||||
|
||||
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')) {
|
||||
$this->checkPaymentModules(true);
|
||||
}
|
||||
@@ -1016,55 +1020,46 @@ class Firmendaten {
|
||||
,'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',
|
||||
'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'
|
||||
,"buchhaltung_berater","buchhaltung_mandant","buchhaltung_wj_beginn","buchhaltung_sachkontenlaenge"
|
||||
);
|
||||
|
||||
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) {
|
||||
|
||||
$check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$v'");
|
||||
if ($check) {
|
||||
$this->app->DB->Update("UPDATE firmendaten SET ".$v." = '".($data[$v])."'"." WHERE firma = '$id' LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
if(isset($firmendaten_werte_spalten)) {
|
||||
foreach($toupdate as $key) {
|
||||
if(isset($firmendaten_werte_spalten[$key]) && $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");
|
||||
unset($firmendaten_werte_spalten[$key]);
|
||||
if(!empty($doubletes[$key])) {
|
||||
$this->app->DB->Delete(
|
||||
sprintf(
|
||||
"DELETE FROM firmendaten_werte WHERE id <> %d AND name != '%s' AND id IN (%s)",
|
||||
$firmendaten_werte_spalten[$key]['id'], $this->app->DB->real_escape_string($key),
|
||||
implode(', ', $doubletes[$key])
|
||||
)
|
||||
);
|
||||
unset($doubletes[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$v'");
|
||||
if ($check) {
|
||||
$this->app->DB->Update("UPDATE firmendaten SET ".$v." = '".($data[$v])."'"." WHERE firma = '$id' LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($firmendaten_werte_spalten)) {
|
||||
foreach($toupdate as $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");
|
||||
unset($firmendaten_werte_spalten[$key]);
|
||||
if(!empty($doubletes[$key])) {
|
||||
$this->app->DB->Delete(
|
||||
sprintf(
|
||||
"DELETE FROM firmendaten_werte WHERE id <> %d AND name != '%s' AND id IN (%s)",
|
||||
$firmendaten_werte_spalten[$key]['id'], $this->app->DB->real_escape_string($key),
|
||||
implode(', ', $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($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) {
|
||||
$check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$k'");
|
||||
if ($check) {
|
||||
$this->app->DB->Update("UPDATE firmendaten SET ".$k." = '".$v."'"." WHERE firma = '$id' LIMIT 1");
|
||||
}
|
||||
}
|
||||
// }
|
||||
foreach($toupdate2 as $k => $v) {
|
||||
$check = $this->app->DB->SELECT("SHOW COLUMNS FROM firmendaten WHERE Field = '$k'");
|
||||
if ($check) {
|
||||
$this->app->DB->Update("UPDATE firmendaten SET ".$k." = '".$v."'"." WHERE firma = '$id' LIMIT 1");
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($firmendaten_werte_spalten)) {
|
||||
foreach($toupdate2 as $key => $v) {
|
||||
@@ -1400,8 +1384,11 @@ class Firmendaten {
|
||||
if(!isset($data[0][$v['name']])){
|
||||
$data[0][$v['name']] = $v['wert'];
|
||||
}
|
||||
|
||||
// Fill all fields
|
||||
$this->app->Tpl->Set(strtoupper($v['name']), $v['wert']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Brief Absender
|
||||
$this->app->Tpl->Set('ABSENDER' , $data[0]['absender']);
|
||||
@@ -1719,6 +1706,7 @@ class Firmendaten {
|
||||
$this->app->Tpl->Set('ABSENDERNAME' , $data[0]['absendername']);
|
||||
$this->app->Tpl->Set('BCC1' , $data[0]['bcc1']);
|
||||
$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('NAME' , $data[0]['name']);
|
||||
$this->app->Tpl->Set('STRASSE' , $data[0]['strasse']);
|
||||
@@ -2072,15 +2060,16 @@ class Firmendaten {
|
||||
$this->app->Tpl->Set('EMAIL' , $data['email']);
|
||||
$this->app->Tpl->Set('ABSENDERNAME' , $data['absendername']);
|
||||
$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('NAME' , $data['name']);
|
||||
$this->app->Tpl->Set('STRASSE' , $data['strasse']);
|
||||
$this->app->Tpl->Set('PLZ' , $data['plz']);
|
||||
$this->app->Tpl->Set('ORT' , $data['ort']);
|
||||
$this->app->Tpl->Set('STEUERNUMMER' , $data['steuernummer']);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -2224,6 +2213,7 @@ class Firmendaten {
|
||||
$data['absendername'] = ($this->app->Secure->POST["absendername"]);
|
||||
$data['bcc1'] = ($this->app->Secure->POST["bcc1"]);
|
||||
$data['bcc2'] = ($this->app->Secure->POST["bcc2"]);
|
||||
$data['bcc3'] = ($this->app->Secure->POST["bcc3"]);
|
||||
$data['name'] = ($this->app->Secure->POST["name"]);
|
||||
$data['firmenfarbe'] = ($this->app->Secure->POST["firmenfarbe"]);
|
||||
$data['strasse'] = ($this->app->Secure->POST["strasse"]);
|
||||
@@ -2265,6 +2255,12 @@ class Firmendaten {
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -3110,7 +3106,6 @@ class Firmendaten {
|
||||
|
||||
$this->app->YUI->AutoComplete('document_project', 'projektname', 1);
|
||||
|
||||
|
||||
$this->app->Tpl->Add('TAB1', $table);
|
||||
//$this->app->Tpl->Set('TAB1', $ret);
|
||||
$this->app->Tpl->Parse('PAGE','tabview.tpl');
|
||||
|
||||
@@ -1418,7 +1418,7 @@ class Importvorlage extends GenImportvorlage {
|
||||
$ersterdatensatz = 1;
|
||||
$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;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -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]."'
|
||||
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]))
|
||||
{
|
||||
@@ -3755,7 +3762,7 @@ class Importvorlage extends GenImportvorlage {
|
||||
//verkaufspreis3internerkommentar'][$i]
|
||||
|
||||
$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");
|
||||
|
||||
$verkaufspreis1stueckdivisor = 1;
|
||||
@@ -5021,7 +5028,61 @@ class Importvorlage extends GenImportvorlage {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
|
||||
@@ -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ü');
|
||||
$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ö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> <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", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurü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ö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ück zur Ü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 ü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ö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']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+257
-641
File diff suppressed because it is too large
Load Diff
+912
-912
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -82,7 +82,7 @@ class Log
|
||||
'Nachricht',
|
||||
'',
|
||||
];
|
||||
$width = ['1%', '4%', '8%', '4%', '10%', '15%', '20%', '10%', '5%', '40%'];
|
||||
$width = ['1%', '4%', '9%', '4%', '10%', '15%', '20%', '10%', '5%', '40%'];
|
||||
$findcols = [
|
||||
'open',
|
||||
'l.id',
|
||||
@@ -116,7 +116,7 @@ class Log
|
||||
$sql = "SELECT l.id,
|
||||
'<img src=./themes/new/images/details_open.png class=details>' AS `open`,
|
||||
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
|
||||
FROM `log` AS `l`";
|
||||
$fastcount = 'SELECT COUNT(l.id) FROM `log` AS `l`';
|
||||
|
||||
+4983
-4898
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 OpenXE project
|
||||
*/
|
||||
|
||||
use Xentral\Components\Database\Exception\QueryFailureException;
|
||||
|
||||
class Produktion_position {
|
||||
|
||||
function __construct($app, $intern = false) {
|
||||
$this->app = $app;
|
||||
if ($intern)
|
||||
return;
|
||||
|
||||
$this->app->ActionHandlerInit($this);
|
||||
$this->app->ActionHandler("list", "produktion_position_list");
|
||||
$this->app->ActionHandler("create", "produktion_position_edit"); // This automatically adds a "New" button
|
||||
$this->app->ActionHandler("edit", "produktion_position_edit");
|
||||
$this->app->ActionHandler("delete", "produktion_position_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 "produktion_position_list":
|
||||
$allowed['produktion_position_list'] = array('list');
|
||||
$heading = array('','','produktion', 'artikel', 'projekt', 'bezeichnung', 'beschreibung', 'internerkommentar', 'nummer', 'menge', 'preis', 'waehrung', 'lieferdatum', 'vpe', 'sort', 'status', 'umsatzsteuer', 'bemerkung', 'geliefert', 'geliefert_menge', 'explodiert', 'explodiert_parent', 'logdatei', 'nachbestelltexternereinkauf', 'beistellung', 'externeproduktion', 'einheit', 'steuersatz', 'steuertext', 'erloese', 'erloesefestschreiben', 'freifeld1', 'freifeld2', 'freifeld3', 'freifeld4', 'freifeld5', 'freifeld6', 'freifeld7', 'freifeld8', 'freifeld9', 'freifeld10', 'freifeld11', 'freifeld12', 'freifeld13', 'freifeld14', 'freifeld15', 'freifeld16', 'freifeld17', 'freifeld18', 'freifeld19', 'freifeld20', 'freifeld21', 'freifeld22', 'freifeld23', 'freifeld24', 'freifeld25', 'freifeld26', 'freifeld27', 'freifeld28', 'freifeld29', 'freifeld30', 'freifeld31', 'freifeld32', 'freifeld33', 'freifeld34', 'freifeld35', 'freifeld36', 'freifeld37', 'freifeld38', 'freifeld39', 'freifeld40', 'stuecklistestufe', 'teilprojekt', 'Menü');
|
||||
$width = array('1%','1%','10%'); // Fill out manually later
|
||||
|
||||
$findcols = array('p.produktion', 'p.artikel', 'p.projekt', 'p.bezeichnung', 'p.beschreibung', 'p.internerkommentar', 'p.nummer', 'p.menge', 'p.preis', 'p.waehrung', 'p.lieferdatum', 'p.vpe', 'p.sort', 'p.status', 'p.umsatzsteuer', 'p.bemerkung', 'p.geliefert', 'p.geliefert_menge', 'p.explodiert', 'p.explodiert_parent', 'p.logdatei', 'p.nachbestelltexternereinkauf', 'p.beistellung', 'p.externeproduktion', 'p.einheit', 'p.steuersatz', 'p.steuertext', 'p.erloese', 'p.erloesefestschreiben', 'p.freifeld1', 'p.freifeld2', 'p.freifeld3', 'p.freifeld4', 'p.freifeld5', 'p.freifeld6', 'p.freifeld7', 'p.freifeld8', 'p.freifeld9', 'p.freifeld10', 'p.freifeld11', 'p.freifeld12', 'p.freifeld13', 'p.freifeld14', 'p.freifeld15', 'p.freifeld16', 'p.freifeld17', 'p.freifeld18', 'p.freifeld19', 'p.freifeld20', 'p.freifeld21', 'p.freifeld22', 'p.freifeld23', 'p.freifeld24', 'p.freifeld25', 'p.freifeld26', 'p.freifeld27', 'p.freifeld28', 'p.freifeld29', 'p.freifeld30', 'p.freifeld31', 'p.freifeld32', 'p.freifeld33', 'p.freifeld34', 'p.freifeld35', 'p.freifeld36', 'p.freifeld37', 'p.freifeld38', 'p.freifeld39', 'p.freifeld40', 'p.stuecklistestufe', 'p.teilprojekt');
|
||||
$searchsql = array('p.produktion', 'p.artikel', 'p.projekt', 'p.bezeichnung', 'p.beschreibung', 'p.internerkommentar', 'p.nummer', 'p.menge', 'p.preis', 'p.waehrung', 'p.lieferdatum', 'p.vpe', 'p.sort', 'p.status', 'p.umsatzsteuer', 'p.bemerkung', 'p.geliefert', 'p.geliefert_menge', 'p.explodiert', 'p.explodiert_parent', 'p.logdatei', 'p.nachbestelltexternereinkauf', 'p.beistellung', 'p.externeproduktion', 'p.einheit', 'p.steuersatz', 'p.steuertext', 'p.erloese', 'p.erloesefestschreiben', 'p.freifeld1', 'p.freifeld2', 'p.freifeld3', 'p.freifeld4', 'p.freifeld5', 'p.freifeld6', 'p.freifeld7', 'p.freifeld8', 'p.freifeld9', 'p.freifeld10', 'p.freifeld11', 'p.freifeld12', 'p.freifeld13', 'p.freifeld14', 'p.freifeld15', 'p.freifeld16', 'p.freifeld17', 'p.freifeld18', 'p.freifeld19', 'p.freifeld20', 'p.freifeld21', 'p.freifeld22', 'p.freifeld23', 'p.freifeld24', 'p.freifeld25', 'p.freifeld26', 'p.freifeld27', 'p.freifeld28', 'p.freifeld29', 'p.freifeld30', 'p.freifeld31', 'p.freifeld32', 'p.freifeld33', 'p.freifeld34', 'p.freifeld35', 'p.freifeld36', 'p.freifeld37', 'p.freifeld38', 'p.freifeld39', 'p.freifeld40', 'p.stuecklistestufe', 'p.teilprojekt');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',p.id,'\" />') AS `auswahl`";
|
||||
|
||||
$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> <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>";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS p.id, $dropnbox, p.produktion, p.artikel, p.projekt, p.bezeichnung, p.beschreibung, p.internerkommentar, p.nummer, p.menge, p.preis, p.waehrung, p.lieferdatum, p.vpe, p.sort, p.status, p.umsatzsteuer, p.bemerkung, p.geliefert, p.geliefert_menge, p.explodiert, p.explodiert_parent, p.logdatei, p.nachbestelltexternereinkauf, p.beistellung, p.externeproduktion, p.einheit, p.steuersatz, p.steuertext, p.erloese, p.erloesefestschreiben, p.freifeld1, p.freifeld2, p.freifeld3, p.freifeld4, p.freifeld5, p.freifeld6, p.freifeld7, p.freifeld8, p.freifeld9, p.freifeld10, p.freifeld11, p.freifeld12, p.freifeld13, p.freifeld14, p.freifeld15, p.freifeld16, p.freifeld17, p.freifeld18, p.freifeld19, p.freifeld20, p.freifeld21, p.freifeld22, p.freifeld23, p.freifeld24, p.freifeld25, p.freifeld26, p.freifeld27, p.freifeld28, p.freifeld29, p.freifeld30, p.freifeld31, p.freifeld32, p.freifeld33, p.freifeld34, p.freifeld35, p.freifeld36, p.freifeld37, p.freifeld38, p.freifeld39, p.freifeld40, p.stuecklistestufe, p.teilprojekt, p.id FROM produktion_position p";
|
||||
|
||||
$where = "1";
|
||||
$count = "SELECT count(DISTINCT id) FROM produktion_position WHERE $where";
|
||||
// $groupby = "";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
|
||||
foreach ($erlaubtevars as $k => $v) {
|
||||
if (isset($$v)) {
|
||||
$erg[$v] = $$v;
|
||||
}
|
||||
}
|
||||
return $erg;
|
||||
}
|
||||
|
||||
function produktion_position_list() {
|
||||
/* $this->app->erp->MenuEintrag("index.php?module=produktion_position&action=list", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=produktion_position&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurück");
|
||||
|
||||
$this->app->YUI->TableSearch('TAB1', 'produktion_position_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE', "produktion_position_list.tpl");*/
|
||||
|
||||
header("Location: index.php?module=produktion&action=list");
|
||||
}
|
||||
|
||||
|
||||
// End edit process and return to previous page
|
||||
// Give pid in case of delete because position.id is already gone
|
||||
function produktion_position_edit_end(string $msg, bool $error, bool $go_to_production, int $pid = 0) {
|
||||
|
||||
if ($error) {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">".$msg."</div>");
|
||||
} else {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"info\">".$msg."</div>");
|
||||
}
|
||||
|
||||
if ($go_to_production) {
|
||||
if ($pid == 0) {
|
||||
$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";
|
||||
$result = $this->app->DB->SelectArr($sql)[0];
|
||||
$pid = $result['id'];
|
||||
}
|
||||
header("Location: index.php?module=produktion&action=edit&id=$pid&msg=$msg#tabs-3");
|
||||
} else {
|
||||
header("Location: index.php?module=produktion_position&action=list&msg=$msg");
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
public function produktion_position_delete() {
|
||||
$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";
|
||||
$result = $this->app->DB->SelectArr($sql)[0];
|
||||
$status = $result['status'];
|
||||
$pid = $result['id'];
|
||||
if (!in_array($status,array('angelegt','freigegeben'))) {
|
||||
$this->produktion_position_edit_end("Bearbeiten nicht möglich, Produktionsstatus ist '$status'",true, true);
|
||||
}
|
||||
|
||||
$this->app->DB->Delete("DELETE FROM `produktion_position` WHERE `id` = '{$id}'");
|
||||
|
||||
// Remove reserved items
|
||||
|
||||
$this->produktion_position_edit_end("Der Eintrag wurde gelöscht.", true, true, $pid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Edit produktion_position item
|
||||
* If id is empty, create a new one
|
||||
*/
|
||||
|
||||
function produktion_position_edit() {
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
|
||||
$this->app->Tpl->Set('ID', $id);
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=produktion_position&action=edit&id=$id", "Details");
|
||||
$this->app->erp->MenuEintrag("index.php?module=produktion&action=edit%id=$pid", "Zurück zur Übersicht");
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
$input = $this->GetInput();
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
|
||||
if (empty($id)) {
|
||||
// New item
|
||||
$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";
|
||||
$result = $this->app->DB->SelectArr($sql)[0];
|
||||
$status = $result['status'];
|
||||
$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";
|
||||
$result = $this->app->DB->SelectArr($sql)[0];
|
||||
$planmenge = $result['menge'];
|
||||
|
||||
if ($planmenge == 0) {
|
||||
$this->produktion_position_edit_end("Keine Planung vorhanden.",true, true, $produktion_id);
|
||||
}
|
||||
|
||||
if ($submit != '')
|
||||
{
|
||||
|
||||
// Write to database
|
||||
|
||||
// Add checks here
|
||||
$input['artikel'] = $this->app->erp->ReplaceArtikel(true, $input['artikel'],true); // Convert from form to db
|
||||
|
||||
// Only allowed when produktion is 'freigegeben or angelegt'
|
||||
if (!in_array($status,array('angelegt','freigegeben'))) {
|
||||
$this->produktion_position_edit_end("Bearbeiten nicht möglich, Produktionsstatus ist '$status'",true, true);
|
||||
}
|
||||
|
||||
if ($input['menge'] < 0) {
|
||||
$this->produktion_position_edit_end("Ungültige Menge.",true, true);
|
||||
}
|
||||
|
||||
// Only allow quantities that are a multiple of the target quantity
|
||||
if ($input['menge'] % $planmenge != 0) {
|
||||
$this->produktion_position_edit_end("Positionsmenge muss Vielfaches von $planmenge sein.",true, true, $produktion_id);
|
||||
}
|
||||
|
||||
$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 produktion_position (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||
|
||||
// echo($sql);
|
||||
|
||||
$this->app->DB->Update($sql);
|
||||
|
||||
if ($id == 'NULL') {
|
||||
$msg = "Das Element wurde erfolgreich angelegt.";
|
||||
} else {
|
||||
$msg = "Die Einstellungen wurden erfolgreich übernommen.";
|
||||
}
|
||||
$this->produktion_position_edit_end($msg,false,true,$produktion_id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Load values again from database
|
||||
|
||||
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS pp.id, pp.produktion, p.belegnr, pp.artikel, FORMAT(pp.menge,0) as menge, pp.id FROM produktion_position pp INNER JOIN produktion p ON pp.produktion = p.id "." WHERE pp.id=$id");
|
||||
|
||||
foreach ($result[0] as $key => $value) {
|
||||
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add displayed items later
|
||||
*
|
||||
|
||||
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||
$this->app->Tpl->Add('EMAIL', $email);
|
||||
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||
*/
|
||||
|
||||
$this->app->YUI->AutoComplete("artikel", "artikelnummer");
|
||||
//$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('PRODUKTIONID',$result[0]['produktion']);
|
||||
$this->app->Tpl->Set('PRODUKTIONBELEGNR',$result[0]['belegnr']);
|
||||
|
||||
$this->app->Tpl->Add('MESSAGE',"<div class=\"info\">Positionsmenge muss Vielfaches von $planmenge sein.</div>");
|
||||
|
||||
$this->app->Tpl->Parse('PAGE', "produktion_position_edit.tpl");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all paramters from html form and save into $input
|
||||
*/
|
||||
public function GetInput(): array {
|
||||
$input = array();
|
||||
|
||||
$input['artikel'] = $this->app->Secure->GetPOST('artikel');
|
||||
$input['menge'] = $this->app->Secure->GetPOST('menge');
|
||||
|
||||
return($input);
|
||||
}
|
||||
|
||||
}
|
||||
+1133
-1123
File diff suppressed because it is too large
Load Diff
+3817
-3817
File diff suppressed because it is too large
Load Diff
+100
-31
@@ -48,11 +48,11 @@ class Ticket {
|
||||
case "ticket_list":
|
||||
|
||||
$allowed['ticket_list'] = array('list');
|
||||
$heading = array('','','Ticket #', 'Letzte Aktion', 'Adresse', 'Betreff', 'Tags', 'Verant.', 'Nachr.', 'Status', 'Alter', 'Projekt', 'Menü');
|
||||
$width = array('1%','1%','5%', '5%', '5%', '30%', '1%', '5%', '1%', '1%', '1%', '1%', '1%');
|
||||
$heading = array('','','Ticket #', 'Aktion','Adresse', 'Betreff', 'Tags', 'Verant.', 'Nachr.', 'Status', 'Projekt', 'Menü');
|
||||
$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');
|
||||
$searchsql = array( 't.schluessel', 't.zeit', 'a.name', 't.betreff','t.notiz', 't.tags', 'w.warteschlange', 't.status', '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', 'p.abkuerzung','(SELECT mail FROM ticket_nachricht tn WHERE tn.ticket = t.schluessel AND tn.versendet <> 1 LIMIT 1)');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
@@ -65,27 +65,29 @@ class Ticket {
|
||||
CONCAT(TIMESTAMPDIFF(hour, t.zeit, NOW()),'h'),
|
||||
CONCAT(TIMESTAMPDIFF(day, t.zeit, NOW()), 'd ',MOD(TIMESTAMPDIFF(hour, t.zeit, NOW()),24),'h'))";
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',t.id,'\" />') AS `auswahl`";
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`,
|
||||
CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',t.id,'\" />') AS `auswahl`";
|
||||
|
||||
$priobetreff = "if(t.prio!=1,t.betreff,CONCAT('<b><font color=red>',t.betreff,'</font></b>'))";
|
||||
|
||||
$anzahlnachrichten = "(SELECT COUNT(n.id) FROM ticket_nachricht n WHERE n.ticket = t.schluessel)";
|
||||
|
||||
$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\">";
|
||||
$tagend = "</li>";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||
t.id,
|
||||
".$dropnbox.",
|
||||
CONCAT('<a href=\"index.php?module=ticket&action=edit&id=',t.id,'\">',t.schluessel,'</a>'),
|
||||
t.zeit,
|
||||
a.name,
|
||||
CONCAT('<a href=\"index.php?module=ticket&action=edit&id=',t.id,'\">',t.schluessel,'</a>'),".
|
||||
$app->erp->FormatDateTimeShort('zeit')." as aktion,
|
||||
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('<div class=\"ticketoffene\"><ul class=\"tag-editor\">'\n,'".$tagstart."',replace(t.tags,',','".$tagend."<div class=\"tag-editor-spacer\"> </div>".$tagstart."'),'".$tagend."','</ul></div>'),
|
||||
w.warteschlange,
|
||||
".$anzahlnachrichten." as nachrichten_anz,
|
||||
".$anzahlnachrichten." as `nachrichten_anz`,
|
||||
".ticket_iconssql().",
|
||||
".$timedifference.",
|
||||
p.abkuerzung,
|
||||
t.id
|
||||
FROM ticket t
|
||||
@@ -149,7 +151,7 @@ class Ticket {
|
||||
// END Toggle filters
|
||||
|
||||
$moreinfo = true; // Allow drop down details
|
||||
$menucol = 12; // For moredata
|
||||
$menucol = 11; // For moredata
|
||||
|
||||
$count = "SELECT count(DISTINCT id) FROM ticket t WHERE $where";
|
||||
|
||||
@@ -170,6 +172,16 @@ class Ticket {
|
||||
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() {
|
||||
|
||||
// Process multi action
|
||||
@@ -181,7 +193,7 @@ class Ticket {
|
||||
if($selectedId > 0) {
|
||||
$selectedIds[] = $selectedId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$status = $this->app->Secure->GetPOST('status');
|
||||
$warteschlange = $this->app->Secure->GetPOST('warteschlange');
|
||||
@@ -192,9 +204,10 @@ class Ticket {
|
||||
}
|
||||
|
||||
$sql .= " WHERE id IN (".implode(",",$selectedIds).")";
|
||||
|
||||
$this->app->DB->Update($sql);
|
||||
|
||||
$this->ticket_set_self_assigned_status($selectedIds);
|
||||
|
||||
}
|
||||
|
||||
// List
|
||||
@@ -239,8 +252,8 @@ class Ticket {
|
||||
n.verfasser,
|
||||
n.mail,
|
||||
t.quelle,
|
||||
n.zeit,
|
||||
n.zeitausgang,
|
||||
".$this->app->erp->FormatDateTimeShort('n.zeit','zeit').",
|
||||
".$this->app->erp->FormatDateTimeShort('n.zeitausgang','zeitausgang').",
|
||||
n.versendet,
|
||||
n.text,
|
||||
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_ZEIT",$message['zeitausgang']);
|
||||
$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_SENDER",htmlentities($message['bearbeiter']));
|
||||
$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)"));
|
||||
} 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_RECIPIENTS",htmlentities($message['mail']));
|
||||
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc']));
|
||||
$this->app->Tpl->Set("NACHRICHT_FLOAT","right");
|
||||
$this->app->Tpl->Set("META_FLOAT","left");
|
||||
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']);
|
||||
$this->app->Tpl->Set("NACHRICHT_NAME",htmlentities($message['verfasser']));
|
||||
} else {
|
||||
@@ -349,8 +364,9 @@ class Ticket {
|
||||
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",htmlentities($message['quelle']));
|
||||
}
|
||||
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",htmlentities($message['mail_cc_recipients']));
|
||||
$this->app->Tpl->Set("NACHRICHT_BETREFF",'<a href="index.php?module=ticket&action=text&mid='.$message['id'].'" target="_blank">'.htmlentities($message['betreff']).'</a>');
|
||||
$this->app->Tpl->Set("NACHRICHT_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("META_FLOAT","right");
|
||||
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']);
|
||||
}
|
||||
|
||||
@@ -365,9 +381,21 @@ class Ticket {
|
||||
}
|
||||
}
|
||||
|
||||
function ticket_text() {
|
||||
|
||||
$secure_html_tags = array(
|
||||
'<br>',
|
||||
'<p>',
|
||||
'<strong>',
|
||||
'<b>',
|
||||
'<table>',
|
||||
'<tr>',
|
||||
'<td>',
|
||||
'<style>'
|
||||
);
|
||||
|
||||
function ticket_text() {
|
||||
$mid = $this->app->Secure->GetGET('mid');
|
||||
$insecure = $this->app->Secure->GetGET('insecure');
|
||||
|
||||
if (empty($mid)) {
|
||||
return;
|
||||
@@ -378,7 +406,18 @@ class Ticket {
|
||||
if (empty($messages)) {
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set("TEXT",$messages[0]['text']);
|
||||
if ($insecure) {
|
||||
$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->ExitXentral();
|
||||
}
|
||||
@@ -460,6 +499,9 @@ class Ticket {
|
||||
$sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||
$this->app->DB->Update($sql);
|
||||
$id = $this->app->DB->GetInsertID();
|
||||
|
||||
$this->ticket_set_self_assigned_status(array($id));
|
||||
|
||||
return($id);
|
||||
}
|
||||
|
||||
@@ -549,7 +591,10 @@ class Ticket {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$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
|
||||
|
||||
|
||||
if ($ticket_from_db['mailadresse'] != "") {
|
||||
$this->app->Tpl->Set('MAILADRESSE',"<".$ticket_from_db['mailadresse'].">");
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('ADRESSE_ID',$ticket_from_db['adresse']);
|
||||
|
||||
$this->app->YUI->AutoComplete("projekt","projektname",1);
|
||||
@@ -645,14 +694,14 @@ class Ticket {
|
||||
switch ($submit) {
|
||||
case 'neue_email':
|
||||
|
||||
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
|
||||
$senderAddress = $this->app->erp->GetFirmaMail();
|
||||
|
||||
if (empty($drafted_messages)) {
|
||||
// Create new message and save it for editing
|
||||
|
||||
$this->app->Tpl->Set('EMAIL_AN', htmlentities($recv_messages[0]['mail']));
|
||||
|
||||
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
|
||||
$senderAddress = $this->app->erp->GetFirmaMail();
|
||||
|
||||
$to = "";
|
||||
$cc = "";
|
||||
|
||||
@@ -687,13 +736,30 @@ class Ticket {
|
||||
$anschreiben = $this->app->DB->Select("SELECT anschreiben FROM adresse WHERE id='".$ticket_from_db['adresse']."' LIMIT 1");
|
||||
if($anschreiben=="")
|
||||
{
|
||||
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben").",\n".$this->app->erp->Grussformel($projekt,$sprache);
|
||||
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben");
|
||||
}
|
||||
|
||||
$anschreiben = $anschreiben.",<br>".$this->app->erp->Grussformel($projekt,$sprache);
|
||||
|
||||
$sql = "INSERT INTO `ticket_nachricht` (
|
||||
`ticket`, `zeit`, `text`, `betreff`, `medium`, `versendet`,
|
||||
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`,`mail_cc`
|
||||
) VALUES ('".$ticket_from_db['schluessel']."',NOW(),'".$anschreiben."','".$betreff."','email','1','".$senderName."','".$to."','neu','".$senderName."','".$senderAddress."','".$cc."');";
|
||||
) 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);
|
||||
// Show new message dialog
|
||||
@@ -717,7 +783,7 @@ class Ticket {
|
||||
$citation_info =$recv_messages[0]['zeit']." ".$recv_messages[0]['verfasser']." <".$recv_messages[0]['mail'].">";
|
||||
$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);
|
||||
header("Location: index.php?module=ticket&action=edit&id=$id");
|
||||
$this->app->ExitXentral();
|
||||
@@ -739,24 +805,27 @@ class Ticket {
|
||||
// Attachments
|
||||
$files = $this->app->erp->GetDateiSubjektObjektDateiname('Anhang','Ticket',$drafted_messages[0]['id'],"");
|
||||
|
||||
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
|
||||
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,63})(?:\.[a-z]{2})?/i';
|
||||
|
||||
preg_match_all($pattern, $drafted_messages[0]['mail'], $matches);
|
||||
$to = $matches[0];
|
||||
|
||||
if ($drafted_messages[0]['mail_cc'] != '') {
|
||||
$pattern = '/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
|
||||
preg_match_all($pattern, $drafted_messages[0]['mail_cc'], $matches);
|
||||
$cc = $matches[0];
|
||||
} else {
|
||||
$cc = null;
|
||||
}
|
||||
|
||||
$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)
|
||||
|
||||
if (
|
||||
$this->app->erp->MailSend(
|
||||
$drafted_messages[0]['mail_replyto'],
|
||||
$drafted_messages[0]['verfasser_replyto'],
|
||||
$senderAddress,
|
||||
$senderName,
|
||||
$to,
|
||||
$to,
|
||||
htmlentities($drafted_messages[0]['betreff']),
|
||||
@@ -771,7 +840,7 @@ class Ticket {
|
||||
) {
|
||||
|
||||
// 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);
|
||||
|
||||
$msg .= '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'.';
|
||||
|
||||
@@ -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','Übersetzung', 'Original', 'Menü');
|
||||
$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> <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", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=uebersetzung&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurü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ö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ück zur Ü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 ü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']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 OpenXE project
|
||||
*/
|
||||
|
||||
use Xentral\Components\Database\Exception\QueryFailureException;
|
||||
|
||||
class upgrade {
|
||||
|
||||
function __construct($app, $intern = false) {
|
||||
$this->app = $app;
|
||||
if ($intern)
|
||||
return;
|
||||
|
||||
$this->app->ActionHandlerInit($this);
|
||||
$this->app->ActionHandler("list", "upgrade_overview");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
}
|
||||
|
||||
public function Install() {
|
||||
/* Fill out manually later */
|
||||
}
|
||||
|
||||
function upgrade_overview() {
|
||||
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
$verbose = $this->app->Secure->GetPOST('details_anzeigen') === '1';
|
||||
$db_verbose = $this->app->Secure->GetPOST('db_details_anzeigen') === '1';
|
||||
$force = $this->app->Secure->GetPOST('erzwingen') === '1';
|
||||
|
||||
$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";
|
||||
upgrade_set_out_file_name($logfile);
|
||||
|
||||
$this->app->Tpl->Set('UPGRADE_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, bool $origin) {
|
||||
|
||||
$directory = dirname(getcwd())."/upgrade";
|
||||
|
||||
switch ($submit) {
|
||||
case 'check_upgrade':
|
||||
$this->app->Tpl->Set('UPGRADE_VISIBLE', "");
|
||||
unlink($logfile);
|
||||
upgrade_main($directory,$verbose,true,false,false,true,false,$force,false,false);
|
||||
break;
|
||||
case 'do_upgrade':
|
||||
unlink($logfile);
|
||||
upgrade_main($directory,$verbose,true,true,false,true,true,$force,false,false);
|
||||
break;
|
||||
case 'check_db':
|
||||
$this->app->Tpl->Set('UPGRADE_DB_VISIBLE', "");
|
||||
unlink($logfile);
|
||||
upgrade_main($directory,$db_verbose,false,false,false,true,false,$force,false,false);
|
||||
break;
|
||||
case 'do_db_upgrade':
|
||||
$this->app->Tpl->Set('UPGRADE_DB_VISIBLE', "");
|
||||
unlink($logfile);
|
||||
upgrade_main($directory,$db_verbose,false,false,false,true,true,$force,false,false);
|
||||
break;
|
||||
case 'refresh':
|
||||
break;
|
||||
}
|
||||
|
||||
// Read results
|
||||
$result = file_get_contents($logfile);
|
||||
$this->app->Tpl->Set('CURRENT', $this->app->erp->Revision());
|
||||
$this->app->Tpl->Set('OUTPUT_FROM_CLI',nl2br($result));
|
||||
$this->app->Tpl->Parse('PAGE', "upgrade.tpl");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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ährung von', 'Währung nach', 'Kurs', 'Gültig bis', 'Geändert am', 'Bearbeiter', 'Kommentar', 'Menü');
|
||||
$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> <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", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=waehrungumrechnung&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurü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ö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ück zur Ü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 ü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']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -90,8 +90,6 @@ class Welcome
|
||||
$this->app->ActionHandler("mobileapps","WelcomeMobileApps");
|
||||
$this->app->ActionHandler("spooler","WelcomeSpooler");
|
||||
$this->app->ActionHandler("redirect","WelcomeRedirect");
|
||||
$this->app->ActionHandler("upgrade","WelcomeUpgrade");
|
||||
$this->app->ActionHandler("upgradedb","WelcomeUpgradeDB");
|
||||
$this->app->ActionHandler("startseite","WelcomeStartseite");
|
||||
|
||||
$this->app->ActionHandler("addnote","WelcomeAddNote");
|
||||
@@ -886,8 +884,6 @@ $this->app->Tpl->Add('TODOFORUSER',"<tr><td width=\"90%\">".$tmp[$i]['aufgabe'].
|
||||
$this->app->Tpl->Parse('AUFGABENPOPUP','aufgaben_popup.tpl');
|
||||
// ENDE:Aufgabe-Bearbeiten-Popup
|
||||
|
||||
$this->XentralUpgradeFeed();
|
||||
|
||||
$this->app->erp->RunHook('welcome_start', 1 , $this);
|
||||
|
||||
// Xentral 20 database compatibility
|
||||
@@ -1113,97 +1109,6 @@ $this->app->Tpl->Add('TODOFORUSER',"<tr><td width=\"90%\">".$tmp[$i]['aufgabe'].
|
||||
$this->app->erp->ExitWawi();
|
||||
}
|
||||
|
||||
protected function XentralUpgradeFeed($max=3)
|
||||
{
|
||||
if(!$this->app->Conf->WFoffline)
|
||||
{
|
||||
$version = $this->app->erp->Version();
|
||||
$revision = $this->app->erp->Revision();
|
||||
/*
|
||||
$tmp = explode('.',$revision);
|
||||
$branch = strtolower($version).'_'.$tmp[0].'.'.$tmp[1];
|
||||
|
||||
$BLOGURL = "https://{$this->app->Conf->updateHost}/wawision_2016.php?branch=".$branch;
|
||||
$CACHEFILE = $this->app->erp->GetTMP().md5($BLOGURL);
|
||||
$CACHEFILE2 = $this->app->erp->GetTMP().md5($BLOGURL).'2';
|
||||
if(!file_exists($CACHEFILE2))
|
||||
{
|
||||
if(file_exists($CACHEFILE)){
|
||||
@unlink($CACHEFILE);
|
||||
}
|
||||
}else{
|
||||
if(trim(file_get_contents($CACHEFILE2)) != $version.$revision){
|
||||
@unlink($CACHEFILE);
|
||||
}
|
||||
}
|
||||
$CACHETIME = 4; # hours
|
||||
|
||||
if(!file_exists($CACHEFILE) || ((time() - filemtime($CACHEFILE)) > 3600 * $CACHETIME)) {
|
||||
if($feed_contents = @file_get_contents($BLOGURL)) {
|
||||
$fp = fopen($CACHEFILE, 'w');
|
||||
fwrite($fp, $feed_contents);
|
||||
fclose($fp);
|
||||
@file_put_contents($CACHEFILE2, $version.$revision);
|
||||
}
|
||||
}
|
||||
$feed_contents = file_get_contents($CACHEFILE);
|
||||
|
||||
$xml = simplexml_load_string($feed_contents);
|
||||
$json = json_encode($xml);
|
||||
$array = json_decode($json,TRUE);
|
||||
$found = false;
|
||||
$version_revision = null;
|
||||
include dirname(dirname(__DIR__)) .'/version.php';
|
||||
if($version_revision != '') {
|
||||
$ra = explode('.', $version_revision);
|
||||
if(isset($ra[2]) && $ra[2] != '') {
|
||||
$itemsCount = isset($array['channel']['item'])?count($array['channel']['item']):0;
|
||||
for($i = 0; $i< $itemsCount; $i++) {
|
||||
if($found !== false) {
|
||||
unset($array['channel']['item'][$i]);
|
||||
}
|
||||
else{
|
||||
$rev = isset($array['channel']['item'][$i]['guid'])?(string)$array['channel']['item'][$i]['guid']:'';
|
||||
if($rev === '') {
|
||||
$rev = trim(trim($array['channel']['item'][$i]['title']),')');
|
||||
$rev = trim(substr($rev, strrpos($rev, '(')+4));
|
||||
}
|
||||
if($rev == $ra[2]) {
|
||||
$found = $i;
|
||||
unset($array['channel']['item'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!empty($array['channel']) && !empty($array['channel']['item']) && is_array($array['channel']['item'])) {
|
||||
$itemsCount = isset($array['channel']['item'])?count($array['channel']['item']):0;
|
||||
for($i = 0; $i < $itemsCount; $i++) {
|
||||
$this->app->Tpl->Add('WAIWISONFEEDS','<tr><td><b>'.$array['channel']['item'][$i]['title']
|
||||
.'</b></td></tr><tr><td style="font-size:7pt">'.$array['channel']['item'][$i]['description'].'</td></tr>');
|
||||
}
|
||||
}
|
||||
elseif($found !== false){
|
||||
$this->app->Tpl->Add('WAIWISONFEEDS','<tr><td><br><b>Ihre Version ist auf dem neusten Stand.</b></td></tr>');
|
||||
}
|
||||
$version = $this->app->erp->Version();
|
||||
if($version==='OSS') {
|
||||
$this->app->Tpl->Set('INFO', '<br>Sie verwenden die Open-Source Version.');
|
||||
$this->app->Tpl->Set('TESTBUTTON','<div class="btn">
|
||||
<a href="index.php?module=appstore&action=testen" class="button" target="_blank">14 Tage Business testen</a>
|
||||
</div>');
|
||||
}
|
||||
$this->app->Tpl->Set('RAND',md5(microtime(true)));
|
||||
if(!$this->app->erp->RechteVorhanden('welcome','changelog')) {
|
||||
$this->app->Tpl->Set('BEFORECHANGELOG', '<!--');
|
||||
$this->app->Tpl->Set('AFTERCHANGELOG', '-->');
|
||||
}
|
||||
$this->app->erp->RunHook('welcome_news');
|
||||
$this->app->Tpl->Parse('WELCOMENEWS','welcome_news.tpl');
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function WelcomeAddPinwand()
|
||||
{
|
||||
@@ -1668,156 +1573,6 @@ $this->app->Tpl->Add('TODOFORUSER',"<tr><td width=\"90%\">".$tmp[$i]['aufgabe'].
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function WelcomeUpgrade()
|
||||
{
|
||||
$this->app->erp->MenuEintrag('index.php?module=welcome&action=start','zurück zur Startseite');
|
||||
$this->app->erp->Headlines('Update für Xentral');
|
||||
|
||||
$this->app->Tpl->Set('STARTBUTTON','<!--');
|
||||
$this->app->Tpl->Set('ENDEBUTTON','-->');
|
||||
|
||||
$lizenz = $this->app->erp->Firmendaten('lizenz');
|
||||
$schluessel = $this->app->erp->Firmendaten('schluessel');
|
||||
if($lizenz=='' || $schluessel=='')
|
||||
{
|
||||
if(is_file('../wawision.inc.php'))
|
||||
{
|
||||
include_once '../wawision.inc.php';
|
||||
$this->app->erp->FirmendatenSet('lizenz',$WAWISION['serial']);
|
||||
$this->app->erp->FirmendatenSet('schluessel',$WAWISION['authkey']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->app->erp->MenuEintrag('index.php?module=welcome&action=upgrade','Update');
|
||||
$this->XentralUpgradeFeed(5);
|
||||
$result = '';
|
||||
if($this->app->Secure->GetPOST('upgrade'))
|
||||
{
|
||||
ob_start();
|
||||
// dringend nacheinander, sonst wird das alte upgrade nur ausgefuehrt
|
||||
if(!is_dir('.svn'))
|
||||
{
|
||||
echo "new update system\r\n";
|
||||
include '../upgradesystemclient2_include.php';
|
||||
} else {
|
||||
echo "Update in Entwicklungsversion\r\n";
|
||||
}
|
||||
|
||||
$result .= "\r\n>>>>>>Bitte klicken Sie jetzt auf \"Weiter mit Schritt 2\"<<<<<<\r\n\r\n";
|
||||
$result .= ob_get_contents();
|
||||
$result .= "\r\n>>>>>>Bitte klicken Sie jetzt auf \"Weiter mit Schritt 2\"<<<<<<\r\n\r\n";
|
||||
ob_end_clean();
|
||||
|
||||
if(is_dir('.svn'))
|
||||
{
|
||||
$version_revision = 'SVN';
|
||||
} else {
|
||||
include '../version.php';
|
||||
}
|
||||
|
||||
$result .="\r\nIhre Version: $version_revision\r\n";
|
||||
|
||||
} else {
|
||||
$result .=">>>>>Bitte auf \"Dateien aktualisieren jetzt starten\" klicken<<<<<<\r\n";
|
||||
}
|
||||
|
||||
if($this->app->erp->Firmendaten('version')==''){
|
||||
$this->app->erp->FirmendatenSet('version', $this->app->erp->RevisionPlain());
|
||||
}
|
||||
|
||||
$doc_root = preg_replace("!{$_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
|
||||
$path = preg_replace("!^{$doc_root}!", '', __DIR__);
|
||||
|
||||
$this->app->Tpl->Add('TAB1',"<h2>Schritt 1 von 2: Dateien aktualisieren</h2><table width=\"100%\"><tr valign=\"top\"><td width=\"70%\"><form action=\"\" method=\"post\" class=\"updateForm\"><input type=\"hidden\" name=\"upgrade\" value=\"1\">
|
||||
<textarea rows=\"15\" cols=\"90\">$result</textarea>
|
||||
<br><input type=\"submit\" value=\"Dateien aktualisieren jetzt starten\" name=\"upgrade\">
|
||||
<input type=\"button\" value=\"Weiter mit Schritt 2\" onclick=\"window.location.href='index.php?module=welcome&action=upgradedb'\">
|
||||
</form></td><td>[WELCOMENEWS]</td></tr></table>");
|
||||
|
||||
$this->app->Tpl->Parse('PAGE','tabview.tpl');
|
||||
}
|
||||
|
||||
public function WelcomeUpgradeDB()
|
||||
{
|
||||
$this->app->erp->MenuEintrag('index.php?module=welcome&action=start','zurück zur Startseite');
|
||||
$this->app->erp->Headlines('Update für Xentral');
|
||||
|
||||
$lizenz = $this->app->erp->Firmendaten('lizenz');
|
||||
$schluessel = $this->app->erp->Firmendaten('schluessel');
|
||||
if($lizenz=='' || $schluessel=='')
|
||||
{
|
||||
if(is_file('../wawision.inc.php'))
|
||||
{
|
||||
include_once '../wawision.inc.php';
|
||||
$this->app->erp->FirmendatenSet('lizenz',$WAWISION['serial']);
|
||||
$this->app->erp->FirmendatenSet('schluessel',$WAWISION['authkey']);
|
||||
}
|
||||
}
|
||||
$this->app->erp->MenuEintrag('index.php?module=welcome&action=upgradedb','Update');
|
||||
$this->XentralUpgradeFeed(5);
|
||||
$result = '';
|
||||
if($this->app->Secure->GetPOST('upgradedb'))
|
||||
{
|
||||
ob_start();
|
||||
// include("upgradesystemclient.php");
|
||||
$result .="Starte DB Update\r\n";
|
||||
$this->app->erp->UpgradeDatabase();
|
||||
$this->app->erp->check_column_missing_run = true;
|
||||
$this->app->erp->UpgradeDatabase();
|
||||
|
||||
if((!empty($this->app->erp->check_column_missing)?count($this->app->erp->check_column_missing):0) > 0)
|
||||
{
|
||||
$result .= "\r\n**** INFORMATION DATENBANK ****\r\n";
|
||||
foreach($this->app->erp->check_column_missing as $tablename=>$columns)
|
||||
{
|
||||
$result .= "\r\n";
|
||||
foreach($columns as $key=>$columname) {
|
||||
$result .= $tablename . ':' . $columname . "\r\n";
|
||||
}
|
||||
}
|
||||
$result .= "\r\n**** INFORMATION DATENBANK ****\r\n\r\n";
|
||||
}
|
||||
if((!empty($this->app->erp->check_index_missing)?count($this->app->erp->check_index_missing):0) > 0)
|
||||
{
|
||||
$result .= "\r\n**** INFORMATION DATENBANK INDEXE ****\r\n";
|
||||
foreach($this->app->erp->check_index_missing as $tablename=>$columns)
|
||||
{
|
||||
$result .= "\r\n";
|
||||
foreach($columns as $key=>$columname) {
|
||||
$result .= $tablename . ":" . $columname . "\r\n";
|
||||
}
|
||||
}
|
||||
$result .= "\r\n**** INFORMATION DATENBANK INDEXE ****\r\n\r\n";
|
||||
}
|
||||
$result .="Fertig DB Update\r\n";
|
||||
$result .="\r\n\r\nDas Datenbank Update wurde durchgeführt\r\n";
|
||||
$result .="\r\n>>>>>Sie können nun mit Xentral weiterarbeiten.<<<<<<\r\n";
|
||||
$result .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
} else {
|
||||
$result .="\r\n>>>>>Bitte auf \"Datenbank Anpassungen jetzt durchführen\" klicken<<<<<<\r\n";
|
||||
}
|
||||
|
||||
if($this->app->erp->Firmendaten('version')==''){
|
||||
$this->app->erp->FirmendatenSet('version', $this->app->erp->RevisionPlain());
|
||||
}
|
||||
|
||||
$doc_root = preg_replace("!{$_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
|
||||
$path = preg_replace("!^{$doc_root}!", '', __DIR__);
|
||||
|
||||
$this->app->Tpl->Add('TAB1',"<h2>Schritt 2 von 2: Datenbank anpassen</h2><table width=\"100%\"><tr valign=\"top\"><td width=\"70%\"><form action=\"\" method=\"post\" class=\"updateForm\"><input type=\"hidden\" name=\"upgrade\" value=\"1\">
|
||||
<textarea rows=\"15\" cols=\"90\">$result</textarea>
|
||||
<br><input type=\"submit\" value=\"Datenbank Anpassungen jetzt durchführen\" name=\"upgradedb\">
|
||||
<input type=\"button\" value=\"Zurück\" onclick=\"window.location.href='index.php?module=welcome&action=upgrade'\">
|
||||
<input type=\"button\" value=\"Abbrechen\" onclick=\"window.location.href='index.php'\">
|
||||
</form></td><td>[WELCOMENEWS]</td></tr></table>");
|
||||
|
||||
$this->app->Tpl->Parse('PAGE','tabview.tpl');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function Termine($date)
|
||||
{
|
||||
$userid = $this->app->User->GetID();
|
||||
|
||||
@@ -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ü');
|
||||
$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> <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", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurü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ö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ück zur Ü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 ü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
@@ -101,7 +101,7 @@
|
||||
unset($_POST['_ACTION']);
|
||||
unset($_POST['_SUBMIT']);
|
||||
|
||||
$error = ((function_exists($action)) ? $action() : '');
|
||||
$error = ((function_exists($action ?? '')) ? $action() : '');
|
||||
if($configfile=='') $error .= "<br>'configfile' for this step is missing";
|
||||
|
||||
if($error=='') {
|
||||
|
||||
@@ -1809,12 +1809,12 @@ fieldset.usersave div.filter-item > label {
|
||||
fieldset {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
margin-top: 5px;
|
||||
/* margin-top: 5px;
|
||||
padding: 5px;
|
||||
border: 0 solid transparent;
|
||||
border-top: 25px solid transparent;
|
||||
border-bottom: 5px solid transparent;
|
||||
border-width: 24px 5px 0;
|
||||
border-width: 24px 5px 0;*/
|
||||
border-color: transparent;
|
||||
background-color: transparent;
|
||||
}
|
||||
@@ -2139,7 +2139,7 @@ img {
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
padding-top: 2px;
|
||||
/* padding-top: 2px;*/
|
||||
}
|
||||
|
||||
|
||||
@@ -2467,12 +2467,23 @@ ul.tag-editor {
|
||||
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 {
|
||||
width: 100%;
|
||||
border: none;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
|
||||
.ui-button-icon,
|
||||
.ui-button:not(.ui-dialog-titlebar-close):not(.button-secondary),
|
||||
input[type=submit]:not(.button-secondary) {
|
||||
@@ -3373,7 +3384,7 @@ div.noteit_highprio {
|
||||
right: 10px;
|
||||
top: 28px;
|
||||
}
|
||||
|
||||
/*
|
||||
@media screen and (min-width: 320px) {
|
||||
.mkTableFormular tr td:first-child {
|
||||
padding-top: 7px;
|
||||
@@ -3386,7 +3397,7 @@ div.noteit_highprio {
|
||||
}
|
||||
.mkTableFormular tr td {
|
||||
vertical-align: top;
|
||||
}
|
||||
}*/
|
||||
@media screen and (max-width: 768px) {
|
||||
.hide768 {
|
||||
display: none;
|
||||
@@ -3699,10 +3710,10 @@ span.red, b.red {
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_processing {
|
||||
background: url('../images/loading.gif') no-repeat;
|
||||
background-position: 50% 0;
|
||||
background-size: 150px;
|
||||
padding-top: 90px;
|
||||
background: url('../images/loading.gif') no-repeat !important;
|
||||
background-position: 50% 0 !important;
|
||||
background-size: 150px !important;
|
||||
padding-top: 90px !important;
|
||||
}
|
||||
|
||||
a.ui-tabs-anchor:hover {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 357 KiB After Width: | Height: | Size: 358 KiB |
@@ -13,6 +13,7 @@
|
||||
<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/login_styles.css?v=3">
|
||||
<link rel="stylesheet" href="themes/new/css/custom.css?v=3">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -31,18 +32,15 @@
|
||||
Willkommen bei OpenXE ERP.<br/>
|
||||
Bitte gib Deinen Benutzernamen und Passwort ein!
|
||||
</div>
|
||||
<div style="[LOGINWARNING]" class="warning"><p>Achtung: Es werden gerade Wartungsarbeiten in Ihrem System (z.B. Update oder Backup) durch Ihre IT-Abteilung durchgeführt. Das System sollte in wenigen Minuten wieder erreichbar sein. Für Rückfragen wenden Sie sich bitte an Ihren Administrator.</p></div>
|
||||
<div [LOGINWARNING_VISIBLE] class="warning"><p>[LOGINWARNING_TEXT]</p></div>
|
||||
|
||||
[SPERRMELDUNGNACHRICHT]
|
||||
[PAGE]
|
||||
<div id="login-footer">
|
||||
<div class="copyright">
|
||||
© [YEAR] by OpenXE-org & Xentral ERP Software GmbH.
|
||||
<br>
|
||||
[WAWIVERSION]
|
||||
</br>
|
||||
OpenXE is free open source software under AGPL-3.0 license, based on <a href="https://xentral.com" target="_blank">Xentral®</a>.
|
||||
<!-- dead link [LIZENZHINWEIS] -->
|
||||
© [YEAR] by OpenXE-org & Xentral ERP Software GmbH.<br>
|
||||
OpenXE is free open source software under AGPL-3.0 license, based on <a href="https://xentral.com" target="_blank">Xentral®</a>.<br>
|
||||
[XENTRALVERSION]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self';">
|
||||
<title>Xentral Login</title>
|
||||
<title>OpenXE Login</title>
|
||||
<link rel="stylesheet" href="themes/new/css/login.css?v=2">
|
||||
</head>
|
||||
<body>
|
||||
<div class="permission-box">
|
||||
<h1>LOGIN Xentral</h1>
|
||||
<h1>OpenXE Login</h1>
|
||||
<p class="error">Sie haben nicht das Recht auf diese Seite zugreifen zu dürfen!</p>
|
||||
<p><a href="BACK" class="btn btn-primary">Zurück zur vorherigen Seite</a></p>
|
||||
<p><a href="index.php?module=welcome&action=logout" class="btn btn-secondary">Erneut einloggen</a></p>
|
||||
|
||||
-5420
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user