Revision 4e5c422e
Von Sven Schöling vor fast 13 Jahren hinzugefügt
bin/mozilla/ir.pl | ||
---|---|---|
274 | 274 |
|
275 | 275 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
276 | 276 |
|
277 |
my $set_duedate_url = "$form->{script}?action=set_duedate"; |
|
278 |
|
|
279 |
push @ { $form->{AJAX} }, new CGI::Ajax( 'set_duedate' => $set_duedate_url ); |
|
280 |
|
|
281 | 277 |
my @old_project_ids = ($form->{"globalproject_id"}); |
282 | 278 |
map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"}; |
283 | 279 |
|
... | ... | |
820 | 816 |
$main::lxdebug->leave_sub(); |
821 | 817 |
} |
822 | 818 |
|
823 |
sub set_duedate_vendor { |
|
824 |
$main::lxdebug->enter_sub(); |
|
825 |
|
|
826 |
my $form = $main::form; |
|
819 |
sub get_duedate_vendor { |
|
820 |
$::lxdebug->enter_sub; |
|
827 | 821 |
|
828 |
print $form->ajax_response_header(), IR->get_duedate('vendor_id' => $form->{vendor_id}, |
|
829 |
'invdate' => $form->{invdate}, |
|
830 |
'default' => $form->{old_duedate}); |
|
822 |
my $result = IR->get_duedate( |
|
823 |
vendor_id => $::form->{vendor_id}, |
|
824 |
invdate => $::form->{invdate}, |
|
825 |
default => $::form->{old_duedate}, |
|
826 |
); |
|
831 | 827 |
|
832 |
$main::lxdebug->leave_sub(); |
|
828 |
print $::form->ajax_response_header, $result; |
|
829 |
$::lxdebug->leave_sub; |
|
833 | 830 |
} |
templates/webpages/ir/form_header.html | ||
---|---|---|
147 | 147 |
</tr> |
148 | 148 |
<tr> |
149 | 149 |
<th align="right">[% 'Credit Note Date' | $T8 %]</th> |
150 |
<td>[% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL') %]</td> |
|
150 |
<td>[% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL', onChange='set_duedate(this)') %]</td>
|
|
151 | 151 |
</tr> |
152 | 152 |
[%- ELSE %] |
153 | 153 |
<tr> |
... | ... | |
156 | 156 |
</tr> |
157 | 157 |
<tr> |
158 | 158 |
<th align="right">[% 'Invoice Date' | $T8 %]</th> |
159 |
<td>[% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL') %]</td> |
|
159 |
<td>[% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL', onChange='set_duedate(this)') %]</td>
|
|
160 | 160 |
</tr> |
161 | 161 |
<tr> |
162 | 162 |
<th align="right">[% 'Due Date' | $T8 %]</th> |
... | ... | |
212 | 212 |
setupDateFormat('[% dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]'); |
213 | 213 |
setupPoints('[% numberformat %]', '[% 'wrongformat' | $T8 %]'); |
214 | 214 |
}); |
215 |
function set_duedate() { |
|
216 |
$.ajax({ |
|
217 |
url: 'ir.pl?action=get_duedate_vendor', |
|
218 |
data: { |
|
219 |
invdate: $('#invdate').val(), |
|
220 |
vendor_id: $('input[name="vendor_id"]').val(), |
|
221 |
old_duedate: $('#duedate').val(), |
|
222 |
}, |
|
223 |
dataType: 'text', |
|
224 |
success: function (data) { $('#duedate').val(data); } |
|
225 |
}) |
|
226 |
} |
|
215 | 227 |
//--> |
216 | 228 |
</script> |
217 | 229 |
|
Auch abrufbar als: Unified diff
CGI::Ajax aus ir/form_header entfernt.
duedate auf jquery umgeschrieben. Die Funktion von (irreführend)
set_duedate_vendor auf get_duedate_vendor umbenannt.