Revision 735c1772
Von Werner Hahn vor mehr als 7 Jahren hinzugefügt
SL/Controller/File.pm | ||
---|---|---|
44 | 44 |
__PACKAGE__->run_before('check_object_params', only => [ qw(list ajax_delete ajax_importdialog ajax_import ajax_unimport ajax_upload ajax_files_uploaded) ]); |
45 | 45 |
|
46 | 46 |
my %file_types = ( |
47 |
'sales_quotation' => { gen => 1, gltype => '', dir => 'SalesQuotation', model => 'Order', right => 'import_ar' }, |
|
48 |
'sales_order' => { gen => 1, gltype => '', dir => 'SalesOrder', model => 'Order', right => 'import_ar' }, |
|
49 |
'sales_delivery_order' => { gen => 1, gltype => '', dir => 'SalesDeliveryOrder', model => 'DeliveryOrder', right => 'import_ar' }, |
|
50 |
'invoice' => { gen => 1, gltype => 'ar', dir => 'SalesInvoice', model => 'Invoice', right => 'import_ar' }, |
|
51 |
'credit_note' => { gen => 1, gltype => '', dir => 'CreditNote', model => 'Invoice', right => 'import_ar' }, |
|
52 |
'request_quotation' => { gen => 3, gltype => '', dir => 'RequestForQuotation', model => 'Order', right => 'import_ap' }, |
|
53 |
'purchase_order' => { gen => 3, gltype => '', dir => 'PurchaseOrder', model => 'Order', right => 'import_ap' }, |
|
54 |
'purchase_delivery_order' => { gen => 3, gltype => '', dir => 'PurchaseDeliveryOrder', model => 'DeliveryOrder', right => 'import_ap' }, |
|
55 |
'purchase_invoice' => { gen => 2, gltype => 'ap', dir => 'PurchaseInvoice', model => 'PurchaseInvoice', right => 'import_ap' }, |
|
56 |
'vendor' => { gen => 0, gltype => '', dir => 'Vendor', model => 'Vendor', right => 'xx' }, |
|
57 |
'customer' => { gen => 1, gltype => '', dir => 'Customer', model => 'Customer', right => 'xx' }, |
|
58 |
'part' => { gen => 0, gltype => '', dir => 'Part', model => 'Part', right => 'xx' }, |
|
59 |
'gl_transaction' => { gen => 2, gltype => 'gl', dir => 'GeneralLedger', model => 'GLTransaction', right => 'import_ap' }, |
|
60 |
'draft' => { gen => 0, gltype => '', dir => 'Draft', model => 'Draft', right => 'xx' }, |
|
61 |
'csv_customer' => { gen => 1, gltype => '', dir => 'Reports', model => 'Customer', right => 'xx' }, |
|
62 |
'csv_vendor' => { gen => 1, gltype => '', dir => 'Reports', model => 'Vendor', right => 'xx' }, |
|
47 |
'sales_quotation' => { gen => 1, gltype => '', dir =>'SalesQuotation', model => 'Order', right => 'import_ar' }, |
|
48 |
'sales_order' => { gen => 1, gltype => '', dir =>'SalesOrder', model => 'Order', right => 'import_ar' }, |
|
49 |
'sales_delivery_order' => { gen => 1, gltype => '', dir =>'SalesDeliveryOrder', model => 'DeliveryOrder', right => 'import_ar' }, |
|
50 |
'invoice' => { gen => 1, gltype => 'ar', dir =>'SalesInvoice', model => 'Invoice', right => 'import_ar' }, |
|
51 |
'credit_note' => { gen => 1, gltype => '', dir =>'CreditNote', model => 'Invoice', right => 'import_ar' }, |
|
52 |
'request_quotation' => { gen => 3, gltype => '', dir =>'RequestForQuotation', model => 'Order', right => 'import_ap' }, |
|
53 |
'purchase_order' => { gen => 3, gltype => '', dir =>'PurchaseOrder', model => 'Order', right => 'import_ap' }, |
|
54 |
'purchase_delivery_order' => { gen => 3, gltype => '', dir =>'PurchaseDeliveryOrder',model => 'DeliveryOrder', right => 'import_ap' }, |
|
55 |
'purchase_invoice' => { gen => 2, gltype => 'ap', dir =>'PurchaseInvoice', model => 'PurchaseInvoice',right => 'import_ap' }, |
|
56 |
'vendor' => { gen => 0, gltype => '', dir =>'Vendor', model => 'Vendor', right => 'xx' }, |
|
57 |
'customer' => { gen => 1, gltype => '', dir =>'Customer', model => 'Customer', right => 'xx' }, |
|
58 |
'part' => { gen => 0, gltype => '', dir =>'Part', model => 'Part', right => 'xx' }, |
|
59 |
'gl_transaction' => { gen => 2, gltype => 'gl', dir =>'GeneralLedger', model => 'GLTransaction', right => 'import_ap' }, |
|
60 |
'draft' => { gen => 0, gltype => '', dir =>'Draft', model => 'Draft', right => 'xx' }, |
|
61 |
'csv_customer' => { gen => 1, gltype => '', dir =>'Reports', model => 'Customer', right => 'xx' }, |
|
62 |
'csv_vendor' => { gen => 1, gltype => '', dir =>'Reports', model => 'Vendor', right => 'xx' }, |
|
63 |
'shop_image' => { gen => 0, gltype => '', dir =>'ShopImages', model => 'Part', right => 'xx' }, |
|
63 | 64 |
); |
64 | 65 |
|
65 | 66 |
#--- 4 locale ---# |
... | ... | |
252 | 253 |
source => $source, |
253 | 254 |
file_type => $self->file_type, |
254 | 255 |
file_name => $basefile, |
255 |
); |
|
256 |
|
|
257 |
if ($existobj) { |
|
258 |
push @existing, $existobj->id.'_'.$sfile->file_name; |
|
259 |
} else { |
|
260 |
my $fileobj = SL::File->save(object_id => $self->object_id, |
|
261 |
object_type => $self->object_type, |
|
262 |
mime_type => $mime_type, |
|
263 |
source => $source, |
|
264 |
file_type => $self->file_type, |
|
265 |
file_name => $basefile, |
|
266 |
## two possibilities: which is better ? content or sessionfile ?? |
|
267 |
#file_contents => ${$upfiles[$idx]->{data}}, |
|
268 |
file_path => $sfile->file_name |
|
256 |
); |
|
257 |
|
|
258 |
if ($existobj) { |
|
259 |
push @existing, $existobj->id.'_'.$sfile->file_name; |
|
260 |
} else { |
|
261 |
my $fileobj = SL::File->save(object_id => $self->object_id, |
|
262 |
object_type => $self->object_type, |
|
263 |
mime_type => $mime_type, |
|
264 |
source => $source, |
|
265 |
file_type => $self->file_type, |
|
266 |
file_name => $basefile, |
|
267 |
title => $::form->{title}, |
|
268 |
description => $::form->{description}, |
|
269 |
## two possibilities: what is better ? content or sessionfile ?? |
|
270 |
file_contents => ${$upfiles[$idx]->{data}}, |
|
271 |
file_path => $sfile->file_name |
|
269 | 272 |
); |
270 | 273 |
unlink($sfile->file_name); |
271 | 274 |
} |
... | ... | |
376 | 379 |
); |
377 | 380 |
} |
378 | 381 |
$self->files(\@files); |
379 |
$self->_mk_render('file/list', 1, 0, $json); |
|
382 |
|
|
383 |
if($self->object_type eq 'shop_image'){ |
|
384 |
$self->js |
|
385 |
->run('kivi.ShopPart.show_images', $self->object_id) |
|
386 |
->render(); |
|
387 |
}else{ |
|
388 |
$self->_mk_render('file/list', 1, 0, $json); |
|
389 |
} |
|
380 | 390 |
} |
381 | 391 |
|
382 | 392 |
sub _get_from_import { |
Auch abrufbar als: Unified diff
WebshopApi: Filecontroller um shop_image erweitert