From: cajus Date: Mon, 7 Jul 2008 13:41:23 +0000 (+0000) Subject: Fixed query for product properties X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=02eb9a0288a9ddd246b70c6af95bf665562deb37;p=gosa.git Fixed query for product properties git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11545 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/opsi.pm b/gosa-si/client/events/opsi.pm index 04473295c..3ce4cb33a 100644 --- a/gosa-si/client/events/opsi.pm +++ b/gosa-si/client/events/opsi.pm @@ -93,15 +93,16 @@ sub opsi_get_netboot_products { my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; my $hostId; - # Get hostID if defined - if (defined @{$msg_hash->{'hostId'}}[0]){ - $hostId = @{$msg_hash->{'hostId'}}[0]; - } - # build return message with twisted target and source my $out_hash = &main::create_xml_hash("answer_$header", $target, $source); &add_content2xml_hash($out_hash, "session_id", $session_id); + # Get hostID if defined + if (defined @{$msg_hash->{'hostId'}}[0]){ + $hostId = @{$msg_hash->{'hostId'}}[0]; + &add_content2xml_hash($out_hash, "hostId", $hostId); + } + if (defined $forward_to_gosa) { &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa); } @@ -163,15 +164,16 @@ sub opsi_get_product_properties { my $productId = @{$msg_hash->{'ProductId'}}[0]; my $hostId; - # Get hostID if defined - if (defined @{$msg_hash->{'hostId'}}[0]){ - $hostId = @{$msg_hash->{'hostId'}}[0]; - } - # build return message with twisted target and source my $out_hash = &main::create_xml_hash("answer_$header", $target, $source); &add_content2xml_hash($out_hash, "session_id", $session_id); + # Get hostID if defined + if (defined @{$msg_hash->{'hostId'}}[0]){ + $hostId = @{$msg_hash->{'hostId'}}[0]; + &add_content2xml_hash($out_hash, "hostId", $hostId); + } + if (defined $forward_to_gosa) { &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa); } @@ -180,22 +182,20 @@ sub opsi_get_product_properties { my $xml_msg= &create_xml_string($out_hash); -# Move to getProductProperties_hash prod + objectid - # JSON Query my $callobj = { - method => 'getProductPropertyDefinitions_listOfHashes', + method => 'getProductProperties_hash', params => [ $productId ], id => 1, }; my $res = $client->call($opsi_url, $callobj); - if (check_res($res)){ - foreach my $r (@{$res->result}) { - my $item= ""; + if (check_res($res)){ + my $r= $res->result; foreach my $key (keys %{$r}) { - my $value = $r->{$key}; + my $item= ""; + my $value= $r->{$key}; if (UNIVERSAL::isa( $value, "ARRAY" )){ foreach my $subval (@{$value}){ $item.= "<$key>".xml_quote($subval).""; @@ -203,10 +203,9 @@ sub opsi_get_product_properties { } else { $item.= "<$key>".xml_quote($value).""; } + $item.= ""; + $xml_msg=~ s/<\/xxx>/$item<\/xxx>/; } - $item.= ""; - $xml_msg=~ s/<\/xxx>/$item<\/xxx>/; - } } $xml_msg=~ s/<\/xxx>//;