Revision d55cf346
Von Kivitendo Admin vor fast 8 Jahren hinzugefügt
SL/Dev/Record.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
use base qw(Exporter); |
5 |
our @EXPORT = qw(create_invoice_item create_sales_invoice create_order_item create_sales_order create_purchase_order create_delivery_order_item create_sales_delivery_order); |
|
5 |
our @EXPORT = qw(create_invoice_item create_sales_invoice create_order_item create_sales_order create_purchase_order create_delivery_order_item create_sales_delivery_order create_project);
|
|
6 | 6 |
|
7 | 7 |
use SL::DB::Invoice; |
8 | 8 |
use SL::DB::InvoiceItem; |
9 | 9 |
use SL::DB::Employee; |
10 | 10 |
use SL::Dev::Part; |
11 | 11 |
use SL::Dev::CustomerVendor; |
12 |
use SL::DB::Project; |
|
13 |
use SL::DB::ProjectStatus; |
|
14 |
use SL::DB::ProjectType; |
|
12 | 15 |
use DateTime; |
13 | 16 |
|
14 | 17 |
my %record_type_to_item_type = ( sales_invoice => 'SL::DB::InvoiceItem', |
... | ... | |
208 | 211 |
return [ $item1, $item2 ]; |
209 | 212 |
} |
210 | 213 |
|
214 |
sub create_project { |
|
215 |
my (%params) = @_; |
|
216 |
my $project = SL::DB::Project->new( |
|
217 |
projectnumber => 1, |
|
218 |
description => "Test project", |
|
219 |
active => 1, |
|
220 |
valid => 1, |
|
221 |
project_status_id => SL::DB::Manager::ProjectStatus->find_by(name => "running")->id, |
|
222 |
project_type_id => SL::DB::Manager::ProjectType->find_by(description => "Standard")->id, |
|
223 |
%params, |
|
224 |
)->save; |
|
225 |
return $project; |
|
226 |
} |
|
227 |
|
|
211 | 228 |
1; |
212 | 229 |
|
213 | 230 |
__END__ |
... | ... | |
285 | 302 |
invoiceitems => [ $item ], |
286 | 303 |
); |
287 | 304 |
|
305 |
=head2 C<create_project %PARAMS> |
|
306 |
|
|
307 |
Creates a default project. |
|
308 |
|
|
309 |
Minimal example, creating a project with status "running" and type "Standard": |
|
310 |
my $project = SL::Dev::Record::create_project(); |
|
311 |
|
|
312 |
$project = SL::Dev::Record::create_project( |
|
313 |
projectnumber => 'p1', |
|
314 |
description => 'Test project', |
|
315 |
) |
|
316 |
|
|
288 | 317 |
=head1 TODO |
289 | 318 |
|
290 | 319 |
=head1 BUGS |
Auch abrufbar als: Unified diff
SL::Dev::Record - neue Funktion create_project