Пример #1
0
 /**
  * Load the deliveryArticle.
  *
  * @param \CommerceTeam\Commerce\Domain\Model\Article $article Article
  *
  * @return \CommerceTeam\Commerce\Domain\Model\Article $result
  */
 protected function getDeliveryArticle(\CommerceTeam\Commerce\Domain\Model\Article &$article)
 {
     $deliveryConf = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.DELIVERY.types');
     $classname = array_shift(array_keys($deliveryConf));
     /**
      * Article repository.
      *
      * @var ArticleRepository
      */
     $articleRepository = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Repository\\ArticleRepository');
     $row = $articleRepository->findByClassname($classname);
     $result = false;
     if (!empty($row)) {
         /**
          * Instantiate article class.
          *
          * @var \CommerceTeam\Commerce\Domain\Model\Article $deliveryArticle
          */
         $deliveryArticle = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Article', $row['uid'], $article->getLang());
         /*
          * Do not call loadData at this point, since loadData recalls this hook,
          * so we have a non ending recursion
          */
         if (is_object($deliveryArticle)) {
             $deliveryArticle->loadPrices();
         }
         $result = $deliveryArticle;
     }
     return $result;
 }
 /**
  * Administrative links for a table / record.
  *
  * @param string $table Table name
  * @param array  $row   Record for which administrative links are generated.
  *
  * @return string HTML link tags.
  */
 public function adminLinks($table, array $row)
 {
     if ($table !== 'tx_commerce_products') {
         return parent::adminLinks($table, $row);
     } else {
         $language = $this->getLanguageService();
         // Edit link:
         $adminLink = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->getBackPath())) . '">' . IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', true))) . '</a>';
         // Delete link:
         $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', true))) . '</a>';
         if ($row['pid'] == -1) {
             // get page TSconfig
             $pagesTyposcriptConfig = BackendUtility::getPagesTSconfig(GeneralUtility::_POST('popViewId'));
             if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) {
                 $previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid'];
             } else {
                 $previewPageId = SettingsFactory::getInstance()->getExtConf('previewPageID');
             }
             $sysLanguageUid = (int) $row['sys_language_uid'];
             /**
              * Product.
              *
              * @var \CommerceTeam\Commerce\Domain\Model\Product $product
              */
             $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Product', $row['t3ver_oid'], $sysLanguageUid);
             $product->loadData();
             $getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory());
             $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($previewPageId, $this->getBackPath(), BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
         }
         return $adminLink;
     }
 }
Пример #3
0
 /**
  * Main function.
  *
  * @param string $linktxt Link text
  * @param array $conf Configuration
  * @param string $linkHandlerKeyword Keyword
  * @param string $linkHandlerValue Value
  * @param string $linkParameter Link parameter
  * @param ContentObjectRenderer $pObj Parent
  * @return string
  */
 public function main($linktxt, array $conf, $linkHandlerKeyword, $linkHandlerValue, $linkParameter, ContentObjectRenderer &$pObj)
 {
     $this->pObj =& $pObj;
     $linkHandlerData = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $linkHandlerValue);
     $addparams = '';
     foreach ($linkHandlerData as $linkData) {
         $params = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $linkData);
         if (isset($params[0])) {
             if ($params[0] == 'tx_commerce_products') {
                 $addparams .= '&tx_commerce_pi1[showUid]=' . (int) $params[1];
             } elseif ($params[0] == 'tx_commerce_categories') {
                 $addparams .= '&tx_commerce_pi1[catUid]=' . (int) $params[1];
             }
         }
         if (isset($params[2])) {
             if ($params[2] == 'tx_commerce_products') {
                 $addparams .= '&tx_commerce_pi1[showUid]=' . (int) $params[3];
             } elseif ($params[2] == 'tx_commerce_categories') {
                 $addparams .= '&tx_commerce_pi1[catUid]=' . (int) $params[3];
             }
         }
     }
     if (strpos($addparams, 'showUid') === false) {
         $addparams .= '&tx_commerce_pi1[showUid]=';
     }
     if (strlen($addparams) <= 0) {
         return $linktxt;
     }
     /**
      * Local content object.
      *
      * @var ContentObjectRenderer
      */
     $localcObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $displayPageId = $this->getFrontendController()->tmpl->setup['plugin.']['tx_commerce_pi1.']['overridePid'];
     if (empty($displayPageId)) {
         $displayPageId = SettingsFactory::getInstance()->getExtConf('previewPageID');
     }
     // remove the first param of '$link_param' (this is the page id wich is
     // set by $DisplayPID) and add all params left (e.g. css class,
     // target...) to the value of $lconf['paramter']
     $linkParamArray = explode(' ', $linkParameter);
     if (is_array($linkParamArray)) {
         $linkParamArray = array_splice($linkParamArray, 1);
         if (!empty($linkParamArray)) {
             $linkParameter = $displayPageId . ' ' . implode(' ', $linkParamArray);
         } else {
             $linkParameter = $displayPageId;
         }
     } else {
         $linkParameter = $displayPageId;
     }
     $lconf = $conf;
     unset($lconf['parameter.']);
     $lconf['parameter'] = $linkParameter;
     $lconf['additionalParams'] .= $addparams;
     $lconf['useCacheHash'] = true;
     return $localcObj->typoLink($linktxt, $lconf);
 }
Пример #4
0
 /**
  * Get instance.
  *
  * @return SettingsFactory
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
         self::$instance->getSettings();
     }
     return self::$instance;
 }
Пример #5
0
 /**
  * Initialization.
  *
  * @return void
  */
 protected function init()
 {
     $excludeStatisticFolders = 0;
     if (SettingsFactory::getInstance()->getExtConf('excludeStatisticFolders') != '') {
         $excludeStatisticFolders = SettingsFactory::getInstance()->getExtConf('excludeStatisticFolders');
     }
     $this->statistics = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Utility\\StatisticsUtility');
     $this->statistics->init($excludeStatisticFolders);
 }
 /**
  * Initializes the Tree.
  *
  * @param bool $bare If TRUE only categories get rendered
  *
  * @return void
  */
 public function init($bare = false)
 {
     $this->getLanguageService()->includeLLFile('EXT:commerce/Resources/Private/Language/locallang_mod_category.xml');
     // Get the Category Tree
     $this->categoryTree = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\CategoryTree');
     $this->categoryTree->setBare($bare);
     $this->categoryTree->setSimpleMode((int) SettingsFactory::getInstance()->getExtConf('simpleMode'));
     $this->categoryTree->setNavigationFrame(true);
     $this->categoryTree->init();
 }
Пример #7
0
 /**
  * Pre-processing to define which control items are enabled or disabled.
  *
  * @param string $parentUid The uid of the parent record (uid or NEW...)
  * @param string $foreignTable The table we create control-icons for
  * @param array $childRecord The current record of that foreign_table
  * @param array $childConfig TCA configuration of the current field
  * @param bool $isVirtual Defines whether the current records is only virtually
  *      shown and not physically part of the parent record
  * @param array $enabledControls Associative array with the enabled control items
  *
  * @return void
  */
 public function renderForeignRecordHeaderControl_preProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$enabledControls = null)
 {
     $settingsFactory = SettingsFactory::getInstance();
     if (is_null($enabledControls)) {
         $enabledControls = array('new' => true, 'hide' => true, 'delete' => true);
     } elseif ($settingsFactory->getExtConf('simpleMode') == 1 && $foreignTable == 'tx_commerce_articles' && $parentUid == $settingsFactory->getExtConf('deliveryID')) {
         $enabledControls = array('new' => true, 'hide' => true, 'delete' => true);
     } elseif ($settingsFactory->getExtConf('simpleMode') == 1 && $foreignTable == 'tx_commerce_articles') {
         $enabledControls = array('hide' => true);
     } elseif ($foreignTable == 'tx_commerce_article_prices') {
         $enabledControls = array('new' => true, 'sort' => true, 'hide' => true, 'delete' => true);
     }
 }
Пример #8
0
 /**
  * This hook gets called after a field in tceforms gets rendered. We use this to
  * restore the old values after the hook above got called.
  *
  * @param string $table The name of the database table
  * @param string $field The name of the field we work on in $table
  * @param array  $row The values of all $fields in $table
  * @param string $out Unknown, just for calling compatibility
  *
  * @return void
  */
 public function getSingleField_postProcess($table, $field, array $row, &$out)
 {
     $settingsFactory = SettingsFactory::getInstance();
     // This value is set, if the preProcess updated the tca earlyer
     if ($this->lastMaxItems !== false) {
         $GLOBALS['TCA']['tx_commerce_products']['columns']['articles']['config']['maxitems'] = $this->lastMaxItems;
         $this->lastMaxItems = false;
     }
     if ($table == 'tx_commerce_articles' && $field == 'prices' && !$row['sys_language_uid'] && strpos($row['uid_product'], '_' . $settingsFactory->getExtConf('paymentID') . '|') === false && strpos($row['uid_product'], '_' . $settingsFactory->getExtConf('deliveryID') . '|') === false && is_numeric($row['uid'])) {
         $splitText = '<div class="typo3-newRecordLink">';
         $outa = explode($splitText, $out, 2);
         $out = $outa[0] . $this->getScaleAmount($row['uid']) . $splitText . $outa[1];
     }
 }
Пример #9
0
 /**
  * Load configured criteria.
  *
  * @return void
  * @throws \Exception If criteria was not of correct interface
  */
 protected function loadCriteria()
 {
     // Get and instantiate registered criteria of this payment provider
     $criteraConfigurations = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.PAYMENT.types.' . $this->paymentObject->getType() . '.provider.' . $this->type . '.criteria');
     if (is_array($criteraConfigurations)) {
         foreach ($criteraConfigurations as $criterionConfiguration) {
             if (!is_array($criterionConfiguration['options'])) {
                 $criterionConfiguration['options'] = array();
             }
             /**
              * Criterion.
              *
              * @var ProviderCriterionInterface
              */
             $criterion = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($criterionConfiguration['class'], $this, $criterionConfiguration['options']);
             if (!$criterion instanceof ProviderCriterionInterface) {
                 throw new \Exception('Criterion ' . $criterionConfiguration['class'] . ' must implement interface \\CommerceTeam\\Commerce\\Payment\\Provider\\ProviderCriterionInterface', 1307720945);
             }
             $this->criteria[] = $criterion;
         }
     }
 }
Пример #10
0
 /**
  * Render list header.
  *
  * @param string $table Table
  * @param array $currentIdList Current id list
  * @param array $headerColumns Header columns
  * @param \CommerceTeam\Commerce\ViewHelpers\OrderRecordList $parentObject Parent
  *
  * @return array
  */
 public function renderListHeader($table, $currentIdList, $headerColumns, &$parentObject)
 {
     $language = $this->getLanguageService();
     if (get_class($parentObject) == 'CommerceTeam\\Commerce\\ViewHelpers\\OrderRecordList') {
         $icon = '';
         foreach ($parentObject->fieldArray as $fCol) {
             // Calculate users permissions to edit records in the table:
             $permsEdit = $parentObject->calcPerms & ($table == 'pages' ? 2 : 16);
             switch ((string) $fCol) {
                 // Path
                 case '_PATH_':
                     $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_', 1) . ']</i>';
                     break;
                     // References
                 // References
                 case '_REF_':
                     $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_', 1) . ']</i>';
                     break;
                     // Path
                 // Path
                 case '_LOCALIZATION_':
                     $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_', 1) . ']</i>';
                     break;
                     // Path
                 // Path
                 case '_LOCALIZATION_b':
                     $headerColumns[$fCol] = $language->getLL('Localize', 1);
                     break;
                     // Clipboard:
                 // Clipboard:
                 case '_CLIPBOARD_':
                     if ($parentObject->id && !SettingsFactory::getInstance()->getTcaValue($table . '.ctrl.readOnly') && $this->getController()->MOD_SETTINGS['bigControlPanel']) {
                         $headerColumns[$fCol] = $language->getLL('moveorderto');
                     } else {
                         $headerColumns[$fCol] = '';
                     }
                     break;
                     // Control panel:
                 // Control panel:
                 case '_CONTROL_':
                     if (!SettingsFactory::getInstance()->getTcaValue($table . '.ctrl.readOnly')) {
                         // If new records can be created on this page, add links:
                         if ($parentObject->calcPerms & ($table == 'pages' ? 8 : 16) && $parentObject->showNewRecLink($table)) {
                             if ($table == 'pages') {
                                 $sprite = IconUtility::getSpriteIcon('actions-page-new');
                             } else {
                                 $sprite = IconUtility::getSpriteIcon('actions-document-new');
                             }
                             if ($table == 'tt_content' && $parentObject->newWizards) {
                                 // If mod.web_list.newContentWiz.overrideWithExtension is set,
                                 // use that extension's create new content wizard instead:
                                 $tmpTypoScript = BackendUtility::getModTSconfig($parentObject->id, 'mod.web_list');
                                 $tmpTypoScript = $tmpTypoScript['properties']['newContentWiz.']['overrideWithExtension'];
                                 $newContentWizScriptPath = ExtensionManagementUtility::isLoaded($tmpTypoScript) ? ExtensionManagementUtility::extRelPath($tmpTypoScript) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
                                 $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $parentObject->id . '\');') . '" title="' . $language->getLL('new', true) . '">' . $sprite . '</a>';
                             } elseif ($table == 'pages' && $parentObject->newWizards) {
                                 $icon = '<a href="' . htmlspecialchars($parentObject->backPath . 'db_new.php?id=' . $parentObject->id . '&pagesOnly=1&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '" title="' . $language->getLL('new', true) . '">' . $sprite . '</a>';
                             } else {
                                 $params = '&edit[' . $table . '][' . $parentObject->id . ']=new';
                                 if ($table == 'pages_language_overlay') {
                                     $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $parentObject->pageRow['doktype'];
                                 }
                                 $icon = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . $language->getLL('new', true) . '">' . $sprite . '</a>';
                             }
                         }
                         // If the table can be edited, add link for editing
                         // ALL SHOWN fields for all listed records:
                         if ($permsEdit && $parentObject->table && is_array($currentIdList)) {
                             $editIdList = implode(',', $currentIdList);
                             if ($parentObject->clipNumPane()) {
                                 $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                             }
                             $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $parentObject->fieldArray) . '&disHelp=1';
                             $icon .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . $language->getLL('editShownColumns', true) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                         }
                         // add an empty entry, so column count fits again after moving this into $icon
                         $headerColumns[$fCol] = '&nbsp;';
                     }
                     break;
                     // space column
                 // space column
                 case '_AFTERCONTROL_':
                     // space column
                 // space column
                 case '_AFTERREF_':
                     $headerColumns[$fCol] = '&nbsp;';
                     break;
                     // Regular fields header:
                 // Regular fields header:
                 default:
                     $headerColumns[$fCol] = '';
                     if ($parentObject->table && is_array($currentIdList)) {
                         // If the numeric clipboard pads are selected, show duplicate sorting link:
                         if ($parentObject->clipNumPane()) {
                             $headerColumns[$fCol] .= '<a href="' . htmlspecialchars($parentObject->listURL('', -1) . '&duplicateField=' . $fCol) . '" title="' . $language->getLL('clip_duplicates', true) . '">' . IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>';
                         }
                         // If the table can be edited, add link for
                         // editing THIS field for all listed records:
                         if (!SettingsFactory::getInstance()->getTcaValue($table . '.ctrl.readOnly') && $permsEdit && SettingsFactory::getInstance()->getTcaValue($table . '.columns.' . $fCol)) {
                             $editIdList = implode(',', $currentIdList);
                             if ($parentObject->clipNumPane()) {
                                 $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                             }
                             $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
                             $iTitle = sprintf($language->getLL('editThisColumn'), rtrim(trim($language->sL(BackendUtility::getItemLabel($table, $fCol))), ':'));
                             $headerColumns[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                         }
                     }
                     $headerColumns[$fCol] .= $parentObject->addSortLink($language->sL(BackendUtility::getItemLabel($table, $fCol, 'LLL:EXT:commerce/Resources/Private/Language/locallang_mod_orders.xml:|')), $fCol, $table);
             }
         }
     }
     return $headerColumns;
 }
 /**
  * Constructor.
  *
  * @return self
  */
 public function __construct()
 {
     $this->mapping = trim(SettingsFactory::getInstance()->getExtConf('feuser_address_mapping'), ' ;');
 }
Пример #12
0
    /**
     * Get table.
     *
     * @param string $table Table
     * @param int $id Id
     * @param array $rowlist Row list
     *
     * @return string
     */
    public function getTable($table, $id, array $rowlist)
    {
        // Loading all TCA details for this table:
        $tableConfig = SettingsFactory::getInstance()->getTcaValue($table);
        // Init
        $addWhere = '';
        $titleCol = $tableConfig['ctrl']['label'];
        $thumbsCol = $tableConfig['ctrl']['thumbnail'];
        $l10nEnabled = $tableConfig['ctrl']['languageField'] && $tableConfig['ctrl']['transOrigPointerField'] && !$tableConfig['ctrl']['transOrigPointerTable'];
        // Cleaning rowlist for duplicates and place
        // the $titleCol as the first column always!
        $this->fieldArray = array();
        // Add title column
        $this->fieldArray[] = $titleCol;
        if ($this->localizationView && $l10nEnabled) {
            $this->fieldArray[] = '_LOCALIZATION_';
            $addWhere .= ' AND ' . $tableConfig['ctrl']['languageField'] . ' <= 0';
        }
        if ($this->showClipboard) {
            $this->fieldArray[] = '_CLIPBOARD_';
        }
        if ($this->searchLevels) {
            $this->fieldArray[] = '_PATH_';
        }
        // Cleaning up:
        $this->fieldArray = array_unique(array_merge($this->fieldArray, GeneralUtility::trimExplode(',', $rowlist, 1)));
        if ($this->noControlPanels) {
            $tempArray = array_flip($this->fieldArray);
            unset($tempArray['_CONTROL_']);
            unset($tempArray['_CLIPBOARD_']);
            $this->fieldArray = array_keys($tempArray);
        }
        // Creating the list of fields to include in the SQL query:
        $selectFields = $this->fieldArray;
        $selectFields[] = 'uid';
        $selectFields[] = 'pid';
        if ($thumbsCol) {
            // adding column for thumbnails
            $selectFields[] = $thumbsCol;
        }
        if ($table == 'pages') {
            if (ExtensionManagementUtility::isLoaded('cms')) {
                $selectFields[] = 'module';
                $selectFields[] = 'extendToSubpages';
            }
            $selectFields[] = 'doktype';
        }
        if (is_array($tableConfig['ctrl']['enablecolumns'])) {
            $selectFields = array_merge($selectFields, $tableConfig['ctrl']['enablecolumns']);
        }
        if ($tableConfig['ctrl']['type']) {
            $selectFields[] = $tableConfig['ctrl']['type'];
        }
        if ($tableConfig['ctrl']['typeicon_column']) {
            $selectFields[] = $tableConfig['ctrl']['typeicon_column'];
        }
        if ($tableConfig['ctrl']['versioning']) {
            $selectFields[] = 't3ver_id';
        }
        if ($l10nEnabled) {
            $selectFields[] = $tableConfig['ctrl']['languageField'];
            $selectFields[] = $tableConfig['ctrl']['transOrigPointerField'];
        }
        if ($tableConfig['ctrl']['label_alt']) {
            $selectFields = array_merge($selectFields, GeneralUtility::trimExplode(',', $tableConfig['ctrl']['label_alt'], 1));
        }
        // Unique list!
        $selectFields = array_unique($selectFields);
        // Making sure that the fields in the field-list ARE in the field-list from TCA!
        $selectFields = array_intersect($selectFields, $this->makeFieldList($table, 1));
        // implode it into a list of fields for the SQL-statement.
        $selFieldList = implode(',', $selectFields);
        // Create the SQL query for selecting the elements in the listing:
        // (API function from class.db_list.inc)
        $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
        // Finding the total amount of records on the page
        // (API function from class.db_list.inc)
        $this->setTotalItems($queryParts);
        // Init:
        $dbCount = 0;
        $out = '';
        $database = $this->getDatabaseConnection();
        $language = $this->getLanguageService();
        // If the count query returned any number of records,
        // we perform the real query, selecting records.
        $result = false;
        if ($this->totalItems) {
            $result = $database->exec_SELECT_queryArray($queryParts);
            $dbCount = $database->sql_num_rows($result);
        }
        $listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
        // If any records was selected, render the list:
        if ($dbCount) {
            // Half line is drawn between tables:
            if (!$listOnlyInSingleTableMode) {
                $theData = array();
                if (!$this->table && !$rowlist) {
                    $theData[$titleCol] = '<span style="display: block; width: ' . ($this->getController()->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . 'px; height: 1px"></span>';
                }
                $out .= $this->addelement(0, '', $theData, '', $this->leftMargin);
            }
            // Header line is drawn
            $theData = array();
            if ($this->disableSingleTableView) {
                $theData[$titleCol] = '<span class="c-table">' . $language->sL($tableConfig['ctrl']['title'], 1) . '</span> (' . $this->totalItems . ')';
            } else {
                $title = $language->getLL(!$this->table ? 'expandView' : 'contractView', 1);
                $icon = IconUtility::getSpriteIcon('actions-view-table-' . ($this->table ? 'collapse' : 'expand'), array('title' => $title));
                $theData[$titleCol] = $this->linkWrapTable($table, '<span class="c-table">' . $language->sL($tableConfig['ctrl']['title'], 1) . '</span> (' . $this->totalItems . ') ' . $icon);
            }
            // CSH:
            $theData[$titleCol] .= BackendUtility::cshItem($table, '', $this->backPath, '', false, 'margin-bottom:0px; white-space: normal;');
            if ($listOnlyInSingleTableMode) {
                $out .= '
					<tr>
						<td class="c-headLineTable" style="width: 95%;" ' . $theData[$titleCol] . '</td>
					</tr>';
                if ($this->getBackendUser()->uc['edit_showFieldHelp']) {
                    $language->loadSingleTableDescription($table);
                    if (isset($GLOBALS['TCA_DESCR'][$table]['columns'][''])) {
                        $out .= '
					<tr>
						<td class="c-tableDescription">' . BackendUtility::helpTextIcon($table, '', $this->backPath, true) . $GLOBALS['TCA_DESCR'][$table]['columns']['']['description'] . '</td>
					</tr>';
                    }
                }
            } else {
                $theUpIcon = $table == 'pages' && $this->id && isset($this->pageRow['pid']) ? '<a href="' . htmlspecialchars($this->listURL($this->pageRow['pid'])) . '">' . IconUtility::getSpriteIcon('actions-view-go-up', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', 1))) . '</a>' : '';
                $out .= $this->addelement(1, $theUpIcon, $theData, ' class="c-headLineTable"', '');
            }
            $iOut = '';
            if (!$listOnlyInSingleTableMode) {
                // Fixing a order table for sortby tables
                $this->currentTable = array();
                $currentIdList = array();
                $doSort = $tableConfig['ctrl']['sortby'] && !$this->sortField;
                $prevUid = 0;
                $prevPrevUid = 0;
                // Accumulate rows here
                $accRows = array();
                while ($row = $database->sql_fetch_assoc($result)) {
                    $accRows[] = $row;
                    $currentIdList[] = $row['uid'];
                    if ($doSort) {
                        if ($prevUid) {
                            $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
                            $this->currentTable['next'][$prevUid] = '-' . $row['uid'];
                            $this->currentTable['prevUid'][$row['uid']] = $prevUid;
                        }
                        $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
                        $prevUid = $row['uid'];
                    }
                }
                $database->sql_free_result($result);
                // CSV initiated
                if ($this->csvOutput) {
                    $this->initCSV();
                }
                // Render items:
                $this->CBnames = array();
                $this->duplicateStack = array();
                $this->eCounter = $this->firstElementNumber;
                $cc = 0;
                foreach ($accRows as $row) {
                    // Forward/Backwards navigation links:
                    list($flag, $code) = $this->fwd_rwd_nav($table);
                    $iOut .= $code;
                    // If render item, increment counter and call function
                    if ($flag) {
                        ++$cc;
                        $row[$titleCol] = '<a href="' . GeneralUtility::getIndpEnv('REQUEST_URI') . '&userId=' . $row['uid'] . '">' . $row[$titleCol] . '</a>';
                        $iOut .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
                        // If localization view is enabled it means that the selected records are either
                        // default or All language and here we will not select translations which point
                        // to the main record:
                        if ($this->localizationView && $l10nEnabled) {
                            // Look for translations of this record:
                            $translations = $database->exec_SELECTgetRows($selFieldList, $table, 'pid = ' . $row['pid'] . ' AND ' . $tableConfig['ctrl']['languageField'] . ' > 0 AND ' . $tableConfig['ctrl']['transOrigPointerField'] . ' = ' . (int) $row['uid'] . BackendUtility::deleteClause($table));
                            // For each available translation, render the record:
                            foreach ($translations as $lRow) {
                                $iOut .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 18);
                            }
                        }
                    }
                    // Counter of total rows incremented:
                    ++$this->eCounter;
                }
                // The header row for the table is now created:
                $out .= $this->renderListHeader($table, $currentIdList);
            }
            // The list of records is added after the header:
            $out .= $iOut;
            // ... and it is all wrapped in a table:
            $out = '
            <!--
                DB listing of elements:	"' . htmlspecialchars($table) . '"
            -->
                <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($listOnlyInSingleTableMode ? ' typo3-dblist-overview' : '') . '">
                    ' . $out . '
                </table>';
            // Output csv if...
            if ($this->csvOutput) {
                $this->outputCSV($table);
            }
        }
        // Return content:
        return $out;
    }
Пример #13
0
 /**
  * Find appropriate provider for this payment.
  *
  * @return void
  * @throws \Exception If payment provider is not of corret interface
  */
 protected function findProvider()
 {
     // Check if type has criteria, create all needed objects
     $providerConfigurations = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.PAYMENT.types.' . $this->type . '.provider');
     if (is_array($providerConfigurations)) {
         foreach ($providerConfigurations as $providerConfiguration) {
             /**
              * Provider.
              *
              * @var \CommerceTeam\Commerce\Payment\Provider\ProviderInterface $provider
              */
             $provider = GeneralUtility::makeInstance($providerConfiguration['class'], $this);
             if (!$provider instanceof \CommerceTeam\Commerce\Payment\Provider\ProviderInterface) {
                 throw new \Exception('Provider ' . $providerConfiguration['class'] . ' must implement interface \\CommerceTeam\\Commerce\\Payment\\Provider\\ProviderInterface', 1307705798);
             }
             // Check if provider is allowed and break if so
             if ($provider->isAllowed()) {
                 $this->provider = $provider;
                 break;
             }
         }
     }
 }
Пример #14
0
 /**
  * Calculate tax.
  *
  * @param array $fieldArray Field values
  * @param int $tax Tax percentage
  *
  * @return void
  */
 protected function calculateTax(array &$fieldArray, $tax)
 {
     $generatePrices = SettingsFactory::getInstance()->getExtConf('genprices');
     if ($generatePrices > 0) {
         if ($generatePrices == 2 || !isset($fieldArray['price_gross']) || $fieldArray['price_gross'] === '' || strlen($fieldArray['price_gross']) == 0 || doubleval($fieldArray['price_gross']) === 0.0) {
             $fieldArray['price_gross'] = round($fieldArray['price_net'] * 100 * (100 + $tax) / 100) / 100;
         }
         if ($generatePrices == 3 || !isset($fieldArray['price_net']) || $fieldArray['price_net'] === '' || strlen($fieldArray['price_net']) == 0 || doubleval($fieldArray['price_net']) === 0.0) {
             $fieldArray['price_net'] = round($fieldArray['price_gross'] * 100 / (100 + $tax) * 100) / 100;
         }
     }
 }
Пример #15
0
 /**
  * Finishing Page from Checkout.
  *
  * @param \CommerceTeam\Commerce\Payment\PaymentInterface $paymentObj The payment
  *
  * @return string HTML-Content
  * @throws \Exception If no payment type was configured
  */
 public function finishIt(\CommerceTeam\Commerce\Payment\PaymentInterface $paymentObj = null)
 {
     $database = $this->getDatabaseConnection();
     $orderId = $this->getOrderId();
     if (!is_object($paymentObj)) {
         $paymentType = $this->getPaymentType();
         $config = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.PAYMENT.types.' . strtolower((string) $paymentType));
         if (!isset($config['class']) || !file_exists($config['path'])) {
             throw new \Exception('FINISHING: FATAL! No payment possible because no payment handler is configured!', 1395665876);
         }
         $paymentObj = GeneralUtility::makeInstance($config['class'], $this);
     } else {
         $config = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.PAYMENT.types.' . $paymentObj->getType());
     }
     if ($paymentObj instanceof \CommerceTeam\Commerce\Payment\PaymentInterface) {
         $paymentDone = $paymentObj->checkExternalData($_REQUEST, $this->sessionData);
     } else {
         $paymentDone = false;
     }
     // Check if terms are accepted
     if (!$paymentDone && (empty($this->piVars['terms']) || $this->piVars['terms'] != 'termschecked')) {
         $this->formError['terms'] = $this->pi_getLL('error_terms_not_accepted');
         $content = $this->handlePayment($paymentObj);
         if ($content == false) {
             $this->formError['terms'] = $this->pi_getLL('error_terms_not_accepted');
             $content = $this->getListing();
         }
         return $content;
     }
     // Check stock amount of articles
     if (!$this->checkStock()) {
         $content = $this->pi_getLL('not_all_articles_in_stock') . $this->pi_linkToPage($this->pi_getLL('no_stock_back'), $this->conf['noStockBackPID']);
         return $this->cObj->stdWrap($content, $this->conf['noStockWrap.']);
     }
     // Handle orders
     $feUser = $this->getFrontendUser();
     $basket = $this->getBasket();
     $hooks = HookFactory::getHooks('Controller/CheckoutController', 'finishIt');
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'prepayment')) {
             $hookObj->prepayment($paymentObj, $basket);
         }
     }
     $this->debug($basket, '$basket', __FILE__ . ' ' . __LINE__);
     // Merge local lang array
     if (is_array($this->LOCAL_LANG) && isset($paymentObj->LOCAL_LANG)) {
         foreach ($this->LOCAL_LANG as $llKey => $llData) {
             $newLlData = array_merge($llData, (array) $paymentObj->LOCAL_LANG[$llKey]);
             $this->LOCAL_LANG[$llKey] = $newLlData;
         }
     }
     if (method_exists($paymentObj, 'hasSpecialFinishingForm') && $paymentObj->hasSpecialFinishingForm($_REQUEST)) {
         return $paymentObj->getSpecialFinishingForm($config, $this->sessionData, $basket);
     } elseif (!$paymentObj->finishingFunction($config, $this->sessionData, $basket)) {
         return $this->handlePayment($paymentObj);
     }
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'postpayment')) {
             $hookObj->postpayment($paymentObj, $basket, $this);
         }
     }
     /*
      * We implement a new TS - Setting to handle the generating of orders.
      * if you want to use the "generateOrderId" - Hook and need a unique ID
      * this is only possible if you insert an empty order an make an update
      * later.
      */
     if (isset($this->conf['lockOrderIdInGenerateOrderId']) && $this->conf['lockOrderIdInGenerateOrderId'] == 1) {
         $orderData = array();
         $now = time();
         $orderData['crdate'] = $now;
         $orderData['tstamp'] = $now;
         $database->exec_INSERTquery('tx_commerce_orders', $orderData);
         $orderUid = $database->sql_insert_id();
         // make orderUid avaible in hookObjects
         $this->orderUid = $orderUid;
     }
     // Real finishing starts here !
     // Determine sysfolder, where to place all datasests
     // Default (if no hook us used, the Commerce default folder)
     if (isset($this->conf['newOrderPid']) and $this->conf['newOrderPid'] > 0) {
         $orderData['pid'] = $this->conf['newOrderPid'];
     }
     if (empty($orderData['pid']) || $orderData['pid'] < 0) {
         $comPid = array_keys(FolderRepository::getFolders($this->extKey, 0, 'COMMERCE'));
         $ordPid = array_keys(FolderRepository::getFolders($this->extKey, $comPid[0], 'Orders'));
         $incPid = array_keys(FolderRepository::getFolders($this->extKey, $ordPid[0], 'Incoming'));
         $orderData['pid'] = $incPid[0];
     }
     // Save the order, execute the hooks and stock
     $orderData = $this->saveOrder($orderId, $orderData['pid'], $basket, $paymentObj, true, true);
     // Send emails
     $this->userMailOk = $this->sendUserMail($orderId, $orderData);
     $this->adminMailOk = $this->sendAdminMail($orderId, $orderData);
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'afterMailSend')) {
             $markerArray = $hookObj->afterMailSend($orderData, $this);
         }
     }
     // Start content rendering
     $content = $this->cObj->getSubpart($this->templateCode, '###FINISH###');
     $markerArray['###LISTING_BASKET###'] = $this->makeBasketView($basket, '###BASKET_VIEW###', GeneralUtility::intExplode(',', $this->conf['regularArticleTypes']), array('###LISTING_ARTICLE###', '###LISTING_ARTICLE2###'));
     $markerArray['###MESSAGE###'] = '';
     $markerArray['###LISTING_TITLE###'] = $this->pi_getLL('order_confirmation');
     if (method_exists($paymentObj, 'getSuccessData')) {
         $markerArray['###MESSAGE_PAYMENT_OBJECT###'] = $paymentObj->getSuccessData($this);
     } else {
         $markerArray['###MESSAGE_PAYMENT_OBJECT###'] = '';
     }
     $deliveryAddress = '';
     if ($orderData['cust_deliveryaddress']) {
         $data = $database->exec_SELECTgetSingleRow('*', 'tt_address', 'uid = ' . $orderData['cust_deliveryaddress']);
         if (is_array($data)) {
             $deliveryAddress = $this->makeAdressView($data, '###DELIVERY_ADDRESS###');
         }
     }
     $content = $this->cObj->substituteSubpart($content, '###DELIVERY_ADDRESS###', $deliveryAddress);
     $billingAddress = '';
     if ($orderData['cust_invoice']) {
         $data = $database->exec_SELECTgetSingleRow('*', 'tt_address', 'uid = ' . $orderData['cust_invoice']);
         if (is_array($data)) {
             $billingAddress = $this->makeAdressView($data, '###BILLING_ADDRESS_SUB###');
             $markerArray['###CUST_NAME###'] = $data['NAME'];
         }
     }
     $content = $this->cObj->substituteSubpart($content, '###BILLING_ADDRESS###', $billingAddress);
     $markerArray = $this->finishItRenderGoodBadMarker($markerArray);
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'processMarker')) {
             $markerArray = $hookObj->processMarker($markerArray, $this);
         }
     }
     $content = $this->cObj->substituteMarkerArray($this->cObj->substituteMarkerArray($content, $markerArray), $this->languageMarker);
     foreach ($hooks as $hookObj) {
         if (method_exists($hookObj, 'postFinish')) {
             $hookObj->postFinish($basket, $this);
         }
     }
     // At last remove some things from the session
     if ($this->clearSessionAfterCheckout == true) {
         $feUser->setKey('ses', \CommerceTeam\Commerce\Utility\GeneralUtility::generateSessionKey('payment'), null);
         $feUser->setKey('ses', \CommerceTeam\Commerce\Utility\GeneralUtility::generateSessionKey('delivery'), null);
         $feUser->setKey('ses', \CommerceTeam\Commerce\Utility\GeneralUtility::generateSessionKey('billing'), null);
     }
     $basket->finishOrder();
     // create new basket to remove all values from old one
     /**
      * Basket.
      *
      * @var \CommerceTeam\Commerce\Domain\Model\Basket $basket
      */
     $basket = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Basket');
     $basket->setSessionId(md5($feUser->id . ':' . rand(0, PHP_INT_MAX)));
     $basket->loadData();
     $feUser->setKey('ses', 'orderId', null);
     $feUser->setKey('ses', 'commerceBasketId-' . $basket->getBasketStoragePid(), $basket->getSessionId());
     $feUser->tx_commerce_basket = $basket;
     return $content;
 }
Пример #16
0
 /**
  * Constructor for a commerce basket.
  * Loads configuration data.
  *
  * @return self
  */
 public function __construct()
 {
     if (SettingsFactory::getInstance()->getExtConf('basketType') == 'persistent') {
         $this->storageType = 'persistent';
     }
 }
Пример #17
0
 /**
  * Generates the System Articles.
  *
  * @param int $catUid Category uid
  * @param string $type Type
  * @param array $addArray Additional Values
  *
  * @return void
  */
 public static function makeSystemCatsProductsArtcilesAndPrices($catUid, $type, array $addArray)
 {
     $productUid = self::makeProduct($catUid, $type, $addArray);
     // create some articles, depending on the PAYMENT types
     $sysProductTypes = (array) SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.' . $type . '.types');
     foreach ($sysProductTypes as $key => $value) {
         self::makeArticle($productUid, $key, $value, $addArray);
     }
 }
Пример #18
0
 /**
  * Links the string $code to a create-new form for a record
  * in $table created on page $pid.
  *
  * @param string $linkText Link text
  * @param string $table Table name (in which to create new record)
  * @param int $pid PID value for the
  *      "&edit['.$table.']['.$pid.']=new" command (positive/negative)
  * @param bool $addContentTable If $addContentTable is set,
  *      then a new contentTable record is created together with pages
  *
  * @return string The link.
  */
 public function linkWrap($linkText, $table, $pid, $addContentTable = false)
 {
     $parameters = '&edit[' . $table . '][' . $pid . ']=new';
     $contentTable = $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'];
     $contentTableConfig = SettingsFactory::getInstance()->getTcaValue($contentTable);
     if ($table == 'pages' && $contentTable && $contentTableConfig && $addContentTable) {
         $parameters .= '&edit[' . $contentTable . '][prev]=new&returnNewPageId=1';
     } elseif ($table == 'pages_language_overlay') {
         $parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageinfo['doktype'];
     }
     $parameters = $this->addCommerceParameter($parameters, $table);
     $onClick = BackendUtility::editOnClick($parameters, '', $this->returnUrl);
     return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $linkText . '</a>';
 }
 /**
  * Generates a list of all saved Suppliers.
  *
  * @return string
  */
 protected function getSupplierListing()
 {
     $fields = explode(',', SettingsFactory::getInstance()->getExtConf('coSuppliers'));
     $headerRow = '<tr><td></td>';
     foreach ($fields as $field) {
         $headerRow .= '<td class="bgColor6"><strong>' . $this->getLanguageService()->sL(BackendUtility::getItemLabel('tx_commerce_supplier', htmlspecialchars($field))) . '</strong></td>';
     }
     $headerRow .= '</tr>';
     $result = $this->fetchDataByTable('tx_commerce_supplier');
     $supplierRows = $this->renderSupplierRows($result, $fields);
     $this->tableForNewLink = 'supplier';
     return '<table>' . $headerRow . $supplierRows . '</table>';
 }
Пример #20
0
 /**
  * Localize attributes of product.
  *
  * @param int $productUid Product uid
  * @param int $localizedProductUid Localized product uid
  * @param int $value Value
  *
  * @return void
  */
 protected function translateAttributesOfProduct($productUid, $localizedProductUid, $value)
 {
     $database = $this->getDatabaseConnection();
     // get all related attributes
     $productAttributes = $this->belib->getAttributesForProduct($productUid, false, true);
     // check if localized product has attributes
     $localizedProductAttributes = $this->belib->getAttributesForProduct($localizedProductUid);
     // Check product has attrinutes and no attributes are
     // avaliable for localized version
     if ($localizedProductAttributes == false && !empty($productAttributes)) {
         // if true
         $langIsoCode = BackendUtility::getRecord('sys_language', (int) $value, 'static_lang_isocode');
         $langIdent = BackendUtility::getRecord('static_languages', (int) $langIsoCode['static_lang_isocode'], 'lg_typo3');
         $langIdent = strtoupper($langIdent['lg_typo3']);
         foreach ($productAttributes as $productAttribute) {
             // only if we have attributes type 4 and no valuelist
             if ($productAttribute['uid_correlationtype'] == 4 && !$productAttribute['has_valuelist'] == 1) {
                 $localizedProductAttribute = $productAttribute;
                 unset($localizedProductAttribute['attributeData']);
                 unset($localizedProductAttribute['has_valuelist']);
                 switch (SettingsFactory::getInstance()->getExtConf('attributeLocalizationType')) {
                     case self::ATTRIBUTE_LOCALIZATION_TITLE_EMPTY:
                         unset($localizedProductAttribute['default_value']);
                         break;
                     case self::ATTRIBUTE_LOCALIZATION_TITLE_COPY:
                         break;
                     case self::ATTRIBUTE_LOCALIZATION_TITLE_PREPENDED:
                         /*
                          * Walk through the array and prepend text
                          */
                         $prepend = '[Translate to ' . $langIdent . ':] ';
                         $localizedProductAttribute['default_value'] = $prepend . $localizedProductAttribute['default_value'];
                         break;
                     default:
                 }
                 $localizedProductAttribute['uid_local'] = $localizedProductUid;
                 $database->exec_INSERTquery('tx_commerce_products_attributes_mm', $localizedProductAttribute);
             }
         }
         /*
          * Update the flexform
          */
         $resProduct = $database->exec_SELECTquery('attributesedit, attributes', 'tx_commerce_products', 'uid = ' . $productUid);
         if ($rowProduct = $database->sql_fetch_assoc($resProduct)) {
             $product['attributesedit'] = $this->belib->buildLocalisedAttributeValues($rowProduct['attributesedit'], $langIdent);
             $database->exec_UPDATEquery('tx_commerce_products', 'uid = ' . $localizedProductUid, $product);
         }
     }
 }
Пример #21
0
 /**
  * Main function - generating the click menu in whatever form it has.
  *
  * @return void
  */
 public function main()
 {
     // get the data of the field - the currently selected items
     $row = $this->getRecordProcessed();
     $this->content .= $this->doc->startPage('Treeview Browser');
     /**
      * Form engine.
      *
      * @var \TYPO3\CMS\Backend\Form\FormEngine $form
      */
     $form = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
     $form->initDefaultBEmode();
     $form->backPath = $this->getBackPath();
     $row['uid'] = $this->uid;
     $parameter = array();
     if (is_array($this->flexConfig)) {
         $parameter['fieldConf'] = array('label' => $form->sL($this->flexConfig['label']), 'config' => $this->flexConfig['config'], 'defaultExtras' => $this->flexConfig['defaultExtras']);
     } else {
         $settingsFactory = SettingsFactory::getInstance();
         $parameter['fieldConf'] = array('label' => $form->sL($settingsFactory->getTcaValue($this->table . '.columns.' . $this->field . '.label')), 'config' => $settingsFactory->getTcaValue($this->table . '.columns.' . $this->field . '.config'));
     }
     $parameter['fieldConf']['config']['treeViewBrowseable'] = 'iframeContent';
     $parameter['fieldConf']['config']['noTableWrapping'] = true;
     $parameter['itemFormElName'] = $this->itemFormElName;
     $parameter['itemFormElName_file'] = $this->itemFormElName;
     $this->content .= $form->getSingleField_SW($this->table, $this->field, $row, $parameter);
 }
Пример #22
0
 /**
  * Initialization.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->createPid = SettingsFactory::getInstance()->getExtConf('create_feuser_pid');
 }
Пример #23
0
 /**
  * Retrieves the data object to make an overwrite.
  *
  * @param string $table Tablename
  * @param int $uidFrom Uid of the record we which to retrieve the data from
  * @param int $destPid Uid of the record we want to overwrite
  *
  * @return array
  */
 public function getOverwriteData($table, $uidFrom, $destPid)
 {
     /**
      * Data handler.
      *
      * @var \TYPO3\CMS\Core\DataHandling\DataHandler $tce
      */
     $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
     $tce->stripslashes_values = 0;
     $backendUser = self::getBackendUser();
     $tcaDefaultOverride = $backendUser->getTSConfigProp('TCAdefaults');
     if (is_array($tcaDefaultOverride)) {
         $tce->setDefaultsFromUserTS($tcaDefaultOverride);
     }
     $tce->start(array(), array());
     $first = 0;
     $language = 0;
     $uid = $origUid = (int) $uidFrom;
     $tableConfig = SettingsFactory::getInstance()->getTcaValue($table);
     // Only copy if the table is defined in TCA, a uid is given
     if ($tableConfig && $uid) {
         // This checks if the record can be selected
         // which is all that a copy action requires.
         $data = array();
         $nonFields = array_unique(GeneralUtility::trimExplode(',', 'uid, perms_userid, perms_groupid, perms_user, perms_group, perms_everybody, t3ver_oid, t3ver_wsid,
                 t3ver_id, t3ver_label, t3ver_state, t3ver_swapmode, t3ver_count, t3ver_stage, t3ver_tstamp,', 1));
         // So it copies (and localized) content from workspace...
         $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid);
         if (is_array($row)) {
             // Initializing:
             $theNewId = $destPid;
             $enableField = isset($tableConfig['ctrl']['enablecolumns']) ? $tableConfig['ctrl']['enablecolumns']['disabled'] : '';
             $headerField = $tableConfig['ctrl']['label'];
             // Getting default data:
             $defaultData = $tce->newFieldArray($table);
             // Getting "copy-after" fields if applicable:
             $copyAfterFields = array();
             // Page TSconfig related:
             // NOT using BackendUtility::getTSCpid() because we need the
             // real pid - not the ID of a page, if the input is a page...
             $tscPid = \TYPO3\CMS\Backend\Utility\BackendUtility::getTSconfig_pidValue($table, $uid, -$destPid);
             $tsConfig = $tce->getTCEMAIN_TSconfig($tscPid);
             $tE = $tce->getTableEntries($table, $tsConfig);
             // Traverse ALL fields of the selected record:
             foreach ($row as $field => $value) {
                 if (!in_array($field, $nonFields)) {
                     // Get TCA configuration for the field:
                     $conf = $tableConfig['columns'][$field]['config'];
                     // Preparation/Processing of the value:
                     // "pid" is hardcoded of course:
                     if ($field == 'pid') {
                         $value = $destPid;
                         // Override value...
                     } elseif (isset($overrideValues[$field])) {
                         $value = $overrideValues[$field];
                         // Copy-after value if available:
                     } elseif (isset($copyAfterFields[$field])) {
                         $value = $copyAfterFields[$field];
                         // Revert to default for some fields:
                     } elseif ($tableConfig['ctrl']['setToDefaultOnCopy'] && GeneralUtility::inList($tableConfig['ctrl']['setToDefaultOnCopy'], $field)) {
                         $value = $defaultData[$field];
                     } else {
                         // Hide at copy may override:
                         if ($first && $field == $enableField && $tableConfig['ctrl']['hideAtCopy'] && !$tce->neverHideAtCopy && !$tE['disableHideAtCopy']) {
                             $value = 1;
                         }
                         // Prepend label on copy:
                         if ($first && $field == $headerField && $tableConfig['ctrl']['prependAtCopy'] && !$tE['disablePrependAtCopy']) {
                             // @todo this can't work resolvePid and clearPrefixFromValue are not implement
                             // wasn't present bevor 0.11.x and was broken from the beginning
                             $value = $tce->getCopyHeader($table, $this->resolvePid($table, $destPid), $field, $this->clearPrefixFromValue($table, $value), 0);
                         }
                         // Processing based on the TCA config field
                         // type (files, references, flexforms...)
                         $value = $tce->copyRecord_procBasedOnFieldType($table, $uid, $field, $value, $row, $conf, $tscPid, $language);
                     }
                     // Add value to array.
                     $data[$table][$theNewId][$field] = $value;
                 }
             }
             // Overriding values:
             if ($tableConfig['ctrl']['editlock']) {
                 $data[$table][$theNewId][$tableConfig['ctrl']['editlock']] = 0;
             }
             // Setting original UID:
             if ($tableConfig['ctrl']['origUid']) {
                 $data[$table][$theNewId][$tableConfig['ctrl']['origUid']] = $uid;
             }
             return $data;
         }
     }
     return array();
 }
 /**
  * Adds items to the ->MOD_MENU array. Used for the function menu selector.
  *
  * @return void
  */
 public function menuConfig()
 {
     $language = $this->getLanguageService();
     if (SettingsFactory::getInstance()->getExtConf('allowAggregation') == 1) {
         $this->MOD_MENU = array('function' => array('1' => $language->getLL('statistics'), '2' => $language->getLL('incremental_aggregation'), '3' => $language->getLL('complete_aggregation')));
     } else {
         $this->MOD_MENU = array('function' => array('1' => $language->getLL('statistics')));
     }
     parent::menuConfig();
 }
Пример #25
0
 /**
  * Gets the basket storage pid.
  *
  * @return int
  */
 public static function getBasketStoragePid()
 {
     if (self::getFrontendController()->tmpl->setup['plugin.']['tx_commerce_pi2.']['basketStoragePid']) {
         $basketStoragePid = (int) self::getFrontendController()->tmpl->setup['plugin.']['tx_commerce_pi2.']['basketStoragePid'];
     } else {
         $basketStoragePid = SettingsFactory::getInstance()->getExtConf('BasketStoragePid');
     }
     return $basketStoragePid;
 }
Пример #26
0
    /**
     * Create a regular new element (pages and records).
     *
     * @return void
     */
    protected function regularNew()
    {
        $backendUser = $this->getBackendUser();
        $language = $this->getLanguageService();
        // Slight spacer from header:
        $this->code .= '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->getBackPath(), 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' alt="" /><br />';
        // New tables INSIDE this category
        foreach ($this->param as $table => $param) {
            if ($this->showNewRecLink($table) && $this->isTableAllowedForThisPage($this->pageinfo, $table) && $backendUser->check('tables_modify', $table) && ($param['ctrl']['rootLevel'] xor $this->id || $param['ctrl']['rootLevel'] == -1)) {
                $val = key($param);
                $cmd = $param[$val];
                switch ($cmd) {
                    case 'new':
                        // Create new link for record:
                        $rowContent = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->getBackPath(), 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />' . $this->linkWrap(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array()) . $language->sL(SettingsFactory::getInstance()->getTcaValue($table . '.ctrl.title'), 1), $table, $this->id);
                        // Compile table row:
                        $tRows[] = '
                <tr>
                    <td nowrap="nowrap">' . $rowContent . '</td>
                    <td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($table, '', $this->getBackPath(), '') . '</td>
                </tr>
                ';
                        break;
                    default:
                }
            }
        }
        // Compile table row:
        $tRows[] = '
			<tr>
				<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->getBackPath(), 'gfx/ol/stopper.gif', 'width="18" height="16"') . ' alt="" /></td>
				<td></td>
			</tr>
		';
        // Make table:
        $this->code .= '
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-newRecord">
			' . implode('', $tRows) . '
			</table>
		';
        // Add CSH:
        $this->code .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'new_regular', $this->getBackPath(), '<br/>');
    }
Пример #27
0
 /**
  * Saves all relations between products and his attributes.
  *
  * @param int $productId The UID of the product
  * @param array $fieldArray Field array
  *
  * @return void
  */
 protected function saveProductRelations($productId, array $fieldArray = null)
 {
     $productId = (int) $productId;
     // first step is to save all relations between this product and all attributes
     // of this product.
     // We don't have to check for any parent categories, because the attributes
     // from them should already be saved for this product.
     $database = $this->getDatabaseConnection();
     // create an article and a new price for a new product
     if (SettingsFactory::getInstance()->getExtConf('simpleMode') && $productId != null) {
         // search for an article of this product
         $res = $database->exec_SELECTquery('*', 'tx_commerce_articles', 'uid_product = ' . $productId, '', '', 1);
         $aRes = array();
         if ($database->sql_num_rows($res)) {
             $aRes = $database->sql_fetch_assoc($res);
             $aUid = $aRes['uid'];
         } else {
             // create a new article if no one exists
             $pRes = $database->exec_SELECTquery('title', 'tx_commerce_products', 'uid = ' . $productId, '', '', 1);
             $productData = $database->sql_fetch_assoc($pRes);
             $database->exec_INSERTquery('tx_commerce_articles', array('pid' => $fieldArray['pid'], 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME'], 'uid_product' => $productId, 'article_type_uid' => 1, 'title' => $productData['title']));
             $aUid = $database->sql_insert_id();
         }
         // check if the article has already a price
         $row = $database->exec_SELECTgetSingleRow('*', 'tx_commerce_article_prices', 'uid_article = ' . $productId);
         if (empty($row) && $aRes['sys_language_uid'] < 1) {
             // create a new price if no one exists
             $database->exec_INSERTquery('tx_commerce_article_prices', array('pid' => $fieldArray['pid'], 'uid_article' => $aUid, 'tstamp' => $GLOBALS['EXEC_TIME'], 'crdate' => $GLOBALS['EXEC_TIME']));
         }
     }
     $delete = true;
     if (isset($fieldArray['categories'])) {
         $catList = array();
         $res = $database->exec_SELECTquery('uid_foreign', 'tx_commerce_products_categories_mm', 'uid_local = ' . $productId);
         while ($sres = $database->sql_fetch_assoc($res)) {
             $catList[] = $sres['uid_foreign'];
         }
         $paList = $this->belib->getAttributesForCategoryList($catList);
         $uidList = $this->belib->extractFieldArray($paList, 'uid_foreign', true, array('uid_correlationtype'));
         $this->belib->saveRelations($productId, $uidList, 'tx_commerce_products_attributes_mm', false, false);
         $this->belib->updateXML('attributes', 'tx_commerce_products', $productId, 'product', $catList);
         $delete = false;
     }
     $articles = false;
     if (isset($fieldArray['attributes'])) {
         // get all correlation types
         $correlationTypeList = $this->belib->getAllCorrelationTypes();
         $paList = array();
         // extract all attributes from FlexForm
         $ffData = GeneralUtility::xml2array($fieldArray['attributes']);
         if (is_array($ffData)) {
             $this->belib->mergeAttributeListFromFFData($ffData['data']['sDEF']['lDEF'], 'ct_', $correlationTypeList, $productId, $paList);
         }
         // get the list of uid_foreign and save relations for this category
         $uidList = $this->belib->extractFieldArray($paList, 'uid_foreign', true, array('uid_correlationtype'));
         // get all ct4 attributes
         $ct4Attributes = array();
         if (is_array($uidList)) {
             foreach ($uidList as $uidItem) {
                 if ($uidItem['uid_correlationtype'] == 4) {
                     $ct4Attributes[] = $uidItem['uid_foreign'];
                 }
             }
         }
         $this->belib->saveRelations($productId, $uidList, 'tx_commerce_products_attributes_mm', $delete, false);
         /*
          * Rebuild the XML (last param set to true)
          * Fixes that l10n of products had invalid XML attributes
          */
         $this->belib->updateXML('attributes', 'tx_commerce_products', $productId, 'product', $correlationTypeList, true);
         // update the XML for this product, we remove everything that is not
         // set for current attributes
         $pXml = $database->exec_SELECTquery('attributesedit', 'tx_commerce_products', 'uid = ' . $productId);
         $pXml = $database->sql_fetch_assoc($pXml);
         if (!empty($pXml['attributesedit'])) {
             $pXml = GeneralUtility::xml2array($pXml['attributesedit']);
             if (is_array($pXml['data']['sDEF']['lDEF'])) {
                 foreach (array_keys($pXml['data']['sDEF']['lDEF']) as $key) {
                     $data = array();
                     $uid = $this->belib->getUIdFromKey($key, $data);
                     if (!in_array($uid, $ct4Attributes)) {
                         unset($pXml['data']['sDEF']['lDEF'][$key]);
                     }
                 }
             }
             if (is_array($pXml) && is_array($pXml['data']) && is_array($pXml['data']['sDEF'])) {
                 $pXml = GeneralUtility::array2xml($pXml, '', 0, 'T3FlexForms');
                 $fieldArray['attributesedit'] = $pXml;
             }
         }
         // now get all articles that where created from this product
         $articles = $this->belib->getArticlesOfProduct($productId);
         // build relation table
         if (is_array($articles) && !empty($articles)) {
             $uidList = $this->belib->extractFieldArray($paList, 'uid_foreign', true);
             foreach ($articles as $article) {
                 $this->belib->saveRelations($article['uid'], $uidList, 'tx_commerce_articles_article_attributes_mm', true, false);
             }
         }
     }
     $updateArrays = array();
     // update all articles of this product
     if (!empty($fieldArray['attributesedit'])) {
         $ffData = (array) GeneralUtility::xml2array($fieldArray['attributesedit']);
         if (is_array($ffData['data']) && is_array($ffData['data']['sDEF']['lDEF'])) {
             // get articles if they are not already there
             if (!$articles) {
                 $articles = $this->belib->getArticlesOfProduct($productId);
             }
             // update this product
             $articleRelations = array();
             $counter = 0;
             foreach ($ffData['data']['sDEF']['lDEF'] as $ffDataItemKey => $ffDataItem) {
                 ++$counter;
                 $attributeKey = $this->belib->getUidFromKey($ffDataItemKey, $keyData);
                 $attributeData = $this->belib->getAttributeData($attributeKey, 'has_valuelist,multiple');
                 // check if the attribute has more than one value, if that is true,
                 // we have to create a relation for each value
                 if ($attributeData['multiple'] == 1) {
                     // if we have a multiple valuelist we need to handle the attributes a little
                     // bit different first we delete all existing attributes
                     $database->exec_DELETEquery('tx_commerce_products_attributes_mm', 'uid_local = ' . $productId . ' AND uid_foreign = ' . $attributeKey);
                     // now explode the data
                     $attributeValues = GeneralUtility::trimExplode(',', $ffDataItem['vDEF'], true);
                     foreach ($attributeValues as $attributeValue) {
                         // The first time an attribute value is selected, TYPO3 returns them
                         // INCLUDING an empty value! This would cause an unnecessary entry in the
                         // database, so we have to filter this here.
                         if (empty($attributeValue)) {
                             continue;
                         }
                         $updateData = $this->belib->getUpdateData($attributeData, $attributeValue, $productId);
                         $database->exec_INSERTquery('tx_commerce_products_attributes_mm', array_merge(array('uid_local' => $productId, 'uid_foreign' => $attributeKey, 'uid_correlationtype' => 4), $updateData[0]));
                     }
                 } else {
                     // update a simple valuelist and normal attributes as usual
                     $updateArrays = $this->belib->getUpdateData($attributeData, $ffDataItem['vDEF'], $productId);
                     $database->exec_UPDATEquery('tx_commerce_products_attributes_mm', 'uid_local = ' . $productId . ' AND uid_foreign = ' . $attributeKey, $updateArrays[0]);
                 }
                 // update articles
                 if (is_array($articles) && !empty($articles)) {
                     foreach ($articles as $article) {
                         if ($attributeData['multiple'] == 1) {
                             // if we have a multiple valuelist we need to handle the attributes a little
                             // bit different first we delete all existing attributes
                             $database->exec_DELETEquery('tx_commerce_articles_article_attributes_mm', 'uid_local = ' . $article['uid'] . ' AND uid_foreign = ' . $attributeKey);
                             // now explode the data
                             $attributeValues = GeneralUtility::trimExplode(',', $ffDataItem['vDEF'], true);
                             $attributeCount = 0;
                             $attributeValue = '';
                             foreach ($attributeValues as $attributeValue) {
                                 if (empty($attributeValue)) {
                                     continue;
                                 }
                                 ++$attributeCount;
                                 $updateData = $this->belib->getUpdateData($attributeData, $attributeValue, $productId);
                                 $database->exec_INSERTquery('tx_commerce_articles_article_attributes_mm', array_merge(array('uid_local' => $article['uid'], 'uid_foreign' => $attributeKey, 'uid_product' => $productId, 'sorting' => $counter), $updateData[1]));
                             }
                             // create at least an empty relation if no attributes where set
                             if ($attributeCount == 0) {
                                 $updateData = $this->belib->getUpdateData(array(), $attributeValue, $productId);
                                 $database->exec_INSERTquery('tx_commerce_articles_article_attributes_mm', array_merge(array('uid_local' => $article['uid'], 'uid_foreign' => $attributeKey, 'uid_product' => $productId, 'sorting' => $counter), $updateData[1]));
                             }
                         } else {
                             // if the article has already this attribute, we have to insert so try
                             // to select this attribute for this article
                             $res = $database->exec_SELECTquery('uid_local, uid_foreign', 'tx_commerce_articles_article_attributes_mm', 'uid_local = ' . $article['uid'] . ' AND uid_foreign = ' . $attributeKey);
                             if ($database->sql_num_rows($res)) {
                                 $database->exec_UPDATEquery('tx_commerce_articles_article_attributes_mm', 'uid_local = ' . $article['uid'] . ' AND uid_foreign = ' . $attributeKey, array_merge($updateArrays[1], array('sorting' => $counter)));
                             } else {
                                 $database->exec_INSERTquery('tx_commerce_articles_article_attributes_mm', array_merge($updateArrays[1], array('uid_local' => $article['uid'], 'uid_product' => $productId, 'uid_foreign' => $attributeKey, 'sorting' => $counter)));
                             }
                         }
                         $relArray = $updateArrays[0];
                         $relArray['uid_foreign'] = $attributeKey;
                         if (!in_array($relArray, $articleRelations)) {
                             $articleRelations[] = $relArray;
                         }
                         $this->belib->updateArticleHash($article['uid']);
                     }
                 }
             }
             // Finally update the Felxform for this Product
             $this->belib->updateArticleXML($articleRelations, false, null, $productId);
             // And add those datas from the database to the articles
             if (is_array($articles) && !empty($articles)) {
                 foreach ($articles as $article) {
                     $thisArticleRelations = $this->belib->getAttributesForArticle($article['uid']);
                     $this->belib->updateArticleXML($thisArticleRelations, false, $article['uid'], null);
                 }
             }
         }
     }
     // Check if we do have some localized products an call the method recursivly
     $resLocalised = $database->exec_SELECTquery('uid', 'tx_commerce_products', 'deleted = 0 AND l18n_parent = ' . $productId);
     while ($rowLocalised = $database->sql_fetch_assoc($resLocalised)) {
         $this->saveProductRelations($rowLocalised['uid'], $fieldArray);
     }
 }
Пример #28
0
 /**
  * Makes the list of fields to select for a table.
  *
  * @param string $table Table name
  * @param bool|int $dontCheckUser If set, users access to the
  *      field (non-exclude-fields) is NOT checked.
  * @param bool|int $addDateFields If set, also adds crdate and
  *      tstamp fields (note: they will also be added if user is admin or
  *      dontCheckUser is set)
  *
  * @return array Array, where values are fieldnames to include in query
  */
 public function makeFieldList($table, $dontCheckUser = 0, $addDateFields = 0)
 {
     $backendUser = $this->getBackendUser();
     $tableConfig = SettingsFactory::getInstance()->getTcaValue($table);
     // Init fieldlist array:
     $fieldListArr = array();
     // Check table:
     if (is_array($tableConfig)) {
         if (isset($tableConfig['columns']) && is_array($tableConfig['columns'])) {
             // Traverse configured columns and add them to field array,
             // if available for user.
             foreach ($tableConfig['columns'] as $fN => $fieldValue) {
                 if ($dontCheckUser || (!$fieldValue['exclude'] || $backendUser->check('non_exclude_fields', $table . ':' . $fN)) && $fieldValue['config']['type'] != 'passthrough') {
                     $fieldListArr[] = $fN;
                 }
             }
             foreach ($this->additionalFieldArray as $fN) {
                 $fieldListArr[] = $fN;
             }
             // Add special fields:
             if ($dontCheckUser || $backendUser->isAdmin()) {
                 $fieldListArr[] = 'uid';
                 $fieldListArr[] = 'pid';
             }
             // Add date fields
             if ($dontCheckUser || $backendUser->isAdmin() || $addDateFields) {
                 if ($tableConfig['ctrl']['tstamp']) {
                     $fieldListArr[] = $tableConfig['ctrl']['tstamp'];
                 }
                 if ($tableConfig['ctrl']['crdate']) {
                     $fieldListArr[] = $tableConfig['ctrl']['crdate'];
                 }
             }
             // Add more special fields:
             if ($dontCheckUser || $backendUser->isAdmin()) {
                 if ($tableConfig['ctrl']['cruser_id']) {
                     $fieldListArr[] = $tableConfig['ctrl']['cruser_id'];
                 }
                 if ($tableConfig['ctrl']['sortby']) {
                     $fieldListArr[] = $tableConfig['ctrl']['sortby'];
                 }
                 if ($tableConfig['ctrl']['versioningWS']) {
                     $fieldListArr[] = 't3ver_id';
                     $fieldListArr[] = 't3ver_state';
                     $fieldListArr[] = 't3ver_wsid';
                     if ($table === 'pages') {
                         $fieldListArr[] = 't3ver_swapmode';
                     }
                 }
             }
         } else {
             GeneralUtility::sysLog(sprintf('$TCA is broken for the table "%s": no required "columns" entry in $TCA.', $table), 'core', GeneralUtility::SYSLOG_SEVERITY_ERROR);
         }
     }
     // CSV Export
     if ($this->csvOutput) {
         $fieldListArr = $this->csvFieldArray;
     }
     return $fieldListArr;
 }
Пример #29
0
 /**
  * Returns the payment object for a specific payment type
  * (creditcard, invoice, ...).
  *
  * @param string $paymentType Payment type to get
  *
  * @return \CommerceTeam\Commerce\Payment\PaymentAbstract Current payment
  *
  * @throws \Exception If payment object can not be created or is invalid
  */
 protected function getPaymentObject($paymentType = '')
 {
     if (!is_string($paymentType)) {
         throw new \Exception('Expected variable of type string for ' . $paymentType . ' but a ' . getType($paymentType) . ' was given.', 1305675802);
     }
     if (strlen($paymentType) < 1) {
         throw new \Exception('Empty payment type given.', 1307015821);
     }
     $config = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.PAYMENT.types.' . $paymentType);
     if (!is_array($config)) {
         throw new \Exception('No configuration found for payment type ' . $paymentType, 1305675991);
     }
     if (!isset($config['class'])) {
         throw new \Exception('No target implementation found for payment type ' . $paymentType, 1305676132);
     }
     $paymentObject = GeneralUtility::makeInstance($config['class'], $this);
     if (!$paymentObject instanceof \CommerceTeam\Commerce\Payment\PaymentInterface) {
         throw new \Exception($config['class'] . ' must implement \\CommerceTeam\\Commerce\\Payment\\PaymentInterface');
     }
     return $paymentObject;
 }
Пример #30
0
 /**
  * This method will be used by the initial methods before and after the Order
  * will be moved to another Orderstate.
  *
  * @param array $orderdata Containing the orderdatea like UID and PID
  * @param array $detaildata Containing the detaildata to Order like
  *      order_id and CustomerUIDs
  * @param int $mailkind Mail kind
  *
  * @return void
  */
 protected function processOrdermails(array &$orderdata, array &$detaildata, $mailkind)
 {
     $pid = $orderdata['pid'] ? $orderdata['pid'] : $detaildata['pid'];
     $templates = $this->generateTemplateArray($mailkind, $pid, $detaildata['order_sys_language_uid']);
     foreach ($templates as $template) {
         $this->templateCode = GeneralUtility::getURL($this->templatePath . $template['mailtemplate']);
         $this->templateCodeHtml = GeneralUtility::getURL($this->templatePath . $template['htmltemplate']);
         $settingsFactory = SettingsFactory::getInstance();
         $senderemail = $template['senderemail'] == '' ? $settingsFactory->getExtConf('defEmailAddress') : $template['senderemail'];
         if ($template['sendername'] == '') {
             if ($senderemail == $settingsFactory->getExtConf('defEmailAddress')) {
                 $sendername = $settingsFactory->getExtConf('defEmailSendername');
             } else {
                 $sendername = $senderemail;
             }
         } else {
             $sendername = $template['sendername'];
         }
         // Mailconf for tx_commerce_div::sendMail($mailconf);
         $mailconf = array('plain' => array('content' => $this->generateMail($orderdata['order_id'], $detaildata, $this->templateCode)), 'html' => array('content' => $this->generateMail($orderdata['order_id'], $detaildata, $this->templateCodeHtml), 'path' => '', 'useHtml' => $this->templateCodeHtml ? '1' : ''), 'defaultCharset' => 'utf-8', 'encoding' => '8bit', 'attach' => '', 'alternateSubject' => 'TYPO3 :: commerce', 'recipient' => '', 'recipient_copy' => $template['BCC'], 'fromEmail' => $senderemail, 'fromName' => $sendername, 'replyTo' => $this->cObj->conf['usermail.']['from'], 'priority' => '3', 'callLocation' => 'processOrdermails');
         if ($template['otherreceiver'] != '') {
             $mailconf['recipient'] = $template['otherreceiver'];
             $this->ordermoveSendMail($mailconf, $orderdata, $template);
         } else {
             $mailconf['recipient'] = $this->customermailadress;
             $this->ordermoveSendMail($mailconf, $orderdata, $template);
         }
     }
 }