Revision 20b7b20b
Von Werner Hahn vor mehr als 7 Jahren hinzugefügt
SL/BackgroundJob/ShopOrderMassTransfer.pm | ||
---|---|---|
package SL::BackgroundJob::ShopOrderMassTransfer;
|
||
#BackgroundJob::ShopOrderMassTransfer
|
||
|
||
use strict;
|
||
use warnings;
|
||
|
||
... | ... | |
# my $data = {
|
||
# shop_order_record_ids => [ 603, 604, 605],
|
||
# num_order_created => 0,
|
||
# num_delivery_order_created => 0,
|
||
# orders_ids => [1,2,3]
|
||
# conversation_errors => [ { id => 603 , item => 2, message => "Out of stock"}, ],
|
||
# };
|
||
#
|
||
... | ... | |
# die "can't find shoporder with id $shop_order_id" unless $shop_order;
|
||
#TODO Kundenabfrage so ändern, dass es nicht abricht
|
||
unless($shop_order){
|
||
push @{ $error_report{$shop_order_id}} }, 'Shoporder not found';
|
||
push @{ $error_report{$shop_order_id} }, 'Shoporder not found';
|
||
}
|
||
my $customer = SL::DB::Manager::Customer->find_by(id => $shop_order->{kivi_customer_id});
|
||
die "Can't find customer" unless $customer;
|
||
... | ... | |
$shop_order->oe_transid($order->id);
|
||
$shop_order->save;
|
||
$shop_order->link_to_record($order);
|
||
$data->{num_created}++;
|
||
$data->{num_order_created} ++;
|
||
push @{ $data->{orders_ids} }, $order->id;
|
||
push @{ $data->{shop_orders_ids} }, $shop_order->id;
|
||
|
||
$job_obj->update_attributes(data_as_hash => $data);
|
||
my $delivery_order = $order->convert_to_delivery_order(customer => $customer, employee => $employee);
|
||
$delivery_order->save;
|
||
my $snumbers = "deliveryordernumber_" . $delivery_order->donumber;
|
SL/Controller/FileUploader.pm | ||
---|---|---|
$self->render('fileuploader/test_page');
|
||
}
|
||
|
||
sub action_upload_form{
|
||
my ($self) = @_;
|
||
$self->file(SL::DB::File->new);
|
||
$self->render('common/file_upload', {header => 0});
|
||
}
|
||
|
||
sub action_show_files {
|
||
my ($self) = @_;
|
||
$main::lxdebug->dump(0, 'WH: Show_Files',\$::form);
|
||
my $images = SL::DB::Manager::File->get_all( query => [ trans_id => $::form->{id}, modul => $::form->{modul} ] );
|
||
$main::lxdebug->dump(0, 'WH: ',\$images);
|
||
|
||
|
||
}
|
||
|
||
sub action_ajax_add_file{
|
||
my ($self) = @_;
|
||
$self->file( $::form->{id} ? SL::DB::File->new(id => $::form->{id})->load : SL::DB::File->new );
|
||
... | ... | |
return @errors
|
||
}
|
||
|
||
sub action_upload_form{
|
||
my ($self) = @_;
|
||
$self->file(SL::DB::File->new);
|
||
$self->render('common/file_upload', {header => 0});
|
||
}
|
||
|
||
sub action_show_files {
|
||
my ($self) = @_;
|
||
|
||
|
||
sub action_ajax_add_file{
|
||
my ($self) = @_;
|
||
$self->file(SL::DB::File->new);
|
||
$self->render('common/file_upload', { layout => 0}, DATA => $::form);
|
||
}
|
||
|
||
sub action_ajax_upload_file{
|
||
my ($self, %params) = @_;
|
||
my $attributes = $::form->{ $::form->{form_prefix} } || die "Missing FormPrefix";
|
||
$attributes->{trans_id} = $::form->{id} || die "Missing ID";
|
||
$attributes->{modul} = $::form->{modul} || die "Missing Modul";
|
||
$attributes->{filename} = $::form->{FILENAME} || die "Missing Filename";
|
||
$attributes->{title} = $::form->{ $::form->{form_prefix} }->{title};
|
||
$attributes->{description} = $::form->{ $::form->{form_prefix} }->{description};
|
||
my @image_types = ("jpg","tif","png");
|
||
|
||
my @errors = $self->file(SL::DB::File->new(%{ $attributes }))->validate;
|
||
return $self->js->error(@errors)->render($self) if @errors;
|
||
|
||
$self->file->save;
|
||
|
||
# TODO js call
|
||
$self->render('fileuploader/test_page');
|
||
}
|
||
|
||
#
|
||
# helpers
|
||
#
|
||
|
||
sub init_file {
|
||
return SL::DB::File->new(id => $::form->{id})->load;
|
||
}
|
||
... | ... | |
|
||
=head1 DESCRIPTION
|
||
|
||
# longer description...
|
||
just the action ajax_add_file is needed and its automaticly called by. The other ones are for the testpage templates/webpages/testpage.html
|
||
kivi.add.file(id[shop_part_id,part_id, cv_id, project_id,...],modul[part,shop_part,project,IC,...],controller_action[ShopPart/do_something_file],allowed_filestypes) in your template.
|
||
[% L.button_tag("kivi.add_file(this.form.id.value,'shop_part', 'Part/do_something_with_file','jpg,png,gif,pdf')", 'Fileupload') %]
|
||
|
||
The called Controller/Action deals with the uploaded file in wich you can do whatever you want with the file.
|
||
like
|
||
- Store it in the Database SL::DB::File
|
||
- Store it in Webdav
|
||
- Store it in Webdav and DB (be careful: files wich deleted in the filesystem will not be deleted in the database automaticly)
|
||
- do something very fancy with the file
|
||
|
||
|
||
=head1 INTERFACE
|
SL/Controller/ShopOrder.pm | ||
---|---|---|
package SL::Controller::ShopOrder;
|
||
#package SL::Controller::ShopOrder;
|
||
# Controller::ShopOrder
|
||
|
||
use strict;
|
||
|
||
... | ... | |
my ( $self ) = @_;
|
||
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0, obsolete => 0 ]);
|
||
my $transferred = $::form->{filter}->{transferred_eq_ignore_empty} ne '' ? $::form->{filter}->{transferred_eq_ignore_empty} : '';
|
||
#$::lxdebug->dump(0, "WH: FILTER ", $::form->{filter}->{_eq_ignore_empty}." - ".$transferred);
|
||
#$::lxdebug->dump(0, "WH: FILTER2 ", \%filter);
|
||
my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'order_date';
|
||
$sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC';
|
||
my $shop_orders = SL::DB::Manager::ShopOrder->get_all( %filter, sort_by => $sort_by,
|
||
... | ... | |
);
|
||
$shop_order->{open_invoices} = $open_invoices;
|
||
}
|
||
$main::lxdebug->dump(0, 'WH:SHOPORDER ',\$shop_orders);
|
||
|
||
|
||
$self->render('shop_order/list',
|
||
title => t8('ShopOrders'),
|
||
... | ... | |
and => [ # check for street and zipcode
|
||
and => [ 'street' => { ilike => "%".$shop_order->customer_street."%" },
|
||
'zipcode' => { ilike => $shop_order->customer_zipcode },
|
||
],
|
||
],
|
||
or => [ 'email' => { ilike => $shop_order->customer_email } ],
|
||
],
|
||
],
|
||
);
|
||
$main::lxdebug->dump(0, 'WH:PROP ',\$proposals);
|
||
|
||
|
||
$self->render('shop_order/show',
|
||
title => t8('Shoporder'),
|
||
... | ... | |
'zipcode'=> { ilike => $address{'zipcode'} },
|
||
'city' => { ilike => $address{'city'} },
|
||
]);
|
||
$::lxdebug->dump(0, "WH: CUSTOMER ", \$addressdata);
|
||
return @{$addressdata}[0];
|
||
}
|
||
|
SL/Controller/ShopPart.pm | ||
---|---|---|
package SL::Controller::ShopPart;
|
||
#package SL::Controller::ShopPart;
|
||
|
||
use strict;
|
||
|
||
... | ... | |
my $shop_article = $shop->connector->get_article($self->shop_part->part->partnumber);
|
||
$stock_onlineshop = $shop_article->{data}->{mainDetail}->{inStock};
|
||
$active_online = $shop_article->{data}->{active};
|
||
#}
|
||
}
|
||
|
||
$stock_local = $self->shop_part->part->onhand;
|
||
|
||
... | ... | |
|
||
#TODO Price must be formatted. $price_src_str must be translated
|
||
flash('info', $is_new ? t8('The shop part has been created.') : t8('The shop part has been saved.'));
|
||
# $self->js->val('#partnumber', 'ladida');
|
||
$self->js->html('#shop_part_description_' . $self->shop_part->id, $self->shop_part->shop_description)
|
||
->html('#shop_part_active_' . $self->shop_part->id, $self->shop_part->active)
|
||
->html('#price_' . $self->shop_part->id, $::form->format_amount(\%::myconfig,$price,2))
|
||
... | ... | |
my $transferred = $::form->{filter}->{transferred_eq_ignore_empty} ne '' ? $::form->{filter}->{transferred_eq_ignore_empty} : '';
|
||
my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'part.partnumber';
|
||
$sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC';
|
||
$main::lxdebug->message(0, "WH:LA ");
|
||
|
||
my $articles = SL::DB::Manager::ShopPart->get_all(where => [ 'shop.obsolete' => 0 ],with_objects => [ 'part','shop' ], sort_by => $sort_by );
|
||
|
||
... | ... | |
my $images = SL::DB::Manager::File->get_all_count( where => [ trans_id => $article->part->id, modul => 'shop_part', file_content_type => { like => 'image/%' } ], sort_by => 'position' );
|
||
$article->{images} = $images;
|
||
}
|
||
$main::lxdebug->dump(0, 'WH:ARTIKEL ',\$articles);
|
||
|
||
$self->render('shop_part/_list_articles', title => t8('Webshops articles'), SHOP_PARTS => $articles);
|
||
}
|
||
... | ... | |
|
||
sub action_mass_upload {
|
||
my ($self) = @_;
|
||
$main::lxdebug->message(0, "WH:MA ");
|
||
|
||
my @shop_parts = @{ $::form->{shop_parts_ids} || [] };
|
||
|
||
... | ... | |
status => SL::BackgroundJob::ShopPartMassUpload->WAITING_FOR_EXECUTION(),
|
||
conversation_errors => [ ],
|
||
)->update_next_run_at;
|
||
$main::lxdebug->dump(0, 'WH:MA JOB ',\$job);
|
||
|
||
SL::System::TaskServer->new->wake_up;
|
||
$main::lxdebug->dump(0, 'WH:MA JOB 2',\$job);
|
||
|
||
my $html = $self->render('shop_part/_transfer_status', { output => 0 }, job => $job);
|
||
|
||
... | ... | |
# internal stuff
|
||
#
|
||
sub add_javascripts {
|
||
# is this needed?
|
||
$::request->{layout}->add_javascripts(qw(kivi.shop_part.js));
|
||
}
|
||
|
||
... | ... | |
}
|
||
|
||
sub init_file {
|
||
$main::lxdebug->message(0, "WH:INIT_FILES ");
|
||
my $file = $::form->{id} ? SL::DB::File->new(id => $::form->{id})->load : SL::DB::File->new;
|
||
$main::lxdebug->dump(0, 'WH: INITFILE: ',\file);
|
||
|
||
return $file;
|
||
}
|
||
|
||
sub init_shops {
|
||
# data for drop down filter options
|
||
$main::lxdebug->message(0, "WH:INIT_SHOPS ");
|
||
|
||
require SL::DB::Shop;
|
||
my @shops_dd = [ { title => t8("all") , value =>'' } ];
|
||
my $shops = SL::DB::Mangager::Shop->get_all( where => [ obsolete => 0 ] );
|
||
my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ;
|
||
$main::lxdebug->dump(0, 'WH:SHOPS ',\@tmp);
|
||
return @shops_dd;
|
||
my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ;
|
||
return @shops_dd;
|
||
|
||
}
|
||
|
||
sub init_producers {
|
||
# data for drop down filter options
|
||
$main::lxdebug->message(0, "WH:INIT_PRODUCERS ");
|
||
|
||
my @producers_dd = [ { title => t8("all") , value =>'' } ];
|
||
return @producers_dd;
|
||
return @producers_dd;
|
||
|
||
}
|
||
|
SL/DB/File.pm | ||
---|---|---|
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::File;
|
||
#package SL::DB::File;
|
||
|
||
use strict;
|
||
|
SL/DB/Helper/ThumbnailCreator.pm | ||
---|---|---|
|
||
use strict;
|
||
|
||
use parent qw(SL::Controller::Base);
|
||
|
||
use SL::Locale::String qw(t8);
|
||
use Carp;
|
||
use GD;
|
||
use Image::Info;
|
||
... | ... | |
my ($self) = @_;
|
||
|
||
return () if !$self->file_content;
|
||
return () if $self->file_content_type && $self->file_img_width && $self->file_img_height && !Rose::DB::Object::Util::get_column_value_modified($self, 'file_content');
|
||
return () if $self->file_content_type && $self->files_img_width && $self->files_img_height && !Rose::DB::Object::Util::get_column_value_modified($self, 'file_content');
|
||
|
||
my @errors = $self->file_probe_type;
|
||
return @errors if @errors;
|
||
... | ... | |
|
||
=head1 NAME
|
||
|
||
SL::DB::Helper::ThumbnailCreator - DatabaseClass Helper for Fileuploads
|
||
SL::DB::Helper::ThumbnailCreator - DatabaseClass Helper for Fileuploads
|
||
|
||
=head1 SYNOPSIS
|
||
|
||
... | ... | |
|
||
=head1 DESCRIPTION
|
||
|
||
# longer description..
|
||
# longer description..
|
||
|
||
=head1 AUTHOR
|
||
|
||
Werner Hahn E<lt>wh@futureworldsearch.netE<gt>
|
||
Werner Hahn E<lt>wh@futureworldsearch.netE<gt>
|
||
|
||
=cut
|
||
|
SL/DB/MetaSetup/Shop.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::Shop;
|
||
#package SL::DB::Shop;
|
||
|
||
use strict;
|
||
|
||
use base qw(SL::DB::Object);
|
||
use parent qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->table('shops');
|
||
|
SL/DB/MetaSetup/ShopOrder.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::ShopOrder;
|
||
#package SL::DB::ShopOrder;
|
||
|
||
use strict;
|
||
|
SL/DB/MetaSetup/ShopOrderItem.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::ShopOrderItem;
|
||
#package SL::DB::ShopOrderItem;
|
||
|
||
use strict;
|
||
|
SL/DB/MetaSetup/ShopPart.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::ShopPart;
|
||
#package SL::DB::ShopPart;
|
||
|
||
use strict;
|
||
|
||
<<<<<<< HEAD
|
||
use parent qw(SL::DB::Object);
|
||
=======
|
||
use base qw(SL::DB::Object);
|
||
>>>>>>> Shop - Einführung von ShopParts
|
||
|
||
__PACKAGE__->meta->table('shop_parts');
|
||
|
SL/DB/Part.pm | ||
---|---|---|
package SL::DB::Part;
|
||
#package SL::DB::Part;
|
||
|
||
use strict;
|
||
|
||
... | ... | |
sub is_assortment { $_[0]->part_type eq 'assortment' }
|
||
|
||
sub type {
|
||
return $_[0]->part_type;
|
||
# my ($self, $type) = @_;
|
||
# if (@_ > 1) {
|
||
# die 'invalid type' unless $type =~ /^(?:part|service|assembly)$/;
|
||
# $self->assembly( $type eq 'assembly' ? 1 : 0);
|
||
# $self->inventory_accno_id($type ne 'service' ? 1 : undef);
|
||
# }
|
||
|
||
# return 'assembly' if $self->assembly;
|
||
# return 'part' if $self->inventory_accno_id;
|
||
# return 'service';
|
||
my ($self, $type) = @_;
|
||
if (@_ > 1) {
|
||
die 'invalid type' unless $type =~ /^(?:part|service|assembly)$/;
|
||
$self->assembly( $type eq 'assembly' ? 1 : 0);
|
||
$self->inventory_accno_id($type ne 'service' ? 1 : undef);
|
||
}
|
||
|
||
return 'assembly' if $self->assembly;
|
||
return 'part' if $self->inventory_accno_id;
|
||
return 'service';
|
||
}
|
||
|
||
sub new_part {
|
SL/DB/ShopOrder.pm | ||
---|---|---|
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::ShopOrder;
|
||
# DB::ShopOrder
|
||
|
||
use strict;
|
||
|
SL/DB/ShopPart.pm | ||
---|---|---|
__PACKAGE__->meta->initialize;
|
||
__PACKAGE__->attr_html('shop_description');
|
||
|
||
|
||
1;
|
SL/Shop.pm | ||
---|---|---|
package SL::Shop;
|
||
#package SL::Shop;
|
||
|
||
use strict;
|
||
|
||
use parent qw(Rose::Object);
|
||
use SL::ShopConnector::ALL;
|
||
use SL::DB::Part;
|
||
|
||
# __PACKAGE__->run_before('check_auth');
|
||
|
||
... | ... | |
'scalar --get_set_init' => [ qw(connector) ],
|
||
);
|
||
|
||
sub updatable_parts {
|
||
my ($self, $last_update) = @_;
|
||
$last_update ||= DateTime->now(); # need exact timestamp, with minutes
|
||
|
||
my $parts;
|
||
my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ]);
|
||
foreach my $shop ( @{ $active_shops } ) {
|
||
# maybe run as an iterator? does that make sense with with_objects?
|
||
my $update_parts = SL::DB::Manager::ShopPart->get_all(query => [
|
||
and => [
|
||
'active' => 1,
|
||
'shop_id' => $shop->id,
|
||
# shop => '1',
|
||
or => [ 'part.mtime' => { ge => $last_update },
|
||
'part.itime' => { ge => $last_update },
|
||
'itime' => { ge => $last_update },
|
||
'mtime' => { ge => $last_update },
|
||
],
|
||
]
|
||
],
|
||
with_objects => ['shop', 'part'],
|
||
# multi_many_ok => 1,
|
||
);
|
||
push( @{ $parts }, @{ $update_parts });
|
||
};
|
||
return $parts;
|
||
|
||
};
|
||
|
||
sub init_connector {
|
||
my ($self) = @_;
|
||
# determine the connector from the connector type in the webshop config
|
||
return SL::ShopConnector::ALL->shop_connector_class_by_name($self->config->connector)->new( config => $self->config);
|
||
return SL::ShopConnector::ALL->shop_connector_class_by_name($self->config->connector)->new( config => $self->config);
|
||
|
||
};
|
||
|
||
... | ... | |
|
||
=head1 NAME
|
||
|
||
SL::WebShop - Do stuff with WebShop instances
|
||
SL::Shop - Do stuff with WebShop instances
|
||
|
||
=head1 SYNOPSIS
|
||
|
||
my $config = SL::DB::Manager::WebShop->get_first();
|
||
my $config = SL::DB::Manager::Shop->get_first();
|
||
my $shop = SL::WebShop->new( config => $config );
|
||
|
||
From the config we know which Connector class to load, save in $shop->connector
|
||
and do stuff from there:
|
||
From the config we know which Connector class to load, save in $shop->connector
|
||
and do stuff from there:
|
||
|
||
$shop->connector->get_new_orders;
|
||
|
||
... | ... | |
|
||
=head1 BUGS
|
||
|
||
Nothing here yet.
|
||
Nothing here yet.
|
||
|
||
=head1 AUTHOR
|
||
|
||
G. Richardson <lt>information@kivitendo-premium.deE<gt>
|
||
G. Richardson <lt>information@kivitendo-premium.deE<gt>
|
||
|
||
=cut
|
||
|
SL/ShopConnector/Shopware.pm | ||
---|---|---|
package SL::ShopConnector::Shopware;
|
||
#package SL::ShopConnector::Shopware;
|
||
#package SL::ShopConnector::Shopware;
|
||
|
||
use strict;
|
||
|
||
... | ... | |
return \@daten;
|
||
}
|
||
|
||
sub get_articles {
|
||
my ($self, $json_data) = @_;
|
||
|
||
}
|
||
|
||
|
||
sub update_part {
|
||
my ($self, $shop_part, $json, $todo) = @_;
|
||
|
||
... | ... | |
|
||
# mapping to shopware still missing attributes,metatags
|
||
my %shop_data;
|
||
$main::lxdebug->dump(0, 'WH:TODO ',\$todo);
|
||
|
||
if($todo eq "price"){
|
||
%shop_data = ( mainDetail => { number => $part->{partnumber},
|
||
... | ... | |
}else{
|
||
my %shop_data = ( mainDetail => { number => $part->{partnumber}, });
|
||
}
|
||
$main::lxdebug->dump(0, 'WH:SHOPDATA ',\%shop_data);
|
||
|
||
my $dataString = SL::JSON::to_json(\%shop_data);
|
||
$dataString = encode_utf8($dataString);
|
||
|
||
my $upload_content;
|
||
if($import->{success}){
|
||
my %del_img = ( images => [ {} ], ) ;
|
||
my $del_imgString = SL::JSON::to_json(\%del_img);
|
||
#my $delImg = $self->connector->put("http://$url/api/articles/$part->{partnumber}?useNumberAsId=true",Content => $del_imgString);
|
||
#update
|
||
my $partnumber = $::form->escape($part->{partnumber});#shopware don't accept / in articlenumber
|
||
my $upload = $self->connector->put("http://$url/api/articles/$partnumber?useNumberAsId=true",Content => $dataString);
|
||
... | ... | |
my ($self,$partnumber) = @_;
|
||
|
||
my $url = $self->url;
|
||
my $partnumber = $::form->escape($partnumber);#shopware don't accept / in articlenumber
|
||
$partnumber = $::form->escape($partnumber);#shopware don't accept / in articlenumber
|
||
my $data = $self->connector->get("http://$url/api/articles/$partnumber?useNumberAsId=true");
|
||
my $data_json = $data->content;
|
||
return SL::JSON::decode_json($data_json);
|
css/webshop.css | ||
---|---|---|
/* Shop */
|
||
div.shop_table {
|
||
display: table;
|
||
background-color: #ebebeb;
|
js/kivi.FileUploader.js | ||
---|---|---|
//TMP
|
||
namespace('kivi.FileUploader', function(ns) {
|
||
//opens a popupdialog for fileupload
|
||
|
js/kivi.ShopOrder.js | ||
---|---|---|
//TMP
|
||
namespace('kivi.ShopOrder', function(ns) {
|
||
ns.massTransferInitialize = function() {
|
||
kivi.popup_dialog({
|
||
id: 'status_mass_transfer',
|
||
dialog: {
|
||
title: kivi.t8('Status Shoptransfer')
|
||
title: kivi.t8('Status Shoptransfer'),
|
||
close: function(event, ui) { alert('CLOSE'); },
|
||
}
|
||
});
|
||
alert('Hallo');
|
||
};
|
||
|
||
ns.massTransferStarted = function() {
|
||
... | ... | |
$('.ui-dialog-titlebar button.ui-dialog-titlebar-close').prop('disabled', '')
|
||
};
|
||
|
||
ns.processClose = function() {
|
||
$('#status_mass_transfer').dialog('close');
|
||
window.location.href = 'controller.pl?filter.obsolete=0&filter.transferred=0&action=ShopOrder%2flist&db=shop_orders&sort_by=shop_ordernumber';
|
||
};
|
||
|
||
ns.setup = function() {
|
||
kivi.ShopOrder.massTransferInitialize();
|
||
kivi.submit_ajax_form('controller.pl?action=ShopOrder/mass_transfer','[name=shop_orders_list]');
|
||
};
|
||
|
||
});
|
||
//$(kivi.ShopOrder.setup);
|
js/kivi.shop_part.js | ||
---|---|---|
//TMP
|
||
namespace('kivi.shop_part', function(ns) {
|
||
var $dialog;
|
||
|
||
... | ... | |
}
|
||
|
||
|
||
// save existing shop_part_id with new params from form, calls create_or_update and saves to db
|
||
ns.save_shop_part = function(shop_part_id) {
|
||
var form = $('form').serializeArray();
|
||
form.push( { name: 'action', value: 'ShopPart/update' }
|
||
, { name: 'shop_part_id', value: shop_part_id }
|
||
);
|
||
|
||
$.post('controller.pl', form, function(data) {
|
||
kivi.eval_json_result(data);
|
||
});
|
||
}
|
||
// save existing shop_part_id with new params from form, calls create_or_update and saves to db
|
||
ns.save_shop_part = function(shop_part_id) {
|
||
var form = $('form').serializeArray();
|
||
form.push( { name: 'action', value: 'ShopPart/update' }
|
||
, { name: 'shop_part_id', value: shop_part_id }
|
||
);
|
||
|
||
// add part to a shop
|
||
ns.add_shop_part = function(part_id,shop_id) {
|
||
var form = $('form').serializeArray();
|
||
form.push( { name: 'action', value: 'ShopPart/update' }
|
||
);
|
||
$.post('controller.pl', form, function(data) {
|
||
kivi.eval_json_result(data);
|
||
});
|
||
}
|
||
|
||
$.post('controller.pl', form, function(data) {
|
||
kivi.eval_json_result(data);
|
||
});
|
||
}
|
||
// add part to a shop
|
||
ns.add_shop_part = function(part_id,shop_id) {
|
||
var form = $('form').serializeArray();
|
||
form.push( { name: 'action', value: 'ShopPart/update' }
|
||
);
|
||
$.post('controller.pl', form, function(data) {
|
||
kivi.eval_json_result(data);
|
||
});
|
||
}
|
||
|
||
// this is called from tabs/_shop.html, opens edit_window (render)
|
||
ns.edit_shop_part = function(shop_part_id) {
|
||
... | ... | |
});
|
||
}
|
||
|
||
ns.massUploadInitialize = function() {
|
||
kivi.popup_dialog({
|
||
id: 'status_mass_upload',
|
||
dialog: {
|
||
title: kivi.t8('Status Shopupload')
|
||
}
|
||
});
|
||
};
|
||
|
||
ns.massUploadStarted = function() {
|
||
$('#status_mass_upload').data('timerId', setInterval(function() {
|
||
$.get("controller.pl", {
|
||
action: 'ShopPart/upload_status',
|
||
job_id: $('#smu_job_id').val()
|
||
}, kivi.eval_json_result);
|
||
}, 5000));
|
||
};
|
||
|
||
ns.massUploadFinished = function() {
|
||
clearInterval($('#status_mass_upload').data('timerId'));
|
||
$('.ui-dialog-titlebar button.ui-dialog-titlebar-close').prop('disabled', '')
|
||
};
|
||
|
||
ns.setup = function() {
|
||
kivi.shop_part.massUploadInitialize();
|
||
kivi.submit_ajax_form('controller.pl?action=ShopPart/mass_upload','[name=shop_parts]');
|
||
};
|
||
|
||
});
|
menus/user/10-shopimport.yaml | ||
---|---|---|
action: ShopPart/list_articles
|
||
db: shop_parts
|
||
sort_by: part.onhand
|
||
#ShopPart
|
sql/Pg-upgrade2/shop_orders_2.sql | ||
---|---|---|
-- @tag: shop_orders_2
|
||
-- @description: Hinzufügen der Spalte Position in der Tabelle shop_order_items
|
||
-- @depends: release_3_3_0
|
||
-- tmp
|
||
ALTER TABLE shop_order_items ADD COLUMN position integer;
|
sql/Pg-upgrade2/shop_parts.sql | ||
---|---|---|
-- TMP
|
||
-- @tag: shop_parts
|
||
-- @description: Add tables for part information for shop
|
||
-- @charset: UTF-8
|
templates/webpages/common/file_upload.html | ||
---|---|---|
<!-- TMP -->
|
||
[%- USE LxERP -%][%- USE L -%][%- USE HTML -%][%- USE JavaScript -%][% USE Base64 %]
|
||
[% SET style="width: 500px" %]
|
||
[% SET id_base = "fileupload" %]
|
||
[% L.dump(DATA) %]
|
||
[% SET id_base_bak = "fileupload" %]
|
||
[% SET id_base = 'fileupload_' _ (SELF.file.id ? SELF.file.id : 'new') %]
|
||
[% SET trans_id = SELF.file.id ? SELF.file.trans_id : data.trans_id %]
|
||
[% SET modul = SELF.file.id ? SELF.file.modul : data.modul %]
|
||
|
||
<form method="post" id="fileupload_form" method="POST" enctype="multipart/form-data">
|
||
[% L.hidden_tag('form_prefix', id_base, id=id_base _ '_form_prefix') %]
|
||
[% L.hidden_tag('id', DATA.id, no_id=1) %]
|
||
[% L.hidden_tag('modul', DATA.modul) %]
|
||
[% L.hidden_tag('form_prefix', id_base, id=id_base _ '_form_prefix') %]
|
||
[% L.hidden_tag(id_base _ '.id', SELF.file.id, no_id=1) %]
|
||
[% L.hidden_tag(id_base _ '.trans_id', trans_id) %]
|
||
[% L.hidden_tag(id_base _ '.modul', modul) %]
|
||
[% L.hidden_tag('aft', data.aft) %]
|
||
|
||
<h2>
|
||
[%- IF SELF.file.id %]
|
||
[%- LxERP.t8("Edit file properties ", SELF.file.number) %]
|
||
[%- LxERP.t8("Edit fileproperties", SELF.file.position) %]
|
||
[%- ELSE %]
|
||
[%- LxERP.t8("Add file to webdav") %]
|
||
[%- LxERP.t8("Add file") %]
|
||
[%- END %]
|
||
</h2>
|
||
|
||
<table>
|
||
[% IF SELF.file.number %]
|
||
[% IF SELF.file.id %]
|
||
<tr>
|
||
<th align="right">[%- LxERP.t8("Number") %]:</th>
|
||
<td>[% HTML.escape(SELF.file.number) %]</td>
|
||
<th align="right">[%- LxERP.t8("Position") %]:</th>
|
||
<td>[% HTML.escape(SELF.file.position) %]</td>
|
||
</tr>
|
||
[% END %]
|
||
|
||
... | ... | |
[% IF SELF.file.file_content %]
|
||
<tr>
|
||
<th align="right">[%- LxERP.t8("File name") %]:</th>
|
||
<td>[% HTML.escape(SELF.file.file_file_name) %]</td>
|
||
<td>[% HTML.escape(SELF.file.filename) %][% L.hidden_tag(id_base _ '.filename', SELF.file.filename) %][% L.hidden_tag('id', SELF.file.id, no_id=1) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
... | ... | |
|
||
<tr>
|
||
<th align="right">[%- LxERP.t8("Dimensions") %]:</th>
|
||
<td>[% HTML.escape(SELF.file.file_width) %]x[% HTML.escape(SELF.file.file_height) %]</td>
|
||
<td>[% HTML.escape(SELF.file.files_img_width) %]x[% HTML.escape(SELF.file.files_img_height) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th align="right">[%- LxERP.t8("Uploaded at") %]:</th>
|
||
<td>[% HTML.escape(SELF.file.file_mtime.to_kivitendo(precision='second')) %]</td>
|
||
<td>[% HTML.escape(SELF.file.files_mtime.to_kivitendo(precision='second')) %]</td>
|
||
</tr>
|
||
[% END %]
|
||
|
||
... | ... | |
</table>
|
||
|
||
<p>
|
||
[%- L.ajax_submit_tag('controller.pl?action=FileUploader/ajax_upload_file', '#fileupload_form', LxERP.t8('Save'), no_id=1) %]
|
||
<!-- TODO action ändern in übergebene Variable, sodass jede xbelibiege Controller/Action aufgerufen werden kann -->
|
||
[%- L.ajax_submit_tag('controller.pl?action=' _ data.ca, '#fileupload_form', LxERP.t8('Save'), no_id=1) %]
|
||
<a href="#" onclick="$('#jqueryui_popup_dialog').dialog('close');">[%- LxERP.t8("Cancel") %]</a>
|
||
</p>
|
||
|
templates/webpages/shop_order/_transfer_status.html | ||
---|---|---|
[%- USE Dumper -%]
|
||
[% SET data = job.data_as_hash %]
|
||
|
||
<!-- ShopOrder -->
|
||
|
||
<h2>[% LxERP.t8("Watch status") %]</h2>
|
||
|
||
[% L.hidden_tag('', job.id, id="smt_job_id") %]
|
||
... | ... | |
[% # Dumper.dump_html(data) %]
|
||
</p>
|
||
<p>
|
||
[% L.link("#", LxERP.t8("Close window"), onclick="kivi.ShopOrder.processClose();") %]
|
||
<table>
|
||
<tr>
|
||
<th valign="top" align="left">[% LxERP.t8("Current status:") %]</th>
|
||
... | ... | |
</td>
|
||
</tr>
|
||
<tr>
|
||
<th valign="top" align="left">[% LxERP.t8("Number of invoices created:") %]</th>
|
||
<td valign="top">[% IF data.status > 0 %][% HTML.escape(data.num_created) %] / [% HTML.escape(data.record_ids.size) %][% ELSE %]–[% END %]</td>
|
||
<th valign="top" align="left">[% LxERP.t8("Number of orders created:") %]</th>
|
||
<td valign="top">[% IF data.status > 0 %][% HTML.escape(data.num_order_created) %] / [% HTML.escape(data.shop_order_record_ids.size) %][% ELSE %]–[% END %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th valign="top" align="left">[% LxERP.t8("Number of invoices printed:") %]</th>
|
||
<td valign="top">[% IF data.status > 1 %][% HTML.escape(data.num_printed) %] / [% HTML.escape(data.invoice_ids.size) %][% ELSE %]–[% END %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th valign="top" align="left">[% LxERP.t8("Errors during conversion:") %]</th>
|
||
... | ... | |
[% END %]
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th valign="top" align="left">[% LxERP.t8("Errors during printing:") %]</th>
|
||
<td valign="top">
|
||
[% IF data.status < 2 %]
|
||
–
|
||
[% ELSIF !data.print_errors.size %]
|
||
[% LxERP.t8("No errors have occurred.") %]
|
||
[% ELSE %]
|
||
<table>
|
||
<tr class="listheader">
|
||
<th>[% LxERP.t8("Invoice") %]</th>
|
||
<th>[% LxERP.t8("Error") %]</th>
|
||
</tr>
|
||
|
||
[% FOREACH error = data.print_errors %]
|
||
<tr>
|
||
<td valign="top">[% IF error.id %][% L.link(SELF.url_for(controller='is.pl', action='edit', type='sales_invoice',id=error.id), HTML.escape(error.number), target="_blank") %][% ELSE %]–[% END %]</td>
|
||
<td valign="top">[% HTML.escape(error.message) %]</td>
|
||
</tr>
|
||
[% END %]
|
||
</table>
|
||
[% END %]
|
||
</td>
|
||
</tr>
|
||
|
||
</table>
|
||
</p>
|
templates/webpages/shop_order/list.html | ||
---|---|---|
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
|
||
[% USE Dumper %]
|
||
<!-- TMP -->
|
||
|
||
<h1>[% title %]</h1>
|
||
[%- PROCESS 'shop_order/_filter.html' filter=SELF.models.filtered.laundered %]
|
||
... | ... | |
<br>[% HTML.escape(shop_order.customer_street) %]
|
||
<br>[% HTML.escape(shop_order.customer_zipcode) %] [% HTML.escape(shop_order.customer_city) %]
|
||
<br>[% HTML.escape(shop_order.customer_country) %] </td>
|
||
<td>[% IF shop_order.customer_company %]<b>[% HTML.escape(shop_order.customer_company) %]</b><br>[% END %]
|
||
<td [% transferable_class %]>[% IF shop_order.customer_company %]<b>[% HTML.escape(shop_order.customer_company) %]</b><br>[% END %]
|
||
<b>[% HTML.escape(shop_order.billing_lastname) %], [% HTML.escape(shop_order.billing_firstname) %]</b>
|
||
<br>[% HTML.escape(shop_order.billing_street) %]
|
||
<br>[% HTML.escape(shop_order.billing_zipcode) %] [% HTML.escape(shop_order.billing_city) %]
|
||
... | ... | |
</table>
|
||
<hr>
|
||
<p>
|
||
[% L.hidden_tag("action", "ShopOrder/mass_transfer") %]
|
||
[% L.submit_tag("", LxERP.t8("Transfer all marked")) %]
|
||
[% L.button_tag("kivi.ShopOrder.setup();", LxERP.t8("Transfer all marked"), id="mass_transfer") %]
|
||
</p>
|
||
<div id="status_mass_transfer" style="display: none;">
|
||
[%- INCLUDE 'shop_order/_transfer_status.html' %]
|
||
</div>
|
||
</form>
|
||
<script type="text/javascript">
|
||
<!--
|
templates/webpages/shop_order/show.html | ||
---|---|---|
<!-- TMP -->
|
||
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
|
||
[% L.stylesheet_tag('webshop') %]
|
||
|
||
... | ... | |
$('#transfer').css("display", 'block');
|
||
});
|
||
</script>
|
||
[% L.dump(IMPORT) %]
|
||
[% # L.dump(IMPORT) %]
|
templates/webpages/shop_part/_filter.html | ||
---|---|---|
[%- USE L %]
|
||
[%- USE LxERP %]
|
||
[%- USE HTML %]
|
||
<!-- ShopOrder -->
|
||
<form action='controller.pl' method='post' id="shop_part_filter">
|
||
<table id='filter_table'>
|
||
|
templates/webpages/shop_part/_list_articles.html | ||
---|---|---|
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
|
||
[% USE Dumper %]
|
||
<!-- ShopPart -->
|
||
<!-- ShopPart -->
|
||
<!-- ShopPart -->
|
||
|
||
|
||
<h1>[% title %]</h1>
|
||
[%- PROCESS 'shop_part/_filter.html' filter=SELF.models.filtered.laundered %]
|
||
<hr>
|
templates/webpages/shop_part/_list_images.html | ||
---|---|---|
<!-- TMP -->
|
||
[%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%]
|
||
[%- USE T8 %][% USE Base64 %]
|
||
[%- USE Dumper %]
|
||
... | ... | |
<th>[% 'Description' | $T8 %]</th>
|
||
<th>[% 'Filename' | $T8 %]</th>
|
||
<th>[% 'Orig. Size w/h' | $T8 %]</th>
|
||
<th>[% 'Action' | $T8 %]</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
... | ... | |
<tr class="listrow" id="image_id_[% img.id %]">
|
||
<td><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]" class="dragdrop"></td>
|
||
<td width="70px"><img src="data:[% img.thumbnail_img_content_type %];base64,[% img.thumbnail_img_content.encode_base64 %]" alt="[% img.title %]"></td>
|
||
<td>[% HTML.escape(img.title) %]</td>
|
||
<td>[% HTML.escape(img.description) %]</td>
|
||
<td>[% HTML.escape(img.filename) %]</td>
|
||
<td>[% HTML.escape(img.thumbnail_img_width) _ ' x ' _ HTML.escape(img.thumbnail_img_height) %]</td>
|
||
<td>[% HTML.escape(img.title) %]</td>
|
||
<td>[% HTML.escape(img.description) %]</td>
|
||
<td>[% HTML.escape(img.filename) %]</td>
|
||
<td>[% HTML.escape(img.files_img_width) _ ' x ' _ HTML.escape(img.files_img_height) %]</td>
|
||
<td>[% L.button_tag("kivi.FileUploader.delete_file(" _ img.id _ ", 'ShopPart/ajax_delete_file')", LxERP.t8('Delete'), confirm=LxERP.t8("Are you sure?")) %] [% L.button_tag("kivi.FileUploader.add_file(" _ img.id _ "," _ FORM.id _ ",'shop_part','ShopPart/ajax_update_file','jpg|png|tif|gif')", LxERP.t8('Edit')) %] </td>
|
||
</tr>
|
||
[% END %]
|
||
</tbody>
|
||
... | ... | |
|
||
[% L.sortable_element('#images_list tbody', url=SELF.url_for(action='reorder'), with='image_id') %]
|
||
<p>
|
||
[% L.button_tag("add_file(this.form.id.value,'shop_part')", 'Fileupload') %]
|
||
[% L.button_tag("kivi.FileUploader.add_file(''," _ FORM.id _ ",'shop_part','ShopPart/ajax_upload_file','jpg|png|tif|gif')", LxERP.t8('Fileupload')) %]
|
||
</p>
|
||
|
||
|
||
|
||
|
||
<script type='text/javascript'>
|
||
<!--
|
||
function add_file(id,modul) {
|
||
//var id = this.$('#part').val();
|
||
kivi.popup_dialog({
|
||
url : 'controller.pl?action=FileUploader/ajax_add_file',
|
||
data: 'id=' + id + '&modul=' + modul,
|
||
dialog: { title: kivi.t8('File upload') }
|
||
} );
|
||
// var url = 'controller.pl?action=ShopPart/show_files?modul=shop_part&id=' + $('#id').val();
|
||
// $('#images_list').load(url);
|
||
//$('#jqueryui_popup_dialog').dialog('close');
|
||
return true;
|
||
}
|
||
-->
|
||
</script>
|
templates/webpages/shop_part/_transfer_status.html | ||
---|---|---|
[%- USE Dumper -%]
|
||
[% SET data = job.data_as_hash %]
|
||
|
||
<!-- ShopOrder BGJ -->
|
||
<h2>[% LxERP.t8("Watch status") %]</h2>
|
||
|
||
[% L.hidden_tag('', job.id, id="smu_job_id") %]
|
templates/webpages/shop_part/_upload_status.html | ||
---|---|---|
[% SET data = job.data_as_hash %]
|
||
|
||
|
||
<!-- ShopPart BGJ -->
|
||
<h2>[% LxERP.t8("Watch status") %]</h2>
|
||
|
||
[% L.hidden_tag('', job.id, id="smu_job_id") %]
|
templates/webpages/shop_part/categories.html | ||
---|---|---|
[%- USE P -%]
|
||
[%- USE LxERP -%]
|
||
[%- USE Dumper -%]
|
||
<!-- ShopPart -->
|
||
|
||
[% LxERP.t8("Part") %]: [% HTML.escape(SELF.shop_part.part.displayable_name) %]<br>
|
||
[% LxERP.t8("Shop") %]: [% HTML.escape(SELF.shop_part.shop.description) %]
|
||
<br>
|
||
... | ... | |
|
||
<form action="controller.pl" method="post">
|
||
[% BLOCK recurse %]
|
||
[% # path = '' %]<!-- TODO: Pfad wg neuer Kategorie im Shop anlegen -->
|
||
[% # path = '' %]<!-- TODO: Pfad wg neuer Kategorie im Shop anlegen -->
|
||
[% FOREACH obj = data %]
|
||
<ul>
|
||
<li>
|
||
[% checked = '' %]
|
||
[% # path = path _ obj.name %]
|
||
[% # test = path.split('\|') %]
|
||
[% # Dumper.dump_html(SELF.shop_part.shop_category.size) %]
|
||
[% # Dumper.dump_html(SELF.shop_part.shop_category) %]
|
||
[% IF SELF.shop_part.shop_category.1.grep(obj.name).size %]
|
||
[% checked = 'checked' %]
|
||
[% ELSE %]
|
||
... | ... | |
[% END %]
|
||
[% END %]
|
||
[% END %]
|
||
[% L.checkbox_tag('categories[]',value=obj.id _"," _ obj.name _ ",PFAD", checked=checked) %][% HTML.escape(obj.name) %]</li>
|
||
[% L.checkbox_tag('categories[]',value=obj.id, checked=checked) %][% HTML.escape(obj.name) %][% L.hidden_tag("cat_id_" _ obj.id, obj.name) %]</li>
|
||
[% IF obj.childrenCount >= 1 %]
|
||
[% # path = path _ '|' %]
|
||
[% INCLUDE recurse data=obj.children %]
|
||
... | ... | |
[% END %]
|
||
<div><h2>[% LxERP.t8("Shopcategories") %]</h2>
|
||
[% FOREACH row = CATEGORIES %]
|
||
<!-- TODO: Is still hardcoded 'Root' is shopware specified -->
|
||
[% IF row.name == 'Root' %]
|
||
[% IF row.childrenCount >= 1 %]
|
||
[% path = '' %]
|
templates/webpages/shop_part/edit.html | ||
---|---|---|
[%- USE LxERP -%]
|
||
[%- USE Dumper -%]
|
||
|
||
<!-- ShopPart -->
|
||
<!-- ShopPart -->
|
||
[% LxERP.t8("Part") %]: [% HTML.escape(SELF.shop_part.part.displayable_name) %]<br>
|
||
[% LxERP.t8("Shop") %]: [% HTML.escape(SELF.shop_part.shop.description) %]
|
||
[% Dumper.dump_html(SELF) %]
|
||
[% # Dumper.dump_html(SELF) %]
|
||
<form action="controller.pl" method="post">
|
||
<div>
|
||
[% IF SELF.shop_part.id %]
|
||
... | ... | |
</tr>
|
||
<tr>
|
||
<td>[% LxERP.t8("Active") %]</td>
|
||
<td>[% L.yes_no_tag("shop_part.active", SELF.shop_part.active) %]</td>
|
||
<td>[% L.yes_no_tag("shop_part.active", SELF.shop_part.active, default = "yes") %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th align="right">[% 'Price Source' | $T8 %]</th>
|
templates/webpages/shops/form.html | ||
---|---|---|
</p>
|
||
|
||
<hr>
|
||
<table>
|
||
<tr>
|
||
<th align="right">[% 'Description' | $T8 %]</th>
|
||
<th>Last update</th>
|
||
<th>[% 'Available qty' | $T8 %]</th>
|
||
</tr>
|
||
[%- FOREACH shop_part = SELF.shop.updatable_parts %]
|
||
<tr>
|
||
<td>[% P.part(shop_part.part) %]</td>
|
||
<td>[% shop_part.last_update.to_kivitendo %]</td>
|
||
<td>[% shop_part.part.get_stock %]</td>
|
||
</tr>
|
||
[%- END %]
|
||
</table>
|
||
|
||
|
||
<script type="text/javascript">
|
||
<!--
|
Auch abrufbar als: Unified diff
Shopmodul: Anpassungen nach mergen für master
Bis hier noch mit individuellen Kundenanpassungen