X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcommon.pl;h=8cbdac75c6c6f4fb44705525edf9bbecaefa0902;hb=08e48f66590f580cbe2c8e3df76883d88b4c0fef;hp=f03911c32c153bea5f2358c65a2381b231784181;hpb=4fd7458e0476bd39dae6ea687125278105e09746;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index f03911c32..8cbdac75c 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -10,15 +10,21 @@ ###################################################################### use SL::Common; -use SL::DBUtils; +use SL::DB::Helper::Mappings; +use SL::DB; +use SL::DBUtils qw(do_query); use SL::Form; -use SL::MoreCommon; +use SL::MoreCommon qw(restore_form save_form); + +use strict; sub build_std_url { - $lxdebug->enter_sub(2); + $main::lxdebug->enter_sub(2); - my $script = $form->{script}; + my $form = $main::form; + my $script = $form->{script}; + my $fragment; my @parts; foreach my $key (@_) { @@ -27,6 +33,10 @@ sub build_std_url { if ($key =~ /(.*?)=(.*)/) { if ($1 eq 'script') { $script = $2; + + } elsif ($1 eq 'fragment') { + $fragment = $2; + } else { push @parts, $key; } @@ -38,167 +48,34 @@ sub build_std_url { } } - my $url = "${script}?" . join('&', @parts); + my $url = "${script}?" . join('&', @parts) . (defined $fragment ? "#$fragment" : ''); - $lxdebug->leave_sub(2); + $main::lxdebug->leave_sub(2); return $url; } # ------------------------------------------------------------------------- -sub select_part { - $lxdebug->enter_sub(); - - my ($callback_sub, @parts) = @_; - - my $remap_parts_id = 0; - if (defined($parts[0]->{parts_id}) && !defined($parts[0]->{id})) { - $remap_parts_id = 1; - map { $_->{id} = $_->{parts_id}; } @parts; - } - - my $remap_partnumber = 0; - if (defined($parts[0]->{partnumber}) && !defined($parts[0]->{number})) { - $remap_partnumber = 1; - map { $_->{number} = $_->{partnumber}; } @parts; - } - - my $has_charge = 0; - if (defined($parts[0]->{chargenumber})) { - $has_charge = 1; - map { $_->{has_charge} = 1; } @parts; - } - my $has_ean = 0; - if (defined($parts[0]->{ean})) { - $has_ean = 1; - map { $_->{has_ean} = 1; } @parts; - } - - my $old_form = save_form(); - - $form->header(); - print $form->parse_html_template("generic/select_part", - { "PARTS" => \@parts, - "old_form" => $old_form, - "title" => $locale->text("Select a part"), - "nextsub" => "select_part_internal", - "callback_sub" => $callback_sub, - "has_charge" => $has_charge, - "has_ean" => $has_ean, - "remap_parts_id" => $remap_parts_id, - "remap_partnumber" => $remap_partnumber }); - - $lxdebug->leave_sub(); -} - -sub select_part_internal { - $lxdebug->enter_sub(); - - my ($new_item, $callback_sub); - - my $re = "^new_.*_$form->{selection}\$"; - - foreach (grep /$re/, keys %{ $form }) { - my $new_key = $_; - $new_key =~ s/^new_//; - $new_key =~ s/_\d+$//; - $new_item->{$new_key} = $form->{$_}; - } - - if ($form->{remap_parts_id}) { - $new_item->{parts_id} = $new_item->{id}; - delete $new_item->{id}; - } - - if ($form->{remap_partnumber}) { - $new_item->{partnumber} = $new_item->{number}; - delete $new_item->{number}; - } - - my $callback_sub = $form->{callback_sub}; - - restore_form($form->{old_form}); - - call_sub($callback_sub, $new_item); - - $lxdebug->leave_sub(); -} - -sub part_selection_internal { - $lxdebug->enter_sub(); - - $order_by = "description"; - $order_by = $form->{"order_by"} if (defined($form->{"order_by"})); - $order_dir = 1; - $order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"})); - - my %options; - - foreach my $opt (split m/:/, $form->{options}) { - if ($opt =~ /=/) { - my ($key, $value) = split m/=/, $opt, 2; - $options{$key} = $value; - - } else { - $options{$opt} = 1; - } - } - - map { $form->{$_} = $options{$_} if ($options{$_}) } qw(no_services no_assemblies assemblies click_button); - - $parts = Common->retrieve_parts(\%myconfig, $form, $order_by, $order_dir); - - if (0 == scalar(@{$parts})) { - $form->show_generic_information($locale->text("No part was found matching the search parameters.")); - } elsif (1 == scalar(@{$parts})) { - $onload = "part_selected('1')"; - } - - map { $parts->[$_]->{selected} = $_ ? 0 : 1; } (0..$#{$parts}); - - my $callback = build_std_url('action=part_selection_internal', qw(partnumber description input_partnumber input_description input_partsid), - grep({ /^[fl]_/ } keys %{ $form })); - - my @header_sort = qw(partnumber description); - my %header_title = ( "partnumber" => $locale->text("Part Number"), - "description" => $locale->text("Part description"), - ); - - my @header = - map(+{ "column_title" => $header_title{$_}, - "column" => $_, - "callback" => $callback . "order_by=${_}&order_dir=" . ($order_by eq $_ ? 1 - $order_dir : $order_dir), - }, - @header_sort); - - $form->{formname} ||= 'Form'; - - $form->{title} = $locale->text("Select a part"); - $form->header(); - print $form->parse_html_template("generic/part_selection", { "HEADER" => \@header, - "PARTS" => $parts, - "onload" => $onload }); - - $lxdebug->leave_sub(); -} - -# ------------------------------------------------------------------------- - sub delivery_customer_selection { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $order_by = "name"; + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my $order_by = "name"; $order_by = $form->{"order_by"} if (defined($form->{"order_by"})); - $order_dir = 1; + my $order_dir = 1; $order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"})); - $delivery = Common->retrieve_delivery_customer(\%myconfig, $form, $order_by, $order_dir); + my $delivery = Common->retrieve_delivery_customer(\%myconfig, $form, $order_by, $order_dir); map({ $delivery->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$delivery})); + if (0 == scalar(@{$delivery})) { $form->show_generic_information($locale->text("No Customer was found matching the search parameters.")); } elsif (1 == scalar(@{$delivery})) { - $onload = "customer_selected('1')"; + $::request->{layout}->add_javascripts_inline("customer_selected('1')"); } my $callback = "$form->{script}?action=delivery_customer_selection&"; @@ -219,30 +96,34 @@ sub delivery_customer_selection { @header_sort); $form->{"title"} = $locale->text("Select a Customer"); - $form->header(); + $form->header(no_layout => 1); print $form->parse_html_template("generic/select_delivery_customer", { "HEADER" => \@header, - "DELIVERY" => $delivery, - "onload" => $onload }); + "DELIVERY" => $delivery, }); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- sub vendor_selection { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; - $order_by = "name"; + my $order_by = "name"; $order_by = $form->{"order_by"} if (defined($form->{"order_by"})); - $order_dir = 1; + my $order_dir = 1; $order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"})); - $vendor = Common->retrieve_vendor(\%myconfig, $form, $order_by, $order_dir); + my $vendor = Common->retrieve_vendor(\%myconfig, $form, $order_by, $order_dir); map({ $vendor->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$vendor})); + if (0 == scalar(@{$vendor})) { $form->show_generic_information($locale->text("No Vendor was found matching the search parameters.")); } elsif (1 == scalar(@{$vendor})) { - $onload = "vendor_selected('1')"; + $::request->{layout}->add_javascripts_inline("vendor_selected('1')"); } my $callback = "$form->{script}?action=vendor_selection&"; @@ -263,24 +144,27 @@ sub vendor_selection { @header_sort); $form->{"title"} = $locale->text("Select a Customer"); - $form->header(); + $form->header(no_layout => 1); print $form->parse_html_template("generic/select_vendor", { "HEADER" => \@header, - "VENDOR" => $vendor, - "onload" => $onload }); + "VENDOR" => $vendor, }); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- sub calculate_qty { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; $form->{formel} =~ s/\r\n//g; my ($variable_string, $formel) = split /###/,$form->{formel}; + my @variable; - foreach $item (split m/;/, $variable_string) { + foreach my $item (split m/;/, $variable_string) { next unless $item =~ m/^ \s* (\w+) \s* = \s* (\w+) \s* (\w+) \s* $/x; push @variable, { description => $1, @@ -301,39 +185,25 @@ sub calculate_qty { }, @header_sort; $form->{formel} = $formel; - $form->{title} = $locale->text("Please enter values"); - $form->header(); - print $form->parse_html_template("generic/calculate_qty", { "HEADER" => \@header, - "VARIABLES" => \@variable, - "onload" => $onload }); + my $html = $form->parse_html_template("generic/calculate_qty", { "HEADER" => \@header, + "VARIABLES" => \@variable, }); + print $::form->ajax_response_header, $html; - $lxdebug->leave_sub(); -} - -# ------------------------------------------------------------------------- - -sub set_longdescription { - $lxdebug->enter_sub(); - - $form->{title} = $locale->text("Enter longdescription"); - $form->header(); - print $form->parse_html_template("generic/set_longdescription"); - - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- sub H { - return $locale->quote_special_chars('HTML', $_[0]); + return $main::locale->quote_special_chars('HTML', $_[0]); } sub Q { - return $locale->quote_special_chars('URL@HTML', $_[0]); + return $main::locale->quote_special_chars('URL@HTML', $_[0]); } sub E { - return $form->escape($_[0]); + return $main::form->escape($_[0]); } sub NTI { @@ -344,123 +214,61 @@ sub NTI { } sub format_dates { - $lxdebug->enter_sub(); - - my ($dateformat, $longformat, @indices) = @_; - - $dateformat = $myconfig{"dateformat"} unless ($dateformat); - - foreach my $idx (@indices) { - if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { - for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { - $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = - $locale->reformat_date(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], - $dateformat, $longformat); - } - } - - next unless (defined($form->{$idx})); - - if (!ref($form->{$idx})) { - $form->{$idx} = $locale->reformat_date(\%myconfig, $form->{$idx}, - $dateformat, $longformat); - - } elsif (ref($form->{$idx}) eq "ARRAY") { - for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { - $form->{$idx}->[$i] = - $locale->reformat_date(\%myconfig, $form->{$idx}->[$i], - $dateformat, $longformat); - } - } - } - - $lxdebug->leave_sub(); + return $::form->format_dates(@_); } sub reformat_numbers { - $lxdebug->enter_sub(); - - my ($numberformat, $places, @indices) = @_; - - return $lxdebug->leave_sub() - if (!$numberformat || ($numberformat eq $myconfig{"numberformat"})); - - foreach my $idx (@indices) { - if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { - for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { - $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->parse_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i]); - } - } - - next unless (defined($form->{$idx})); - - if (!ref($form->{$idx})) { - $form->{$idx} = $form->parse_amount(\%myconfig, $form->{$idx}); - - } elsif (ref($form->{$idx}) eq "ARRAY") { - for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { - $form->{$idx}->[$i] = - $form->parse_amount(\%myconfig, $form->{$idx}->[$i]); - } - } - } - - my $saved_numberformat = $myconfig{"numberformat"}; - $myconfig{"numberformat"} = $numberformat; - - foreach my $idx (@indices) { - if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { - for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { - $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->format_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], $places); - } - } - - next unless (defined($form->{$idx})); - - if (!ref($form->{$idx})) { - $form->{$idx} = $form->format_amount(\%myconfig, $form->{$idx}, $places); - - } elsif (ref($form->{$idx}) eq "ARRAY") { - for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { - $form->{$idx}->[$i] = - $form->format_amount(\%myconfig, $form->{$idx}->[$i], $places); - } - } - } - - $myconfig{"numberformat"} = $saved_numberformat; - - $lxdebug->leave_sub(); + return $::form->reformat_numbers(@_); } # ------------------------------------------------------------------------- sub show_history { - $lxdebug->enter_sub(); - my $dbh = $form->dbconnect(\%myconfig); - my ($sort, $sortby) = split(/\-\-/, $form->{order}); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my $dbh = $form->dbconnect(\%myconfig); + my ($sort, $sortby) = split(/\-\-/, $form->{order}); $sort =~ s/.*\.(.*)/$1/; - $form->{title} = $locale->text("History"); - $form->header(); - print $form->parse_html_template( "common/show_history", { - "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}), - "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), - uc($sort) => 1, - uc($sort)."BY" => $sortby - } ); - - $dbh->disconnect(); - $lxdebug->leave_sub(); + $form->{title} = $locale->text("History"); + $form->header(no_layout => 1); + + my $callback = build_std_url(qw(action longdescription trans_id_type input_name)); + my $restriction; + if ( $form->{trans_id_type} eq 'glid' ) { # for invoices + $restriction = "AND ( snumbers LIKE 'invnumber%' OR what_done LIKE '%Buchungsnummer%' OR snumbers LIKE 'gltransaction%' OR (snumbers LIKE 'emailjournal%' AND what_done ~ 'invoice|credit_note') ) "; + } elsif ( $form->{trans_id_type} eq 'id' ) { # for non invoices + $restriction = " AND ( snumbers NOT LIKE 'invnumber_%' AND snumbers NOT LIKE 'gltransaction%' AND (what_done NOT LIKE '%Buchungsnummer%' AND what_done NOT LIKE '%invoice%' OR what_done IS null))"; + } else { + $restriction = ''; + }; + + print $form->parse_html_template( "common/show_history", { + "DATEN" => $form->get_history($dbh,$form->{input_name},$restriction,$form->{order}), + "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), + uc($sort) => 1, + uc($sort)."BY" => $sortby, + callback => $callback, + } ); + + $dbh->disconnect(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- sub call_sub { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); my $name = shift; + my $form = $main::form; + my $locale = $main::locale; + if (!$name) { $form->error($locale->text("Trying to call a sub without a name")); } @@ -471,15 +279,22 @@ sub call_sub { $form->error(sprintf($locale->text("Attempt to call an undefined sub named '%s'"), $name)); } - &{ $name }(@_); + { + no strict "refs"; + &{ $name }(@_); + } - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- sub show_vc_details { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; $form->{vc} = $form->{vc} eq "customer" ? "customer" : "vendor"; $form->isblank("vc_id", @@ -488,19 +303,22 @@ sub show_vc_details { $locale->text("No vendor has been selected yet.")); Common->get_vc_details(\%myconfig, $form, $form->{vc}, $form->{vc_id}); + $form->{discount_as_percent} = $form->format_amount(\%::myconfig, $form->parse_amount(\%::myconfig, $form->{discount}) * 100, 2); $form->{title} = $form->{vc} eq "customer" ? $locale->text("Customer details") : $locale->text("Vendor details"); - $form->header(); + $form->header(no_layout => 1); print $form->parse_html_template("common/show_vc_details", { "is_customer" => $form->{vc} eq "customer" }); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- sub retrieve_partunits { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; my @part_ids = grep { $_ } map { $form->{"id_${_}"} } (1..$form->{rowcount}); @@ -513,181 +331,60 @@ sub retrieve_partunits { } } - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } # ------------------------------------------------------------------------- -sub mark_as_paid_common { - $lxdebug->enter_sub(); - my ($myconfig, $db_name) = @_; - - if($form->{mark_as_paid}) { - my $dbh ||= $form->get_standard_dbh($myconfig); - my $query = qq|UPDATE $db_name SET paid = amount WHERE id = ?|; - do_query($form, $dbh, $query, $form->{id}); - $dbh->commit(); - $form->redirect($locale->text("Marked as paid")); - - } else { - my $referer = $ENV{HTTP_REFERER}; - if ($referer =~ /action/) { - $referer =~ /^(.*)\?action\=[^\&]*(\&.*)$/; - $script = $1; - $callback = $2; - } else { - $script = $referer; - $callback = ""; - } - $referer = $script . "?action=mark_as_paid&mark_as_paid=1&id=$form->{id}" . $callback; - $form->header(); - print qq||; - print qq|

