Clean up code.

This commit is contained in:
James Cole 2021-06-12 08:40:35 +02:00
parent 5854dff37e
commit 10597e3bef
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
4 changed files with 48 additions and 7 deletions

View File

@ -0,0 +1,41 @@
<?php
/*
* AttributeHandler.php
* Copyright (c) 2021 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace FireflyIII\Ldap;
use FireflyIII\User as DatabaseUser;
use LdapRecord\Models\OpenLDAP\User as LdapUser;
/**
* Class AttributeHandler
*/
class AttributeHandler
{
/**
* @param LdapUser $ldap
* @param DatabaseUser $database
*/
public function handle(LdapUser $ldap, DatabaseUser $database)
{
$database->email = $ldap->getFirstAttribute('mail');
$database->save();
}
}

View File

@ -398,9 +398,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$array['categories'] = $journal->categories->toArray();
$array['budgets'] = $journal->budgets->toArray();
$array['notes'] = $journal->notes->toArray();
$array['locations'] = []; // todo
$array['locations'] = [];
$array['attachments'] = $journal->attachments->toArray();
$array['links'] = []; // todo
$array['links'] = [];
$array['piggy_bank_events'] = $journal->piggyBankEvents->toArray();
/** @var Transaction $transaction */

View File

@ -255,7 +255,7 @@ trait RenderPartialViews
{
$index = 0;
$actions = [];
// todo must be repos
// must be repos
$currentActions = $rule->ruleActions()->orderBy('order', 'ASC')->get();
/** @var RuleAction $entry */
foreach ($currentActions as $entry) {
@ -304,7 +304,7 @@ trait RenderPartialViews
asort($triggers);
$index = 0;
$renderedEntries = [];
// todo must be repos
// must be repos
$currentTriggers = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
/** @var RuleTrigger $entry */
foreach ($currentTriggers as $entry) {

View File

@ -21,6 +21,8 @@
declare(strict_types=1);
use FireflyIII\Ldap\AttributeHandler;
return [
/*
|--------------------------------------------------------------------------
@ -111,9 +113,7 @@ return [
'database' => [
'model' => FireflyIII\User::class,
'sync_passwords' => false,
'sync_attributes' => [
'email' => 'mail',
],
'sync_attributes' => AttributeHandler::class,
],
],
],