mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed typos
This commit is contained in:
parent
63df16a369
commit
d04d743520
144 changed files with 263 additions and 265 deletions
|
@ -45,12 +45,12 @@ use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
|||
use function count;
|
||||
|
||||
/**
|
||||
* This command converts the BBCode used by old Part-DB versions (<1.0), to the current used markdown format.
|
||||
* This command converts the BBCode used by old Part-DB versions (<1.0), to the current used Markdown format.
|
||||
*/
|
||||
class ConvertBBCodeCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @var string The LIKE criteria used to detect on SQL server if a entry contains BBCode
|
||||
* @var string The LIKE criteria used to detect on SQL server if an entry contains BBCode
|
||||
*/
|
||||
protected const BBCODE_CRITERIA = '%[%]%[/%]%';
|
||||
/**
|
||||
|
|
|
@ -269,7 +269,6 @@ abstract class BaseAdminController extends AbstractController
|
|||
|
||||
protected function _new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AbstractNamedDBElement $entity = null)
|
||||
{
|
||||
$master_picture_backup = null;
|
||||
if (null === $entity) {
|
||||
/** @var AbstractStructuralDBElement|User $new_entity */
|
||||
$new_entity = new $this->entity_class();
|
||||
|
@ -390,7 +389,7 @@ abstract class BaseAdminController extends AbstractController
|
|||
foreach ($errors as $error) {
|
||||
if ($error['entity'] instanceof AbstractStructuralDBElement) {
|
||||
$this->addFlash('error', $error['entity']->getFullPath().':'.$error['violations']);
|
||||
} else { //When we dont have a structural element, we can only show the name
|
||||
} else { //When we don't have a structural element, we can only show the name
|
||||
$this->addFlash('error', $error['entity']->getName().':'.$error['violations']);
|
||||
}
|
||||
}
|
||||
|
@ -413,11 +412,11 @@ abstract class BaseAdminController extends AbstractController
|
|||
}
|
||||
|
||||
/**
|
||||
* Performs checks if the element can be deleted safely. Otherwise an flash message is added.
|
||||
* Performs checks if the element can be deleted safely. Otherwise, a flash message is added.
|
||||
*
|
||||
* @param AbstractNamedDBElement $entity the element that should be checked
|
||||
*
|
||||
* @return bool True if the the element can be deleted, false if not
|
||||
* @return bool True if the element can be deleted, false if not
|
||||
*/
|
||||
protected function deleteCheck(AbstractNamedDBElement $entity): bool
|
||||
{
|
||||
|
|
|
@ -395,7 +395,7 @@ class PartController extends AbstractController
|
|||
}
|
||||
|
||||
err:
|
||||
//If an redirect was passed, then redirect there
|
||||
//If a redirect was passed, then redirect there
|
||||
if($request->request->get('_redirect')) {
|
||||
return $this->redirect($request->request->get('_redirect'));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class RedirectController extends AbstractController
|
|||
*/
|
||||
public function addLocalePart(Request $request): RedirectResponse
|
||||
{
|
||||
//By default we use the global default locale
|
||||
//By default, we use the global default locale
|
||||
$locale = $this->default_locale;
|
||||
|
||||
//Check if a user has set a preferred language setting:
|
||||
|
|
|
@ -95,7 +95,7 @@ class TypeaheadController extends AbstractController
|
|||
}
|
||||
|
||||
/**
|
||||
* This functions map the parameter type to the class, so we can access its repository
|
||||
* This function map the parameter type to the class, so we can access its repository
|
||||
* @param string $type
|
||||
* @return class-string
|
||||
*/
|
||||
|
|
|
@ -61,11 +61,11 @@ class UserController extends AdminPages\BaseAdminController
|
|||
|
||||
protected function additionalActionEdit(FormInterface $form, AbstractNamedDBElement $entity): bool
|
||||
{
|
||||
//Check if we editing a user and if we need to change the password of it
|
||||
//Check if we're editing a user and if we need to change the password of it
|
||||
if ($entity instanceof User && !empty($form['new_password']->getData())) {
|
||||
$password = $this->passwordEncoder->hashPassword($entity, $form['new_password']->getData());
|
||||
$entity->setPassword($password);
|
||||
//By default the user must change the password afterwards
|
||||
//By default, the user must change the password afterward
|
||||
$entity->setNeedPwChange(true);
|
||||
|
||||
$event = new SecurityEvent($entity);
|
||||
|
@ -141,7 +141,7 @@ class UserController extends AdminPages\BaseAdminController
|
|||
if ($entity instanceof User && !empty($form['new_password']->getData())) {
|
||||
$password = $this->passwordEncoder->hashPassword($entity, $form['new_password']->getData());
|
||||
$entity->setPassword($password);
|
||||
//By default the user must change the password afterwards
|
||||
//By default, the user must change the password afterward
|
||||
$entity->setNeedPwChange(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ class UserSettingsController extends AbstractController
|
|||
$page_need_reload = true;
|
||||
}
|
||||
|
||||
/** @var Form $form We need an form implementation for the next calls */
|
||||
/** @var Form $form We need a form implementation for the next calls */
|
||||
if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName()) {
|
||||
//Remove the avatar attachment from the user if requested
|
||||
if ($user->getMasterPictureAttachment() !== null) {
|
||||
|
@ -327,7 +327,7 @@ class UserSettingsController extends AbstractController
|
|||
|
||||
$pw_form->handleRequest($request);
|
||||
|
||||
//Check if password if everything was correct, then save it to User and DB
|
||||
//Check if everything was correct, then save it to User and DB
|
||||
if (!$this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) {
|
||||
$password = $passwordEncoder->hashPassword($user, $pw_form['new_password']->getData());
|
||||
$user->setPassword($password);
|
||||
|
|
|
@ -31,7 +31,7 @@ use Omines\DataTablesBundle\Column\AbstractColumn;
|
|||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* Similar to the built in DateTimeColumn, but the datetime is formatted using a IntlDateFormatter,
|
||||
* Similar to the built-in DateTimeColumn, but the datetime is formatted using a IntlDateFormatter,
|
||||
* to get prettier locale based formatting.
|
||||
*/
|
||||
class LocaleDateTimeColumn extends AbstractColumn
|
||||
|
|
|
@ -98,7 +98,7 @@ class InstanceOfConstraint extends AbstractConstraint
|
|||
|
||||
if ($this->operator === 'ANY' || $this->operator === 'NONE') {
|
||||
foreach($this->value as $value) {
|
||||
//We cannnot use an paramater here, as this is the only way to pass the FCQN to the query (via binded params, we would need to use ClassMetaData). See: https://github.com/doctrine/orm/issues/4462
|
||||
//We can not use a parameter here, as this is the only way to pass the FCQN to the query (via binded params, we would need to use ClassMetaData). See: https://github.com/doctrine/orm/issues/4462
|
||||
$expressions[] = ($queryBuilder->expr()->isInstanceOf($this->property, $value));
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class TextConstraint extends AbstractConstraint
|
|||
return;
|
||||
}
|
||||
|
||||
//The CONTAINS, LIKE, STARTS and ENDS operators use the LIKE operator but we have to build the value string differently
|
||||
//The CONTAINS, LIKE, STARTS and ENDS operators use the LIKE operator, but we have to build the value string differently
|
||||
$like_value = null;
|
||||
if ($this->operator === 'LIKE') {
|
||||
$like_value = $this->value;
|
||||
|
|
|
@ -24,7 +24,7 @@ use Doctrine\DBAL\Driver;
|
|||
use Doctrine\DBAL\Driver\Middleware;
|
||||
|
||||
/**
|
||||
* This class wraps the Doctrine DBAL driver and wraps it into an Midleware driver so we can change the SQL mode
|
||||
* This class wraps the Doctrine DBAL driver and wraps it into a Midleware driver, so we can change the SQL mode
|
||||
*/
|
||||
class SetSQLModeMiddlewareWrapper implements Middleware
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
/**
|
||||
* A list of file extensions, that browsers can show directly as image.
|
||||
* Based on: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
||||
* It will be used to determine if a attachment is a picture and therefore will be shown to user as preview.
|
||||
* It will be used to determine if an attachment is a picture and therefore will be shown to user as preview.
|
||||
*/
|
||||
public const PICTURE_EXTS = ['apng', 'bmp', 'gif', 'ico', 'cur', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png',
|
||||
'svg', 'webp', ];
|
||||
|
@ -70,7 +70,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
public const MODEL_EXTS = ['x3d'];
|
||||
|
||||
/**
|
||||
* When the path begins with one of this placeholders.
|
||||
* When the path begins with one of the placeholders.
|
||||
*/
|
||||
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
|
||||
|
||||
|
@ -105,7 +105,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* ORM mapping is done in sub classes (like PartAttachment).
|
||||
* ORM mapping is done in subclasses (like PartAttachment).
|
||||
*/
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
|
||||
|
@ -153,7 +153,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
public function isPicture(): bool
|
||||
{
|
||||
//We can not check if a external link is a picture, so just assume this is false
|
||||
//We can not check if an external link is a picture, so just assume this is false
|
||||
if ($this->isExternal()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
* Checks if the attachment file is using a builtin file. (see BUILTIN_PLACEHOLDERS const for possible placeholders)
|
||||
* If a file is built in, the path is shown to user in url field (no sensitive infos are provided).
|
||||
*
|
||||
* @return bool true if the attachment is using an builtin file
|
||||
* @return bool true if the attachment is using a builtin file
|
||||
*/
|
||||
public function isBuiltIn(): bool
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* The URL to the external file, or the path to the built in file.
|
||||
* The URL to the external file, or the path to the built-in file.
|
||||
* Returns null, if the file is not external (and not builtin).
|
||||
*/
|
||||
public function getURL(): ?string
|
||||
|
@ -455,9 +455,9 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
* @param string $string The string which should be checked
|
||||
* @param bool $path_required If true, the string must contain a path to be valid. (e.g. foo.bar would be invalid, foo.bar/test.php would be valid).
|
||||
* @param bool $only_http Set this to true, if only HTTPS or HTTP schemata should be allowed.
|
||||
* *Caution: When this is set to false, a attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
|
||||
* *Caution: When this is set to false, an attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
|
||||
*
|
||||
* @return bool True if the string is a valid URL. False, if the string is not an URL or invalid.
|
||||
* @return bool True if the string is a valid URL. False, if the string is not a URL or invalid.
|
||||
*/
|
||||
public static function isValidURL(string $string, bool $path_required = true, bool $only_http = true): bool
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets an filter, which file types are allowed for attachment files.
|
||||
* Gets a filter, which file types are allowed for attachment files.
|
||||
* Must be in the format of <input type=file> accept attribute
|
||||
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a category element.
|
||||
* An attachment attached to a category element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a footprint element.
|
||||
* An attachment attached to a footprint element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a Group element.
|
||||
* An attachment attached to a Group element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a manufacturer element.
|
||||
* An attachment attached to a manufacturer element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -28,7 +28,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a measurement unit element.
|
||||
* An attachment attached to a measurement unit element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a measurement unit element.
|
||||
* An attachment attached to a measurement unit element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a user element.
|
||||
* An attachment attached to a user element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
|
|
@ -81,7 +81,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
protected int $level = 0;
|
||||
|
||||
/**
|
||||
* We can not define the mapping here or we will get an exception. Unfortunately we have to do the mapping in the
|
||||
* We can not define the mapping here, or we will get an exception. Unfortunately we have to do the mapping in the
|
||||
* subclasses.
|
||||
*
|
||||
* @var AbstractStructuralDBElement[]|Collection
|
||||
|
@ -96,7 +96,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
*/
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/** @var string[] all names of all parent elements as a array of strings,
|
||||
/** @var string[] all names of all parent elements as an array of strings,
|
||||
* the last array element is the name of the element itself
|
||||
*/
|
||||
private array $full_path_strings = [];
|
||||
|
@ -167,7 +167,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Checks if this element is an root element (has no parent).
|
||||
*
|
||||
* @return bool true if the this element is an root element
|
||||
* @return bool true if this element is a root element
|
||||
*/
|
||||
public function isRoot(): bool
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* A entity with this class has a master attachment, which is used as a preview image for this object.
|
||||
* An entity with this class has a master attachment, which is used as a preview image for this object.
|
||||
*/
|
||||
trait MasterAttachmentTrait
|
||||
{
|
||||
|
|
|
@ -27,9 +27,9 @@ use DateTime;
|
|||
interface TimeTravelInterface
|
||||
{
|
||||
/**
|
||||
* Checks if this entry has informations which data has changed.
|
||||
* Checks if this entry has information which data has changed.
|
||||
*
|
||||
* @return bool true if this entry has informations about the changed data
|
||||
* @return bool true if this entry has information about the changed data
|
||||
*/
|
||||
public function hasOldDataInformations(): bool;
|
||||
|
||||
|
@ -39,7 +39,7 @@ interface TimeTravelInterface
|
|||
public function getOldData(): array;
|
||||
|
||||
/**
|
||||
* Returns the the timestamp associated with this change.
|
||||
* Returns the timestamp associated with this change.
|
||||
*/
|
||||
public function getTimestamp(): DateTime;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ use InvalidArgumentException;
|
|||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* This entity describes a entry in the event log.
|
||||
* This entity describes an entry in the event log.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\LogEntryRepository")
|
||||
* @ORM\Table("log", indexes={
|
||||
|
@ -340,7 +340,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* Returns the class name of the target element associated with this log entry.
|
||||
* Returns null, if this log entry is not associated with an log entry.
|
||||
* Returns null, if this log entry is not associated with a log entry.
|
||||
*
|
||||
* @return string|null the class name of the target class
|
||||
*/
|
||||
|
@ -355,7 +355,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* Returns the ID of the target element associated with this log entry.
|
||||
* Returns null, if this log entry is not associated with an log entry.
|
||||
* Returns null, if this log entry is not associated with a log entry.
|
||||
*
|
||||
* @return int|null the ID of the associated element
|
||||
*/
|
||||
|
@ -451,7 +451,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts an target type id to an full qualified class name.
|
||||
* Converts a target type id to a full qualified class name.
|
||||
*
|
||||
* @param int $type_id The target type ID
|
||||
*/
|
||||
|
|
|
@ -86,7 +86,7 @@ use InvalidArgumentException;
|
|||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
* This log entry is created when an element is deleted, that is used in a collection of an other entity.
|
||||
* This log entry is created when an element is deleted, that is used in a collection of another entity.
|
||||
* This is needed to signal time travel, that it has to undelete the deleted entity.
|
||||
*/
|
||||
class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventUndoInterface
|
||||
|
|
|
@ -43,7 +43,7 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
|||
*/
|
||||
public function isSuccessful(): bool
|
||||
{
|
||||
//We dont save unsuccessful updates now, so just assume it to save space.
|
||||
//We don't save unsuccessful updates now, so just assume it to save space.
|
||||
return $this->extra['s'] ?? true;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class LegacyInstockChangedLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the price that has to be payed for the change (in the base currency).
|
||||
* Returns the price that has to be paid for the change (in the base currency).
|
||||
*
|
||||
* @param bool $absolute Set this to true, if you want only get the absolute value of the price (without minus)
|
||||
*/
|
||||
|
@ -92,9 +92,9 @@ class LegacyInstockChangedLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the Change was an withdrawal of parts.
|
||||
* Checks if the Change was a withdrawal of parts.
|
||||
*
|
||||
* @return bool true if the change was an withdrawal, false if not
|
||||
* @return bool true if the change was a withdrawal, false if not
|
||||
*/
|
||||
public function isWithdrawal(): bool
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
* Return the (anonymized) IP address used to log in the user.
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -125,9 +125,9 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
* Sets the IP address used to log in the user.
|
||||
*
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param string $ip the IP address used to log in the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -42,7 +42,7 @@ class UserLoginLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
* Return the (anonymized) IP address used to log in the user.
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -50,9 +50,9 @@ class UserLoginLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
* Sets the IP address used to log in the user.
|
||||
*
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param string $ip the IP address used to log in the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -40,7 +40,7 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
* Return the (anonymized) IP address used to log in the user.
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -48,9 +48,9 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
* Sets the IP address used to log in the user.
|
||||
*
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param string $ip the IP address used to log in the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -139,7 +139,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
protected string $group = '';
|
||||
|
||||
/**
|
||||
* Mapping is done in sub classes.
|
||||
* Mapping is done in subclasses.
|
||||
*
|
||||
* @var AbstractDBElement|null the element to which this parameter belongs to
|
||||
*/
|
||||
|
|
|
@ -47,7 +47,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a category element.
|
||||
* An attachment attached to a category element.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
|
|
|
@ -46,7 +46,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
* Part class.
|
||||
*
|
||||
* The class properties are split over various traits in directory PartTraits.
|
||||
* Otherwise this class would be too big, to be maintained.
|
||||
* Otherwise, this class would be too big, to be maintained.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\PartRepository")
|
||||
* @ORM\Table("`parts`", indexes={
|
||||
|
|
|
@ -130,7 +130,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Check if the current part lot is expired.
|
||||
* This is the case, if the expiration date is greater the the current date.
|
||||
* This is the case, if the expiration date is greater the current date.
|
||||
*
|
||||
* @return bool|null True, if the part lot is expired. Returns null, if no expiration date was set.
|
||||
*
|
||||
|
@ -195,7 +195,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the expiration date for the part lot. Set to null, if the part lot does not expires.
|
||||
* Sets the expiration date for the part lot. Set to null, if the part lot does not expire.
|
||||
*
|
||||
* @param DateTime|null $expiration_date
|
||||
*
|
||||
|
|
|
@ -46,7 +46,7 @@ trait BasicPropertyTrait
|
|||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool Kept for compatibility (it is not used now, and I dont think it was used in old versions)
|
||||
* @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions)
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected bool $visible = true;
|
||||
|
@ -136,7 +136,7 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* Gets the Footprint of this part (e.g. DIP8).
|
||||
*
|
||||
* @return Footprint|null The footprint of this part. Null if this part should no have a footprint.
|
||||
* @return Footprint|null The footprint of this part. Null if this part should not have a footprint.
|
||||
*/
|
||||
public function getFootprint(): ?Footprint
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ trait InstockTrait
|
|||
|
||||
/**
|
||||
* Get the count of parts which must be in stock at least.
|
||||
* If a integer-based part unit is selected, the value will be rounded to integers.
|
||||
* If an integer-based part unit is selected, the value will be rounded to integers.
|
||||
*
|
||||
* @return float count of parts which must be in stock at least
|
||||
*/
|
||||
|
@ -171,7 +171,7 @@ trait InstockTrait
|
|||
//TODO: Find a method to do this natively in SQL, the current method could be a bit slow
|
||||
$sum = 0;
|
||||
foreach ($this->getPartLots() as $lot) {
|
||||
//Dont use the instock value, if it is unkown
|
||||
//Don't use the in stock value, if it is unknown
|
||||
if ($lot->isInstockUnknown() || $lot->isExpired() ?? false) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ trait ProjectTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the project that this part represents the builds of, or null if it doesnt
|
||||
* Returns the project that this part represents the builds of, or null if it doesn't
|
||||
* @return Project|null
|
||||
*/
|
||||
public function getBuiltProject(): ?Project
|
||||
|
|
|
@ -266,9 +266,9 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*
|
||||
* @param BigDecimal $new_price the new price as a float number
|
||||
*
|
||||
* * This is the price for "price_related_quantity" parts!!
|
||||
* * Example: if "price_related_quantity" is '10',
|
||||
* you have to set here the price for 10 parts!
|
||||
* This is the price for "price_related_quantity" parts!!
|
||||
* Example: if "price_related_quantity" is 10,
|
||||
* you have to set here the price for 10 parts!
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* This entity represents an user group.
|
||||
* This entity represents a user group.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("`groups`", indexes={
|
||||
|
@ -64,7 +64,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
protected Collection $users;
|
||||
|
||||
/**
|
||||
* @var bool If true all users associated with this group must have enabled some kind of 2 factor authentication
|
||||
* @var bool If true all users associated with this group must have enabled some kind of two-factor authentication
|
||||
* @ORM\Column(type="boolean", name="enforce_2fa")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
|
|
|
@ -57,7 +57,7 @@ final class PermissionData implements \JsonSerializable
|
|||
|
||||
/**
|
||||
* Creates a new Permission Data Instance using the given data.
|
||||
* By default, a empty array is used, meaning
|
||||
* By default, an empty array is used, meaning
|
||||
*/
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
|
||||
/**
|
||||
* This entity represents a user, which can log in and have permissions.
|
||||
* Also this entity is able to save some informations about the user, like the names, email-address and other info.
|
||||
* Also, this entity is able to save some information about the user, like the names, email-address and other info.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
|
||||
* @ORM\Table("`users`", indexes={
|
||||
|
@ -130,7 +130,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* @var Group|null the group this user belongs to
|
||||
* DO NOT PUT A fetch eager here! Otherwise you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
||||
* DO NOT PUT A fetch eager here! Otherwise, you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="users")
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
|
@ -139,7 +139,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected ?Group $group = null;
|
||||
|
||||
/**
|
||||
* @var string|null The secret used for google authenticator
|
||||
* @var string|null The secret used for Google authenticator
|
||||
* @ORM\Column(name="google_authenticator_secret", type="string", nullable=true)
|
||||
*/
|
||||
protected ?string $googleAuthenticatorSecret = null;
|
||||
|
@ -409,7 +409,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if this user is disabled (user cannot login any more).
|
||||
* Checks if this user is disabled (user cannot log in any more).
|
||||
*
|
||||
* @return bool true, if the user is disabled
|
||||
*/
|
||||
|
@ -516,7 +516,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
public function getFullName(bool $including_username = false): string
|
||||
{
|
||||
$tmp = $this->getFirstName();
|
||||
//Dont add a space, if the name has only one part (it would look strange)
|
||||
//Don't add a space, if the name has only one part (it would look strange)
|
||||
if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
|
||||
$tmp .= ' ';
|
||||
}
|
||||
|
@ -683,9 +683,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
|
||||
/**
|
||||
* Gets the language the user prefers (as 2 letter ISO code).
|
||||
* Gets the language the user prefers (as 2-letter ISO code).
|
||||
*
|
||||
* @return string|null The 2 letter ISO code of the preferred language (e.g. 'en' or 'de').
|
||||
* @return string|null The 2-letter ISO code of the preferred language (e.g. 'en' or 'de').
|
||||
* If null is returned, the user has not specified a language and the server wide language should be used.
|
||||
*/
|
||||
public function getLanguage(): ?string
|
||||
|
@ -696,8 +696,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the language the user prefers.
|
||||
*
|
||||
* @param string|null $language The new language as 2 letter ISO code (e.g. 'en' or 'de').
|
||||
* Set to null, to use the system wide language.
|
||||
* @param string|null $language The new language as 2-letter ISO code (e.g. 'en' or 'de').
|
||||
* Set to null, to use the system-wide language.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
|
@ -744,8 +744,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the theme the user wants to see.
|
||||
*
|
||||
* @param string|null $theme The name of the theme (See See self::AVAILABLE_THEMES for valid values). Set to null
|
||||
* if the system wide theme should be used.
|
||||
* @param string|null $theme The name of the theme (See self::AVAILABLE_THEMES for valid values). Set to null
|
||||
* if the system-wide theme should be used.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -789,7 +789,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the user name that should be shown in Google Authenticator.
|
||||
* Return the username that should be shown in Google Authenticator.
|
||||
*/
|
||||
public function getGoogleAuthenticatorUsername(): string
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Invalidate all trusted device tokens at once, by incrementing the token version.
|
||||
* You have to flush the changes to database afterwards.
|
||||
* You have to flush the changes to database afterward.
|
||||
*/
|
||||
public function invalidateTrustedDeviceTokens(): void
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ use SplFileInfo;
|
|||
|
||||
/**
|
||||
* This listener watches for changes on attachments and deletes the files associated with an attachment, that are not
|
||||
* used any more. This can happens after an attachment is delteted or the path is changed.
|
||||
* used anymore. This can happen after an attachment is deleted or the path is changed.
|
||||
*/
|
||||
class AttachmentDeleteListener
|
||||
{
|
||||
|
|
|
@ -47,12 +47,12 @@ use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
|||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* This event subscriber write to event log when entities are changed, removed, created.
|
||||
* This event subscriber writes to the event log when entities are changed, removed, created.
|
||||
*/
|
||||
class EventLoggerSubscriber implements EventSubscriber
|
||||
{
|
||||
/**
|
||||
* @var array The given fields will not be saved, because they contain sensitive informations
|
||||
* @var array The given fields will not be saved, because they contain sensitive information
|
||||
*/
|
||||
protected const FIELD_BLACKLIST = [
|
||||
User::class => ['password', 'need_pw_change', 'googleAuthenticatorSecret', 'backupCodes', 'trustedDeviceCookieVersion', 'pw_reset_token', 'backupCodesGenerationDate'],
|
||||
|
@ -128,7 +128,7 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
|
||||
public function postPersist(LifecycleEventArgs $args): void
|
||||
{
|
||||
//Create an log entry, we have to do this post persist, cause we have to know the ID
|
||||
//Create a log entry, we have to do this post persist, because we have to know the ID
|
||||
|
||||
/** @var AbstractDBElement $entity */
|
||||
$entity = $args->getObject();
|
||||
|
@ -158,7 +158,7 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
{
|
||||
$em = $args->getObjectManager();
|
||||
$uow = $em->getUnitOfWork();
|
||||
// If the we have added any ElementCreatedLogEntries added in postPersist, we flush them here.
|
||||
// If we have added any ElementCreatedLogEntries added in postPersist, we flush them here.
|
||||
$uow->computeChangeSets();
|
||||
if ($uow->hasPendingInsertions() || !empty($uow->getScheduledEntityUpdates())) {
|
||||
$em->flush();
|
||||
|
@ -196,7 +196,7 @@ class EventLoggerSubscriber implements EventSubscriber
|
|||
}
|
||||
}
|
||||
|
||||
//By default allow every field.
|
||||
//By default, allow every field.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
|||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
/**
|
||||
* Write to event log when a user tries to access an forbidden page and recevies an 403 Access Denied message.
|
||||
* Write to event log when a user tries to access a forbidden page and receives an 403 Access Denied message.
|
||||
*/
|
||||
class LogAccessDeniedSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
* This subscriber writes entries to log if an security related event happens (e.g. the user changes its password).
|
||||
* This subscriber writes entries to log if a security related event happens (e.g. the user changes its password).
|
||||
*/
|
||||
final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
|||
$ip = $request->getClientIp() ?? 'unknown';
|
||||
} else {
|
||||
$ip = 'Console';
|
||||
//Dont try to apply IP filter rules to non numeric string
|
||||
//Don't try to apply IP filter rules to non-numeric string
|
||||
$anonymize = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
||||
|
||||
/**
|
||||
* This subscriber sets an Header in Debug mode that signals the Symfony Profiler to also update on Ajax requests.
|
||||
* This subscriber sets a Header in Debug mode that signals the Symfony Profiler to also update on Ajax requests.
|
||||
*/
|
||||
final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ use Symfony\Component\Security\Http\SecurityEvents;
|
|||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* This event listener shows an login successful flash to the user after login and write the login to event log.
|
||||
* This event listener shows a login successful flash to the user after login and write the login to event log.
|
||||
*/
|
||||
final class LoginSuccessSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
|
|
@ -31,8 +31,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* This subscriber is used to log out a disabled user, as soon as he to do an request.
|
||||
* It is not possible for him to login again, afterwards.
|
||||
* This subscriber is used to log out a disabled user, as soon as he to do a request.
|
||||
* It is not possible for him to login again, afterward.
|
||||
*/
|
||||
final class LogoutDisabledUserSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ final class LogoutDisabledUserSubscriber implements EventSubscriberInterface
|
|||
{
|
||||
$user = $this->security->getUser();
|
||||
if ($user instanceof User && $user->isDisabled()) {
|
||||
//Redirect to login
|
||||
//Redirect to log in
|
||||
$response = new RedirectResponse($this->urlGenerator->generate('logout'));
|
||||
$event->setResponse($response);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
|
|||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* The purpose of this event subscriber is to check if the permission schema of the current user is up to date and upgrade it automatically if needed.
|
||||
* The purpose of this event subscriber is to check if the permission schema of the current user is up-to-date and upgrade it automatically if needed.
|
||||
*/
|
||||
class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ use Symfony\Contracts\EventDispatcher\Event;
|
|||
|
||||
/**
|
||||
* This event is triggered when something security related to a user happens.
|
||||
* For example when the password is reset or the an two factor authentication method was disabled.
|
||||
* For example when the password is reset or the two-factor authentication method was disabled.
|
||||
*/
|
||||
class SecurityEvent extends Event
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ class CollectionTypeExtension extends AbstractTypeExtension
|
|||
|
||||
/**
|
||||
* Set the option of the form.
|
||||
* This a bit hacky cause we access private properties....
|
||||
* This a bit hacky because we access private properties....
|
||||
*
|
||||
*/
|
||||
public function setOption(FormConfigInterface $builder, string $option, $value): void
|
||||
|
@ -175,7 +175,7 @@ class CollectionTypeExtension extends AbstractTypeExtension
|
|||
throw new \RuntimeException('This method only works with FormConfigBuilder instances.');
|
||||
}
|
||||
|
||||
//We have to use FormConfigBuilder::class here, because options is private and not available in sub classes
|
||||
//We have to use FormConfigBuilder::class here, because options is private and not available in subclasses
|
||||
$reflection = new ReflectionClass(FormConfigBuilder::class);
|
||||
$property = $reflection->getProperty('options');
|
||||
$property->setAccessible(true);
|
||||
|
|
|
@ -47,7 +47,7 @@ class NumberConstraintType extends AbstractType
|
|||
$resolver->setDefaults([
|
||||
'compound' => true,
|
||||
'data_class' => NumberConstraint::class,
|
||||
'text_suffix' => '', // An suffix which is attached as text-append to the input group. This can for example be used for units
|
||||
'text_suffix' => '', // A suffix which is attached as text-append to the input group. This can for example be used for units
|
||||
|
||||
'min' => null,
|
||||
'max' => null,
|
||||
|
|
|
@ -68,7 +68,6 @@ class ParameterConstraintType extends AbstractType
|
|||
* Ensure that the data is never null, but use an empty ParameterConstraint instead
|
||||
*/
|
||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
|
||||
$form = $event->getForm();
|
||||
$data = $event->getData();
|
||||
|
||||
if ($data === null) {
|
||||
|
|
|
@ -36,7 +36,7 @@ class StructuralEntityConstraintType extends AbstractType
|
|||
$resolver->setDefaults([
|
||||
'compound' => true,
|
||||
'data_class' => EntityConstraint::class,
|
||||
'text_suffix' => '', // An suffix which is attached as text-append to the input group. This can for example be used for units
|
||||
'text_suffix' => '', // A suffix which is attached as text-append to the input group. This can for example be used for units
|
||||
]);
|
||||
|
||||
$resolver->setRequired('entity_class');
|
||||
|
|
|
@ -36,7 +36,7 @@ class UserEntityConstraintType extends AbstractType
|
|||
$resolver->setDefaults([
|
||||
'compound' => true,
|
||||
'data_class' => EntityConstraint::class,
|
||||
'text_suffix' => '', // An suffix which is attached as text-append to the input group. This can for example be used for units
|
||||
'text_suffix' => '', //A suffix which is attached as text-append to the input group. This can for example be used for units
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class CurrencyEntityType extends StructuralEntityType
|
|||
});
|
||||
|
||||
$resolver->setDefault('empty_message', function (Options $options) {
|
||||
//By default we use the global base currency:
|
||||
//By default, we use the global base currency:
|
||||
$iso_code = $this->base_currency;
|
||||
|
||||
if ($options['base_currency']) { //Allow to override it
|
||||
|
@ -75,7 +75,7 @@ class CurrencyEntityType extends StructuralEntityType
|
|||
|
||||
$resolver->setDefault('used_to_select_parent', false);
|
||||
|
||||
//If short is set to true, then the name of the entity will only shown in the dropdown list not in the selected value.
|
||||
//If short is set to true, then the name of the entity will only show in the dropdown list not in the selected value.
|
||||
$resolver->setDefault('short', false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,8 +147,8 @@ class StructuralEntityChoiceHelper
|
|||
|
||||
/**
|
||||
* Do not change the structure below, even when inspection says it can be replaced with a null coalescing operator.
|
||||
* It is important that the value returned here for a existing element is an int, and for a new element a string.
|
||||
* I dont really understand why, but it seems to be important for the choice_loader to work correctly.
|
||||
* It is important that the value returned here for an existing element is an int, and for a new element a string.
|
||||
* I don't really understand why, but it seems to be important for the choice_loader to work correctly.
|
||||
* So please do not change this!
|
||||
*/
|
||||
if ($element->getID() === null) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class PartSelectType extends AbstractType implements DataMapperInterface
|
|||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
//At initialization we have to fill the form element with our selected data, so the user can see it
|
||||
//At initialization, we have to fill the form element with our selected data, so the user can see it
|
||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) {
|
||||
$form = $event->getForm();
|
||||
$config = $form->getConfig()->getOptions();
|
||||
|
|
|
@ -118,7 +118,7 @@ class StructuralEntityType extends AbstractType
|
|||
'choice_translation_domain' => false, //Don't translate the entity names
|
||||
]);
|
||||
|
||||
//Set the constraints for the case that allow add is enabled (we then have to check that the new element is valid)
|
||||
//Set the constraints for the case that allow to add is enabled (we then have to check that the new element is valid)
|
||||
$resolver->setNormalizer('constraints', function (Options $options, $value) {
|
||||
if ($options['allow_add']) {
|
||||
$value[] = new Valid();
|
||||
|
@ -159,8 +159,8 @@ class StructuralEntityType extends AbstractType
|
|||
public function modelReverseTransform($value, array $options)
|
||||
{
|
||||
/* This step is important in combination with the caching!
|
||||
The elements deserialized from cache, are not known to Doctrinte ORM any more, so doctrine thinks,
|
||||
that the entity has changed (and so throws an exception about non-persited entities).
|
||||
The elements deserialized from cache, are not known to Doctrine ORM anymore, so doctrine thinks,
|
||||
that the entity has changed (and so throws an exception about non-persisted entities).
|
||||
This function just retrieves a fresh copy of the entity from database, so doctrine detect correctly that no
|
||||
change happened.
|
||||
The performance impact of this should be very small in comparison of the boost, caused by the caching.
|
||||
|
|
|
@ -175,7 +175,7 @@ final class ProjectBuildRequest
|
|||
|
||||
/**
|
||||
* Returns the amount of parts that should be withdrawn from the given lot for the corresponding BOM entry.
|
||||
* @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdraw amount should be get
|
||||
* @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got
|
||||
* @return float
|
||||
*/
|
||||
public function getLotWithdrawAmount($lot): float
|
||||
|
@ -197,7 +197,7 @@ final class ProjectBuildRequest
|
|||
|
||||
/**
|
||||
* Sets the amount of parts that should be withdrawn from the given lot for the corresponding BOM entry.
|
||||
* @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdraw amount should be get
|
||||
* @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got
|
||||
* @param float $amount
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -267,7 +267,7 @@ final class ProjectBuildRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the list of all bom entries that have to be build.
|
||||
* Returns the list of all bom entries that have to be built.
|
||||
* @return ProjectBOMEntry[]
|
||||
*/
|
||||
public function getBomEntries(): array
|
||||
|
@ -276,7 +276,7 @@ final class ProjectBuildRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the all part bom entries that have to be build.
|
||||
* Returns the all part bom entries that have to be built.
|
||||
* @return ProjectBOMEntry[]
|
||||
*/
|
||||
public function getPartBomEntries(): array
|
||||
|
|
|
@ -76,7 +76,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the legacy Part-DB version number. Returns 0, if target database is not an legacy Part-DB database.
|
||||
* Gets the legacy Part-DB version number. Returns 0, if target database is not a legacy Part-DB database.
|
||||
*/
|
||||
public function getOldDBVersion(): int
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration
|
|||
}
|
||||
}
|
||||
|
||||
//As we dont have access to container, just use the default PHP pw hash function
|
||||
//As we don't have access to container, just use the default PHP pw hash function
|
||||
return password_hash($this->admin_pw, PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class AttachmentRepository extends DBElementRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the count of all external attachments (attachments only containing an URL).
|
||||
* Gets the count of all external attachments (attachments only containing a URL).
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
@ -80,7 +80,7 @@ class AttachmentRepository extends DBElementRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the count of all attachments where an user uploaded an file.
|
||||
* Gets the count of all attachments where a user uploaded a file.
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
|
|
@ -100,7 +100,7 @@ class LogEntryRepository extends DBElementRepository
|
|||
* Gets all log entries that are related to time travelling.
|
||||
*
|
||||
* @param AbstractDBElement $element The element for which the time travel data should be retrieved
|
||||
* @param DateTime $until Back to which timestamp should the data be get (including the timestamp)
|
||||
* @param DateTime $until Back to which timestamp should the data be got (including the timestamp)
|
||||
*
|
||||
* @return AbstractLogEntry[]
|
||||
*/
|
||||
|
|
|
@ -47,7 +47,7 @@ class NamedDBElementRepository extends DBElementRepository
|
|||
|
||||
if ($entity instanceof User) {
|
||||
if ($entity->isDisabled()) {
|
||||
//If this is an user, then add a badge when it is disabled
|
||||
//If this is a user, then add a badge when it is disabled
|
||||
$node->setIcon('fa-fw fa-treeview fa-solid fa-user-lock text-muted');
|
||||
}
|
||||
if ($entity->isSamlUser()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||
class PartRepository extends NamedDBElementRepository
|
||||
{
|
||||
/**
|
||||
* Gets the summed up instock of all parts (only parts without an measurent unit).
|
||||
* Gets the summed up instock of all parts (only parts without a measurement unit).
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
@ -49,7 +49,7 @@ class PartRepository extends NamedDBElementRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the number of parts that has price informations.
|
||||
* Gets the number of parts that has price information.
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
|
|
@ -88,7 +88,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
|
|||
$recursiveIterator = new RecursiveIteratorIterator($elementIterator, RecursiveIteratorIterator::SELF_FIRST);
|
||||
//$result = iterator_to_array($recursiveIterator);
|
||||
|
||||
//We can not use iterator_to_array here or we get only the parent elements
|
||||
//We can not use iterator_to_array here, or we get only the parent elements
|
||||
foreach ($recursiveIterator as $item) {
|
||||
$result[] = $item;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ final class UserChecker implements UserCheckerInterface
|
|||
return;
|
||||
}
|
||||
|
||||
//Check if user is disabled. Then dont allow login
|
||||
//Check if user is disabled. Then don't allow login
|
||||
if ($user->isDisabled()) {
|
||||
//throw new DisabledException();
|
||||
throw new CustomUserMessageAccountStatusException($this->translator->trans('user.login_error.user_disabled', [], 'security'));
|
||||
|
|
|
@ -69,7 +69,7 @@ class StructureVoter extends ExtendedVoter
|
|||
}
|
||||
|
||||
/**
|
||||
* Maps a instance type to the permission name.
|
||||
* Maps an instance type to the permission name.
|
||||
*
|
||||
* @param object|string $subject The subject for which the permission name should be generated
|
||||
*
|
||||
|
|
|
@ -80,7 +80,7 @@ class UserVoter extends ExtendedVoter
|
|||
}
|
||||
}
|
||||
|
||||
//Else just check users permission:
|
||||
//Else just check user permission:
|
||||
if ($this->resolver->isValidOperation('users', $attribute)) {
|
||||
return $this->resolver->inherit($user, 'users', $attribute) ?? false;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class StructuralElementDenormalizer implements ContextAwareDenormalizerInterface
|
|||
{
|
||||
return is_array($data)
|
||||
&& is_subclass_of($type, AbstractStructuralDBElement::class)
|
||||
//Only denormalize if we are doing an file import operation
|
||||
//Only denormalize if we are doing a file import operation
|
||||
&& in_array('import', $context['groups'] ?? [], true);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class StructuralElementDenormalizer implements ContextAwareDenormalizerInterface
|
|||
|
||||
//Check if we have created the entity in this request before (so we don't create multiple entities for the same path)
|
||||
//Entities get saved in the cache by type and path
|
||||
//We use a different cache for this then the objects created by a string value (saved in repo). However that should not be a problem
|
||||
//We use a different cache for this then the objects created by a string value (saved in repo). However, that should not be a problem
|
||||
//unless the user data has mixed structure between json data and a string path
|
||||
if (isset($this->object_cache[$type][$path])) {
|
||||
return $this->object_cache[$type][$path];
|
||||
|
|
|
@ -69,7 +69,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, Ca
|
|||
|
||||
public function hasCacheableSupportsMethod(): bool
|
||||
{
|
||||
//Must be false, because we do a is_string check on data in supportsDenormalization
|
||||
//Must be false, because we do an is_string check on data in supportsDenormalization
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -140,7 +140,7 @@ class AttachmentManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a human readable version of the attachment file size.
|
||||
* Returns a human-readable version of the attachment file size.
|
||||
* For external attachments, null is returned.
|
||||
*
|
||||
* @param int $decimals The number of decimals numbers that should be printed
|
||||
|
|
|
@ -30,7 +30,7 @@ use SplFileInfo;
|
|||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* This service provides functions to find attachments via an reverse search based on a file.
|
||||
* This service provides functions to find attachments via a reverse search based on a file.
|
||||
*/
|
||||
class AttachmentReverseSearch
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ class AttachmentReverseSearch
|
|||
*
|
||||
* @param SplFileInfo $file The file for which is searched
|
||||
*
|
||||
* @return Attachment[] an list of attachments that use the given file
|
||||
* @return Attachment[] a list of attachments that use the given file
|
||||
*/
|
||||
public function findAttachmentsByFile(SplFileInfo $file): array
|
||||
{
|
||||
|
@ -75,11 +75,11 @@ class AttachmentReverseSearch
|
|||
* @param SplFileInfo $file The file that should be removed
|
||||
* @param int $threshold the threshold used, to determine if a file should be deleted or not
|
||||
*
|
||||
* @return bool True, if the file was delete. False if not.
|
||||
* @return bool True, if the file was deleted. False if not.
|
||||
*/
|
||||
public function deleteIfNotUsed(SplFileInfo $file, int $threshold = 1): bool
|
||||
{
|
||||
/* When the file is used more then $threshold times, don't delete it */
|
||||
/* When the file is used more than $threshold times, don't delete it */
|
||||
if (count($this->findAttachmentsByFile($file)) > $threshold) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class AttachmentSubmitHandler
|
|||
*/
|
||||
public function isValidFileExtension(AttachmentType $attachment_type, UploadedFile $uploadedFile): bool
|
||||
{
|
||||
//Only validate if the attachment type has specified an filetype filter:
|
||||
//Only validate if the attachment type has specified a filetype filter:
|
||||
if (empty($attachment_type->getFiletypeFilter())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -121,10 +121,10 @@ class AttachmentSubmitHandler
|
|||
|
||||
/**
|
||||
* Generates a filename for the given attachment and extension.
|
||||
* The filename contains a random id, so every time this function is called you get an unique name.
|
||||
* The filename contains a random id, so every time this function is called you get a unique name.
|
||||
*
|
||||
* @param Attachment $attachment The attachment that should be used for generating an attachment
|
||||
* @param string $extension The extension that the new file should have (must only contain chars allowed in pathes)
|
||||
* @param string $extension The extension that the new file should have (must only contain chars allowed in paths)
|
||||
*
|
||||
* @return string the new filename
|
||||
*/
|
||||
|
@ -136,7 +136,7 @@ class AttachmentSubmitHandler
|
|||
$extension
|
||||
);
|
||||
|
||||
//Use the (sanatized) attachment name as an filename part
|
||||
//Use the (sanatized) attachment name as a filename part
|
||||
$safeName = transliterator_transliterate(
|
||||
'Any-Latin; Latin-ASCII; [^A-Za-z0-9_] remove; Lower()',
|
||||
$attachment->getName()
|
||||
|
@ -177,12 +177,12 @@ class AttachmentSubmitHandler
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle the submit of an attachment form.
|
||||
* Handle submission of an attachment form.
|
||||
* This function will move the uploaded file or download the URL file to server, if needed.
|
||||
*
|
||||
* @param Attachment $attachment the attachment that should be used for handling
|
||||
* @param UploadedFile|null $file If given, that file will be moved to the right location
|
||||
* @param array $options The options to use with the upload. Here you can specify that an URL should be downloaded,
|
||||
* @param array $options The options to use with the upload. Here you can specify that a URL should be downloaded,
|
||||
* or an file should be moved to a secure location.
|
||||
*
|
||||
* @return Attachment The attachment with the new filename (same instance as passed $attachment)
|
||||
|
@ -219,7 +219,7 @@ class AttachmentSubmitHandler
|
|||
}
|
||||
|
||||
/**
|
||||
* Rename attachments with an unsafe extension (meaning files which would be runned by a to a safe one.
|
||||
* Rename attachments with an unsafe extension (meaning files which would be run by a to a safe one).
|
||||
* @param Attachment $attachment
|
||||
* @return Attachment
|
||||
*/
|
||||
|
@ -261,7 +261,7 @@ class AttachmentSubmitHandler
|
|||
$resolver->setDefaults([
|
||||
//If no preview image was set yet, the new uploaded file will become the preview image
|
||||
'become_preview_if_empty' => true,
|
||||
//When an URL is given download the URL
|
||||
//When a URL is given download the URL
|
||||
'download_url' => false,
|
||||
'secure_attachment' => false,
|
||||
]);
|
||||
|
@ -357,17 +357,17 @@ class AttachmentSubmitHandler
|
|||
|
||||
//File download should be finished here, so determine the new filename and extension
|
||||
$headers = $response->getHeaders();
|
||||
//Try to determine an filename
|
||||
//Try to determine a filename
|
||||
$filename = '';
|
||||
|
||||
//If an content disposition header was set try to extract the filename out of it
|
||||
//If a content disposition header was set try to extract the filename out of it
|
||||
if (isset($headers['content-disposition'])) {
|
||||
$tmp = [];
|
||||
preg_match('/[^;\\n=]*=([\'\"])*(.*)(?(1)\1|)/', $headers['content-disposition'][0], $tmp);
|
||||
$filename = $tmp[2];
|
||||
}
|
||||
|
||||
//If we dont know filename yet, try to determine it out of url
|
||||
//If we don't know filename yet, try to determine it out of url
|
||||
if ('' === $filename) {
|
||||
$filename = basename(parse_url($url, PHP_URL_PATH));
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ class AttachmentSubmitHandler
|
|||
//Set original file
|
||||
$attachment->setFilename($filename);
|
||||
|
||||
//Check if we have a extension given
|
||||
//Check if we have an extension given
|
||||
$pathinfo = pathinfo($filename);
|
||||
if (!empty($pathinfo['extension'])) {
|
||||
$new_ext = $pathinfo['extension'];
|
||||
|
|
|
@ -57,7 +57,7 @@ class AttachmentURLGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts the absolute file path to a version relative to the public folder, that can be passed to asset
|
||||
* Converts the absolute file path to a version relative to the public folder, that can be passed to the
|
||||
* Asset Component functions.
|
||||
*
|
||||
* @param string $absolute_path the absolute path that should be converted
|
||||
|
@ -77,7 +77,7 @@ class AttachmentURLGenerator
|
|||
$public_path = $this->public_path;
|
||||
}
|
||||
|
||||
//Our absolute path must begin with public path or we can not use it for asset pathes.
|
||||
//Our absolute path must begin with public path, or we can not use it for asset pathes.
|
||||
if (0 !== strpos($absolute_path, $public_path)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class AttachmentURLGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a placeholder path to a path to a image path.
|
||||
* Converts a placeholder path to a path to an image path.
|
||||
*
|
||||
* @param string $placeholder_path the placeholder path that should be converted
|
||||
*/
|
||||
|
@ -120,7 +120,7 @@ class AttachmentURLGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a URL to an thumbnail of the attachment file.
|
||||
* Returns a URL to a thumbnail of the attachment file.
|
||||
* @return string|null The URL or null if the attachment file is not existing
|
||||
*/
|
||||
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string
|
||||
|
@ -155,7 +155,7 @@ class AttachmentURLGenerator
|
|||
//So we remove the schema manually
|
||||
return preg_replace('/^https?:/', '', $tmp);
|
||||
} catch (\Imagine\Exception\RuntimeException $e) {
|
||||
//If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning
|
||||
//If the filter fails, we can not serve the thumbnail and fall back to the original image and log a warning
|
||||
$this->logger->warning('Could not open thumbnail for attachment with ID ' . $attachment->getID() . ': ' . $e->getMessage());
|
||||
return $this->assets->getUrl($asset_path);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use Symfony\Contracts\Cache\CacheInterface;
|
|||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
|
||||
/**
|
||||
* An servive that helps working with filetype filters (based on the format <input type=file> accept uses.
|
||||
* A service that helps to work with filetype filters (based on the format <input type=file> accept uses).
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers for
|
||||
* more details.
|
||||
*/
|
||||
|
|
|
@ -80,7 +80,7 @@ class ElementTypeNameGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets an localized label for the type of the entity.
|
||||
* Gets a localized label for the type of the entity.
|
||||
* A part element becomes "Part" ("Bauteil" in german) and a category object becomes "Category".
|
||||
* Useful when the type should be shown to user.
|
||||
* Throws an exception if the class is not supported.
|
||||
|
@ -95,7 +95,7 @@ class ElementTypeNameGenerator
|
|||
{
|
||||
$class = is_string($entity) ? $entity : get_class($entity);
|
||||
|
||||
//Check if we have an direct array entry for our entity class, then we can use it
|
||||
//Check if we have a direct array entry for our entity class, then we can use it
|
||||
if (isset($this->mapping[$class])) {
|
||||
return $this->mapping[$class];
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ use Symfony\Component\OptionsResolver\Options;
|
|||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* This service formats an part amout using a Measurement Unit.
|
||||
* This service formats a part amount using a Measurement Unit.
|
||||
*/
|
||||
class AmountFormatter
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ class AmountFormatter
|
|||
//Otherwise just output it
|
||||
if (!empty($options['unit'])) {
|
||||
$format_string = '%.'.$options['decimals'].'f '.$options['unit'];
|
||||
} else { //Dont add space after number if no unit was specified
|
||||
} else { //Don't add space after number if no unit was specified
|
||||
$format_string = '%.'.$options['decimals'].'f';
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ class AmountFormatter
|
|||
$resolver->setAllowedTypes('decimals', 'int');
|
||||
|
||||
$resolver->setNormalizer('decimals', static function (Options $options, $value) {
|
||||
// If the unit is integer based, then dont show any decimals
|
||||
// If the unit is integer based, then don't show any decimals
|
||||
if ($options['is_integer']) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace App\Services\Formatters;
|
|||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* This class allows you to convert markdown text to HTML.
|
||||
* This class allows you to convert Markdown text to HTML.
|
||||
*/
|
||||
class MarkdownParser
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ class MarkdownParser
|
|||
* Mark the markdown for rendering.
|
||||
* The rendering of markdown is done on client side.
|
||||
*
|
||||
* @param string $markdown the markdown text that should be parsed to html
|
||||
* @param string $markdown the Markdown text that should be parsed to html
|
||||
* @param bool $inline_mode When true, p blocks will have no margins behind them
|
||||
*
|
||||
* @return string the markdown in a version that can be parsed on client side
|
||||
|
|
|
@ -38,7 +38,7 @@ class MoneyFormatter
|
|||
}
|
||||
|
||||
/**
|
||||
* Format the the given value in the given currency.
|
||||
* Format the given value in the given currency.
|
||||
*
|
||||
* @param string|float $value the value that should be formatted
|
||||
* @param Currency|null $currency The currency that should be used for formatting. If null the global one is used
|
||||
|
|
|
@ -45,7 +45,7 @@ class SIFormatter
|
|||
*
|
||||
* @param int $magnitude the magnitude for which the prefix should be determined
|
||||
*
|
||||
* @return array A array, containing the divisor in first element, and the prefix symbol in second. For example, [1000, "k"].
|
||||
* @return array An array, containing the divisor in first element, and the prefix symbol in second. For example, [1000, "k"].
|
||||
*/
|
||||
public function getPrefixByMagnitude(int $magnitude): array
|
||||
{
|
||||
|
|
|
@ -74,7 +74,6 @@ class EntityExporter
|
|||
}
|
||||
|
||||
//Ensure that all entities are of type AbstractNamedDBElement
|
||||
$entity_type = null;
|
||||
foreach ($entities as $entity) {
|
||||
if (!$entity instanceof AbstractNamedDBElement) {
|
||||
throw new InvalidArgumentException('All entities must be of type AbstractNamedDBElement!');
|
||||
|
|
|
@ -50,7 +50,7 @@ trait PKImportHelperTrait
|
|||
*/
|
||||
protected function convertAttachmentDataToEntity(array $attachment_row, string $target_class, string $type): Attachment
|
||||
{
|
||||
//By default we use the cached version
|
||||
//By default, we use the cached version
|
||||
if (!$this->import_attachment_type) {
|
||||
//Get the import attachment type
|
||||
$this->import_attachment_type = $this->em->getRepository(AttachmentType::class)->findOneBy([
|
||||
|
@ -103,7 +103,7 @@ trait PKImportHelperTrait
|
|||
/**
|
||||
* Imports the attachments from the given data
|
||||
* @param array $data The PartKeepr database
|
||||
* @param string $table_name The table name for the attachments (if it contain "image", it will be treated as an image)
|
||||
* @param string $table_name The table name for the attachments (if it contains "image", it will be treated as an image)
|
||||
* @param string $target_class The target class (e.g. Part)
|
||||
* @param string $target_id_field The field name where the target ID is stored
|
||||
* @param string $attachment_class The attachment class (e.g. PartAttachment)
|
||||
|
|
|
@ -30,7 +30,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
||||
|
||||
/**
|
||||
* This service is used to other non mandatory data from a PartKeepr export.
|
||||
* This service is used to other non-mandatory data from a PartKeepr export.
|
||||
* You have to import the datastructures and parts first to use project import!
|
||||
*/
|
||||
class PKOptionalImporter
|
||||
|
|
|
@ -106,7 +106,7 @@ final class LabelGenerator
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts width and height given in mm to an size array, that can be used by DOMPDF for page size.
|
||||
* Converts width and height given in mm to a size array, that can be used by DOMPDF for page size.
|
||||
*
|
||||
* @param float $width The width of the paper
|
||||
* @param float $height The height of the paper
|
||||
|
|
|
@ -70,7 +70,7 @@ final class LabelProfileDropdownHelper
|
|||
$repo = $this->entityManager->getRepository(LabelProfile::class);
|
||||
|
||||
return $this->cache->get($key, function (ItemInterface $item) use ($repo, $type, $secure_class_name) {
|
||||
// Invalidate when groups, a element with the class or the user changes
|
||||
// Invalidate when groups, an element with the class or the user changes
|
||||
$item->tag(['groups', 'tree_treeview', $this->keyGenerator->generateKey(), $secure_class_name]);
|
||||
|
||||
return $repo->getDropdownProfiles($type);
|
||||
|
|
|
@ -101,12 +101,12 @@ class EventLogger
|
|||
return true;
|
||||
}
|
||||
|
||||
//If the normal log function does not added the log entry, we just do nothing
|
||||
//If the normal log function does not get added to the log entry, we just do nothing
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given log entry to the Log, if the entry fullfills the global configured criterias and flush afterwards.
|
||||
* Adds the given log entry to the Log, if the entry fulfills the global configured criteria and flush afterward.
|
||||
*
|
||||
* @return bool returns true, if the event was added to log
|
||||
*/
|
||||
|
@ -129,12 +129,12 @@ class EventLogger
|
|||
$blacklist = $blacklist ?? $this->blacklist;
|
||||
$whitelist = $whitelist ?? $this->whitelist;
|
||||
|
||||
//Dont add the entry if it does not reach the minimum level
|
||||
//Don't add the entry if it does not reach the minimum level
|
||||
if ($logEntry->getLevel() > $minimum_log_level) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check if the event type is black listed
|
||||
//Check if the event type is blacklisted
|
||||
if (!empty($blacklist) && $this->isObjectClassInArray($logEntry, $blacklist)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class EventLogger
|
|||
return false;
|
||||
}
|
||||
|
||||
// By default all things should be added
|
||||
// By default, all things should be added
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class EventUndoHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Clear the currently the set undone event.
|
||||
* Clear the currently set undone event.
|
||||
*/
|
||||
public function clearUndoneEvent(): void
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ class EventUndoHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a event is undone.
|
||||
* Check if an event is undone.
|
||||
*/
|
||||
public function isUndo(): bool
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ class LogEntryExtraFormatter
|
|||
}
|
||||
|
||||
/**
|
||||
* Return an user viewable representation of the extra data in a log entry, styled for console output.
|
||||
* Return a user viewable representation of the extra data in a log entry, styled for console output.
|
||||
*/
|
||||
public function formatConsole(AbstractLogEntry $logEntry): string
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ class LogEntryExtraFormatter
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a HTML formatted string containing a user viewable form of the Extra data.
|
||||
* Return an HTML formatted string containing a user viewable form of the Extra data.
|
||||
*/
|
||||
public function format(AbstractLogEntry $context): string
|
||||
{
|
||||
|
|
|
@ -136,7 +136,7 @@ class TimeTravel
|
|||
continue;
|
||||
}
|
||||
|
||||
//Revert many to one association (one element in property)
|
||||
//Revert many-to-one association (one element in property)
|
||||
if (
|
||||
ClassMetadataInfo::MANY_TO_ONE === $mapping['type']
|
||||
|| ClassMetadataInfo::ONE_TO_ONE === $mapping['type']
|
||||
|
@ -156,7 +156,7 @@ class TimeTravel
|
|||
}
|
||||
foreach ($target_elements as $target_element) {
|
||||
if (null !== $target_element && $element->getLastModified() >= $timestamp) {
|
||||
//Remove the element from collection, if it did not existed at $timestamp
|
||||
//Remove the element from collection, if it did not exist at $timestamp
|
||||
if (!$this->repo->getElementExistedAtTimestamp(
|
||||
$target_element,
|
||||
$timestamp
|
||||
|
|
|
@ -93,7 +93,7 @@ class ParameterExtractor
|
|||
[, $name, $value] = $matches;
|
||||
$value = trim($value);
|
||||
|
||||
//Dont allow empty names or values (these are a sign of an invalid extracted string)
|
||||
//Don't allow empty names or values (these are a sign of an invalid extracted string)
|
||||
if (empty($name) || empty($value)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -153,13 +153,13 @@ class PricedetailHelper
|
|||
foreach ($orderdetails as $orderdetail) {
|
||||
$pricedetail = $orderdetail->findPriceForQty($amount);
|
||||
|
||||
//When we dont have informations about this amount, ignore it
|
||||
//When we don't have information about this amount, ignore it
|
||||
if (null === $pricedetail) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$converted = $this->convertMoneyToCurrency($pricedetail->getPricePerUnit(), $pricedetail->getCurrency(), $currency);
|
||||
//Ignore price informations that can not be converted to base currency.
|
||||
//Ignore price information that can not be converted to base currency.
|
||||
if (null !== $converted) {
|
||||
$avg = $avg->plus($converted);
|
||||
++$count;
|
||||
|
|
|
@ -79,7 +79,7 @@ class ProjectBuildHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the given project can be build with the current stock.
|
||||
* Checks if the given project can be built with the current stock.
|
||||
* This means that the maximum buildable count is greater or equal than the requested $number_of_projects
|
||||
* @param Project $project
|
||||
* @parm int $number_of_builds
|
||||
|
@ -91,7 +91,7 @@ class ProjectBuildHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if the given BOM entry can be build with the current stock.
|
||||
* Check if the given BOM entry can be built with the current stock.
|
||||
* This means that the maximum buildable count is greater or equal than the requested $number_of_projects
|
||||
* @param ProjectBOMEntry $bom_entry
|
||||
* @param int $number_of_builds
|
||||
|
@ -137,7 +137,7 @@ class ProjectBuildHelper
|
|||
/**
|
||||
* Withdraw the parts from the stock using the given ProjectBuildRequest and create the build parts entries, if needed.
|
||||
* The ProjectBuildRequest has to be validated before!!
|
||||
* You have to flush changes to DB afterwards
|
||||
* You have to flush changes to DB afterward
|
||||
* @param ProjectBuildRequest $buildRequest
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,7 @@ class StatisticsHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the number of all parts which have price informations.
|
||||
* Returns the number of all parts which have price information.
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
@ -147,7 +147,7 @@ class StatisticsHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the count of all external (only containing an URL) attachments.
|
||||
* Gets the count of all external (only containing a URL) attachments.
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
@ -158,7 +158,7 @@ class StatisticsHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the count of all attachments where the user uploaded an file.
|
||||
* Gets the count of all attachments where the user uploaded a file.
|
||||
*
|
||||
* @throws NoResultException
|
||||
* @throws NonUniqueResultException
|
||||
|
|
|
@ -59,7 +59,7 @@ class TagFinder
|
|||
|
||||
$options = $resolver->resolve($options);
|
||||
|
||||
//If the keyword is too short we will get to much results, which takes too much time...
|
||||
//If the keyword is too short we will get too much results, which takes too much time...
|
||||
if (mb_strlen($keyword) < $options['min_keyword_length']) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ final class PermissionExtractor implements ExtractorInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the prefix that should be used for new found messages.
|
||||
* Sets the prefix that should be used for new-found messages.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
*/
|
||||
|
|
|
@ -62,7 +62,7 @@ class NodesListBuilder
|
|||
$key = 'list_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.$parent_id;
|
||||
|
||||
return $this->cache->get($key, function (ItemInterface $item) use ($class_name, $parent, $secure_class_name) {
|
||||
// Invalidate when groups, a element with the class or the user changes
|
||||
// Invalidate when groups, an element with the class or the user changes
|
||||
$item->tag(['groups', 'tree_list', $this->keyGenerator->generateKey(), $secure_class_name]);
|
||||
/** @var StructuralDBElementRepository $repo */
|
||||
$repo = $this->em->getRepository($class_name);
|
||||
|
|
|
@ -35,7 +35,7 @@ class StructuralElementRecursionHelper
|
|||
}
|
||||
|
||||
/**
|
||||
* Executes an function (callable) recursivly for $element and every of its children.
|
||||
* Executes a function (callable) recursivly for $element and every of its children.
|
||||
*
|
||||
* @param AbstractStructuralDBElement $element The element on which the func should be executed
|
||||
* @param callable $func The function which should be executed for each element.
|
||||
|
|
|
@ -45,7 +45,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
|
||||
/**
|
||||
* This Service generates the tree structure for the tools.
|
||||
* Whenever you change something here, you has to clear the cache, because the results are cached for performance reasons.
|
||||
* Whenever you change something here, you have to clear the cache, because the results are cached for performance reasons.
|
||||
*/
|
||||
class ToolsTreeBuilder
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class ToolsTreeBuilder
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates the tree for the tools menu.
|
||||
* Generates the tree for the tools' menu.
|
||||
* The result is cached.
|
||||
*
|
||||
* @return TreeViewNode[] the array containing all Nodes for the tools menu
|
||||
|
|
|
@ -209,7 +209,7 @@ class TreeViewGenerator
|
|||
/** @var StructuralDBElementRepository $repo */
|
||||
$repo = $this->em->getRepository($class);
|
||||
|
||||
//If we just want a part of a tree, dont cache it
|
||||
//If we just want a part of a tree, don't cache it
|
||||
if (null !== $parent) {
|
||||
return $repo->getGenericNodeTree($parent);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ class TreeViewGenerator
|
|||
$key = 'treeview_'.$this->keyGenerator->generateKey().'_'.$secure_class_name;
|
||||
|
||||
return $this->cache->get($key, function (ItemInterface $item) use ($repo, $parent, $secure_class_name) {
|
||||
// Invalidate when groups, a element with the class or the user changes
|
||||
// Invalidate when groups, an element with the class or the user changes
|
||||
$item->tag(['groups', 'tree_treeview', $this->keyGenerator->generateKey(), $secure_class_name]);
|
||||
|
||||
return $repo->getGenericNodeTree($parent);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue