mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
docgen/budget: add comment for each budget line (resource and charge)
The comments are cocatenated by lines of each type, and separated by a `|`
This commit is contained in:
parent
910245f855
commit
69b2dce7ee
@ -13,6 +13,7 @@ and this project adheres to
|
||||
<!-- write down unreleased development here -->
|
||||
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
|
||||
* [docgen] add a new context with a list of activities in course
|
||||
* [docgen] add a comment in budget lines
|
||||
|
||||
|
||||
## Test releases
|
||||
|
@ -25,13 +25,13 @@ use function count;
|
||||
*/
|
||||
class SummaryBudget implements SummaryBudgetInterface
|
||||
{
|
||||
private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, type FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private const QUERY_CHARGE_BY_PERSON = 'select SUM(amount) AS sum, type FROM chill_budget.charge WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_CHARGE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.charge WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private const QUERY_RESOURCE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, type FROM chill_budget.resource WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_RESOURCE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.resource WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, type FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private array $chargeLabels;
|
||||
|
||||
@ -110,7 +110,9 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$rsm = new ResultSetMapping();
|
||||
$rsm
|
||||
->addScalarResult('sum', 'sum')
|
||||
->addScalarResult('type', 'type');
|
||||
->addScalarResult('type', 'type')
|
||||
->addScalarResult('comment', 'comment')
|
||||
;
|
||||
|
||||
return $rsm;
|
||||
}
|
||||
@ -121,7 +123,7 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$labels = $this->chargeLabels;
|
||||
|
||||
return array_combine($keys, array_map(function ($i) use ($labels) {
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i])];
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i]), 'comment' => ''];
|
||||
}, $keys));
|
||||
}
|
||||
|
||||
@ -131,7 +133,7 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$labels = $this->resourcesLabels;
|
||||
|
||||
return array_combine($keys, array_map(function ($i) use ($labels) {
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i])];
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i]), 'comment' => ''];
|
||||
}, $keys));
|
||||
}
|
||||
|
||||
@ -158,6 +160,7 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$result[$row['type']] = [
|
||||
'sum' => (float) $row['sum'],
|
||||
'label' => $this->translatableStringHelper->localize($label[$row['type']]),
|
||||
'comment' => (string) $row['comment'],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user