Skip to content

Commit 3588e18

Browse files
committed
fix ticket-0704
1 parent c9b5cbe commit 3588e18

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

src/Component/Spacecraft/System/Type/TractorBeamShipSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public function deactivate(SpacecraftWrapperInterface $wrapper): void
9999
if ($tractoredShip !== null) {
100100

101101
$spacecraft->setTractoredShip(null);
102-
$tractoredShip->setTractoringSpacecraft(null);
103102
$this->spacecraftRepository->save($spacecraft);
104103
$this->entityManager->flush();
104+
$this->entityManager->refresh($spacecraft);
105105

106106
$this->privateMessageSender->send(
107107
$spacecraft->getUser()->getId(),

src/Migrations/pgsql/Version20250304213810_Field_Type_Complementary_Color.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class Version20250304213810_Field_Type_Complementary_Color extends Abstrac
1212
{
1313
public function getDescription(): string
1414
{
15-
return 'Adds complementary color to field types';;
15+
return 'Adds complementary color to field types';
1616
}
1717

1818
public function up(Schema $schema): void
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stu\Migrations\Pgsql;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
11+
final class Version20250314102615_Clear_Faulty_Tractor_Reference extends AbstractMigration
12+
{
13+
public function getDescription(): string
14+
{
15+
return 'Clears the tractored ship reference, if the corresponding ship system is offline.';
16+
}
17+
18+
public function up(Schema $schema): void
19+
{
20+
$this->addSql('UPDATE stu_spacecraft s SET tractored_ship_id = NULL WHERE s.tractored_ship_id IS NOT NULL AND EXISTS (SELECT * FROM stu_spacecraft_system ss WHERE ss.spacecraft_id = s.id AND ss.system_type = 14 AND ss.mode < 2)');
21+
}
22+
}

src/html/spacecraft/control/control_right.twig

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,40 +193,42 @@
193193
{% endif %}
194194
</table>
195195
{% endif %}
196-
{% if SPACECRAFT.isTractoring or SPACECRAFT.isTractored %}
196+
{% set tractoredShip = SPACECRAFT.getTractoredShip %}
197+
{% set tractoringSpacecraft = SPACECRAFT.getTractoringSpacecraft %}
198+
{% if tractoredShip or tractoringSpacecraft %}
197199
<table class="tcal">
198200
<tr>
199201
<th colspan="2"><img src="/assets/buttons/trak.png" title="Traktorstrahl" />
200202
Traktorstrahl</th>
201203
</tr>
202204
<tr>
203-
{% if SPACECRAFT.isTractoring %}
205+
{% if tractoredShip %}
204206
<td colspan="2">
205-
Gerichtet auf: {{ SPACECRAFT.getTractoredShip.getName|bbcode }}
207+
Gerichtet auf: {{ tractoredShip.getName|bbcode }}
206208
</td>
207209
{% else %}
208210
<td colspan="2">
209-
Gehalten von: {{ SPACECRAFT.getTractoringSpacecraft.getName|bbcode }}
211+
Gehalten von: {{ tractoringSpacecraft.getName|bbcode }}
210212
</td>
211213
{% endif %}
212214
</tr>
213215
<tr>
214216
<td>
215-
{% if SPACECRAFT.isTractoring %}
216-
{% if SPACECRAFT.isStation and not SPACECRAFT.getTractoredShip.isDestroyed %}
217+
{% if tractoredShip %}
218+
{% if SPACECRAFT.isStation %}
217219
<a href="javascript:void(0);"
218220
onClick="actionToInnerContent('B_DOCK_TRACTORED', 'id={{ spacecraftId }}&sstr={{ SESSIONSTRING }}');"
219221
onmouseover="cp('docktractored','buttons/dock2')" onmouseout="cp('docktractored','buttons/dock1')">
220222
<img src="/assets/buttons/dock1.png" name="docktractored" title="Gehaltenes Schiff andocken" />
221223
</a>
222224
{% endif %}
223-
<img src="/assets/ships/{{ SPACECRAFT.getTractoredShip.getRump.getId }}.png" />
225+
<img src="/assets/ships/{{ tractoredShip.getRump.getId }}.png" />
224226
{% else %}
225-
<img src="/assets/ships/{{ SPACECRAFT.getTractoringSpacecraft.getRump.getId }}.png" />
227+
<img src="/assets/ships/{{ tractoringSpacecraft.getRump.getId }}.png" />
226228
{% endif %}
227229
</td>
228230
<td>
229-
{% if SPACECRAFT.isTractoring %}
231+
{% if tractoredShip %}
230232
<input type="submit" class="button" name="B_DEACTIVATE_TRACTOR" value="deaktivieren" />
231233
{% elseif SPACECRAFT.isDeflectorHealthy %}
232234
<input type="submit" class="button" name="B_ESCAPE_TRAKTOR" value="Fluchtversuch" />

testdata/Migrations/VersionTestBuildplansModules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function up(Schema $schema): void
4141
(22226, 689,6,11904,NULL,3);
4242
(22227, 689,8,10835,NULL,3);
4343
(22228, 689,10,10604,NULL,3);
44-
(22229, 689,7,10735,NULL,3);;
44+
(22229, 689,7,10735,NULL,3);
4545
');
4646
}
4747
}

0 commit comments

Comments
 (0)