X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fap.pl;h=18924979618cdc15c056fadb24d48b3102857b87;hb=9c2d49bb4dae241b4290afaeeb762d9c0e584301;hp=0d531cf825c021d66a3d602338d417db260aff8e;hpb=f01741e36a022e2bb7503abb23fbc0f46f27cd62;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 0d531cf82..189249796 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -37,6 +37,7 @@ use SL::PE; require "$form->{path}/arap.pl"; require "bin/mozilla/common.pl"; +require "bin/mozilla/drafts.pl"; 1; @@ -73,6 +74,8 @@ require "bin/mozilla/common.pl"; sub add { $lxdebug->enter_sub(); + return $lxdebug->leave_sub() if (load_draft_maybe()); + $form->{title} = "Add"; $form->{callback} = @@ -88,6 +91,9 @@ sub add { sub edit { $lxdebug->enter_sub(); + # show history button + $form->{javascript} = qq||; + #/show hhistory button $form->{title} = "Edit"; @@ -193,6 +199,7 @@ sub create_links { $form->{"forex_$j"} = $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate}; $form->{"AP_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}"; + $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id}; $form->{paidaccounts}++; } else { @@ -455,6 +462,8 @@ sub form_header { {locked}> +| . ($form->{saved_message} ? qq|

$form->{saved_message}

| : "") . qq| + @@ -637,14 +646,14 @@ $jsscript
$form->{title} - + |; if ($form->{currency} eq $form->{defaultcurrency}) { - @column_index = qw(datepaid source memo paid AP_paid); + @column_index = qw(datepaid source memo paid AP_paid paid_project_id); } else { - @column_index = qw(datepaid source memo paid exchangerate AP_paid); + @column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id); } $column_data{datepaid} = ""; @@ -653,6 +662,7 @@ $jsscript $column_data{AP_paid} = ""; $column_data{source} = ""; $column_data{memo} = ""; + $column_data{paid_project_id} = ""; print " @@ -708,6 +718,13 @@ $jsscript qq||; $column_data{"memo_$i"} = qq||; + $column_data{"paid_project_id_$i"} = + qq||; map { print qq|$column_data{"${_}_$i"}\n| } @column_index; @@ -740,10 +757,15 @@ sub form_footer { print qq| +{path}> {login}> {password}> +| +. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) +. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]) +. qq|
|; @@ -751,36 +773,45 @@ sub form_footer { $transdate = $form->datetonum($form->{transdate}, \%myconfig); $closedto = $form->datetonum($form->{closedto}, \%myconfig); + print qq||; + if ($form->{id}) { # print qq| # |; - if ($form->{radier}) { - print qq| + if ($form->{radier}) { + print qq| |; - } + } - print qq| + print qq| -|; - print qq| |; - } else { - if (($transdate > $closedto) && !$form->{id}) { - print qq| + } elsif (($transdate > $closedto) && !$form->{id}) { + print qq| |; - } + . $locale->text('Post') . qq|"> | . + NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), + '-class' => 'submit')); } - + # button for saving history + if($form->{id} ne "") { + print qq| + {id} + . qq|); name=history id=history value=| + . $locale->text('history') + . qq|>|; + } + # /button for saving history print " @@ -981,8 +1012,16 @@ sub post { $form->{id} = 0 if $form->{postasnew}; - $form->redirect($locale->text('Transaction posted!')) - if (AP->post_transaction(\%myconfig, \%$form)); + if (AP->post_transaction(\%myconfig, \%$form)) { + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "POSTED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + remove_draft() if $form->{remove_draft}; + $form->redirect($locale->text('Transaction posted!')); + } $form->error($locale->text('Cannot post transaction!')); $lxdebug->leave_sub(); @@ -992,6 +1031,12 @@ sub post_as_new { $lxdebug->enter_sub(); $form->{postasnew} = 1; + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "POSTED AS NEW"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &post; $lxdebug->leave_sub(); @@ -1049,9 +1094,15 @@ sub delete { sub yes { $lxdebug->enter_sub(); - - $form->redirect($locale->text('Transaction deleted!')) - if (AP->delete_transaction(\%myconfig, \%$form, $spool)); + if (AP->delete_transaction(\%myconfig, \%$form, $spool)) { + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->redirect($locale->text('Transaction deleted!')); + } $form->error($locale->text('Cannot delete transaction!')); $lxdebug->leave_sub();
| . $locale->text('Payments') . qq|| . $locale->text('Payments') . qq|
" . $locale->text('Date') . "" . $locale->text('Account') . "" . $locale->text('Source') . "" . $locale->text('Memo') . "" . $locale->text('Project Number') . "
| + . NTI($cgi->popup_menu('-name' => "paid_project_id_$i", + '-values' => \@project_values, + '-labels' => \%project_labels, + '-default' => $form->{"paid_project_id_$i"} )) + . qq|