<?php

/**
 * This Software is the property of Data Development and is protected
 * by copyright law - it is NOT Freeware.
 *
 * Any unauthorized use of this software without a valid license
 * is a violation of the license agreement and will be prosecuted by
 * civil and criminal law.
 *
 * https://www.d3data.de
 *
 * @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
 * @author    D3 Data Development - Daniel Seifert <support@shopmodule.com>
 * @link      https://www.oxidmodule.com
 */

namespace D3\Ordermanager\Setup;

use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
use D3\ModCfg\Application\Model\d3bitmask;
use D3\ModCfg\Application\Model\d3database;
use D3\ModCfg\Application\Model\d3str;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
use D3\ModCfg\Application\Model\Installwizzard\d3installdbrecord;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\FetchMode;
use Exception;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Exception\ConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Application\Model\Shop;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Facts\Facts;
use Doctrine\DBAL\Driver\PDOException;
use ReflectionException;
use stdClass;

class d3ordermanager_update extends d3install_updatebase
{
    public $sModKey = 'd3_ordermanager';
    public $sModName = 'Auftragsmanager';
    public $sModVersion = '4.1.1.0';
    public $sModRevision = '4110';
    public $sBaseConf =
    'JFiv2==NnV0bDJpVjNtUHYwRGpJc2p0OXQrNXN0VmtLWGdpQWpENEFtQU1rR2dOL3JUY09OZ2EvZ2VaV
jVtZXErYis4dG5ON1dPTHhEWnJsaFdCMzYxNmhLSk9zSHlMcXpXS2c4V0NybTlCblBkMUEzZ3JmaElPM
EdCelZnakdCSkx6WEVnVXlDTjFUc1R2b0ZWQnBJdXJRcXN3eS9rMkdGQTlhbFN3RlNydGM5NmZYUnFyc
WZXRTNVMGt6b281eHlJek5sN1NIZjdHWjV0YlZ1aWhuaG1VOVlIZVpUdzBwMk5rdnVpSHY5ZllLbmxEU
C9rbnFvMTFyTjV6SGdRdlNyaFRTM3dybEVuQXZNRVBDZk1UN1VRenFWZUVCRjFpclVlbDJnZm5GOGV1N
jMyRlBYaHZ0ZUd0dDYrdzVBTkpvZ0x6ZnRtNklMdFVseEpqK210bzJQclY4ZElnPT0=';
    public $sRequirements = '';
    public $sBaseValue = 'TyUzQTglM0ElMjJzdGRDbGFzcyUyMiUzQTUlM0ElN0JzJTNBMjMlM0ElMjJkM19jZmdfbW9kX19hRm9sZGVyTGlzdCUyMiUzQmElM0E1JTNBJTdCaSUzQTAlM0JzJTNBMjUlM0ElMjJEM19PUkRFUk1BTkFHRVJfT1JERVJfTkVXJTIyJTNCaSUzQTElM0JzJTNBMzIlM0ElMjJEM19PUkRFUk1BTkFHRVJfT1JERVJfUEFZQURWQU5DRSUyMiUzQmklM0EyJTNCcyUzQTM2JTNBJTIyRDNfT1JERVJNQU5BR0VSX09SREVSX1BBWVNUQVRVU0NIRUNLJTIyJTNCaSUzQTMlM0JzJTNBMzYlM0ElMjJEM19PUkRFUk1BTkFHRVJfT1JERVJfREVMSVZFUllTVEFUVVMlMjIlM0JpJTNBNCUzQnMlM0EzNyUzQSUyMkQzX09SREVSTUFOQUdFUl9PUkRFUl9PUkRFUlBST0NFU1NJTkclMjIlM0IlN0RzJTNBMjQlM0ElMjJkM19jZmdfbW9kX19ibENyb25BY3RpdmUlMjIlM0JzJTNBMSUzQSUyMjAlMjIlM0JzJTNBMjQlM0ElMjJkM19jZmdfbW9kX19pTWF4T3JkZXJDbnQlMjIlM0JzJTNBMiUzQSUyMjUwJTIyJTNCcyUzQTI1JTNBJTIyZDNfY2ZnX21vZF9fc0Nyb25QYXNzd29yZCUyMiUzQnMlM0EwJTNBJTIyJTIyJTNCcyUzQTMwJTNBJTIyZDNfY2ZnX21vZF9fYmxDYWxjU3RhdE9uRGVtYW5kJTIyJTNCcyUzQTElM0ElMjIwJTIyJTNCJTdE';

    public $sMinModCfgVersion = '5.3.1.2';
    
    protected $_aUpdateMethods = array(
        array('check' => 'doesOrder2OrderManagerTableNotExist',
              'do'    => 'addOrder2OrderManagerTable'),
        array('check' => 'doesModCfgItemNotExist',
              'do'    => 'addModCfgItem'),
        array('check' => 'checkFields',
              'do'    => 'fixFields'),
        array('check' => 'checkIndizes',
              'do'    => 'fixIndizes'),
        array('check' => 'checkOrderManagerTableExist',
              'do'    => 'convertOrderManagerItems'),
        array('check' => 'checkCronPasswordSet',
              'do'    => 'createCronPassword'),
        array('check' => 'needExampleJobList',
              'do'    => 'addExampleJobList'),
        array('check' => 'isExampleContentMissingInDatabase',
              'do'    => 'addExampleContentList'),
        array('check' => 'requireExample2ShopRelation',
              'do'    => 'addExample2ShopRelation'),
        array('check' => 'hasNotOrderArticlesParentId',
              'do'    => 'addOrderArticlesParentId'),
        array('check' => 'hasUnregisteredFiles',
              'do'    => 'showUnregisteredFiles'),
        array('check' => 'checkModCfgSameRevision',
              'do'    => 'updateModCfgSameRevision'),
    );

