X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FShopConnector%2FBase.pm;h=1dc4a2e219731c42e409d4386f4c55deea1d926e;hb=04dccca70c47960cd6ea03a4f0ae05a9cbc42c41;hp=cf2f9f636bd92c838aacc5a65c4f5d37bd3b0b1e;hpb=98d0f52efec9515aed3dc8efa39b3e5683400d02;p=kivitendo-erp.git diff --git a/SL/ShopConnector/Base.pm b/SL/ShopConnector/Base.pm index cf2f9f636..1dc4a2e21 100644 --- a/SL/ShopConnector/Base.pm +++ b/SL/ShopConnector/Base.pm @@ -34,7 +34,21 @@ sub get_one_order { sub get_new_orders { die 'get_order needs to be implemented' } -sub update_part { die 'update_part needs to be implemented' } +sub update_part { + die 'update_part needs to be implemented'; + + my ($self, $shop_part, $todo) = @_; + #shop_part is passed as a param + die "Need a valid Shop Part for updating Part" unless ref($shop_part) eq 'SL::DB::ShopPart'; + die "Invalid todo for updating Part" unless $todo =~ m/(price|stock|price_stock|active|all)/; + + my $part = SL::DB::Part->new(id => $shop_part->part_id)->load; + die "Shop Part but no kivi Part?" unless ref $part eq 'SL::DB::Part'; + + my $success; + + return $success ? 1 : 0; +} sub get_article { die 'get_article needs to be implemented' } @@ -85,7 +99,24 @@ imported order or within the same hash structure a error message. =item C -=item C +=item C + +Updates one Part including all metadata and Images in a Shop. +Needs a valid 'SL::DB::ShopPart' as first parameter and a requested action +as second parameter. Valid values for the second parameter are +"price, stock, price_stock, active, all". +The method updates either all metadata or a subset. +Name and action for the subsets: + + price => updates only the price + stock => updates only the available stock (qty) + price_stock => combines both predecessors + active => updates only the state of the shop part + +Images should always be updated, regardless of the requested action. +Returns 1 if all updates were executed successful. + + =item C @@ -106,7 +137,7 @@ the same data structure. Details of the returning hashref: =item C Sets the state of the order in the Shop. -Valid values are dependant on the Shop API, common states +Valid values depend on the Shop API, common states are delivered, fetched, paid, in progress ...