Revision a2c920be
Von Jan Büren vor mehr als 2 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
# type=submit $locale->text('Add Accounts Payables Transaction')
|
||
# type=submit $locale->text('Edit Accounts Payables Transaction')
|
||
|
||
my $readonly = $form->{id} ? "readonly" : "";
|
||
|
||
$form->{radier} = ($::instance_conf->get_ap_changeable == 2)
|
||
? ($form->current_date(\%myconfig) eq $form->{gldate})
|
||
: ($::instance_conf->get_ap_changeable == 1);
|
||
$readonly = $form->{radier} ? "" : $readonly;
|
||
|
||
$form->{readonly} = $readonly;
|
||
|
||
# currencies
|
||
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
|
||
if ($form->{currency} ne $form->{defaultcurrency}) {
|
||
... | ... | |
if ($::form->{id} && SL::DB::Manager::ApGl->find_by(ap_id => $::form->{id})) {
|
||
$is_linked_gl_transaction = 1;
|
||
}
|
||
# add readonly state in $::form
|
||
$::form->{readonly} = !$may_edit_create ? 1
|
||
: $is_closed ? 1
|
||
: $is_storno ? 1
|
||
: $has_storno ? 1
|
||
: ($::form->{id} && $change_never) ? 1
|
||
: ($::form->{id} && $change_on_same_day_only) ? 1
|
||
: $is_linked_bank_transaction ? 1
|
||
: $has_sepa_exports ? 1
|
||
: 0;
|
||
|
||
my $create_post_action = sub {
|
||
# $_[0]: description
|
bin/mozilla/ar.pl | ||
---|---|---|
# $locale->text('Edit Accounts Receivables Transaction')
|
||
$form->{title} = $locale->text("$title Accounts Receivables Transaction");
|
||
|
||
$readonly = ($form->{id}) ? "readonly" : "";
|
||
|
||
$form->{radier} = ($::instance_conf->get_ar_changeable == 2)
|
||
? ($form->current_date(\%myconfig) eq $form->{gldate})
|
||
: ($::instance_conf->get_ar_changeable == 1);
|
||
$readonly = ($form->{radier}) ? "" : $readonly;
|
||
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
|
||
if ($form->{currency} ne $form->{defaultcurrency}) {
|
||
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, "buy", $form->{id}, 'ar');
|
||
... | ... | |
|
||
$is_linked_bank_transaction = 1;
|
||
}
|
||
# add readonly state in $::form
|
||
$::form->{readonly} = !$may_edit_create ? 1
|
||
: $is_closed ? 1
|
||
: $is_storno ? 1
|
||
: $has_storno ? 1
|
||
: ($::form->{id} && $change_never) ? 1
|
||
: ($::form->{id} && $change_on_same_day_only) ? 1
|
||
: $is_linked_bank_transaction ? 1
|
||
: 0;
|
||
for my $bar ($::request->layout->get('actionbar')) {
|
||
$bar->add(
|
||
action => [
|
bin/mozilla/ir.pl | ||
---|---|---|
}
|
||
|
||
sub setup_ir_action_bar {
|
||
my ($tmpl_var) = @_;
|
||
my $form = $::form;
|
||
my $change_never = $::instance_conf->get_ir_changeable == 0;
|
||
my $change_on_same_day_only = $::instance_conf->get_ir_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate});
|
||
... | ... | |
|
||
$is_linked_bank_transaction = 1;
|
||
}
|
||
# add readonly state in tmpl_vars
|
||
$tmpl_var->{readonly} = !$may_edit_create ? 1
|
||
: $form->{locked} ? 1
|
||
: $form->{storno} ? 1
|
||
: ($form->{id} && $change_never) ? 1
|
||
: ($form->{id} && $change_on_same_day_only) ? 1
|
||
: $is_linked_bank_transaction ? 1
|
||
: $has_sepa_exports ? 1
|
||
: 0;
|
||
|
||
my $create_post_action = sub {
|
||
# $_[0]: description
|
||
... | ... | |
: $form->{storno} ? t8('A canceled invoice cannot be posted.')
|
||
: ($form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.')
|
||
: ($form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.')
|
||
: $has_sepa_exports ? t8('This invoice has been linked with a sepa export, undo this first.')
|
||
: $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
|
||
: undef,
|
||
],
|
||
... | ... | |
|
||
$::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));
|
||
|
||
setup_ir_action_bar();
|
||
setup_ir_action_bar(\%TMPL_VAR);
|
||
|
||
$form->header();
|
||
|
bin/mozilla/is.pl | ||
---|---|---|
my $lr = $invoice_obj->linked_records(direction => 'from', from => ['Order']);
|
||
$is_invoice_for_advance_payment_from_order = scalar @$lr >= 1;
|
||
}
|
||
# add readonly state in tmpl_vars
|
||
$tmpl_var->{readonly} = !$may_edit_create ? 1
|
||
: $form->{locked} ? 1
|
||
: $form->{storno} ? 1
|
||
: ($form->{id} && $change_never) ? 1
|
||
: ($form->{id} && $change_on_same_day_only) ? 1
|
||
: $is_linked_bank_transaction ? 1
|
||
: 0;
|
||
|
||
for my $bar ($::request->layout->get('actionbar')) {
|
||
$bar->add(
|
templates/webpages/ap/form_header.html | ||
---|---|---|
<span class="plus[% creditremaining_plus %]">[% creditremaining | html %]</span>
|
||
</td>
|
||
</tr>
|
||
|
||
[%- IF invoice_obj.sepa_exports.as_list.size %]
|
||
<tr>
|
||
<th align="right">[% LxERP.t8("SEPA exports") %]</th>
|
||
... | ... | |
</td>
|
||
</tr>
|
||
[%- END %]
|
||
|
||
<tr>
|
||
<th align="right" nowrap>[% 'Currency' | $T8 %]</th>
|
||
<td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
|
||
|
||
<td>
|
||
[%- IF readonly %]
|
||
[% HTML.escape(currency) %]
|
||
[% L.hidden_tag("currency", currency) %]
|
||
[%- ELSE %]
|
||
[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]
|
||
[%- END %]
|
||
</td>
|
||
[% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
|
||
<th align=right>[% 'Exchangerate' | $T8 %]</th>
|
||
[% IF ( forex ) %]
|
||
<td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td>
|
||
[% ELSE %]
|
||
<td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td>
|
||
[% END %]
|
||
<td>
|
||
[%- IF readonly %]
|
||
[% LxERP.format_amount(exchangerate, 5) %]
|
||
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %]
|
||
[%- ELSE %]
|
||
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]">
|
||
[%- END %]
|
||
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %]
|
||
[% END %]
|
||
|
||
</tr>
|
||
|
||
[% IF ALL_DEPARTMENTS %]
|
templates/webpages/ar/form_header.html | ||
---|---|---|
[%- END %]
|
||
<tr>
|
||
<th align=right>[% 'Currency' | $T8 %]</th>
|
||
<td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
|
||
<td>
|
||
[%- IF readonly %]
|
||
[% HTML.escape(currency) %]
|
||
[% L.hidden_tag("currency", currency) %]
|
||
[%- ELSE %]
|
||
[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]
|
||
[%- END %]
|
||
</td>
|
||
[% L.hidden_tag('defaultcurrency', defaultcurrency) %]
|
||
[% L.hidden_tag('fxgain_accno', fxgain_accno) %]
|
||
[% L.hidden_tag('fxloss_accno', fxloss_accno) %]
|
||
... | ... | |
[% L.hidden_tag('forex', forex) %]
|
||
[% IF show_exch %]
|
||
<th align=right>[% 'Exchangerate' | $T8 %]</th>
|
||
<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>
|
||
<td>
|
||
[%- IF readonly %]
|
||
[% LxERP.format_amount(exchangerate, 5) %]
|
||
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %]
|
||
[%- ELSE %]
|
||
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]">
|
||
[%- END %]
|
||
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %]
|
||
</td>
|
||
[% END %]
|
||
</tr>
|
||
[% IF ALL_DEPARTMENTS %]
|
templates/webpages/ir/form_header.html | ||
---|---|---|
[%- IF currencies %]
|
||
<tr>
|
||
<th align="right">[% 'Currency' | $T8 %]</th>
|
||
<td>[% currencies %]</td>
|
||
<td>
|
||
[%- IF readonly %]
|
||
[% HTML.escape(currency) %]
|
||
[% L.hidden_tag("currency", currency) %]
|
||
[%- ELSE %]
|
||
[% currencies %]
|
||
[%- END %]
|
||
</td>
|
||
</tr>
|
||
[%- END %]
|
||
<input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]">
|
||
... | ... | |
<tr>
|
||
<th align="right">[% 'Exchangerate' | $T8 %]</th>
|
||
<td>
|
||
[%- IF forex %]
|
||
[% LxERP.format_amount(exchangerate, 5) %]
|
||
[%- IF readonly %]
|
||
[% LxERP.format_amount(exchangerate, 5) %]
|
||
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %]
|
||
[%- ELSE %]
|
||
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]">
|
||
[%- END %]
|
||
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %]
|
||
</td>
|
||
</tr>
|
||
[%- END %]
|
templates/webpages/is/form_header.html | ||
---|---|---|
[%- IF currencies %]
|
||
<tr>
|
||
<th align="right">[% 'Currency' | $T8 %]</th>
|
||
<td>[% currencies %]</td>
|
||
<td>
|
||
[%- IF readonly %]
|
||
[% HTML.escape(currency) %]
|
||
[% L.hidden_tag("currency", currency) %]
|
||
[%- ELSE %]
|
||
[% currencies %]
|
||
[%- END %]
|
||
</td>
|
||
</tr>
|
||
[%- END %]
|
||
<tr style='display:none'>
|
||
... | ... | |
<tr>
|
||
<th align="right">[% 'Exchangerate' | $T8 %]</th>
|
||
<td>
|
||
[%- IF forex %]
|
||
[% LxERP.format_amount(exchangerate, 5) %]
|
||
[%- IF readonly %]
|
||
[% LxERP.format_amount(exchangerate, 5) %]
|
||
[% L.hidden_tag("exchangerate", LxERP.format_amount(exchangerate, 5)) %]
|
||
[%- ELSE %]
|
||
<input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]">
|
||
[%- END %]
|
||
[% IF record_forex %][% 'record exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %]
|
||
</td>
|
||
</tr>
|
||
[%- 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)