From 521bb9654dd87078adc03def1f5cccfc1c80102d Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 5 Jun 2009 08:35:44 +0200 Subject: [PATCH] code cleaning * removed unused sub in Budgets.pm * lot of cleaning in aqplan.pl * typo changes in aqplan.tmpl --- C4/Budgets.pm | 32 ---- admin/aqplan.pl | 155 ++---------------- .../prog/en/modules/admin/aqplan.tmpl | 4 +- 3 files changed, 12 insertions(+), 179 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index ddb65cc8f6..d2a5b761b2 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -47,7 +47,6 @@ BEGIN { &GetBudgetPeriodsDropbox &GetBudgetSortDropbox - &GetAuthcatDropbox &GetAuthvalueDropbox &GetBudgetPermDropbox @@ -332,37 +331,6 @@ sub GetBudgetPermDropbox { return $radio; } -# ------------------------------------------------------------------- -sub GetAuthcatDropbox { - my ($name, $default ) = @_; - my @authorised_values; - my $value; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare(qq| - SELECT distinct(category) - FROM authorised_values WHERE category LIKE 'Asort%' - ORDER BY lib | - ); - $sth->execute(); - - push @authorised_values, ''; - while (my $value = $sth->fetchrow_array) { - push @authorised_values, $value; - } - - my $budget_authcat_dropbox = CGI::scrolling_list( - -name => $name, - -values => \@authorised_values, - -override => 1, - -size => 1, - -default => $default, - -multiple => 0, - -tabindex => 1, - -id => $name, - ); - return $budget_authcat_dropbox; -} - # ------------------------------------------------------------------- sub GetBudgetAuthCats { my ($budget_period_id) = shift; diff --git a/admin/aqplan.pl b/admin/aqplan.pl index cb17f0ea49..a8771d451e 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -100,15 +100,6 @@ my $del = $input->param("sep"); my $show_mine = $input->param('show_mine') ; my @hide_cols = $input->param('hide_cols'); -#### @hide_cols - - - -=c -my $show_mine = 1; #SHOW BY DEFAULT -my $show = $input->param('show'); # SET TO 1, BY A FORM SUMBIT -$show_mine = $input->param('show_mine') if $show == 1; -=cut my $cur_format = C4::Context->preference("CurrencyFormat"); my $num; @@ -141,10 +132,6 @@ my $op = $input->param("op"); my $budget_branchcode; - -#my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $budget_branchcode ); -## ## $budgets_ref - my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{param_map}->{'USER_INFO'}[0]->{'branchcode'}:'', $show_mine?$template->{param_map}->{'USER_INFO'}[0]->{'borrowernumber'}:'' ); # build categories list @@ -161,12 +148,11 @@ while ( my ($category) = $sth->fetchrow_array ) { $categories{$category} = 1; } +# push koha system categories push( @category_list, 'MONTHS' ); push( @category_list, 'ITEMTYPES' ); push( @category_list, 'BRANCHES' ); -# push koha system categories - #reorder the list @category_list = sort { $a cmp $b } @category_list; my $tab_list = CGI::scrolling_list( @@ -191,13 +177,6 @@ my %labels; # ------------------------------------------------------------ if ( $op eq 'save' ) { - - - ### --------------------- save - - #### @names - - #get budgets my ( @buds, @auth_values ); foreach my $n (@names) { @@ -241,67 +220,25 @@ if ( $op eq 'save' ) { my $plan = \@budget_lines; ModBudgetPlan( $plan, $budget_period_id, $authcat ); -#### iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii HideCols($authcat, @hide_cols); } - - # ------------------------------------------------------------ - - if ( $authcat =~ m/^Asort/ ) { - -#### eeeee # ----------- copied from C4::Input::buildCGIsort() my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib }; my $sth = $dbh->prepare($query); -#### $query -# $sth->{TraceLevel} = 2; $sth->execute($authcat ); - -=c - my $query = qq{ - -SELECT * FROM authorised_values -JOIN aqbudgets_planning ON - (aqbudgets_planning.authvalue = authorised_values.authorised_value ) -WHERE (authcat = ? -AND category = ? -AND budget_period_id = ? -AND display = 1 ) -ORDER BY lib }; - - - my $sth = $dbh->prepare($query); -#### $query - $sth->{TraceLevel} = 2; - - $sth->execute($authcat, $authcat, $budget_period_id ); -=cut - - -#### qq - if ( $sth->rows > 0 ) { for ( my $i = 0 ; $i < $sth->rows ; $i++ ) { my $results = $sth->fetchrow_hashref; push @authvals, $results->{authorised_value}; $labels{ $results->{authorised_value} } = $results->{lib}; - # $labels{ $results->{display} } = 1 ; - } } $sth->finish; @authvals = sort { $a <=> $b } @authvals; - - -#### @authvals - - - - } elsif ( $authcat eq 'MONTHS' ) { @@ -327,22 +264,8 @@ elsif ( $authcat eq 'MONTHS' ) { } elsif ( $authcat eq 'ITEMTYPES' ) { -#### aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - my $query = qq| SELECT itemtype, description FROM itemtypes |; -=c - my $query = qq| SELECT * FROM aqbudgets_planning - JOIN itemtypes ON (aqbudgets_planning.authvalue = itemtypes.itemtype) - WHERE (authcat = 'itemtypes' - AND budget_period_id = ? ) |; -=cut - - my $sth = $dbh->prepare($query); - $sth->{TraceLevel} = 3; - - - #$sth->execute( $budget_period_id ); $sth->execute( ); if ( $sth->rows > 0 ) { @@ -354,14 +277,6 @@ elsif ( $authcat eq 'ITEMTYPES' ) { } $sth->finish; - - #### @authvals - - - - - - } elsif ( $authcat eq 'BRANCHES' ) { my $query = qq| SELECT branchcode, branchname FROM branches |; @@ -378,11 +293,6 @@ elsif ( $authcat eq 'ITEMTYPES' ) { $sth->finish; } -#### @authvals -#### %labels - - - my @authvals_row; my $i=1; foreach my $val (@authvals) { @@ -396,36 +306,21 @@ foreach my $val (@authvals) { push( @authvals_row, \%auth_hash ); } -#### ddddddddddddd -#### @authvals_row - - - - - - - - - - #get budgets - my ( @buds, @auth_values ); - foreach my $n (@names) { - next if $n =~ m/^[^0-9]/; - $n =~ m/(\d*),(.*)/; - push @buds, $1; - push @auth_values, $2; - } +#get budgets +my ( @buds, @auth_values ); +foreach my $n (@names) { + next if $n =~ m/^[^0-9]/; + $n =~ m/(\d*),(.*)/; + push @buds, $1; + push @auth_values, $2; +} # ------------------------------------------------------------ # DEFAULT DISPLAY BEGINS my @mime = ( C4::Context->preference("MIME") ); -foreach my $mime (@mime) { - # warn "".$mime; -} - my $CGIextChoice = CGI::scrolling_list( -name => 'MIME', -id => 'MIME', @@ -446,9 +341,6 @@ my $CGIsepChoice = CGI::scrolling_list( my ( @budget_lines, %cell_hash ); - - - foreach my $budget (@budgets) { my $budget_lock; @@ -504,9 +396,6 @@ foreach my $budget (@budgets) { $i++; } - - - # lines => \@cells_line, my $budget_act_remain = $budget->{budget_amount} - $actual_spent; my $budget_est_remain = $budget->{budget_amount} - $estimated_spent; @@ -532,9 +421,6 @@ foreach my $budget (@budgets) { # skip if active set , and spent == 0 next if ( $show_active == '1' && ( $actual_spent == 0 ) ); - - ### %budget_lin - push( @budget_lines, \%budget_line ); } @@ -543,8 +429,6 @@ if ( $output eq "file" ) { exit(1); } - ## ## @budget_lines - $template->param( authvals_row => \@authvals_row, budget_lines => \@budget_lines, @@ -564,27 +448,9 @@ $template->param( authvals => \@authvals_row, hide_cols_loop => \@hide_cols ); -#### uuuuuuuuuuu - - output_html_with_http_headers $input, $cookie, $template->output; - - - - - - - - - - - - - - - sub _print_to_csv { my ( $header, $results ) = @_; @@ -620,5 +486,4 @@ sub _print_to_csv { my $str = $csv->string; print "$str\n"; } -} - +} \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl index dfbef4f42d..645f16b395 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tmpl @@ -211,7 +211,7 @@ YAHOO.util.Event.onAvailable("popmenu", function () { - uu  +   " > " id='' class='' onchange="calcTotalRow(this);" > @@ -246,7 +246,7 @@ YAHOO.util.Event.onAvailable("popmenu", function () { ')" value="Auto-fill row"/> -
LOCKED
+
not owned
-- 2.39.5