X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FMappings.pm;h=81f451248f92b407c6d9ec9ba2757a0bf93b5c24;hb=3ced230d576cb0eff6f8b7805f1682c14e009ef9;hp=2b79bfe362616406d427b15aab2698148a7a5b4e;hpb=a93b3b648ec14f94c87176bb8d174da005446d97;p=kivitendo-erp.git diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 2b79bfe36..81f451248 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -3,6 +3,8 @@ package SL::DB::Helper::Mappings; use utf8; use strict; +use SL::Util qw(camelify); + require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(get_table_for_package get_package_for_table get_package_names); @@ -18,7 +20,16 @@ my @lxoffice_blacklist_permanent = qw( my @lxoffice_blacklist_temp = qw( ); -my @lxoffice_blacklist = (@lxoffice_blacklist_permanent, @lxoffice_blacklist_temp); +# tables created by crm module +my @crm_blacklist = qw( +); + +# tables created by cash register +my @cash_register_blacklist = qw( +ekartikel ekbon ekkunde ektext erptasten +); + +my @lxoffice_blacklist = (@lxoffice_blacklist_permanent, @lxoffice_blacklist_temp, @crm_blacklist, @cash_register_blacklist); # map table names to their models. # unlike rails we have no singular<->plural magic. @@ -26,6 +37,14 @@ my @lxoffice_blacklist = (@lxoffice_blacklist_permanent, @lxoffice_blacklist_tem my %lxoffice_package_names = ( acc_trans => 'acc_transaction', audittrail => 'audit_trail', + 'auth.clients' => 'auth_client', + 'auth.clients_users' => 'auth_client_user', + 'auth.clients_groups' => 'auth_client_group', + 'auth.group' => 'auth_groups', + 'auth.group_right' => 'auth_group_rights', + 'auth.user' => 'auth_users', + 'auth.user_config' => 'auth_user_configs', + 'auth.user_group' => 'auth_user_groups', ar => 'invoice', ap => 'purchase_invoice', background_jobs => 'background_job', @@ -34,10 +53,15 @@ my %lxoffice_package_names = ( bank_accounts => 'bank_account', buchungsgruppen => 'buchungsgruppe', contacts => 'contact', + csv_import_profiles => 'csv_import_profile', + csv_import_profile_settings => 'csv_import_profile_setting', + csv_import_reports => 'csv_import_report', + csv_import_report_rows => 'csv_import_report_row', + csv_import_report_status => 'csv_import_report_status', + currencies => 'currency', custom_variable_configs => 'custom_variable_config', custom_variables => 'custom_variable', custom_variables_validity => 'custom_variable_validity', - customertax => 'customer_tax', datev => 'datev', defaults => 'default', delivery_orders => 'delivery_order', @@ -54,31 +78,25 @@ my %lxoffice_package_names = ( follow_up_links => 'follow_up_link', follow_ups => 'follow_up', generic_translations => 'generic_translation', - gifi => 'gifi', gl => 'GLTransaction', history_erp => 'history', inventory => 'inventory', invoice => 'invoice_item', language => 'language', - license => 'license', - licenseinvoice => 'license_invoice', makemodel => 'make_model', notes => 'note', orderitems => 'order_item', oe => 'order', parts => 'part', partsgroup => 'parts_group', - partstax => 'parts_tax', payment_terms => 'payment_term', periodic_invoices => 'periodic_invoice', periodic_invoices_configs => 'periodic_invoices_config', - prices => 'prices', + prices => 'price', price_factors => 'price_factor', pricegroup => 'pricegroup', printers => 'Printer', record_links => 'record_link', - rma => 'RMA', - rmaitems => 'RMA_item', sepa_export => 'sepa_export', sepa_export_items => 'sepa_export_item', schema_info => 'schema_info', @@ -91,7 +109,7 @@ my %lxoffice_package_names = ( translation_payment_terms => 'translation_payment_term', units => 'unit', units_language => 'units_language', - vendortax => 'vendor_tax', + vendor => 'vendor', ); my (%lxoffice_tables_to_packages, %lxoffice_tables_to_manager_packages, %lxoffice_packages_to_tables); @@ -145,18 +163,6 @@ sub db { die "Can't resolve '$string' as a database model, sorry. Did you perhaps forgot to load it?"; } -sub camelify { - my ($str) = @_; - $str =~ s/_+(.)/uc($1)/ge; - ucfirst $str; -} - -sub snakify { - my ($str) = @_; - $str =~ s/(? Returns the manager package name for a table name: - SL::DB::Helpers::Mappings::get_manager_package_for_table('oe') + SL::DB::Helper::Mappings::get_manager_package_for_table('oe') # SL::DB::Manager::Order =item C Returns the table name for a package name: - SL::DB::Helpers::Mappings::get_table_for_package('SL::DB::Order') + SL::DB::Helper::Mappings::get_table_for_package('SL::DB::Order') # oe - SL::DB::Helpers::Mappings::get_table_for_package('Order') + SL::DB::Helper::Mappings::get_table_for_package('Order') # oe =back