Revision 93d8a5ea
Von Jan Büren vor etwa 2 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
401 | 401 |
# type=submit $locale->text('Add Accounts Payables Transaction') |
402 | 402 |
# type=submit $locale->text('Edit Accounts Payables Transaction') |
403 | 403 |
|
404 |
my $readonly = $form->{id} ? "readonly" : ""; |
|
405 |
|
|
406 |
$form->{radier} = ($::instance_conf->get_ap_changeable == 2) |
|
407 |
? ($form->current_date(\%myconfig) eq $form->{gldate}) |
|
408 |
: ($::instance_conf->get_ap_changeable == 1); |
|
409 |
$readonly = $form->{radier} ? "" : $readonly; |
|
410 |
|
|
411 |
$form->{readonly} = $readonly; |
|
412 |
|
|
413 | 404 |
# currencies |
414 | 405 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
415 | 406 |
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 | ||
---|---|---|
379 | 379 |
# $locale->text('Edit Accounts Receivables Transaction') |
380 | 380 |
$form->{title} = $locale->text("$title Accounts Receivables Transaction"); |
381 | 381 |
|
382 |
$readonly = ($form->{id}) ? "readonly" : ""; |
|
383 |
|
|
384 |
$form->{radier} = ($::instance_conf->get_ar_changeable == 2) |
|
385 |
? ($form->current_date(\%myconfig) eq $form->{gldate}) |
|
386 |
: ($::instance_conf->get_ar_changeable == 1); |
|
387 |
$readonly = ($form->{radier}) ? "" : $readonly; |
|
388 | 382 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
389 | 383 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
390 | 384 |
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, "buy", $form->{id}, 'ar'); |
... | ... | |
1384 | 1378 |
|
1385 | 1379 |
$is_linked_bank_transaction = 1; |
1386 | 1380 |
} |
1381 |
# add readonly state in $::form |
|
1382 |
$::form->{readonly} = !$may_edit_create ? 1 |
|
1383 |
: $is_closed ? 1 |
|
1384 |
: $is_storno ? 1 |
|
1385 |
: $has_storno ? 1 |
|
1386 |
: ($::form->{id} && $change_never) ? 1 |
|
1387 |
: ($::form->{id} && $change_on_same_day_only) ? 1 |
|
1388 |
: $is_linked_bank_transaction ? 1 |
|
1389 |
: 0; |
|
1387 | 1390 |
for my $bar ($::request->layout->get('actionbar')) { |
1388 | 1391 |
$bar->add( |
1389 | 1392 |
action => [ |
bin/mozilla/ir.pl | ||
---|---|---|
247 | 247 |
} |
248 | 248 |
|
249 | 249 |
sub setup_ir_action_bar { |
250 |
my ($tmpl_var) = @_; |
|
250 | 251 |
my $form = $::form; |
251 | 252 |
my $change_never = $::instance_conf->get_ir_changeable == 0; |
252 | 253 |
my $change_on_same_day_only = $::instance_conf->get_ir_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate}); |
... | ... | |
269 | 270 |
|
270 | 271 |
$is_linked_bank_transaction = 1; |
271 | 272 |
} |
273 |
# add readonly state in tmpl_vars |
|
274 |
$tmpl_var->{readonly} = !$may_edit_create ? 1 |
|
275 |
: $form->{locked} ? 1 |
|
276 |
: $form->{storno} ? 1 |
|
277 |
: ($form->{id} && $change_never) ? 1 |
|
278 |
: ($form->{id} && $change_on_same_day_only) ? 1 |
|
279 |
: $is_linked_bank_transaction ? 1 |
|
280 |
: $has_sepa_exports ? 1 |
|
281 |
: 0; |
|
272 | 282 |
|
273 | 283 |
my $create_post_action = sub { |
274 | 284 |
# $_[0]: description |
... | ... | |
283 | 293 |
: $form->{storno} ? t8('A canceled invoice cannot be posted.') |
284 | 294 |
: ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') |
285 | 295 |
: ($form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.') |
296 |
: $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.') |
|
286 | 297 |
: $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') |
287 | 298 |
: undef, |
288 | 299 |
], |
... | ... | |
498 | 509 |
|
499 | 510 |
$::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)); |
500 | 511 |
|
501 |
setup_ir_action_bar(); |
|
512 |
setup_ir_action_bar(\%TMPL_VAR);
|
|
502 | 513 |
|
503 | 514 |
$form->header(); |
504 | 515 |
|
bin/mozilla/is.pl | ||
---|---|---|
350 | 350 |
my $lr = $invoice_obj->linked_records(direction => 'from', from => ['Order']); |
351 | 351 |
$is_invoice_for_advance_payment_from_order = scalar @$lr >= 1; |
352 | 352 |
} |
353 |
# add readonly state in tmpl_vars |
|
354 |
$tmpl_var->{readonly} = !$may_edit_create ? 1 |
|
355 |
: $form->{locked} ? 1 |
|
356 |
: $form->{storno} ? 1 |
|
357 |
: ($form->{id} && $change_never) ? 1 |
|
358 |
: ($form->{id} && $change_on_same_day_only) ? 1 |
|
359 |
: $is_linked_bank_transaction ? 1 |
|
360 |
: 0; |
|
353 | 361 |
|
354 | 362 |
for my $bar ($::request->layout->get('actionbar')) { |
355 | 363 |
$bar->add( |
templates/webpages/ap/form_header.html | ||
---|---|---|
107 | 107 |
<span class="plus[% creditremaining_plus %]">[% creditremaining | html %]</span> |
108 | 108 |
</td> |
109 | 109 |
</tr> |
110 |
|
|
111 | 110 |
[%- IF invoice_obj.sepa_exports.as_list.size %] |
112 | 111 |
<tr> |
113 | 112 |
<th align="right">[% LxERP.t8("SEPA exports") %]</th> |
... | ... | |
119 | 118 |
</td> |
120 | 119 |
</tr> |
121 | 120 |
[%- END %] |
122 |
|
|
123 | 121 |
<tr> |
124 | 122 |
<th align="right" nowrap>[% 'Currency' | $T8 %]</th> |
125 |
<td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td> |
|
126 |
|
|
123 |
<td> |
|
124 |
[%- IF readonly %] |
|
125 |
[% HTML.escape(currency) %] |
|
126 |
[% L.hidden_tag("currency", currency) %] |
|
127 |
[%- ELSE %] |
|
128 |
[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %] |
|
129 |
[%- END %] |
|
130 |
</td> |
|
127 | 131 |
[% IF ( defaultcurrency && (currency != defaultcurrency) ) %] |
128 | 132 |
<th align=right>[% 'Exchangerate' | $T8 %]</th> |
129 |
[% IF ( forex ) %] |
|
130 |
<td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td> |
|
131 |
[% ELSE %] |
|
132 |
<td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td> |
|
133 |
[% END %] |
|
133 |
<td> |
|
134 |
[%- IF readonly %] |
|
135 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
136 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
137 |
[%- ELSE %] |
|
138 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
|
139 |
[%- END %] |
|
140 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
134 | 141 |
[% END %] |
135 |
|
|
136 | 142 |
</tr> |
137 | 143 |
|
138 | 144 |
[% IF ALL_DEPARTMENTS %] |
templates/webpages/ar/form_header.html | ||
---|---|---|
96 | 96 |
[%- END %] |
97 | 97 |
<tr> |
98 | 98 |
<th align=right>[% 'Currency' | $T8 %]</th> |
99 |
<td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td> |
|
99 |
<td> |
|
100 |
[%- IF readonly %] |
|
101 |
[% HTML.escape(currency) %] |
|
102 |
[% L.hidden_tag("currency", currency) %] |
|
103 |
[%- ELSE %] |
|
104 |
[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %] |
|
105 |
[%- END %] |
|
106 |
</td> |
|
100 | 107 |
[% L.hidden_tag('defaultcurrency', defaultcurrency) %] |
101 | 108 |
[% L.hidden_tag('fxgain_accno', fxgain_accno) %] |
102 | 109 |
[% L.hidden_tag('fxloss_accno', fxloss_accno) %] |
... | ... | |
104 | 111 |
[% L.hidden_tag('forex', forex) %] |
105 | 112 |
[% IF show_exch %] |
106 | 113 |
<th align=right>[% 'Exchangerate' | $T8 %]</th> |
107 |
<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> |
|
114 |
<td> |
|
115 |
[%- IF readonly %] |
|
116 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
117 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
118 |
[%- ELSE %] |
|
119 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
|
120 |
[%- END %] |
|
121 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
122 |
</td> |
|
108 | 123 |
[% END %] |
109 | 124 |
</tr> |
110 | 125 |
[% IF ALL_DEPARTMENTS %] |
templates/webpages/ir/form_header.html | ||
---|---|---|
121 | 121 |
[%- IF currencies %] |
122 | 122 |
<tr> |
123 | 123 |
<th align="right">[% 'Currency' | $T8 %]</th> |
124 |
<td>[% currencies %]</td> |
|
124 |
<td> |
|
125 |
[%- IF readonly %] |
|
126 |
[% HTML.escape(currency) %] |
|
127 |
[% L.hidden_tag("currency", currency) %] |
|
128 |
[%- ELSE %] |
|
129 |
[% currencies %] |
|
130 |
[%- END %] |
|
131 |
</td> |
|
125 | 132 |
</tr> |
126 | 133 |
[%- END %] |
127 | 134 |
<input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]"> |
... | ... | |
130 | 137 |
<tr> |
131 | 138 |
<th align="right">[% 'Exchangerate' | $T8 %]</th> |
132 | 139 |
<td> |
133 |
[%- IF forex %] |
|
134 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
140 |
[%- IF readonly %] |
|
141 |
[% LxERP.format_amount(exchangerate, 5) %] |
|
142 |
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %] |
|
135 | 143 |
[%- ELSE %] |
136 | 144 |
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]"> |
137 | 145 |
[%- END %] |
146 |
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
|
138 | 147 |
</td> |
139 | 148 |
</tr> |
140 | 149 |
[%- 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)