From 00ee6e9960b700ca4e84ca19bcef102f3337444a Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 5 Nov 2012 03:45:54 +0100 Subject: [PATCH 1/4] Can have the thirdparty status 'active' when creating by webservices --- htdocs/webservices/server_thirdparty.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index f23bee5f631..2e6cfbc083c 100755 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -94,6 +94,7 @@ $server->wsdl->addComplexType( 'ref' => array('name'=>'name','type'=>'xsd:string'), 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'), 'fk_user_author' => array('name'=>'fk_user_author','type'=>'xsd:string'), + 'status' => array('name'=>'status','type'=>'xsd:string'), 'client' => array('name'=>'client','type'=>'xsd:string'), 'supplier' => array('name'=>'supplier','type'=>'xsd:string'), 'customer_code' => array('name'=>'customer_code','type'=>'xsd:string'), From 9eac0d06ec6f370848b3c59d3f4b4c9d5392fafd Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 6 Nov 2012 01:41:31 +0100 Subject: [PATCH 2/4] Add price_ttc value in product properties when call by webservice --- htdocs/webservices/server_productorservice.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index f9cc7334828..f486d3d95fb 100755 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -109,6 +109,7 @@ $server->wsdl->addComplexType( 'price_net' => array('name'=>'price_net','type'=>'xsd:string'), 'price' => array('name'=>'price','type'=>'xsd:string'), + 'price_ttc' => array('name'=>'price_ttc','type'=>'xsd:string'), 'price_base_type' => array('name'=>'price_base_type','type'=>'xsd:string'), 'stock_alert' => array('name'=>'stock_alert','type'=>'xsd:string'), @@ -278,6 +279,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='') 'price_net' => $product->price, 'price' => ($product->price_ttc-$product->price), 'vat_rate' => $product->tva_tx, + 'price_ttc' => $product->price_ttc, 'price_base_type' => $product->price_base_type, 'stock_real' => $product->stock_reel, From 8175a9a7e5780a5d5746319ce603e980d6854dd8 Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 6 Nov 2012 15:16:49 +0100 Subject: [PATCH 3/4] Add image information in webservice product --- .../webservices/server_productorservice.php | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index f486d3d95fb..3a69061e459 100755 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -1,5 +1,6 @@ + * Copyright (C) 2012 JF FERRY * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -116,10 +117,49 @@ $server->wsdl->addComplexType( 'stock_real' => array('name'=>'stock_real','type'=>'xsd:string'), 'stock_pmp' => array('name'=>'stock_pmp','type'=>'xsd:string'), 'canvas' => array('name'=>'canvas','type'=>'xsd:string'), - 'import_key' => array('name'=>'import_key','type'=>'xsd:string') + 'import_key' => array('name'=>'import_key','type'=>'xsd:string'), + + 'dir' => array('name'=>'dir','type'=>'xsd:string'), + 'photos' => array('name'=>'photos','type'=>'tns:PhotosArray') ) ); + +/* + * Image of product +*/ +$server->wsdl->addComplexType( + 'PhotosArray', + 'complexType', + 'array', + '', + 'SOAP-ENC:Array', + array(), + array( + array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]') + ), + '' +); + +/* + * An image +*/ +$server->wsdl->addComplexType( + 'image', + 'complexType', + 'array', + '', + 'SOAP-ENC:Array', + array(), + array( + 'photo' => array('name'=>'photo','type'=>'xsd:string'), + 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), + 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), + 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') + ) +); + + // Define other specific objects $server->wsdl->addComplexType( 'filterproduct', @@ -255,6 +295,10 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='') $result=$product->fetch($id,$ref,$ref_ext); if ($result > 0) { + $dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output); + $pdir = get_exdir($obj->id,2) . $obj->id ."/photos/"; + $dir = $dir . '/'. $pdir; + // Create $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), @@ -285,7 +329,9 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='') 'stock_real' => $product->stock_reel, 'stock_alert' => $product->seuil_stock_alerte, 'pmp' => $product->pmp, - 'import_key' => $product->import_key + 'import_key' => $product->import_key, + 'dir' => $pdir, + 'photos' => $obj->liste_photos($dir,$nbmax=10) )); } else From 8a69a258fd098c8dc8a305b35fdb05e3fd21aedd Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 6 Nov 2012 16:18:26 +0100 Subject: [PATCH 4/4] image information in webservice product : fix wrong objet --- htdocs/webservices/server_productorservice.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 3a69061e459..0bba1e80058 100755 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -27,6 +27,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -137,8 +138,7 @@ $server->wsdl->addComplexType( array(), array( array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]') - ), - '' + ) ); /* @@ -296,7 +296,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='') if ($result > 0) { $dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output); - $pdir = get_exdir($obj->id,2) . $obj->id ."/photos/"; + $pdir = get_exdir($product->id,2) . $product->id ."/photos/"; $dir = $dir . '/'. $pdir; // Create @@ -331,7 +331,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='') 'pmp' => $product->pmp, 'import_key' => $product->import_key, 'dir' => $pdir, - 'photos' => $obj->liste_photos($dir,$nbmax=10) + 'photos' => $product->liste_photos($dir,$nbmax=10) )); } else