Skip to content

Commit

Permalink
Merge pull request #297 from franzholz/develop
Browse files Browse the repository at this point in the history
fix continue statements
  • Loading branch information
franzholz authored Sep 27, 2024
2 parents 1ccb36f + 97c3e36 commit f6795d5
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 35 deletions.
11 changes: 11 additions & 0 deletions Classes/Api/ControlApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,15 @@ public static function isOverwriteMode($infoArray)

return $overwriteMode;
}

public static function getTagId(
$jsTableNamesId,
$theCode,
$uid,
$field
) {
$result = $jsTableNamesId . '-' . strtolower($theCode) . '-' . $uid . '-' . $field;

return $result;
}
}
2 changes: 1 addition & 1 deletion Classes/Api/CreditpointsViewApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getItemMarkerSubpartArrays(
foreach ($actItemArray as $k1 => $actItem) {
$row = $actItem['rec'];
if (!$row) { // avoid bug with missing row
continue 2;
continue 1;
}
$pricecredits_total_totunits_no_tax = 0;
$pricecredits_total_totunits_tax = 0;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Api/EditVariantApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function getVariables(array $editVariantConfig, array $row)
) {
foreach ($config['setVariables.'] as $variable => $value) {
if (strpos($variable, '.') !== false) {
continue 2;
continue 1;
}
$isActive = true;
if (
Expand Down
4 changes: 2 additions & 2 deletions Classes/Api/PaymentShippingHandling.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static function getSubpartArrays(
if (
!MathUtility::canBeInterpretedAsInteger($k2int)
) {
continue 2;
continue 1;
}

if ($pskey == 'handling') {
Expand All @@ -240,7 +240,7 @@ public static function getSubpartArrays(
if (
!MathUtility::canBeInterpretedAsInteger($k3int)
) {
continue 2;
continue 1;
}
$bActive = isset($basketExtra[$pskey . '.'][$k3int]['0']) && ($k3int == $basketExtra[$pskey . '.'][$k3int]['0']);
self::helperSubpartArray(
Expand Down
13 changes: 8 additions & 5 deletions eid/class.tx_ttproducts_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ protected function generateResponse(
) ||
$field == 'additional'
) {
continue 2;
continue 1;
}
$fieldId = $field;
$bSkip = false;
Expand Down Expand Up @@ -592,15 +592,15 @@ protected function generateResponse(
if (!in_array($field, $variantArray)) {
if (($position = strpos($field, '_uid')) !== false) {
if (!$useFal) {
continue 2;
continue 1;
}
$fieldId = substr($field, 0, $position);
} else {
if (
in_array($field, ['image', 'smallimage']) &&
$useFal
) {
continue 2;
continue 1;
}
}

Expand Down Expand Up @@ -681,7 +681,11 @@ protected function generateResponse(
$mediaNum
);

$v = $imgCodeArray;
if (is_array($imgCodeArray)) {
$v = $imgCodeArray;
} else {
continue 2;
}
} else {
$v = '';
continue 2; // do not delete the current image
Expand Down Expand Up @@ -736,7 +740,6 @@ protected function generateResponse(
$fieldMarkerArray,
$markerArray
);

foreach ($newRow as $field => $v) {
$tagId = ControlApi::getTagId(
$jsTableNamesId,
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'title' => 'Shop System',
'description' => 'Advanced versions at ttproducts.de. Documented in the E-Book "Der TYPO3-Webshop" - Shop with listing in multiple languages, with order tracking, product variants, support for transactor extension, bill, creditpoint and voucher system.',
'state' => 'stable',
'version' => '2.15.14',
'version' => '2.15.15',
'manual' => true,
'author' => 'Franz Holzinger',
'author_company' => 'jambage.com',
Expand Down
2 changes: 1 addition & 1 deletion lib/class.tx_ttproducts_csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function create(
$pid = intval($row['pid']);
if (!tx_ttproducts_control_basket::getPidListObj()->getPageArray($pid)) {
// product belongs to another basket
continue 2;
continue 1;
}
// $variants = explode(';', $itemTable->variant->getVariantFromRow($row));
$csvdata = '"' . intval($row['uid']) . '";"' .
Expand Down
8 changes: 4 additions & 4 deletions lib/class.tx_ttproducts_discountprice.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getCalculatedData(
$additive = $v2;
break;
}
continue 2;
continue 1;
}
}
if (isset($priceCalcTemp['prod.']) && is_array($priceCalcTemp['prod.'])) {
Expand Down Expand Up @@ -183,7 +183,7 @@ public function getCalculatedData(

if (is_array($priceCalcTemp['sql.'])) {
if (!($bIsValid = tx_ttproducts_sql::isValid($row, $priceCalcTemp['sql.']['where']))) {
continue 2;
continue 1;
}
}

Expand Down Expand Up @@ -320,7 +320,7 @@ public function getCalculatedData(
) {
$rangeArray = GeneralUtility::trimExplode(',', $rangeConf['range']);
if (count($rangeArray) != count($fieldArray)) {
continue 3;
continue 1;
}

$k3number = substr($k3, 0, -1);
Expand Down Expand Up @@ -456,7 +456,7 @@ public function getCalculatedData(
if (is_array($countedItems[$k1])) {
foreach ($countedItems[$k1] as $k3 => $v3) {
if ($v3['active'] == false) {
continue 2;
continue 1;
}

foreach ($itemArray[$v3['sort']] as $k1 => $actItem) {
Expand Down
4 changes: 2 additions & 2 deletions lib/class.tx_ttproducts_pricecalc.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public function getCalculatedData(

if (is_array($priceCalcTemp['sql.'])) {
if (!($bIsValid = $sql->isValid($row, $priceCalcTemp['sql.']['where']))) {
continue 2;
continue 1;
}
}

// has a price reduction already been calculated before ?
if ($priceReduction[$row['uid']] == 1) {
continue 2;
continue 1;
}

// count all items which will apply to the discount price
Expand Down
2 changes: 1 addition & 1 deletion model/class.tx_ttproducts_basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ public function create(
if ($conf['whereGiftService']) {
$bAddGiftService = true;
}
continue 2;
continue 1;
}

$currRow =
Expand Down
6 changes: 3 additions & 3 deletions model/class.tx_ttproducts_fpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function ImprovedTable($header, array $data): void

if ($k2 == 0 && trim($v2) == '' && $rowCount == 4 && $oldRowCount == 1 && $columnNo == 2) {
// skip first column which has been filled in from former row
continue 2;
continue 1;
}
$l2 = intval($this->GetStringWidth($v2));
unset($value);
Expand Down Expand Up @@ -198,11 +198,11 @@ public function ImprovedTable($header, array $data): void
$columnNo++;

if ($columnNo <= 4) {
continue 2;
continue 1;
}
$this->Ln();
} else {
continue 2;
continue 1;
}

if (isset($additonalRow) && is_array($additonalRow)) {
Expand Down
2 changes: 1 addition & 1 deletion model/class.tx_ttproducts_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ public function createMM(

if (!tx_ttproducts_control_basket::getPidListObj()->getPageArray($pid)) {
// product belongs to another basket
continue 2;
continue 1;
}

$variantArray = [];
Expand Down
6 changes: 3 additions & 3 deletions model/class.tx_ttproducts_pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function ImprovedTable($header, array $data): void

if ($k2 == 0 && trim($v2) == '' && $rowCount == 4 && $oldRowCount == 1 && $columnNo == 2) {
// skip first column which has been filled in from former row
continue 2;
continue 1;
}
$l2 = intval($this->GetStringWidth($v2));
unset($value);
Expand Down Expand Up @@ -200,11 +200,11 @@ public function ImprovedTable($header, array $data): void
$columnNo++;

if ($columnNo <= 4) {
continue 2;
continue 1;
}
$this->Ln();
} else {
continue 2;
continue 1;
}

if (isset($additonalRow) && is_array($additonalRow)) {
Expand Down
6 changes: 5 additions & 1 deletion model/class.tx_ttproducts_product.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public function fillVariantsFromArticles(

foreach ($selectableFieldArray as $field) {
if (
isset($row[$field]) &&
$row[$field] == '' &&
!empty($variantRow[$field])
) {
Expand Down Expand Up @@ -215,7 +216,10 @@ public function getMatchingArticleRows(
foreach ($fieldArray as $field => $valueArray) {
$valueArray = array_map('trim', $valueArray);
$rowFieldArray = [];
if (isset($row[$field]) && strlen($row[$field])) {
if (
isset($row[$field]) &&
strlen($row[$field])
) {
$rowFieldArray =
preg_split(
'/[\h]*' . $variantSeparator . '[\h]*/',
Expand Down
2 changes: 1 addition & 1 deletion view/class.tx_ttproducts_basketitem_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public function getItemMarkerArray(
$imageImport['sql.']['where']
);
if (!$bIsValid) {
continue 2;
continue 1;
}
}
$imageFile = $imageImport['prod.'][$k2];
Expand Down
2 changes: 1 addition & 1 deletion view/class.tx_ttproducts_product_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function getModelMarkerArray(
}
}
if (strpos($index, $markerKey) === false) {
continue 3;
continue 1;
}
$fieldPos = strrpos($index, '_');
$fieldName = substr($index, $fieldPos + 1);
Expand Down
12 changes: 6 additions & 6 deletions view/class.tx_ttproducts_table_base_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,14 @@ public function getId($row, $midId, $theCode)

// This can also add additional fields to the row.
public function modifyFieldObject(
&$theMarkerArray,
array $origRow,
array $row,
array $tableconf,
$markerPrefix,
$suffix,
array $fieldMarkerArray,
array $markerArray,
&$theMarkerArray
array $markerArray
) {
$templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
$local_cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
Expand Down Expand Up @@ -533,15 +533,15 @@ public function modifyFieldObject(
$hookObj = GeneralUtility::makeInstance($classRef);
if (method_exists($hookObj, 'modifyFieldObject')) {
$hookObj->modifyFieldObject(
$thts,
$theMarkerArray,
$this,
$origRow,
$row,
$tableconf,
$markerPrefix,
$suffix,
$fieldMarkerArray,
$markerArray,
$theMarkerArray,
$newRow
);
}
Expand Down Expand Up @@ -720,14 +720,14 @@ public function getRowMarkerArray(
}
if (!$bSkip) {
$this->modifyFieldObject(
$theMarkerArray,
$row,
$modifiedRow,
$tableconf,
$markerPrefix,
$suffix,
$fieldMarkerArray,
$markerArray,
$theMarkerArray
$markerArray
);
}
}
Expand Down
5 changes: 4 additions & 1 deletion view/field/class.tx_ttproducts_field_media_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ public function getCodeMarkerArray(
if (is_array($tableConf) && isset($tableConf['imageMarker.'])) {
$imageMarkerArray = $tableConf['imageMarker.'];
}
$imageConfStart = $this->conf[$imageRenderObj . '.'];
$imageConfStart = $this->conf[$imageRenderObj . '.'] ?? null;
if (!isset($imageConfStart)) {
return false;
}
$contentObject = $this->conf[$imageRenderObj] ?? '';
if ($contentObject == '') {
$contentObject = 'IMAGE';
Expand Down

0 comments on commit f6795d5

Please sign in to comment.