Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision be4b49e5

Von Werner Hahn vor mehr als 6 Jahren hinzugefügt

  • ID be4b49e576514e1731c736ab35f96b3d68bf2a66
  • Vorgänger 5a973c14
  • Nachfolger 8cb6dd85

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