/**
	 *
	 * @service commission write
	 * @param $fields
	 * @return Gpf_Rpc_Action
	 */
	public function deleteCommissionType(Gpf_Rpc_Params $params) {
		$action = new Gpf_Rpc_Action($params);
		$action->setErrorMessage($this->_('Failed to delete type, some transactions are connected to this type. Remove them first.'));
		$action->setInfoMessage($this->_('Commission type successfully removed'));

		$commTypeId = $action->getParam('commtypeid');

		$transaction = new Pap_Db_Transaction();
		$transaction->setCommissionTypeId($commTypeId);
		$collection = $transaction->loadCollection(array(Pap_Db_Table_Transactions::COMMISSIONTYPEID));
		if ($collection->getSize() > 0) {
			$action->addError();
			return $action;
		}

        $commissionType = new Pap_Db_CommissionType();
        $commissionType->setId($commTypeId);
        $commissionType->delete();

        $action->addOk();
        return $action;
	}