5 our @EXPORT = qw(create_scanned create_uploaded create_created get_all_count get_all get_all_versions delete_all);
11 $params{source} = 'scanner1';
12 $params{file_type} = 'document';
13 $params{file_path} = '/var/tmp/'.$params{file_name} if !$params{file_path};
14 open(OUT,"> ".$params{file_path});
15 print OUT $params{file_contents};
17 delete $params{file_contents};
18 my $file = _create_file(%params);
19 unlink($params{file_path});
25 $params{source} = 'uploaded';
26 $params{file_type} = 'attachment';
27 return _create_file(%params);
32 $params{source} = 'created';
33 $params{file_type} = 'document';
34 return _create_file(%params);
40 my $fileobj = SL::File->save(
42 object_type => 'sales_order',
43 mime_type => 'text/plain',
44 description => 'Test File',
45 file_type => $params{file_type},
46 source => $params{source},
47 file_name => $params{file_name},
48 file_contents => $params{file_contents},
49 file_path => $params{file_path}
55 my ($class,%params) = @_;
56 $params{object_id} = 1;
57 $params{object_type} = 'sales_order';
58 return SL::File->get_all_count(%params);
62 my ($class,%params) = @_;
63 $params{object_id} = 1;
64 $params{object_type} = 'sales_order';
65 SL::File->get_all(%params);
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);
76 my ($class,%params) = @_;
77 $params{object_id} = 1;
78 $params{object_type} = 'sales_order';
79 SL::File->delete_all(%params);
87 SL::Dev::File - create file objects for testing, with minimal defaults
91 =head2 C<create_scanned %PARAMS>
93 =head2 C<create_uploaded %PARAMS>
95 =head2 C<create_created %PARAMS>
101 Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>