From 72608e7a725060c761c8e4d54a6139e141a3e8ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Nov 2012 23:43:14 +0100 Subject: [PATCH] Fix: Checkstyle --- htdocs/webservices/server_category.php | 27 ++++--- .../webservices/server_productorservice.php | 78 +++++++++---------- 2 files changed, 50 insertions(+), 55 deletions(-) diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index b08aa90d763..713fcd70fe4 100755 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -1,7 +1,7 @@ * 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 * the Free Software Foundation; either version 2 of the License, or @@ -67,7 +67,7 @@ $server->wsdl->addComplexType( 'entity' => array('name'=>'entity','type'=>'xsd:string'), ) ); - + /* * Une catégorie */ @@ -90,7 +90,7 @@ $server->wsdl->addComplexType( 'filles' => array('name'=>'filles','type'=>'tns:FillesArray') ) ); - + /* * Les catégories filles, sous tableau dez la catégorie */ @@ -123,12 +123,12 @@ $server->wsdl->addComplexType( 'tns:categories' ); */ - + /* * Les photos de la catégorie (un tableau indéxé qui contient les images avec leur vignette) */ - $server->wsdl->addComplexType( - 'PhotosArray', +$server->wsdl->addComplexType( + 'PhotosArray', 'complexType', 'array', '', @@ -137,7 +137,7 @@ $server->wsdl->addComplexType( array( array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]') ), -'' + '' ); /* @@ -235,7 +235,7 @@ function getCategory($authentication,$id) $dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output); $pdir = get_exdir($categorie->id,2) . $categorie->id ."/photos/"; $dir = $dir . '/'. $pdir; - + $cat = array( 'id' => $categorie->id, 'id_mere' => $categorie->id_mere, @@ -247,11 +247,10 @@ function getCategory($authentication,$id) 'dir' => $pdir, 'photos' => $categorie->liste_photos($dir,$nbmax=10) ); - + $cats = $categorie->get_filles(); - if (sizeof ($cats) > 0) + if (count($cats) > 0) { - foreach($cats as $fille) { $dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output); @@ -268,11 +267,11 @@ function getCategory($authentication,$id) 'dir' => $pdir, 'photos' => $fille->liste_photos($dir,$nbmax=10) ); - + } - + } - + // Create $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index b256621fb79..cb6e033e85a 100755 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -116,7 +116,7 @@ $server->wsdl->addComplexType( 'price_ttc' => array('name'=>'price_ttc','type'=>'xsd:string'), 'price_min' => array('name'=>'price_min','type'=>'xsd:string'), 'price_min_ttc' => array('name'=>'price_min_ttc','type'=>'xsd:string'), - + 'price_base_type' => array('name'=>'price_base_type','type'=>'xsd:string'), 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:string'), @@ -622,68 +622,64 @@ function getProductsForCategory($authentication,$id) $res = $db->query($sql); if ($res) { - - while ($rec = $db->fetch_array ($res)) + while ($rec = $db->fetch_array($res)) { - $obj = new Product ($db); - $obj->fetch ($rec['fk_'.$field]); - if($obj->status > 0 ) { - + $obj = new Product($db); + $obj->fetch($rec['fk_'.$field]); + if($obj->status > 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; - + $products[] = array( - - 'id' => $obj->id, - 'ref' => $obj->ref, - 'ref_ext' => $obj->ref_ext, - 'label' => $obj->label, - 'description' => $obj->description, - 'date_creation' => dol_print_date($obj->date_creation,'dayhourrfc'), - 'date_modification' => dol_print_date($obj->date_modification,'dayhourrfc'), - 'note' => $obj->note, - 'status_tosell' => $obj->status, - 'status_tobuy' => $obj->status_buy, - 'type' => $obj->type, - 'barcode' => $obj->barcode, - 'barcode_type' => $obj->barcode_type, - 'country_id' => $obj->country_id>0?$obj->country_id:'', - 'country_code' => $obj->country_code, - 'custom_code' => $obj->customcode, + 'id' => $obj->id, + 'ref' => $obj->ref, + 'ref_ext' => $obj->ref_ext, + 'label' => $obj->label, + 'description' => $obj->description, + 'date_creation' => dol_print_date($obj->date_creation,'dayhourrfc'), + 'date_modification' => dol_print_date($obj->date_modification,'dayhourrfc'), + 'note' => $obj->note, + 'status_tosell' => $obj->status, + 'status_tobuy' => $obj->status_buy, + 'type' => $obj->type, + 'barcode' => $obj->barcode, + 'barcode_type' => $obj->barcode_type, + 'country_id' => $obj->country_id>0?$obj->country_id:'', + 'country_code' => $obj->country_code, + 'custom_code' => $obj->customcode, - 'price_net' => $obj->price, - 'price' => ($obj->price_ttc-$obj->price), - 'vat_rate' => $obj->tva_tx, - 'price_ttc' => $obj->price_ttc, - 'price_base_type' => $obj->price_base_type, + 'price_net' => $obj->price, + 'price' => ($obj->price_ttc-$obj->price), + 'vat_rate' => $obj->tva_tx, + 'price_ttc' => $obj->price_ttc, + 'price_base_type' => $obj->price_base_type, - 'stock_real' => $obj->stock_reel, - 'stock_alert' => $obj->seuil_stock_alerte, - 'pmp' => $obj->pmp, - 'import_key' => $obj->import_key, - 'dir' => $pdir, - 'photos' => $obj->liste_photos($dir,$nbmax=10) - - + 'stock_real' => $obj->stock_reel, + 'stock_alert' => $obj->seuil_stock_alerte, + 'pmp' => $obj->pmp, + 'import_key' => $obj->import_key, + 'dir' => $pdir, + 'photos' => $obj->liste_photos($dir,$nbmax=10) ); } } - + // Retour $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), 'products'=> $products ); - + } else { $errorcode='NORECORDS_FOR_ASSOCIATION'; $errorlabel='No products associated'.$sql; $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); dol_syslog("getProductsForCategory:: ".$c->error, LOG_DEBUG); - + } } else