Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
58c25ff6
Commit
58c25ff6
authored
9 years ago
by
Xebax
Browse files
Options
Downloads
Patches
Plain Diff
REST API: fix the error 500 when updating a product.
parent
9f526c51
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/api/class/api.class.php
+11
-0
11 additions, 0 deletions
htdocs/api/class/api.class.php
htdocs/product/class/api_products.class.php
+0
-1
0 additions, 1 deletion
htdocs/product/class/api_products.class.php
with
11 additions
and
1 deletion
htdocs/api/class/api.class.php
+
11
−
0
View file @
58c25ff6
...
@@ -88,6 +88,17 @@ class DolibarrApi
...
@@ -88,6 +88,17 @@ class DolibarrApi
// Remove $db object property for object
// Remove $db object property for object
unset
(
$object
->
db
);
unset
(
$object
->
db
);
// Remove the $oldcopy property because it is not supported by the JSON
// encoder. The following error is generated when trying to serialize
// it: "Error encoding/decoding JSON: Type is not supported"
// Note: Event if this property was correctly handled by the JSON
// encoder, it should be ignored because keeping it would let the API
// have a very strange behavior: calling PUT and then GET on the same
// resource would give different results:
// PUT /objects/{id} -> returns object with oldcopy = previous version of the object
// GET /objects/{id} -> returns object with oldcopy empty
unset
(
$object
->
oldcopy
);
// If object has lines, remove $db property
// If object has lines, remove $db property
if
(
isset
(
$object
->
lines
)
&&
count
(
$object
->
lines
)
>
0
)
{
if
(
isset
(
$object
->
lines
)
&&
count
(
$object
->
lines
)
>
0
)
{
$nboflines
=
count
(
$object
->
lines
);
$nboflines
=
count
(
$object
->
lines
);
...
...
This diff is collapsed.
Click to expand it.
htdocs/product/class/api_products.class.php
+
0
−
1
View file @
58c25ff6
...
@@ -275,7 +275,6 @@ class Products extends DolibarrApi
...
@@ -275,7 +275,6 @@ class Products extends DolibarrApi
* @param int $id Id of product to update
* @param int $id Id of product to update
* @param array $request_data Datas
* @param array $request_data Datas
* @return int
* @return int
* FIXME The product is correctluy updated but the API returns an error 500.
*/
*/
function
put
(
$id
,
$request_data
=
NULL
)
function
put
(
$id
,
$request_data
=
NULL
)
{
{
...
...
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