use SL::File::Backend;
use SL::File::Object;
use SL::DB::History;
+use SL::DB::ShopImage;
use SL::DB::File;
use SL::Helper::UserPreferences;
+use SL::Controller::Helper::ThumbnailCreator qw(file_probe_type);
use SL::JSON;
use constant RENAME_OK => 0;
$file->mtime(DateTime->now_local);
$file->save;
+ #ShopImage
+ if($file->object_type eq "shop_image"){
+ my $image_content = $params{file_contents};
+ my $thumbnail = file_probe_type($image_content);
+ my $shopimage = SL::DB::ShopImage->new();
+ $shopimage->assign_attributes(
+ file_id => $file->id,
+ thumbnail_content => $thumbnail->{thumbnail_img_content},
+ org_file_height => $thumbnail->{file_image_height},
+ org_file_width => $thumbnail->{file_image_width},
+ thumbnail_content_type => $thumbnail->{thumbnail_img_content_type},
+ object_id => $file->object_id,
+ );
+ $shopimage->save;
+ }
if ($params{file_type} eq 'document' && $params{source} ne 'created') {
SL::DB::History->new(
addition => 'IMPORT',
assembly => 'erzeugnisse',
letter => 'briefe',
general_ledger => 'dialogbuchungen',
+ gl_transaction => 'dialogbuchungen',
accounts_payable => 'kreditorenbuchungen',
+ shop_image => 'shopbilder',
);
my %type_to_model = (
assembly => 'Part',
letter => 'Letter',
general_ledger => 'GLTransaction',
+ gl_transaction => 'GLTransaction',
accounts_payable => 'GLTransaction',
+ shop_image => 'Part',
);
my %model_to_number = (
PurchaseInvoice => 'invnumber',
Part => 'partnumber',
Letter => 'letternumber',
- GLTransaction => 'reference'
+ GLTransaction => 'reference',
+ ShopImage => 'partnumber',
);
sub webdav_path {
return false;
}
+ ns.delete_file = function(id,controller_action) {
+ $.post('controller.pl', { action: controller_action, id: id }, function(data) {
+ kivi.eval_json_result(data);
+ });
+ };
+
ns.unimport = function(id,type,file_type,checkbox_class) {
var checkboxes = $('.'+checkbox_class).filter(function () { return $(this).prop('checked'); });
[%- USE L -%][%- USE LxERP -%][%- USE JavaScript -%]
<form method="post" id="upload_form" enctype="multipart/form-data" action="controller.pl">
+ [% SET multiple = 'true' %]
+ [% IF SELF.object_type == 'shop_image' %][% multiple = 'false' %][% END %]
<table>
<tr>
<td>[%- LxERP.t8("Filename") %]:</td><td>
- <input type="file" name="uploadfiles[]" multiple="true" id="upload_files" size="45" accept="[% SELF.accept_types %]" onchange="kivi.File.allow_upload_submit();"></td>
+ <input type="file" name="uploadfiles[]" multiple="[% multiple %]" id="upload_files" size="45" accept="[% SELF.accept_types %]" onchange="kivi.File.allow_upload_submit();"></td>
</tr>
+ [% IF SELF.object_type == 'shop_image' %]
+ <tr>
+ <td>[% LxERP.t8("Title") %]</td>
+ <td>[% L.input_tag("title",'') %]</td>
+ </tr>
+ <tr>
+ <td>[% LxERP.t8("Description") %]</td>
+ <td>[% L.input_tag("description",'') %]</td>
+ </tr>
+ [% END %]
</table>
<p>