Change default view in Affiliate panel


NOTE:
There is no need to utilize this plugin anymore, since you can already change the default view of grids (which column shall be visible and which  not) of affiliate panel directly in the merchant panel:
http://support.qualityunit.com/356960-Change-default-view-in-affiliate-grids

This plugin changes default view of Commissions grid in affiliate panel. Default view of other grids can be changed same way too. If there is no extension point in the grid you want to modify, please let us know.

Plugin definition file:
<?php

class CustomTransactionsDefaultView_Definition extends Gpf_Plugins_Definition {

    public function __construct() {
        $this->codeName =  'CustomTransactionsDefaultView';
        $this->name = $this->_('Custom default view for affiliate panel commissions grid');
        $this->description = $this->_('Plugin will change default view for affiliate panel commissions grid');
        $this->version = '1.0.0';

        $this->addRequirement('PapCore', '4.1.28.2');

        $this->addImplementation('PostAffiliate.Affiliates.Transactions.initDefaultView', 'CustomTransactionsDefaultView_Main', 'changeDefaultView');
    }
}
?>

Main plugin file:
class CustomTransactionsDefaultView_Main extends Gpf_Plugins_Handler {

    /**
     * @return CustomTransactionsDefaultView_Main
     */
    public static function getHandlerInstance() {
        return new CustomTransactionsDefaultView_Main();
    }

    public function changeDefaultView(Pap_Affiliates_Reports_TransactionsGrid $transactionsGrid) {
        $transactionsGrid->clearDefaultViewColumns();
        $transactionsGrid->addDefaultViewColumn(Pap_Db_Table_Transactions::CHANNEL, '', 'N');
        $transactionsGrid->addDefaultViewColumn(Pap_Db_Table_Transactions::TIER, '', 'N');
        $transactionsGrid->addDefaultViewColumn(Pap_Db_Table_Transactions::TOTAL_COST, '', 'N');
        $transactionsGrid->addDefaultViewColumn(Pap_Db_Table_Transactions::COMMISSION, '', 'N');
        $transactionsGrid->addDefaultViewColumn(Pap_Db_Table_Transactions::DATE_INSERTED, '', 'A');
        $transactionsGrid->addDefaultViewColumn('payoutdate', '', 'N');
        $transactionsGrid->addDefaultViewColumn(Pap_Db_Table_Transactions::PAYOUT_STATUS, '', 'N');
    }
}
?>