partkeepr

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

commit 6c81e51d4e89a0494921add2116ab59592aba1cb
parent 4dc65ec72760867c07b830b514d55005aae2df17
Author: Felicia Hummel <felicia@partkeepr.com>
Date:   Thu,  1 Jun 2017 12:13:35 +0200

- Copy the lotNumber to the created part, should fix #824

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReport.js | 13+++++++------
Msrc/PartKeepr/PartBundle/Controller/PartController.php | 13++++++++++++-
2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReport.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReport.js @@ -249,15 +249,18 @@ Ext.define('PartKeepr.ProjectReportView', { gridPresetButton.setGrid(this.reportResult); }, - foo: function () { - this.reportResult.getView().refresh(); - }, onApplyMetaPartsClick: function (button) { var parentRecord = button.up("grid").parentRecord; this.convertMetaPartsToParts(parentRecord); }, + /** + * Converts meta parts to parts. Iterates over the sub parts and figures out which actual parts to create, then + * removes the original meta part. + * + * @param record + */ convertMetaPartsToParts: function (record) { var missing; @@ -287,6 +290,7 @@ Ext.define('PartKeepr.ProjectReportView', { projectReportItem.set("projectNames", record.get("projectNames")); projectReportItem.set("remarks", record.get("remarks")); projectReportItem.set("productionRemarks", subPart.get("productionRemarks")); + projectReportItem.set("lotNumber", record.get("lotNumber")); projectReportItem.setPart(subPart); this.reportResult.getStore().add(projectReportItem); @@ -311,9 +315,6 @@ Ext.define('PartKeepr.ProjectReportView', { } else { record.set("stockToUse", record.get("stockLevel")); } - - - } } diff --git a/src/PartKeepr/PartBundle/Controller/PartController.php b/src/PartKeepr/PartBundle/Controller/PartController.php @@ -6,6 +6,7 @@ use Dunglas\ApiBundle\Api\IriConverter; use FOS\RestBundle\Controller\Annotations\View; use FOS\RestBundle\Controller\FOSRestController; use PartKeepr\PartBundle\Entity\Part; +use PartKeepr\ProjectBundle\Entity\Project; use PartKeepr\ProjectBundle\Entity\ProjectRun; use PartKeepr\ProjectBundle\Entity\ProjectRunPart; use PartKeepr\StockBundle\Entity\StockEntry; @@ -47,6 +48,9 @@ class PartController extends FOSRestController $projectRuns = []; foreach ($projects as $projectInfo) { + /** + * @var Project $project + */ $project = $iriConverter->getItemFromIri($projectInfo->project); $projectRun = new ProjectRun(); @@ -60,6 +64,7 @@ class PartController extends FOSRestController $user = $this->get('partkeepr.userservice')->getUser(); foreach ($removals as $removal) { + if (!property_exists($removal, 'part')) { throw new \Exception('Each removal must have the part property defined'); } @@ -68,8 +73,12 @@ class PartController extends FOSRestController throw new \Exception('Each removal must have the amount property defined'); } + if (!property_exists($removal, 'lotNumber')) { + throw new \Exception('Each removal must have the lotNumber property defined'); + } + /** - * @var Part + * @var Part $part */ $part = $iriConverter->getItemFromIri($removal->part); @@ -119,6 +128,8 @@ class PartController extends FOSRestController * @Routing\Route("/api/parts/getPartParameterValues", defaults={"method" = "get","_format" = "json"}) * @View() * + * @param $request Request The Request to process + * * @return array An array with name and description properties */ public function getParameterValuesAction(Request $request)