Revision 4507456b
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
316 | 316 |
|
317 | 317 |
AP->setup_form($form); |
318 | 318 |
|
319 |
$form->{locked} = |
|
320 |
($form->datetonum($form->{transdate}, \%myconfig) <= |
|
321 |
$form->datetonum($form->{closedto}, \%myconfig)); |
|
322 |
|
|
323 | 319 |
$main::lxdebug->leave_sub(); |
324 | 320 |
} |
325 | 321 |
|
... | ... | |
436 | 432 |
my $follow_up_vc = $form->{vendor_id} ? SL::DB::Vendor->load_cached($form->{vendor_id})->name : ''; |
437 | 433 |
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; |
438 | 434 |
|
439 |
$::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.RecordTemplate.js", "kivi.File.js"); |
|
435 |
$::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.RecordTemplate.js", "kivi.File.js", "kivi.AP.js");
|
|
440 | 436 |
my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; |
441 | 437 |
my $first_taxchart; |
442 | 438 |
|
439 |
setup_ap_display_form_action_bar(); |
|
440 |
|
|
443 | 441 |
$form->header(); |
444 | 442 |
|
445 | 443 |
for my $i (1 .. $form->{rowcount}) { |
... | ... | |
568 | 566 |
print $::form->parse_html_template('ap/form_footer', { |
569 | 567 |
num_due => $num_due, |
570 | 568 |
num_follow_ups => $num_follow_ups, |
571 |
show_post_draft => ($transdate > $closedto) && !$::form->{id}, |
|
572 |
show_storno => $storno, |
|
573 | 569 |
}); |
574 | 570 |
|
575 | 571 |
$::lxdebug->leave_sub; |
... | ... | |
861 | 857 |
|
862 | 858 |
$main::auth->assert('ap_transactions'); |
863 | 859 |
|
864 |
map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
|
|
860 |
map { delete $form->{$_} } qw(printed emailed queued invnumber deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); |
|
865 | 861 |
$form->{paidaccounts} = 1; |
866 | 862 |
$form->{rowcount}--; |
867 |
$form->{invdate} = $form->current_date(\%myconfig); |
|
868 |
&update; |
|
869 |
|
|
870 |
$main::lxdebug->leave_sub(); |
|
871 |
} |
|
872 |
|
|
873 |
sub delete { |
|
874 |
$main::lxdebug->enter_sub(); |
|
875 |
|
|
876 |
my $form = $main::form; |
|
877 |
my $locale = $main::locale; |
|
878 | 863 |
|
879 |
$main::auth->assert('ap_transactions'); |
|
880 |
|
|
881 |
$form->{title} = $locale->text('Confirm!'); |
|
882 |
|
|
883 |
$form->header; |
|
864 |
my $today = DateTime->today_local; |
|
865 |
$form->{transdate} = $today->to_kivitendo; |
|
866 |
$form->{duedate} = $form->{transdate}; |
|
884 | 867 |
|
885 |
delete $form->{header}; |
|
886 |
|
|
887 |
print qq| |
|
888 |
<form method=post action=$form->{script}> |
|
889 |
|; |
|
890 |
|
|
891 |
foreach my $key (keys %$form) { |
|
892 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
|
893 |
$form->{$key} =~ s/\"/"/g; |
|
894 |
print qq|<input type=hidden name=$key value="$form->{$key}">\n|; |
|
868 |
if ($form->{vendor_id}) { |
|
869 |
my $payment_terms = SL::DB::Vendor->load_cached($form->{vendor_id})->payment; |
|
870 |
$form->{duedate} = $payment_terms->calc_date(reference_date => $today)->to_kivitendo if $payment_terms; |
|
895 | 871 |
} |
896 | 872 |
|
897 |
print qq| |
|
898 |
<h2 class=confirm>$form->{title}</h2> |
|
899 |
|
|
900 |
<h4>| |
|
901 |
. $locale->text('Are you sure you want to delete Transaction') |
|
902 |
. qq| $form->{invnumber}</h4> |
|
903 |
|
|
904 |
<input name=action class=submit type=submit value="| |
|
905 |
. $locale->text('Yes') . qq|"> |
|
906 |
</form> |
|
907 |
|; |
|
873 |
&update; |
|
908 | 874 |
|
909 | 875 |
$main::lxdebug->leave_sub(); |
910 | 876 |
} |
911 | 877 |
|
912 |
sub yes { |
|
913 |
$main::lxdebug->enter_sub(); |
|
914 |
|
|
878 |
sub delete { |
|
915 | 879 |
my $form = $main::form; |
916 | 880 |
my %myconfig = %main::myconfig; |
917 | 881 |
my $locale = $main::locale; |
... | ... | |
930 | 894 |
$form->redirect($locale->text('Transaction deleted!')); |
931 | 895 |
} |
932 | 896 |
$form->error($locale->text('Cannot delete transaction!')); |
933 |
|
|
934 |
$main::lxdebug->leave_sub(); |
|
935 | 897 |
} |
936 | 898 |
|
937 | 899 |
sub search { |
... | ... | |
1180 | 1142 |
|
1181 | 1143 |
$main::lxdebug->leave_sub(); |
1182 | 1144 |
} |
1145 |
|
|
1146 |
sub setup_ap_display_form_action_bar { |
|
1147 |
my $transdate = $::form->datetonum($::form->{transdate}, \%::myconfig); |
|
1148 |
my $closedto = $::form->datetonum($::form->{closedto}, \%::myconfig); |
|
1149 |
my $is_closed = $transdate <= $closedto; |
|
1150 |
|
|
1151 |
my $change_never = $::instance_conf->get_ar_changeable == 0; |
|
1152 |
my $change_on_same_day_only = $::instance_conf->get_ar_changeable == 2 && ($::form->current_date(\%::myconfig) ne $::form->{gldate}); |
|
1153 |
|
|
1154 |
my $is_storno = IS->is_storno(\%::myconfig, $::form, 'ap', $::form->{id}); |
|
1155 |
my $has_storno = IS->has_storno(\%::myconfig, $::form, 'ap'); |
|
1156 |
|
|
1157 |
for my $bar ($::request->layout->get('actionbar')) { |
|
1158 |
$bar->add( |
|
1159 |
action => [ |
|
1160 |
t8('Update'), |
|
1161 |
submit => [ '#form', { action => "update" } ], |
|
1162 |
id => 'update_button', |
|
1163 |
accesskey => 'enter', |
|
1164 |
], |
|
1165 |
|
|
1166 |
combobox => [ |
|
1167 |
action => [ |
|
1168 |
t8('Post'), |
|
1169 |
submit => [ '#form', { action => "post" } ], |
|
1170 |
checks => [ 'kivi.AP.check_fields_before_posting' ], |
|
1171 |
disabled => $is_closed ? t8('The billing period has already been locked.') |
|
1172 |
: $is_storno ? t8('A canceled invoice cannot be posted.') |
|
1173 |
: ($::form->{id} && $change_never) ? t8('Changing invoices has been disabled in the configuration.') |
|
1174 |
: ($::form->{id} && $change_on_same_day_only) ? t8('Invoices can only be changed on the day they are posted.') |
|
1175 |
: undef, |
|
1176 |
], |
|
1177 |
action => [ |
|
1178 |
t8('Post Payment'), |
|
1179 |
submit => [ '#form', { action => "post_payment" } ], |
|
1180 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') : undef, |
|
1181 |
], |
|
1182 |
action => [ t8('Mark as paid'), |
|
1183 |
submit => [ '#form', { action => "mark_as_paid" } ], |
|
1184 |
confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'), |
|
1185 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') : undef, |
|
1186 |
only_if => $::instance_conf->get_is_show_mark_as_paid, |
|
1187 |
], |
|
1188 |
], # end of combobox "Post" |
|
1189 |
|
|
1190 |
combobox => [ |
|
1191 |
action => [ t8('Storno'), |
|
1192 |
submit => [ '#form', { action => "storno" } ], |
|
1193 |
checks => [ 'kivi.AP.check_fields_before_posting' ], |
|
1194 |
confirm => t8('Do you really want to cancel this invoice?'), |
|
1195 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') |
|
1196 |
: $has_storno ? t8('This invoice has been canceled already.') |
|
1197 |
: $is_storno ? t8('Reversal invoices cannot be canceled.') |
|
1198 |
: $::form->{totalpaid} ? t8('Invoices with payments cannot be canceled.') |
|
1199 |
: undef, |
|
1200 |
], |
|
1201 |
action => [ t8('Delete'), |
|
1202 |
submit => [ '#form', { action => "delete" } ], |
|
1203 |
confirm => t8('Do you really want to delete this object?'), |
|
1204 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') |
|
1205 |
: $change_never ? t8('Changing invoices has been disabled in the configuration.') |
|
1206 |
: $change_on_same_day_only ? t8('Invoices can only be changed on the day they are posted.') |
|
1207 |
: $has_storno ? t8('This invoice has been canceled already.') |
|
1208 |
: $is_closed ? t8('The billing period has already been locked.') |
|
1209 |
: undef, |
|
1210 |
], |
|
1211 |
], # end of combobox "Storno" |
|
1212 |
|
|
1213 |
'separator', |
|
1214 |
|
|
1215 |
combobox => [ |
|
1216 |
action => [ t8('Workflow') ], |
|
1217 |
action => [ |
|
1218 |
t8('Use As New'), |
|
1219 |
submit => [ '#form', { action => "use_as_new" } ], |
|
1220 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') : undef, |
|
1221 |
], |
|
1222 |
], # end of combobox "Workflow" |
|
1223 |
|
|
1224 |
combobox => [ |
|
1225 |
action => [ t8('more') ], |
|
1226 |
action => [ |
|
1227 |
t8('History'), |
|
1228 |
call => [ 'set_history_window', $::form->{id} * 1, 'glid' ], |
|
1229 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') : undef, |
|
1230 |
], |
|
1231 |
action => [ |
|
1232 |
t8('Follow-Up'), |
|
1233 |
call => [ 'follow_up_window' ], |
|
1234 |
disabled => !$::form->{id} ? t8('This invoice has not been posted yet.') : undef, |
|
1235 |
], |
|
1236 |
action => [ |
|
1237 |
t8('Record templates'), |
|
1238 |
call => [ 'kivi.RecordTemplate.popup', 'ap_transaction' ], |
|
1239 |
], |
|
1240 |
action => [ |
|
1241 |
t8('Drafts'), |
|
1242 |
call => [ 'kivi.Draft.popup', 'ap', 'invoice', $::form->{draft_id}, $::form->{draft_description} ], |
|
1243 |
disabled => $::form->{id} ? t8('This invoice has already been posted.') |
|
1244 |
: $is_closed ? t8('The billing period has already been locked.') |
|
1245 |
: undef, |
|
1246 |
], |
|
1247 |
], # end of combobox "more" |
|
1248 |
); |
|
1249 |
} |
|
1250 |
} |
js/kivi.AP.js | ||
---|---|---|
1 |
namespace('kivi.AP', function(ns){ |
|
2 |
'use strict'; |
|
3 |
|
|
4 |
ns.check_fields_before_posting = function() { |
|
5 |
var errors = []; |
|
6 |
|
|
7 |
if ($('#transdate').val() === '') |
|
8 |
errors.push(kivi.t8('Invoice Date missing!')); |
|
9 |
|
|
10 |
if ($('#duedate').val() === '') |
|
11 |
errors.push(kivi.t8('Due Date missing!')); |
|
12 |
|
|
13 |
if ($('#invnumber').val() === '') |
|
14 |
errors.push(kivi.t8('Invoice Number missing!')); |
|
15 |
|
|
16 |
if ($('#vendor').val() === '') |
|
17 |
errors.push(kivi.t8('Vendor missing!')); |
|
18 |
|
|
19 |
if (errors.length === 0) |
|
20 |
return true; |
|
21 |
|
|
22 |
alert(errors.join(' ')); |
|
23 |
|
|
24 |
return false; |
|
25 |
}; |
|
26 |
}); |
js/locale/de.js | ||
---|---|---|
64 | 64 |
"If you switch to a different tab without saving you will lose the data you've entered in the current tab.":"Wenn Sie auf einen anderen Tab wechseln, ohne vorher zu speichern, so gehen die im aktuellen Tab eingegebenen Daten verloren.", |
65 | 65 |
"Import documents from #1":"Importiere Dateien von Quelle '#1'", |
66 | 66 |
"Invoice Date missing!":"Rechnungsdatum fehlt!", |
67 |
"Invoice Number missing!":"Rechnungsnummer fehlt!", |
|
67 | 68 |
"Map":"Karte", |
68 | 69 |
"More than one file selected, please set only one checkbox!":"Mehr als ein Element selektiert, bitte nur eine Box anklicken", |
69 | 70 |
"No":"Nein", |
... | ... | |
123 | 124 |
"Transaction description":"Vorgangsbezeichnung", |
124 | 125 |
"Update":"Erneuern", |
125 | 126 |
"Update quotation/order":"Auftrag/Angebot aktualisieren", |
127 |
"Vendor missing!":"Lieferant fehlt!", |
|
126 | 128 |
"Version actions":"Aktionen für Versionen", |
127 | 129 |
"Yes":"Ja", |
128 | 130 |
"filename has not uploadable characters ":"Bitte Dateinamen ändern. Er hat für den Upload nicht verwendbare Sonderzeichen ", |
locale/de/all | ||
---|---|---|
300 | 300 |
'Ar aging on %s' => 'Offene Forderungen zum %s', |
301 | 301 |
'Are you sure to generate cb/ob transactions?' => 'Sollen die EB/SB Buchungen wirklich erzeugt werden?', |
302 | 302 |
'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:', |
303 |
'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?', |
|
304 | 303 |
'Are you sure you want to delete this background job?' => 'Sind Sie sicher, dass Sie diesen Hintergrund-Job löschen möchten?', |
305 | 304 |
'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?', |
306 | 305 |
'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?', |
... | ... | |
3691 | 3690 |
'generated Files' => 'Erzeugte Dokumente', |
3692 | 3691 |
'gobd-#1-#2.zip' => 'gobd-#1-#2.zip', |
3693 | 3692 |
'h' => 'h', |
3694 |
'history' => 'Historie', |
|
3695 | 3693 |
'history search engine' => 'Historien Suchmaschine', |
3696 | 3694 |
'imported' => 'Importiert', |
3697 | 3695 |
'inactive' => 'inaktiv', |
templates/webpages/ap/form_footer.html | ||
---|---|---|
11 | 11 |
<input name=gldate type=hidden value="[% gldate | html %]"> |
12 | 12 |
[% P.hidden_tag('draft_id', draft_id) %] |
13 | 13 |
[% P.hidden_tag('draft_description', draft_description) %] |
14 |
|
|
15 |
<br> |
|
16 |
|
|
17 |
<input class="submit" type="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]"> |
|
18 |
|
|
19 |
[%- IF id %] |
|
20 |
[%- IF radier %] |
|
21 |
<input class=submit type=submit name=action value="[% 'Post' | $T8 %]"> |
|
22 |
<input class=submit type=submit name=action value="[% 'Delete' | $T8 %]"> |
|
23 |
[%- END %] |
|
24 |
|
|
25 |
[%- IF show_storno %] |
|
26 |
<input class=submit type=submit name=action value="[% 'Storno' | $T8 %]"> |
|
27 |
[%- END %] |
|
28 |
|
|
29 |
<input class=submit type=submit name=action value="[% 'Post Payment' | $T8 %]"> |
|
30 |
<input class=submit type=submit name=action value="[% 'Use As New' | $T8 %]"> |
|
31 |
<input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]"> |
|
32 |
|
|
33 |
[%- ELSIF show_post_draft %] |
|
34 |
<input class=submit type=submit name=action value="[% 'Post' | $T8 %]"> |
|
35 |
[% L.button_tag('kivi.Draft.popup("ap", "invoice", "' _ draft_id _ '", "' _ draft_description _ '")', LxERP.t8('Drafts')) %] |
|
36 |
[%- END %] |
|
37 |
|
|
38 |
[%- IF id %] |
|
39 |
<input type=button class=submit onclick="set_history_window([% id %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]"> |
|
40 |
[% IF INSTANCE_CONF.get_ap_show_mark_as_paid %] |
|
41 |
[% L.submit_tag("action", LxERP.t8('Mark as paid'), confirm=LxERP.t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?')) %] |
|
42 |
[% END %] |
|
43 |
[%- END %] |
|
44 |
|
|
45 |
[% L.button_tag("kivi.RecordTemplate.popup('ap_transaction')", LxERP.t8("Record templates")) %] |
|
46 | 14 |
</form> |
47 | 15 |
|
48 | 16 |
<script type="text/javascript"> |
templates/webpages/ap/form_header.html | ||
---|---|---|
146 | 146 |
<table> |
147 | 147 |
<tr> |
148 | 148 |
<th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th> |
149 |
<td><input name="invnumber" size="11" value="[% invnumber | html %]" [% readonly %]></td>
|
|
149 |
<td>[% L.input_tag("invnumber", invnumber, size="11", readonly=readonly) %]</td>
|
|
150 | 150 |
</tr> |
151 | 151 |
<tr> |
152 | 152 |
<th align="right" nowrap>[% 'Order Number' | $T8 %]</th> |
153 |
<td><input name="ordnumber" size="11" value="[% ordnumber | html %]" [% readonly %]></td>
|
|
153 |
<td>[% L.input_tag("ordnumber", ordnumber, size="11", readonly=readonly) %]</td>
|
|
154 | 154 |
</tr> |
155 | 155 |
<tr> |
156 | 156 |
<th align="right" nowrap>[% 'Invoice Date' | $T8 %]</th> |
Auch abrufbar als: Unified diff
ActionBar: Verwendung in Kreditorenbuchungen