|.$locale->text('Mark as paid?').qq|

|; - print qq| |; - print qq||; - print qq||; - } - - $lxdebug->leave_sub(); -} - -sub cov_selection_internal { - $lxdebug->enter_sub(); - - $order_by = "name"; - $order_by = $form->{"order_by"} if (defined($form->{"order_by"})); - $order_dir = 1; - $order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"})); - - my $type = $form->{"is_vendor"} ? $locale->text("vendor") : $locale->text("customer"); - - $covs = Common->retrieve_customers_or_vendors(\%myconfig, $form, $order_by, $order_dir, $form->{"is_vendor"}, $form->{"allow_both"}); - map({ $covs->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$covs})); - if (0 == scalar(@{$covs})) { - $form->show_generic_information(sprintf($locale->text("No %s was found matching the search parameters."), $type)); - } elsif (1 == scalar(@{$covs})) { - $onload = "cov_selected('1')"; - } - - my $callback = "$form->{script}?action=cov_selection_internal&"; - map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(name input_name input_id is_vendor allow_both), grep({ /^[fl]_/ } keys %$form))); - - my @header_sort = qw(name address contact); - my %header_title = ( "name" => $locale->text("Name"), - "address" => $locale->text("Address"), - "contact" => $locale->text("Contact"), - ); - - my @header = - map(+{ "column_title" => $header_title{$_}, - "column" => $_, - "callback" => $callback . "order_by=${_}&order_dir=" . ($order_by eq $_ ? 1 - $order_dir : $order_dir), - }, - @header_sort); - - foreach my $cov (@{ $covs }) { - $cov->{address} = "$cov->{street}, $cov->{zipcode} $cov->{city}"; - $cov->{address} =~ s{^,}{}x; - $cov->{address} =~ s{\ +}{\ }gx; - - $cov->{contact} = join " ", map { $cov->{$_} } qw(cp_gender cp_title cp_givenname cp_name); - $cov->{contact} =~ s{\ +}{\ }gx; - } - - $form->{"title"} = $form->{is_vendor} ? $locale->text("Select a vendor") : $locale->text("Select a customer"); - $form->header(); - print($form->parse_html_template("generic/cov_selection", { "HEADER" => \@header, - "COVS" => $covs, - "onload" => $onload })); - - $lxdebug->leave_sub(); -} # Functions to call add routines beneath different reports sub sales_invoice { - $lxdebug->enter_sub(); - - $auth->assert('invoice_edit'); - + $main::lxdebug->enter_sub(); - $form->{script} = 'is.pl'; - $script = "is"; - $form->{type} = "invoice"; - $locale = new Locale "$myconfig{countrycode}", "$script"; + print $::form->redirect_header('is.pl?action=add&type=invoice'); - require "bin/mozilla/$form->{script}"; - &add; - - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub ar_transaction { - $lxdebug->enter_sub(); - - $auth->assert('general_ledger'); - + $main::lxdebug->enter_sub(); - $form->{script} = 'ar.pl'; - $script = "ar"; - $locale = new Locale "$myconfig{countrycode}", "$script"; + print $::form->redirect_header('ar.pl?action=add'); - require "bin/mozilla/$form->{script}"; - &add; - - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub vendor_invoice { - $lxdebug->enter_sub(); - - $auth->assert('invoice_edit'); + $main::lxdebug->enter_sub(); + print $::form->redirect_header('ir.pl?action=add&type=invoice'); - $form->{script} = 'ir.pl'; - $script = "ir"; - $form->{type} = "invoice"; - $locale = new Locale "$myconfig{countrycode}", "$script"; - - require "bin/mozilla/$form->{script}"; - &add; - - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub ap_transaction { - $lxdebug->enter_sub(); - - $auth->assert('general_ledger'); - - - $form->{script} = 'ap.pl'; - $script = "ap"; - $locale = new Locale "$myconfig{countrycode}", "$script"; + $main::lxdebug->enter_sub(); - require "bin/mozilla/$form->{script}"; - &add; + print $::form->redirect_header('ap.pl?action=add'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub gl_transaction { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $auth->assert('general_ledger'); + print $::form->redirect_header('gl.pl?action=add'); + $main::lxdebug->leave_sub(); +} - $form->{script} = 'gl.pl'; - $script = "gl"; - $locale = new Locale "$myconfig{countrycode}", "$script"; - - require "bin/mozilla/$form->{script}"; - &add; - - $lxdebug->leave_sub(); +sub db { + goto &SL::DB::Helper::Mappings::db; } +sub continue { call_sub($::form->{nextsub}); } + 1;