improved invoices with new renderer (#306)

* added docx renderer and demo template
* added csv renderer and demo template
* added xlsx renderer and demo template
* added ods renderer and demo template
* added user calculator
* added invoice documentation
This commit is contained in:
Kevin Papst
2018-09-21 01:27:56 +02:00
committed by GitHub
parent b035fc9ebd
commit 53f82a808b
121 changed files with 4094 additions and 770 deletions

View File

@@ -312,18 +312,28 @@ class KimaiImporterCommand extends Command
* This is checked against the Kimai version and database revision.
*
* @param SymfonyStyle $io
* @param $requiredVersion
* @param $requiredRevision
* @param string $requiredVersion
* @param string $requiredRevision
* @return bool
* @throws \Doctrine\DBAL\DBALException
*/
protected function checkDatabaseVersion(SymfonyStyle $io, $requiredVersion, $requiredRevision)
{
$versionQuery = 'SELECT `value` from ' . $this->dbPrefix . 'configuration WHERE `option` = "version"';
$revisionQuery = 'SELECT `value` from ' . $this->dbPrefix . 'configuration WHERE `option` = "revision"';
$version = $this->connection->createQueryBuilder()
->select('value')
->from($this->connection->quoteIdentifier($this->dbPrefix . 'configuration'))
->where('option = :option')
->setParameter(':option', 'version')
->execute()
->fetchColumn();
$version = $this->getImportConnection()->query($versionQuery)->fetchColumn();
$revision = $this->getImportConnection()->query($revisionQuery)->fetchColumn();
$revision = $this->connection->createQueryBuilder()
->select('value')
->from($this->connection->quoteIdentifier($this->dbPrefix . 'configuration'))
->where('option = :option')
->setParameter(':option', 'revision')
->execute()
->fetchColumn();
if (1 == version_compare($requiredVersion, $version)) {
$io->error(
@@ -378,21 +388,16 @@ class KimaiImporterCommand extends Command
}
/**
* @param $table
* @param string $table
* @return array
* @throws \Doctrine\DBAL\DBALException
*/
protected function fetchAllFromImport($table)
{
return $this->getImportConnection()->query('SELECT * from ' . $this->dbPrefix . $table)->fetchAll();
}
/**
* @return \Doctrine\DBAL\Connection
*/
protected function getImportConnection()
{
return $this->connection;
return $this->connection->createQueryBuilder()
->select('*')
->from($this->connection->quoteIdentifier($this->dbPrefix . $table))
->execute()
->fetchAll();
}
/**
@@ -792,7 +797,6 @@ class KimaiImporterCommand extends Command
}
}
if (!$this->validateImport($io, $activity)) {
throw new \Exception('Failed to validate activity: ' . $activity->getName());
}
@@ -932,15 +936,15 @@ class KimaiImporterCommand extends Command
$io->write('.');
if (0 == $counter % 80) {
$io->writeln(' ('.$counter.'/'.$total.')');
$io->writeln(' (' . $counter . '/' . $total . ')');
$entityManager->clear(Timesheet::class);
}
}
for ($i = 0; $i < 80-($counter%80); $i++) {
for ($i = 0; $i < 80 - ($counter % 80); $i++) {
$io->write(' ');
}
$io->writeln(' ('.$counter.'/'.$total.')');
$io->writeln(' (' . $counter . '/' . $total . ')');
if ($activityCounter > 0) {
$io->success('Created new (previously global) activities during timesheet import: ' . $activityCounter);