partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit da771320b9f8a2383e220c03f241b94731b58646
parent b33aa24c0d57bb1b3fd99d053f00a624f8742f73
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu, 22 Dec 2011 09:18:11 +0100

Hackish bugfix: Don't display parts from all storage locations if creating a storage location.

Fixing this in a clean way is lots of work and will eventually solve itself when the service/manager philosophy stabilizes.

Diffstat:
Msrc/backend/de/RaumZeitLabor/PartKeepr/Part/Part.php | 2+-
Msrc/backend/de/RaumZeitLabor/PartKeepr/Part/PartManager.php | 6+++++-
Msrc/backend/de/RaumZeitLabor/PartKeepr/Part/PartService.php | 2+-
3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Part/Part.php b/src/backend/de/RaumZeitLabor/PartKeepr/Part/Part.php @@ -459,7 +459,7 @@ class Part extends BaseEntity implements Serializable, Deserializable { } /** - * Deserializes the manufacturer + * Deserializes the part * @param array $parameters The array with the parameters to set */ public function deserialize (array $parameters) { diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Part/PartManager.php b/src/backend/de/RaumZeitLabor/PartKeepr/Part/PartManager.php @@ -52,7 +52,11 @@ class PartManager extends Singleton { $qb->setParameter("filter", "%".$filter."%"); } - if ($storageLocation != "") { + if ($storageLocation !== null) { + /* If storage location is empty, assume new record. This isn't nice and to be considered as a hack */ + if ($storageLocation == "") { + return array(); + } $qb->andWhere("st.name = :storageLocation"); $qb->setParameter("storageLocation", $storageLocation); } diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Part/PartService.php b/src/backend/de/RaumZeitLabor/PartKeepr/Part/PartService.php @@ -27,7 +27,7 @@ class PartService extends Service implements RestfulService { $this->getParameter("categoryScope", "all"), $this->getParameter("stockMode", "all"), $this->getParameter("withoutPrice", false), - $this->getParameter("storageLocation", "")); + $this->getParameter("storageLocation", null)); } }