mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
e2f7aafa2d
commit
3fe452626d
9 changed files with 25 additions and 27 deletions
|
@ -585,9 +585,9 @@ class Part extends AttachmentContainingDBElement
|
||||||
|
|
||||||
if (\is_string($delimeter)) {
|
if (\is_string($delimeter)) {
|
||||||
return implode($delimeter, $supplier_names);
|
return implode($delimeter, $supplier_names);
|
||||||
} else {
|
|
||||||
return $supplier_names;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $supplier_names;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,9 +286,9 @@ class PermissionsEmbed
|
||||||
|
|
||||||
if (self::DISALLOW == $value) {
|
if (self::DISALLOW == $value) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,10 +40,10 @@ use Doctrine\ORM\PersistentCollection;
|
||||||
*/
|
*/
|
||||||
abstract class StructuralDBElement extends AttachmentContainingDBElement
|
abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
const ID_ROOT_ELEMENT = 0;
|
public const ID_ROOT_ELEMENT = 0;
|
||||||
|
|
||||||
//This is a not standard character, so build a const, so a dev can easily use it
|
//This is a not standard character, so build a const, so a dev can easily use it
|
||||||
const PATH_DELIMITER_ARROW = ' → ';
|
public const PATH_DELIMITER_ARROW = ' → ';
|
||||||
|
|
||||||
// We can not define the mapping here or we will get an exception. Unfortunatly we have to do the mapping in the
|
// We can not define the mapping here or we will get an exception. Unfortunatly we have to do the mapping in the
|
||||||
// subclasses
|
// subclasses
|
||||||
|
@ -146,9 +146,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
*/
|
*/
|
||||||
public function getComment(bool $parse_bbcode = true): string
|
public function getComment(bool $parse_bbcode = true): string
|
||||||
{
|
{
|
||||||
$val = htmlspecialchars($this->comment ?? '');
|
return htmlspecialchars($this->comment ?? '');
|
||||||
|
|
||||||
return $val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,7 +215,8 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
|
|
||||||
if (!$recursive) {
|
if (!$recursive) {
|
||||||
return $this->children;
|
return $this->children;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$all_elements = array();
|
$all_elements = array();
|
||||||
foreach ($this->children as $subelement) {
|
foreach ($this->children as $subelement) {
|
||||||
$all_elements[] = $subelement;
|
$all_elements[] = $subelement;
|
||||||
|
@ -226,7 +225,6 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
|
|
||||||
return $all_elements;
|
return $all_elements;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
|
@ -76,15 +76,13 @@ class ElementPermissionListener
|
||||||
$annotation = $reader->getPropertyAnnotation($property,
|
$annotation = $reader->getPropertyAnnotation($property,
|
||||||
ColumnSecurity::class);
|
ColumnSecurity::class);
|
||||||
|
|
||||||
if (null !== $annotation) {
|
|
||||||
//Check if user is allowed to read info, otherwise apply placeholder
|
//Check if user is allowed to read info, otherwise apply placeholder
|
||||||
if (!$this->security->isGranted($annotation->getReadOperationName(), $element)) {
|
if ((null !== $annotation) && !$this->security->isGranted($annotation->getReadOperationName(), $element)) {
|
||||||
$property->setAccessible(true);
|
$property->setAccessible(true);
|
||||||
$property->setValue($element, $annotation->getPlaceholder());
|
$property->setValue($element, $annotation->getPlaceholder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @PreUpdate
|
* @PreUpdate
|
||||||
|
|
|
@ -13,7 +13,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||||
*/
|
*/
|
||||||
class PartVoter extends ExtendedVoter
|
class PartVoter extends ExtendedVoter
|
||||||
{
|
{
|
||||||
const READ = 'read';
|
public const READ = 'read';
|
||||||
|
|
||||||
protected function supports($attribute, $subject)
|
protected function supports($attribute, $subject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,5 +109,7 @@ class EntityURLGenerator
|
||||||
if ($entity instanceof NamedDBElement) {
|
if ($entity instanceof NamedDBElement) {
|
||||||
return sprintf('<a href="%s">%s</a>', $href, $entity->getName());
|
return sprintf('<a href="%s">%s</a>', $href, $entity->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new EntityNotSupported('The given entity is not supported yet!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<img src="{{ main_image }}" class="img-fluid img-thumbnail bg-light" height="300" width="300">
|
<img src="{{ main_image }}" class="img-fluid img-thumbnail bg-light" alt="Part main image" height="300" width="300">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<h5 class="text-muted pt-2" title="{% trans %}manufacturer.label{% endtrans %}">{{ part.manufacturer.name ?? ""}}</h5>
|
<h5 class="text-muted pt-2" title="{% trans %}manufacturer.label{% endtrans %}">{{ part.manufacturer.name ?? ""}}</h5>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="card-body row">
|
<div class="card-body row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<div class="img-thumbnail">
|
<div class="img-thumbnail">
|
||||||
<img class="img-fluid img-rounded" src="{{ avatar }}">
|
<img class="img-fluid img-rounded" alt="User avatar" src="{{ avatar }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="{{ app.request.locale }}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue