Notes on Migrating from versions of Shopware ERP older than 5.0.0
=================================================================

The Shopware ERP 5.0.0 release introduced a number of breaking changes across most services, entities and database
tables. Because of this, custom integrations which were developed against older versions of Shopware ERP must be adapted
to the new APIs.

Stock Management
----------------

The previous method of reading and writing stock has changed. Please see the
:ref:`chapter on Stock Management <stock-management>` for details.

Renamed Services
----------------

=================================================================  ============================================================
Old name                                                           New name
=================================================================  ============================================================
``viison_pickware_erp.bin_location_stock_change_factory``          ``pickware.erp.stock_change_list_factory_service``
``viison_pickware_erp.order_document_creator``                     ``pickware.erp.order_document_creation_service``
``viison_pickware_erp.plugins.swag_import_export.profile_loader``  ``pickware.erp.import_export_profile_loader_service``
``viison_pickware_erp.stock_entry_item_updater``                   ``pickware.erp.stock_item_updater_service``
``viison_pickware_erp.stock_initialization``                       ``pickware.erp.stock_initialization_service``
``viison_pickware_erp.stock_manager_factory``                      *removed*, use ``pickware.erp.stock_ledger_service`` instead
``viison_pickware_erp.stock_reservation``                          ``pickware.erp.stock_reservation_service``
``viison_pickware_erp.stock_util``                                 *removed*
``viison_pickware_erp.supplier_number``                            ``pickware.erp.supplier_number_generator_service``
``viison_pickware_erp.warehouse_stock_limits``                     *removed*
=================================================================  ============================================================

Renamed Tables
--------------

============================================================  ======================================================
Old name                                                      New name
============================================================  ======================================================
``s_plugin_pickware_article_detail_property_types``           ``pickware_erp_article_detail_item_properties``
``s_plugin_pickware_property_types``                          ``pickware_erp_item_properties``
``s_plugin_pickware_reshipment_attachments``                  ``pickware_erp_return_shipment_attachments``
``s_plugin_pickware_reshipment_items``                        ``pickware_erp_return_shipment_items``
``s_plugin_pickware_reshipment_status``                       ``pickware_erp_return_shipment_statuses``
``s_plugin_pickware_reshipments``                             ``pickware_erp_return_shipments``
``s_plugin_pickware_stock_entry_item_properties``             ``pickware_erp_stock_item_property_values``
``s_plugin_pickware_stock_entry_items``                       ``pickware_erp_stock_items``
``s_plugin_pickware_stocks``                                  ``pickware_erp_stock_ledger_entries``
``s_plugin_pickware_supplier_article_details``                ``pickware_erp_article_detail_supplier_mappings``
``s_plugin_pickware_supplier_fabricators``                    ``pickware_erp_manufacturer_supplier_mappings``
``s_plugin_pickware_supplier_order_article_detail_states``    ``pickware_erp_supplier_order_item_statuses``
``s_plugin_pickware_supplier_order_article_details``          ``pickware_erp_supplier_order_items``
``s_plugin_pickware_supplier_order_attachments``              ``pickware_erp_supplier_order_attachments``
``s_plugin_pickware_supplier_order_states``                   ``pickware_erp_supplier_order_statuses``
``s_plugin_pickware_supplier_orders``                         ``pickware_erp_supplier_orders``
``s_plugin_pickware_suppliers``                               ``pickware_erp_suppliers``
``s_plugin_pickware_warehouse_bin_location_article_details``  ``pickware_erp_article_detail_bin_location_mappings``
``s_plugin_pickware_warehouse_bin_location_stock_snapshots``  ``pickware_erp_bin_location_stock_snapshots``
``s_plugin_pickware_warehouse_bin_locations``                 ``pickware_erp_bin_locations``
``s_plugin_pickware_warehouse_reserved_stocks``               ``pickware_erp_order_stock_reservations``
``s_plugin_pickware_warehouse_stocks``                        ``pickware_erp_warehouse_article_detail_stock_counts``
``s_plugin_pickware_warehouses``                              ``pickware_erp_warehouses``
============================================================  ======================================================

Renamed Pickware Table Columns
------------------------------

===============================================  ==============================  =====================================
Table                                            Old column name                 New column name
===============================================  ==============================  =====================================
``pickware_erp_article_detail_item_properties``  ``propertyTypeId``              ``itemPropertyId``
``pickware_erp_bin_location_stock_snapshots``    ``stockEntryId``                ``stockLedgerEntryId``
``pickware_erp_manufacturer_supplier_mappings``  ``fabricatorId``                ``manufacturerId``
``pickware_erp_order_stock_reservations``        ``binLocationArticleDetailId``  ``articleDetailBinLocationMappingId``
``pickware_erp_return_shipment_attachments``     ``reshipmentId``                ``returnShipmentId``
``pickware_erp_return_shipment_items``           ``depreciatedQuantity``         ``writtenOffQuantity``

                                                 ``reshipmentId``                ``returnShipmentId``
``pickware_erp_stock_item_property_values``      ``propertyTypeId``              ``itemPropertyId``

                                                 ``stockEntryItemId``            ``stockItemId``
``pickware_erp_stock_items``                     ``stockEntryId``                ``stockLedgerEntryId``
``pickware_erp_stock_ledger_entries``            ``newInstockQuantity``          ``newStock``

                                                 ``oldInstockQuantity``          ``oldStock``

                                                 ``parentId``                    ``sourceLotEntryId``

                                                 ``reshipmentItemId``            ``returnShipmentItemId``
``pickware_erp_supplier_order_attachments``      ``orderId``                     ``supplierOrderId``
``pickware_erp_supplier_order_items``            ``fabricatorName``              ``manufacturerName``

                                                 ``fabricatorNumber``            ``manufacturerArticleNumber``

                                                 ``orderId``                     ``supplierOrderId``

                                                 ``status``                      ``statusId``
``pickware_erp_supplier_orders``                 ``status``                      ``statusId``
``pickware_erp_warehouses``                      ``stockAvailable``              ``stockAvailableForSale``
===============================================  ==============================  =====================================

Renamed Attribute Columns
-------------------------

===============================================  =========================================  ======================================
Table                                            Old attribute column name                  New attribute column name
===============================================  =========================================  ======================================
``s_articles_attributes``                        ``viison_incoming_stock``                  ``pickware_incoming_stock``

                                                 ``viison_not_relevant_for_stock_manager``  ``pickware_stock_management_disabled``

                                                 ``viison_physical_stock_for_sale``         ``pickware_physical_stock_for_sale``

                                                 ``viison_stock_initialized``               ``pickware_stock_initialized``

                                                 ``viison_stock_initialization_time``       ``pickware_stock_initialization_time``
``s_order_attributes``                           ``viison_last_changed``                    ``pickware_last_changed``
``s_order_details_attributes``                   ``viison_canceled_quantity``               ``pickware_canceled_quantity``
===============================================  =========================================  ======================================

