Bug 7328 Expanded options in advanced search
[koha.git] / admin / aqbudgetperiods.pl
index b12f85e..e74935e 100755 (executable)
@@ -14,9 +14,9 @@
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 =head1 admin/aqbudgetperiods.pl
 
@@ -42,6 +42,7 @@ script to administer the budget periods table
 
 ## modules
 use strict;
+#use warnings; FIXME - Bug 2505
 use Number::Format qw(format_price);
 use CGI;
 use List::Util qw/min/;
@@ -61,7 +62,6 @@ my $input       = new CGI;
 my $searchfield          = $input->param('searchfield');
 my $budget_period_id     = $input->param('budget_period_id');
 my $op                   = $input->param('op')||"else";
-my $check_duplicate      = $input->param('confirm_not_duplicate')||0;
 
 my $budget_period_hashref= $input->Vars;
 #my $sort1_authcat = $input->param('sort1_authcat');
@@ -82,7 +82,9 @@ my ($template, $borrowernumber, $cookie, $staff_flags ) = get_template_and_user(
 
 
 my $cur = GetCurrency();
-$template->param( cur => $cur->{symbol} );
+$template->param( symbol => $cur->{symbol},
+                  currency => $cur->{currency}
+               );
 my $cur_format = C4::Context->preference("CurrencyFormat");
 my $num;
 
@@ -114,13 +116,20 @@ if ( $op eq 'add_form' ) {
                my $budgetperiod_hash=GetBudgetPeriod($budget_period_id);
         # get dropboxes
                FormatData($budgetperiod_hash);
-        $$budgetperiod_hash{budget_period_total}= $num->format_price($$budgetperiod_hash{'budget_period_total'});  
+
+        my $editnum = new Number::Format(
+            'int_curr_symbol'   => '',
+            'thousands_sep'     => '',
+            'mon_thousands_sep' => '',
+            'mon_decimal_point' => '.'
+        );
+
+        $$budgetperiod_hash{budget_period_total}= $editnum->format_price($$budgetperiod_hash{'budget_period_total'});
         $template->param(
                        %$budgetperiod_hash
         );
     } # IF-MOD
     $template->param( DHTMLcalendar_dateformat         => C4::Dates->DHTMLcalendar(),);
-    $template->param( confirm_not_duplicate            => $check_duplicate               );
 }
 
 elsif ( $op eq 'add_validate' ) {
@@ -132,31 +141,6 @@ elsif ( $op eq 'add_validate' ) {
                my $status=ModBudgetPeriod($budget_period_hashref);
        } 
        else {    # ELSE ITS AN ADD
-               unless ($check_duplicate){
-                       my $candidates=GetBudgetPeriods({ 
-                                                                                       budget_period_startdate => $$budget_period_hashref{budget_period_startdate}
-                                                                                       , budget_period_enddate => $$budget_period_hashref{budget_period_enddate}
-                                                                                       });
-                       if (@$candidates){
-                               my @duplicates=map{
-                                                                       { dupid                            => $$_{budget_period_id}
-                                                                       , duplicateinformation =>
-                                                                                       $$_{budget_period_description}." ".$$_{budget_period_startdate}." ".$$_{budget_period_enddate}
-                                                                       }
-                                                                 } @$candidates;
-                               $template->param(url                      => "aqbudgetperiods.pl", 
-                                                               field_name                => "budget_period_id",
-                                                               action_dup_yes_url=> "aqbudgets.pl",
-                                                               action_dup_no_url => "aqbudgetperiods.pl?op=add_validate",
-                                                               confirm_not_duplicate     => 0
-                                                                       );
-                               delete $$budget_period_hashref{budget_period_id};
-                               $template->param(duplicates=>\@duplicates,%$budget_period_hashref);
-                               $template->param("add_form"=>1);
-                               output_html_with_http_headers $input, $cookie, $template->output;
-                               exit;
-                       }
-               }
                my $budget_period_id=AddBudgetPeriod($budget_period_hashref);
        }
        $op='else';
@@ -204,10 +188,8 @@ elsif ( $op eq 'delete_confirmed' ) {
         $budgetperiod->{budget_active} = 1;
         push( @period_loop, $budgetperiod );
     }
-    my $budget_period_dropbox = GetBudgetPeriodsDropbox();
 
     $template->param(
-        budget_period_dropbox => $budget_period_dropbox,
         period_loop           => \@period_loop,
                pagination_bar            => pagination_bar("aqbudgetperiods.pl",getnbpages(scalar(@$results),$pagesize),$page),
     );