Skip to content

Commit 7501cb0

Browse files
committed
Merge remote-tracking branch 'mpi/MC-22931' into Chaika-PR-2019-11-25
2 parents c4a8d4a + 1cf65ed commit 7501cb0

File tree

1 file changed

+80
-6
lines changed

1 file changed

+80
-6
lines changed

app/code/Magento/Tax/Model/Config.php

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
use Magento\Store\Model\Store;
1515

1616
/**
17+
* Class to set flags for tax display setting
18+
*
1719
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
1820
*/
1921
class Config
2022
{
21-
// tax notifications
23+
/**
24+
* Tax notifications
25+
*/
2226
const XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT = 'tax/notification/ignore_discount';
2327

2428
const XML_PATH_TAX_NOTIFICATION_IGNORE_PRICE_DISPLAY = 'tax/notification/ignore_price_display';
@@ -70,7 +74,11 @@ class Config
7074

7175
const XML_PATH_DISPLAY_CART_SHIPPING = 'tax/cart_display/shipping';
7276

73-
/** @deprecated */
77+
/**
78+
* Tax cart display discount
79+
*
80+
* @deprecated
81+
*/
7482
const XML_PATH_DISPLAY_CART_DISCOUNT = 'tax/cart_display/discount';
7583

7684
const XML_PATH_DISPLAY_CART_GRANDTOTAL = 'tax/cart_display/grandtotal';
@@ -88,7 +96,11 @@ class Config
8896

8997
const XML_PATH_DISPLAY_SALES_SHIPPING = 'tax/sales_display/shipping';
9098

91-
/** @deprecated */
99+
/**
100+
* Tax sales display discount
101+
*
102+
* @deprecated
103+
*/
92104
const XML_PATH_DISPLAY_SALES_DISCOUNT = 'tax/sales_display/discount';
93105

94106
const XML_PATH_DISPLAY_SALES_GRANDTOTAL = 'tax/sales_display/grandtotal';
@@ -231,6 +243,7 @@ public function discountTax($store = null)
231243

232244
/**
233245
* Get taxes/discounts calculation sequence.
246+
*
234247
* This sequence depends on "Apply Customer Tax" and "Apply Discount On Prices" configuration options.
235248
*
236249
* @param null|int|string|Store $store
@@ -353,6 +366,8 @@ public function setShippingPriceIncludeTax($flag)
353366
}
354367

355368
/**
369+
* Return the flag for display sales for cart prices including tax
370+
*
356371
* @param null|string|bool|int|Store $store
357372
* @return bool
358373
*/
@@ -366,6 +381,8 @@ public function displayCartPricesInclTax($store = null)
366381
}
367382

368383
/**
384+
* Return the flag for display sales for cart prices excluding tax
385+
*
369386
* @param null|string|bool|int|Store $store
370387
* @return bool
371388
*/
@@ -379,6 +396,8 @@ public function displayCartPricesExclTax($store = null)
379396
}
380397

381398
/**
399+
* Return the flag for display sales for cart prices both including and excluding tax
400+
*
382401
* @param null|string|bool|int|Store $store
383402
* @return bool
384403
*/
@@ -392,6 +411,8 @@ public function displayCartPricesBoth($store = null)
392411
}
393412

394413
/**
414+
* Return the flag for display sales for cart subtotal including tax
415+
*
395416
* @param null|string|bool|int|Store $store
396417
* @return bool
397418
*/
@@ -405,6 +426,8 @@ public function displayCartSubtotalInclTax($store = null)
405426
}
406427

407428
/**
429+
* Return the flag for display sales for cart subtotal excluding tax
430+
*
408431
* @param null|string|bool|int|Store $store
409432
* @return bool
410433
*/
@@ -418,6 +441,8 @@ public function displayCartSubtotalExclTax($store = null)
418441
}
419442

420443
/**
444+
* Return the flag for display sales for cart subtotal both including and excluding tax
445+
*
421446
* @param null|string|bool|int|Store $store
422447
* @return bool
423448
*/
@@ -431,6 +456,8 @@ public function displayCartSubtotalBoth($store = null)
431456
}
432457

433458
/**
459+
* Return the flag for display sales for cart shipping including tax
460+
*
434461
* @param null|string|bool|int|Store $store
435462
* @return bool
436463
*/
@@ -444,6 +471,8 @@ public function displayCartShippingInclTax($store = null)
444471
}
445472

446473
/**
474+
* Return the flag for display sales for cart shipping excluding tax
475+
*
447476
* @param null|string|bool|int|Store $store
448477
* @return bool
449478
*/
@@ -457,6 +486,8 @@ public function displayCartShippingExclTax($store = null)
457486
}
458487

459488
/**
489+
* Return the flag for display sales for shipping both including and excluding tax
490+
*
460491
* @param null|string|bool|int|Store $store
461492
* @return bool
462493
*/
@@ -470,6 +501,8 @@ public function displayCartShippingBoth($store = null)
470501
}
471502

472503
/**
504+
* Return the flag for display cart discount for including tax
505+
*
473506
* @param null|string|bool|int|Store $store
474507
* @return bool
475508
* @deprecated 100.1.3
@@ -484,6 +517,8 @@ public function displayCartDiscountInclTax($store = null)
484517
}
485518

486519
/**
520+
* Return the flag for display cart discount for excluding tax
521+
*
487522
* @param null|string|bool|int|Store $store
488523
* @return bool
489524
* @deprecated 100.1.3
@@ -498,6 +533,8 @@ public function displayCartDiscountExclTax($store = null)
498533
}
499534

500535
/**
536+
* Return the flag for display cart discount for both including and excluding tax
537+
*
501538
* @param null|string|bool|int|Store $store
502539
* @return bool
503540
* @deprecated 100.1.3
@@ -512,6 +549,8 @@ public function displayCartDiscountBoth($store = null)
512549
}
513550

514551
/**
552+
* Return the flag for display cart tax with grand total for both including and excluding tax
553+
*
515554
* @param null|string|bool|int|Store $store
516555
* @return bool
517556
*/
@@ -525,6 +564,8 @@ public function displayCartTaxWithGrandTotal($store = null)
525564
}
526565

527566
/**
567+
* Return the flag for display cart full summary
568+
*
528569
* @param null|string|bool|int|Store $store
529570
* @return bool
530571
*/
@@ -538,6 +579,8 @@ public function displayCartFullSummary($store = null)
538579
}
539580

540581
/**
582+
* Return the flag for display cart zero tax
583+
*
541584
* @param null|string|bool|int|Store $store
542585
* @return bool
543586
*/
@@ -551,6 +594,8 @@ public function displayCartZeroTax($store = null)
551594
}
552595

553596
/**
597+
* Return the flag for display sales prices for including tax
598+
*
554599
* @param null|string|bool|int|Store $store
555600
* @return bool
556601
*/
@@ -564,6 +609,8 @@ public function displaySalesPricesInclTax($store = null)
564609
}
565610

566611
/**
612+
* Return the flag for display sales prices for excluding tax
613+
*
567614
* @param null|string|bool|int|Store $store
568615
* @return bool
569616
*/
@@ -577,6 +624,8 @@ public function displaySalesPricesExclTax($store = null)
577624
}
578625

579626
/**
627+
* Return the flag for display sales prices for both including and excluding tax
628+
*
580629
* @param null|string|bool|int|Store $store
581630
* @return bool
582631
*/
@@ -590,6 +639,8 @@ public function displaySalesPricesBoth($store = null)
590639
}
591640

592641
/**
642+
* Return the flag for display sales subtotal for including tax
643+
*
593644
* @param null|string|bool|int|Store $store
594645
* @return bool
595646
*/
@@ -603,6 +654,8 @@ public function displaySalesSubtotalInclTax($store = null)
603654
}
604655

605656
/**
657+
* Return the flag for display sales subtotal for excluding tax
658+
*
606659
* @param null|string|bool|int|Store $store
607660
* @return bool
608661
*/
@@ -616,6 +669,8 @@ public function displaySalesSubtotalExclTax($store = null)
616669
}
617670

618671
/**
672+
* Return the flag for display sales subtotal for both including and excluding tax
673+
*
619674
* @param null|string|bool|int|Store $store
620675
* @return bool
621676
*/
@@ -629,6 +684,8 @@ public function displaySalesSubtotalBoth($store = null)
629684
}
630685

631686
/**
687+
* Return the flag for display sales for shipping including tax
688+
*
632689
* @param null|string|bool|int|Store $store
633690
* @return bool
634691
*/
@@ -642,6 +699,8 @@ public function displaySalesShippingInclTax($store = null)
642699
}
643700

644701
/**
702+
* Return the flag for display sales for shipping excluding tax
703+
*
645704
* @param null|string|bool|int|Store $store
646705
* @return bool
647706
*/
@@ -655,6 +714,8 @@ public function displaySalesShippingExclTax($store = null)
655714
}
656715

657716
/**
717+
* Return the flag for display sales for shipping both including and excluding tax
718+
*
658719
* @param null|string|bool|int|Store $store
659720
* @return bool
660721
*/
@@ -668,6 +729,8 @@ public function displaySalesShippingBoth($store = null)
668729
}
669730

670731
/**
732+
* Return the flag for display sales discount for including tax
733+
*
671734
* @param null|string|bool|int|Store $store
672735
* @return bool
673736
* @deprecated 100.1.3
@@ -682,6 +745,8 @@ public function displaySalesDiscountInclTax($store = null)
682745
}
683746

684747
/**
748+
* Return the flag for display sales discount for excluding tax
749+
*
685750
* @param null|string|bool|int|Store $store
686751
* @return bool
687752
* @deprecated 100.1.3
@@ -696,6 +761,8 @@ public function displaySalesDiscountExclTax($store = null)
696761
}
697762

698763
/**
764+
* Return the flag for display sales discount for both including and excluding tax
765+
*
699766
* @param null|string|bool|int|Store $store
700767
* @return bool
701768
* @deprecated 100.1.3
@@ -710,6 +777,8 @@ public function displaySalesDiscountBoth($store = null)
710777
}
711778

712779
/**
780+
* Return the flag for display sales tax with grand total
781+
*
713782
* @param null|string|bool|int|Store $store
714783
* @return bool
715784
*/
@@ -723,6 +792,8 @@ public function displaySalesTaxWithGrandTotal($store = null)
723792
}
724793

725794
/**
795+
* Return the flag for display sales full summary
796+
*
726797
* @param null|string|bool|int|Store $store
727798
* @return bool
728799
*/
@@ -736,6 +807,8 @@ public function displaySalesFullSummary($store = null)
736807
}
737808

738809
/**
810+
* Return the flag for display sales zero tax
811+
*
739812
* @param null|string|bool|int|Store $store
740813
* @return bool
741814
*/
@@ -829,23 +902,24 @@ public function getInfoUrl($store = null)
829902

830903
/**
831904
* Check if necessary do product price conversion
905+
*
832906
* If it necessary will be returned conversion type (minus or plus)
833907
*
834908
* @param null|int|string|Store $store
835-
* @return bool|int
909+
* @return bool
836910
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
837911
*/
838912
public function needPriceConversion($store = null)
839913
{
840-
$res = 0;
914+
$res = false;
841915
$priceIncludesTax = $this->priceIncludesTax($store) || $this->getNeedUseShippingExcludeTax();
842916
if ($priceIncludesTax) {
843917
switch ($this->getPriceDisplayType($store)) {
844918
case self::DISPLAY_TYPE_EXCLUDING_TAX:
845919
case self::DISPLAY_TYPE_BOTH:
846920
return self::PRICE_CONVERSION_MINUS;
847921
case self::DISPLAY_TYPE_INCLUDING_TAX:
848-
$res = false;
922+
$res = $this->displayCartPricesInclTax($store);
849923
break;
850924
default:
851925
break;

0 commit comments

Comments
 (0)