Revision 68319a27
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
scripts/migrate_icons.pl | ||
---|---|---|
1 |
|
|
2 |
use strict; |
|
3 |
use warnings; |
|
4 |
|
|
5 |
my %icons = ( |
|
6 |
'AP--Add Purchase Order.png' => 'purchase_order_add.png', |
|
7 |
'AP--Add RFQ.png' => 'rfq_add.png', |
|
8 |
'AP.png' => 'ap.png', |
|
9 |
'AP--Reports.png' => 'ap_report.png', |
|
10 |
'AP--Reports--Purchase Orders.png' => 'purchase_order_report.png', |
|
11 |
'AP--Reports--RFQs.png' => 'rfq_report.png', |
|
12 |
'AR--Add Credit Note.png' => 'credit_note_add.png', |
|
13 |
'AR--Add Delivery Order.png' => undef, # symlink to MDI-Txt_editor |
|
14 |
'AR--Add Dunning.png' => 'dunning_add.png', |
|
15 |
'AR--Add Quotation.png' => 'quotation_add.png', |
|
16 |
'AR--Add Sales Invoice.png' => 'sales_invoice_add.png', |
|
17 |
'AR--Add Sales Order.png' => 'sales_order_add.png', |
|
18 |
'AR.png' => 'ar.png', |
|
19 |
'AR--Reports--Delivery Orders.png' => undef, # symlink to MDI-Text_editor |
|
20 |
'AR--Reports--Dunnings.png' => 'dunnings_report.png', |
|
21 |
'AR--Reports--Invoices, Credit Notes & AR Transactions.png' => 'invoices_report.png', |
|
22 |
'AR--Reports.png' => 'ar_report.png', |
|
23 |
'AR--Reports--Quotations.png' => 'report_quotations.png', |
|
24 |
'AR--Reports--Sales Orders.png' => 'report_sales_orders.png', |
|
25 |
'Batch Printing--Packing Lists.png' => 'package_lists.png', |
|
26 |
'Batch Printing.png' => 'printing.png', |
|
27 |
'Batch Printing--Purchase Orders.png' => 'purchase_order_printing.png', |
|
28 |
'Batch Printing--Quotations.png' => 'quotation_printing.png', |
|
29 |
'Batch Printing--Receipts.png' => 'receipt_printing.png', |
|
30 |
'Batch Printing--RFQs.png' => 'rfq_printing.png', |
|
31 |
'Batch Printing--Sales Invoices.png' => 'sales_invoice_printing.png', |
|
32 |
'Batch Printing--Sales Orders.png' => 'sales_order_printing.png', |
|
33 |
'Cash--Payment.png' => 'payment.png', |
|
34 |
'Cash.png' => 'cash.png', |
|
35 |
'Cash--Receipt.png' => 'receipt.png', |
|
36 |
'Cash--Reconciliation.png' => 'reconcilliation.png', |
|
37 |
'Cash--Reports--Payments.png' => 'payment_report.png', |
|
38 |
'Cash--Reports.png' => 'cash_report.png', |
|
39 |
'Cash--Reports--Receipts.png' => 'receipt_report.png', |
|
40 |
'CRM--Add--Customer.png' => 'customer.png', |
|
41 |
'CRM--Add--Person.png' => 'contact.png', |
|
42 |
'CRM--Add--Vendor.png' => 'vendor.png', |
|
43 |
'CRM--Admin--Document Template.png' => 'document_template.png', |
|
44 |
'CRM--Admin--Label.png' => 'label.png', |
|
45 |
'CRM--Admin--Message.png' => 'message.png', |
|
46 |
'CRM--Admin.png' => 'admin.png', |
|
47 |
'CRM--Admin--Status.png' => 'status.png', |
|
48 |
'CRM--Admin--User Groups.png' => 'user_group.png', |
|
49 |
'CRM--Admin--User.png' => 'user.png', |
|
50 |
'CRM--Appointments.png' => 'appointment.png', |
|
51 |
'CRM--E-mail.png' => 'email.png', |
|
52 |
'CRM--Follow-Up.png' => 'follow_up.png', |
|
53 |
'CRM--Help.png' => 'help.png', |
|
54 |
'CRM--Knowledge.png' => 'knowledge.png', |
|
55 |
'CRM--Memo.png' => 'memo.png', |
|
56 |
'CRM--Opportunity.png' => 'opportunity.png', |
|
57 |
'CRM.png' => 'crm.png', |
|
58 |
'CRM--Search.png' => 'search.png', |
|
59 |
'CRM--Service.png' => 'service.png', |
|
60 |
'General Ledger--Add AP Transaction.png' => 'ap_transaction_add.png', |
|
61 |
'General Ledger--Add AR Transaction.png' => 'ar_transaction_add.png', |
|
62 |
'General Ledger--Add Transaction.png' => 'transaction_add.png', |
|
63 |
'General Ledger--DATEV - Export Assistent.png' => 'datev.png', |
|
64 |
'General Ledger.png' => 'gl.png', |
|
65 |
'General Ledger--Reports--AP Aging.png' => 'ap_aging.png', |
|
66 |
'General Ledger--Reports--AR Aging.png' => 'ar_aging.png', |
|
67 |
'General Ledger--Reports--Journal.png' => 'journal.png', |
|
68 |
'General Ledger--Reports.png' => 'gl_report.png', |
|
69 |
'Master Data--Add Assembly.png' => 'assembly_add.png', |
|
70 |
'Master Data--Add Customer.png' => 'customer_add.png', |
|
71 |
'Master Data--Add License.png' => 'license_add.png', |
|
72 |
'Master Data--Add Part.png' => 'part_add.png', |
|
73 |
'Master Data--Add Project.png' => 'project_add.png', |
|
74 |
'Master Data--Add Service.png' => 'service_add.png', |
|
75 |
'Master Data--Add Vendor.png' => 'vendor_add.png', |
|
76 |
'Master Data.png' => 'master_data.png', |
|
77 |
'Master Data--Reports--Assemblies.png' => 'assembly_report.png', |
|
78 |
'Master Data--Reports--Customers.png' => 'customer_report.png', |
|
79 |
'Master Data--Reports--Licenses.png' => 'license_report.png', |
|
80 |
'Master Data--Reports--Parts.png' => 'part_report.png', |
|
81 |
'Master Data--Reports.png' => 'master_data_report.png', |
|
82 |
'Master Data--Reports--Projects.png' => 'project_report.png', |
|
83 |
'Master Data--Reports--Projecttransactions.png' => 'project_transaction_report.png', |
|
84 |
'Master Data--Reports--Services.png' => 'service_report.png', |
|
85 |
'Master Data--Reports--Vendors.png' => 'vendor_report.png', |
|
86 |
'Master Data--Update Prices.png' => 'prices_update.png', |
|
87 |
'Neues Fenster.png' => 'window_new.png', |
|
88 |
# 'phone.png' => 'phone.png', |
|
89 |
'Program--Logout.png' => 'logout.png', |
|
90 |
'Program.png' => 'program.png', |
|
91 |
'Program--Preferences.png' => 'preferences.png', |
|
92 |
'Program--Version.png' => 'version.png', |
|
93 |
'Reports--Balance Sheet.png' => 'balance_sheet.png', |
|
94 |
'Reports--Chart of Accounts.png' => 'chart_of_accounts.png', |
|
95 |
'Reports--Income Statement.png' => 'income_statement.png', |
|
96 |
'Reports.png' => 'report.png', |
|
97 |
'Reports--UStVa.png' => 'ustva.png', |
|
98 |
'System.png' => 'system.png', |
|
99 |
'Warehouse.png' => 'warehouse.png', |
|
100 |
'Warehouse--Produce Assembly.png' => 'assembly_produce.png', |
|
101 |
'MDI-Text-Editor-16x16.png' => 'mdi_text_editor.png', |
|
102 |
); |
|
103 |
|
|
104 |
my %symlinks = ( |
|
105 |
'mdi_text_editor.png' => 'delivery_order_add.png', # symlink to MDI-Txt_editor |
|
106 |
'mdi_text_editor.png' => 'delivery_order_report.png', # symlink to MDI-Txt_editor |
|
107 |
); |
|
108 |
|
|
109 |
sub checks { |
|
110 |
# check 1: no duplicate targets |
|
111 |
my %seen; |
|
112 |
for (values %icons) { |
|
113 |
next unless defined $_; |
|
114 |
die "duplicate target: $_" if $seen{$_}++; |
|
115 |
} |
|
116 |
|
|
117 |
# check2: all targets should end in .png, otherwise there's a typo |
|
118 |
for (values %icons) { |
|
119 |
next unless defined $_; |
|
120 |
die "target does not end in .png: $_" unless /\.png$/; |
|
121 |
} |
|
122 |
|
|
123 |
# check 3: all sources need to be real files in this dir |
|
124 |
for (keys %icons) { |
|
125 |
next unless defined $_; |
|
126 |
die "key $_ is not a file!" unless -f $_; |
|
127 |
} |
|
128 |
|
|
129 |
# check 4: all keys in symlinks need to be a target in icons |
|
130 |
for (keys %symlinks) { |
|
131 |
no warnings 'uninitialized'; |
|
132 |
die "can't symlink this, because it's not a target of renaming: $_" unless { reverse %icons }->{$_}; |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
sub make_icons { |
|
137 |
# now do the actual renaming |
|
138 |
while (my ($from, $to) = each(%icons)) { |
|
139 |
if (defined $to) { |
|
140 |
# rename |
|
141 |
system("git mv '$from' '$to'"); |
|
142 |
} else { |
|
143 |
# delete |
|
144 |
system("git rm '$from'"); |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
# and do some symlinking |
|
149 |
while (my ($from, $to) = each(%symlinks)) { |
|
150 |
system("ln -s '$from' '$to'"); |
|
151 |
system("git add '$to'"); |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
checks(); |
|
156 |
make_icons(); |
Auch abrufbar als: Unified diff
Migrationsscript das Iconmappings enthält