Commit 87d92818 authored by Christopher Zechendorf's avatar Christopher Zechendorf
Browse files

[FEATURE] Invoice/List - fixes #2

parent 273d0712
<?php
namespace ExtDev\Invoicing\Controller;
/***************************************************************
*
* This is free and unencumbered software
* released into the public domain.
*
* (C0) 2018 ext/dev <info@extdev.io>
*
***************************************************************/
/**
* AccountController
*/
class InvoiceController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* accountRepository
*
* @var \ExtDev\Invoicing\Domain\Repository\InvoiceRepository
* @inject
*/
protected $invoiceRepository = NULL;
/**
* action list
*
* @return void
*/
public function listAction()
{
$invoices = $this->invoiceRepository->findAll();
$this->view->assign('invoices', $invoices);
}
}
......@@ -15,4 +15,159 @@ namespace ExtDev\Invoicing\Domain\Model;
*/
class Invoice extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* title
*
* @var string
*/
protected $title = '';
/**
* invoiceDate
*
* @var \DateTime
*/
protected $invoiceDate = NULL;
/**
* address
*
* @var string
*/
protected $address = '';
/**
* positions
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\ExtDev\Invoicing\Domain\Model\InvoicePosition>
* @lazy
*/
protected $positions = '';
/**
* __construct
*/
public function __construct()
{
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
*
* @return void
*/
protected function initStorageObjects()
{
$this->positions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Returns the invoiceDate
*
* @return \DateTime $invoiceDate
*/
public function getInvoiceDate()
{
return $this->invoiceDate;
}
/**
* Sets the invoiceDate
*
* @param \DateTime $invoiceDate
* @return void
*/
public function setInvoiceDate($invoiceDate)
{
$this->invoiceDate = $invoiceDate;
}
/**
* Returns the address
*
* @return string $address
*/
public function getAddress()
{
return $this->address;
}
/**
* Sets the address
*
* @param string $address
* @return void
*/
public function setAddress($address)
{
$this->address = $address;
}
/**
* Adds a position
*
* @param \ExtDev\Invoicing\Domain\Model\InvoicePosition $position
* @return void
*/
public function addPosition(\ExtDev\Invoicing\Domain\Model\InvoicePosition $position)
{
$this->transactions->attach($position);
}
/**
* Removes a position
*
* @param \ExtDev\Invoicing\Domain\Model\InvoicePosition The Position to be removed
* @return void
*/
public function removePosition(\ExtDev\Invoicing\Domain\Model\InvoicePosition $positionToRemove)
{
$this->positions->detach($positionToRemove);
}
/**
* Returns the positions
*
* @return \ExtDev\Invoicing\Domain\Model\InvoicePosition $positions
*/
public function getPositions()
{
return $this->positions;
}
/**
* Sets the transactions
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\ExtDev\Invoicing\Domain\Model\InvoicePosition> $positions
* @return void
*/
public function setPositions($positions)
{
$this->positions = $positions;
}
}
......@@ -15,4 +15,201 @@ namespace ExtDev\Invoicing\Domain\Model;
*/
class InvoicePosition extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* title
*
* @var string
*/
protected $title = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* internalComment
*
* @var string
*/
protected $internalComment = '';
/**
* url
*
* @var string
*/
protected $url = '';
/**
* amount
*
* @var float
*/
protected $amount = 0.00;
/**
* price
*
* @var float
*/
protected $price = 0.00;
/**
* taxRate
*
* @var float
*/
protected $taxRate = 0.00;
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* Returns the internalComment
*
* @return string $internalComment
*/
public function getInternalComment()
{
return $this->internalComment;
}
/**
* Sets the internalComment
*
* @param string $internalComment
* @return void
*/
public function setInternalComment($internalComment)
{
$this->internalComment = $internalComment;
}
/**
* Returns the url
*
* @return string $url
*/
public function getUrl()
{
return $this->url;
}
/**
* Sets the url
*
* @param string $url
* @return void
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* Returns the amount
*
* @return float $amount
*/
public function getAmount()
{
return $this->amount;
}
/**
* Sets the amount
*
* @param float $amount
* @return void
*/
public function setAmount($amount)
{
$this->amount = $amount;
}
/**
* Returns the price
*
* @return float $price
*/
public function getPrice()
{
return $this->price;
}
/**
* Sets the price
*
* @param float $price
* @return void
*/
public function setPrice($price)
{
$this->price = $price;
}
/**
* Returns the taxRate
*
* @return float $taxRate
*/
public function getTaxRate()
{
return $this->taxRate;
}
/**
* Sets the taxRate
*
* @param float $taxRate
* @return void
*/
public function setTaxRate($taxRate)
{
$this->taxRate = $taxRate;
}
}
......@@ -57,6 +57,9 @@
<trans-unit id="tx_invoicing_domain_model_rate.tax_rate">
<source>Tax Rate (%)</source>
</trans-unit>
<trans-unit id="plugin.invoicing.actions">
<source>Actions</source>
</trans-unit>
</body>
</file>
</xliff>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="table-responsive">
<table class="table">
<thead class="text-primary">
<tr>
<th>#</th>
<th><f:translate key="tx_invoicing_domain_model_invoice.title" /></th>
<th class="text-right"><f:translate key="plugin.invoicing.actions" /></th>
</tr>
</thead>
<tbody>
<f:for each="{invoices}" as="invoice">
<tr>
<td>{invoice.uid}</td>
<td>{invoice.title}</td>
<td class="td-actions text-right">
<f:link.action class="btn btn-default" action="show" arguments="{invoice:invoice}">
<i class="fa fa-eye"></i>
</f:link.action>
<f:link.action class="btn btn-default" action="showPdf" arguments="{invoice:invoice}">
<i class="fa fa-file"></i>
</f:link.action>
</td>
</tr>
</f:for>
</tbody>
</table>
</div>
</html>
......@@ -8,3 +8,18 @@
* (C0) 2018 ext/dev <info@extdev.io>
*
***************************************************************/
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'ExtDev.' . $_EXTKEY,
'Invoicing',
[
'Invoice' => 'list, show, showPdf'
],
[
'Invoice' => 'list, show, showPdf'
]
);
......@@ -8,3 +8,13 @@
* (C0) 2018 ext/dev <info@extdev.io>
*
***************************************************************/
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'ExtDev.' . $_EXTKEY,
'Invoicing',
'Invoicing'
);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment