fix two more instances of old FSF address
[koha_fer] / acqui / basket.pl
index 9687b88..7c2456a 100755 (executable)
@@ -16,9 +16,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.
 
 use strict;
 use warnings;
@@ -86,6 +86,9 @@ my $basket = GetBasket($basketno);
 $booksellerid = $basket->{booksellerid} unless $booksellerid;
 my ($bookseller) = GetBookSellerFromId($booksellerid);
 my $op = $query->param('op');
+if (!defined $op) {
+    $op = q{};
+}
 
 if ( $op eq 'delete_confirm' ) {
     my $basketno = $query->param('basketno');
@@ -156,9 +159,9 @@ if ( $op eq 'delete_confirm' ) {
                             });
             ModBasket( { basketno => $basketno,
                          basketgroupid => $basketgroupid } );
-            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid);
+            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
         } else {
-            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?basketno='.$basketno.'&op=attachbasket&booksellerid=' . $booksellerid);
+            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?supplierid=' . $booksellerid);
         }
         exit;
     } else {
@@ -192,7 +195,7 @@ if ( $op eq 'delete_confirm' ) {
     }
 #if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
     my $basketgroups;
-    my $member = GetMember($loggedinuser, "borrowernumber");
+    my $member = GetMember(borrowernumber => $loggedinuser);
     if ($basket->{closedate} && haspermission({ flagsrequired   => { acquisition => 'group_manage'} })) {
         $basketgroups = GetBasketgroups($basket->{booksellerid});
         for (my $i=0; $i < scalar(@$basketgroups); $i++) {
@@ -231,6 +234,9 @@ if ( $op eq 'delete_confirm' ) {
     for ( my $i = 0 ; $i < $count ; $i++ ) {
         my $rrp = $results[$i]->{'listprice'};
                my $qty = $results[$i]->{'quantity'} || 0;
+        if (!defined $results[$i]->{quantityreceived}) {
+            $results[$i]->{quantityreceived} = 0;
+        }
 
         my $budget = GetBudget(  $results[$i]->{'budget_id'} );
         $rrp = ConvertCurrency( $results[$i]->{'currency'}, $rrp );
@@ -242,7 +248,7 @@ if ( $op eq 'delete_confirm' ) {
         my %line = %{ $results[$i] };
                ($i%2) and $line{toggle} = 1;
 
-        $line{order_received} = ( $qty eq $results[$i]->{'quantityreceived'} );
+        $line{order_received} = ( $qty == $results[$i]->{'quantityreceived'} );
         $line{basketno}       = $basketno;
         $line{i}              = $i;
         $line{budget_name}    = $budget->{budget_name};
@@ -251,10 +257,8 @@ if ( $op eq 'delete_confirm' ) {
         $line{line_total}     = sprintf( "%.2f", $line_total );
         $line{odd}            = $i % 2;
         if ($line{uncertainprice}) {
-            $template->param( unclosable => 1 );
-            for my $key (qw/ecost line_total rrp/) {
-                $line{$key} .= '??';
-            }
+            $template->param( uncertainprices => 1 );
+            $line{rrp} .= ' (Uncertain)';
         }
        if ($line{'title'}){
            my $volume = $results[$i]->{'volume'};
@@ -282,6 +286,7 @@ if ( $op eq 'delete_confirm' ) {
        my $total_est_gste = $total_rrp_gste - ($total_rrp_gste * $discount);
 
     my $contract = &GetContract($basket->{contractnumber});
+    my @orders = GetOrders($basketno);
     $template->param(
         basketno             => $basketno,
         basketname           => $basket->{'basketname'},
@@ -311,6 +316,7 @@ if ( $op eq 'delete_confirm' ) {
         GST                  => $gist,
         basketgroups         => $basketgroups,
         grouped              => $basket->{basketgroupid},
+        unclosable           => @orders ? 0 : 1, 
     );
 }