Skip to content

Commit 35d5269

Browse files
authored
Opravy chyb helpdesk (#797)
* block capacity check fix * check tables existence fix * downgrade nette forms
1 parent ffbeb34 commit 35d5269

File tree

5 files changed

+823
-152
lines changed

5 files changed

+823
-152
lines changed

app/AdminModule/ProgramModule/Forms/BlockFormFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function create(int $id, int $userId): Form
158158
$capacityText->addCondition(Form::FILLED)
159159
->addRule(Form::INTEGER, 'admin.program.blocks.form.capacity_format')
160160
->toggle('alternatesAllowedCheckbox');
161-
$minAllowedCapacity = $this->queryBus->handle(new MinBlockAllowedCapacityQuery($this->block));
161+
$minAllowedCapacity = $this->block !== null ? $this->queryBus->handle(new MinBlockAllowedCapacityQuery($this->block)) : null;
162162
if ($minAllowedCapacity !== null) {
163163
$capacityText->addCondition(Form::FILLED)
164164
->addRule(Form::MIN, 'admin.program.blocks.form.capacity_low', $minAllowedCapacity);

app/InstallModule/Presenters/InstallPresenter.php

+6-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use App\Model\Acl\Repositories\RoleRepository;
88
use App\Model\Acl\Role;
99
use App\Model\Settings\Commands\SetSettingBoolValue;
10-
use App\Model\Settings\Exceptions\SettingsItemNotFoundException;
1110
use App\Model\Settings\Queries\SettingBoolValueQuery;
1211
use App\Model\Settings\Settings;
1312
use App\Model\Structure\Repositories\SubeventRepository;
@@ -17,14 +16,14 @@
1716
use App\Services\QueryBus;
1817
use Contributte\Console\Application;
1918
use Doctrine\Common\Collections\ArrayCollection;
20-
use Doctrine\DBAL\Exception\TableNotFoundException;
2119
use Doctrine\Migrations\Tools\Console\Command\MigrateCommand;
2220
use Doctrine\ORM\EntityManagerInterface;
2321
use Exception;
2422
use Nette\Application\AbortException;
2523
use Skautis\Skautis;
2624
use Skautis\Wsdl\WsdlException;
2725
use Symfony\Component\Console\Input\ArrayInput;
26+
use Symfony\Component\Messenger\Exception\HandlerFailedException;
2827
use Throwable;
2928
use Tracy\Debugger;
3029
use Tracy\ILogger;
@@ -84,8 +83,8 @@ public function renderDefault(): void
8483

8584
$this->flashMessage('install.schema.schema_already_created', 'info');
8685
$this->redirect('admin');
87-
} catch (TableNotFoundException $ex) {
88-
} catch (SettingsItemNotFoundException $ex) {
86+
} catch (HandlerFailedException $ex) {
87+
// ignoruje se, tabulky ještě nejsou vytvořeny
8988
}
9089
}
9190

@@ -126,9 +125,7 @@ public function renderAdmin(): void
126125
$this->flashMessage('install.admin.admin_already_created', 'info');
127126
$this->redirect('finish');
128127
}
129-
} catch (TableNotFoundException $ex) {
130-
$this->redirect('default');
131-
} catch (SettingsItemNotFoundException $ex) {
128+
} catch (HandlerFailedException $ex) {
132129
$this->redirect('default');
133130
}
134131

@@ -185,9 +182,7 @@ public function renderFinish(): void
185182
if (! $this->queryBus->handle(new SettingBoolValueQuery(Settings::ADMIN_CREATED))) {
186183
$this->redirect('default');
187184
}
188-
} catch (TableNotFoundException $ex) {
189-
$this->redirect('default');
190-
} catch (SettingsItemNotFoundException $ex) {
185+
} catch (HandlerFailedException $ex) {
191186
$this->redirect('default');
192187
}
193188
}
@@ -204,9 +199,7 @@ public function renderInstalled(): void
204199
if (! $this->queryBus->handle(new SettingBoolValueQuery(Settings::ADMIN_CREATED))) {
205200
$this->redirect('default');
206201
}
207-
} catch (TableNotFoundException $ex) {
208-
$this->redirect('default');
209-
} catch (SettingsItemNotFoundException $ex) {
202+
} catch (HandlerFailedException $ex) {
210203
$this->redirect('default');
211204
}
212205
}

app/WebModule/Presenters/WebBasePresenter.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
use App\Services\CmsService;
2121
use App\Services\QueryBus;
2222
use App\Services\SkautIsService;
23-
use Doctrine\DBAL\Exception\TableNotFoundException;
2423
use Nette\Application\AbortException;
24+
use Symfony\Component\Messenger\Exception\HandlerFailedException;
2525
use Throwable;
2626
use WebLoader\Nette\CssLoader;
2727
use WebLoader\Nette\JavaScriptLoader;
@@ -140,9 +140,7 @@ private function checkInstallation(): void
140140
if (! $this->queryBus->handle(new SettingBoolValueQuery(Settings::ADMIN_CREATED))) {
141141
$this->redirect(':Install:Install:default');
142142
}
143-
} catch (TableNotFoundException $ex) {
144-
$this->redirect(':Install:Install:default');
145-
} catch (SettingsItemNotFoundException $ex) {
143+
} catch (HandlerFailedException $ex) {
146144
$this->redirect(':Install:Install:default');
147145
}
148146
}

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"nette/database": "^3.1",
2323
"nette/di": "^3.0",
2424
"nette/finder": "^2.5",
25-
"nette/forms": "^3.0",
25+
"nette/forms": "~3.0.0",
2626
"nette/http": "^3.1",
2727
"nette/mail": "^3.1",
2828
"nette/robot-loader": "^3.3",

0 commit comments

Comments
 (0)