Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 80c4366a

Von Kivitendo Admin vor fast 9 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
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;
t/shop/shop.t
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;
......
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 });
};
......
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;
templates/webpages/ic/tabs/_shop.html
[%- 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>

Auch abrufbar als: Unified diff