Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
573f0b27
Commit
573f0b27
authored
5 years ago
by
Johannes Goderbauer
Browse files
Options
Downloads
Patches
Plain Diff
fix of: cancelling in prod2prod (the parts list) raises an error
parent
4c167f24
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js
+29
-28
29 additions, 28 deletions
...Prod2prod_entity/recordcontainers/jdito/contentProcess.js
with
29 additions
and
28 deletions
entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js
+
29
−
28
View file @
573f0b27
...
...
@@ -111,32 +111,33 @@ function buildGraph (elementID, parentElementID, mappingStructure, prod2prodIdMa
return
elements
;
}
if
(
vars
.
get
(
"
$sys.recordstate
"
)
!=
neon
.
OPERATINGSTATE_NEW
)
{
var
prodid
=
vars
.
exists
(
"
$param.ProductId_param
"
)
&&
vars
.
get
(
"
$param.ProductId_param
"
)
!=
null
?
vars
.
get
(
"
$param.ProductId_param
"
)
:
""
;
if
(
prodid
!=
""
)
{
// First 3 columns are crucial, the rest is optional.
var
data
=
db
.
table
(
"
select PROD2PRODID, SOURCE_ID, DEST_ID, QUANTITY, PRODUCTCODE, PRODUCTID, PROD2PRODID, OPTIONAL, TAKEPRICE
"
+
"
from PROD2PROD join PRODUCT on PROD2PROD.SOURCE_ID = PRODUCTID
"
+
"
order by PRODUCTCODE
"
);
var
prod2prodIdMapping
=
buildProd2ProdIDMapping
(
data
);
var
childrenMapping
=
buildChildrenMapping
(
data
);
var
rootElements
=
calculateRootElements
(
prodid
,
data
);
var
allData
=
[]
rootElements
.
forEach
(
function
(
rg
)
{
var
graphData
=
buildGraph
(
rg
,
null
,
childrenMapping
,
prod2prodIdMapping
)
graphData
.
forEach
(
function
(
gd
)
{
allData
.
push
(
gd
);
})
})
result
.
object
(
allData
);
}
}
else
/*
* in the past at this point a check for the "recordstate" was done
* this should not be necessery and in fact causes a problem:
* When adding a new prod2prod entry and performing a cancel an error is raised that the variable does not exist.
*
* So *IF* you need that check for the state, you should check if this error is thrown
* + add a comment why the check is needed here instead of this current comment
*/
var
prodid
=
vars
.
exists
(
"
$param.ProductId_param
"
)
&&
vars
.
get
(
"
$param.ProductId_param
"
)
!=
null
?
vars
.
get
(
"
$param.ProductId_param
"
)
:
""
;
if
(
prodid
!=
""
)
{
result
.
object
([]);
}
// First 3 columns are crucial, the rest is optional.
var
data
=
db
.
table
(
"
select PROD2PRODID, SOURCE_ID, DEST_ID, QUANTITY, PRODUCTCODE, PRODUCTID, PROD2PRODID, OPTIONAL, TAKEPRICE
"
+
"
from PROD2PROD join PRODUCT on PROD2PROD.SOURCE_ID = PRODUCTID
"
+
"
order by PRODUCTCODE
"
);
var
prod2prodIdMapping
=
buildProd2ProdIDMapping
(
data
);
var
childrenMapping
=
buildChildrenMapping
(
data
);
var
rootElements
=
calculateRootElements
(
prodid
,
data
);
var
allData
=
[]
rootElements
.
forEach
(
function
(
rg
)
{
var
graphData
=
buildGraph
(
rg
,
null
,
childrenMapping
,
prod2prodIdMapping
)
graphData
.
forEach
(
function
(
gd
)
{
allData
.
push
(
gd
);
})
})
result
.
object
(
allData
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment