Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4.2.2 #244

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions app/Console/Commands/LegacyBudgetGroupShiftCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App\Console\Commands;

use App\Models\Legacy\LegacyBudgetGroup;
use App\Models\Legacy\LegacyBudgetItem;
use App\Models\Legacy\LegacyBudgetPlan;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class LegacyBudgetGroupShiftCommand extends Command
{
protected $signature = 'legacy:budget-group-shift
{new_group_id : The new Group ID}';

protected $description = 'Insert an new budget group with the given id in the newest BudgetPlan';

public function handle(): void
{
\DB::transaction(function () {
$latestPlan = LegacyBudgetPlan::orderBy('id', 'desc')->limit(1)->first();
$budgetGroups = LegacyBudgetGroup::where('hhp_id', $latestPlan->id)
->where('id', '>=', $this->argument('new_group_id'));
$this->info('The following amount of other groups will be shifted back: '.$budgetGroups->count());
\Schema::disableForeignKeyConstraints();
// this is so hacky ...
$budgetGroups->update(['id' => DB::raw('-(id + 1)')]);
LegacyBudgetGroup::where('id', '<', 0)->update(['id' => DB::raw('-id')]);
// but its needed, otherwise there is a duplicate key. id's should not be used for sorting...
LegacyBudgetItem::where('hhpgruppen_id', '>=', $this->argument('new_group_id'))
->update(['hhpgruppen_id' => DB::raw('hhpgruppen_id + 1')]);
$newGroup = new LegacyBudgetGroup([
'hhp_id' => $latestPlan->id,
'gruppen_name' => $this->ask('Please enter new Group name:'),
'type' => $this->ask('Is it Einname or Ausgabe? E/A') === 'E' ? 0 : 1,
]);
$newGroup->id = $this->argument('new_group_id');
$newGroup->save();
\Schema::enableForeignKeyConstraints();

});
}
}
2 changes: 2 additions & 0 deletions app/Models/Legacy/Bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Bank extends Model
*/
protected $table = 'konto_bank';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/BankAccountCredential.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
*/
class BankAccountCredential extends Model
{
public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/ExpensesReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class ExpensesReceipt extends Model
*/
protected $table = 'belege';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/ExpensesReceiptPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class ExpensesReceiptPost extends Model
*/
protected $table = 'beleg_posten';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class FileInfo extends Model
*/
protected $table = 'fileinfo';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/LegacyBudgetGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class LegacyBudgetGroup extends Model
*/
protected $table = 'haushaltsgruppen';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/LegacyBudgetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class LegacyBudgetItem extends Model
*/
protected $table = 'haushaltstitel';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/LegacyBudgetPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class LegacyBudgetPlan extends Model
*/
protected $table = 'haushaltsplan';

public $timestamps = false;

/**
* @var array
*/
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Legacy/ProjectPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class ProjectPost extends Model
*/
protected $table = 'projektposten';

public $timestamps = false;

/**
* @var array
*/
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
'help_contact_mail' => env('HELP_CONTACT_MAIL', 'stufis@open-administration.de'),
'git-repo' => env('GIT_URL', 'https://github.com/openadministration/stufis/releases'),
'blog_url' => env('BLOG_URL', 'https://open-administration.de'),
'docs_url' => env('DOCS_URL', 'https://doku.open-administration.de'),
'docs_url' => env('DOCS_URL', 'https://doku.stufis.de'),

'realm' => env('AUTH_REALM'),

Expand Down