Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
a-menshchikov committed Sep 10, 2024
1 parent 4dbc5ff commit eb54607
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ jobs:
echo "::endgroup::"
- name: Auditor
uses: docker://nbgrp/auditor:0.26.0
uses: docker://nbgrp/auditor:0.27.0
with:
working-directory: shared/homeless
28 changes: 15 additions & 13 deletions shared/homeless/src/Admin/ClientAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,21 +891,23 @@ protected function configureTabMenu(MenuItemInterface $menu, string $action, ?Ad

$noticesCount = $this->noticeRepository->getUnviewedCount($this->getSubject(), $user);

$menu->addChild('Напоминания'.($noticesCount > 0 ? " ({$noticesCount})" : ''), [
'uri' => $admin->generateUrl('app.notice.admin.list', [
'id' => $id,
'filter' => [
'date' => [
'value' => [
'end' => date('d.m.Y'),
if ($this->isMenuItemEnabled(MenuItem::CODE_NOTIFICATIONS)) {
$menu->addChild('Напоминания'.($noticesCount > 0 ? " ({$noticesCount})" : ''), [
'uri' => $admin->generateUrl('app.notice.admin.list', [
'id' => $id,
'filter' => [
'date' => [
'value' => [
'end' => date('d.m.Y'),
],
],
'viewed' => [
'value' => 2,
],
],
'viewed' => [
'value' => 2,
],
],
])],
);
])],
);
}
}

private static function isAdditionalFieldValueEmpty(mixed $val): bool
Expand Down
2 changes: 1 addition & 1 deletion shared/homeless/src/Admin/ClientFormFieldAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function preValidate(object $object): void
}

if ($object->isFixed()) {
throw new AccessDeniedException(sprintf(
throw new AccessDeniedException(\sprintf(
'Изменение поля %s запрещено.', $object->getName(),
));
}
Expand Down
2 changes: 1 addition & 1 deletion shared/homeless/src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function downloadAction(Request $request): Response
{
$object = $this->admin->getSubject();
if (empty($object)) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $request->get($this->admin->getIdParameter())));
throw new NotFoundHttpException(\sprintf('unable to find the object with id : %s', $request->get($this->admin->getIdParameter())));
}

if (!($object instanceof DownloadableInterface)) {
Expand Down
2 changes: 1 addition & 1 deletion shared/homeless/src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function deleteAction(Request $request): Response
$object = $this->admin->getObject($id);

if (!$object) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
throw new NotFoundHttpException(\sprintf('unable to find the object with id : %s', $id));
}

$currentUserId = $this->getUser()->getId();
Expand Down
2 changes: 1 addition & 1 deletion shared/homeless/src/Entity/HistoryDownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class HistoryDownload

public function __toString(): string
{
return sprintf('%s (%s)', $this->user, $this->date->format('d.m.Y'));
return \sprintf('%s (%s)', $this->user, $this->date->format('d.m.Y'));
}

public function getId(): int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(
public function transform($value): bool
{
if ($value !== '0' && $value !== false && $value !== null && $value !== '1' && $this->formResponseId !== null) {
error_log(sprintf('Non-boolean value in form response %d: field %d has value %s',
error_log(\sprintf('Non-boolean value in form response %d: field %d has value %s',
$this->formResponseId, $this->formFieldId, var_export($value, true),
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function transform($value): ?array
return null;
}
if (!\is_string($value)) {
error_log(sprintf('Non-string value in multiselect transform. Form response %d: field %d has value %s',
error_log(\sprintf('Non-string value in multiselect transform. Form response %d: field %d has value %s',
$this->formResponseId, $this->formFieldId, var_export($value, true),
));
}
Expand All @@ -40,7 +40,7 @@ public function transform($value): ?array
public function reverseTransform($value): ?string
{
if (!\is_array($value)) {
error_log(sprintf('Non-array value in multiselect reverseTransform. Form response %d: field %d has value %s',
error_log(\sprintf('Non-array value in multiselect reverseTransform. Form response %d: field %d has value %s',
$this->formResponseId, $this->formFieldId, var_export($value, true),
));
}
Expand Down
4 changes: 2 additions & 2 deletions shared/homeless/src/Form/Type/AppHomelessFromDateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void

if ($options['widget'] === 'single_text') {
if ($pattern !== null && !str_contains($pattern, 'y') && !str_contains($pattern, 'M') && !str_contains($pattern, 'd')) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
throw new InvalidOptionsException(\sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
}

$builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
Expand All @@ -64,7 +64,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
));
} else {
if ($pattern !== null && (!str_contains($pattern, 'y') || !str_contains($pattern, 'M') || !str_contains($pattern, 'd'))) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
throw new InvalidOptionsException(\sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
}

$yearOptions = $monthOptions = [
Expand Down
2 changes: 1 addition & 1 deletion shared/homeless/src/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(ManagerRegistry $manager)
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{
if (!$user instanceof User) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_debug_type($user)));
throw new UnsupportedUserException(\sprintf('Instances of "%s" are not supported.', get_debug_type($user)));
}
$user->setSalt(null);
$user->setPassword($newHashedPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
class="tab-pane fade{% if (not app.request.query.has('_tab') and loop.first) or (tab_query_index == loop.index) %} in active{% endif %}"
id="{{ _tab_name }}"
>
<div class="box-body container-fluid">
<div class="box-body container-fluid">
<div class="sonata-ba-collapsed-fields">
{% if form_tab.description != false %}
{% if form_tab.translation_domain is defined and form_tab.translation_domain is same as(false) %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@
</div>
{% else %}
<form
{% if app.request.get('type') == 'custom_modal' %}
{% set isModal = true %}
{% else %}
{% set isModal = false %}
{% endif %}
{% set isModal = app.request.get('type') == 'custom_modal' %}

{% if sonata_config.getOption('form_type') == 'horizontal' %}class="form-horizontal"{% endif %}
role="form"
action="{% block sonata_form_action_url %}{{ admin.generateUrl(url, {'id': admin.id(object), 'uniqid': admin.uniqid, 'subclass': app.request.get('subclass'), 'isModal': isModal, 'url': app.request.headers.get('referer')}) }}{% endblock %}"
{% if form.vars.multipart %} enctype="multipart/form-data"{% endif %}
method="POST"
{% if not sonata_config.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
{% block sonata_form_attributes %}{% endblock %}
>
{% if sonata_config.getOption('form_type') == 'horizontal' %}class="form-horizontal"{% endif %}
role="form"
action="{% block sonata_form_action_url %}{{ admin.generateUrl(url, {'id': admin.id(object), 'uniqid': admin.uniqid, 'subclass': app.request.get('subclass'), 'isModal': isModal, 'url': app.request.headers.get('referer')}) }}{% endblock %}"
{% if form.vars.multipart %} enctype="multipart/form-data"{% endif %}
method="POST"
{% if not sonata_config.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
{% block sonata_form_attributes %}{% endblock %}
>

{{ include('@SonataAdmin/Helper/render_form_dismissable_errors.html.twig') }}

Expand All @@ -45,7 +41,7 @@
<div class="tab-content">
{% for code, form_tab in admin.formtabs %}
<div class="tab-pane fade{% if loop.first %} in active{% endif %}" id="tab_{{ admin.uniqid }}_{{ loop.index }}">
<div class="box-body container-fluid">
<div class="box-body container-fluid">
<div class="sonata-ba-collapsed-fields">
{% if form_tab.description != false %}
<p>{{ form_tab.description|raw }}</p>
Expand Down

0 comments on commit eb54607

Please sign in to comment.