FIXED : product webservice can now save barcode

This commit is contained in:
Arnaud Aujon Chevallier 2015-02-09 13:55:43 +01:00
parent 65efa7ddf7
commit 5747dbfe9b

View File

@ -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'];