mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Added an DB field for filetype filtering to attachment types.
This commit is contained in:
parent
af3dfafe22
commit
c484e40758
2 changed files with 32 additions and 1 deletions
|
@ -56,6 +56,7 @@ use App\Entity\Base\StructuralDBElement;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use s9e\TextFormatter\Configurator\RendererGenerators\PHP\XPathConvertor\Convertors\SingleByteStringManipulation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AttachmentType.
|
* Class AttachmentType.
|
||||||
|
@ -82,6 +83,12 @@ class AttachmentType extends StructuralDBElement
|
||||||
*/
|
*/
|
||||||
protected $parent;
|
protected $parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @ORM\Column(type="string", length=65535)
|
||||||
|
*/
|
||||||
|
protected $filetype_filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all attachements ("Attachement" objects) with this type.
|
* Get all attachements ("Attachement" objects) with this type.
|
||||||
*
|
*
|
||||||
|
@ -98,6 +105,27 @@ class AttachmentType extends StructuralDBElement
|
||||||
return $this->attachments;
|
return $this->attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an filter, which file types are allowed for attachment files.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFiletypeFilter(): string
|
||||||
|
{
|
||||||
|
return $this->filetype_filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $filetype_filter
|
||||||
|
* @return AttachmentType
|
||||||
|
*/
|
||||||
|
public function setFiletypeFilter(string $filetype_filter): AttachmentType
|
||||||
|
{
|
||||||
|
$this->filetype_filter = $filetype_filter;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID as an string, defined by the element class.
|
* Returns the ID as an string, defined by the element class.
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
* This should have a form like P000014, for a part with ID 14.
|
||||||
|
|
|
@ -49,11 +49,14 @@ final class Version20190829104643 extends AbstractMigration
|
||||||
//Use float values for pricedetails amount, to use with non integer part units
|
//Use float values for pricedetails amount, to use with non integer part units
|
||||||
$this->addSql('ALTER TABLE pricedetails CHANGE orderdetails_id orderdetails_id INT DEFAULT NULL, CHANGE id_currency id_currency INT DEFAULT NULL, CHANGE price_related_quantity price_related_quantity DOUBLE PRECISION NOT NULL, CHANGE min_discount_quantity min_discount_quantity DOUBLE PRECISION NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
$this->addSql('ALTER TABLE pricedetails CHANGE orderdetails_id orderdetails_id INT DEFAULT NULL, CHANGE id_currency id_currency INT DEFAULT NULL, CHANGE price_related_quantity price_related_quantity DOUBLE PRECISION NOT NULL, CHANGE min_discount_quantity min_discount_quantity DOUBLE PRECISION NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||||
|
|
||||||
|
|
||||||
//Fix typo in attachment table names
|
//Fix typo in attachment table names
|
||||||
$this->addSql("ALTER TABLE attachements RENAME TO attachments;");
|
$this->addSql("ALTER TABLE attachements RENAME TO attachments;");
|
||||||
$this->addSql("ALTER TABLE attachement_types RENAME TO attachment_types;");
|
$this->addSql("ALTER TABLE attachement_types RENAME TO attachment_types;");
|
||||||
|
|
||||||
|
//Add an filetye filter field to attachment types
|
||||||
|
$this->addSql('ALTER TABLE attachment_types ADD filetype_filter VARCHAR(65535) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||||
|
|
||||||
|
|
||||||
//Fill empty timestamps with current date
|
//Fill empty timestamps with current date
|
||||||
$tables = ["attachments", "attachment_types", "categories", "devices", "footprints", "manufacturers",
|
$tables = ["attachments", "attachment_types", "categories", "devices", "footprints", "manufacturers",
|
||||||
"orderdetails", "pricedetails", "storelocations", "suppliers"];
|
"orderdetails", "pricedetails", "storelocations", "suppliers"];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue