Skip to content

Commit

Permalink
Merge pull request #241 from franzholz/develop
Browse files Browse the repository at this point in the history
use spelling funcTablename instead of functablename
  • Loading branch information
franzholz authored Feb 16, 2024
2 parents 78a34b5 + 07d9819 commit 6e919cd
Show file tree
Hide file tree
Showing 76 changed files with 448 additions and 448 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
* bugfix issue #74: The FE session has not been stored.

2020-10-09 Franz Holzinger <[email protected]>
* bugfix with memo item function: wrong functablename memoItems instead of tt_products
* bugfix with memo item function: wrong funcTablename memoItems instead of tt_products

2020-10-05 Franz Holzinger <[email protected]>
* bugfix with discountprice: $k3 == 'type' is true with a value of 0.
Expand Down
12 changes: 6 additions & 6 deletions Classes/Api/ParameterApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public function getParameterTable($parameter = '')
return $result;
}

public function getPiVarValue($functablename)
public function getPiVarValue($funcTablename)
{
$piVars = $this->getPiVars();
$piVar = $this->getPiVar($functablename);
$piVar = $this->getPiVar($funcTablename);
$result = false;

if (
Expand Down Expand Up @@ -199,10 +199,10 @@ public function getPrefixId()
return $this->prefixId;
}

public function getPiVar($functablename)
public function getPiVar($funcTablename)
{
$paramsTableArray = $this->getParameterTable();
$result = array_search($functablename, $paramsTableArray);
$result = array_search($funcTablename, $paramsTableArray);

return $result;
}
Expand Down Expand Up @@ -446,7 +446,7 @@ public function getWhereByFields(
public function getSearchInfo(
$cObj,
$searchVars,
$functablename,
$funcTablename,
$tablename,
&$searchboxWhere,
&$bUseSearchboxArray,
Expand Down Expand Up @@ -519,7 +519,7 @@ public function getSearchInfo(
$searchFieldArray['local'] = $tmpArray[1];
$searchFieldArray['foreign'] = '';

if (self::getPiVar($functablename) == $searchParamArray['local']) {
if (self::getPiVar($funcTablename) == $searchParamArray['local']) {
$sqlTableArray['from'] = [];
$sqlTableArray['join'] = [];
$sqlTableArray['local'] = [];
Expand Down
8 changes: 4 additions & 4 deletions Classes/Api/PluginApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ public function getRelatedProducts(

if (
!empty($funcArray) &&
$funcTablename != $funcArray['functablename']
$funcTablename != $funcArray['funcTablename']
) {
$relatedItemObj = $tablesObj->get($funcArray['functablename'], false);
$parentFuncTablename = $funcArray['functablename'];
$relatedItemObj = $tablesObj->get($funcArray['funcTablename'], false);
$parentFuncTablename = $funcArray['funcTablename'];
}
$tableConf = $relatedItemObj->getTableConf($funcArray['code']);
$orderBy = '';
Expand Down Expand Up @@ -442,7 +442,7 @@ public function getRelatedProducts(
$tmpContent = $listView->printView(
$templateCode,
$funcArray['code'],
$funcArray['functablename'],
$funcArray['funcTablename'],
implode(',', $relatedIds),
$listPids,
'',
Expand Down
2 changes: 1 addition & 1 deletion Classes/Hooks/TransactorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function execute(
$this,
$templateCode,
$mainMarkerArray,
$functablename = 'tt_products',
$funcTablename = 'tt_products',
$orderUid,
$orderRow,
$itemArray,
Expand Down
6 changes: 3 additions & 3 deletions api/class.tx_ttproducts_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ public static function finalizeOrder(
$pObj,
$templateCode,
$mainMarkerArray,
$functablename,
$funcTablename,
$orderUid,
&$orderArray,
$itemArray,
Expand Down Expand Up @@ -695,7 +695,7 @@ public static function finalizeOrder(
$csvfilepath = Environment::getPublicPath() . '/' . $conf['CSVdestination'];

$csv->create(
$functablename,
$funcTablename,
$conf,
$itemArray,
$calculatedArray,
Expand Down Expand Up @@ -1389,7 +1389,7 @@ public static function finalizeOrder(
$infoViewObj,
$templateCode,
$basketView,
$functablename,
$funcTablename,
$orderUid,
$orderConfirmationHTML,
$errorMessage,
Expand Down
8 changes: 4 additions & 4 deletions api/class.tx_ttproducts_ts.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ protected function getMemoCount($uid = 0)
}

if ($bMemoFound) {
$functablename = 'tt_products';
$memoItems = tx_ttproducts_control_memo::readSessionMemoItems($functablename);
$funcTablename = 'tt_products';
$memoItems = tx_ttproducts_control_memo::readSessionMemoItems($funcTablename);
if ($memoItems != '') {
$memoArray = GeneralUtility::trimExplode(',', $memoItems);
$count = count($memoArray);
Expand Down Expand Up @@ -183,10 +183,10 @@ public function pageProductCount_IProcFunc($I, $conf)

public function processMemo(): void
{
$functablename = 'tt_products';
$funcTablename = 'tt_products';
$conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][TT_PRODUCTS_EXT . '.'];
$piVars = GeneralUtility::_GPmerged('tt_products');

tx_ttproducts_control_memo::process($functablename, $piVars, $conf);
tx_ttproducts_control_memo::process($funcTablename, $piVars, $conf);
}
}
6 changes: 3 additions & 3 deletions control/class.tx_ttproducts_activity_finalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function getEmailControlArray(
public function doProcessing(
$templateCode,
$mainMarkerArray,
$functablename,
$funcTablename,
$orderUid,
&$orderArray,
$productRowArray,
Expand Down Expand Up @@ -157,7 +157,7 @@ public function doProcessing(
if (!$bAlwaysInStock) {
$emailControlArray = $this->getEmailControlArray($templateCode, $conf, $defaultFromArray);

$itemObj = $tablesObj->get($functablename);
$itemObj = $tablesObj->get($funcTablename);
$instockTableArray =
$itemObj->reduceInStockItems(
$basketObj->getItemArray(),
Expand Down Expand Up @@ -294,7 +294,7 @@ public function doProcessing(
$this,
$templateCode,
$mainMarkerArray,
$functablename,
$funcTablename,
$orderUid,
$orderArray,
$basketObj->getItemArray(),
Expand Down
4 changes: 2 additions & 2 deletions control/class.tx_ttproducts_control_basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,10 @@ public static function getTagName($uid, $fieldname)
return $result;
}

public static function getAjaxVariantFunction($row, $functablename, $theCode)
public static function getAjaxVariantFunction($row, $funcTablename, $theCode)
{
if (ExtensionManagementUtility::isLoaded('taxajax')) {
$result = 'doFetchRow(\'' . $functablename . '\',\'' . strtolower($theCode) . '\',' . $row['uid'] . ');';
$result = 'doFetchRow(\'' . $funcTablename . '\',\'' . strtolower($theCode) . '\',' . $row['uid'] . ');';
} else {
$result = '';
}
Expand Down
10 changes: 5 additions & 5 deletions control/class.tx_ttproducts_control_basketquantity.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public function getQuantityMarkerArray(// deprecated. used only for DAM
$basketObj = GeneralUtility::makeInstance('tx_ttproducts_basket');
$quantityArray = $basketObj->getQuantityArray($relatedIds, $rowArray);

foreach ($rowArray as $functablename => $functableRowArray) {
$viewObj = $tablesObj->get($functablename, true);
foreach ($rowArray as $funcTablename => $functableRowArray) {
$viewObj = $tablesObj->get($funcTablename, true);
$modelObj = $viewObj->getModelObj();
$marker = $viewObj->getMarker();

Expand All @@ -80,10 +80,10 @@ public function getQuantityMarkerArray(// deprecated. used only for DAM
if (
isset($quantityArray[$uid]) &&
is_array($quantityArray[$uid]) &&
isset($quantityArray[$uid][$functablename]) &&
is_array($quantityArray[$uid][$functablename])
isset($quantityArray[$uid][$funcTablename]) &&
is_array($quantityArray[$uid][$funcTablename])
) {
$count = strval($quantityArray[$uid][$functablename][$subuid]);
$count = strval($quantityArray[$uid][$funcTablename][$subuid]);
if (!isset($count)) {
$count = '';
}
Expand Down
54 changes: 27 additions & 27 deletions control/class.tx_ttproducts_control_memo.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ public static function bUseSession($conf)
return $result;
}

public static function process($functablename, $piVars, $conf): void
public static function process($funcTablename, $piVars, $conf): void
{
$bMemoChanged = false;
self::loadMemo($functablename, $conf);
self::loadMemo($funcTablename, $conf);

$memoItems = self::getMemoItems($functablename);
$memoItems = self::getMemoItems($funcTablename);
if (!is_array($memoItems)) {
$memoItems = [];
}
Expand Down Expand Up @@ -189,30 +189,30 @@ public static function process($functablename, $piVars, $conf): void
}

if ($bMemoChanged) {
self::saveMemo($functablename, $memoItems, $conf);
self::setMemoItems($functablename, $memoItems);
self::saveMemo($funcTablename, $memoItems, $conf);
self::setMemoItems($funcTablename, $memoItems);
}
}

public static function getMemoField($functablename, $bFeuser)
public static function getMemoField($funcTablename, $bFeuser)
{
if (isset(self::$memoTableFieldArray[$functablename])) {
$result = ($bFeuser ? 'tt_products_' : '') . self::$memoTableFieldArray[$functablename];
if (isset(self::$memoTableFieldArray[$funcTablename])) {
$result = ($bFeuser ? 'tt_products_' : '') . self::$memoTableFieldArray[$funcTablename];
} else {
$result = false;
}

return $result;
}

public static function getMemoItems($functablename)
public static function getMemoItems($funcTablename)
{
$result = self::$memoItemArray[$functablename];
$result = self::$memoItemArray[$funcTablename];

return $result;
}

public static function setMemoItems($functablename, $v): void
public static function setMemoItems($funcTablename, $v): void
{
if (!is_array($v)) {
if ($v == '') {
Expand All @@ -221,15 +221,15 @@ public static function setMemoItems($functablename, $v): void
$v = explode(',', $v);
}
}
self::$memoItemArray[$functablename] = $v;
self::$memoItemArray[$funcTablename] = $v;
}

public static function readSessionMemoItems($functablename)
public static function readSessionMemoItems($funcTablename)
{
$result = '';
$session = tx_ttproducts_control_session::readSessionData();
$tableArray = self::getMemoTableFieldArray();
$field = $tableArray[$functablename];
$field = $tableArray[$funcTablename];

if (
$field != '' &&
Expand All @@ -242,10 +242,10 @@ public static function readSessionMemoItems($functablename)
return $result;
}

public static function readFeUserMemoItems($functablename)
public static function readFeUserMemoItems($funcTablename)
{
$result = '';
$feuserField = self::getMemoField($functablename, true);
$feuserField = self::getMemoField($funcTablename, true);

if ($GLOBALS['TSFE']->fe_user->user[$feuserField]) {
$result = explode(',', $GLOBALS['TSFE']->fe_user->user[$feuserField]);
Expand All @@ -254,24 +254,24 @@ public static function readFeUserMemoItems($functablename)
return $result;
}

public static function loadMemo($functablename, $conf): void
public static function loadMemo($funcTablename, $conf): void
{
$memoItems = '';
// $bFeuser = self::bUseFeuser($conf);
// $theField = self::getMemoField($functablename, $bFeuser);
// $theField = self::getMemoField($funcTablename, $bFeuser);

if (self::bUseFeuser($conf)) {
$memoItems = self::readFeUserMemoItems($functablename);
$memoItems = self::readFeUserMemoItems($funcTablename);
} else {
$memoItems = self::readSessionMemoItems($functablename);
$memoItems = self::readSessionMemoItems($funcTablename);
}
self::setMemoItems($functablename, $memoItems);
self::setMemoItems($funcTablename, $memoItems);
}

public static function saveMemo($functablename, $memoItems, $conf): void
public static function saveMemo($funcTablename, $memoItems, $conf): void
{
$bFeuser = self::bUseFeuser($conf);
$feuserField = self::getMemoField($functablename, $bFeuser);
$feuserField = self::getMemoField($funcTablename, $bFeuser);

$fieldsArray = [];
$fieldsArray[$feuserField] = implode(',', $memoItems);
Expand All @@ -287,15 +287,15 @@ public static function saveMemo($functablename, $memoItems, $conf): void
public static function copySession2Feuser($params, $pObj, $conf): void
{
$tableArray = self::getMemoTableFieldArray();
foreach ($tableArray as $functablename => $type) {
$memoItems = self::readSessionMemoItems($functablename);
foreach ($tableArray as $funcTablename => $type) {
$memoItems = self::readSessionMemoItems($funcTablename);

if (!empty($memoItems) && is_array($memoItems)) {
$feuserMemoItems = self::readFeUserMemoItems($functablename);
$feuserMemoItems = self::readFeUserMemoItems($funcTablename);
if (isset($feuserMemoItems) && is_array($feuserMemoItems)) {
$memoItems = array_merge($feuserMemoItems, $memoItems);
}
self::saveMemo($functablename, $memoItems, $conf);
self::saveMemo($funcTablename, $memoItems, $conf);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions control/class.tx_ttproducts_control_product.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function getPresetVariantArray(
$useArticles
) {
$uid = $row['uid'];
$functablename = $itemTable->getFuncTablename();
$funcTablename = $itemTable->getFuncTablename();

$basketVar = tx_ttproducts_model_control::getBasketVar();
$presetVariantArray = [];
Expand All @@ -66,11 +66,11 @@ public static function getPresetVariantArray(
if (
isset($storedRecs) &&
is_array($storedRecs) &&
isset($storedRecs[$functablename]) &&
is_array($storedRecs[$functablename]) &&
isset($storedRecs[$functablename][$uid])
isset($storedRecs[$funcTablename]) &&
is_array($storedRecs[$funcTablename]) &&
isset($storedRecs[$funcTablename][$uid])
) {
$variantRow = $storedRecs[$functablename][$uid];
$variantRow = $storedRecs[$funcTablename][$uid];
$variant =
$itemTable->variant->getVariantFromProductRow(
$row,
Expand All @@ -96,10 +96,10 @@ public static function addAjax(
$tablesObj,
$languageObj,
$theCode,
$functablename
$funcTablename
): void {
if (ExtensionManagementUtility::isLoaded('taxajax')) {
$itemTable = $tablesObj->get($functablename, false);
$itemTable = $tablesObj->get($funcTablename, false);

$selectableVariantFieldArray = $itemTable->variant->getSelectableFieldArray();
$editFieldArray = $itemTable->editVariant->getFieldArray();
Expand All @@ -116,7 +116,7 @@ public static function addAjax(
$fieldArray = array_merge($fieldArray, $editFieldArray);
}

$param = [$functablename => $fieldArray];
$param = [$funcTablename => $fieldArray];
$bUseColorbox = false;
$tableConf = $itemTable->getTableConf($theCode);
if (
Expand Down
4 changes: 2 additions & 2 deletions control/class.tx_ttproducts_control_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ public function run($cObj, $pibaseClass, &$errorCode, $content = '')
);
break;
case 'KEYFIELD':
$functablename = ($this->config['foreign_table'] ?? $this->config['local_table']);
$tableConf = $cnf->getTableConf($functablename, $theCode);
$funcTablename = ($this->config['foreign_table'] ?? $this->config['local_table']);
$tableConf = $cnf->getTableConf($funcTablename, $theCode);

if (isset($tableConf['view.']) && is_array($tableConf['view.']) &&
isset($tableConf['view.']['valueArray.']) && is_array($tableConf['view.']['valueArray.'])
Expand Down
Loading

0 comments on commit 6e919cd

Please sign in to comment.