Release 1.20.3 (#3340)
* fix edit timesheet link * fix drag & drop creates record for wrong user * fix search with multiple bindings * hide user switcher in calendar if there is only one user to choose * make quick entry responsive for mobile-only users * mark invoices as exported by default * fix serialization deprecation warning * fix duration calculation for fixed rate entries * updated composer packages * fix checkbox for horizontal forms * support pdfContext for PDF invoice templates
This commit is contained in:
@@ -23,7 +23,7 @@ class InvoiceQuery extends TimesheetQuery
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $markAsExported = false;
|
||||
private $markAsExported = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -33,7 +33,7 @@ class InvoiceQuery extends TimesheetQuery
|
||||
'exported' => InvoiceQuery::STATE_NOT_EXPORTED,
|
||||
'state' => self::STATE_STOPPED,
|
||||
'billable' => true,
|
||||
'markAsExported' => false,
|
||||
'markAsExported' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,36 +59,43 @@ trait RepositorySearchTrait
|
||||
$searchAnd = $qb->expr()->andX();
|
||||
|
||||
if ($this->supportsMetaFields()) {
|
||||
$i = 0;
|
||||
$a = 0;
|
||||
$c = 0;
|
||||
foreach ($searchTerm->getSearchFields() as $metaName => $metaValue) {
|
||||
$and = $qb->expr()->andX();
|
||||
/** @var literal-string $alias */
|
||||
$alias = 'meta' . $a++;
|
||||
$paramName = 'metaName' . $i++;
|
||||
$paramValue = 'metaValue' . $c++;
|
||||
|
||||
if ($metaValue === '*') {
|
||||
$qb->leftJoin($rootAlias . '.meta', 'meta');
|
||||
$and->add($qb->expr()->eq('meta.name', ':metaName'));
|
||||
$qb->setParameter('metaName', $metaName);
|
||||
$and->add($qb->expr()->isNotNull('meta.value'));
|
||||
$qb->leftJoin($rootAlias . '.meta', $alias);
|
||||
$and->add($qb->expr()->eq($alias . '.name', ':' . $paramName));
|
||||
$qb->setParameter($paramName, $metaName);
|
||||
$and->add($qb->expr()->isNotNull($alias . '.value'));
|
||||
} elseif ($metaValue === '~') {
|
||||
$and->add(
|
||||
sprintf('NOT EXISTS(SELECT metaNotExists FROM %s metaNotExists WHERE metaNotExists.%s = %s.id)', $this->getMetaFieldClass(), $this->getMetaFieldName(), $rootAlias)
|
||||
);
|
||||
} elseif ($metaValue === '' || $metaValue === null) {
|
||||
$qb->leftJoin($rootAlias . '.meta', 'meta');
|
||||
$qb->leftJoin($rootAlias . '.meta', $alias);
|
||||
$and->add(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->eq('meta.name', ':metaName'),
|
||||
$qb->expr()->isNull('meta.value')
|
||||
$qb->expr()->eq($alias . '.name', ':' . $paramName),
|
||||
$qb->expr()->isNull($alias . '.value')
|
||||
),
|
||||
sprintf('NOT EXISTS(SELECT metaNotExists FROM %s metaNotExists WHERE metaNotExists.%s = %s.id)', $this->getMetaFieldClass(), $this->getMetaFieldName(), $rootAlias)
|
||||
)
|
||||
);
|
||||
$qb->setParameter('metaName', $metaName);
|
||||
$qb->setParameter($paramName, $metaName);
|
||||
} else {
|
||||
$qb->leftJoin($rootAlias . '.meta', 'meta');
|
||||
$and->add($qb->expr()->eq('meta.name', ':metaName'));
|
||||
$and->add($qb->expr()->like('meta.value', ':metaValue'));
|
||||
$qb->setParameter('metaName', $metaName);
|
||||
$qb->setParameter('metaValue', '%' . $metaValue . '%');
|
||||
$qb->leftJoin($rootAlias . '.meta', $alias);
|
||||
$and->add($qb->expr()->eq($alias . '.name', ':' . $paramName));
|
||||
$and->add($qb->expr()->like($alias . '.value', ':' . $paramValue));
|
||||
$qb->setParameter($paramName, $metaName);
|
||||
$qb->setParameter($paramValue, '%' . $metaValue . '%');
|
||||
}
|
||||
|
||||
$searchAnd->add($and);
|
||||
@@ -99,16 +106,18 @@ trait RepositorySearchTrait
|
||||
|
||||
if ($searchTerm->hasSearchTerm() && \count($fields) > 0) {
|
||||
$or = $qb->expr()->orX();
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
$param = 'searchTerm' . $i++;
|
||||
if (stripos($field, '.') === false) {
|
||||
$field = $rootAlias . '.' . $field;
|
||||
}
|
||||
$or->add(
|
||||
$qb->expr()->like($field, ':searchTerm'),
|
||||
$qb->expr()->like($field, ':' . $param),
|
||||
);
|
||||
$qb->setParameter($param, '%' . $searchTerm->getSearchTerm() . '%');
|
||||
}
|
||||
$searchAnd->add($or);
|
||||
$qb->setParameter('searchTerm', '%' . $searchTerm->getSearchTerm() . '%');
|
||||
}
|
||||
|
||||
if ($searchAnd->count() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user