<?php

/**
 * Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 *
 * https://www.d3data.de
 *
 * @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
 * @author    D3 Data Development - Daniel Seifert <info@shopmodule.com>
 * @link      https://www.oxidmodule.com
 */

declare(strict_types=1);

namespace D3\Ordermanager\Setup;

use D3\DIContainerHandler\d3DicException;
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\Exception as DBALException;
use Doctrine\DBAL\Driver\Exception as DBALDriverException;
use Doctrine\DBAL\Query\QueryBuilder;
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 Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use stdClass;

class d3ordermanager_update extends d3install_updatebase
{
    public $sModKey = 'd3_ordermanager';

    public $sModName = 'Auftragsmanager';

    public $sModVersion = '6.1.0.0';

    public $sModRevision = '6100';

    public $sBaseConf =
    '9p4v2==RmE5QVhVeWIxSVViVlpNZTIxeUFpa25LVWZZaTVUVXQ5L2dIWG1lY3M0Uk5VRFZVR1hzQzFIL
2VjcWpYNksrSUxIczFhUDZiOG83akhLazdBM3R3bXJ6OUplT21lSGR2OHJ4cXBaTFlOK2xWV2tJZVlNe
WlBaitkWVpOZGxDTXpsblZjMVVPSVV2eVZOOFBTY1J2NDkrWG9KbTR0c2NQK3FMaGdBRWliTmNlaDBIV
1UvczRUdlM0MGZZVkRCeHRrdytEalZWQk9jY3U5VEk1T3QyenJHbFpZMVRmVnVtVG5KUnEyRGQvUUM5K
zdPT2U5eEhTcVVuL2lrRHBNRjV3ajNDQ3p1a3lwS0FxZjF3bVloS0VHRXdGYnZNSkVuSkV2eDJrWFlKL
0RyMG5TYUJuaHhMMFIrVExPNVQzV2VCbXk5K053L1FFbUlBeUhUTFA4V2IxVWRBPT0=';

    public $sRequirements = '';

    public $sBaseValue = 'TyUzQTglM0ElMjJzdGRDbGFzcyUyMiUzQTUlM0ElN0JzJTNBMjMlM0ElMjJkM19jZmdfbW9kX19hRm9sZGVyTGlzdCUyMiUzQmElM0E1JTNBJTdCaSUzQTAlM0JzJTNBMjUlM0ElMjJEM19PUkRFUk1BTkFHRVJfT1JERVJfTkVXJTIyJTNCaSUzQTElM0JzJTNBMzIlM0ElMjJEM19PUkRFUk1BTkFHRVJfT1JERVJfUEFZQURWQU5DRSUyMiUzQmklM0EyJTNCcyUzQTM2JTNBJTIyRDNfT1JERVJNQU5BR0VSX09SREVSX1BBWVNUQVRVU0NIRUNLJTIyJTNCaSUzQTMlM0JzJTNBMzYlM0ElMjJEM19PUkRFUk1BTkFHRVJfT1JERVJfREVMSVZFUllTVEFUVVMlMjIlM0JpJTNBNCUzQnMlM0EzNyUzQSUyMkQzX09SREVSTUFOQUdFUl9PUkRFUl9PUkRFUlBST0NFU1NJTkclMjIlM0IlN0RzJTNBMjQlM0ElMjJkM19jZmdfbW9kX19ibENyb25BY3RpdmUlMjIlM0JzJTNBMSUzQSUyMjAlMjIlM0JzJTNBMjQlM0ElMjJkM19jZmdfbW9kX19pTWF4T3JkZXJDbnQlMjIlM0JzJTNBMiUzQSUyMjUwJTIyJTNCcyUzQTI1JTNBJTIyZDNfY2ZnX21vZF9fc0Nyb25QYXNzd29yZCUyMiUzQnMlM0EwJTNBJTIyJTIyJTNCcyUzQTMwJTNBJTIyZDNfY2ZnX21vZF9fYmxDYWxjU3RhdE9uRGVtYW5kJTIyJTNCcyUzQTElM0ElMjIwJTIyJTNCJTdE';

    public $sMinModCfgVersion = '7.0.0.0';

    protected $_aUpdateMethods = [
        [
            'check' => 'doesOrder2OrderManagerTableNotExist',
            'do'    => 'addOrder2OrderManagerTable',
        ],
        [
            'check' => 'doesModCfgItemNotExist',
            'do'    => 'addModCfgItem',
        ],
        [
            'check' => 'checkFields',
            'do'    => 'fixFields',
        ],
        [
            'check' => 'checkIndizes',
            'do'    => 'fixIndizes',
        ],
        [
            'check' => 'checkCronPasswordSet',
            'do'    => 'createCronPassword',
        ],
        [
            'check' => 'needExampleJobList',
            'do'    => 'addExampleJobList',
        ],
        [
            'check' => 'isExampleContentMissingInDatabase',
            'do'    => 'addExampleContentList',
        ],
        [
            'check' => 'requireExample2ShopRelation',
            'do'    => 'addExample2ShopRelation',
        ],
        [
            'check' => 'hasNotOrderArticlesParentId',
            'do'    => 'addOrderArticlesParentId',
        ],
        [
            'check' => 'hasModcfgMultilangSetting',
            'do'    => 'addModcfgMultilangSetting',
        ],
        [
            'check' => 'hasModProfileMultilangSetting',
            'do'    => 'addModProfileMultilangSetting',
        ],
        [
            'check' => 'checkModCfgSameRevision',
            'do'    => 'updateModCfgSameRevision',
        ],
    ];

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

    public $aFields = [
        'PROF_EXECMANUALLY'        => [
            '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'        => [
            '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'        => [
            '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'        => [
            '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'        => [
            'sTableName'  => 'd3modprofile',
            'sFieldName'  => 'D3_CRONJOBID',
            'sType'       => 'VARCHAR(8)',
            'blNull'      => false,
            'sDefault'    => 0,
            'sComment'    => 'ID for identifying via cronjob',
            'sExtra'      => '',
            'blMultilang' => false,
        ],

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

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

    protected $_aRefreshMetaModuleIds = [ 'd3ordermanager' ];

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

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

        return $blRet;
    }

    public function d3GetInstallDbRecord(): d3installdbrecord
    {
        d3GetOxidDIC()->set(
            d3installdbrecord::class.'.arg_updatebase',
            $this
        );

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

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

    /**
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function doesModCfgItemNotExist(): bool
    {
        $blRet = false;
        foreach ($this->d3GetConfig()->getShopIds() as $sShopId) {
            $aWhere = [
                'oxmodid'       => $this->sModKey,
                'oxnewrevision' => $this->sModRevision,
                'oxshopid'      => $sShopId,
            ];

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

            if ($blRet) {
                return true;
            }
        }

        return $blRet;
    }

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

        if ($this->doesModCfgItemNotExist()) {
            foreach ($this->d3GetConfig()->getShopIds() as $sShopId) {
                $aWhere = [
                    '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 = [
                        [
                            'fieldname'     => 'OXID',
                            'content'       => "md5('" . $this->sModKey . " " . $sShopId . " de')",
                            'force_update'  => true,
                            'use_quote'     => false,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXSHOPID',
                            'content'       => $sShopId,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXMODID',
                            'content'       => $this->sModKey,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXNAME',
                            'content'       => $this->sModName,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXACTIVE',
                            'content'       => "0",
                            'force_update'  => false,
                            'use_quote'     => false,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXBASECONFIG',
                            'content'       => $this->sBaseConf,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXSERIAL',
                            'content'       => "",
                            'force_update'  => false,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXINSTALLDATE',
                            'content'       => "NOW()",
                            'force_update'  => true,
                            'use_quote'     => false,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXVERSION',
                            'content'       => $this->sModVersion,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXSHOPVERSION',
                            'content'       => (oxNew(Facts::class))->getEdition(),
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXREQUIREMENTS',
                            'content'       => $this->sRequirements,
                            'force_update'  => true,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            'fieldname'     => 'OXVALUE',
                            'content'       => $this->sBaseValue,
                            'force_update'  => false,
                            'use_quote'     => true,
                            'use_multilang' => false,
                        ],
                        [
                            '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 Exception
     */
    public function checkCronPasswordSet(): bool
    {
        /** @var d3_cfg_mod $set */
        $set = d3GetOxidDIC()->get('d3.ordermanager.modcfg');
        $password = $set->getValue('sCronPassword');
        return false === $password || is_null($password) || (is_string($password) && strlen($password) <= 0);
    }

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

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

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

        return true;
    }

    /**
     * @return bool true, if update is required
     * @throws DBALDriverException
     * @throws DBALException
     * @throws d3DicException
     */
    public function needExampleJobList(): bool
    {
        /** @var QueryBuilder $qb */
        $qb = d3GetOxidDIC()->get('d3ox.modcfg.OxDbQueryBuilder');
        // change this to your inividual check criterias
        $qb->select('count(oxid) ')->from('d3modprofile')
           ->where('oxmodid = '.$qb->createNamedParameter('d3_ordermanager'))
           ->setMaxResults(1);
        return $qb->execute()->fetchOne() == 0;
    }

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

        foreach ($this->getExampleJobInsertList() 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 DBALDriverException
     * @throws DBALException
     * @throws d3DicException
     */
    public function isExampleContentMissingInDatabase(): bool
    {
        $blRet = false;

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

                if (strtoupper($aInsertField['fieldname']) != 'OXLOADID') {
                    continue;
                }

                $aIdentList[] = $aInsertField['content'];
            }
        }

        if ($aIdentList !== []) {
            // change this to your inividual check criterias
            /** @var QueryBuilder $qb */
            $qb = d3GetOxidDIC()->get('d3ox.modcfg.OxDbQueryBuilder');
            $qb->select('count(oxid) < '.count($aIdentList))
                ->from('oxcontents')
                ->where(
                    $qb->expr()->in('oxloadid', implode(', ', array_map(
                        static fn ($value) => $qb->createNamedParameter($value),
                        $aIdentList
                    )))
                )
                ->setMaxResults(1);

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

        return $blRet;
    }

    /**
     * @throws ConnectionException
     * @throws DBALException
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     */
    public function addExampleContentList(): bool
    {
        $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(): bool
    {
        startProfile(__METHOD__);

        $this->setInitialExecMethod(__METHOD__);

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

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

        stopProfile(__METHOD__);
        return false;
    }

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

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

            if (!$blRet) {
                break;
            }
        }

        $this->setUpdateBreak(true);

        return $blRet;
    }

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

    public function getExampleContentInsertList(): array
    {
        return [
            [
                'content'   => 'getExampleContent1InsertFields',
                'table'     => 'oxcontents',
            ],
            [
                'content'   => 'getExampleContent2InsertFields',
                'table'     => 'oxcontents',
            ],
        ];
    }

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

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job01 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Vorkasseinfo an Kunden senden',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Vorkasseinfo an Kunden senden',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'send payadvance information',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYADVANCE',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '1000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job02 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Rechnungs-PDF erstellen',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Rechnungs-PDF erstellen',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'create invoice pdf',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '1100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job03 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'mit Trackingcode als "versendet" markieren',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'mit Trackingcode als "versendet" markieren',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'trackcode orders mark as "sended"',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '2000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '1',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job04 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Lieferschwierigkeiten (Deutschland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Lieferschwierigkeiten (Deutschland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'delivery delay (Germany)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_DELIVERYSTATUS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '2100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job05 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Lieferschwierigkeiten (Ausland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Lieferschwierigkeiten (Ausland)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'delivery delay (foreign countries)',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_DELIVERYSTATUS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '2200',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job06 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Zahlungserinnerung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Zahlungserinnerung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'pay reminder',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYSTATUSCHECK',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '3000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job07 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => '1. Mahnung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => '1. Mahnung',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => '1st monition',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYSTATUSCHECK',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '3100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job08 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'bezahlte Rechnungen nach "erledigt" verschieben',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'bezahlte Rechnungen nach "erledigt" verschieben',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'move paid invoices to "finished"',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '4000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job09 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Vorkasse-Kontroll-Export',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Vorkasse-Kontroll-Export',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'export unpaid prepayment orders',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_PAYADVANCE',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '4100',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '1',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " job10 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPINCL',
                'content'       => $iShopBit,
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPEXCL',
                'content'       => '0',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVEFROM',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVETO',
                'content'       => '0000-00-00 00:00:00',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODID',
                'content'       => 'd3_ordermanager',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => 'Push-Benachrichtigung bei großen Bestellungen erhalten',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'de'),
                'content'       => 'Push-Benachrichtigung bei großen Bestellungen erhalten',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXTITLE', 'en'),
                'content'       => 'Receive push notification for large orders',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCREATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXUPDATE',
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('d3modprofile', 'OXUPDATE', 'de'),
                'content'       => 'NOW()',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXMODVERSION',
                'content'       => $this->sModVersion,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOG',
                'content'       => '15',
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXVALUE',
                'content'       => ' ',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'D3_ORDERMANAGER_ORDER_ORDERPROCESSING',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSORT',
                'content'       => '5000',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXWRITEPROTECTION',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_EXECMANUALLY',
                'content'       => "0",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'D3_OM_MARKORDER',
                'content'       => '1',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " content01 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOADID',
                'content'       => "d3payreminder",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSNIPPET',
                'content'       => "1",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTYPE',
                'content'       => "0",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXPOSITION',
                'content'       => "",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => "Zahlungserinnerung",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontent', 'OXTITLE', 'de'),
                'content'       => "Zahlungserinnerung",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontent', 'OXTITLE', 'en'),
                'content'       => "1. Reminder",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCATID',
                'content'       => '30e44ab83fdee7564.23264141',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'CMSFOLDER_EMAILS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

        return [
            [
                'fieldname'     => 'OXID',
                'content'       => "MD5('" . $this->sModKey . " content02 " . $sShopId . "')",
                'force_update'  => false,
                'use_quote'     => false,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXLOADID',
                'content'       => "d3payreminder_plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSHOPID',
                'content'       => $sShopId,
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXSNIPPET',
                'content'       => "1",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTYPE',
                'content'       => "0",
                'force_update'  => true,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXACTIVE',
                'content'       => "1",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => 'OXPOSITION',
                'content'       => "",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXTITLE',
                'content'       => "Zahlungserinnerung Plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontents', 'OXTITLE', 'de'),
                'content'       => "Zahlungserinnerung Plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                'fieldname'     => $this->_getLangAbbrFieldName('oxcontents', 'OXTITLE', 'en'),
                'content'       => "1. Reminder plain",
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => true,
            ],
            [
                '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,
            ],
            [
                'fieldname'     => 'OXCATID',
                'content'       => '30e44ab83fdee7564.23264141',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
            [
                'fieldname'     => 'OXFOLDER',
                'content'       => 'CMSFOLDER_EMAILS',
                'force_update'  => false,
                'use_quote'     => true,
                'use_multilang' => false,
            ],
        ];
    }

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

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

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

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

        return $blRet;
    }

    /**
     * @throws DBALDriverException
     * @throws DBALException
     * @throws d3DicException
     */
    public function hasNotOrderArticlesParentId(): bool
    {
        if (!$this->mustCheckOrderArticlesParentId()) {
            return false;
        }

        /** @var QueryBuilder $qb */
        $qb = d3GetOxidDIC()->get('d3ox.modcfg.OxDbQueryBuilder');

        $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()->fetchOne();

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

        return $ret;
    }

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

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

    /**
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws d3DicException
     */
    public function addOrderArticlesParentId(): bool
    {
        /** @var QueryBuilder $qbsub */
        $qbsub = d3GetOxidDIC()->get('d3ox.modcfg.OxDbQueryBuilder');
        $qbsub->select('oxarticles.oxparentid')
            ->from('oxarticles')
            ->where(
                $qbsub->expr()->eq(
                    'oxarticles.oxid',
                    'oxorderarticles.oxartid'
                )
            );

        /** @var QueryBuilder $qb */
        $qb = d3GetOxidDIC()->get('d3ox.modcfg.OxDbQueryBuilder');
        $qb->update('oxorderarticles')
            ->set(
                'oxparentid',
                $qbsub->getSQL()
            )
            ->where(
                $qb->expr()->eq(
                    'oxorderarticles.oxparentid',
                    ""
                )
            );

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

        $this->setDontCheckOrderArticlesParentId();

        return $ret;
    }

    /**
     * @param bool $useMultilang
     *
     * @return bool
     * @throws ContainerExceptionInterface
     * @throws DatabaseConnectionException
     * @throws DatabaseErrorException
     * @throws NotFoundExceptionInterface
     */
    public function addModProfileMultilangSetting(bool $useMultilang = false): bool
    {
        return parent::addModProfileMultilangSetting(true);
    }
}
