mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 02:45:58 +00:00
Add method to collect note text.
This commit is contained in:
@@ -26,6 +26,7 @@ use Carbon\Carbon;
|
|||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Factory\BillFactory;
|
use FireflyIII\Factory\BillFactory;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
@@ -242,6 +243,24 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
return $sum;
|
return $sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get text or return empty string.
|
||||||
|
*
|
||||||
|
* @param Bill $bill
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getNoteText(Bill $bill): string
|
||||||
|
{
|
||||||
|
/** @var Note $note */
|
||||||
|
$note = $bill->notes()->first();
|
||||||
|
if (null !== $note) {
|
||||||
|
return (string)$note->text;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
@@ -554,5 +573,4 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
|
|
||||||
return $service->update($bill, $data);
|
return $service->update($bill, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@ namespace FireflyIII\Repositories\Bill;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -99,6 +98,15 @@ interface BillRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getBillsUnpaidInRange(Carbon $start, Carbon $end): string;
|
public function getBillsUnpaidInRange(Carbon $start, Carbon $end): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get text or return empty string.
|
||||||
|
*
|
||||||
|
* @param Bill $bill
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getNoteText(Bill $bill): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user