commit 80c4366a480de328d273e036473442c7a13092e7
Author: Geoffrey Richardson <information@kivitendo-premium.de>
Date:   Fri Sep 25 11:51:39 2015 +0200

    Shop - erster Test mehrere ShopParts in Artikelreiter
    
    Conflicts:
            bin/mozilla/ic.pl

diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl
index 6cb9e9cd8..cc0dd01c6 100644
--- a/bin/mozilla/ic.pl
+++ b/bin/mozilla/ic.pl
@@ -1640,6 +1640,13 @@ sub form_header {
   CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $partsgroup_id)
     if (scalar @{ $form->{CUSTOM_VARIABLES} });
 
+  my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ], sort_by => 'sortkey');
+  $form->{ACTIVE_SHOPS} = $active_shops;
+  foreach my $shop ( @$active_shops ) {
+    my ($shop_part) =  $part->find_shop_parts( { shop_id => $shop->id } );
+    push( @{ $form->{SHOP_PARTS} }, $shop_part );
+  };
+
   $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule);
   $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})});") if $::form->{id};
   $form->header;
diff --git a/t/shop/shop.t b/t/shop/shop.t
index e811918f2..3f28cc0cd 100644
--- a/t/shop/shop.t
+++ b/t/shop/shop.t
@@ -31,6 +31,8 @@ clear_up();
 
 my $VERBOSE = 0;
 my $DEBUG   = 0;
+my $DANCER  = 0; # activate the mock shop
+
 
 # initialise data:
 my $pricegroup_a = SL::DB::Pricegroup->new(pricegroup => "typ a")->save;
@@ -110,21 +112,21 @@ my $config2 = SL::DB::Shop->new( description => 'TestShop 2',
 
 my $shop       = SL::Shop->new( config => $config1 );
 my $shop2      = SL::Shop->new( config => $config2 );
-my $result     = $shop->connector->get_order('1');
-my $new_orders = $shop->connector->get_new_orders;
+my $result     = $shop->connector->get_order('1') if $DANCER;
+my $new_orders = $shop->connector->get_new_orders if $DANCER;
 
 # printf("order %s has amount %s\n", $result->{ordnumber}, $result->{amount});
 
 is( $config1->connector,  'xtcommerce', 'created shop object');
 is( $shop->config->connector,  'xtcommerce', 'created SL::Shop');
-is( $result->{amount}, '12.34' , 'fetched amount for order 1234');
+is( $result->{amount}, '12.34' , 'fetched amount for order 1234') if $DANCER;
 is( $shop->connector->url, "http://localhost:3000", 'connector url');
-is( scalar keys %{ $new_orders } , 2, '2 new orders');
+is( scalar keys %{ $new_orders } , 2, '2 new orders') if $DANCER;
 
 my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ]);
 foreach my $shop_config ( @{ $active_shops } ) {
   my $shop = SL::Shop->new( config => $shop_config );
-  my $new_orders = $shop->connector->get_new_orders;
+  my $new_orders = $shop->connector->get_new_orders if $DANCER;
   # printf("Shop \"%s\" has %s new orders\n", $shop->config->description, scalar keys %{ $new_orders });
 };
 
@@ -185,7 +187,7 @@ my $s1p2 = SL::DB::ShopPart->new( part => $part2,
 my $s2p1 = SL::DB::ShopPart->new( part => $part,
                                   shop => $config2,
                                   last_update => $dt2,
-                                  shop_description => 'marketing speak for part 1 shop 2',
+                                  shop_description => 'marketing speak for part 1 in shop 2',
                                   itime => $part_itime,
                                 )->save;
 
diff --git a/templates/webpages/ic/tabs/_shop.html b/templates/webpages/ic/tabs/_shop.html
index 849d32dcc..a7aa6f367 100644
--- a/templates/webpages/ic/tabs/_shop.html
+++ b/templates/webpages/ic/tabs/_shop.html
@@ -1,10 +1,45 @@
 [%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%]
 
 <div id="shop_variables">
+[% LxERP.t8("Active shops:") %]
+ <table>
+  <thead>
+  <tr>
+   <th>[% LxERP.t8("Description") %]</th>
+   <th>[% LxERP.t8("Description") %]</th>
+  </tr>
+  </thead>
+  [%- FOREACH shop = ACTIVE_SHOPS %]
+  <tr>
+   <td>[% HTML.escape( shop.description ) %]</td>
+   <td>[% HTML.escape( shop.description ) %]</td>
+  </tr>
+  [%- END %]
+</table>
+
+ <table>
+  <thead>
+  <tr>
+   <th>[% LxERP.t8("Shop") %]</th>
+   <th>[% LxERP.t8("Shop part") %]</th>
+   <th>[% LxERP.t8("Last update") %]</th>
+  </tr>
+  </thead>
+  [%- FOREACH shop_part = SHOP_PARTS %]
+  <tr>
+   <td>[% HTML.escape( shop_part.shop.description ) %]</td>
+   <td>[% HTML.escape( shop_part.shop_description ) %]</td>
+   <td>[% HTML.escape( shop_part.last_update.to_kivitendo('precision' => 'minute') ) %]</td>
+  </tr>
+  [%- END %]
+</table>
+
+<br><br>
+
  <table>
   <tr>
    <td>[% LxERP.t8("Description") %]</td>
-   <td>[% L.textarea_tag("shop_shop_description", shop_part.shop_description) %]</td>
+   <td>[% L.textarea_tag("shop_description", shop_part.shop_description) %]</td>
   </tr>
   <tr>
    <td>[% LxERP.t8("Sort order") %]</td>
