Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 80c4366a

Von Kivitendo Admin vor mehr als 8 Jahren hinzugefügt

  • ID 80c4366a480de328d273e036473442c7a13092e7
  • Vorgänger 58f04310
  • Nachfolger cfe73453

Shop - erster Test mehrere ShopParts in Artikelreiter

Conflicts:
bin/mozilla/ic.pl

Unterschiede anzeigen:

bin/mozilla/ic.pl
1640 1640
  CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $partsgroup_id)
1641 1641
    if (scalar @{ $form->{CUSTOM_VARIABLES} });
1642 1642

  
1643
  my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ], sort_by => 'sortkey');
1644
  $form->{ACTIVE_SHOPS} = $active_shops;
1645
  foreach my $shop ( @$active_shops ) {
1646
    my ($shop_part) =  $part->find_shop_parts( { shop_id => $shop->id } );
1647
    push( @{ $form->{SHOP_PARTS} }, $shop_part );
1648
  };
1649

  
1643 1650
  $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule);
1644 1651
  $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})});") if $::form->{id};
1645 1652
  $form->header;
t/shop/shop.t
31 31

  
32 32
my $VERBOSE = 0;
33 33
my $DEBUG   = 0;
34
my $DANCER  = 0; # activate the mock shop
35

  
34 36

  
35 37
# initialise data:
36 38
my $pricegroup_a = SL::DB::Pricegroup->new(pricegroup => "typ a")->save;
......
110 112

  
111 113
my $shop       = SL::Shop->new( config => $config1 );
112 114
my $shop2      = SL::Shop->new( config => $config2 );
113
my $result     = $shop->connector->get_order('1');
114
my $new_orders = $shop->connector->get_new_orders;
115
my $result     = $shop->connector->get_order('1') if $DANCER;
116
my $new_orders = $shop->connector->get_new_orders if $DANCER;
115 117

  
116 118
# printf("order %s has amount %s\n", $result->{ordnumber}, $result->{amount});
117 119

  
118 120
is( $config1->connector,  'xtcommerce', 'created shop object');
119 121
is( $shop->config->connector,  'xtcommerce', 'created SL::Shop');
120
is( $result->{amount}, '12.34' , 'fetched amount for order 1234');
122
is( $result->{amount}, '12.34' , 'fetched amount for order 1234') if $DANCER;
121 123
is( $shop->connector->url, "http://localhost:3000", 'connector url');
122
is( scalar keys %{ $new_orders } , 2, '2 new orders');
124
is( scalar keys %{ $new_orders } , 2, '2 new orders') if $DANCER;
123 125

  
124 126
my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ]);
125 127
foreach my $shop_config ( @{ $active_shops } ) {
126 128
  my $shop = SL::Shop->new( config => $shop_config );
127
  my $new_orders = $shop->connector->get_new_orders;
129
  my $new_orders = $shop->connector->get_new_orders if $DANCER;
128 130
  # printf("Shop \"%s\" has %s new orders\n", $shop->config->description, scalar keys %{ $new_orders });
129 131
};
130 132

  
......
185 187
my $s2p1 = SL::DB::ShopPart->new( part => $part,
186 188
                                  shop => $config2,
187 189
                                  last_update => $dt2,
188
                                  shop_description => 'marketing speak for part 1 shop 2',
190
                                  shop_description => 'marketing speak for part 1 in shop 2',
189 191
                                  itime => $part_itime,
190 192
                                )->save;
191 193

  
templates/webpages/ic/tabs/_shop.html
1 1
[%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%]
2 2

  
3 3
<div id="shop_variables">
4
[% LxERP.t8("Active shops:") %]
5
 <table>
6
  <thead>
7
  <tr>
8
   <th>[% LxERP.t8("Description") %]</th>
9
   <th>[% LxERP.t8("Description") %]</th>
10
  </tr>
11
  </thead>
12
  [%- FOREACH shop = ACTIVE_SHOPS %]
13
  <tr>
14
   <td>[% HTML.escape( shop.description ) %]</td>
15
   <td>[% HTML.escape( shop.description ) %]</td>
16
  </tr>
17
  [%- END %]
18
</table>
19

  
20
 <table>
21
  <thead>
22
  <tr>
23
   <th>[% LxERP.t8("Shop") %]</th>
24
   <th>[% LxERP.t8("Shop part") %]</th>
25
   <th>[% LxERP.t8("Last update") %]</th>
26
  </tr>
27
  </thead>
28
  [%- FOREACH shop_part = SHOP_PARTS %]
29
  <tr>
30
   <td>[% HTML.escape( shop_part.shop.description ) %]</td>
31
   <td>[% HTML.escape( shop_part.shop_description ) %]</td>
32
   <td>[% HTML.escape( shop_part.last_update.to_kivitendo('precision' => 'minute') ) %]</td>
33
  </tr>
34
  [%- END %]
35
</table>
36

  
37
<br><br>
38

  
4 39
 <table>
5 40
  <tr>
6 41
   <td>[% LxERP.t8("Description") %]</td>
7
   <td>[% L.textarea_tag("shop_shop_description", shop_part.shop_description) %]</td>
42
   <td>[% L.textarea_tag("shop_description", shop_part.shop_description) %]</td>
8 43
  </tr>
9 44
  <tr>
10 45
   <td>[% LxERP.t8("Sort order") %]</td>

Auch abrufbar als: Unified diff