    // Standardwerte für checkMultiLangTables() und fixRegisterMultiLangTables()
    public $aMultiLangTables = array();

    public $aFields = array(
        'PROF_EXECMANUALLY'        => array(
            'sTableName'  => 'd3modprofile',
            'sFieldName'  => 'D3_OM_EXECMANUALLY',
            'sType'       => 'TINYINT(1)',
            'blNull'      => false,
            'sDefault'    => '0',
            'sComment'    => 'order manager: job is manually executable',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'PROF_ORDERSAVETRIGGERED'        => array(
            'sTableName'  => 'd3modprofile',
            'sFieldName'  => 'D3_OM_ORDERSAVETRIGGERED',
            'sType'       => 'TINYINT(1)',
            'blNull'      => false,
            'sDefault'    => '0',
            'sComment'    => 'order manager: job will executed on order::save',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'PROF_ORDERFINISHTRIGGERED'        => array(
            'sTableName'  => 'd3modprofile',
            'sFieldName'  => 'D3_OM_ORDERFINISHTRIGGERED',
            'sType'       => 'TINYINT(1)',
            'blNull'      => false,
            'sDefault'    => '0',
            'sComment'    => 'order manager: job will executed after order::finalizeOrder',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'PROF_MARKORDER'        => array(
            'sTableName'  => 'd3modprofile',
            'sFieldName'  => 'D3_OM_MARKORDER',
            'sType'       => 'TINYINT(1)',
            'blNull'      => false,
            'sDefault'    => '0',
            'sComment'    => 'order manager: mark orders as finished',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'PROF_CRONJOBID'        => array(
            'sTableName'  => 'd3modprofile',
            'sFieldName'  => 'D3_CRONJOBID',
            'sType'       => 'VARCHAR(8)',
            'blNull'      => false,
            'sDefault'    => 0,
            'sComment'    => 'ID for identifying via cronjob',
            'sExtra'      => '',
            'blMultilang' => false,
        ),

        'O_OXID'    => array(
            'sTableName'  => 'd3order2ordermanager',
            'sFieldName'  => 'OXID',
            'sType'       => 'CHAR(32)',
            'blNull'      => false,
            'sDefault'    => false,
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'O_OXORDERID'    => array(
            'sTableName'  => 'd3order2ordermanager',
            'sFieldName'  => 'OXORDERID',
            'sType'       => 'CHAR(32)',
            'blNull'      => false,
            'sDefault'    => false,
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'O_OXORDERMANAGERID'    => array(
            'sTableName'  => 'd3order2ordermanager',
            'sFieldName'  => 'OXORDERMANAGERID',
            'sType'       => 'CHAR(32)',
            'blNull'      => false,
            'sDefault'    => false,
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'O_OXREMARKID'    => array(
            'sTableName'  => 'd3order2ordermanager',
            'sFieldName'  => 'OXREMARKID',
            'sType'       => 'CHAR(32)',
            'blNull'      => false,
            'sDefault'    => false,
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'O_OXEXECDATE'    => array(
            'sTableName'  => 'd3order2ordermanager',
            'sFieldName'  => 'OXEXECDATE',
            'sType'       => 'TIMESTAMP',
            'blNull'      => false,
            'sDefault'    => 'CURRENT_TIMESTAMP',
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'O_OXDONTUSEFORCHECK'    => array(
            'sTableName'  => 'd3order2ordermanager',
            'sFieldName'  => 'OXDONTUSEFORCHECK',
            'sType'       => 'TINYINT(1)',
            'blNull'      => false,
            'sDefault'    => '0',
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'OXREMARKTYPE'    => array(
            'sTableName'  => 'oxremark',
            'sFieldName'  => 'OXTYPE',
            'sType'       => 'ENUM("d3om")',
            'blNull'      => false,
            'sDefault'    => 'r',
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
        'OXPARENTID'    => array(
            'sTableName'  => 'oxorderarticles',
            'sFieldName'  => 'OXPARENTID',
            'sType'       => 'CHAR(32)',
            'blNull'      => false,
            'sDefault'    => '',
            'sComment'    => '',
            'sExtra'      => '',
            'blMultilang' => false,
        ),
    );

    public $aIndizes = array(
        'MP_D3_OM_EXECMANUALLY' => array(
            'sTableName' => 'd3modprofile',
            'sType'      => d3database::INDEX_TYPE_INDEX,
            'sName'      => 'D3_OM_EXECMANUALLY',
            'aFields'    => array(
                'D3_OM_EXECMANUALLY' => 'D3_OM_EXECMANUALLY',
            ),
        ),
        'MP_D3_OM_ORDERSAVETRIGGERED' => array(
            'sTableName' => 'd3modprofile',
            'sType'      => d3database::INDEX_TYPE_INDEX,
            'sName'      => 'D3_OM_ORDERSAVETRIGGERED',
            'aFields'    => array(
                'D3_OM_ORDERSAVETRIGGERED' => 'D3_OM_ORDERSAVETRIGGERED',
            ),
        ),
        'MP_D3_OM_ORDERFINISHTRIGGERED' => array(
            'sTableName' => 'd3modprofile',
            'sType'      => d3database::INDEX_TYPE_INDEX,
            'sName'      => 'D3_OM_ORDERFINISHTRIGGERED',
            'aFields'    => array(
                'D3_OM_ORDERFINISHTRIGGERED' => 'D3_OM_ORDERFINISHTRIGGERED',
            ),
        ),
        'O_OXID' => array(
            'sTableName' => 'd3order2ordermanager',
            'sType'      => d3database::INDEX_TYPE_PRIMARY,
            'sName'      => 'PRIMARY',
            'aFields'    => array(
                'OXID' => 'OXID',
            ),
        ),
        'O2OM_OXORDERMANAGERID' => array(
            'sTableName' => 'd3order2ordermanager',
            'sType'      => d3database::INDEX_TYPE_INDEX,
            'sName'      => 'OXORDERMANAGERID',
            'aFields'    => array(
                'OXORDERMANAGERID' => 'OXORDERMANAGERID',
            ),
        ),
        'O2OM_OXORDERID' => array(
            'sTableName' => 'd3order2ordermanager',
            'sType'      => d3database::INDEX_TYPE_INDEX,
            'sName'      => 'OXORDERID',
            'aFields'    => array(
                'OXORDERID' => 'OXORDERID',
            ),
        ),
    );

    protected $_aRefreshMetaModuleIds = array('d3ordermanager');

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function checkOrderManagerTableExist()
    {
        return !$this->_checkTableNotExist('d3ordermanager');
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws ConnectionException
     */
    public function convertOrderManagerItems()
    {
        $blReturn = false;
        if ($this->checkOrderManagerTableExist()) {
            $this->_changeItemContent('d3ordermanager__', '');
// ToDo: move this to generic methods in install_updatebase
            $aWhere = array();

            $aFieldLists = $this->_prepareConvertAssignments(
                'd3ordermanager',
                $this->_getConvertAssignments(),
                'd3modprofile'
            );

            $aSql = $this->_getDatabaseHandler()->getDataConvertQuery(
                'd3ordermanager',
                'd3modprofile',
                $aFieldLists['from'],
                $aFieldLists['to'],
                $aWhere
            );

            $sSql = implode('', $aSql);

            if ($this->hasExecute()) {
                try {
                    $this->getDb()->execute($sSql);
                    $blReturn = true;
                } catch  (PDOException $exception) {
                    if ($exception->errorInfo[1]) {
                        $this->setErrorMessage($exception->errorInfo[2]);
                    }
                    $blReturn = false;
                }
            } else {
                $blReturn = true;
            }

            $this->setUpdateBreak(false);

            if ($sSql) {
                $this->setActionLog('SQL', $sSql, __METHOD__);
            }

            if ($blReturn) {
                // moved to modprofile table
                $this->_dropTable('d3ordermanager');
                $this->fixUnRegisterMultiLangTables('d3ordermanager');
            }
        }

        return $blReturn;
    }

    /**
     * @return array
     */
    protected function _getConvertAssignments()
    {
        return array(
            'oxid'   =>  array(
                'from'      => 'oxid',
                'to'        => 'oxid',
                'multilang' => 0),
            'oxshopid'   =>  array(
                'from'      => 'oxshopid',
                'to'        => 'oxshopid',
                'multilang' => 0),
            4   => array(
                'from'      =>  'oxactive',
                'to'        =>  'oxactive',
                'multilang' => 1,
                'from_content'    => 1,
                'from_use_quote'  => 0),
            5   => array(
                'from'      =>  'oxactivefrom',
                'to'        =>  'oxactivefrom',
                'multilang' => 1,
                'from_content'    => '0000-00-00 00:00:00',
                'from_use_quote'  => 1),
            6   => array(
                'from'      =>  'oxactiveto',
                'to'        =>  'oxactiveto',
                'multilang' => 1,
                'from_content'    => '0000-00-00 00:00:00',
                'from_use_quote'  => 1),
            7   => array(
                'from_content' =>  'd3_ordermanager',
                'from_use_quote'    => true,
                'to'        =>  'oxmodid',
                'multilang' => 0),
            8   => array(
                'from'      =>  'oxtitle',
                'to'        =>  'oxtitle',
                'multilang' => 1),
            9   => array(
                'from'      =>  'oxcreate',
                'to'        =>  'oxcreate',
                'multilang' => 0,
                'from_content'    => 'NOW()',
                'from_use_quote'  => 0),
            10   => array(
                'from'      =>  'oxupdate',
                'to'        =>  'oxupdate',
                'multilang' => 1,
                'from_content'    => 'NOW()',
                'from_use_quote'  => 0),
            11   => array(
                'from'      =>  'oxmodversion',
                'to'        =>  'oxmodversion',
                'multilang' => 0,
                'from_content'    => $this->sModVersion,
                'from_use_quote'  => 1),
            12   => array(
                'from'      =>  'oxlog',
                'to'        =>  'oxlog',
                'multilang' => 1,
                'from_content'    => 15,
                'from_use_quote'  => 0),
            13   => array(
                'from'      =>  'oxvalue',
                'to'        =>  'oxvalue',
                'multilang' => 1),
            14   => array(
                'from'      =>  'oxfolder',
                'to'        =>  'oxfolder',
                'multilang' => 0),
            15   => array(
                'from'      =>  'oxsort',
                'to'        =>  'oxsort',
                'multilang' => 0),
            16   => array(
                'from'      =>  'oxwriteprotection',
                'to'        =>  'oxwriteprotection',
                'multilang' => 0,
                'from_content'    => '0',
                'from_use_quote'  => 0),
            17   => array(
                'from'      =>  'oxexecmanually',
                'to'        =>  'd3_om_execmanually',
                'multilang' => 0,
                'from_content'    => '0',
                'from_use_quote'  => 0),
            18   => array(
                'from'      =>  'oxmarkorder',
                'to'        =>  'd3_om_markorder',
                'multilang' => 0,
                'from_content'    => '1',
                'from_use_quote'  => 0),
        );
    }

    /**
     * @param $sOldKey
     * @param $sNewKey
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    protected function _changeItemContent($sOldKey, $sNewKey)
    {
        $iMaxLanguages = $this->getMaxLanguages();
        /** @var d3database $db */
        $db = d3GetModCfgDIC()->get('d3.ordermanager.database');

        for ($i = 0; $i < $iMaxLanguages; $i++) {
            $sFieldName = $this->_addMultiLangAddOn('oxvalue', $i);
            if ($db->checkTableExist('d3ordermanager') && $db->checkFieldExist('d3ordermanager', $sFieldName)) {
                $qb = $db->getQueryBuilder();
                $qb->select(['oxid', $sFieldName.' AS value'])
                    ->from('d3ordermanager')
                    ->where('1');

                $aRecords = $qb->execute()->fetchAll(FetchMode::ASSOCIATIVE);
                if ($aRecords && is_array($aRecords) && count($aRecords)) {
                    foreach ($aRecords as $aRecord) {
                        $aRecord = array_change_key_case($aRecord, CASE_UPPER);
                        if (strlen($aRecord['VALUE'])) {
                            $aValues = unserialize(rawurldecode(base64_decode($aRecord['VALUE'])));
                            $aNewValues = new stdClass;

                            foreach ($aValues as $sKey => $mValue) {
                                $sNew = str_replace($sOldKey, $sNewKey, $sKey);
                                $aNewValues->{$sNew} = $mValue;
                            }

                            $aSaveValues = base64_encode(rawurlencode(serialize($aNewValues)));

                            $qb1 = $db->getQueryBuilder();
                            $qb1->update('d3ordermanager')
                                ->set($sFieldName, $qb->expr()->literal($aSaveValues))
                                ->where(
                                    $qb->expr()->eq('oxid', $aRecord['OXID'])
                                );

                            if ($this->hasExecute()) {
                                try {
                                    $qb1->execute();
                                } catch  (PDOException $exception) {
                                    if ($exception->errorInfo[1]) {
                                        $this->setErrorMessage($exception->errorInfo[2]);
                                    }
                                }
                            }

                            $this->setUpdateBreak(false);

                            $this->setActionLog('SQL', $db->getPreparedStatementQuery($qb1->getSQL(), $qb1->getParameters()), __METHOD__);
                        }
                    }
                }
            }
        }
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function doesOrder2OrderManagerTableNotExist()
    {
        return $this->_checkTableNotExist('d3order2ordermanager');
    }

    /**
     * @return bool
     * @throws ConnectionException
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function addOrder2OrderManagerTable()
    {
        $blRet = false;
        if ($this->doesOrder2OrderManagerTableNotExist()) {
            $this->setInitialExecMethod(__METHOD__);
            $blRet  = $this->_addTable2(
                'd3order2ordermanager',
                $this->aFields,
                $this->aIndizes,
                'order to ordermanageritem assignment',
                'MyISAM'
            );
        }

        return $blRet;
    }

    /**
     * @return d3installdbrecord
     * @throws Exception
     */
    public function d3GetInstallDbRecord()
    {
        d3GetModCfgDIC()->set(
            d3installdbrecord::class.'.arg_updatebase',
            $this
        );

        /** @var d3installdbrecord $dbRecord */
        $dbRecord = d3GetModCfgDIC()->get(d3installdbrecord::class);
        return $dbRecord;
    }

    /**
     * required for unitTests
     * @return Config
     * @throws Exception
     */
    public function d3GetConfig()
    {
        /** @var Config $config */
        $config = d3GetModCfgDIC()->get('d3ox.ordermanager.'.Config::class);
        return $config;
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws Exception
     */
    public function doesModCfgItemNotExist()
    {
        $blRet = false;
        foreach ($this->d3GetConfig()->getShopIds() as $sShopId) {
            $aWhere = array(
                'oxmodid'       => $this->sModKey,
                'oxnewrevision' => $this->sModRevision,
                'oxshopid'      => $sShopId,
            );

            $blRet = $this->d3GetInstallDbRecord()->checkTableRecordNotExist('d3_cfg_mod', $aWhere);

            if ($blRet == true) {
                return $blRet;
            }
        }

        return $blRet;
    }

    /**
     * @return bool
     * @throws ConnectionException
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function addModCfgItem()
    {
        $blRet = false;

        if ($this->doesModCfgItemNotExist()) {
            foreach ($this->d3GetConfig()->getShopIds() as $sShopId) {
                $aWhere = array(
                    'oxmodid'       => $this->sModKey,
                    'oxshopid'      => $sShopId,
                    'oxnewrevision' => $this->sModRevision,
                );

                if ($this->d3GetInstallDbRecord()->checkTableRecordNotExist('d3_cfg_mod', $aWhere)) {
                    // update don't use this property
                    unset($aWhere['oxnewrevision']);

                    $aInsertFields = array(
                        array (
                            'fieldname'     => 'OXID',
                            'content'       => "md5('" . $this->sModKey . " " . $sShopId . " de')",
                            'force_update'  => true,
                            'use_quote'     => false,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXSHOPID',
                            'content'       => $sShopId,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXMODID',
                            'content'       => $this->sModKey,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXNAME',
                            'content'       => $this->sModName,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXACTIVE',
                            'content'       => "0",
                            'force_update'  => false,
                            'use_quote'     => false,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXBASECONFIG',
                            'content'       => $this->sBaseConf,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXSERIAL',
                            'content'       => "",
                            'force_update'  => false,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXINSTALLDATE',
                            'content'       => "NOW()",
                            'force_update'  => true,
                            'use_quote'     => false,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXVERSION',
                            'content'       => $this->sModVersion,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXSHOPVERSION',
                            'content'       => d3GetModCfgDIC()->get('d3ox.ordermanager.'.Facts::class)->getEdition(),
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array (
                            'fieldname'     => 'OXREQUIREMENTS',
                            'content'       => $this->sRequirements,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array(
                            'fieldname'     => 'OXVALUE',
                            'content'       => $this->sBaseValue,
                            'force_update'  => false,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ),
                        array(
                            'fieldname'     => 'OXNEWREVISION',
                            'content'       => $this->sModRevision,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        )
                    );

                    $this->setInitialExecMethod(__METHOD__);
                    $blRet  = $this->_updateTableItem2('d3_cfg_mod', $aInsertFields, $aWhere);

                    if ($this->getStepByStepMode()) {
                        break;
                    }
                }
            }
        }
        return $blRet;
    }

    /**
     * @return bool true, if new password must set
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function checkCronPasswordSet()
    {
        /** @var d3_cfg_mod $set */
        $set = d3GetModCfgDIC()->get('d3.ordermanager.modcfg');
        $password = $set->getValue('sCronPassword');
        return false === $password || is_null($password) || (is_string($password) && strlen($password) <= 0);
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws StandardException
     * @throws d3ShopCompatibilityAdapterException
     * @throws d3_cfg_mod_exception
     */
    public function createCronPassword()
    {
        $message = Registry::getLang()->translateString('D3_ORDERMANAGER_SETUP_CRONPASSWORD') . PHP_EOL.PHP_EOL;
        $this->setActionLog('msg', $message, __METHOD__);

        if ($this->hasExecute()) {
            /** @var d3str $oD3str */
            $oD3str = d3GetModCfgDIC()->get(d3str::class);
            $password = $oD3str->random_str(12);

            /** @var d3_cfg_mod $set */
            $set = d3GetModCfgDIC()->get('d3.ordermanager.modcfg');
            $set->setValue('sCronPassword', $password);
            $set->saveNoLicenseRefresh();
        }

        return true;
    }

    /**
     * @return bool true, if update is required
     * @throws DBALException
     * @throws Exception
     */
    public function needExampleJobList()
    {
        $blRet = false;

        /** @var d3database $db */
        $db = d3GetModCfgDIC()->get('d3.ordermanager.database');
        $qb = $db->getQueryBuilder();
        // change this to your inividual check criterias
        $qb->select('count(oxid) ')->from('d3modprofile')
           ->where('oxmodid = '.$qb->createNamedParameter('d3_ordermanager'))
           ->setMaxResults(1);

        if ($qb->execute()->fetchColumn() == 0) {
            $blRet = true;
        }

        return $blRet;
    }

    /**
     * @return bool
     * @throws ConnectionException
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function addExampleJobList()
    {
        $blRet = true;

        foreach ($this->getExampleJobInsertList() as $aJobContentInfos) {
            $blRet = $this->_addExampleJobItem($aJobContentInfos['table'], $aJobContentInfos['content']);

            if (false == $blRet) {
                break;
            }
        }

        $this->setUpdateBreak(true);

        return $blRet;
    }

    /**
     * @return bool true, if update is required
     * @throws Exception
     */
    public function isExampleContentMissingInDatabase()
    {
        $blRet = false;

        $aIdentList = array();
        foreach ($this->getExampleContentInsertList() as $aJobContentInfos) {
            $aInsertFields = $this->{$aJobContentInfos['content']}($this->d3GetConfig()->getActiveShop());
            foreach ($aInsertFields as $aInsertField) {
                if (strtoupper($aInsertField['fieldname']) == 'OXLOADID') {
                    $aIdentList[] = $aInsertField['content'];
                }
            }
        }

        if (count($aIdentList)) {
            // change this to your inividual check criterias
            /** @var d3database $db */
            $db = d3GetModCfgDIC()->get('d3.ordermanager.database');
            $qb = $db->getQueryBuilder();
            $qb->select('count(oxid) < '.count($aIdentList))
                ->from('oxcontents')
                ->where(
                        $qb->expr()->in('oxloadid', implode(', ', array_map(
                            function($value) use ($qb) {
                                return $qb->createNamedParameter($value);
                            },
                            $aIdentList
                        )))
                    )
                ->setMaxResults(1);

            return (bool) $qb->execute()->fetchColumn();
        }

        return $blRet;
    }

    /**
     * @return bool
     * @throws ConnectionException
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function addExampleContentList()
    {
        $blRet = true;

        foreach ($this->getExampleContentInsertList() as $aJobContentInfos) {
            $blRet = $this->_addExampleJobItem($aJobContentInfos['table'], $aJobContentInfos['content']);

            if (!$blRet) {
                break;
            }
        }

        $this->setUpdateBreak(true);

        return $blRet;
    }

    /**
     * @return bool true, if update is required
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws d3ParameterNotFoundException
     * @throws ConnectionException
     */
    public function requireExample2ShopRelation()
    {
        startProfile(__METHOD__);

        $this->setInitialExecMethod(__METHOD__);

        foreach ($this->getExampleJobInsertList() as $aJobContentInfos) {
            $sGetFieldContentMethodName = $aJobContentInfos['content'];
            /** @var $oShop Shop */
            foreach ($this->getShopListByActiveModule('d3ordermanager') as $oShop) {
                $aCheckFields = $this->{$sGetFieldContentMethodName}($oShop);

                if ($this->_require2ShopRelation($aJobContentInfos['table'], $aCheckFields)) {
                    stopProfile(__METHOD__);
                    return true;
                }
            }
        }

        stopProfile(__METHOD__);
        return false;
    }

    /**
     * @return bool
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws d3ParameterNotFoundException
     * @throws ConnectionException
     */
    public function addExample2ShopRelation()
    {
        $blRet = true;

        foreach ($this->getExampleJobInsertList() as $aJobContentInfos) {
            $sGetFieldContentMethodName = $aJobContentInfos['content'];
            /** @var $oShop Shop */
            foreach ($this->getShopListByActiveModule('d3ordermanager') as $oShop) {
                $aInsertFields = $this->{$sGetFieldContentMethodName}($oShop);
                $blRet = $this->_add2ShopRelation($aJobContentInfos['table'], $aInsertFields);
            }

            if (!$blRet) {
                break;
            }
        }

        $this->setUpdateBreak(true);

        return $blRet;
    }

    /**
     * @return array
     */
    public function getExampleJobInsertList()
    {
        return array(
            array(
                'content'   => 'getExampleJobItem1InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem2InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem3InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem4InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem5InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem6InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem7InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem8InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem9InsertFields',
                'table'     => 'd3modprofile'
            ),
            array(
                'content'   => 'getExampleJobItem10InsertFields',
                'table'     => 'd3modprofile'
            ),
        );
    }

    /**
     * @return array
     */
    public function getExampleContentInsertList()
    {
        return array(
            array(
                'content'   => 'getExampleContent1InsertFields',
                'table'     => 'oxcontents'
            ),
            array(
                'content'   => 'getExampleContent2InsertFields',
                'table'     => 'oxcontents'
            ),
        );
    }

    /**
     * @return d3bitmask
     * @throws Exception
     */
    public function getD3BitMask()
    {
        /** @var d3bitmask $bitMask */
        $bitMask = d3GetModCfgDIC()->get(d3bitmask::class);
        return $bitMask;
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem1InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job01 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Vorkasseinfo an Kunden senden',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Vorkasseinfo an Kunden senden',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'send payadvance information',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Kunden, die per Vorkasse bezahlen möchten, werden kurz nach ihrem Kauf '.
                    'automatisch über den Ablauf der Vorkassezahlung und die Bankverbindung informiert.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Kunden, die per Vorkasse bezahlen möchten, werden kurz nach ihrem Kauf '.
                    'automatisch über den Ablauf der Vorkassezahlung und die Bankverbindung informiert.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 7232 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYADVANCE',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '1000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem2InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job02 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Rechnungs-PDF erstellen',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Rechnungs-PDF erstellen',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'create invoice pdf',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Versenden Sie die PDF-Rechnung automatisch an Ihre Kunden. Sie sparen sich damit viel Arbeit in der Nachbehandlung der Bestellungen.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Versenden Sie die PDF-Rechnung automatisch an Ihre Kunden. Sie sparen sich damit viel Arbeit in der Nachbehandlung der Bestellungen.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 6872 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '1100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem3InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job03 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'mit Trackingcode als "versendet" markieren',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'mit Trackingcode als "versendet" markieren',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'trackcode orders mark as "sended"',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Alle Bestellungen, die einen Trackingcode erhalten, werden als "versendet" markiert. Der Kunde kann diesen Status abfragen oder wird per Mail informiert. Auf dem "versendet"-Status können andere Aufgaben aufbauen und weitere Aktionen auslösen.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Alle Bestellungen, die einen Trackingcode erhalten, werden als "versendet" markiert. Der Kunde kann diesen Status abfragen oder wird per Mail informiert. Auf dem "versendet"-Status können andere Aufgaben aufbauen und weitere Aktionen auslösen.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 6060 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '2000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '1',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem4InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job04 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Lieferschwierigkeiten (Deutschland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Lieferschwierigkeiten (Deutschland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'delivery delay (Germany)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Ist z.B. ein bestimmter Artikel nicht lieferbar, informieren Sie alle Käufer dieses Artikels mit einer individuellen Mail. Für ausländische Kunden versendet die Aufgabe "Lieferschwierigkeiten (Ausland)" eine alternative Mail.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Ist z.B. ein bestimmter Artikel nicht lieferbar, informieren Sie alle Käufer dieses Artikels mit einer individuellen Mail. Für ausländische Kunden versendet die Aufgabe "Lieferschwierigkeiten (Ausland)" eine alternative Mail.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 7856 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_DELIVERYSTATUS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '2100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem5InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job05 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Lieferschwierigkeiten (Ausland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Lieferschwierigkeiten (Ausland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'delivery delay (foreign countries)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Ist der Versand eines Artikels außerhalb Deutschland unvorhergesehen nicht möglich, geben Sie Ihren Kunden Bescheid. Diese Aufgabe versendet personalisierte Mails an alle betroffenen Käufer.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Ist der Versand eines Artikels außerhalb Deutschland unvorhergesehen nicht möglich, geben Sie Ihren Kunden Bescheid. Diese Aufgabe versendet personalisierte Mails an alle betroffenen Käufer.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 25488 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_DELIVERYSTATUS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '2200',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem6InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job06 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Zahlungserinnerung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Zahlungserinnerung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'pay reminder',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Automatisieren Sie Ihren Mahnlauf, indem säumige Zahler in verschiedenen Stufen an die Zahlung erinnert werden. Dies ist die Beispielaufgabe zur 1. Stufe "Zahlungserinnerung".',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Automatisieren Sie Ihren Mahnlauf, indem säumige Zahler in verschiedenen Stufen an die Zahlung erinnert werden. Dies ist die Beispielaufgabe zur 1. Stufe "Zahlungserinnerung".',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 6792 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYSTATUSCHECK',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '3000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem7InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job07 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => '1. Mahnung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => '1. Mahnung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => '1st monition',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Automatisieren Sie Ihren Mahnlauf, indem säumige Zahler in verschiedenen Stufen an die Zahlung erinnert werden. Dies ist die Beispielaufgabe zur 2. Stufe "Mahnung". Legen Sie weitere Aufgaben an, um weiterhin säumige Kunden z.B. zu blockieren.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Automatisieren Sie Ihren Mahnlauf, indem säumige Zahler in verschiedenen Stufen an die Zahlung erinnert werden. Dies ist die Beispielaufgabe zur 2. Stufe "Mahnung". Legen Sie weitere Aufgaben an, um weiterhin säumige Kunden z.B. zu blockieren.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 7128 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYSTATUSCHECK',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '3100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem8InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job08 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'bezahlte Rechnungen nach "erledigt" verschieben',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'bezahlte Rechnungen nach "erledigt" verschieben',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'move paid invoices to "finished"',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Mit dieser Aufgabe halten Sie die Bestellliste übersichtlich. Alle als "bezahlt" markierten Bestellungen werden in den Ordner "erledigt" einsortiert. Erweitern Sie die Aufgabe, um z.B. den Versand zu informieren.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Mit dieser Aufgabe halten Sie die Bestellliste übersichtlich. Alle als "bezahlt" markierten Bestellungen werden in den Ordner "erledigt" einsortiert. Erweitern Sie die Aufgabe, um z.B. den Versand zu informieren.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 5788 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '4000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem9InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job09 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Vorkasse-Kontroll-Export',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Vorkasse-Kontroll-Export',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'export unpaid prepayment orders',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Unbezahlte Vorkassebestellungen werden in einer Exportliste für die Kontrolle durch die Buchhaltung zusammengefasst.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Unbezahlte Vorkassebestellungen werden in einer Exportliste für die Kontrolle durch die Buchhaltung zusammengefasst.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 9908 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYADVANCE',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '4100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '1',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function getExampleJobItem10InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();
        $iShopBit = strlen($sShopId) == 1 ? $this->getD3BitMask()->getIntByBitPosition((int) $sShopId) : '1';

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job10 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => 'Push-Benachrichtigung bei großen Bestellungen erhalten',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Push-Benachrichtigung bei großen Bestellungen erhalten',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'Receive push notification for large orders',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHORTDESC',
                'content'       => 'Diese Aufgabe kann eine Push-Benachrichtigung an einen Dienst (z.B. IFTTT) senden, der daraufhin weitere Aktionen durchführt. Die weiteren Bearbeitungsmöglichkeiten sind dienstabhängig. Weitere Infos zu dieser Funktion finden Sie im Handbuch des Moduls.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'de'),
                'content'       => 'Diese Aufgabe kann eine Push-Benachrichtigung an einen Dienst (z.B. IFTTT) senden, der daraufhin weitere Aktionen durchführt. Die weiteren Bearbeitungsmöglichkeiten sind dienstabhängig. Weitere Infos zu dieser Funktion finden Sie im Handbuch des Moduls.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXSHORTDESC', 'en'),
                'content'       => 'This task can send a push notification to a service (e.g. IFTTT), which then performs further actions. The other processing options are service-dependent. For more information on this function, refer to the modules manual.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ),
            array(
                'fieldname'     => 'OXVALUE',
                'content'       => '[encoded data, 10172 characters]',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array(
                'fieldname'     => 'OXSORT',
                'content'       => '5000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '1',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function getExampleContent1InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " content01 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXLOADID',
                'content'       => "d3payreminder",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSNIPPET',
                'content'       => "1",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTYPE',
                'content'       => "0",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXPOSITION',
                'content'       => "",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => "Zahlungserinnerung",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontent', 'OXTITLE', 'de'),
                'content'       => "Zahlungserinnerung",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontent', 'OXTITLE', 'en'),
                'content'       => "1. Reminder",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXCONTENT',
                'content'       => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html lang="de"><head><title>[{$oShop->oxshops__oxordersubject->value}]</title><meta http-equiv="Content-Type" content="text/html; charset=[{$charset}]"></head><body style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 10px;" alink="#355222" vlink="#355222" link="#355222" bgcolor="#FFFFFF"><img src="[{$oViewConf->getNoSslImageDir()}]/logo_white.gif" alt="[{$oShop->oxshops__oxname->value}]" border="0" hspace="0" vspace="0" align="texttop"><br><br>Hallo [{$oOrder->oxorder__oxbillsal->value|oxmultilangsal}][{$oOrder->oxorder__oxbilllname->getRawValue()}],<br>'.PHP_EOL.'<br>'.PHP_EOL.'zur Bestellung[{$oOrder->oxorder__oxordernr->getRawValue()}] liegt uns noch keine Bezahlung vor.<br>'.PHP_EOL.'<br>'.PHP_EOL.'Ihr [{$oShop->oxshops__oxname->getRawValue()}]-Team.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXCATID',
                'content'       => '30e44ab83fdee7564.23264141',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'CMSFOLDER_EMAILS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param Shop $oShop
     *
     * @return array
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function getExampleContent2InsertFields(Shop $oShop)
    {
        $sShopId = $oShop->getId();

        return array(
            array (
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " content02 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXLOADID',
                'content'       => "d3payreminder_plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXSNIPPET',
                'content'       => "1",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTYPE',
                'content'       => "0",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXPOSITION',
                'content'       => "",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXTITLE',
                'content'       => "Zahlungserinnerung Plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontents', 'OXTITLE', 'de'),
                'content'       => "Zahlungserinnerung Plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontents', 'OXTITLE', 'en'),
                'content'       => "1. Reminder plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXCONTENT',
                'content'       => 'Hallo [{$oOrder->oxorder__oxbillsal->value|oxmultilangsal}] [{$oOrder->oxorder__oxbilllname->getRawValue()}],'.PHP_EOL.PHP_EOL.'zur Bestellung [{$oOrder->oxorder__oxordernr->getRawValue()}] liegt uns noch keine Bezahlung vor.'.PHP_EOL.PHP_EOL.'Ihr [{$oShop->oxshops__oxname->getRawValue()}]-Team.',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ),
            array (
                'fieldname'     => 'OXCATID',
                'content'       => '30e44ab83fdee7564.23264141',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
            array (
                'fieldname'     => 'OXFOLDER',
                'content'       => 'CMSFOLDER_EMAILS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ),
        );
    }

    /**
     * @param $sTableName
     *
     * @param $sGetFieldContentMethodName
     * @return bool
     * @throws ConnectionException
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    protected function _addExampleJobItem($sTableName, $sGetFieldContentMethodName)
    {
        $blRet = false;

        /** @var $oShop Shop */
        foreach ($this->getShopListByActiveModule('d3ordermanager') as $oShop) {
            $aWhere = array();
            $aInsertFields = $this->{$sGetFieldContentMethodName}($oShop);

            $this->setInitialExecMethod(__METHOD__);
            $blRet  = $this->_updateTableItem2($sTableName, $aInsertFields, $aWhere);

            if ($this->getStepByStepMode()) {
                break;
            }
        }

        return $blRet;
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws Exception
     */
    public function hasNotOrderArticlesParentId()
    {
        if (false == $this->mustCheckOrderArticlesParentId()) {
            return false;
        }

        /** @var d3database $db */
        $db = d3GetModCfgDIC()->get('d3.ordermanager.database');
        $qb = $db->getQueryBuilder();

        $qb->select('ooa.oxparentid != oa.oxparentid')
            ->from('oxorderarticles', 'ooa')
            ->leftJoin('ooa', 'oxarticles', 'oa', 'ooa.oxartid = oa.oxid')
            ->where(
                $qb->expr()->isNotNull('oa.oxparentid')
            )
            ->setMaxResults(1);

        $ret = (bool) $qb->execute()->fetchColumn();

        if ($ret === false) {
            $this->setDontCheckOrderArticlesParentId();
        }

        return $ret;
    }

    /**
     * @return bool
     */
    public function mustCheckOrderArticlesParentId()
    {
        return false === $this->d3GetConfig()->getShopConfVar('setupCheckOrderArticleParentId', null, 'd3ordermanager');
    }

    public function setDontCheckOrderArticlesParentId()
    {
        $this->d3GetConfig()->saveShopConfVar('bool', 'setupCheckOrderArticleParentId', true, null, 'd3ordermanager');
    }

    /**
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws Exception
     */
    public function addOrderArticlesParentId()
    {
        /** @var d3database $db */
        $db = d3GetModCfgDIC()->get('d3.ordermanager.database');
        $qbsub = $db->getQueryBuilder();

        $qbsub->select('oxarticles.oxparentid')
            ->from('oxarticles')
            ->where(
                $qbsub->expr()->eq(
                    'oxarticles.oxid',
                    'oxorderarticles.oxartid'
                )
            );

        $qb = $db->getQueryBuilder();
        $qb->update('oxorderarticles')
            ->set(
                'oxparentid',
                $qbsub->getSQL()
            )
            ->where(
                $qb->expr()->eq(
                    'oxorderarticles.oxparentid',
                    ""
                )
            );

        $ret = $this->_tableSqlExecute($qb->getSQL(), 'oxorderarticles', true);

        $this->setDontCheckOrderArticlesParentId();

        return $ret;
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws StandardException
     * @throws ReflectionException
     * @throws d3ParameterNotFoundException
     * @throws d3ShopCompatibilityAdapterException
     * @throws d3_cfg_mod_exception
     */
    public function hasUnregisteredFiles()
    {
        return $this->_hasUnregisteredFiles('d3ordermanager', array('d3FileRegister'));
    }

    /**
     * @return bool
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws StandardException
     * @throws ReflectionException
     * @throws d3ShopCompatibilityAdapterException
     * @throws d3_cfg_mod_exception
     */
    public function showUnregisteredFiles()
    {
        return $this->_showUnregisteredFiles('d3ordermanager', array('d3FileRegister'));
    }
}
