mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
More code for import routine.
This commit is contained in:
@@ -243,6 +243,18 @@ class BillRepository implements BillRepositoryInterface
|
||||
return $sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all bills with these ID's.
|
||||
*
|
||||
* @param array $billIds
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getByIds(array $billIds): Collection
|
||||
{
|
||||
return $this->user->bills()->whereIn('id', $billIds)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text or return empty string.
|
||||
*
|
||||
@@ -393,11 +405,11 @@ class BillRepository implements BillRepositoryInterface
|
||||
$rules = $this->user->rules()
|
||||
->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id')
|
||||
->where('rule_actions.action_type', 'link_to_bill')
|
||||
->get(['rules.id', 'rules.title', 'rule_actions.action_value','rules.active']);
|
||||
->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active']);
|
||||
$array = [];
|
||||
foreach ($rules as $rule) {
|
||||
$array[$rule->action_value] = $array[$rule->action_value] ?? [];
|
||||
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title,'active' => $rule->active];
|
||||
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active];
|
||||
}
|
||||
$return = [];
|
||||
foreach ($collection as $bill) {
|
||||
|
@@ -98,6 +98,15 @@ interface BillRepositoryInterface
|
||||
*/
|
||||
public function getBillsUnpaidInRange(Carbon $start, Carbon $end): string;
|
||||
|
||||
/**
|
||||
* Get all bills with these ID's.
|
||||
*
|
||||
* @param array $billIds
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getByIds(array $billIds): Collection;
|
||||
|
||||
/**
|
||||
* Get text or return empty string.
|
||||
*
|
||||
|
Reference in New Issue
Block a user