InvoicePayment - Version 1.1.0

Version Notes

Initial Release

Download this release

Release Info

Developer Rouven Alexander Rieker
Extension InvoicePayment
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

app/code/community/Itabs/Invoice/Block/Form.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * Payment Method Form
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Block_Form extends Mage_Payment_Block_Form
27
+ {
28
+ /**
29
+ * (non-PHPdoc)
30
+ * @see Mage_Core_Block_Template::_construct()
31
+ */
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+ $this->setTemplate('invoice/form.phtml');
36
+ }
37
+ }
app/code/community/Itabs/Invoice/Block/Info.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * Payment Method Info
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Block_Info extends Mage_Payment_Block_Info
27
+ {
28
+ /**
29
+ * (non-PHPdoc)
30
+ * @see Mage_Payment_Block_Info::_construct()
31
+ */
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+ $this->setTemplate('invoice/info.phtml');
36
+ }
37
+
38
+ /**
39
+ * Sets the template for PDF print-outs
40
+ *
41
+ * @return string Text for PDF print-out
42
+ */
43
+ public function toPdf()
44
+ {
45
+ $this->setTemplate('invoice/pdf.phtml');
46
+
47
+ return $this->toHtml();
48
+ }
49
+
50
+ /**
51
+ * Retrieve the payment method code
52
+ *
53
+ * @return string
54
+ */
55
+ public function getMethodCode()
56
+ {
57
+ return $this->getInfo()->getMethodInstance()->getCode();
58
+ }
59
+ }
app/code/community/Itabs/Invoice/Helper/Data.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * Helper class
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Helper_Data extends Mage_Core_Helper_Abstract
27
+ {
28
+
29
+ }
app/code/community/Itabs/Invoice/Model/Invoice.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * Invoice Model
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Model_Invoice extends Mage_Payment_Model_Method_Abstract
27
+ {
28
+ protected $_isGateway = false;
29
+ protected $_canAuthorize = false;
30
+ protected $_canCapture = true;
31
+ protected $_canCapturePartial = false;
32
+ protected $_canRefund = false;
33
+ protected $_canVoid = false;
34
+ protected $_canUseInternal = true;
35
+ protected $_canUseCheckout = true;
36
+ protected $_canUseForMultishipping = false;
37
+
38
+ /**
39
+ * unique internal payment method identifier
40
+ *
41
+ * @var string [a-z0-9_]
42
+ */
43
+ protected $_code = 'invoice';
44
+
45
+ /**
46
+ * payment form block
47
+ *
48
+ * @var string MODULE/BLOCKNAME
49
+ */
50
+ protected $_formBlockType = 'invoice/form';
51
+
52
+ /**
53
+ * payment info block
54
+ *
55
+ * @var string MODULE/BLOCKNAME
56
+ */
57
+ protected $_infoBlockType = 'invoice/info';
58
+
59
+ /**
60
+ * (non-PHPdoc)
61
+ * @see Mage_Payment_Model_Method_Abstract::authorize()
62
+ */
63
+ public function authorize(Varien_Object $payment, $amount)
64
+ {
65
+ if (Mage::getStoreConfigFlag('payment/'.$this->getCode().'/create_invoice')) {
66
+ /* @var $order Mage_Sales_Model_Order */
67
+ $order = $payment->getOrder();
68
+ $realOrderId = $payment->getOrder()->getRealOrderId();
69
+ $order->loadByIncrementId($realOrderId);
70
+
71
+ if ($order->canInvoice()) {
72
+ /* @var $invoice Mage_Sales_Model_Order_Invoice */
73
+ $invoice = $order->prepareInvoice();
74
+ $invoice->register()->capture();
75
+ Mage::getModel('core/resource_transaction')
76
+ ->addObject($invoice)
77
+ ->addObject($invoice->getOrder())->save();
78
+ $order->addRelatedObject($invoice);
79
+
80
+ $invoice->setState($this->getConfigData('invoice_state'));
81
+
82
+ if (Mage::getStoreConfigFlag('payment/'.$this->getCode().'/send_invoice_email')) {
83
+ $invoice->sendEmail();
84
+ }
85
+
86
+ // Add comment to order history
87
+ $order->addStatusHistoryComment('Invoiced order amount: '.$amount);
88
+ $order->save();
89
+ }
90
+ }
91
+
92
+ return $this;
93
+ }
94
+ }
app/code/community/Itabs/Invoice/Model/Observer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * Observer for payment method availability checks
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Model_Observer
27
+ {
28
+ /**
29
+ * paymentMethodIsActive
30
+ *
31
+ * Checks if Invoice is allowed for specific customer groups and if a
32
+ * registered customer has the required minimum amount of orders to be
33
+ * allowed to order via Invoice.
34
+ *
35
+ * @magentoEvent payment_method_is_active
36
+ * @param Varien_Event_Observer $observer Observer
37
+ * @return void
38
+ */
39
+ public function paymentMethodIsActive($observer)
40
+ {
41
+ $methodInstance = $observer->getEvent()->getMethodInstance();
42
+
43
+ // Check if method is Invoice
44
+ if ($methodInstance->getCode() != 'invoice') {
45
+ return;
46
+ }
47
+
48
+ // Check if payment method is active
49
+ if (!Mage::getStoreConfigFlag('payment/invoice/active')) {
50
+ return;
51
+ }
52
+
53
+ /* @var $validationModel Itabs_Invoice_Model_Validation */
54
+ $validationModel = Mage::getModel('invoice/validation');
55
+ $observer->getEvent()->getResult()->isAvailable = $validationModel->isValid();
56
+ }
57
+ }
app/code/community/Itabs/Invoice/Model/System/Config/Source/Customer/Group.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * System Config Customer Groups
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Model_System_Config_Source_Customer_Group
27
+ {
28
+ /**
29
+ * @var array Customer Groups
30
+ */
31
+ protected $_options;
32
+
33
+ /**
34
+ * Returns the customer groups as an array for system configuration
35
+ *
36
+ * @return array Customer Groups
37
+ */
38
+ public function toOptionArray()
39
+ {
40
+ if (!$this->_options) {
41
+ $collection = Mage::getResourceModel('customer/group_collection')
42
+ ->loadData()
43
+ ->toOptionArray();
44
+ $this->_options = $collection;
45
+
46
+ array_unshift(
47
+ $this->_options,
48
+ array(
49
+ 'value' => '',
50
+ 'label' => Mage::helper('invoice')->__('-- Please Select --')
51
+ )
52
+ );
53
+ }
54
+
55
+ return $this->_options;
56
+ }
57
+ }
app/code/community/Itabs/Invoice/Model/System/Config/Source/Sales/Invoice/State.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * System Config Invoice States
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Model_System_Config_Source_Sales_Invoice_State
27
+ {
28
+ /**
29
+ * @var array Invoice States
30
+ */
31
+ protected $_options;
32
+
33
+ /**
34
+ * Returns the invoice states as an array for system configuration
35
+ *
36
+ * @return array Invoice States
37
+ */
38
+ public function toOptionArray()
39
+ {
40
+ if (!$this->_options) {
41
+ $options = array();
42
+ $options[] = array(
43
+ 'value' => Mage_Sales_Model_Order_Invoice::STATE_OPEN,
44
+ 'label' => Mage::helper('invoice')->__('Open')
45
+ );
46
+ $options[] = array(
47
+ 'value' => Mage_Sales_Model_Order_Invoice::STATE_PAID,
48
+ 'label' => Mage::helper('invoice')->__('Paid')
49
+ );
50
+ $this->_options = $options;
51
+ }
52
+
53
+ return $this->_options;
54
+ }
55
+ }
app/code/community/Itabs/Invoice/Model/Validation.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Itabs
8
+ * @package Itabs_Invoice
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.1.0
13
+ * @link https://github.com/itabs/Itabs_Invoice
14
+ */
15
+ /**
16
+ * Validation model
17
+ *
18
+ * @category Itabs
19
+ * @package Itabs_Invoice
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.1.0
24
+ * @link https://github.com/itabs/Itabs_Invoice
25
+ */
26
+ class Itabs_Invoice_Model_Validation
27
+ {
28
+ /**
29
+ * @var null|Mage_Sales_Model_Resource_Order_Collection
30
+ */
31
+ protected $_customerOrders = null;
32
+
33
+ /**
34
+ * @var null|Mage_Sales_Model_Resource_Order_Collection
35
+ */
36
+ protected $_customerOrdersEmail = null;
37
+
38
+ /**
39
+ * @return bool
40
+ */
41
+ public function isValid()
42
+ {
43
+ return $this->hasSpecificCustomerGroup()
44
+ && $this->hasMinimumOrderCount()
45
+ && $this->hasMinimumOrderAmount()
46
+ && $this->hasOpenInvoices()
47
+ ;
48
+ }
49
+
50
+ /**
51
+ * Check if the customer is in a specific customer group
52
+ *
53
+ * @return bool
54
+ */
55
+ public function hasSpecificCustomerGroup()
56
+ {
57
+ if (!Mage::getStoreConfigFlag('payment/invoice/specificgroup_all')) {
58
+ $allowedGroupIds = explode(',', Mage::getStoreConfig('payment/invoice/specificgroup'));
59
+ if (!in_array($this->_getCustomerGroupId(), $allowedGroupIds)) {
60
+ return false;
61
+ }
62
+ }
63
+
64
+ return true;
65
+ }
66
+
67
+ /**
68
+ * Check if the customer has placed less complete orders than required..
69
+ *
70
+ * @return bool
71
+ */
72
+ public function hasMinimumOrderCount()
73
+ {
74
+ $minOrderCount = Mage::getStoreConfig('payment/invoice/customer_order_count');
75
+ if ($minOrderCount > 0) {
76
+ $customerId = $this->_getCustomer()->getId();
77
+ if (is_null($customerId)) {
78
+ return false;
79
+ }
80
+
81
+ $orders = $this->_getCustomerOrders($customerId);
82
+ if (count($orders) < $minOrderCount) {
83
+ return false;
84
+ }
85
+ }
86
+
87
+ return true;
88
+ }
89
+
90
+ /**
91
+ * Check if the order amount of all customer order are below the
92
+ * required order amount
93
+ *
94
+ * @return bool
95
+ */
96
+ public function hasMinimumOrderAmount()
97
+ {
98
+ $minOrderSum = Mage::getStoreConfig('payment/invoice/customer_order_amount');
99
+ if ($minOrderSum > 0) {
100
+ $customerId = $this->_getCustomer()->getId();
101
+ if (is_null($customerId)) {
102
+ return false;
103
+ }
104
+
105
+ $orders = $this->_getCustomerOrders($customerId);
106
+ $orderTotal = 0;
107
+ foreach ($orders as $order) {
108
+ $orderTotal += $order->getData('grand_total');
109
+ }
110
+
111
+ if ($orderTotal < $minOrderSum) {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ return true;
117
+ }
118
+
119
+ /**
120
+ * Check if a customer has not paid invoices..
121
+ *
122
+ * @return bool
123
+ */
124
+ public function hasOpenInvoices()
125
+ {
126
+ if (Mage::getStoreConfig('payment/invoice/check_open_invoices')) {
127
+ $email = $this->_getCustomerEmail();
128
+
129
+ // Load all customer orders by email because we need to check the guests too
130
+ if (null === $this->_customerOrdersEmail) {
131
+ $this->_customerOrdersEmail = Mage::getResourceModel('sales/order_collection')
132
+ ->addAttributeToFilter('customer_email', $email)
133
+ ->load();
134
+ }
135
+
136
+ /* @var $orders Mage_Sales_Model_Resource_Order_Collection */
137
+ $orders = $this->_customerOrdersEmail;
138
+
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) {
145
+ foreach ($invoices as $invoice) {
146
+ /* @var $invoice Mage_Sales_Model_Order_Invoice */
147
+ if ($invoice->getState() == 1) {
148
+ $hasOpenInvoices = true;
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ if ($hasOpenInvoices) {
155
+ return false;
156
+ }
157
+ }
158
+
159
+ return true;
160
+ }
161
+
162
+ /**
163
+ * Retrieve the current session
164
+ *
165
+ * @return Mage_Adminhtml_Model_Session_Quote|Mage_Customer_Model_Session
166
+ */
167
+ protected function _getSession()
168
+ {
169
+ if (Mage::app()->getStore()->isAdmin()) {
170
+ /* @var $session Mage_Adminhtml_Model_Session_Quote */
171
+ $session = Mage::getSingleton('adminhtml/session_quote');
172
+ } else {
173
+ /* @var $session Mage_Customer_Model_Session */
174
+ $session = Mage::getSingleton('customer/session');
175
+ }
176
+
177
+ return $session;
178
+ }
179
+
180
+ /**
181
+ * Retrieve the current customer
182
+ *
183
+ * @return Mage_Customer_Model_Customer
184
+ */
185
+ protected function _getCustomer()
186
+ {
187
+ return $this->_getSession()->getCustomer();
188
+ }
189
+
190
+ /**
191
+ * Retrieve the customer group id of the current customer
192
+ *
193
+ * @return int
194
+ */
195
+ protected function _getCustomerGroupId()
196
+ {
197
+ $customerGroupId = Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;
198
+ if (Mage::app()->getStore()->isAdmin()) {
199
+ $customerGroupId = $this->_getSession()->getQuote()->getCustomerGroupId();
200
+ } else {
201
+ if ($this->_getSession()->isLoggedIn()) {
202
+ $customerGroupId = $this->_getSession()->getCustomerGroupId();
203
+ }
204
+ }
205
+
206
+ return $customerGroupId;
207
+ }
208
+
209
+ /**
210
+ * Retrieve the email address of the current customer
211
+ *
212
+ * @return string
213
+ */
214
+ protected function _getCustomerEmail()
215
+ {
216
+ if (Mage::app()->getStore()->isAdmin()) {
217
+ $email = $this->_getCustomer()->getEmail();
218
+ } else {
219
+ if ($this->_getSession()->isLoggedIn()) {
220
+ $email = $this->_getCustomer()->getEmail();
221
+ } else {
222
+ /* @var $quote Mage_Sales_Model_Quote */
223
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
224
+ $email = $quote->getBillingAddress()->getEmail();
225
+ }
226
+ }
227
+
228
+ return $email;
229
+ }
230
+
231
+ /**
232
+ * Retrieve the order collection of a specific customer
233
+ *
234
+ * @param int $customerId
235
+ * @return Mage_Sales_Model_Resource_Order_Collection
236
+ */
237
+ protected function _getCustomerOrders($customerId)
238
+ {
239
+ if (null === $this->_customerOrders) {
240
+ $orders = Mage::getResourceModel('sales/order_collection')
241
+ ->addAttributeToSelect('*')
242
+ ->addAttributeToFilter('customer_id', $customerId)
243
+ ->addAttributeToFilter('status', Mage_Sales_Model_Order::STATE_COMPLETE)
244
+ ->addAttributeToFilter(
245
+ 'state',
246
+ array(
247
+ 'in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()
248
+ )
249
+ )
250
+ ->load();
251
+ $this->_customerOrders = $orders;
252
+ }
253
+
254
+ return $this->_customerOrders;
255
+ }
256
+ }
app/code/community/Itabs/Invoice/etc/config.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * This file is part of the Itabs_Invoice extension.
5
+ *
6
+ * @category Itabs
7
+ * @package Itabs_Invoice
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.1.0
12
+ * @link https://github.com/itabs/Itabs_Invoice
13
+ */
14
+ -->
15
+ <config>
16
+ <modules>
17
+ <Itabs_Invoice>
18
+ <version>1.1.0</version>
19
+ </Itabs_Invoice>
20
+ </modules>
21
+ <global>
22
+ <blocks>
23
+ <invoice>
24
+ <class>Itabs_Invoice_Block</class>
25
+ </invoice>
26
+ </blocks>
27
+ <helpers>
28
+ <invoice>
29
+ <class>Itabs_Invoice_Helper</class>
30
+ </invoice>
31
+ </helpers>
32
+ <models>
33
+ <invoice>
34
+ <class>Itabs_Invoice_Model</class>
35
+ </invoice>
36
+ </models>
37
+ <events>
38
+ <payment_method_is_active>
39
+ <observers>
40
+ <invoice_observer>
41
+ <class>invoice/observer</class>
42
+ <method>paymentMethodIsActive</method>
43
+ </invoice_observer>
44
+ </observers>
45
+ </payment_method_is_active>
46
+ </events>
47
+ </global>
48
+ <adminhtml>
49
+ <translate>
50
+ <modules>
51
+ <Itabs_Invoice>
52
+ <files>
53
+ <default>Itabs_Invoice.csv</default>
54
+ </files>
55
+ </Itabs_Invoice>
56
+ </modules>
57
+ </translate>
58
+ </adminhtml>
59
+ <frontend>
60
+ <translate>
61
+ <modules>
62
+ <Itabs_Invoice>
63
+ <files>
64
+ <default>Itabs_Invoice.csv</default>
65
+ </files>
66
+ </Itabs_Invoice>
67
+ </modules>
68
+ </translate>
69
+ </frontend>
70
+ <default>
71
+ <payment>
72
+ <invoice>
73
+ <active>0</active>
74
+ <model>invoice/invoice</model>
75
+ <order_status>pending</order_status>
76
+ <title>Invoice</title>
77
+ <payment_due>10</payment_due>
78
+ <payment_action>authorize</payment_action>
79
+ <allowspecific>0</allowspecific>
80
+ <specificgroup_all>1</specificgroup_all>
81
+ <specificgroup>0</specificgroup>
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>
88
+ </invoice>
89
+ </payment>
90
+ </default>
91
+ </config>
app/code/community/Itabs/Invoice/etc/system.xml ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * This file is part of the Itabs_Invoice extension.
5
+ *
6
+ * @category Itabs
7
+ * @package Itabs_Invoice
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.1.0
12
+ * @link https://github.com/itabs/Itabs_Invoice
13
+ */
14
+ -->
15
+ <config>
16
+ <sections>
17
+ <payment>
18
+ <groups>
19
+ <invoice translate="label" module="invoice">
20
+ <label>Invoice</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>31</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <active translate="label">
28
+ <label>Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </active>
36
+ <title translate="label">
37
+ <label>Title</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>5</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </title>
44
+ <order_status translate="label">
45
+ <label>New Order Status</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>adminhtml/system_config_source_order_status</source_model>
48
+ <sort_order>10</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </order_status>
53
+ <sort_order translate="label">
54
+ <label>Sort Order</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>15</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </sort_order>
61
+ <allowspecific translate="label">
62
+ <label>Payment from Applicable Countries</label>
63
+ <frontend_type>allowspecific</frontend_type>
64
+ <sort_order>20</sort_order>
65
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </allowspecific>
70
+ <specificcountry translate="label">
71
+ <label>Payment from Specific Countries</label>
72
+ <frontend_type>multiselect</frontend_type>
73
+ <sort_order>25</sort_order>
74
+ <source_model>adminhtml/system_config_source_country</source_model>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ </specificcountry>
79
+ <payment_due translate="label comment">
80
+ <label>Payment Due</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>30</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <comment><![CDATA[Number of days within the invoice is payable]]></comment>
87
+ </payment_due>
88
+ <text_block_form translate="label comment">
89
+ <label>Text for Payment Form</label>
90
+ <frontend_type>textarea</frontend_type>
91
+ <sort_order>31</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <comment><![CDATA[Text after the selection of the payment method]]></comment>
96
+ </text_block_form>
97
+ <text_block_info translate="label comment">
98
+ <label>Text for Payment Info</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>35</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ <comment><![CDATA[Text for the checkout progress info]]></comment>
105
+ </text_block_info>
106
+ <min_order_total translate="label">
107
+ <label>Minimum Order Total</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>40</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </min_order_total>
114
+ <max_order_total translate="label">
115
+ <label>Maximum Order Total</label>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>45</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ </max_order_total>
122
+ <specificgroup_all translate="label comment">
123
+ <label>Enabled for all customer groups</label>
124
+ <comment>Set to "no" if you want to enable Invoice payment only for specific customer groups.</comment>
125
+ <frontend_type>select</frontend_type>
126
+ <sort_order>50</sort_order>
127
+ <source_model>adminhtml/system_config_source_yesno</source_model>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ </specificgroup_all>
132
+ <specificgroup translate="label">
133
+ <label>Enabled only for specific customer groups</label>
134
+ <frontend_type>multiselect</frontend_type>
135
+ <sort_order>55</sort_order>
136
+ <source_model>invoice/system_config_source_customer_group</source_model>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ <depends>
141
+ <specificgroup_all>0</specificgroup_all>
142
+ </depends>
143
+ </specificgroup>
144
+ <customer_order_count translate="label comment">
145
+ <label>Minimum Order Count</label>
146
+ <frontend_type>text</frontend_type>
147
+ <sort_order>60</sort_order>
148
+ <comment>Default: "0" for disabled check | Minimum count of orders (in the past) needed for the customer to use this payment method.</comment>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </customer_order_count>
153
+ <customer_order_amount translate="label comment">
154
+ <label>Minimum Order Amount</label>
155
+ <frontend_type>text</frontend_type>
156
+ <sort_order>65</sort_order>
157
+ <comment>Default: "0" for disabled check | Minimum order amount (in the past) needed for the customer to use this payment method.</comment>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ </customer_order_amount>
162
+ <check_open_invoices translate="label comment">
163
+ <label>Check Open Invoices</label>
164
+ <frontend_type>select</frontend_type>
165
+ <source_model>adminhtml/system_config_source_yesno</source_model>
166
+ <sort_order>70</sort_order>
167
+ <comment>Set to "yes" if you want to disallow this payment method if a customer has invoices with the invoice state "Open".</comment>
168
+ <show_in_default>1</show_in_default>
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>
175
+ <source_model>adminhtml/system_config_source_yesno</source_model>
176
+ <sort_order>75</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ </create_invoice>
181
+ <invoice_state translate="label comment">
182
+ <label>Invoice State</label>
183
+ <frontend_type>select</frontend_type>
184
+ <source_model>invoice/system_config_source_sales_invoice_state</source_model>
185
+ <sort_order>80</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ <depends>
190
+ <create_invoice>1</create_invoice>
191
+ </depends>
192
+ </invoice_state>
193
+ <send_invoice_email translate="label">
194
+ <label>Send Invoice Email</label>
195
+ <frontend_type>select</frontend_type>
196
+ <source_model>adminhtml/system_config_source_yesno</source_model>
197
+ <sort_order>85</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
+ <depends>
202
+ <create_invoice>1</create_invoice>
203
+ </depends>
204
+ </send_invoice_email>
205
+ </fields>
206
+ </invoice>
207
+ </groups>
208
+ </payment>
209
+ </sections>
210
+ </config>
app/design/adminhtml/default/default/template/invoice/form.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * @category Itabs
6
+ * @package Itabs_Invoice
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.1.0
11
+ * @link https://github.com/itabs/Itabs_Invoice
12
+ */
13
+ ?>
14
+ <?php
15
+ /* @var $this Itabs_Invoice_Block_Form */
16
+
17
+ /* @var $method Itabs_Invoice_Model_Invoice */
18
+ $method = $this->getMethod();
19
+ ?>
20
+ <fieldset class="form-list">
21
+ <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none">
22
+ <li>
23
+ <div class="input-box">
24
+ <p><?php echo $this->__('Your invoice is payable within %s days.', $method->getConfigData('payment_due'))?></p>
25
+ <?php if ($method->getConfigData('text_block_form')): ?>
26
+ <p><?php echo $method->getConfigData('text_block_form') ?></p>
27
+ <?php endif; ?>
28
+ </div>
29
+ </li>
30
+ </ul>
31
+ </fieldset>
app/design/adminhtml/default/default/template/invoice/info.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * @category Itabs
6
+ * @package Itabs_Invoice
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.1.0
11
+ * @link https://github.com/itabs/Itabs_Invoice
12
+ */
13
+ ?>
14
+ <?php
15
+ /* @var $this Itabs_Invoice_Block_Info */
16
+
17
+ /* @var $method Itabs_Invoice_Model_Invoice */
18
+ $method = $this->getMethod();
19
+ ?>
20
+ <p><?php echo $method->getTitle() ?></p>
21
+ <p><?php echo $this->__('Your invoice is payable within %s days.', $method->getConfigData('payment_due'))?></p>
22
+ <?php if ($method->getConfigData('text_block_info')): ?>
23
+ <p><?php echo $method->getConfigData('text_block_info') ?></p>
24
+ <?php endif; ?>
app/design/adminhtml/default/default/template/invoice/pdf.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * @category Itabs
6
+ * @package Itabs_Invoice
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.1.0
11
+ * @link https://github.com/itabs/Itabs_Invoice
12
+ */
13
+ ?>
14
+ <?php
15
+ /* @var $this Itabs_Invoice_Block_Info */
16
+
17
+ /* @var $method Itabs_Invoice_Model_Invoice */
18
+ $method = $this->getMethod();
19
+ ?>
20
+ <?php echo $this->escapeHtml($method->getTitle()) ?>
21
+ {{pdf_row_separator}}
22
+ <?php echo $this->__('Your invoice is payable within %s days.', $method->getConfigData('payment_due'))?>
23
+ {{pdf_row_separator}}
24
+ <?php if ($method->getConfigData('text_block_info')): ?>
25
+ <?php echo $method->getConfigData('text_block_info') ?>
26
+ <?php endif; ?>
app/design/frontend/base/default/template/invoice/form.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * @category Itabs
6
+ * @package Itabs_Invoice
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.1.0
11
+ * @link https://github.com/itabs/Itabs_Invoice
12
+ */
13
+ ?>
14
+ <?php
15
+ /* @var $this Itabs_Invoice_Block_Form */
16
+
17
+ /* @var $method Itabs_Invoice_Model_Invoice */
18
+ $method = $this->getMethod();
19
+ ?>
20
+ <fieldset class="form-list">
21
+ <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none">
22
+ <li>
23
+ <div class="input-box">
24
+ <p><?php echo $this->__('Your invoice is payable within %s days.', $method->getConfigData('payment_due'))?></p>
25
+ <?php if ($method->getConfigData('text_block_form')): ?>
26
+ <p><?php echo $method->getConfigData('text_block_form') ?></p>
27
+ <?php endif; ?>
28
+ </div>
29
+ </li>
30
+ </ul>
31
+ </fieldset>
app/design/frontend/base/default/template/invoice/info.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file is part of the Itabs_Invoice extension.
4
+ *
5
+ * @category Itabs
6
+ * @package Itabs_Invoice
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.1.0
11
+ * @link https://github.com/itabs/Itabs_Invoice
12
+ */
13
+ ?>
14
+ <?php
15
+ /* @var $this Itabs_Invoice_Block_Info */
16
+
17
+ /* @var $method Itabs_Invoice_Model_Invoice */
18
+ $method = $this->getMethod();
19
+ ?>
20
+ <p><?php echo $method->getTitle() ?></p>
21
+ <p><?php echo $this->__('Your invoice is payable within %s days.', $method->getConfigData('payment_due'))?></p>
22
+ <?php if ($method->getConfigData('text_block_info')): ?>
23
+ <p><?php echo $method->getConfigData('text_block_info') ?></p>
24
+ <?php endif; ?>
app/etc/modules/Itabs_Invoice.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * This file is part of the Itabs_Invoice extension.
5
+ *
6
+ * @category Itabs
7
+ * @package Itabs_Invoice
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.1.0
12
+ * @link https://github.com/itabs/Itabs_Invoice
13
+ */
14
+ -->
15
+ <config>
16
+ <modules>
17
+ <Itabs_Invoice>
18
+ <active>true</active>
19
+ <codePool>community</codePool>
20
+ <depends>
21
+ <Mage_Payment />
22
+ </depends>
23
+ </Itabs_Invoice>
24
+ </modules>
25
+ </config>
app/locale/de_DE/Itabs_Invoice.csv ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Enabled","Aktiviert"
2
+ "Title","Titel"
3
+ "New Order Status","Neuer Bestell-Status"
4
+ "Sort Order","Reihenfolge"
5
+ "Payment from Applicable Countries","Zahlung aus erlaubten Ländern"
6
+ "Payment from Specific Countries","Zahlung von bestimmten Ländern"
7
+ "Payment Due","Zahlungsziel"
8
+ "Number of days within the invoice is payable","Anzahl an Tagen in denen die Rechnung zahlbar ist"
9
+ "Text for Payment Form","Text für Zahlungsmethoden-Auswahl"
10
+ "Text after the selection of the payment method","Text, der nach der Auswahl der Zahlungsmethode im Checkout angezeigt werden soll"
11
+ "Text for Payment Info","Text für die Zahlungsinformation"
12
+ "Text for the checkout progress info","Text, der im Bestellfortschritt angezeigt werden soll"
13
+ "Minimum Order Total","Mindestwert für Gesamtbestellung"
14
+ "Maximum Order Total","Höchstwert für Gesamtbestellung"
15
+ "Enabled for all customer groups","Aktiviert für alle Kundengruppen"
16
+ "Set to ""no"" if you want to enable Invoice payment only for specific customer groups.","Auf ""nein"" setzen um die Zahlungsart nur für bestimmte Kundengruppen zu erlauben"
17
+ "Enabled only for specific customer groups","Aktiviert für bestimmte Kundengruppen"
18
+ "Minimum Order Count","Mindestbestellanzahl"
19
+ "Default: ""0"" for disabled check | Minimum count of orders (in the past) needed for the customer to use this payment method.","Standard: ""0"" für deaktivierte Überprüfung | Mindestanzahl an Bestellugnen (in der Vergangenheit) um diese Zahlungsart benutzen zu dürfen."
20
+ "Minimum Order Amount","Mindestbestellsumme"
21
+ "Default: ""0"" for disabled check | Minimum order amount (in the past) needed for the customer to use this payment method.","Standard: ""0"" für deaktivierte Überprüfung | Mindestbestellsumme (in der Vergangenheit) um diese Zahlungsart benutzen zu dürfen."
22
+ "Check Open Invoices","Offene Rechnungen überprüfen"
23
+ "Set to ""yes"" if you want to disallow this payment method if a customer has invoices with the invoice state ""Open"".","Auf ""Ja"" setzen um die Zahlungsart zu deaktivieren, wenn der Kunden Rechnungen mit dem Status ""Offen"" hat."
24
+ "Automatically Create Invoice","Automatische Rechnungserstellung"
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."
app/locale/en_US/Itabs_Invoice.csv ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Enabled","Enabled"
2
+ "Title","Title"
3
+ "New Order Status","New Order Status"
4
+ "Sort Order","Sort Order"
5
+ "Payment from Applicable Countries","Payment from Applicable Countries"
6
+ "Payment from Specific Countries","Payment from Specific Countries"
7
+ "Payment Due","Payment Due"
8
+ "Number of days within the invoice is payable","Number of days within the invoice is payable"
9
+ "Text for Payment Form","Text for Payment Form"
10
+ "Text after the selection of the payment method","Text after the selection of the payment method"
11
+ "Text for Payment Info","Text for Payment Info"
12
+ "Text for the checkout progress info","Text for the checkout progress info"
13
+ "Minimum Order Total","Minimum Order Total"
14
+ "Maximum Order Total","Maximum Order Total"
15
+ "Enabled for all customer groups","Enabled for all customer groups"
16
+ "Set to ""no"" if you want to enable Invoice payment only for specific customer groups.","Set to ""no"" if you want to enable Invoice payment only for specific customer groups."
17
+ "Enabled only for specific customer groups","Enabled only for specific customer groups"
18
+ "Minimum Order Count","Minimum Order Count"
19
+ "Default: ""0"" for disabled check | Minimum count of orders (in the past) needed for the customer to use this payment method.","Default: ""0"" for disabled check | Minimum count of orders (in the past) needed for the customer to use this payment method."
20
+ "Minimum Order Amount","Minimum Order Amount"
21
+ "Default: ""0"" for disabled check | Minimum order amount (in the past) needed for the customer to use this payment method.","Default: ""0"" for disabled check | Minimum order amount (in the past) needed for the customer to use this payment method."
22
+ "Check Open Invoices","Check Open Invoices"
23
+ "Set to ""yes"" if you want to disallow this payment method if a customer has invoices with the invoice state ""Open"".","Set to ""yes"" if you want to disallow this payment method if a customer has invoices with the invoice state ""Open""."
24
+ "Automatically Create Invoice","Automatically Create Invoice"
25
+ "Invoice State","Invoice State"
26
+ "Send Invoice Email","Send Invoice Email"
27
+ "Your invoice is payable within %s days.","Your invoice is payable within %s days."
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>InvoicePayment</name>
4
+ <version>1.1.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&#xF6;glichkeit "Rechnung" zur Verf&#xFC;gung. / Provides the payment method "invoice".</summary>
10
+ <description>Stellt die Zahlungsm&#xF6;glichkeit "Rechnung" zur Verf&#xFC;gung. / Provides the payment method "invoice".</description>
11
+ <notes>Initial Release</notes>
12
+ <authors><author><name>Rouven Alexander Rieker</name><user>therouv</user><email>rouven.rieker@itabs.de</email></author></authors>
13
+ <date>2013-04-11</date>
14
+ <time>18:03:59</time>
15
+ <contents><target name="magecommunity"><dir name="Itabs"><dir name="Invoice"><dir name="Block"><file name="Form.php" hash="46793ee1f874920013b79123fe390b42"/><file name="Info.php" hash="b8243eb856c07c2d4182d857eff5532d"/></dir><dir name="Helper"><file name="Data.php" hash="9789edeee897dee54830470ab47e9ba7"/></dir><dir name="Model"><file name="Invoice.php" hash="5ccf732d65d716bb682ac32846af5e1c"/><file name="Observer.php" hash="f5088a104744e2f9dc423504798becbf"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><file name="Group.php" hash="364ea556644a107b4fc3523c89acf163"/></dir><dir name="Sales"><dir name="Invoice"><file name="State.php" hash="ecbac95ec623d694c7bbdd586d6131a5"/></dir></dir></dir></dir></dir><file name="Validation.php" hash="f80a2e74e1b7f908578fe59106f5c67c"/></dir><dir name="etc"><file name="config.xml" hash="b799356acb118fbc38c1ef66112900a7"/><file name="system.xml" hash="ebed835b4722d615b3404405724a6c2f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Itabs_Invoice.xml" hash="c09d4bba821d276b47d3883ad889a8cc"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Itabs_Invoice.csv" hash="702589edf5ba0a4908cc3e9929a947e6"/></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="1d98451e78da725aebf7db99534aa9ea"/><file name="info.phtml" hash="85108bfe18dd1542a97953a3ea44bcc1"/><file name="pdf.phtml" hash="8fb295b0d72b21414b28cf46d25280ba"/></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="1d98451e78da725aebf7db99534aa9ea"/><file name="info.phtml" hash="85108bfe18dd1542a97953a3ea44bcc1"/></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>