From: Sven Schöling Date: Fri, 18 Nov 2011 14:00:23 +0000 (+0100) Subject: CGI::Ajax aus ir/form_header entfernt. X-Git-Tag: release-2.7.0beta1~177 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4e5c422eec20f1827fcd36112ed010ce8232a919;p=kivitendo-erp.git CGI::Ajax aus ir/form_header entfernt. duedate auf jquery umgeschrieben. Die Funktion von (irreführend) set_duedate_vendor auf get_duedate_vendor umbenannt. --- diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 353b44453..cb3d3a5ad 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -274,10 +274,6 @@ sub form_header { $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); - my $set_duedate_url = "$form->{script}?action=set_duedate"; - - push @ { $form->{AJAX} }, new CGI::Ajax( 'set_duedate' => $set_duedate_url ); - my @old_project_ids = ($form->{"globalproject_id"}); map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"}; @@ -820,14 +816,15 @@ sub yes { $main::lxdebug->leave_sub(); } -sub set_duedate_vendor { - $main::lxdebug->enter_sub(); - - my $form = $main::form; +sub get_duedate_vendor { + $::lxdebug->enter_sub; - print $form->ajax_response_header(), IR->get_duedate('vendor_id' => $form->{vendor_id}, - 'invdate' => $form->{invdate}, - 'default' => $form->{old_duedate}); + my $result = IR->get_duedate( + vendor_id => $::form->{vendor_id}, + invdate => $::form->{invdate}, + default => $::form->{old_duedate}, + ); - $main::lxdebug->leave_sub(); + print $::form->ajax_response_header, $result; + $::lxdebug->leave_sub; } diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index b0ef7caba..d070b4d74 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -147,7 +147,7 @@ [% 'Credit Note Date' | $T8 %] - [% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL') %] + [% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL', onChange='set_duedate(this)') %] [%- ELSE %] @@ -156,7 +156,7 @@ [% 'Invoice Date' | $T8 %] - [% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL') %] + [% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL', onChange='set_duedate(this)') %] [% 'Due Date' | $T8 %] @@ -212,6 +212,18 @@ setupDateFormat('[% dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]'); setupPoints('[% numberformat %]', '[% 'wrongformat' | $T8 %]'); }); + function set_duedate() { + $.ajax({ + url: 'ir.pl?action=get_duedate_vendor', + data: { + invdate: $('#invdate').val(), + vendor_id: $('input[name="vendor_id"]').val(), + old_duedate: $('#duedate').val(), + }, + dataType: 'text', + success: function (data) { $('#duedate').val(data); } + }) + } //-->