[FEAT] Exclude transactions with given tag(s)
This commit is contained in:
11
autosave.php
11
autosave.php
@@ -29,7 +29,7 @@ bcscale(12);
|
||||
* Keep in mind that running this script is entirely AT YOUR OWN RISK with ZERO GUARANTEES.
|
||||
*/
|
||||
|
||||
const FIREFLY_III_URL = 'http://firefly.sd.home';
|
||||
const EXCLUDED_TAGS = 'Direct debit';
|
||||
const FIREFLY_III_TOKEN = 'ey...';
|
||||
|
||||
/*
|
||||
@@ -282,9 +282,18 @@ function getTransactions(int $accountId): array
|
||||
foreach ($transactions as $transaction) {
|
||||
$time = strtotime($transaction['date']);
|
||||
if ($time > TIMESTAMP) {
|
||||
$tags = $transaction['tags'];
|
||||
$noExcludedTags = true;
|
||||
foreach (explode(";", EXCLUDED_TAGS) as $excludedTag) {
|
||||
if (in_array($tags, $excludedTag)) {
|
||||
$noExcludedTags = false;
|
||||
}
|
||||
}
|
||||
if ($noExcludedTags) {
|
||||
// add it to the array:
|
||||
$addToSet = true;
|
||||
}
|
||||
}
|
||||
if ($time <= TIMESTAMP) {
|
||||
//message(sprintf('Will not include transaction group #%d, the date is %s', $currentGroup['id'], $transaction['date']));
|
||||
// break the loop:
|
||||
|
||||
Reference in New Issue
Block a user