Fixing style errors.
This commit is contained in:
parent
416a2f7f1c
commit
cfa0860d24
@ -914,7 +914,7 @@ class Products extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $resid;
|
return $resid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update attributes by id.
|
* Update attributes by id.
|
||||||
*
|
*
|
||||||
@ -933,22 +933,22 @@ class Products extends DolibarrApi
|
|||||||
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$prodattr = new ProductAttribute($this->db);
|
$prodattr = new ProductAttribute($this->db);
|
||||||
|
|
||||||
$result = $prodattr->fetch((int) $id);
|
$result = $prodattr->fetch((int) $id);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(404, 'Attribute not found');
|
throw new RestException(404, 'Attribute not found');
|
||||||
} elseif ($result < 0) {
|
} elseif ($result < 0) {
|
||||||
throw new RestException(500, "Error fetching attribute");
|
throw new RestException(500, "Error fetching attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
if ($field == 'rowid') { continue;
|
if ($field == 'rowid') { continue;
|
||||||
}
|
}
|
||||||
$prodattr->$field = $value;
|
$prodattr->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($prodattr->update(DolibarrApiAccess::$user) > 0) {
|
if ($prodattr->update(DolibarrApiAccess::$user) > 0) {
|
||||||
$result = $prodattr->fetch((int) $id);
|
$result = $prodattr->fetch((int) $id);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
@ -1190,7 +1190,7 @@ class Products extends DolibarrApi
|
|||||||
}
|
}
|
||||||
throw new RestException(500, "Error creating new attribute value");
|
throw new RestException(500, "Error creating new attribute value");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update attribute value.
|
* Update attribute value.
|
||||||
*
|
*
|
||||||
@ -1208,22 +1208,22 @@ class Products extends DolibarrApi
|
|||||||
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$objectval = new ProductAttributeValue($this->db);
|
$objectval = new ProductAttributeValue($this->db);
|
||||||
$result = $objectval->fetch((int) $id);
|
$result = $objectval->fetch((int) $id);
|
||||||
|
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(404, 'Attribute value not found');
|
throw new RestException(404, 'Attribute value not found');
|
||||||
} elseif ($result < 0) {
|
} elseif ($result < 0) {
|
||||||
throw new RestException(500, "Error fetching attribute value");
|
throw new RestException(500, "Error fetching attribute value");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
foreach($request_data as $field => $value) {
|
||||||
if ($field == 'rowid') { continue;
|
if ($field == 'rowid') { continue;
|
||||||
}
|
}
|
||||||
$objectval->$field = $value;
|
$objectval->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($objectval->update(DolibarrApiAccess::$user) > 0) {
|
if ($objectval->update(DolibarrApiAccess::$user) > 0) {
|
||||||
$result = $objectval->fetch((int) $id);
|
$result = $objectval->fetch((int) $id);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user