fix invoice preview (#1129)

This commit is contained in:
Kevin Papst
2019-09-20 16:00:03 +02:00
committed by GitHub
parent 5aa422dde1
commit e45e782e7d
9 changed files with 39 additions and 31 deletions

View File

@@ -10,32 +10,32 @@
namespace App;
/**
* Some very global constants for Kimai.
* Some "very" global constants for Kimai.
*/
class Constants
{
/**
* The current release version
*/
public const VERSION = '1.4';
/**
* The current release status, either "stable" or "dev"
*/
public const STATUS = 'dev';
/**
* The software name
*/
public const SOFTWARE = 'Kimai 2';
/**
* The current release version
*/
public const VERSION = '1.3';
/**
* The release name, will only change for new major version
*/
public const NAME = 'Ayumi';
/**
* The current release status, either "stable" or "dev"
*/
public const STATUS = 'stable';
/**
* Used in multiple views
*/
public const GITHUB = 'https://github.com/kevinpapst/kimai2/';
/**
* Used in multiple views
* Homepage, used in multiple views
*/
public const HOMEPAGE = 'https://www.kimai.org';
}

View File

@@ -68,7 +68,6 @@ class InvoiceController extends AbstractController
}
$showPreview = false;
$maxItemsPreview = 500;
$entries = [];
$query = $this->getDefaultQuery();
@@ -88,7 +87,6 @@ class InvoiceController extends AbstractController
$previewButton = $form->get('preview');
if ($previewButton->isClicked()) {
$showPreview = true;
$query->setPageSize($maxItemsPreview);
$entries = $this->getPreviewEntries($query);
}
}
@@ -102,8 +100,7 @@ class InvoiceController extends AbstractController
return $this->render('invoice/index.html.twig', [
'model' => $model,
'form' => $form->createView(),
'preview_max' => $maxItemsPreview,
'preview_show' => $showPreview,
'preview' => $showPreview,
]);
}
@@ -209,7 +206,7 @@ class InvoiceController extends AbstractController
$entries = array_merge($entries, $items);
}
return array_slice($entries, 0, $query->getPageSize());
return $entries;
}
/**

View File

@@ -40,7 +40,7 @@ final class UserPreferenceEvent extends Event
}
/**
* Do not set the preferences directly to the user object, but ONLY via addUserPreference()
* Do not set the preferences directly to the user object, but ONLY via addPreference()
* @return User
*/
public function getUser()
@@ -59,7 +59,7 @@ final class UserPreferenceEvent extends Event
/**
* @param UserPreference $preference
*/
public function addUserPreference(UserPreference $preference)
public function addPreference(UserPreference $preference)
{
foreach ($this->preferences as $pref) {
if (strtolower($pref->getName()) === strtolower($preference->getName())) {
@@ -70,4 +70,14 @@ final class UserPreferenceEvent extends Event
}
$this->preferences[] = $preference;
}
/**
* @param UserPreference $preference
* @deprecated since 1.4, will be removed with 2.0
*/
public function addUserPreference(UserPreference $preference)
{
@trigger_error('addUserPreference() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
$this->addPreference($preference);
}
}