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
782e2b7fdf
commit
0f3ba9b6a8
19 changed files with 109 additions and 139 deletions
|
@ -53,6 +53,6 @@ class DebugController extends AbstractController
|
||||||
|
|
||||||
$this->addFlash('testkjfd', 'Blabla. This message type should be not know to template!');
|
$this->addFlash('testkjfd', 'Blabla. This message type should be not know to template!');
|
||||||
|
|
||||||
return $this->render("base.html.twig");
|
return $this->render('base.html.twig');
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,14 +34,7 @@
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Attachment;
|
|
||||||
use App\Entity\AttachmentType;
|
|
||||||
use App\Entity\Category;
|
|
||||||
use App\Entity\Part;
|
|
||||||
use App\Entity\StructuralDBElement;
|
|
||||||
use Shivas\VersioningBundle\Service\VersionManager;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class HomepageController extends AbstractController
|
class HomepageController extends AbstractController
|
||||||
|
|
|
@ -37,10 +37,7 @@ use App\Entity\Category;
|
||||||
use App\Entity\Part;
|
use App\Entity\Part;
|
||||||
use App\Form\PartType;
|
use App\Form\PartType;
|
||||||
use App\Services\AttachmentFilenameService;
|
use App\Services\AttachmentFilenameService;
|
||||||
use App\Services\EntityURLGenerator;
|
|
||||||
use Doctrine\ORM\EntityManager;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
@ -61,8 +58,8 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
return $this->render('Parts/show_part_info.html.twig',
|
return $this->render('Parts/show_part_info.html.twig',
|
||||||
[
|
[
|
||||||
"part" => $part,
|
'part' => $part,
|
||||||
"main_image" => $attachmentFilenameService->attachmentPathToAbsolutePath($filename)
|
'main_image' => $attachmentFilenameService->attachmentPathToAbsolutePath($filename)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -88,8 +85,8 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
return $this->render('Parts/edit_part_info.html.twig',
|
return $this->render('Parts/edit_part_info.html.twig',
|
||||||
[
|
[
|
||||||
"part" => $part,
|
'part' => $part,
|
||||||
"form" => $form->createView(),
|
'form' => $form->createView(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +120,8 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
return $this->render('Parts/new_part.html.twig',
|
return $this->render('Parts/new_part.html.twig',
|
||||||
[
|
[
|
||||||
"part" => $new_part,
|
'part' => $new_part,
|
||||||
"form" => $form->createView()
|
'form' => $form->createView()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +133,7 @@ class PartController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var Part $new_part */
|
/** @var Part $new_part */
|
||||||
$new_part = clone($part);
|
$new_part = clone $part;
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('create', $new_part);
|
$this->denyAccessUnlessGranted('create', $new_part);
|
||||||
|
|
||||||
|
@ -154,8 +151,8 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
return $this->render('Parts/new_part.html.twig',
|
return $this->render('Parts/new_part.html.twig',
|
||||||
[
|
[
|
||||||
"part" => $new_part,
|
'part' => $new_part,
|
||||||
"form" => $form->createView()
|
'form' => $form->createView()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,14 +33,7 @@ namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
use App\DataTables\PartsDataTable;
|
use App\DataTables\PartsDataTable;
|
||||||
use App\Entity\Part;
|
|
||||||
use Omines\DataTablesBundle\Adapter\ArrayAdapter;
|
|
||||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter;
|
|
||||||
use Omines\DataTablesBundle\Column\TextColumn;
|
|
||||||
use Omines\DataTablesBundle\Controller\DataTablesTrait;
|
|
||||||
use Omines\DataTablesBundle\DataTable;
|
|
||||||
use Omines\DataTablesBundle\DataTableFactory;
|
use Omines\DataTablesBundle\DataTableFactory;
|
||||||
use Omines\DataTablesBundle\DataTableRendererInterface;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
|
@ -56,17 +56,17 @@ class UserController extends AbstractController
|
||||||
public function userInfo(?User $user, Packages $packages)
|
public function userInfo(?User $user, Packages $packages)
|
||||||
{
|
{
|
||||||
//If no user id was passed, then we show info about the current user
|
//If no user id was passed, then we show info about the current user
|
||||||
if($user == null) {
|
if($user === null) {
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
} else {
|
} else {
|
||||||
//Else we must check, if the current user is allowed to access $user
|
//Else we must check, if the current user is allowed to access $user
|
||||||
$this->denyAccessUnlessGranted('read', $user);
|
$this->denyAccessUnlessGranted('read', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->getParameter("use_gravatar")) {
|
if($this->getParameter('use_gravatar')) {
|
||||||
$avatar = $this->getGravatar($user->getEmail(), 200, 'identicon');
|
$avatar = $this->getGravatar($user->getEmail(), 200, 'identicon');
|
||||||
} else {
|
} else {
|
||||||
$avatar = $packages->getUrl("/img/default_avatar.png");
|
$avatar = $packages->getUrl('/img/default_avatar.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class UserController extends AbstractController
|
||||||
*****************************/
|
*****************************/
|
||||||
|
|
||||||
return $this->render('Users/user_settings.html.twig', [
|
return $this->render('Users/user_settings.html.twig', [
|
||||||
"settings_form" => $form->createView(),
|
'settings_form' => $form->createView(),
|
||||||
'pw_form' => $pw_form->createView()
|
'pw_form' => $pw_form->createView()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Entity;;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Attachment
|
* Class Attachment
|
||||||
|
@ -137,6 +138,8 @@ class Attachment extends NamedDBElement
|
||||||
public function getType() : AttachmentType
|
public function getType() : AttachmentType
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
|
throw new NotImplementedException("Not implemented yet!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,14 +78,14 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
|
||||||
|
|
||||||
foreach ($attachements as $key => $attachement) {
|
foreach ($attachements as $key => $attachement) {
|
||||||
if (($only_table_attachements && (! $attachement->getShowInTable()))
|
if (($only_table_attachements && (! $attachement->getShowInTable()))
|
||||||
|| ($type_id && ($attachement->getType()->getID() != $type_id))) {
|
|| ($type_id && ($attachement->getType()->getID() !== $type_id))) {
|
||||||
unset($attachements[$key]);
|
unset($attachements[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $attachements;
|
return $attachements;
|
||||||
} else {
|
|
||||||
return $this->attachments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->attachments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class AttachmentType extends StructuralDBElement
|
||||||
* @var ArrayCollection
|
* @var ArrayCollection
|
||||||
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachement_type")
|
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachement_type")
|
||||||
*/
|
*/
|
||||||
protected $attachments = null;
|
protected $attachments;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,7 @@ class AttachmentType extends StructuralDBElement
|
||||||
public function getAttachementsForType() : ArrayCollection
|
public function getAttachementsForType() : ArrayCollection
|
||||||
{
|
{
|
||||||
// the attribute $this->attachements is used from class "AttachementsContainingDBELement"
|
// the attribute $this->attachements is used from class "AttachementsContainingDBELement"
|
||||||
if ($this->attachments == null) {
|
if ($this->attachments === null) {
|
||||||
$this->attachments = new ArrayCollection();
|
$this->attachments = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class AttachmentType extends StructuralDBElement
|
||||||
*/
|
*/
|
||||||
public function getIDString(): string
|
public function getIDString(): string
|
||||||
{
|
{
|
||||||
return "";
|
return '';
|
||||||
//return 'AT' . sprintf('%09d', $this->getID());
|
//return 'AT' . sprintf('%09d', $this->getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ class Device extends PartsContainingDBElement
|
||||||
{
|
{
|
||||||
if($new_order_quantity < 0)
|
if($new_order_quantity < 0)
|
||||||
{
|
{
|
||||||
throw new \InvalidArgumentException("The new order quantity must not be negative!");
|
throw new \InvalidArgumentException('The new order quantity must not be negative!');
|
||||||
}
|
}
|
||||||
$this->order_quantity = $new_order_quantity;
|
$this->order_quantity = $new_order_quantity;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -108,13 +108,13 @@ class Footprint extends PartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
public function get3dFilename(bool $absolute = true) : string
|
public function get3dFilename(bool $absolute = true) : string
|
||||||
{
|
{
|
||||||
if ($absolute == true) {
|
if ($absolute === true) {
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not Implemented yet...");
|
throw new \Exception('Not Implemented yet...');
|
||||||
//return str_replace('%BASE%', BASE, $this->db_data['filename_3d']);
|
//return str_replace('%BASE%', BASE, $this->db_data['filename_3d']);
|
||||||
} else {
|
|
||||||
return $this->filename_3d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->filename_3d;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +155,7 @@ class Footprint extends PartsContainingDBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if file is X3D-Model (these has .x3d extension)
|
//Check if file is X3D-Model (these has .x3d extension)
|
||||||
if (strpos($this->get3dFilename(), '.x3d') == false) {
|
if (strpos($this->get3dFilename(), '.x3d') === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ abstract class NamedDBElement extends DBElement
|
||||||
* @Assert\NotBlank()
|
* @Assert\NotBlank()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected $name = "";
|
protected $name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime The date when this element was modified the last time.
|
* @var \DateTime The date when this element was modified the last time.
|
||||||
|
|
|
@ -154,11 +154,11 @@ class Orderdetail extends DBElement
|
||||||
*/
|
*/
|
||||||
public function getSupplierProductUrl(bool $no_automatic_url = false) : string
|
public function getSupplierProductUrl(bool $no_automatic_url = false) : string
|
||||||
{
|
{
|
||||||
if ($no_automatic_url || $this->supplierpartnr != '') {
|
if ($no_automatic_url || $this->supplierpartnr !== '') {
|
||||||
return $this->supplierpartnr;
|
return $this->supplierpartnr;
|
||||||
} else {
|
}
|
||||||
return $this->getSupplier()->getAutoProductUrl($this->supplierpartnr);
|
|
||||||
} // maybe an automatic url is available...
|
return $this->getSupplier()->getAutoProductUrl($this->supplierpartnr); // maybe an automatic url is available...
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +235,7 @@ class Orderdetail extends DBElement
|
||||||
return $correct_pricedetails->getPrice($as_money_string, $multiplier);
|
return $correct_pricedetails->getPrice($as_money_string, $multiplier);
|
||||||
* */
|
* */
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet...");
|
throw new \Exception('Not implemented yet...');
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
|
@ -252,7 +252,7 @@ class Orderdetail extends DBElement
|
||||||
*/
|
*/
|
||||||
public function setSupplierId(int $new_supplier_id) : self
|
public function setSupplierId(int $new_supplier_id) : self
|
||||||
{
|
{
|
||||||
throw new \Exception("Not implemented yet!");
|
throw new \Exception('Not implemented yet!');
|
||||||
//TODO;
|
//TODO;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -49,7 +49,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
*/
|
*/
|
||||||
class Part extends AttachmentContainingDBElement
|
class Part extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
const INSTOCK_UNKNOWN = -2;
|
public const INSTOCK_UNKNOWN = -2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Category
|
* @var Category
|
||||||
|
@ -146,7 +146,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
*
|
*
|
||||||
* @ColumnSecurity(prefix="description")
|
* @ColumnSecurity(prefix="description")
|
||||||
*/
|
*/
|
||||||
protected $description = "";
|
protected $description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
@ -171,7 +171,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
* @ColumnSecurity(prefix="comment")
|
* @ColumnSecurity(prefix="comment")
|
||||||
*/
|
*/
|
||||||
protected $comment = "";
|
protected $comment = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
@ -205,7 +205,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
*@ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
|
*@ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
|
||||||
*/
|
*/
|
||||||
protected $manufacturer_product_url = "";
|
protected $manufacturer_product_url = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -287,7 +287,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
$all_orderdetails = $this->getOrderdetails();
|
$all_orderdetails = $this->getOrderdetails();
|
||||||
|
|
||||||
if (count($all_orderdetails) == 0) {
|
if (count($all_orderdetails) === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
public function getMinOrderQuantity(bool $with_devices = true) : int
|
public function getMinOrderQuantity(bool $with_devices = true) : int
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet...");
|
throw new \Exception('Not implemented yet...');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
if ($with_devices) {
|
if ($with_devices) {
|
||||||
|
@ -423,15 +423,15 @@ class Part extends AttachmentContainingDBElement
|
||||||
*/
|
*/
|
||||||
public function getManufacturerProductUrl() : string
|
public function getManufacturerProductUrl() : string
|
||||||
{
|
{
|
||||||
if ($this->manufacturer_product_url != '') {
|
if ($this->manufacturer_product_url !== '') {
|
||||||
return $this->manufacturer_product_url;
|
return $this->manufacturer_product_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getManufacturer() !== null) {
|
if ($this->getManufacturer() !== null) {
|
||||||
return $this->getManufacturer()->getAutoProductUrl($this->name);
|
return $this->getManufacturer()->getAutoProductUrl($this->name);
|
||||||
} else {
|
}
|
||||||
return '';
|
|
||||||
} // no url is available
|
return ''; // no url is available
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -752,7 +752,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
public function getProperties(bool $use_description = true, bool $use_comment = true, bool $use_name = true, bool $force_output = false) : array
|
public function getProperties(bool $use_description = true, bool $use_comment = true, bool $use_name = true, bool $force_output = false) : array
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet!");
|
throw new \Exception('Not implemented yet!');
|
||||||
/*
|
/*
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -790,7 +790,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
public function getPropertiesLoop(bool $use_description = true, bool $use_comment = true, bool $use_name = true) : array
|
public function getPropertiesLoop(bool $use_description = true, bool $use_comment = true, bool $use_name = true) : array
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet!");
|
throw new \Exception('Not implemented yet!');
|
||||||
$arr = array();
|
$arr = array();
|
||||||
foreach ($this->getProperties($use_description, $use_comment, $use_name) as $property) {
|
foreach ($this->getProperties($use_description, $use_comment, $use_name) as $property) {
|
||||||
/* @var PartProperty $property */
|
/* @var PartProperty $property */
|
||||||
|
@ -805,17 +805,6 @@ class Part extends AttachmentContainingDBElement
|
||||||
return self::isValidName($this->getName(), $this->getCategory());
|
return self::isValidName($this->getName(), $this->getCategory());
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
|
||||||
public function getAttachmentTypes() : array
|
|
||||||
{
|
|
||||||
return parent::getAttachmentTypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAttachments($type_id = null, bool $only_table_attachements = false) : array
|
|
||||||
{
|
|
||||||
return parent::getAttachments($type_id, $only_table_attachements);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
*
|
*
|
||||||
* Setters
|
* Setters
|
||||||
|
@ -846,7 +835,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
//Assert::natural($new_instock, 'New instock must be positive. Got: %s');
|
//Assert::natural($new_instock, 'New instock must be positive. Got: %s');
|
||||||
|
|
||||||
$old_instock = (int) $this->getInstock();
|
$old_instock = $this->getInstock();
|
||||||
$this->instock = $new_instock;
|
$this->instock = $new_instock;
|
||||||
//TODO
|
//TODO
|
||||||
/*
|
/*
|
||||||
|
@ -873,15 +862,14 @@ class Part extends AttachmentContainingDBElement
|
||||||
*/
|
*/
|
||||||
public function setInstockUnknown(bool $new_unknown) : self
|
public function setInstockUnknown(bool $new_unknown) : self
|
||||||
{
|
{
|
||||||
if($new_unknown == true) {
|
if($new_unknown === true) {
|
||||||
$this->instock = self::INSTOCK_UNKNOWN;
|
$this->instock = self::INSTOCK_UNKNOWN;
|
||||||
} else {
|
} else if ($this->isInstockUnknown()) {
|
||||||
//Change only if instock is currently unknown.
|
$this->setInstock(0);
|
||||||
if ($this->isInstockUnknown()) {
|
|
||||||
$this->setInstock(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1016,7 +1004,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
public function setOrderOrderdetailsID($new_order_orderdetails_id) : self
|
public function setOrderOrderdetailsID($new_order_orderdetails_id) : self
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet...");
|
throw new \Exception('Not implemented yet...');
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -1137,7 +1125,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
public function setMasterPictureAttachementID($new_master_picture_attachement_id) : self
|
public function setMasterPictureAttachementID($new_master_picture_attachement_id) : self
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet!");
|
throw new \Exception('Not implemented yet!');
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,35 +55,35 @@ class PermissionsEmbed
|
||||||
* Permission strings
|
* Permission strings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const STORELOCATIONS = 'storelocations';
|
public const STORELOCATIONS = 'storelocations';
|
||||||
const FOOTRPINTS = 'footprints';
|
public const FOOTRPINTS = 'footprints';
|
||||||
const CATEGORIES = 'categories';
|
public const CATEGORIES = 'categories';
|
||||||
const SUPPLIERS = 'suppliers';
|
public const SUPPLIERS = 'suppliers';
|
||||||
const MANUFACTURERS = 'manufacturers';
|
public const MANUFACTURERS = 'manufacturers';
|
||||||
const DEVICES = 'devices';
|
public const DEVICES = 'devices';
|
||||||
const ATTACHMENT_TYPES = 'attachment_types';
|
public const ATTACHMENT_TYPES = 'attachment_types';
|
||||||
const TOOLS = 'tools';
|
public const TOOLS = 'tools';
|
||||||
const PARTS = 'parts';
|
public const PARTS = 'parts';
|
||||||
const PARTS_NAME = 'parts_name';
|
public const PARTS_NAME = 'parts_name';
|
||||||
const PARTS_DESCRIPTION = 'parts_description';
|
public const PARTS_DESCRIPTION = 'parts_description';
|
||||||
const PARTS_INSTOCK = 'parts_instock';
|
public const PARTS_INSTOCK = 'parts_instock';
|
||||||
const PARTS_MININSTOCK = 'parts_mininstock';
|
public const PARTS_MININSTOCK = 'parts_mininstock';
|
||||||
const PARTS_FOOTPRINT = 'parts_footprint';
|
public const PARTS_FOOTPRINT = 'parts_footprint';
|
||||||
const PARTS_COMMENT = 'parts_comment';
|
public const PARTS_COMMENT = 'parts_comment';
|
||||||
const PARTS_STORELOCATION = 'parts_storelocation';
|
public const PARTS_STORELOCATION = 'parts_storelocation';
|
||||||
const PARTS_MANUFACTURER = 'parts_manufacturer';
|
public const PARTS_MANUFACTURER = 'parts_manufacturer';
|
||||||
const PARTS_ORDERDETAILS = 'parts_orderdetails';
|
public const PARTS_ORDERDETAILS = 'parts_orderdetails';
|
||||||
const PARTS_PRICES = 'parts_prices';
|
public const PARTS_PRICES = 'parts_prices';
|
||||||
const PARTS_ATTACHMENTS = 'parts_attachments';
|
public const PARTS_ATTACHMENTS = 'parts_attachments';
|
||||||
const PARTS_ORDER = 'parts_order';
|
public const PARTS_ORDER = 'parts_order';
|
||||||
const GROUPS = 'groups';
|
public const GROUPS = 'groups';
|
||||||
const USERS = 'users';
|
public const USERS = 'users';
|
||||||
const DATABASE = 'system_database';
|
public const DATABASE = 'system_database';
|
||||||
const CONFIG = 'system_config';
|
public const CONFIG = 'system_config';
|
||||||
const SYSTEM = 'system';
|
public const SYSTEM = 'system';
|
||||||
const DEVICE_PARTS = 'devices_parts';
|
public const DEVICE_PARTS = 'devices_parts';
|
||||||
const SELF = 'self';
|
public const SELF = 'self';
|
||||||
const LABELS = 'labels';
|
public const LABELS = 'labels';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
@ -283,9 +283,11 @@ class PermissionsEmbed
|
||||||
public function getPermissionValue(string $permission_name, int $bit_n) : ?bool
|
public function getPermissionValue(string $permission_name, int $bit_n) : ?bool
|
||||||
{
|
{
|
||||||
$value = $this->getBitValue($permission_name, $bit_n);
|
$value = $this->getBitValue($permission_name, $bit_n);
|
||||||
if($value == self::ALLOW) {
|
if ($value == self::ALLOW) {
|
||||||
return true;
|
return true;
|
||||||
} elseif($value == self::DISALLOW) {
|
}
|
||||||
|
|
||||||
|
if($value == self::DISALLOW) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -121,11 +121,11 @@ class Pricedetail extends DBElement
|
||||||
$price = ($this->price * $multiplier) / $this->price_related_quantity;
|
$price = ($this->price * $multiplier) / $this->price_related_quantity;
|
||||||
|
|
||||||
if ($as_money_string) {
|
if ($as_money_string) {
|
||||||
throw new \Exception("Not implemented yet...");
|
throw new \Exception('Not implemented yet...');
|
||||||
//return floatToMoneyString($price);
|
//return floatToMoneyString($price);
|
||||||
} else {
|
|
||||||
return $price;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $price;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,7 +26,6 @@ namespace App\Entity;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Doctrine\ORM\PersistentCollection;
|
use Doctrine\ORM\PersistentCollection;
|
||||||
use Symfony\Bundle\MakerBundle\Str;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -78,7 +77,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
|
|
||||||
/** @var string[] all names of all parent elements as a array of strings,
|
/** @var string[] all names of all parent elements as a array of strings,
|
||||||
* the last array element is the name of the element itself */
|
* the last array element is the name of the element itself */
|
||||||
private $full_path_strings = null;
|
private $full_path_strings;
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* StructuralDBElement constructor.
|
* StructuralDBElement constructor.
|
||||||
|
@ -105,11 +104,11 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
|
|
||||||
if ($this->getID() == null) { // this is the root node
|
if ($this->getID() == null) { // this is the root node
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
//If this' parents element, is $another_element, then we are finished
|
|
||||||
return (($this->parent->getID() == $another_element->getID())
|
|
||||||
|| $this->parent->isChildOf($another_element)); //Otherwise, check recursivley
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If this' parents element, is $another_element, then we are finished
|
||||||
|
return (($this->parent->getID() == $another_element->getID())
|
||||||
|
|| $this->parent->isChildOf($another_element)); //Otherwise, check recursivley
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,10 +148,6 @@ 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 ?? '');
|
$val = htmlspecialchars($this->comment ?? '');
|
||||||
if ($parse_bbcode) {
|
|
||||||
//$bbcode = new BBCodeParser();
|
|
||||||
//$val = $bbcode->parse($val);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +214,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
public function getSubelements(bool $recursive) : PersistentCollection
|
public function getSubelements(bool $recursive) : PersistentCollection
|
||||||
{
|
{
|
||||||
if ($this->children == null) {
|
if ($this->children == null) {
|
||||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->children = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $recursive) {
|
if (! $recursive) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Supplier extends Company
|
||||||
|
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
throw new \Exception("Not implemented yet!");
|
throw new \Exception('Not implemented yet!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
class User extends NamedDBElement implements UserInterface, HasPermissionsInterface
|
class User extends NamedDBElement implements UserInterface, HasPermissionsInterface
|
||||||
{
|
{
|
||||||
/** The User id of the anonymous user */
|
/** The User id of the anonymous user */
|
||||||
const ID_ANONYMOUS = 1;
|
public const ID_ANONYMOUS = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id()
|
* @ORM\Id()
|
||||||
|
@ -84,19 +84,19 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
||||||
* @var string|null The first name of the User
|
* @var string|null The first name of the User
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $first_name = "";
|
protected $first_name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The last name of the User
|
* @var string|null The last name of the User
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $last_name = "";
|
protected $last_name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The department the user is working
|
* @var string|null The department the user is working
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $department = "";
|
protected $department = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,25 +104,25 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
* @Assert\Email()
|
* @Assert\Email()
|
||||||
*/
|
*/
|
||||||
protected $email = "";
|
protected $email = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The language/locale the user prefers
|
* @var string|null The language/locale the user prefers
|
||||||
* @ORM\Column(type="string", name="config_language", nullable=true)
|
* @ORM\Column(type="string", name="config_language", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $language = "";
|
protected $language = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The timezone the user prefers
|
* @var string|null The timezone the user prefers
|
||||||
* @ORM\Column(type="string", name="config_timezone", nullable=true)
|
* @ORM\Column(type="string", name="config_timezone", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $timezone = "";
|
protected $timezone = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The theme
|
* @var string|null The theme
|
||||||
* @ORM\Column(type="string", name="config_theme", nullable=true)
|
* @ORM\Column(type="string", name="config_theme", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $theme = "";
|
protected $theme = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Group|null The group this user belongs to.
|
* @var Group|null The group this user belongs to.
|
||||||
|
@ -240,7 +240,7 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
||||||
* @param bool $including_username Include the username in the full name.
|
* @param bool $including_username Include the username in the full name.
|
||||||
* @return string A string with the full name of this user.
|
* @return string A string with the full name of this user.
|
||||||
*/
|
*/
|
||||||
public function getFullName(bool $including_username = false)
|
public function getFullName(bool $including_username = false) : string
|
||||||
{
|
{
|
||||||
$str = $this->getFirstName() . ' ' . $this->getLastName();
|
$str = $this->getFirstName() . ' ' . $this->getLastName();
|
||||||
if ($including_username) {
|
if ($including_username) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue