Version Notes
Extended validation possibilities!
Download this release
Release Info
Developer | Rouven Alexander Rieker |
Extension | InvoicePayment |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
- app/code/community/Itabs/Invoice/Block/Form.php +2 -2
- app/code/community/Itabs/Invoice/Block/Info.php +2 -2
- app/code/community/Itabs/Invoice/Helper/Data.php +2 -2
- app/code/community/Itabs/Invoice/Model/Invoice.php +2 -2
- app/code/community/Itabs/Invoice/Model/Observer.php +2 -2
- app/code/community/Itabs/Invoice/Model/System/Config/Source/Customer/Group.php +2 -2
- app/code/community/Itabs/Invoice/Model/System/Config/Source/Sales/Invoice/State.php +2 -2
- app/code/community/Itabs/Invoice/Model/Validation.php +122 -4
- app/code/community/Itabs/Invoice/etc/config.xml +4 -2
- app/code/community/Itabs/Invoice/etc/system.xml +33 -1
- app/design/adminhtml/default/default/template/invoice/form.phtml +1 -1
- app/design/adminhtml/default/default/template/invoice/info.phtml +1 -1
- app/design/adminhtml/default/default/template/invoice/pdf.phtml +1 -1
- app/design/frontend/base/default/template/invoice/form.phtml +1 -1
- app/design/frontend/base/default/template/invoice/info.phtml +1 -1
- app/etc/modules/Itabs_Invoice.xml +1 -1
- app/locale/de_DE/Itabs_Invoice.csv +6 -0
- package.xml +5 -5
app/code/community/Itabs/Invoice/Block/Form.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Block_Form extends Mage_Payment_Block_Form
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Block_Form extends Mage_Payment_Block_Form
|
app/code/community/Itabs/Invoice/Block/Info.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Block_Info extends Mage_Payment_Block_Info
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Block_Info extends Mage_Payment_Block_Info
|
app/code/community/Itabs/Invoice/Helper/Data.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Helper_Data extends Mage_Core_Helper_Abstract
|
app/code/community/Itabs/Invoice/Model/Invoice.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_Invoice extends Mage_Payment_Model_Method_Abstract
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_Invoice extends Mage_Payment_Model_Method_Abstract
|
app/code/community/Itabs/Invoice/Model/Observer.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_Observer
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_Observer
|
app/code/community/Itabs/Invoice/Model/System/Config/Source/Customer/Group.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_System_Config_Source_Customer_Group
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_System_Config_Source_Customer_Group
|
app/code/community/Itabs/Invoice/Model/System/Config/Source/Sales/Invoice/State.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_System_Config_Source_Sales_Invoice_State
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_System_Config_Source_Sales_Invoice_State
|
app/code/community/Itabs/Invoice/Model/Validation.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
-
* @version 1.
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
@@ -20,7 +20,7 @@
|
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
-
* @version 1.
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_Validation
|
@@ -36,15 +36,26 @@ class Itabs_Invoice_Model_Validation
|
|
36 |
protected $_customerOrdersEmail = null;
|
37 |
|
38 |
/**
|
|
|
|
|
39 |
* @return bool
|
40 |
*/
|
41 |
public function isValid()
|
42 |
{
|
43 |
-
|
44 |
&& $this->hasMinimumOrderCount()
|
45 |
&& $this->hasMinimumOrderAmount()
|
46 |
&& $this->hasOpenInvoices()
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
@@ -139,6 +150,7 @@ class Itabs_Invoice_Model_Validation
|
|
139 |
$hasOpenInvoices = false;
|
140 |
foreach ($orders as $order) {
|
141 |
/* @var $order Mage_Sales_Model_Order */
|
|
|
142 |
/* @var $invoices Mage_Sales_Model_Resource_Order_Invoice_Collection */
|
143 |
$invoices = $order->getInvoiceCollection();
|
144 |
if ($invoices->count() > 0) {
|
@@ -159,6 +171,73 @@ class Itabs_Invoice_Model_Validation
|
|
159 |
return true;
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
/**
|
163 |
* Retrieve the current session
|
164 |
*
|
@@ -177,6 +256,24 @@ class Itabs_Invoice_Model_Validation
|
|
177 |
return $session;
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
/**
|
181 |
* Retrieve the current customer
|
182 |
*
|
@@ -253,4 +350,25 @@ class Itabs_Invoice_Model_Validation
|
|
253 |
|
254 |
return $this->_customerOrders;
|
255 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
}
|
9 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
10 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
11 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
* @version 1.2.0
|
13 |
* @link https://github.com/itabs/Itabs_Invoice
|
14 |
*/
|
15 |
/**
|
20 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
21 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
+
* @version 1.2.0
|
24 |
* @link https://github.com/itabs/Itabs_Invoice
|
25 |
*/
|
26 |
class Itabs_Invoice_Model_Validation
|
36 |
protected $_customerOrdersEmail = null;
|
37 |
|
38 |
/**
|
39 |
+
* Check if the invoice payment is allowed
|
40 |
+
*
|
41 |
* @return bool
|
42 |
*/
|
43 |
public function isValid()
|
44 |
{
|
45 |
+
$isValid = $this->hasSpecificCustomerGroup()
|
46 |
&& $this->hasMinimumOrderCount()
|
47 |
&& $this->hasMinimumOrderAmount()
|
48 |
&& $this->hasOpenInvoices()
|
49 |
+
&& $this->isBillingShippingAddressDifferent()
|
50 |
+
&& $this->isPrefixNotAllowed()
|
51 |
+
;
|
52 |
+
|
53 |
+
$checkResult = new StdClass;
|
54 |
+
$checkResult->isValid = $isValid;
|
55 |
+
|
56 |
+
Mage::dispatchEvent('itabs_invoice_validation_result', array('result' => $checkResult));
|
57 |
+
|
58 |
+
return $checkResult->isValid;
|
59 |
}
|
60 |
|
61 |
/**
|
150 |
$hasOpenInvoices = false;
|
151 |
foreach ($orders as $order) {
|
152 |
/* @var $order Mage_Sales_Model_Order */
|
153 |
+
|
154 |
/* @var $invoices Mage_Sales_Model_Resource_Order_Invoice_Collection */
|
155 |
$invoices = $order->getInvoiceCollection();
|
156 |
if ($invoices->count() > 0) {
|
171 |
return true;
|
172 |
}
|
173 |
|
174 |
+
/**
|
175 |
+
* Check if the billing address of a customer is different from the shipping address
|
176 |
+
*
|
177 |
+
* @return bool
|
178 |
+
*/
|
179 |
+
public function isBillingShippingAddressDifferent()
|
180 |
+
{
|
181 |
+
// Check if validation is active
|
182 |
+
if (!Mage::getStoreConfigFlag('payment/invoice/check_addresses')) {
|
183 |
+
return true;
|
184 |
+
}
|
185 |
+
|
186 |
+
// Check if there is a quote
|
187 |
+
$quote = $this->_getQuote();
|
188 |
+
if (!$quote || !$quote->getId() || !$quote->getBillingAddress()) {
|
189 |
+
return true;
|
190 |
+
}
|
191 |
+
|
192 |
+
// Serialize the address data and compare if they are different
|
193 |
+
$billingAddress = $this->_serializeQuoteAddress($quote->getBillingAddress());
|
194 |
+
$shippingAddress = $this->_serializeQuoteAddress($quote->getShippingAddress());
|
195 |
+
if ($billingAddress != $shippingAddress) {
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Check if the prefix of the billing or shipping address is not allowed
|
204 |
+
*
|
205 |
+
* @return bool
|
206 |
+
*/
|
207 |
+
public function isPrefixNotAllowed()
|
208 |
+
{
|
209 |
+
// Check if validation is active
|
210 |
+
if (!Mage::getStoreConfigFlag('payment/invoice/check_prefix')) {
|
211 |
+
return true;
|
212 |
+
}
|
213 |
+
|
214 |
+
// Check if there are disabled prefix options
|
215 |
+
$disabledPrefixes = explode(';', Mage::getStoreConfig('payment/invoice/disabled_prefix'));
|
216 |
+
if (count($disabledPrefixes) == 0) {
|
217 |
+
return true;
|
218 |
+
}
|
219 |
+
|
220 |
+
// Check if there is a quote
|
221 |
+
$quote = $this->_getQuote();
|
222 |
+
if (!$quote || !$quote->getId() || !$quote->getBillingAddress()) {
|
223 |
+
return true;
|
224 |
+
}
|
225 |
+
|
226 |
+
// Check if billing address prefix is disabled
|
227 |
+
$billingAddress = $quote->getBillingAddress();
|
228 |
+
if ($billingAddress && in_array($billingAddress->getPrefix(), $disabledPrefixes)) {
|
229 |
+
return false;
|
230 |
+
}
|
231 |
+
|
232 |
+
// Check if shipping address prefix is disabled
|
233 |
+
$shippingAddress = $quote->getShippingAddress();
|
234 |
+
if ($shippingAddress && in_array($shippingAddress->getPrefix(), $disabledPrefixes)) {
|
235 |
+
return false;
|
236 |
+
}
|
237 |
+
|
238 |
+
return true;
|
239 |
+
}
|
240 |
+
|
241 |
/**
|
242 |
* Retrieve the current session
|
243 |
*
|
256 |
return $session;
|
257 |
}
|
258 |
|
259 |
+
/**
|
260 |
+
* Retrieve the quote object
|
261 |
+
*
|
262 |
+
* @return Mage_Sales_Model_Quote
|
263 |
+
*/
|
264 |
+
protected function _getQuote()
|
265 |
+
{
|
266 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
267 |
+
/* @var $quote Mage_Adminhtml_Model_Session_Quote */
|
268 |
+
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
|
269 |
+
} else {
|
270 |
+
/* @var $quote Mage_Customer_Model_Session */
|
271 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
272 |
+
}
|
273 |
+
|
274 |
+
return $quote;
|
275 |
+
}
|
276 |
+
|
277 |
/**
|
278 |
* Retrieve the current customer
|
279 |
*
|
350 |
|
351 |
return $this->_customerOrders;
|
352 |
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Serialize the given address data for comparison
|
356 |
+
*
|
357 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
358 |
+
* @return string
|
359 |
+
*/
|
360 |
+
protected function _serializeQuoteAddress(Mage_Sales_Model_Quote_Address $address)
|
361 |
+
{
|
362 |
+
return serialize(array(
|
363 |
+
'company' => $address->getCompany(),
|
364 |
+
'prefix' => $address->getPrefix(),
|
365 |
+
'firstname' => $address->getFirstname(),
|
366 |
+
'lastname' => $address->getLastname(),
|
367 |
+
'street' => $address->getStreet(),
|
368 |
+
'postcode' => $address->getPostcode(),
|
369 |
+
'city' => $address->getCity(),
|
370 |
+
'country' => $address->getCountryId()
|
371 |
+
));
|
372 |
+
}
|
373 |
+
|
374 |
}
|
app/code/community/Itabs/Invoice/etc/config.xml
CHANGED
@@ -8,14 +8,14 @@
|
|
8 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
9 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
-
* @version 1.
|
12 |
* @link https://github.com/itabs/Itabs_Invoice
|
13 |
*/
|
14 |
-->
|
15 |
<config>
|
16 |
<modules>
|
17 |
<Itabs_Invoice>
|
18 |
-
<version>1.
|
19 |
</Itabs_Invoice>
|
20 |
</modules>
|
21 |
<global>
|
@@ -82,6 +82,8 @@
|
|
82 |
<customer_order_count>0</customer_order_count>
|
83 |
<customer_order_amount>0</customer_order_amount>
|
84 |
<check_open_invoices>0</check_open_invoices>
|
|
|
|
|
85 |
<create_invoice>0</create_invoice>
|
86 |
<invoice_state>1</invoice_state>
|
87 |
<send_invoice_email>1</send_invoice_email>
|
8 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
9 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
+
* @version 1.2.0
|
12 |
* @link https://github.com/itabs/Itabs_Invoice
|
13 |
*/
|
14 |
-->
|
15 |
<config>
|
16 |
<modules>
|
17 |
<Itabs_Invoice>
|
18 |
+
<version>1.2.0</version>
|
19 |
</Itabs_Invoice>
|
20 |
</modules>
|
21 |
<global>
|
82 |
<customer_order_count>0</customer_order_count>
|
83 |
<customer_order_amount>0</customer_order_amount>
|
84 |
<check_open_invoices>0</check_open_invoices>
|
85 |
+
<check_addresses>0</check_addresses>
|
86 |
+
<check_prefix>0</check_prefix>
|
87 |
<create_invoice>0</create_invoice>
|
88 |
<invoice_state>1</invoice_state>
|
89 |
<send_invoice_email>1</send_invoice_email>
|
app/code/community/Itabs/Invoice/etc/system.xml
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
9 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
-
* @version 1.
|
12 |
* @link https://github.com/itabs/Itabs_Invoice
|
13 |
*/
|
14 |
-->
|
@@ -169,6 +169,38 @@
|
|
169 |
<show_in_website>1</show_in_website>
|
170 |
<show_in_store>1</show_in_store>
|
171 |
</check_open_invoices>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
<create_invoice translate="label comment">
|
173 |
<label>Automatically Create Invoice</label>
|
174 |
<frontend_type>select</frontend_type>
|
8 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
9 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
+
* @version 1.2.0
|
12 |
* @link https://github.com/itabs/Itabs_Invoice
|
13 |
*/
|
14 |
-->
|
169 |
<show_in_website>1</show_in_website>
|
170 |
<show_in_store>1</show_in_store>
|
171 |
</check_open_invoices>
|
172 |
+
<check_addresses translate="label comment">
|
173 |
+
<label>Check Address</label>
|
174 |
+
<frontend_type>select</frontend_type>
|
175 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
176 |
+
<sort_order>71</sort_order>
|
177 |
+
<comment>Check if billing address != shipping address. If yes, invoice payment will be disabled.</comment>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
</check_addresses>
|
182 |
+
<check_prefix translate="label comment">
|
183 |
+
<label>Check Prefix</label>
|
184 |
+
<frontend_type>select</frontend_type>
|
185 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
186 |
+
<sort_order>72</sort_order>
|
187 |
+
<comment>Check if the prefix of the billing/shipping address contains a not allowed value. If yes, invoice payment will be disabled.</comment>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>1</show_in_store>
|
191 |
+
</check_prefix>
|
192 |
+
<disabled_prefix translate="label">
|
193 |
+
<label>Disabled Prefix Options</label>
|
194 |
+
<frontend_type>text</frontend_type>
|
195 |
+
<sort_order>73</sort_order>
|
196 |
+
<comment><![CDATA[Semicolon (;) separated values.]]></comment>
|
197 |
+
<show_in_default>1</show_in_default>
|
198 |
+
<show_in_website>1</show_in_website>
|
199 |
+
<show_in_store>1</show_in_store>
|
200 |
+
<depends>
|
201 |
+
<check_prefix>1</check_prefix>
|
202 |
+
</depends>
|
203 |
+
</disabled_prefix>
|
204 |
<create_invoice translate="label comment">
|
205 |
<label>Automatically Create Invoice</label>
|
206 |
<frontend_type>select</frontend_type>
|
app/design/adminhtml/default/default/template/invoice/form.phtml
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
* @version 1.
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @version 1.2.0
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
app/design/adminhtml/default/default/template/invoice/info.phtml
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
* @version 1.
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @version 1.2.0
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
app/design/adminhtml/default/default/template/invoice/pdf.phtml
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
* @version 1.
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @version 1.2.0
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
app/design/frontend/base/default/template/invoice/form.phtml
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
* @version 1.
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @version 1.2.0
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
app/design/frontend/base/default/template/invoice/info.phtml
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
-
* @version 1.
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
7 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
8 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
* @version 1.2.0
|
11 |
* @link https://github.com/itabs/Itabs_Invoice
|
12 |
*/
|
13 |
?>
|
app/etc/modules/Itabs_Invoice.xml
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
9 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
-
* @version 1.
|
12 |
* @link https://github.com/itabs/Itabs_Invoice
|
13 |
*/
|
14 |
-->
|
8 |
* @author Rouven Alexander Rieker <rouven.rieker@itabs.de>
|
9 |
* @copyright 2013 ITABS GmbH (http://www.itabs.de/). All rights served.
|
10 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
11 |
+
* @version 1.2.0
|
12 |
* @link https://github.com/itabs/Itabs_Invoice
|
13 |
*/
|
14 |
-->
|
app/locale/de_DE/Itabs_Invoice.csv
CHANGED
@@ -25,3 +25,9 @@
|
|
25 |
"Invoice State","Rechnungs-Status"
|
26 |
"Send Invoice Email","Rechnungsemail versenden"
|
27 |
"Your invoice is payable within %s days.","Die Rechnung ist innerhalb %s Tagen zahlbar."
|
|
|
|
|
|
|
|
|
|
|
|
25 |
"Invoice State","Rechnungs-Status"
|
26 |
"Send Invoice Email","Rechnungsemail versenden"
|
27 |
"Your invoice is payable within %s days.","Die Rechnung ist innerhalb %s Tagen zahlbar."
|
28 |
+
"Check Address","Adressüberprüfung aktivieren"
|
29 |
+
"Check if billing address != shipping address. If yes, invoice payment will be disabled.","Prüfe, ob die Rechnungsadresse != der Lieferadresse ist. Falls ja, wird die Zahlung auf Rechnung deaktiviert."
|
30 |
+
"Check Prefix","Anrede überprüfen"
|
31 |
+
"Check if the prefix of the billing/shipping address contains a not allowed value. If yes, invoice payment will be disabled.","Prüfe, ob die Anrede der Rechnungs-/Lieferadresse einen ungültigen Wert enthält. Falls ja, wird die Zahlung auf Rechnung deaktiviert."
|
32 |
+
"Disabled Prefix Options","Nicht erlaubte Anredeoptionen"
|
33 |
+
"Semicolon (;) separated values.","Semikolon (;) getrennte Werte."
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>InvoicePayment</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Stellt die Zahlungsmöglichkeit "Rechnung" zur Verfügung. / Provides the payment method "invoice".</summary>
|
10 |
<description>Stellt die Zahlungsmöglichkeit "Rechnung" zur Verfügung. / Provides the payment method "invoice".</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Rouven Alexander Rieker</name><user>therouv</user><email>rouven.rieker@itabs.de</email></author></authors>
|
13 |
-
<date>2013-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Itabs"><dir name="Invoice"><dir name="Block"><file name="Form.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>InvoicePayment</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Stellt die Zahlungsmöglichkeit "Rechnung" zur Verfügung. / Provides the payment method "invoice".</summary>
|
10 |
<description>Stellt die Zahlungsmöglichkeit "Rechnung" zur Verfügung. / Provides the payment method "invoice".</description>
|
11 |
+
<notes>Extended validation possibilities!</notes>
|
12 |
<authors><author><name>Rouven Alexander Rieker</name><user>therouv</user><email>rouven.rieker@itabs.de</email></author></authors>
|
13 |
+
<date>2013-11-30</date>
|
14 |
+
<time>22:48:59</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Itabs"><dir name="Invoice"><dir name="Block"><file name="Form.php" hash="223932cb245db5544f84646ebdaf65f7"/><file name="Info.php" hash="63b04877dba9e04b115b8a194d5e5ff1"/></dir><dir name="Helper"><file name="Data.php" hash="b4be51feab1b1b62ea74313d5401c0d9"/></dir><dir name="Model"><file name="Invoice.php" hash="a04f924a64472acbba2d4e51b050e87a"/><file name="Observer.php" hash="c6be3111ea6515f3366844cf1e0c7679"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><file name="Group.php" hash="6ae37d6c7721cd794ce4979b1e122ffe"/></dir><dir name="Sales"><dir name="Invoice"><file name="State.php" hash="10b373f6dda9d54417b3e9003a7452f4"/></dir></dir></dir></dir></dir><file name="Validation.php" hash="769c41932ddc5e19423ec21491b9e8fa"/></dir><dir name="etc"><file name="config.xml" hash="e29b3439aa2bd782b5a46684ea6112b8"/><file name="system.xml" hash="731f9a83a6ebf3c7fb4769aaa8d20271"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Itabs_Invoice.xml" hash="439b5cbeab964b66713eac01f08c5a35"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Itabs_Invoice.csv" hash="210b140fd77cba93ef48ade75c0425cb"/></dir><dir name="en_US"><file name="Itabs_Invoice.csv" hash="d47d87074cf0853c8f6e66e80546e19a"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="invoice"><file name="form.phtml" hash="748b8fa4c515c477d1d798979408de84"/><file name="info.phtml" hash="d7f7358ad6e7b93fdbc5ca4df7cac752"/><file name="pdf.phtml" hash="72039869ea33dadafa89873750134466"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="invoice"><file name="form.phtml" hash="748b8fa4c515c477d1d798979408de84"/><file name="info.phtml" hash="d7f7358ad6e7b93fdbc5ca4df7cac752"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|