5 use parent qw(Rose::Object);
 
   6 use SL::ShopConnector::ALL;
 
   9 use Rose::Object::MakeMethods::Generic (
 
  10   'scalar'                => [ qw(config) ],
 
  11   'scalar --get_set_init' => [ qw(connector) ],
 
  15   my ($self, $last_update) = @_;
 
  16   $last_update ||= DateTime->now(); # need exact timestamp, with minutes
 
  19   my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ]);
 
  20   foreach my $shop ( @{ $active_shops } ) {
 
  21     # maybe run as an iterator? does that make sense with with_objects?
 
  22     my $update_parts = SL::DB::Manager::ShopPart->get_all(query => [
 
  25                 'shop_id' => $shop->id,
 
  27                 or => [ 'part.mtime' => { ge => $last_update },
 
  28                         'part.itime' => { ge => $last_update },
 
  29                         'itime'      => { ge => $last_update },
 
  30                         'mtime'      => { ge => $last_update },
 
  34              with_objects => ['shop', 'part'],
 
  37     push( @{ $parts }, @{ $update_parts });
 
  43 sub check_connectivity {
 
  45   my $version = $self->connector->get_version;
 
  51   # determine the connector from the connector type in the webshop config
 
  52   return SL::ShopConnector::ALL->shop_connector_class_by_name($self->config->connector)->new( config => $self->config);
 
  64 SL::Shop - Do stuff with WebShop instances
 
  68 my $config = SL::DB::Manager::Shop->get_first();
 
  69 my $shop = SL::Shop->new( config => $config );
 
  71 From the config we know which Connector class to load, save in $shop->connector
 
  72 and do stuff from there:
 
  74 $shop->connector->get_new_orders;
 
  80 =item C<updatable_parts>
 
  82 =item C<check_connectivity>
 
  84 =item C<init_connector>
 
  94 G. Richardson <lt>information@kivitendo-premium.deE<gt>