post release 1.2 fixes (#1068)
* fix release command * fix permission name in UPGRADING * added missing korean calendar translations * fixed entry.total for invoice with fixed rates
This commit is contained in:
@@ -118,10 +118,10 @@ class CreateReleaseCommand extends Command
|
||||
|
||||
$commands = [
|
||||
'Clone repository' => $gitCmd . ' ' . $tmpDir,
|
||||
'Install composer dependencies' => 'cd ' . $tmpDir . ' && composer install --no-dev --optimize-autoloader',
|
||||
'Create database' => 'cd ' . $tmpDir . ' && ' . $prefix . ' bin/console doctrine:database:create -n',
|
||||
'Create tables' => 'cd ' . $tmpDir . ' && ' . $prefix . ' bin/console doctrine:schema:create -n',
|
||||
'Add all migrations' => 'cd ' . $tmpDir . ' && ' . $prefix . ' bin/console doctrine:migrations:version --add --all -n',
|
||||
'Install composer dependencies' => sprintf('cd %s && %s composer install --no-dev --optimize-autoloader', $tmpDir, $prefix),
|
||||
'Create database' => sprintf('cd %s && %s bin/console doctrine:database:create -n', $tmpDir, $prefix),
|
||||
'Create tables' => sprintf('cd %s && %s bin/console doctrine:schema:create -n', $tmpDir, $prefix),
|
||||
'Add all migrations' => sprintf('cd %s && %s bin/console doctrine:migrations:version --add --all -n', $tmpDir, $prefix),
|
||||
];
|
||||
|
||||
$filesToDelete = [
|
||||
|
||||
@@ -221,7 +221,7 @@ class InvoiceController extends AbstractController
|
||||
*/
|
||||
public function listTemplateAction(): Response
|
||||
{
|
||||
$templates = $this->invoiceRepository->findByQuery(new BaseQuery());
|
||||
$templates = $this->invoiceRepository->getPagerfantaForQuery(new BaseQuery());
|
||||
|
||||
return $this->render('invoice/templates.html.twig', [
|
||||
'entries' => $templates,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Form\Type;
|
||||
|
||||
use App\Entity\InvoiceTemplate;
|
||||
use App\Repository\InvoiceTemplateRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
@@ -27,6 +28,9 @@ class InvoiceTemplateType extends AbstractType
|
||||
$resolver->setDefaults([
|
||||
'label' => 'label.template',
|
||||
'class' => InvoiceTemplate::class,
|
||||
'query_builder' => function (InvoiceTemplateRepository $repository) {
|
||||
return $repository->getQueryBuilderForFormType();
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class InvoiceItem
|
||||
*/
|
||||
private $additionalFields = [];
|
||||
|
||||
public function addAdditionalField(string $name, string $value): InvoiceItem
|
||||
public function addAdditionalField(string $name, ?string $value): InvoiceItem
|
||||
{
|
||||
$this->additionalFields[$name] = $value;
|
||||
|
||||
|
||||
@@ -183,8 +183,7 @@ trait RendererTrait
|
||||
$amount = $this->getFormattedDuration($invoiceItem->getDuration());
|
||||
$description = $invoiceItem->getDescription();
|
||||
|
||||
if (null !== $invoiceItem->getFixedRate()) {
|
||||
$rate = $invoiceItem->getFixedRate();
|
||||
if ($invoiceItem->isFixedRate()) {
|
||||
$hourlyRate = $invoiceItem->getFixedRate();
|
||||
$amount = $invoiceItem->getAmount();
|
||||
}
|
||||
|
||||
@@ -12,39 +12,18 @@ namespace App\Repository;
|
||||
use App\Entity\InvoiceTemplate;
|
||||
use App\Repository\Query\BaseQuery;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
|
||||
class InvoiceTemplateRepository extends EntityRepository
|
||||
{
|
||||
use RepositoryTrait;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTemplate()
|
||||
public function hasTemplate(): bool
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
|
||||
$qb->select('COUNT(t.id) as totalRecords')
|
||||
->from(InvoiceTemplate::class, 't')
|
||||
;
|
||||
|
||||
$result = $qb->getQuery()->execute([], Query::HYDRATE_ARRAY);
|
||||
|
||||
if (!isset($result[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result[0]['totalRecords'] > 0;
|
||||
return $this->count([]) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BaseQuery $query
|
||||
* @return QueryBuilder|Pagerfanta|array
|
||||
*/
|
||||
public function findByQuery(BaseQuery $query)
|
||||
public function getQueryBuilderForFormType(): QueryBuilder
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
|
||||
@@ -52,7 +31,27 @@ class InvoiceTemplateRepository extends EntityRepository
|
||||
->from(InvoiceTemplate::class, 't')
|
||||
->orderBy('t.name');
|
||||
|
||||
return $this->getBaseQueryResult($qb, $query);
|
||||
return $qb;
|
||||
}
|
||||
|
||||
private function getQueryBuilderForQuery(BaseQuery $query): QueryBuilder
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
|
||||
$qb->select('t')
|
||||
->from(InvoiceTemplate::class, 't')
|
||||
->orderBy('t.name');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function getPagerfantaForQuery(BaseQuery $query): Pagerfanta
|
||||
{
|
||||
$paginator = new Pagerfanta(new DoctrineORMAdapter($this->getQueryBuilderForQuery($query), false));
|
||||
$paginator->setMaxPerPage($query->getPageSize());
|
||||
$paginator->setCurrentPage($query->getPage());
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user