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
5d1cb133
Commit
5d1cb133
authored
3 years ago
by
Pascal Neub
Committed by
Benjamin Ulrich
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Projekt: xRM-Sales][TicketNr.: 1081118][Offer_entity onDBInsert select ASYS_BINARIES.BINDATA]
parent
37aa0afb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entity/Offer_entity/recordcontainers/db/onDBInsert.js
+4
-22
4 additions, 22 deletions
entity/Offer_entity/recordcontainers/db/onDBInsert.js
process/Binary_lib/process.js
+45
-0
45 additions, 0 deletions
process/Binary_lib/process.js
with
49 additions
and
22 deletions
entity/Offer_entity/recordcontainers/db/onDBInsert.js
+
4
−
22
View file @
5d1cb133
...
...
@@ -18,8 +18,6 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
if
(
vars
.
exists
(
"
$param.OfferOriginal_Id_param
"
)
&&
vars
.
get
(
"
$param.OfferOriginal_Id_param
"
))
OfferUtils
.
copyOfferItems
(
vars
.
getString
(
"
$param.OfferOriginal_Id_param
"
),
offerId
,
discount
);
var
binaryColumns
;
var
binaries
;
var
activityId
=
vars
.
get
(
"
$param.ActivityId_param
"
);
if
(
activityId
)
{
...
...
@@ -30,30 +28,14 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
"
OBJECT_TYPE
"
:
ContextUtils
.
getCurrentContextId
(),
"
OBJECT_ROWID
"
:
offerId
},
"
ACTIVITYLINK
"
,
"
ACTIVITYLINKID
"
);
binaryColumns
=
"
BINDATA, FILENAME, DESCRIPTION, KEYWORD
"
;
binaries
=
newSelect
(
binaryColumns
,
SqlUtils
.
getBinariesAlias
())
.
from
(
"
ASYS_BINARIES
"
)
.
where
(
"
ASYS_BINARIES.ROW_ID
"
,
activityId
)
.
table
()
for
(
i
=
0
;
i
<
binaries
.
length
;
i
++
)
{
SingleBinaryUtils
.
insert
(
"
OFFER
"
,
"
DOCUMENT
"
,
offerId
,
binaries
[
i
][
0
],
binaries
[
i
][
1
],
binaries
[
i
][
2
],
binaries
[
i
][
3
],
SqlUtils
.
getBinariesAlias
())
}
BinaryUtils
.
copyBinaries
(
"
ACTIVITY
"
,
activityId
,
"
OFFER
"
,
offerId
,
"
DOCUMENT
"
);
}
var
taskId
=
vars
.
get
(
"
$param.TaskId_param
"
);
if
(
taskId
)
{
binaryColumns
=
"
BINDATA, FILENAME, DESCRIPTION, KEYWORD
"
;
binaries
=
newSelect
(
binaryColumns
,
SqlUtils
.
getBinariesAlias
())
.
from
(
"
ASYS_BINARIES
"
)
.
where
(
"
ASYS_BINARIES.ROW_ID
"
,
taskId
)
.
table
()
for
(
i
=
0
;
i
<
binaries
.
length
;
i
++
)
{
SingleBinaryUtils
.
insert
(
"
OFFER
"
,
"
DOCUMENT
"
,
taskId
,
binaries
[
i
][
0
],
binaries
[
i
][
1
],
binaries
[
i
][
2
],
binaries
[
i
][
3
],
SqlUtils
.
getBinariesAlias
())
}
BinaryUtils
.
copyBinaries
(
"
TASK
"
,
taskId
,
"
OFFER
"
,
offerId
,
"
DOCUMENT
"
);
}
}
WorkflowSignalSender
.
inserted
();
\ No newline at end of file
WorkflowSignalSender
.
inserted
();
This diff is collapsed.
Click to expand it.
process/Binary_lib/process.js
+
45
−
0
View file @
5d1cb133
...
...
@@ -3,6 +3,51 @@ import("system.vars");
import
(
"
system.db
"
);
import
(
"
Sql_lib
"
);
/**
* A static utility class for binarys using database binary functions.
* It provides methods to handle multiple binary data.<br>
* <p>
* <b><u>Do not create an instance of this!</u></b>
* @class
*/
function
BinaryUtils
()
{}
/**
* Copies the binaries
*
* @param {String} pSourceAssignmentTable <p>
* The source table from which the binary data will fetched.<br>
* (e.g.: ASYS_BINARIES).<br>
* @param {String} pSourceAssignmentRowId <p>
* The source row id.<br>
* (e.g.: UUID of the record)<br>
* @param {String} pTargetAssignmentTable <p>
* The target table from which the binary data will fetched.<br>
* (e.g.: ASYS_BINARIES).<br>
* @param {String} pTargetAssignmentRowId <p>
* The target row id.<br>
* (e.g.: UUID of the record)<br>
* @param {String} pAssignmentName <p>
* The name of the assignment/container name.<br>
* (e.g.: DOCUMENT)<br>
* @param {String} pAlias=SqlUtils.getBinariesAlias() <p>
* The database alias.<br>
* (e.g.: _____SYSTEMALIAS)
*/
BinaryUtils
.
copyBinaries
=
function
(
pSourceAssignmentTable
,
pSourceAssignmentRowId
,
pTargetAssignmentTable
,
pTargetAssignmentRowId
,
pAssignmentName
,
pAlias
)
{
pAlias
=
pAlias
||
SqlUtils
.
getBinariesAlias
();
var
binMetadata
=
db
.
getBinaryMetadata
(
pSourceAssignmentTable
,
pAssignmentName
,
pSourceAssignmentRowId
,
false
,
pAlias
);
var
binContents
=
db
.
getBinaryContents
(
binMetadata
.
map
(
function
(
curr
){
return
curr
.
id
}),
pAlias
);
for
(
var
i
=
0
;
i
<
binMetadata
.
length
;
i
++
)
{
db
.
insertBinary
(
pTargetAssignmentTable
,
pAssignmentName
,
pTargetAssignmentRowId
,
""
,
binContents
[
i
],
binMetadata
[
i
].
filename
,
binMetadata
[
i
].
description
,
binMetadata
[
i
].
keyword
,
pAlias
);
}
}
/**
* A static utility class for binarys using database binary functions.
* It provides methods to ensure that only one binary for a AssignmentTable, AssignmentName and AssignmentRowId exist.<br>
...
...
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