Shop: Not Yet Implemented Errors falls eine Shopware6 Config gespeichert wird
[kivitendo-erp.git] / SL / DB / Shop.pm
1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
3
4 package SL::DB::Shop;
5
6 use strict;
7
8 use SL::DB::MetaSetup::Shop;
9 use SL::DB::Manager::Shop;
10 use SL::DB::Helper::ActsAsList;
11 use SL::Locale::String qw(t8);
12
13 __PACKAGE__->meta->initialize;
14
15 sub validate {
16   my ($self) = @_;
17
18   my @errors;
19   # critical checks
20   push @errors, $::locale->text('The description is missing.') unless $self->{description};
21   push @errors, $::locale->text('The path is missing.')        unless $self->{path};
22   push @errors, $::locale->text('The Host Name is missing')    unless $self->{server};
23   push @errors, $::locale->text('The Host Name seems invalid') unless $self->{server} =~ m/[0-9A-Za-z].\.[0-9A-Za-z]/;
24   push @errors, $::locale->text('Orders to fetch neeeds a positive Integer')
25                                                                unless $self->{orders_to_fetch} > 0;
26
27   # not yet implemented checks
28   push @errors, $::locale->text('Transaction Description is not yet implemented')   if $self->{transaction_description};
29   if ($self->{connector} eq 'shopware6') {
30     push @errors, $::locale->text('Shipping cost article not implemented')          if $self->{shipping_costs_parts_id};
31     push @errors, $::locale->text('Fetch from last order number not implemented')   if $self->{last_order_number};
32   }
33   return @errors;
34 }
35
36 sub shops_dd {
37   my ( $self ) = @_;
38
39   my @shops_dd = ( { title => t8("all") ,   value =>'' } );
40   my $shops = SL::DB::Manager::Shop->get_all( where => [ obsolete => 0 ] );
41   my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ;
42   push @shops_dd, @tmp;
43   return \@shops_dd;
44 }
45
46 1;
47
48 __END__
49
50 =pod
51
52 =encoding utf-8
53
54 =head1 NAME
55
56 SL::DB::Shop - Model for the 'shops' table
57
58 =head1 SYNOPSIS
59
60 This is a standard Rose::DB::Object based model and can be used as one.
61
62 =head1 METHODS
63
64 =over 4
65
66 =item C<validate>
67
68 Returns an error if the shop description is missing
69
70 =item C<shops_dd>
71
72 Returns an array of hashes for dropdowns in filters
73
74 =back
75
76 =head1 AUTHORS
77
78 Werner Hahn E<lt>wh@futureworldsearch.netE<gt>
79
80 G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>
81
82 =cut