Allow to specify which label profiles are shown in dropdown.

This commit is contained in:
Jan Böhmer 2020-05-02 19:47:31 +02:00
parent 3804e2534d
commit 8b372a3443
8 changed files with 64 additions and 80 deletions

View file

@ -31,8 +31,8 @@ class LabelOptions
public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93'];
public const SUPPORTED_ELEMENTS = ['part', 'part_lot'];
public const PICTURE_TYPES = ['none', 'element_picture', 'main_attachment'];
public const POSITIONS = ['left', 'right', 'top', 'bottom'];
public const FONTS = ['default'];
public const LINES_MODES = ['html', 'twig'];
/**
* @var float The page size of the label in mm
@ -55,13 +55,6 @@ class LabelOptions
*/
protected $barcode_type = 'none';
/**
* @var string The position where the barcode should be put
* @Assert\Choice(choices=LabelOptions::POSITIONS)
* @ORM\Column(type="string")
*/
protected $barcode_position = 'left';
/**
* @var string What image should be shown along the
* @Assert\Choice(choices=LabelOptions::PICTURE_TYPES)
@ -69,13 +62,6 @@ class LabelOptions
*/
protected $picture_type = 'none';
/**
* @var string
* @Assert\Choice(choices=LabelOptions::POSITIONS)
* @ORM\Column(type="string")
*/
protected $picture_position = 'left';
/**
* @var string
* @Assert\Choice(choices=LabelOptions::SUPPORTED_ELEMENTS)
@ -84,10 +70,16 @@ class LabelOptions
protected $supported_element = 'part';
/**
* @var string The font that should be used in the Barcode
* @var string Any additional CSS for the label.
* @ORM\Column(type="text")
*/
protected $additional_css = '';
/** @var string The mode that will be used to interpret the lines.
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
* @ORM\Column(type="string")
*/
protected $font = 'default';
protected $lines_mode = 'html';
/**
* @var string
@ -149,24 +141,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getBarcodePosition(): string
{
return $this->barcode_position;
}
/**
* @param string $barcode_position
* @return LabelOptions
*/
public function setBarcodePosition(string $barcode_position): LabelOptions
{
$this->barcode_position = $barcode_position;
return $this;
}
/**
* @return string
*/
@ -185,24 +159,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getPicturePosition(): string
{
return $this->picture_position;
}
/**
* @param string $picture_position
* @return LabelOptions
*/
public function setPicturePosition(string $picture_position): LabelOptions
{
$this->picture_position = $picture_position;
return $this;
}
/**
* @return string
*/
@ -221,24 +177,6 @@ class LabelOptions
return $this;
}
/**
* @return string
*/
public function getFont(): string
{
return $this->font;
}
/**
* @param string $font
* @return LabelOptions
*/
public function setFont(string $font): LabelOptions
{
$this->font = $font;
return $this;
}
/**
* @return string
*/

View file

@ -56,6 +56,12 @@ class LabelProfile extends AttachmentContainingDBElement
*/
protected $comment = '';
/**
* @var bool Determines, if this label profile should be shown in the dropdown quick menu.
* @ORM\Column(type="boolean")
*/
protected $show_in_dropdown = true;
public function __construct()
{
parent::__construct();
@ -82,6 +88,28 @@ class LabelProfile extends AttachmentContainingDBElement
return $this;
}
/**
* Returns true, if this label profile should be shown in label generator quick menu.
* @return bool
*/
public function isShowInDropdown(): bool
{
return $this->show_in_dropdown;
}
/**
* Sets the show in dropdown menu.
* @param bool $show_in_dropdown
* @return LabelProfile
*/
public function setShowInDropdown(bool $show_in_dropdown): LabelProfile
{
$this->show_in_dropdown = $show_in_dropdown;
return $this;
}
/**
* @inheritDoc
*/