Revision cf3a8cf7
Von Sven Schöling vor mehr als 7 Jahren hinzugefügt
SL/Dev/File.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
use base qw(Exporter); |
5 |
our @EXPORT = qw(create_scanned create_uploaded create_created get_all_count get_all get_all_versions delete_all); |
|
5 |
our @EXPORT_OK = qw(create_scanned create_uploaded create_created); |
|
6 |
our %EXPORT_TAGS = (ALL => \@EXPORT_OK); |
|
6 | 7 |
|
7 | 8 |
use SL::DB::File; |
8 | 9 |
|
10 |
my %common_params = ( |
|
11 |
object_id => 1, |
|
12 |
object_type => 'sales_order', |
|
13 |
); |
|
14 |
|
|
9 | 15 |
sub create_scanned { |
10 | 16 |
my (%params) = @_; |
11 | 17 |
$params{source} = 'scanner1'; |
... | ... | |
38 | 44 |
my (%params) = @_; |
39 | 45 |
|
40 | 46 |
my $fileobj = SL::File->save( |
41 |
object_id => 1, |
|
42 |
object_type => 'sales_order', |
|
47 |
%common_params, |
|
43 | 48 |
mime_type => 'text/plain', |
44 | 49 |
description => 'Test File', |
45 | 50 |
file_type => $params{file_type}, |
... | ... | |
51 | 56 |
return $fileobj; |
52 | 57 |
} |
53 | 58 |
|
54 |
sub get_all_count { |
|
55 |
my ($class,%params) = @_; |
|
56 |
$params{object_id} = 1; |
|
57 |
$params{object_type} = 'sales_order'; |
|
58 |
return SL::File->get_all_count(%params); |
|
59 |
} |
|
60 |
|
|
61 |
sub get_all { |
|
62 |
my ($class,%params) = @_; |
|
63 |
$params{object_id} = 1; |
|
64 |
$params{object_type} = 'sales_order'; |
|
65 |
SL::File->get_all(%params); |
|
66 |
} |
|
67 |
|
|
68 |
sub get_all_versions { |
|
69 |
my ($class,%params) = @_; |
|
70 |
$params{object_id} = 1; |
|
71 |
$params{object_type} = 'sales_order'; |
|
72 |
SL::File->get_all_versions(%params); |
|
73 |
} |
|
59 |
sub get_all { SL::File->get_all (%common_params, @_) } |
|
60 |
sub get_all_count { SL::File->get_all_count (%common_params, @_) } |
|
61 |
sub get_all_versions { SL::File->get_all_versions(%common_params, @_) } |
|
62 |
sub delete_all { SL::File->delete_all (%common_params, @_) } |
|
74 | 63 |
|
75 |
sub delete_all { |
|
76 |
my ($class,%params) = @_; |
|
77 |
$params{object_id} = 1; |
|
78 |
$params{object_type} = 'sales_order'; |
|
79 |
SL::File->delete_all(%params); |
|
80 |
} |
|
81 | 64 |
1; |
82 | 65 |
|
83 | 66 |
__END__ |
... | ... | |
94 | 77 |
|
95 | 78 |
=head2 C<create_created %PARAMS> |
96 | 79 |
|
97 |
=head2 C<delete_all> |
|
98 |
|
|
99 | 80 |
=head1 AUTHOR |
100 | 81 |
|
101 | 82 |
Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt> |
Auch abrufbar als: Unified diff
SL::Dev: EXPORT rewrite und create/new split
- SL::Dev module exportieren nicht mehr ungefragt
- SL::Dev::ALL exportiert jetzt den übergebenen tag aus allen Modulen
- Funktionen nicht nicht speichern (Part/CustomerVendor) heißen jetzt
"new_X" anstatt "create_X"