X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=137243877fcc6116fde8c2ea67963011a5412d11;hb=6ebad56e58db857141565f397c555524cba43109;hp=c28656795682d5ac501c385dbf4e8fd8b46d66ca;hpb=44e1ec6fcc2422cb75d36578245e16a33acef2d8;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index c28656795..137243877 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -3244,3 +3244,99 @@ sub delete_tax { $lxdebug->leave_sub(); } + +sub add_price_factor { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text('Add Price Factor'); + $form->{callback} ||= build_std_url('action=add_price_factor'); + $form->{fokus} = 'description'; + + $form->header(); + print $form->parse_html_template2('am/edit_price_factor'); + + $lxdebug->leave_sub(); +} + +sub edit_price_factor { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text('Edit Price Factor'); + $form->{callback} ||= build_std_url('action=add_price_factor'); + $form->{fokus} = 'description'; + + AM->get_price_factor(\%myconfig, $form); + + $form->{factor} = $form->format_amount(\%myconfig, $form->{factor} * 1); + + $form->header(); + print $form->parse_html_template2('am/edit_price_factor'); + + $lxdebug->leave_sub(); +} + +sub list_price_factors { + $lxdebug->enter_sub(); + + AM->get_all_price_factors(\%myconfig, \%$form); + + my $previous; + foreach my $current (@{ $form->{PRICE_FACTORS} }) { + if ($previous) { + $previous->{next_id} = $current->{id}; + $current->{previous_id} = $previous->{id}; + } + + $current->{factor} = $form->format_amount(\%myconfig, $current->{factor} * 1); + + $previous = $current; + } + + $form->{callback} = build_std_url('action=list_price_factors'); + $form->{title} = $locale->text('Price Factors'); + $form->{url_base} = build_std_url('callback'); + + $form->header(); + print $form->parse_html_template2('am/list_price_factors'); + + $lxdebug->leave_sub(); +} + +sub save_price_factor { + $lxdebug->enter_sub(); + + $form->isblank("description", $locale->text('Description missing!')); + $form->isblank("factor", $locale->text('Factor missing!')); + + $form->{factor} = $form->parse_amount(\%myconfig, $form->{factor}); + + AM->save_price_factor(\%myconfig, $form); + + $form->{callback} .= '&MESSAGE=' . $form->escape($locale->text('Price factor saved!')) if ($form->{callback}); + + $form->redirect($locale->text('Price factor saved!')); + + $lxdebug->leave_sub(); +} + +sub delete_price_factor { + $lxdebug->enter_sub(); + + AM->delete_price_factor(\%myconfig, \%$form); + + $form->{callback} .= '&MESSAGE=' . $form->escape($locale->text('Price factor deleted!')) if ($form->{callback}); + + $form->redirect($locale->text('Price factor deleted!')); + + $lxdebug->leave_sub(); +} + +sub swap_price_factors { + $lxdebug->enter_sub(); + + AM->swap_sortkeys(\%myconfig, $form, 'price_factors'); + list_price_factors(); + + $lxdebug->leave_sub(); +} +