Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest
Commits
5e4e144a
Commit
5e4e144a
authored
Jun 23, 2011
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- REST Interface:
Handling duplicate im_biz_objects relationship now gracefully
parent
8b473b34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
intranet-rest-create-procs.tcl
tcl/intranet-rest-create-procs.tcl
+14
-11
No files found.
tcl/intranet-rest-create-procs.tcl
View file @
5e4e144a
...
...
@@ -1407,18 +1407,20 @@ ad_proc -private im_rest_post_object_type_im_biz_object_member {
# Check for duplicate
set dup_sql
"
select
count(*
)
select
min(rel_id
)
from acs_rels
where rel_type = :rest_otype and
object_id_one = :object_id_one and
object_id_two = :object_id_two
"
if
{[
db_string duplicates
$dup
_sql
]}
{
return
[
im_rest_error -format
$format
-http_status 406 -message
"Duplicate
$rest
_otype_pretty: Your company_name or company_path already exists."
]
}
set rest_oid
[
db_string duplicates
$dup
_sql -default
""
]
if
{[
catch
{
set rest_oid
[
db_string new_im_biz_object_member
"
if
{
""
==
$rest
_oid
}
{
# Add the new relationship only if it doesn't exist yet
# Gracefully handle duplicates
if
{[
catch
{
set rest_oid
[
db_string new_im_biz_object_member
"
select im_biz_object_member__new (
null, -- rel_id
:rest_otype, -- rel_type
...
...
@@ -1429,12 +1431,13 @@ ad_proc -private im_rest_post_object_type_im_biz_object_member {
:user_id, -- Creation user
'
[
ns_conn peeraddr
]
' -- Connection IP address for audit
)
"
]
}
err_msg
]}
{
return
[
im_rest_error -format
$format
-http_status 406 -message
"Error creating
$rest
_otype_pretty: '
$err
_msg'."
]
}
"
]
}
err_msg
]}
{
return
[
im_rest_error -format
$format
-http_status 406 -message
"Error creating
$rest
_otype_pretty: '
$err
_msg'."
]
}
im_audit -user_id
$user
_id -object_type
$rest
_otype -object_id
$rest
_oid -action create
im_audit -user_id
$user
_id -object_type
$rest
_otype -object_id
$rest
_oid -action create
}
set hash_array
(
rest_oid
)
$rest
_oid
set hash_array
(
rel_id
)
$rest
_oid
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment