Skip to content

Commit

Permalink
* bugfix: The object of tx_ttproducts_basket has no basketExtra membe…
Browse files Browse the repository at this point in the history
…r variable. Use tx_ttproducts_control_basket::getBasketExtra() instead.
  • Loading branch information
franzholz committed Nov 4, 2019
1 parent 857bf55 commit c1eff3a
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 66 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

2019-11-04 Franz Holzinger <[email protected]>
* bugfix: The object of tx_ttproducts_basket has no basketExtra member variable. Use tx_ttproducts_control_basket::getBasketExtra() instead.

2019-10-28 Franz Holzinger <[email protected]>
* bugfix: Use the class tx_ttproducts_db to initialize the recs form data.
Expand Down
6 changes: 4 additions & 2 deletions control/class.tx_ttproducts_activity_finalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function doProcessing (
&$mainMarkerArray,
$functablename,
$orderUid,
$basketExtra,
&$errorMessage
) {
if ($this->conf['errorLog']) {
Expand Down Expand Up @@ -259,14 +260,15 @@ public function doProcessing (
$billdeliveryObj->generateBill(
$templateCode,
$mainMarkerArray,
$basketExtra,
$type,
$this->conf[$type . '.']
);
$fileArray[$type] = $absFilename;
}
}

$orderObj->setData($orderUid, $orderConfirmationHTML, 1);
$orderObj->setData($orderUid, $orderConfirmationHTML, 1, $basketExtra);
$creditpointsObj = GeneralUtility::makeInstance('tx_ttproducts_field_creditpoints');
$creditpointsObj->pay();

Expand Down Expand Up @@ -312,7 +314,7 @@ public function doProcessing (
);
$csvfilepath = PATH_site.$this->conf['CSVdestination'];
$csvorderuid = $basketObj->order['orderUid'];
$csv->create($functablename, $infoViewObj, $csvorderuid, $csvfilepath, $errorMessage);
$csv->create($functablename, $infoViewObj, $csvorderuid, $basketExtra, $csvfilepath, $errorMessage);
if (!$this->conf['CSVnotInEmail']) {
$addcsv = $csvfilepath;
}
Expand Down
31 changes: 18 additions & 13 deletions control/class.tx_ttproducts_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class tx_ttproducts_control implements \TYPO3\CMS\Core\SingletonInterface {
public $useArticles;


public function init ($pibaseClass, $conf, $config, $funcTablename, $useArticles) {
public function init ($pibaseClass, $conf, $config, $funcTablename, $useArticles, $basketExtra) {
$this->pibaseClass = $pibaseClass;
$this->pibase = GeneralUtility::makeInstance('' . $pibaseClass);
$this->cObj = $this->pibase->cObj;
Expand All @@ -69,11 +69,11 @@ public function init ($pibaseClass, $conf, $config, $funcTablename, $useArticles
$this->urlObj = GeneralUtility::makeInstance('tx_ttproducts_url_view'); // a copy of it
// This handleURL is called instead of the THANKS-url in order to let handleScript process the information if payment by credit card or so.
$this->urlArray = array();
if ($this->basket->basketExtra['payment.']['handleURL']) {
$this->urlArray['form_url_thanks'] = $this->basket->basketExtra['payment.']['handleURL'];
if ($basketExtra['payment.']['handleURL']) {
$this->urlArray['form_url_thanks'] = $basketExtra['payment.']['handleURL'];
}
if ($this->basket->basketExtra['payment.']['handleTarget']) { // Alternative target
$this->urlArray['form_url_target'] = $this->basket->basketExtra['payment.']['handleTarget'];
if ($basketExtra['payment.']['handleTarget']) { // Alternative target
$this->urlArray['form_url_target'] = $basketExtra['payment.']['handleTarget'];
}
$this->urlObj->setUrlArray($this->urlArray);
} // init
Expand Down Expand Up @@ -565,15 +565,19 @@ public function getContent (
$calculatedArray,
true,
$basket_tmpl,
$mainMarkerArray
$mainMarkerArray,
'',
array(),
array(),
$basketExtra
);
$content .= $paymentHTML;
}

if ($orderUid && $paymentHTML != '') {

$orderObj = $tablesObj->get('sys_products_orders');
$orderObj->setData($orderUid, $paymentHTML, 0);
$orderObj->setData($orderUid, $paymentHTML, 0, $basketExtra);
}
} else { // If not all required info-fields are filled in, this is shown instead:
$infoArray['billing']['error'] = 1;
Expand Down Expand Up @@ -787,7 +791,7 @@ public function processActivities (
tx_transactor_api::init($this->pibase, $this->cObj, $this->conf);
$referenceId = tx_transactor_api::getReferenceUid(
$handleLib,
$this->basket->basketExtra['payment.']['handleLib.'],
$basketExtra['payment.']['handleLib.'],
TT_PRODUCTS_EXT,
$orderUid
);
Expand All @@ -811,8 +815,8 @@ class_exists($callingClassName) &&
) {
$parameters = array(
$referenceId,
$this->basket->basketExtra['payment.']['handleLib'],
$this->basket->basketExtra['payment.']['handleLib.'],
$basketExtra['payment.']['handleLib'],
$basketExtra['payment.']['handleLib.'],
TT_PRODUCTS_EXT,
$calculatedArray,
$this->conf['paymentActivity'],
Expand All @@ -833,8 +837,8 @@ class_exists($callingClassName) &&
} else {
$paymentErrorMsg = tx_transactor_api::checkRequired(
$referenceId,
$this->basket->basketExtra['payment.']['handleLib'],
$this->basket->basketExtra['payment.']['handleLib.'],
$basketExtra['payment.']['handleLib'],
$basketExtra['payment.']['handleLib.'],
TT_PRODUCTS_EXT,
$calculatedArray,
$this->conf['paymentActivity'],
Expand Down Expand Up @@ -1003,7 +1007,7 @@ class_exists($callingClassName) &&
$checkAllowed = $infoViewObj->checkAllowed($basketExtra);
if ($checkRequired == '' && $checkAllowed == '') {
tx_div2007_alpha5::load_noLinkExtCobj_fh002($this->pibase); // TODO
$handleScript = $GLOBALS['TSFE']->tmpl->getFileName($this->basket->basketExtra['payment.']['handleScript']);
$handleScript = $GLOBALS['TSFE']->tmpl->getFileName($basketExtra['payment.']['handleScript']);
$orderUid = $this->getOrderUid();
$orderNumber = $this->getOrdernumber($orderUid);

Expand Down Expand Up @@ -1044,6 +1048,7 @@ class_exists($callingClassName) &&
$mainMarkerArray,
$this->funcTablename,
$orderUid,
$basketExtra,
$errorMessage
);

Expand Down
17 changes: 7 additions & 10 deletions control/class.tx_ttproducts_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@ public function init (&$content, &$conf, &$config, $pibaseClass, &$errorCode, $b
$this->ajax
);

// basket view
$this->control = GeneralUtility::makeInstance('tx_ttproducts_control');

$subpartmarkerObj = GeneralUtility::makeInstance('tx_ttproducts_subpartmarker');
$subpartmarkerObj->init($this->cObj);

Expand Down Expand Up @@ -442,7 +439,7 @@ public function &run ($pibaseClass, &$errorCode, $content = '', $bRunAjax = fals
$recs = tx_ttproducts_control_basket::getRecs();

$voucher->doProcessing($recs);
$basketObj->calculate(); // get the calculated arrays
$basketObj->calculate($basketExtra); // get the calculated arrays
$basketObj->calculateSums();
$basketObj->addVoucherSums();

Expand All @@ -457,20 +454,20 @@ public function &run ($pibaseClass, &$errorCode, $content = '', $bRunAjax = fals

$functablename = 'tt_products';
tx_ttproducts_control_memo::process($functablename, $pibaseObj->piVars, $this->conf);

$this->control->init(
$controlObj = GeneralUtility::makeInstance(tx_ttproducts_control::class);
$controlObj->init(
$pibaseClass,
$conf,
$cnf->getConfig(),
$basketObj->getFuncTablename(),
$this->conf['useArticles']
$this->conf['useArticles'],
$basketExtra
);
$calculatedArray = $basketObj->getCalculatedSums();

$content .= $this->control->doProcessing(
$content .= $controlObj->doProcessing(
$this->codeArray,
$calculatedArray,
$basketObj->basketExtra,
$basketExtra,
$errorCode,
$errorMessage
);
Expand Down
10 changes: 5 additions & 5 deletions eid/class.tx_ttproducts_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ public function init (&$conf, &$config, &$ajax, &$pObj) {
if (isset($ajax) && is_object($ajax)) {
$this->ajax = &$ajax;

$ajax->taxajax->registerFunction(array(TT_PRODUCTS_EXT.'_fetchRow',$this,'fetchRow'));
$ajax->taxajax->registerFunction(array(TT_PRODUCTS_EXT.'_commands',$this,'commands'));
$ajax->taxajax->registerFunction(array(TT_PRODUCTS_EXT . '_fetchRow',$this,'fetchRow'));
$ajax->taxajax->registerFunction(array(TT_PRODUCTS_EXT . '_commands',$this,'commands'));

$ajax->taxajax->registerFunction(array(TT_PRODUCTS_EXT . '_showArticle', $this, 'showArticle'));

}

if (
Expand Down Expand Up @@ -127,6 +126,7 @@ public function &fetchRow ($data) {
$cnf = GeneralUtility::makeInstance('tx_ttproducts_config');
$tablesObj = GeneralUtility::makeInstance('tx_ttproducts_tables');
$basketObj = GeneralUtility::makeInstance('tx_ttproducts_basket');
$basketExtra = tx_ttproducts_control_basket::getBasketExtra();

// price
$priceObj = GeneralUtility::makeInstance('tx_ttproducts_field_price');
Expand Down Expand Up @@ -197,7 +197,7 @@ public function &fetchRow ($data) {
$priceTaxArray = array();

$priceTaxArray = $priceObj->getPriceTaxArray(
$this->conf['discountPriceMode'], $basketObj->basketExtra, 'price', tx_ttproducts_control_basket::getRoundFormat(), tx_ttproducts_control_basket::getRoundFormat('discount'), $tmpRow, $totalDiscountField, $priceTaxArray);
$this->conf['discountPriceMode'], $basketExtra, 'price', tx_ttproducts_control_basket::getRoundFormat(), tx_ttproducts_control_basket::getRoundFormat('discount'), $tmpRow, $totalDiscountField, $priceTaxArray);

$csConvObj = $GLOBALS['TSFE']->csConvObj;
$field = 'price';
Expand Down Expand Up @@ -301,7 +301,7 @@ protected function &generateResponse ($view, &$rowArray, &$variantArray) {
$tmpArray,
$theCode,
'',
$basketObj->basketExtra,
$basketExtra,
$tmp=false,
true,
'',
Expand Down
4 changes: 2 additions & 2 deletions lib/class.tx_ttproducts_billdelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function writeFile ($filename, $content) {
}


public function generateBill ($templateCode, $mainMarkerArray, $type, $generationConf) {
public function generateBill ($templateCode, $mainMarkerArray, $basketExtra, $type, $generationConf) {

$basketView = GeneralUtility::makeInstance('tx_ttproducts_basket_view');
$basketObj = GeneralUtility::makeInstance('tx_ttproducts_basket');
Expand All @@ -126,7 +126,7 @@ public function generateBill ($templateCode, $mainMarkerArray, $type, $generatio
$basketObj->getItemArray(),
$basketObj->getCalculatedArray(),
$basketObj->order,
$basketObj->basketExtra,
$basketExtra,
$basketObj->recs,
$type,
$generationConf,
Expand Down
10 changes: 5 additions & 5 deletions lib/class.tx_ttproducts_csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function init ($pibase, &$itemArray, &$calculatedArray, $accountUid) {
} // init


function create ($functablename, &$address, $csvorderuid, &$csvfilepath, &$errorMessage) {
public function create ($functablename, &$address, $csvorderuid, $basketExtra, &$csvfilepath, &$errorMessage) {
$basket = GeneralUtility::makeInstance('tx_ttproducts_basket');
$priceViewObj = GeneralUtility::makeInstance('tx_ttproducts_field_price_view');
$tablesObj = GeneralUtility::makeInstance('tx_ttproducts_tables');
Expand All @@ -73,10 +73,10 @@ function create ($functablename, &$address, $csvorderuid, &$csvfilepath, &$error
$itemTable = $tablesObj->get($functablename, false);

$csvfilepath = trim($csvfilepath);
if ($csvfilepath{strlen($csvfilepath)-1} != '/') {
if ($csvfilepath{strlen($csvfilepath) - 1} != '/') {
$csvfilepath .= '/';
}
$csvfilepath .= $orderObj->getNumber($csvorderuid).'.csv';
$csvfilepath .= $orderObj->getNumber($csvorderuid) . '.csv';
$csvfile = fopen($csvfilepath, 'w');
if ($csvfile !== false) {
// Generate invoice and delivery address
Expand All @@ -96,7 +96,7 @@ function create ($functablename, &$address, $csvorderuid, &$csvfilepath, &$error
}

// Generate shipping/payment information and delivery note
$csvlineshipping = '"' . $basket->basketExtra['shipping.']['title'] . '";"' .
$csvlineshipping = '"' . $basketExtra['shipping.']['title'] . '";"' .
$priceViewObj->priceFormat($this->calculatedArray['priceTax']['shipping']) . '";"' .
$priceViewObj->priceFormat($this->calculatedArray['priceNoTax']['shipping']) . '"';

Expand All @@ -109,7 +109,7 @@ function create ($functablename, &$address, $csvorderuid, &$csvfilepath, &$error
}
}

$csvlinepayment = '"' . $basket->basketExtra['payment.']['title'] . '";"' .
$csvlinepayment = '"' . $basketExtra['payment.']['title'] . '";"' .
$priceViewObj->priceFormat($this->calculatedArray['priceTax']['payment']) . '";"' .
$priceViewObj->priceFormat($this->calculatedArray['priceNoTax']['payment']) . '"';

Expand Down
21 changes: 10 additions & 11 deletions lib/class.tx_ttproducts_paymentshipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@


class tx_ttproducts_paymentshipping implements \TYPO3\CMS\Core\SingletonInterface {
var $cObj;
var $conf;
var $config;
var $basketView;
var $priceObj; // price functions
public $cObj;
public $conf;
public $config;
public $basketView;
public $priceObj; // price functions
protected $typeArray = array('handling','shipping','payment');
protected $voucher;

Expand Down Expand Up @@ -162,8 +162,9 @@ public function getSubpartArrays (

$handleLib = $basketExtra['payment.']['handleLib'];

if (strpos($handleLib,'transactor') !== false && ExtensionManagementUtility::isLoaded($handleLib)) {

if (
strpos($handleLib,'transactor') !== false && ExtensionManagementUtility::isLoaded($handleLib)
) {
$languageObj = GeneralUtility::makeInstance(\JambageCom\TtProducts\Api\Localization::class);
// Payment Transactor
tx_transactor_api::init($languageObj, $this->cObj, $this->conf);
Expand Down Expand Up @@ -294,7 +295,6 @@ protected function getTypeMarkerArray ($theCode, &$markerArray, $pskey, $subkey,

if ($subkey != '') {
if (isset($basketExtra[$pskey . '.'][$subkey . '.']['image.'])) {
// $imageCode = $this->cObj->IMAGE($basketExtra[$pskey . '.'][$subkey . '.']['image.']);
$imageCode =
$imageObj->getImageCode(
$basketExtra[$pskey . '.'][$subkey . '.']['image.'],
Expand All @@ -304,7 +304,6 @@ protected function getTypeMarkerArray ($theCode, &$markerArray, $pskey, $subkey,
$markerArray['###' . $markerkey . '_TITLE###'] = $basketExtra[$pskey . '.'][$subkey . '.']['title'];
} else {
if (isset($basketExtra[$pskey . '.']['image.'])) {
// $imageCode = $this->cObj->IMAGE($basketExtra[$pskey . '.']['image.']);
$imageCode =
$imageObj->getImageCode(
$basketExtra[$pskey . '.']['image.'],
Expand Down Expand Up @@ -390,11 +389,11 @@ public function getModelMarkerArray ($theCode, $title, $value, $imageCode, $acti
}



/**
* Generates a radio or selector box for payment shipping
*/
public function generateRadioSelect ($theCode, $pskey, $subkey, $calculatedArray, $basketUrl, &$basketExtra) {

/*
The conf-array for the payment/shipping/handling configuration has numeric keys for the elements
But there are also these properties:
Expand Down Expand Up @@ -618,6 +617,7 @@ public function generateRadioSelect ($theCode, $pskey, $subkey, $calculatedArray
return $out;
} // generateRadioSelect


public function getConfiguredPrice (
$pskey,
$subkey,
Expand Down Expand Up @@ -1213,7 +1213,6 @@ public function useAccount ($basketExtra) {
}



public function getHandleLib ($request, $basketExtra) { // getGatewayRequestExt

$rc = false;
Expand Down
7 changes: 4 additions & 3 deletions model/class.tx_ttproducts_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class tx_ttproducts_account extends tx_ttproducts_table_base {
public function init ($cObj, $functablename) {
$basketObj = GeneralUtility::makeInstance('tx_ttproducts_basket');
$formerBasket = $basketObj->recs;
$bIsAllowed = $basketObj->basketExtra['payment.']['accounts'];
if (isset($basketObj->basketExtra['payment.']['useAsterisk'])) {
$this->useAsterisk = $basketObj->basketExtra['payment.']['useAsterisk'];
$basketExtra = tx_ttproducts_control_basket::getBasketExtra();
$bIsAllowed = $basketExtra['payment.']['accounts'];
if (isset($basketExtra['payment.']['useAsterisk'])) {
$this->useAsterisk = $basketExtra['payment.']['useAsterisk'];
}

parent::init($cObj, 'sys_products_accounts');
Expand Down
4 changes: 2 additions & 2 deletions model/class.tx_ttproducts_basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -943,14 +943,14 @@ public function create ($basketExtra, $useArticles, $funcTablename) {
}


public function calculate () {
public function calculate ($basketExtra) {
$cnfObj = GeneralUtility::makeInstance('tx_ttproducts_config');
$useArticles = $cnfObj->getUseArticles();

$calculObj = GeneralUtility::makeInstance('tx_ttproducts_basket_calculate');
$calculObj->calculate(
$this->basketExt,
$this->basketExtra,
$basketExtra,
$this->getFuncTablename(),
$useArticles,
$this->maxTax,
Expand Down
3 changes: 2 additions & 1 deletion model/class.tx_ttproducts_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function init ($cObj, $functablename) {

$basketObj = GeneralUtility::makeInstance('tx_ttproducts_basket');
$formerBasket = $basketObj->recs;
$allowedUids = $basketObj->basketExtra['payment.']['creditcards'];
$basketExtra = tx_ttproducts_control_basket::getBasketExtra();
$allowedUids = $basketExtra['payment.']['creditcards'];

parent::init($cObj, $functablename);

Expand Down
Loading

0 comments on commit c1eff3a

Please sign in to comment.