Skip to content
Snippets Groups Projects
Commit 8f339712 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #2338 from aaujon/3.6-webservice-product-barcode

FIXED : product webservice can now save barcode
parents 89b93648 5747dbfe
No related branches found
No related tags found
No related merge requests found
......@@ -452,6 +452,12 @@ function createProductOrService($authentication,$product)
$error++; $errorcode='KO'; $errorlabel="You must choose between price or price_net to provide price.";
}
if ($product['barcode'] && !$product['barcode_type'])
{
$errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode.";
}
if (! $error)
{
......@@ -473,6 +479,12 @@ function createProductOrService($authentication,$product)
$newobject->price_base_type=$product['price_base_type'];
$newobject->date_creation=$now;
if ($product['barcode'])
{
$newobject->barcode = $product['barcode'];
$newobject->barcode_type = $product['barcode_type'];
}
$newobject->stock_reel=$product['stock_real'];
$newobject->pmp=$product['pmp'];
$newobject->seuil_stock_alert=$product['stock_alert'];
......@@ -562,6 +574,11 @@ function updateProductOrService($authentication,$product)
}
if ($product['barcode'] && !$product['barcode_type'])
{
$errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode.";
}
if (! $error)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
......@@ -584,6 +601,12 @@ function updateProductOrService($authentication,$product)
$newobject->price_base_type=$product['price_base_type'];
$newobject->date_creation=$now;
if ($product['barcode'])
{
$newobject->barcode = $product['barcode'];
$newobject->barcode_type = $product['barcode_type'];
}
$newobject->stock_reel=$product['stock_real'];
$newobject->pmp=$product['pmp'];
$newobject->seuil_stock_alert=$product['stock_alert'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment