Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7b03930b

Von Werner Hahn vor etwa 7 Jahren hinzugefügt

  • ID 7b03930ba3452d17c42a23958fbb0b85e350d48c
  • Vorgänger de7d54fb
  • Nachfolger c9ba2b5b

Shopmodul: Anpassungen nach mergen für master
Bis hier noch mit individuellen Kundenanpassungen

Unterschiede anzeigen:

SL/Shop.pm
1 1
package SL::Shop;
2
#package SL::Shop;
3 2

  
4 3
use strict;
5 4

  
6 5
use parent qw(Rose::Object);
6
use SL::ShopConnector::ALL;
7
use SL::DB::Part;
7 8

  
8 9
# __PACKAGE__->run_before('check_auth');
9 10

  
......
12 13
  'scalar --get_set_init' => [ qw(connector) ],
13 14
);
14 15

  
16
sub updatable_parts {
17
  my ($self, $last_update) = @_;
18
  $last_update ||= DateTime->now(); # need exact timestamp, with minutes
19

  
20
  my $parts;
21
  my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ]);
22
  foreach my $shop ( @{ $active_shops } ) {
23
    # maybe run as an iterator? does that make sense with with_objects?
24
    my $update_parts = SL::DB::Manager::ShopPart->get_all(query => [
25
             and => [
26
                'active' => 1,
27
                'shop_id' => $shop->id,
28
                # shop => '1',
29
                or => [ 'part.mtime' => { ge => $last_update },
30
                        'part.itime' => { ge => $last_update },
31
                        'itime'      => { ge => $last_update },
32
                        'mtime'      => { ge => $last_update },
33
                      ],
34
                    ]
35
             ],
36
             with_objects => ['shop', 'part'],
37
             # multi_many_ok   => 1,
38
          );
39
    push( @{ $parts }, @{ $update_parts });
40
  };
41
  return $parts;
42

  
43
};
44

  
15 45
sub init_connector {
16 46
  my ($self) = @_;
17 47
  # determine the connector from the connector type in the webshop config
18
  return SL::ShopConnector::ALL->shop_connector_class_by_name($self->config->connector)->new( config => $self->config); 
48
  return SL::ShopConnector::ALL->shop_connector_class_by_name($self->config->connector)->new( config => $self->config);
19 49

  
20 50
};
21 51

  
......
27 57

  
28 58
=head1 NAME
29 59

  
30
SL::WebShop - Do stuff with WebShop instances
60
  SL::Shop - Do stuff with WebShop instances
31 61

  
32 62
=head1 SYNOPSIS
33 63

  
34
  my $config = SL::DB::Manager::WebShop->get_first();
64
  my $config = SL::DB::Manager::Shop->get_first();
35 65
  my $shop = SL::WebShop->new( config => $config );
36 66

  
37
From the config we know which Connector class to load, save in $shop->connector
38
and do stuff from there:
67
  From the config we know which Connector class to load, save in $shop->connector
68
  and do stuff from there:
39 69

  
40 70
  $shop->connector->get_new_orders;
41 71

  
......
43 73

  
44 74
=head1 BUGS
45 75

  
46
Nothing here yet.
76
  Nothing here yet.
47 77

  
48 78
=head1 AUTHOR
49 79

  
50
G. Richardson <lt>information@kivitendo-premium.deE<gt>
80
  G. Richardson <lt>information@kivitendo-premium.deE<gt>
51 81

  
52 82
=cut
53

  

Auch abrufbar als: Unified diff