Revision a2c920be
Von Jan Büren vor etwa 2 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
394 | 394 |
# type=submit $locale->text('Add Accounts Payables Transaction') |
395 | 395 |
# type=submit $locale->text('Edit Accounts Payables Transaction') |
396 | 396 |
|
397 |
my $readonly = $form->{id} ? "readonly" : ""; |
|
398 |
|
|
399 |
$form->{radier} = ($::instance_conf->get_ap_changeable == 2) |
|
400 |
? ($form->current_date(\%myconfig) eq $form->{gldate}) |
|
401 |
: ($::instance_conf->get_ap_changeable == 1); |
|
402 |
$readonly = $form->{radier} ? "" : $readonly; |
|
403 |
|
|
404 |
$form->{readonly} = $readonly; |
|
405 |
|
|
406 | 397 |
# currencies |
407 | 398 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
408 | 399 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
... | ... | |
1407 | 1398 |
if ($::form->{id} && SL::DB::Manager::ApGl->find_by(ap_id => $::form->{id})) { |
1408 | 1399 |
$is_linked_gl_transaction = 1; |
1409 | 1400 |
} |
1401 |
# add readonly state in $::form |
|
1402 |
$::form->{readonly} = !$may_edit_create ? 1 |
|
1403 |
: $is_closed ? 1 |
|
1404 |
: $is_storno ? 1 |
|
1405 |
: $has_storno ? 1 |
|
1406 |
: ($::form->{id} && $change_never) ? 1 |
|
1407 |
: ($::form->{id} && $change_on_same_day_only) ? 1 |
|
1408 |
: $is_linked_bank_transaction ? 1 |
|
1409 |
: $has_sepa_exports ? 1 |
|
1410 |
: 0; |
|
1410 | 1411 |
|
1411 | 1412 |
my $create_post_action = sub { |
1412 | 1413 |
# $_[0]: description |
bin/mozilla/ar.pl | ||
---|---|---|
372 | 372 |
# $locale->text('Edit Accounts Receivables Transaction') |
373 | 373 |
$form->{title} = $locale->text("$title Accounts Receivables Transaction"); |
374 | 374 |
|
375 |
$readonly = ($form->{id}) ? "readonly" : ""; |
|
376 |
|
|
377 |
$form->{radier} = ($::instance_conf->get_ar_changeable == 2) |
|
378 |
? ($form->current_date(\%myconfig) eq $form->{gldate}) |
|
379 |
: ($::instance_conf->get_ar_changeable == 1); |
|
380 |
$readonly = ($form->{radier}) ? "" : $readonly; |
|
381 | 375 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
382 | 376 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
383 | 377 |
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, "buy", $form->{id}, 'ar'); |
... | ... | |
1383 | 1377 |
|
1384 | 1378 |
$is_linked_bank_transaction = 1; |
1385 | 1379 |
} |
1380 |
# add readonly state in $::form |
|
1381 |
$::form->{readonly} = !$may_edit_create ? 1 |
|
1382 |
: $is_closed ? 1 |
|
1383 |
: $is_storno ? 1 |
|
1384 |
: $has_storno ? 1 |
|
1385 |
: ($::form->{id} && $change_never) ? 1 |
|
1386 |
: ($::form->{id} && $change_on_same_day_only) ? 1 |
|
1387 |
: $is_linked_bank_transaction ? 1 |
|
1388 |
: 0; |
|
1386 | 1389 |
for my $bar ($::request->layout->get('actionbar')) { |
1387 | 1390 |
$bar->add( |
1388 | 1391 |
action => [ |
bin/mozilla/ir.pl | ||
---|---|---|
242 | 242 |
} |
243 | 243 |
|
244 | 244 |
sub setup_ir_action_bar { |
245 |
my ($tmpl_var) = @_; |
|
245 | 246 |
my $form = $::form; |
246 | 247 |
my $change_never = $::instance_conf->get_ir_changeable == 0; |
247 | 248 |
my $change_on_same_day_only = $::instance_conf->get_ir_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate}); |
... | ... | |
264 | 265 |
|
265 | 266 |
$is_linked_bank_transaction = 1; |
266 | 267 |
} |
268 |
# add readonly state in tmpl_vars |
|
269 |
$tmpl_var->{readonly} = !$may_edit_create ? 1 |
|
270 |
: $form->{locked} ? 1 |
|
271 |
: $form->{storno} ? 1 |
|
272 |
: ($form->{id} && $change_never) ? 1 |
|
273 |
: ($form->{id} && $change_on_same_day_only) ? 1 |
|
274 |
: $is_linked_bank_transaction ? 1 |
|
275 |
: $has_sepa_exports ? 1 |
|
276 |
: 0; |
|
267 | 277 |
|
268 | 278 |
my $create_post_action = sub { |
269 | 279 |
# $_[0]: description |
... | ... | |
278 | 288 |
: $form->{storno} ? t8('A canceled invoice cannot be posted.') |
279 | 289 |
: ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') |
280 | 290 |
: ($form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.') |
291 |
: $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') |
|
281 | 292 |
: $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') |
282 | 293 |
: undef, |
283 | 294 |
], |
... | ... | |
487 | 498 |
|
488 | 499 |
$::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.File kivi.SalesPurchase kivi.Part kivi.CustomerVendor kivi.Validator ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_project client_js)); |
489 | 500 |
|
490 |
setup_ir_action_bar(); |
|
501 |
setup_ir_action_bar(\%TMPL_VAR);
|
|
491 | 502 |
|
492 | 503 |
$form->header(); |
493 | 504 |
|
bin/mozilla/is.pl | ||
---|---|---|
349 | 349 |
my $lr = $invoice_obj->linked_records(direction => 'from', from => ['Order']); |
350 | 350 |
$is_invoice_for_advance_payment_from_order = scalar @$lr >= 1; |
351 | 351 |
} |
352 |
# add readonly state in tmpl_vars |
|
353 |
$tmpl_var->{readonly} = !$may_edit_create ? 1 |
|
354 |
: $form->{locked} ? 1 |
|
355 |
: $form->{storno} ? 1 |
|
356 |
: ($form->{id} && $change_never) ? 1 |
|
357 |
: ($form->{id} && $change_on_same_day_only) ? 1 |
|
358 |
: $is_linked_bank_transaction ? 1 |
|
359 |
: 0; |
|
352 | 360 |
|
353 | 361 |
for my $bar ($::request->layout->get('actionbar')) { |
354 | 362 |
$bar->add( |
templates/webpages/ap/form_header.html | ||
---|---|---|
103 | 103 |
<span class="plus[% creditremaining_plus %]">[% creditremaining | html %]</span> |
104 | 104 |
</td> |
105 | 105 |
</tr> |
106 |
|
|
107 | 106 |
[%- IF invoice_obj.sepa_exports.as_list.size %] |
108 | 107 |
<tr> |
109 | 108 |
<th align="right">[% LxERP.t8("SEPA exports") %]</th> |
... | ... | |
115 | 114 |
</td> |
116 | 115 |
</tr> |
117 | 116 |
[%- END %] |
118 |
|
|
119 | 117 |
<tr> |
120 | 118 |
<th align="right" nowrap>[% 'Currency' | $T8 %]</th> |
121 |
<td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td> |
|
122 |
|
|
119 |
<td> |
|
120 |
[%- IF readonly %] |
|
121 |
[% HTML.escape(currency) %] |
|
122 |
[% L.hidden_tag("currency", currency) %] |
|
123 |
[%- ELSE %] |
|
124 |
[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %] |
|
125 |
[%- END %] |
|
126 |
</td> |
|
123 | 127 |
[% IF ( defaultcurrency && (currency != defaultcurrency) ) %] |
124 | 128 |
<th align=right>[% 'Exchangerate' | $T8 %]</th> |
125 |
[% IF ( forex ) %] |
|
126 |
<td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td> |
|
127 |
[% ELSE %] |
|
128 |
<td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td> |
|
129 |
[% END %] |
|
129 |
<td> |
|
130 |
[%- IF readonly %] |
|
131 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
132 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
133 |
[%- ELSE %] |
|
134 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
|
135 |
[%- END %] |
|
136 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
130 | 137 |
[% END %] |
131 |
|
|
132 | 138 |
</tr> |
133 | 139 |
|
134 | 140 |
[% IF ALL_DEPARTMENTS %] |
templates/webpages/ar/form_header.html | ||
---|---|---|
92 | 92 |
[%- END %] |
93 | 93 |
<tr> |
94 | 94 |
<th align=right>[% 'Currency' | $T8 %]</th> |
95 |
<td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td> |
|
95 |
<td> |
|
96 |
[%- IF readonly %] |
|
97 |
[% HTML.escape(currency) %] |
|
98 |
[% L.hidden_tag("currency", currency) %] |
|
99 |
[%- ELSE %] |
|
100 |
[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %] |
|
101 |
[%- END %] |
|
102 |
</td> |
|
96 | 103 |
[% L.hidden_tag('defaultcurrency', defaultcurrency) %] |
97 | 104 |
[% L.hidden_tag('fxgain_accno', fxgain_accno) %] |
98 | 105 |
[% L.hidden_tag('fxloss_accno', fxloss_accno) %] |
... | ... | |
100 | 107 |
[% L.hidden_tag('forex', forex) %] |
101 | 108 |
[% IF show_exch %] |
102 | 109 |
<th align=right>[% 'Exchangerate' | $T8 %]</th> |
103 |
<td>[%- IF forex %][% L.hidden_tag('exchangerate', LxERP.format_amount(exchangerate, 5, 1)) %][% LxERP.format_amount(exchangerate, 5, 1) %][%- ELSE %][% L.input_tag('exchangerate', LxERP.format_amount(exchangerate, 5, 1), size=10) %][%- END %]</td> |
|
110 |
<td> |
|
111 |
[%- IF readonly %] |
|
112 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
113 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
114 |
[%- ELSE %] |
|
115 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
|
116 |
[%- END %] |
|
117 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
118 |
</td> |
|
104 | 119 |
[% END %] |
105 | 120 |
</tr> |
106 | 121 |
[% IF ALL_DEPARTMENTS %] |
templates/webpages/ir/form_header.html | ||
---|---|---|
118 | 118 |
[%- IF currencies %] |
119 | 119 |
<tr> |
120 | 120 |
<th align="right">[% 'Currency' | $T8 %]</th> |
121 |
<td>[% currencies %]</td> |
|
121 |
<td> |
|
122 |
[%- IF readonly %] |
|
123 |
[% HTML.escape(currency) %] |
|
124 |
[% L.hidden_tag("currency", currency) %] |
|
125 |
[%- ELSE %] |
|
126 |
[% currencies %] |
|
127 |
[%- END %] |
|
128 |
</td> |
|
122 | 129 |
</tr> |
123 | 130 |
[%- END %] |
124 | 131 |
<input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]"> |
... | ... | |
127 | 134 |
<tr> |
128 | 135 |
<th align="right">[% 'Exchangerate' | $T8 %]</th> |
129 | 136 |
<td> |
130 |
[%- IF forex %] |
|
131 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
137 |
[%- IF readonly %] |
|
138 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
139 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
132 | 140 |
[%- ELSE %] |
133 | 141 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
134 | 142 |
[%- END %] |
143 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
135 | 144 |
</td> |
136 | 145 |
</tr> |
137 | 146 |
[%- END %] |
templates/webpages/is/form_header.html | ||
---|---|---|
175 | 175 |
[%- IF currencies %] |
176 | 176 |
<tr> |
177 | 177 |
<th align="right">[% 'Currency' | $T8 %]</th> |
178 |
<td>[% currencies %]</td> |
|
178 |
<td> |
|
179 |
[%- IF readonly %] |
|
180 |
[% HTML.escape(currency) %] |
|
181 |
[% L.hidden_tag("currency", currency) %] |
|
182 |
[%- ELSE %] |
|
183 |
[% currencies %] |
|
184 |
[%- END %] |
|
185 |
</td> |
|
179 | 186 |
</tr> |
180 | 187 |
[%- END %] |
181 | 188 |
<tr style='display:none'> |
... | ... | |
190 | 197 |
<tr> |
191 | 198 |
<th align="right">[% 'Exchangerate' | $T8 %]</th> |
192 | 199 |
<td> |
193 |
[%- IF forex %] |
|
194 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
200 |
[%- IF readonly %] |
|
201 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
202 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
195 | 203 |
[%- ELSE %] |
196 | 204 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
197 | 205 |
[%- END %] |
206 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
198 | 207 |
</td> |
199 | 208 |
</tr> |
200 | 209 |
[%- END %] |
Auch abrufbar als: Unified diff
Wechselkurs in form_header anzeigen, inkl. Herkunft (Beleg oder Tageskurs)
> form>radier entfernt und den Zustand readonly in allen 4Buchungsmasken auch anhand der Zustände der action_bar Knöpfe
abhängig gemacht (in form oder TMPL_VARS gesetzt)