Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate;
|
||||
|
||||
use ApplicationCore;
|
||||
use RuntimeException;
|
||||
use Smarty;
|
||||
use SmartyException;
|
||||
use Xentral\Core\DependencyInjection\ContainerInterface;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Smarty\SmartyWrapper;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Smarty\SmartyTemplateHelper;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Smarty\SmartySecurity;
|
||||
|
||||
final class Bootstrap
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function registerServices()
|
||||
{
|
||||
return [
|
||||
'TransferSmartyTemplate' => 'onInitTransferSmartyTemplate',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @throws RuntimeException
|
||||
*
|
||||
* @return TransferSmartyTemplate
|
||||
*/
|
||||
public static function onInitTransferSmartyTemplate(ContainerInterface $container)
|
||||
{
|
||||
/** @var ApplicationCore $app */
|
||||
$app = $container->get('LegacyApplication');
|
||||
$userdataTempDir = $app->erp->GetTMP();
|
||||
$customBaseDir = realpath($userdataTempDir) . '/Modules/TransferSmartyTemplate';
|
||||
|
||||
$compileDir = $customBaseDir . '/templates_c';
|
||||
$defaultTemplateDir = __DIR__ . '/templates/default';
|
||||
|
||||
$transferTemplate = new TransferSmartyTemplate(self::onInitSmartyFacade($compileDir));
|
||||
$transferTemplate->addTemplateDir('default', $defaultTemplateDir);
|
||||
|
||||
return $transferTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $compileDir
|
||||
* @param array $templateDirs
|
||||
*
|
||||
* @throws SmartyException
|
||||
*
|
||||
* @return SmartyWrapper
|
||||
*/
|
||||
public static function onInitSmartyFacade($compileDir, array $templateDirs = [])
|
||||
{
|
||||
$smarty = new Smarty();
|
||||
$smarty->setCaching(false);
|
||||
$smarty->setDebugging(false);
|
||||
$smarty->setEscapeHtml(false);
|
||||
$smarty->setCompileCheck(true);
|
||||
$smarty->setTemplateDir($templateDirs);
|
||||
$smarty->setCompileDir($compileDir);
|
||||
|
||||
// Security-Settings
|
||||
$security = new SmartySecurity($smarty);
|
||||
$smarty->enableSecurity($security);
|
||||
|
||||
/**
|
||||
* Template-Funktionen registrieren
|
||||
*/
|
||||
$helper = new SmartyTemplateHelper();
|
||||
|
||||
// XML
|
||||
$smarty->registerPlugin('block', 'cdata', [$helper, 'compileBlockCdata']);
|
||||
$smarty->registerPlugin('block', 'escapeXml', [$helper, 'compileBlockEscapeXml']);
|
||||
$smarty->registerPlugin('block', 'error', [$helper, 'compileBlockError']);
|
||||
$smarty->registerPlugin('modifier', 'cdata', [$helper, 'compileModifierCdata']);
|
||||
$smarty->registerPlugin('modifier', 'escapeXml', [$helper, 'compileModifierEscapeXml']);
|
||||
$smarty->registerPlugin('modifier', 'error', [$helper, 'compileModifierError']);
|
||||
|
||||
// CSV
|
||||
$smarty->registerPlugin('modifier', 'quoteCsv', [$helper, 'compileModifierQuoteCsv']);
|
||||
|
||||
// HTML+URL
|
||||
$smarty->registerPlugin('modifier', 'br2nl', [$helper, 'compileModifierBr2Nl']);
|
||||
$smarty->registerPlugin('modifier', 'encodeUrl', [$helper, 'compileModifierEncodeUrl']);
|
||||
$smarty->registerPlugin('modifier', 'decodeUrl', [$helper, 'compileModifierDecodeUrl']);
|
||||
$smarty->registerPlugin('modifier', 'decodeHtmlEntities', [$helper, 'compileModifierDecodeHtmlEntities']);
|
||||
$smarty->registerPlugin('modifier', 'decodeHtmlSpecialChars', [$helper, 'compileModifierDecodeHtmlSpecialChars']);
|
||||
|
||||
// Common
|
||||
$smarty->registerPlugin('modifier', 'replaceLineBreaks', [$helper, 'compileModifierReplaceLineBreaks']);
|
||||
$smarty->registerPlugin('modifier', 'dump', [$helper, 'compileModifierDumpVariable']);
|
||||
|
||||
return new SmartyWrapper($smarty);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
class FilesystemFailureException extends \RuntimeException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class PluginRegistrationFailedException extends RuntimeException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class SegmentNotFoundException extends RuntimeException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class TemplateNotFoundException extends RuntimeException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class TransferTemplateException extends RuntimeException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
use Xentral\Core\Exception\ModuleExceptionInterface;
|
||||
|
||||
interface TransferTemplateExceptionInterface extends ModuleExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class TransferTemplateUserException extends RuntimeException implements TransferTemplateExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Smarty;
|
||||
|
||||
use Smarty_Security;
|
||||
|
||||
/**
|
||||
* @see https://www.smarty.net/docs/en/advanced.features.tpl#advanced.features.security
|
||||
*/
|
||||
final class SmartySecurity extends Smarty_Security
|
||||
{
|
||||
/** @var array $php_functions Allowed PHP functions */
|
||||
public $php_functions = ['isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time'];
|
||||
|
||||
/** @var array $php_modifiers Allowed PHP modifiers */
|
||||
public $php_modifiers = ['count', 'nl2br'];
|
||||
|
||||
/** @var int $php_handling Remove native PHP tags */
|
||||
public $php_handling = \Smarty::PHP_REMOVE;
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Smarty;
|
||||
|
||||
use Smarty_Internal_Template;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\TransferTemplateUserException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\TemplateHelper\CommonHelper;
|
||||
use Xentral\Modules\TransferSmartyTemplate\TemplateHelper\CsvHelper;
|
||||
use Xentral\Modules\TransferSmartyTemplate\TemplateHelper\HtmlUrlHelper;
|
||||
use Xentral\Modules\TransferSmartyTemplate\TemplateHelper\XmlHelper;
|
||||
|
||||
final class SmartyTemplateHelper
|
||||
{
|
||||
/** @var XmlHelper $xmlHelper */
|
||||
private $xmlHelper;
|
||||
|
||||
/** @var CsvHelper $csvHelper */
|
||||
private $csvHelper;
|
||||
|
||||
/** @var HtmlUrlHelper $htmlHelper */
|
||||
private $htmlHelper;
|
||||
|
||||
/** @var CommonHelper $commonHelper */
|
||||
private $commonHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->xmlHelper = new XmlHelper();
|
||||
$this->csvHelper = new CsvHelper();
|
||||
$this->htmlHelper = new HtmlUrlHelper();
|
||||
$this->commonHelper = new CommonHelper();
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {escapeXml}{$evilString}{/escapeXml}
|
||||
* @example {escapeXml charset="UTF-32"}{$evilString}{/escapeXml}
|
||||
*
|
||||
* @param array $params
|
||||
* @param mixed $content
|
||||
* @param Smarty_Internal_Template $template
|
||||
* @param bool $repeat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileBlockEscapeXml($params, $content, $template, &$repeat)
|
||||
{
|
||||
// Only output on closing tag @see https://www.smarty.net/docs/en/plugins.block.functions.tpl
|
||||
if ($repeat === true) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$charset = isset($params['charset']) && !empty($params['charset']) ? (string)$params['charset'] : 'UTF-8';
|
||||
|
||||
return $this->xmlHelper->escapeXml($content, $charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {escapeXml}{$evilString}{/escapeXml}
|
||||
* @example {escapeXml charset="UTF-32"}{$evilString}{/escapeXml}
|
||||
*
|
||||
* @param array $params
|
||||
* @param mixed $content
|
||||
* @param Smarty_Internal_Template $template
|
||||
* @param bool $repeat
|
||||
*
|
||||
* @throws TransferTemplateUserException
|
||||
*/
|
||||
public function compileBlockError($params, $content, $template, &$repeat)
|
||||
{
|
||||
if ($repeat === true) {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new TransferTemplateUserException($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example `{cdata}Long text data{/cdata}` => Ausgabe `<![CDATA[Long text data]]>`
|
||||
*
|
||||
* @param array $params
|
||||
* @param mixed $content
|
||||
* @param Smarty_Internal_Template $template
|
||||
* @param bool $repeat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileBlockCdata($params, $content, $template, &$repeat)
|
||||
{
|
||||
// Only output on closing tag @see https://www.smarty.net/docs/en/plugins.block.functions.tpl
|
||||
if ($repeat === true) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->xmlHelper->createXmlCdataSection($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$url|urlEncode}
|
||||
*
|
||||
* @param mixed $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierEncodeUrl($content)
|
||||
{
|
||||
return $this->htmlHelper->encodeUrl($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$url|urlDecode}
|
||||
*
|
||||
* @param mixed $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierDecodeUrl($content)
|
||||
{
|
||||
return $this->htmlHelper->decodeUrl($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example `{"Inhalt"|cdata}` => Ausgabe `<![CDATA[Inhalt]]>`
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierCdata($content)
|
||||
{
|
||||
return $this->xmlHelper->createXmlCdataSection($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function compileModifierError($content)
|
||||
{
|
||||
throw new TransferTemplateUserException($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$value|escapeXml}
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierEscapeXml($content)
|
||||
{
|
||||
return $this->xmlHelper->escapeXml($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$value|quoteCsv}
|
||||
* @example {$value|quoteCsv:"'"}
|
||||
*
|
||||
*
|
||||
* @param string $content
|
||||
* @param string $quoteChar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierQuoteCsv($content, $quoteChar = '"')
|
||||
{
|
||||
if (empty($quoteChar)) {
|
||||
$quoteChar = '"';
|
||||
}
|
||||
|
||||
return $this->csvHelper->quoteCsv($content, (string)$quoteChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$value|htmlEntitiesDecode}
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierDecodeHtmlEntities($content)
|
||||
{
|
||||
return $this->htmlHelper->decodeHtmlEntities($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$value|htmlSpecialCharsDecode}
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierDecodeHtmlSpecialChars($content)
|
||||
{
|
||||
return $this->htmlHelper->decodeHtmlSpecialChars($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts HTML-BR-Tags to line breaks
|
||||
*
|
||||
* @example {$value|br2nl}
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierBr2Nl($content)
|
||||
{
|
||||
return $this->htmlHelper->convertBr2LineBreak($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example {$var|replaceLineBreaks}
|
||||
* @example {$var|replaceLineBreaks:"ZEILENUMBRUCH"}
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $replaceChar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierReplaceLineBreaks($string, $replaceChar = ' ')
|
||||
{
|
||||
return $this->commonHelper->replaceLineBreaks($string, $replaceChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a template variable
|
||||
*
|
||||
* @example {$var|dump}
|
||||
*
|
||||
* @param mixed $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileModifierDumpVariable($data)
|
||||
{
|
||||
return $this->commonHelper->dumpVariable($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\Smarty;
|
||||
|
||||
use Exception;
|
||||
use Smarty;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\FilesystemFailureException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\InvalidArgumentException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\TransferTemplateException;
|
||||
|
||||
final class SmartyWrapper
|
||||
{
|
||||
/** @var Smarty $smarty */
|
||||
private $smarty;
|
||||
|
||||
/**
|
||||
* @param Smarty $smarty
|
||||
*/
|
||||
public function __construct(Smarty $smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type plugin type
|
||||
* @param string $name name of template tag
|
||||
* @param callback $callback PHP callback to register
|
||||
*
|
||||
* @return \Smarty|\Smarty_Internal_Template
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
public function registerPlugin($type, $name, $callback)
|
||||
{
|
||||
return $this->smarty->registerPlugin($type, $name, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Smarty_Internal_Template::fetch()
|
||||
*
|
||||
* @param string $template
|
||||
*
|
||||
* @throws TransferTemplateException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fetch($template = null)
|
||||
{
|
||||
try {
|
||||
return $this->smarty->fetch($template);
|
||||
} catch (Exception $exception) {
|
||||
throw new TransferTemplateException($exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Smarty_Internal_Data::assign()
|
||||
*
|
||||
* @param array|string $tplVar
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assign($tplVar, $value = null)
|
||||
{
|
||||
$this->smarty->assign($tplVar, $value, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Smarty_Internal_Data::append()
|
||||
*
|
||||
* @param array|string $tplVar
|
||||
* @param mixed $value
|
||||
* @param bool $merge
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function append($tplVar, $value = null, $merge = false)
|
||||
{
|
||||
$this->smarty->append($tplVar, $value, $merge, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $tplVar
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clearAssign($tplVar)
|
||||
{
|
||||
$this->smarty->clearAssign($tplVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $varName
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTemplateVars($varName = null)
|
||||
{
|
||||
return $this->smarty->getTemplateVars($varName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segment
|
||||
* @param string $templateDir
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws FilesystemFailureException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addTemplateDir($segment, $templateDir)
|
||||
{
|
||||
if (empty($segment)) {
|
||||
throw new InvalidArgumentException('Required parameter $segment is empty.');
|
||||
}
|
||||
|
||||
if (!is_dir($templateDir)) {
|
||||
if (!mkdir($templateDir, 0777, true) && !is_dir($templateDir)) {
|
||||
throw new FilesystemFailureException(
|
||||
sprintf('Can not create directory "%s" for segment "%s".', $templateDir, $segment)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->smarty->addTemplateDir($templateDir, $segment, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplateDir($segment)
|
||||
{
|
||||
return $this->smarty->getTemplateDir($segment, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplateDirs()
|
||||
{
|
||||
return $this->smarty->getTemplateDir(null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $template
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function existsTemplate($segment, $template)
|
||||
{
|
||||
try {
|
||||
$resourceName = sprintf('[%s]%s', $segment, $template);
|
||||
return $this->smarty->templateExists($resourceName);
|
||||
} catch (Exception $exception) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\TemplateHelper;
|
||||
|
||||
final class CommonHelper
|
||||
{
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $replaceChar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function replaceLineBreaks($string, $replaceChar = ' ')
|
||||
{
|
||||
return (string)preg_replace("/\r\n|\r|\n/", (string)$replaceChar, (string)$string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a template variable
|
||||
*
|
||||
* @example {$var|dump}
|
||||
*
|
||||
* @param mixed $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function dumpVariable($data)
|
||||
{
|
||||
return var_export($data, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\TemplateHelper;
|
||||
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\InvalidArgumentException;
|
||||
|
||||
final class CsvHelper
|
||||
{
|
||||
/**
|
||||
* Quotes and escapes an CSV value
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $enclosure
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function quoteCsv($string, $enclosure = '"')
|
||||
{
|
||||
if (!is_string($enclosure)) {
|
||||
throw new InvalidArgumentException('Invalid argument. Enclosure need to be type string.');
|
||||
}
|
||||
if (strlen($enclosure) !== 1) {
|
||||
throw new InvalidArgumentException('Invalid argument. Enclosure can only be a single character.');
|
||||
}
|
||||
|
||||
$escapedString = (string)str_replace($enclosure, $enclosure . $enclosure, $string);
|
||||
|
||||
return $enclosure . $escapedString . $enclosure;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\TemplateHelper;
|
||||
|
||||
final class HtmlUrlHelper
|
||||
{
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $charset
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function decodeHtmlEntities($string, $charset = 'UTF-8')
|
||||
{
|
||||
// ENT_HTML5 wird benötigt für Umwandlung von '
|
||||
return html_entity_decode($string, ENT_QUOTES | ENT_HTML5, $charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function decodeHtmlSpecialChars($string)
|
||||
{
|
||||
// ENT_HTML5 wird benötigt für Umwandlung von '
|
||||
return htmlspecialchars_decode($string, ENT_QUOTES | ENT_HTML5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeUrl($string)
|
||||
{
|
||||
$string = $this->stripUrlControlChars($string);
|
||||
|
||||
return rawurlencode($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function decodeUrl($string)
|
||||
{
|
||||
$string = $this->stripUrlControlChars($string);
|
||||
|
||||
return rawurldecode($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param bool $lineFeed
|
||||
* @param bool $carriageReturn
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function convertBr2LineBreak($string, $lineFeed = true, $carriageReturn = true)
|
||||
{
|
||||
$breakChars = '';
|
||||
if ((bool)$carriageReturn === true) {
|
||||
$breakChars .= "\r";
|
||||
}
|
||||
if ((bool)$lineFeed === true) {
|
||||
$breakChars .= "\n";
|
||||
}
|
||||
|
||||
$string = str_replace(['<br>', '<br/>', '<br />'], $breakChars, $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter alle Steuerzeichen aus; auch Zeilenumbrüche
|
||||
*
|
||||
* @see https://www.ascii-code.com/l
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function stripUrlControlChars($string)
|
||||
{
|
||||
return (string)preg_replace('/[\x00-\x1f\x7f]/', '', (string)$string);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate\TemplateHelper;
|
||||
|
||||
final class XmlHelper
|
||||
{
|
||||
/**
|
||||
* @param string $string
|
||||
* @param string $charset
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function escapeXml($string, $charset = 'UTF-8')
|
||||
{
|
||||
$string = $this->stripControlChars($string);
|
||||
|
||||
return htmlspecialchars($string, ENT_XML1 | ENT_QUOTES, $charset, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* CDATA-Abschnitt erzeugen
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function createXmlCdataSection($string)
|
||||
{
|
||||
return sprintf('<![CDATA[%s]]>', (string)$string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filtert alle Steuerzeichen aus; außer Zeilenumbrüche, Tabs und Leerzeichen
|
||||
*
|
||||
* @see https://www.ascii-code.com/
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function stripControlChars($string)
|
||||
{
|
||||
// Erlaubte Steuerzeichen
|
||||
// \x09 = Horintal tab (HT) = \t
|
||||
// \x0a = Line feed (LF) = \n
|
||||
// \x0d = Carriage return (CR) = \r
|
||||
$string = (string)preg_replace('/[\x00-\x08]/', '', (string)$string); // Steuerzeichen bis HT und LF
|
||||
$string = (string)preg_replace('/[\x0b\x0c]/', '', (string)$string); // Steuerzeichen zwischen LF und CR
|
||||
$string = (string)preg_replace('/[\x0e-\x1f]/', '', (string)$string); // Steuerzeichen ab CR
|
||||
$string = (string)preg_replace('/[\x7f]/', '', (string)$string); // DELETE
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\TransferSmartyTemplate;
|
||||
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\InvalidArgumentException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\PluginRegistrationFailedException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\SegmentNotFoundException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Exception\TemplateNotFoundException;
|
||||
use Xentral\Modules\TransferSmartyTemplate\Smarty\SmartyWrapper;
|
||||
|
||||
final class TransferSmartyTemplate
|
||||
{
|
||||
/** @var SmartyWrapper $smarty */
|
||||
private $smarty;
|
||||
|
||||
/**
|
||||
* @param SmartyWrapper $smarty
|
||||
*/
|
||||
public function __construct(SmartyWrapper $smarty)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type plugin type
|
||||
* @param string $name name of template tag
|
||||
* @param callback $callback PHP callback to register
|
||||
*
|
||||
* @throws PluginRegistrationFailedException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerPlugin($type, $name, $callback)
|
||||
{
|
||||
try {
|
||||
$this->smarty->registerPlugin($type, $name, $callback);
|
||||
} catch (\SmartyException $exception) {
|
||||
throw new PluginRegistrationFailedException($exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segment
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTemplateDir($segment)
|
||||
{
|
||||
$segment = (string)$segment;
|
||||
$templateDirs = $this->getTemplateDirs();
|
||||
|
||||
return isset($templateDirs[$segment]) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segment
|
||||
*
|
||||
* @throws SegmentNotFoundException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTemplateDir($segment)
|
||||
{
|
||||
$segment = (string)$segment;
|
||||
$templateDirs = $this->getTemplateDirs();
|
||||
if (!isset($templateDirs[$segment])) {
|
||||
throw new SegmentNotFoundException(sprintf('Segment "%s" not found.', $segment));
|
||||
}
|
||||
|
||||
return $templateDirs[$segment];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segment
|
||||
* @param string $templateDir
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addTemplateDir($segment, $templateDir)
|
||||
{
|
||||
$this->smarty->addTemplateDir($segment, $templateDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplateDirs()
|
||||
{
|
||||
return $this->smarty->getTemplateDirs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if template exists
|
||||
*
|
||||
* @param string $segment
|
||||
* @param string $template
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function existsTemplate($segment, $template)
|
||||
{
|
||||
return $this->smarty->existsTemplate($segment, $template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the template and returns the output.
|
||||
*
|
||||
* @param string $segment
|
||||
* @param string $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fetch($segment, $template)
|
||||
{
|
||||
$templatePath = $this->discoverTemplatePath($segment, $template);
|
||||
|
||||
return $this->smarty->fetch($templatePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of one assigned template variable.
|
||||
*
|
||||
* @param string $tplVar
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVar($tplVar)
|
||||
{
|
||||
$this->ensureTemplateVarIsString($tplVar);
|
||||
|
||||
return $this->smarty->getTemplateVars($tplVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all assigned template variables and values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getVars()
|
||||
{
|
||||
return $this->smarty->getTemplateVars(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns a value to a template variable.
|
||||
*
|
||||
* If variable is already assigned, than the value will be overwritten.
|
||||
*
|
||||
* @param string $tplVar
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assign($tplVar, $value)
|
||||
{
|
||||
$this->ensureTemplateVarIsString($tplVar);
|
||||
$this->smarty->assign((string)$tplVar, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns multiple template variables
|
||||
*
|
||||
* Array keys will be used as template variable and array values as value.
|
||||
*
|
||||
* @example assignAssoc(['foo' => 'zof', 'bar' => 'baz']); In Tempalte: {$foo} {$bar}
|
||||
*
|
||||
* @param array $tplVars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assignAssoc(array $tplVars)
|
||||
{
|
||||
foreach ($tplVars as $tplVar => $value) {
|
||||
$this->assign($tplVar, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a template variable
|
||||
*
|
||||
* @param string $tplVar
|
||||
*/
|
||||
public function clearAssign($tplVar)
|
||||
{
|
||||
$this->ensureTemplateVarIsString($tplVar);
|
||||
$this->smarty->clearAssign((string)$tplVar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes multiple template variables
|
||||
*
|
||||
* @param array $tplVars
|
||||
*/
|
||||
public function clearAssoc(array $tplVars)
|
||||
{
|
||||
foreach ($tplVars as $tplVar) {
|
||||
$this->clearAssign($tplVar);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $tplVar
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function ensureTemplateVarIsString($tplVar)
|
||||
{
|
||||
if (!is_string($tplVar)) {
|
||||
throw new InvalidArgumentException('Template variable is not a string.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'default', 'list.tpl' => 'Modules/TransferTempalte/templates/default/list.tpl'
|
||||
*
|
||||
* @param string $segment
|
||||
* @param string $template
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws TemplateNotFoundException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function discoverTemplatePath($segment, $template)
|
||||
{
|
||||
if (empty($segment)) {
|
||||
throw new InvalidArgumentException('Required parameter "$segment" is empty.');
|
||||
}
|
||||
if (empty($template)) {
|
||||
throw new InvalidArgumentException('Required parameter "$template" is empty.');
|
||||
}
|
||||
|
||||
if ($this->smarty->existsTemplate($segment, $template)) {
|
||||
return sprintf('[%s]%s', $segment, $template);
|
||||
}
|
||||
|
||||
throw new TemplateNotFoundException(sprintf('Template "%s" not found in segment "%s".', $template, $segment));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
# Template Funktionen
|
||||
|
||||
## CSV-Funktionen
|
||||
|
||||
### `quoteCsv` – CSV-Wert mit Anführungszeichen umschließen und escapen
|
||||
|
||||
##### Beispiele
|
||||
|
||||
* `{"Inhalt"|quoteCsv}` > `"Inhalt"`
|
||||
* `{"Inh"alt"|quoteCsv}` > `"Inh""alt"`
|
||||
* `{"Inhalt"|quoteCsv:"'"}` > `'Inhalt'`
|
||||
* `{"Inh'alt"|quoteCsv:"'"}` > `'Inh''alt'`
|
||||
|
||||
#### Parameter
|
||||
|
||||
| Pos. | Type | Pflicht | Default | Beschreibung |
|
||||
|------|----------|----------|---------|--------------|
|
||||
| 1 | `string` | Nein | `"` | Umschließendes Zeichen und Escaping-Zeichen |
|
||||
|
||||
|
||||
## XML-Funktionen
|
||||
|
||||
### `escapeXml` – Wert für Ausgabe in XML escapen
|
||||
|
||||
Nachfolgende Zeichen werden umgewandelt. Außerdem werden alle Steuerzeichen (außer Zeilenumbrüche) entfernt.
|
||||
Sollen Zeilenumbrüche zusätzlich entfernt werden, kann der Modifier `stripLineBreaks` verwendet werden.
|
||||
|
||||
| Zeichen | Ersetzung |
|
||||
|---------|-----------|
|
||||
| `"` | `"` |
|
||||
| `'` | `'` |
|
||||
| `<` | `<` |
|
||||
| `>` | `>` |
|
||||
| `&` | `&` |
|
||||
|
||||
|
||||
##### Beispiel als Modifier
|
||||
|
||||
```smarty
|
||||
{$value|escapeXml}
|
||||
```
|
||||
|
||||
##### Beispiel als Block-Funktion
|
||||
|
||||
```smarty
|
||||
{escapeXml}{$value}{/escapeXml}
|
||||
{escapeXml charset="UTF-32"}{$value}{/escapeXml}
|
||||
```
|
||||
|
||||
### `cdata` – CData-Abschnitt erstellen
|
||||
|
||||
##### Beispiel als Modifier
|
||||
|
||||
```smarty
|
||||
{assign var="variable" value="Hello<br>World"}
|
||||
{$variable|cdata}
|
||||
```
|
||||
|
||||
##### Beispiel als Block-Funktion
|
||||
|
||||
```smarty
|
||||
{cdata}Hello<br>World{/cdata}
|
||||
```
|
||||
|
||||
##### Ausgabe
|
||||
|
||||
```
|
||||
<![CDATA[Hello<br>World]]>
|
||||
```
|
||||
|
||||
|
||||
## HTML-Funktionen
|
||||
|
||||
### `br2nl` – BR-Tags in Zeilenumbrüche umwandeln
|
||||
|
||||
##### Beispiel
|
||||
|
||||
```smarty
|
||||
{assign var="variable" value="Hello<br>World"}
|
||||
{$variable|br2nl}
|
||||
```
|
||||
|
||||
##### Ausgabe
|
||||
|
||||
```text
|
||||
Hello
|
||||
World
|
||||
```
|
||||
|
||||
### `decodeHtmlSpecialChars` – HTML-Specialchars dekodieren
|
||||
|
||||
Ersetzt die HTML-Entities für die fünf HTML-Specialchars ( `"`, `'`, `<`, `>`, `&`) durch das ursprüngliche Zeichen.
|
||||
|
||||
### `decodeHtmlEntities` – HTML-Entities dekodieren
|
||||
|
||||
Wandelt alle HTML-Entities (inklusive der HTML-Specialchars) in das ursprüngliche Zeichen zurück.
|
||||
|
||||
|
||||
## URL-Funktionen
|
||||
|
||||
### `encodeUrl`
|
||||
|
||||
Kodiert einen String für die Verwendung in einer URL
|
||||
|
||||
### `decodeUrl`
|
||||
|
||||
Dekodiert einen URL-kodierten String
|
||||
|
||||
|
||||
## Sonstige Funktionen
|
||||
|
||||
### `replaceLineBreaks` – Zeilenumbrüche ersetzen
|
||||
|
||||
##### Beispiel
|
||||
|
||||
```smarty
|
||||
{$variable|replaceLineBreaks}
|
||||
{$variable|replaceLineBreaks:" ZEILENUMBRUCH "}
|
||||
```
|
||||
|
||||
##### Ausgabe
|
||||
|
||||
```text
|
||||
Hello World
|
||||
Hello ZEILENUMBRUCH World
|
||||
```
|
||||
|
||||
### `dump` – Variablen-Inhalt ausgeben
|
||||
|
||||
_Methode ist nur zum Debuggen gedacht; nicht für den Einsatz in Produktiv-Umgebungen!_
|
||||
|
||||
##### Beispiel
|
||||
|
||||
```smarty
|
||||
{$article|dump}
|
||||
```
|
||||
|
||||
##### Ausgabe
|
||||
|
||||
```text
|
||||
(object) array(
|
||||
'id' => '15',
|
||||
'typ' => '2_kat',
|
||||
'nummer' => '1000001',
|
||||
'projekt' => '1',
|
||||
...
|
||||
)
|
||||
```
|
||||
_Ausgabe wurde gekürzt._
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
nummer;mhddatum;lagerzahl;lagerplatz;
|
||||
{foreach from=$artikelliste key=keyrow item=artikel}{* Artikel *}
|
||||
{if $artikel->mindesthaltbarkeitsdatum}
|
||||
{strip}
|
||||
{$artikel->nummer|quoteCsv};
|
||||
{$artikel->mhddatum|quoteCsv};
|
||||
{$artikel->menge|quoteCsv};
|
||||
{$artikel->kurzbezeichnung|quoteCsv};
|
||||
{/strip}
|
||||
{/if}
|
||||
{/foreach}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<artikelliste>
|
||||
{foreach from=$artikelliste key=keyrow item=artikel}{* Artikel *}
|
||||
{if $artikel->mindesthaltbarkeitsdatum}<artikel>
|
||||
<nummer>{$artikel->nummer}</nummer>
|
||||
<mhd>{$artikel->mhddatum}</mhd>
|
||||
<lagerzahl>{$artikel->menge}</lagerzahl>
|
||||
<lagerplatz>{$artikel->kurzbezeichnung}</lagerplatz>
|
||||
</artikel>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</artikelliste>
|
||||
@@ -0,0 +1,10 @@
|
||||
nummer;lagerzahl;lagerplatz;
|
||||
{foreach from=$artikelliste key=keyrow item=artikel}{* Artikel *}
|
||||
{if !$artikel->mindesthaltbarkeitsdatum}
|
||||
{strip}
|
||||
{$artikel->nummer|quoteCsv};
|
||||
{$artikel->menge|quoteCsv};
|
||||
{$artikel->kurzbezeichnung|quoteCsv};
|
||||
{/strip}
|
||||
{/if}
|
||||
{/foreach}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<artikelliste>
|
||||
{foreach from=$artikelliste key=keyrow item=artikel}{* Artikel *}
|
||||
{if !$artikel->mindesthaltbarkeitsdatum}<artikel>
|
||||
<nummer>{$artikel->nummer|escapeXml}</nummer>
|
||||
<lagerzahl>{$artikel->menge|escapeXml}</lagerzahl>
|
||||
<lagerplatz>{$artikel->kurzbezeichnung|escapeXml}</lagerplatz>
|
||||
</artikel>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</artikelliste>
|
||||
@@ -0,0 +1,9 @@
|
||||
nummer;name_de;name_en;anabregs_text;
|
||||
{foreach from=$artikelliste key=keyrow item=artikel}{* Artikel *}
|
||||
{strip}
|
||||
{$artikel->nummer|quoteCsv};
|
||||
{$artikel->name_de|quoteCsv};
|
||||
{$artikel->name_en|quoteCsv};
|
||||
{$artikel->anabregs_text|quoteCsv};
|
||||
{/strip}
|
||||
{/foreach}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<artikelliste>
|
||||
{foreach from=$artikelliste key=keyrow item=artikel}{* Artikel *}
|
||||
<artikel>
|
||||
<nummer>{$artikel->nummer|escapeXml}</nummer>
|
||||
<name_de>{$artikel->name_de|escapeXml}</name_de>
|
||||
<name_en>{$artikel->name_en|escapeXml}</name_en>
|
||||
<anabregs_text>{cdata}{$artikel->anabregs_text}{/cdata}</anabregs_text>
|
||||
</artikel>
|
||||
{/foreach}
|
||||
</artikelliste>
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
"tracking";"beleg_status";"beleg_datum";"beleg_lieferdatum";"beleg_tatsaechlicheslieferdatum";"beleg_versandart";"beleg_zahlungsweise";"beleg_belegnr";"beleg_hauptbelegnr";"beleg_kundennummer";"beleg_name";"beleg_abteilung";"beleg_unterabteilung";"beleg_adresszusatz";"beleg_ansprechpartner";"beleg_telefon";"beleg_email";"beleg_land";"beleg_strasse";"beleg_plz";"beleg_ort";"beleg_projekt";"beleg_aktion";"beleg_internebemerkung";"beleg_internebezeichnung";"beleg_freitext";"beleg_ihrebestellnummer";"beleg_lieferbedingung";"beleg_art";"artikel_nummer";"artikel_bezeichnung";"artikel_beschreibung";"artikel_menge";"artikel_preis";"artikel_rabatt";"artikel_waehrung";"artikel_lieferdatum";"artikel_sort";"artikel_umsatzsteuer";"artikel_einheit";"artikel_zolltarifnummer";"artikel_herkunftsland";"artikel_artikelnummerkunde";"artikel_freifeld1";"artikel_freifeld2";"artikel_freifeld3";"artikel_freifeld4";"artikel_freifeld5";"artikel_freifeld6";"artikel_freifeld7";"artikel_freifeld8";"artikel_freifeld9";"artikel_freifeld10";"artikel_freifeld11";"artikel_freifeld12";"artikel_freifeld13";"artikel_freifeld14";"artikel_freifeld15";"artikel_freifeld16";"artikel_freifeld17";"artikel_freifeld18";"artikel_freifeld19";"artikel_freifeld20";"artikel_freifeld21";"artikel_freifeld22";"artikel_freifeld23";"artikel_freifeld24";"artikel_freifeld25";"artikel_freifeld26";"artikel_freifeld27";"artikel_freifeld28";"artikel_freifeld29";"artikel_freifeld30";"artikel_freifeld31";"artikel_freifeld32";"artikel_freifeld33";"artikel_freifeld34";"artikel_freifeld35";"artikel_freifeld36";"artikel_freifeld37";"artikel_freifeld38";"artikel_freifeld39";"artikel_freifeld40"
|
||||
{foreach from=$beleg->positionen key=keyrow item=position}{* Positionen *}
|
||||
{strip}
|
||||
{$position->tracking|quoteCsv};
|
||||
{$beleg->status|quoteCsv};
|
||||
{$beleg->datum|date_format:'%d.%m.%Y'|quoteCsv};
|
||||
{$beleg->lieferdatum|quoteCsv};
|
||||
{$beleg->tatsaechlicheslieferdatum|quoteCsv};
|
||||
{$beleg->versandart|quoteCsv};
|
||||
{$beleg->zahlungsweise|quoteCsv};
|
||||
{$beleg->belegnr|quoteCsv};
|
||||
{$beleg->hauptbelegnr|quoteCsv};
|
||||
{$beleg->kundennummer|quoteCsv};
|
||||
{$beleg->name|quoteCsv};
|
||||
{$beleg->abteilung|quoteCsv};
|
||||
{$beleg->unterabteilung|quoteCsv};
|
||||
{$beleg->adresszusatz|quoteCsv};
|
||||
{$beleg->ansprechpartner|quoteCsv};
|
||||
{$beleg->telefon|quoteCsv};
|
||||
{$beleg->email|quoteCsv};
|
||||
{$beleg->land|quoteCsv};
|
||||
{$beleg->strasse|quoteCsv};
|
||||
{$beleg->plz|quoteCsv};
|
||||
{$beleg->ort|quoteCsv};
|
||||
{$beleg->projekt|quoteCsv};
|
||||
{$beleg->aktion|quoteCsv};
|
||||
{$beleg->internebemerkung|quoteCsv};
|
||||
{$beleg->internebezeichnung|quoteCsv};
|
||||
{$beleg->freitext|quoteCsv};
|
||||
{$beleg->ihrebestellnummer|quoteCsv};
|
||||
{$beleg->lieferbedingung|quoteCsv};
|
||||
{$beleg->art|quoteCsv};
|
||||
{$position->nummer|quoteCsv};
|
||||
{$position->bezeichnung|quoteCsv};
|
||||
{$position->beschreibung|quoteCsv};
|
||||
{$position->menge|quoteCsv};
|
||||
{$position->preis|quoteCsv};
|
||||
{$position->rabatt|quoteCsv};
|
||||
{$position->waehrung|quoteCsv};
|
||||
{$position->lieferdatum|quoteCsv};
|
||||
{$position->sort|quoteCsv};
|
||||
{$position->umsatzsteuer|quoteCsv};
|
||||
{$position->einheit|quoteCsv};
|
||||
{$position->zolltarifnummer|quoteCsv};
|
||||
{$position->herkunftsland|quoteCsv};
|
||||
{$position->artikelnummerkunde|quoteCsv};
|
||||
{$position->freifeld1|quoteCsv};
|
||||
{$position->freifeld2|quoteCsv};
|
||||
{$position->freifeld3|quoteCsv};
|
||||
{$position->freifeld4|quoteCsv};
|
||||
{$position->freifeld5|quoteCsv};
|
||||
{$position->freifeld6|quoteCsv};
|
||||
{$position->freifeld7|quoteCsv};
|
||||
{$position->freifeld8|quoteCsv};
|
||||
{$position->freifeld9|quoteCsv};
|
||||
{$position->freifeld10|quoteCsv};
|
||||
{$position->freifeld11|quoteCsv};
|
||||
{$position->freifeld12|quoteCsv};
|
||||
{$position->freifeld13|quoteCsv};
|
||||
{$position->freifeld14|quoteCsv};
|
||||
{$position->freifeld15|quoteCsv};
|
||||
{$position->freifeld16|quoteCsv};
|
||||
{$position->freifeld17|quoteCsv};
|
||||
{$position->freifeld18|quoteCsv};
|
||||
{$position->freifeld19|quoteCsv};
|
||||
{$position->freifeld20|quoteCsv};
|
||||
{$position->freifeld21|quoteCsv};
|
||||
{$position->freifeld22|quoteCsv};
|
||||
{$position->freifeld23|quoteCsv};
|
||||
{$position->freifeld24|quoteCsv};
|
||||
{$position->freifeld25|quoteCsv};
|
||||
{$position->freifeld26|quoteCsv};
|
||||
{$position->freifeld27|quoteCsv};
|
||||
{$position->freifeld28|quoteCsv};
|
||||
{$position->freifeld29|quoteCsv};
|
||||
{$position->freifeld30|quoteCsv};
|
||||
{$position->freifeld31|quoteCsv};
|
||||
{$position->freifeld32|quoteCsv};
|
||||
{$position->freifeld33|quoteCsv};
|
||||
{$position->freifeld34|quoteCsv};
|
||||
{$position->freifeld35|quoteCsv};
|
||||
{$position->freifeld36|quoteCsv};
|
||||
{$position->freifeld37|quoteCsv};
|
||||
{$position->freifeld38|quoteCsv};
|
||||
{$position->freifeld39|quoteCsv};
|
||||
{$position->freifeld40|quoteCsv};
|
||||
{/strip}
|
||||
{/foreach}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<lieferschein>
|
||||
<status>{$beleg->status|escapeXml}</status>
|
||||
<datum>{$beleg->datum|date_format:'%d.%m.%Y'|escapeXml}</datum>
|
||||
<lieferdatum>{$beleg->lieferdatum|escapeXml}</lieferdatum>
|
||||
<tatsaechlicheslieferdatum>{$beleg->tatsaechlicheslieferdatum|escapeXml}</tatsaechlicheslieferdatum>
|
||||
<versandart>{$beleg->versandart|escapeXml}</versandart>
|
||||
<zahlungsweise>{$beleg->zahlungsweise|escapeXml}</zahlungsweise>
|
||||
<belegnr>{$beleg->belegnr|escapeXml}</belegnr>
|
||||
<hauptbelegnr>{$beleg->hauptbelegnr|escapeXml}</hauptbelegnr>
|
||||
<kundennummer>{$beleg->kundennummer|escapeXml}</kundennummer>
|
||||
<name>{$beleg->name|escapeXml}</name>
|
||||
<abteilung>{$beleg->abteilung|escapeXml}</abteilung>
|
||||
<unterabteilung>{$beleg->unterabteilung|escapeXml}</unterabteilung>
|
||||
<adresszusatz>{$beleg->adresszusatz|escapeXml}</adresszusatz>
|
||||
<ansprechpartner>{$beleg->ansprechpartner|escapeXml}</ansprechpartner>
|
||||
<telefon>{$beleg->telefon|escapeXml}</telefon>
|
||||
<email>{$beleg->email|escapeXml}</email>
|
||||
<land>{$beleg->land|escapeXml}</land>
|
||||
<strasse>{$beleg->strasse|escapeXml}</strasse>
|
||||
<plz>{$beleg->plz|escapeXml}</plz>
|
||||
<ort>{$beleg->ort|escapeXml}</ort>
|
||||
<projekt>{$beleg->projekt|escapeXml}</projekt>
|
||||
<aktion>{$beleg->aktion|escapeXml}</aktion>
|
||||
<internebemerkung>{$beleg->internebemerkung|escapeXml}</internebemerkung>
|
||||
<internebezeichnung>{$beleg->internebezeichnung|escapeXml}</internebezeichnung>
|
||||
<freitext>{$beleg->freitext|escapeXml}</freitext>
|
||||
<ihrebestellnummer>{$beleg->ihrebestellnummer|escapeXml}</ihrebestellnummer>
|
||||
<lieferbedingung>{$beleg->lieferbedingung|escapeXml}</lieferbedingung>
|
||||
<art>{$beleg->art|escapeXml}</art>
|
||||
<positionen>
|
||||
{foreach from=$beleg->positionen key=keyrow item=position}{* Positionen *}
|
||||
<position>
|
||||
<nummer>{$position->nummer|escapeXml}</nummer>
|
||||
<bezeichnung>{$position->bezeichnung|escapeXml}</bezeichnung>
|
||||
<beschreibung>{$position->beschreibung|escapeXml}</beschreibung>
|
||||
<menge>{$position->menge|escapeXml}</menge>
|
||||
<preis>{$position->preis|escapeXml}</preis>
|
||||
<rabatt>{$position->rabatt|escapeXml}</rabatt>
|
||||
<waehrung>{$position->waehrung|escapeXml}</waehrung>
|
||||
<lieferdatum>{$position->lieferdatum|escapeXml}</lieferdatum>
|
||||
<sort>{$position->sort|escapeXml}</sort>
|
||||
<umsatzsteuer>{$position->umsatzsteuer|escapeXml}</umsatzsteuer>
|
||||
<einheit>{$position->einheit|escapeXml}</einheit>
|
||||
<zolltarifnummer>{$position->zolltarifnummer|escapeXml}</zolltarifnummer>
|
||||
<herkunftsland>{$position->herkunftsland|escapeXml}</herkunftsland>
|
||||
<artikelnummerkunde>{$position->artikelnummerkunde|escapeXml}</artikelnummerkunde>
|
||||
<freifeld1>{$position->freifeld1|escapeXml}</freifeld1>
|
||||
<freifeld2>{$position->freifeld2|escapeXml}</freifeld2>
|
||||
<freifeld3>{$position->freifeld3|escapeXml}</freifeld3>
|
||||
<freifeld4>{$position->freifeld4|escapeXml}</freifeld4>
|
||||
<freifeld5>{$position->freifeld5|escapeXml}</freifeld5>
|
||||
<freifeld6>{$position->freifeld6|escapeXml}</freifeld6>
|
||||
<freifeld7>{$position->freifeld7|escapeXml}</freifeld7>
|
||||
<freifeld8>{$position->freifeld8|escapeXml}</freifeld8>
|
||||
<freifeld9>{$position->freifeld9|escapeXml}</freifeld9>
|
||||
<freifeld10>{$position->freifeld10|escapeXml}</freifeld10>
|
||||
<freifeld11>{$position->freifeld11|escapeXml}</freifeld11>
|
||||
<freifeld12>{$position->freifeld12|escapeXml}</freifeld12>
|
||||
<freifeld13>{$position->freifeld13|escapeXml}</freifeld13>
|
||||
<freifeld14>{$position->freifeld14|escapeXml}</freifeld14>
|
||||
<freifeld15>{$position->freifeld15|escapeXml}</freifeld15>
|
||||
<freifeld16>{$position->freifeld16|escapeXml}</freifeld16>
|
||||
<freifeld17>{$position->freifeld17|escapeXml}</freifeld17>
|
||||
<freifeld18>{$position->freifeld18|escapeXml}</freifeld18>
|
||||
<freifeld19>{$position->freifeld19|escapeXml}</freifeld19>
|
||||
<freifeld20>{$position->freifeld20|escapeXml}</freifeld20>
|
||||
<freifeld21>{$position->freifeld21|escapeXml}</freifeld21>
|
||||
<freifeld22>{$position->freifeld22|escapeXml}</freifeld22>
|
||||
<freifeld23>{$position->freifeld23|escapeXml}</freifeld23>
|
||||
<freifeld24>{$position->freifeld24|escapeXml}</freifeld24>
|
||||
<freifeld25>{$position->freifeld25|escapeXml}</freifeld25>
|
||||
<freifeld26>{$position->freifeld26|escapeXml}</freifeld26>
|
||||
<freifeld27>{$position->freifeld27|escapeXml}</freifeld27>
|
||||
<freifeld28>{$position->freifeld28|escapeXml}</freifeld28>
|
||||
<freifeld29>{$position->freifeld29|escapeXml}</freifeld29>
|
||||
<freifeld30>{$position->freifeld30|escapeXml}</freifeld30>
|
||||
<freifeld31>{$position->freifeld31|escapeXml}</freifeld31>
|
||||
<freifeld32>{$position->freifeld32|escapeXml}</freifeld32>
|
||||
<freifeld33>{$position->freifeld33|escapeXml}</freifeld33>
|
||||
<freifeld34>{$position->freifeld34|escapeXml}</freifeld34>
|
||||
<freifeld35>{$position->freifeld35|escapeXml}</freifeld35>
|
||||
<freifeld36>{$position->freifeld36|escapeXml}</freifeld36>
|
||||
<freifeld37>{$position->freifeld37|escapeXml}</freifeld37>
|
||||
<freifeld38>{$position->freifeld38|escapeXml}</freifeld38>
|
||||
<freifeld39>{$position->freifeld39|escapeXml}</freifeld39>
|
||||
<freifeld40>{$position->freifeld40|escapeXml}</freifeld40>
|
||||
</position>
|
||||
{/foreach}
|
||||
</positionen>
|
||||
{if $beleg->versand}
|
||||
<tracking>
|
||||
{foreach from=$beleg->versand key=keyversand item=tracking}{* Versand *}
|
||||
<tracking>{$tracking->tracking|escapeXml}</tracking>
|
||||
{/foreach}
|
||||
</tracking>
|
||||
{/if}
|
||||
</lieferschein>
|
||||
@@ -0,0 +1,12 @@
|
||||
auftrag;nummer;ean;name_de;menge;verkaufspreis;einkaufspreis;
|
||||
{foreach from=$salesreportlist key=keyrow item=auftrag}
|
||||
{strip}
|
||||
{$auftrag->auftrag|quoteCsv};
|
||||
{$auftrag->nummer|quoteCsv};
|
||||
{$auftrag->ean|quoteCsv};
|
||||
{$auftrag->name_de|quoteCsv};
|
||||
{$auftrag->menge|quoteCsv};
|
||||
{$auftrag->verkaufspreis|quoteCsv};
|
||||
{$auftrag->einkaufspreis|quoteCsv};
|
||||
{/strip}
|
||||
{/foreach}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<salesreport_list>
|
||||
{foreach from=$salesreportlist key=keyrow item=auftrag}{* Belege *}
|
||||
<auftrag>
|
||||
<belegnr>{$auftrag->auftrag|escapeXml}</belegnr>
|
||||
<artikelnummer>{$auftrag->nummer|escapeXml}</artikelnummer>
|
||||
<ean>{$auftrag->ean|escapeXml}</ean>
|
||||
<name_de>{$auftrag->name_de|escapeXml}</name_de>
|
||||
<menge>{$auftrag->menge|escapeXml}</menge>
|
||||
<verkaufspreis>{$auftrag->verkaufspreis|escapeXml}</verkaufspreis>
|
||||
<rabatt>{$auftrag->rabatt|escapeXml}</rabatt>
|
||||
<einkaufspreis>{$auftrag->einkaufspreis|escapeXml}</einkaufspreis>
|
||||
</auftrag>
|
||||
{/foreach}
|
||||
</salesreport_list>
|
||||
@@ -0,0 +1,13 @@
|
||||
lieferscheinnummer;auftrag;tracking;name;strasse;plz;ort;land;
|
||||
{foreach from=$trackingliste key=keyrow item=tracking}{* Belege *}
|
||||
{strip}
|
||||
{$tracking->lieferscheinnummer|quoteCsv};
|
||||
{$tracking->auftrag|quoteCsv};
|
||||
{$tracking->tracking|quoteCsv};
|
||||
{$tracking->name|quoteCsv};
|
||||
{$tracking->strasse|quoteCsv};
|
||||
{$tracking->plz|quoteCsv};
|
||||
{$tracking->ort|quoteCsv};
|
||||
{$tracking->land|quoteCsv};
|
||||
{/strip}
|
||||
{/foreach}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<lieferschein_liste>
|
||||
{foreach from=$trackingliste key=keyrow item=tracking}{* Belege *}
|
||||
<lieferschein>
|
||||
<lieferscheinnummer>{$tracking->lieferscheinnummer|escapeXml}</lieferscheinnummer>
|
||||
<auftrag>{$tracking->auftrag|escapeXml}</auftrag>
|
||||
<tracking>{$tracking->tracking|escapeXml}</tracking>
|
||||
<name>{$tracking->name|escapeXml}</name>
|
||||
<strasse>{$tracking->strasse|escapeXml}</strasse>
|
||||
<plz>{$tracking->plz|escapeXml}</plz>
|
||||
<ort>{$tracking->ort|escapeXml}</ort>
|
||||
<land>{$tracking->land|escapeXml}</land>
|
||||
</lieferschein>
|
||||
{/foreach}
|
||||
</lieferschein_liste>
|
||||
Reference in New Issue
Block a user