/app/code/local/Ebizmarts/SagePaySuite/Block/Adminhtml/Transaction/Grid.php

https://github.com/arush/desparation-deprecated · PHP · 162 lines · 132 code · 22 blank · 8 comment · 0 complexity · a5109c5e938bc7fcc13a591fc1600bcb MD5 · raw file

  1. <?php
  2. class Ebizmarts_SagePaySuite_Block_Adminhtml_Transaction_Grid extends Mage_Adminhtml_Block_Widget_Grid
  3. {
  4. protected $_massactionBlockName = 'sagepayreporting/adminhtml_widget_grid_massaction';
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. $this->setId('orphan_transactions_grid');
  9. $this->setUseAjax(true);
  10. $this->setDefaultSort('id');
  11. $this->setDefaultDir('DESC');
  12. $this->setSaveParametersInSession(false);
  13. }
  14. protected function _prepareCollection()
  15. {
  16. $collection = Mage::getModel('sagepaysuite2/sagepaysuite_transaction')->getCollection()->getOrfans();
  17. $this->setCollection($collection);
  18. return parent::_prepareCollection();
  19. }
  20. protected function _prepareColumns()
  21. {
  22. $this->addColumn('id', array(
  23. 'header'=> Mage::helper('sagepaysuite')->__('ID'),
  24. 'width' => '80px',
  25. 'index' => 'id',
  26. 'type' => 'number'
  27. ));
  28. $this->addColumn('vendor_tx_code', array(
  29. 'header'=> Mage::helper('sagepaysuite')->__('Vendor Tx Code'),
  30. 'width' => '80px',
  31. 'index' => 'vendor_tx_code'
  32. ));
  33. $this->addColumn('vendorname', array(
  34. 'header'=> Mage::helper('sagepaysuite')->__('Vendor Name'),
  35. 'width' => '80px',
  36. 'index' => 'vendorname'
  37. ));
  38. $this->addColumn('mode', array(
  39. 'header'=> Mage::helper('sagepaysuite')->__('Mode'),
  40. 'width' => '80px',
  41. 'index' => 'mode'
  42. ));
  43. $this->addColumn('vps_tx_id', array(
  44. 'header'=> Mage::helper('sagepaysuite')->__('Vps Tx Id'),
  45. 'width' => '140px',
  46. 'index' => 'vps_tx_id'
  47. ));
  48. $this->addColumn('status', array(
  49. 'header'=> Mage::helper('sagepaysuite')->__('Transaction Status'),
  50. 'width' => '80px',
  51. 'index' => 'status'
  52. ));
  53. $this->addColumn('customer_cc_holder_name', array(
  54. 'header'=> Mage::helper('sagepaysuite')->__('Card Holder Name'),
  55. 'width' => '80px',
  56. 'index' => 'customer_cc_holder_name',
  57. ));
  58. $this->addColumn('customer_contact_info', array(
  59. 'header'=> Mage::helper('sagepaysuite')->__('Customer Contact Info'),
  60. 'width' => '80px',
  61. 'index' => 'customer_contact_info',
  62. ));
  63. $ccCards = Mage::getModel('sagepaysuite/sagepaysuite_source_creditCards')->toOption();
  64. $this->addColumn('card_type', array(
  65. 'header'=> Mage::helper('sagepaysuite')->__('Card Type'),
  66. 'width' => '80px',
  67. 'type' => 'options',
  68. 'index' => 'card_type',
  69. 'options' => $ccCards
  70. ));
  71. $this->addColumn('last_four_digits', array(
  72. 'header'=> Mage::helper('sagepaysuite')->__('Last 4 Digits'),
  73. 'width' => '80px',
  74. 'index' => 'last_four_digits'
  75. ));
  76. $this->addColumn('integration', array(
  77. 'header'=> Mage::helper('sagepaysuite')->__('Integration'),
  78. 'width' => '80px',
  79. 'index' => 'integration'
  80. ));
  81. $this->addColumn('action',
  82. array(
  83. 'header' => Mage::helper('sagepaysuite')->__('Action'),
  84. 'width' => '80px',
  85. 'type' => 'action',
  86. 'getter' => 'getVendorTxCode',
  87. 'actions' => array(
  88. /*array(
  89. 'caption' => Mage::helper('sagepaysuite')->__('View Detail'),
  90. 'url' => array('base'=>'sagepayreporting/adminhtml_sagepayreporting/transactionDetailModal'),
  91. 'field' => 'vendortxcode',
  92. 'popup' => '1',
  93. 'modal' => '1',
  94. ),*/
  95. array(
  96. 'caption' => Mage::helper('sagepaysuite')->__('Recover [beta]'),
  97. 'url' => array('base'=>'sgpsSecure/adminhtml_transaction/recover'),
  98. 'field' => 'vendortxcode',
  99. 'confirm' => Mage::helper('sagepaysuite')->__("Are you sure?\nA new order will be created and payment will be associated."),
  100. ),
  101. array(
  102. 'caption' => Mage::helper('sagepaysuite')->__('VOID'),
  103. 'url' => array('base'=>'sgpsSecure/adminhtml_transaction/void'),
  104. 'field' => 'vendortxcode',
  105. 'confirm' => Mage::helper('sagepaysuite')->__('Are you sure?')
  106. ),
  107. array(
  108. 'caption' => Mage::helper('sagepaysuite')->__('Delete'),
  109. 'url' => array('base'=>'sgpsSecure/adminhtml_transaction/delete'),
  110. 'field' => 'vendortxcode',
  111. 'confirm' => Mage::helper('sagepaysuite')->__("Are you sure?\nThis operation will just delete the record from your local database.")
  112. )
  113. ),
  114. 'filter' => false,
  115. 'sortable' => false,
  116. 'is_system' => true,
  117. ));
  118. return parent::_prepareColumns();
  119. }
  120. protected function _prepareMassaction()
  121. {
  122. $this->setMassactionIdField('vendortxcode');
  123. $this->getMassactionBlock()->setFormFieldName('transaction_ids');
  124. $this->getMassactionBlock()->setUseSelectAll(false);
  125. $this->getMassactionBlock()->addItem('dlete', array(
  126. 'label'=> Mage::helper('sagepaysuite')->__('Delete'),
  127. 'url' => $this->getUrl('sgpsSecure/adminhtml_transaction/delete'),
  128. ));
  129. return $this;
  130. }
  131. public function getRowUrl($row)
  132. {
  133. //return false;
  134. return $this->getUrl('sagepayreporting/adminhtml_sagepayreporting/transactionDetailModal', array('vendortxcode' => $row->getVendorTxCode()));
  135. }
  136. public function getGridUrl()
  137. {
  138. return $this->getUrl('*/*/grid', array('_current'=>true));
  139. }
  140. }