fix for #3620: basket management
authorPaul Poulain <paul.poulain@biblibre.com>
Wed, 16 Sep 2009 15:40:34 +0000 (17:40 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 30 Sep 2009 09:30:34 +0000 (11:30 +0200)
- basket.pl: updating display, formatting dates,
- neworderempty: updating display, removing useless code, using ACQ framework if it exist. The ACQ framework will be used for creating items record during acquisitions. If it does not exist, default is used instead (which has many more informations, lot of them being irrelevant during acquisition, like the barcode)
- new order from imported batch: rewrite of the workflow. Now uses neworderempty and changing status of import_record to 'imported'
- s/copyrightdate/publicationyear/ as it's what libraries uses when ordering
- fixing some warnings
-

12 files changed:
C4/Biblio.pm
C4/ImportBatch.pm
acqui/addorder.pl
acqui/addorderiso2709.pl
acqui/basket.pl
acqui/basketheader.pl
acqui/neworderempty.pl
koha-tmpl/intranet-tmpl/prog/en/js/acq.js
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl

index 0e92d90..e15b93f 100755 (executable)
@@ -960,12 +960,12 @@ sub GetMarcStructure {
         return $marc_structure_cache->{$forlibrarian}->{$frameworkcode};
     }
 
+#     my $sth = $dbh->prepare(
+#         "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?");
+#     $sth->execute($frameworkcode);
+#     my ($total) = $sth->fetchrow;
+#     $frameworkcode = "" unless ( $total > 0 );
     my $sth = $dbh->prepare(
-        "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?");
-    $sth->execute($frameworkcode);
-    my ($total) = $sth->fetchrow;
-    $frameworkcode = "" unless ( $total > 0 );
-    $sth = $dbh->prepare(
         "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
         FROM marc_tag_structure 
         WHERE frameworkcode=? 
@@ -2279,23 +2279,27 @@ sub TransformMarcToKohaOneField {
 
 =over 4
 
-PrepareItemrecordDisplay($itemrecord,$bibnum,$itemumber);
+PrepareItemrecordDisplay($itemrecord,$bibnum,$itemumber,$frameworkcode);
 
 Returns a hash with all the fields for Display a given item data in a template
 
+The $frameworkcode returns the item for the given frameworkcode, ONLY if bibnum is not provided
+
 =back
 
 =cut
 
 sub PrepareItemrecordDisplay {
 
-    my ( $bibnum, $itemnum, $defaultvalues ) = @_;
+    my ( $bibnum, $itemnum, $defaultvalues, $frameworkcode ) = @_;
 
     my $dbh = C4::Context->dbh;
-    my $frameworkcode = &GetFrameworkCode( $bibnum );
+    $frameworkcode = &GetFrameworkCode( $bibnum ) if $bibnum;
     my ( $itemtagfield, $itemtagsubfield ) =
       &GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
     my $tagslib = &GetMarcStructure( 1, $frameworkcode );
+    # return nothing if we don't have found an existing framework.
+    return "" unless $tagslib;
     my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum) if ($itemnum);
     my @loop_data;
     my $authorised_values_sth =
@@ -2350,22 +2354,22 @@ sub PrepareItemrecordDisplay {
                 }
                 if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq
                     'items.itemcallnumber'
-                    && $defaultvalues->{'callnumber'} )
+                    && $defaultvalues && $defaultvalues->{'callnumber'} )
                 {
                     my $temp = $itemrecord->field($subfield) if ($itemrecord);
                     unless ($temp) {
-                        $value = $defaultvalues->{'callnumber'};
+                        $value = $defaultvalues->{'callnumber'} if $defaultvalues;
                     }
                 }
                 if ( ($tagslib->{$tag}->{$subfield}->{kohafield} eq
                     'items.holdingbranch' ||
                     $tagslib->{$tag}->{$subfield}->{kohafield} eq
                     'items.homebranch')          
-                    && $defaultvalues->{'branchcode'} )
+                    && $defaultvalues && $defaultvalues->{'branchcode'} )
                 {
                     my $temp = $itemrecord->field($subfield) if ($itemrecord);
                     unless ($temp) {
-                        $value = $defaultvalues->{branchcode};
+                        $value = $defaultvalues->{branchcode}  if $defaultvalues;
                     }
                 }
                 if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
index aa2c062..8f259a3 100644 (file)
@@ -797,7 +797,7 @@ sub GetImportBatchRangeDesc {
 sub GetItemNumbersFromImportBatch {
        my ($batch_id) = @_;
        my $dbh = C4::Context->dbh;
-       my $sth = $dbh->prepare("select itemnumber from import_batches,import_records,import_items where import_batches.import_batch_id=import_records.import_batch_id and import_records.import_record_id=import_items.import_record_id and import_batches.import_batch_id=?");
+       my $sth = $dbh->prepare("SELECT itemnumber FROM import_batches,import_records,import_items WHERE import_batches.import_batch_id=import_records.import_batch_id AND import_records.import_record_id=import_items.import_record_id AND import_batches.import_batch_id=?");
        $sth->execute($batch_id);
        my @items ;
        while ( my ($itm) = $sth->fetchrow_array ) {
@@ -840,17 +840,22 @@ starting at the given offset.
 =cut
 
 sub GetImportBibliosRange {
-    my ($batch_id, $offset, $results_per_group) = @_;
+    my ($batch_id, $offset, $results_per_group, $status) = @_;
 
     my $dbh = C4::Context->dbh;
     my $query = "SELECT title, author, isbn, issn, import_record_id, record_sequence,
                                            status, overlay_status
                                     FROM   import_records
                                     JOIN   import_biblios USING (import_record_id)
-                                    WHERE  import_batch_id = ?
-                                    ORDER BY import_record_id";
+                                    WHERE  import_batch_id = ?";
     my @params;
     push(@params, $batch_id);
+    if ($status) {
+        $query .= " AND status=?";
+        push(@params,$status);
+    }
+    $query.=" ORDER BY import_record_id";
+
     if($offset){
         if($results_per_group){
             $query .= " LIMIT ?";
index 255dd7e..198cdf0 100755 (executable)
@@ -140,7 +140,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
-       flagsrequired   => { acquisition => 'order_manage' },
+        flagsrequired   => { acquisition => 'order_manage' },
         debug           => 1,
     }
 );
@@ -152,7 +152,7 @@ my $booksellerid  = $input->param('booksellerid');
 my $existing      = $input->param('existing');    # existing biblio, (not basket or order)
 my $title         = $input->param('title');
 my $author        = $input->param('author');
-my $copyrightdate = $input->param('copyrightdate');
+my $publicationyear= $input->param('publicationyear');
 my $isbn          = $input->param('ISBN');
 my $itemtype      = $input->param('format');
 my $quantity      = $input->param('quantity');         # FIXME: else ERROR!
@@ -176,9 +176,8 @@ my $suggestionid  = $input->param('suggestionid');
 my $biblionumber  = $input->param('biblionumber');
 my $user          = $input->remote_user;
 my $uncertainprice = $input->param('uncertainprice');
+my $import_batch_id= $input->param('import_batch_id');
 
-#warn "CREATEBIBITEM =  $input->param('createbibitem')";
-#warn Dumper $input->param('createbibitem');
 my $createbibitem = $input->param('createbibitem');
 
 # create, modify or delete biblio
@@ -193,13 +192,12 @@ if ( $quantity ne '0' ) {
         #if it doesnt create it
         my $record = TransformKohaToMarc(
             {
-                "biblio.title"              => "$title",
-                "biblio.author"             => "$author",
-                "biblio.copyrightdate"      => $copyrightdate ? $copyrightdate : "",
-                "biblio.series"             => $series        ? $series        : "",
-                "biblioitems.itemtype"      => $itemtype      ? $itemtype      : "",
-                "biblioitems.isbn"          => $isbn          ? $isbn          : "",
-                "biblioitems.publishercode" => $publishercode ? $publishercode : "",
+                "biblio.title"                => "$title",
+                "biblio.author"               => "$author",
+                "biblio.series"               => $series          ? $series        : "",
+                "biblioitems.isbn"            => $isbn            ? $isbn          : "",
+                "biblioitems.publishercode"   => $publishercode   ? $publishercode : "",
+                "biblioitems.publicationyear" => $publicationyear ? $publicationyear: "",
             });
         # create the record in catalogue, with framework ''
         ($biblionumber,$bibitemnum) = AddBiblio($record,'');
@@ -304,4 +302,8 @@ else { # qty=0, delete the line
     $biblionumber = $input->param('biblionumber');
     DelOrder( $biblionumber, $ordnum );
 }
-print $input->redirect("basket.pl?basketno=$basketno");
+if ($import_batch_id) {
+    print $input->redirect("/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=$import_batch_id&basketno=$basketno&booksellerid=$booksellerid");
+} else {
+    print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
+}
index d975ef7..7ca6746 100755 (executable)
@@ -50,7 +50,11 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({
                                         });
 my $cgiparams = $input->Vars;
 my $op = $cgiparams->{'op'};
-$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl");
+my $booksellerid  = $input->param('booksellerid');
+
+$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl",
+                booksellerid => $booksellerid,
+                );
 my $ordnum;
 
 if ($cgiparams->{'import_batch_id'} && $op eq ""){
@@ -261,15 +265,15 @@ sub import_batches_list {
 
 sub import_biblios_list {
     my ($template, $import_batch_id) = @_;
-    my $batch = GetImportBatch($import_batch_id);
-    my $biblios = GetImportBibliosRange($import_batch_id);
+    my $batch = GetImportBatch($import_batch_id,'staged');
+    my $biblios = GetImportBibliosRange($import_batch_id,'','','staged');
     my @list = ();
-# Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards
-    my $itemtypehash = GetItemTypes();
-    my @itemtypes;
-    for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) {
-        push(@itemtypes, $itemtypehash->{$key});
-    }
+# Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards
+    my $itemtypehash = GetItemTypes();
+    my @itemtypes;
+    for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) {
+        push(@itemtypes, $itemtypehash->{$key});
+    }
     foreach my $biblio (@$biblios) {
         my $citation = $biblio->{'title'};
         $citation .= " $biblio->{'author'}" if $biblio->{'author'};
@@ -289,15 +293,15 @@ sub import_biblios_list {
             match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0,
             match_citation => $#$match > -1 ? $match->[0]->{'title'} . ' ' . $match->[0]->{'author'} : '',
             match_score => $#$match > -1 ? $match->[0]->{'score'} : 0,
-            itemtypes => \@itemtypes,
+            itemtypes => \@itemtypes,
         );
-        if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordnum) {
-            # prepare empty item form
-            my $cell = PrepareItemrecordDisplay();
-            my @itemloop;
-            push @itemloop,$cell;
-            $cellrecord{'items'} = \@itemloop;
-        }
+        if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordnum) {
+            # prepare empty item form
+            my $cell = PrepareItemrecordDisplay();
+            my @itemloop;
+            push @itemloop,$cell;
+            $cellrecord{'items'} = \@itemloop;
+        }
         push @list, \%cellrecord;
 
 
@@ -307,15 +311,15 @@ sub import_biblios_list {
     my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
     my $item_action = GetImportBatchItemAction($import_batch_id);
     $template->param(biblio_list => \@list,
-                                      num_results => $num_biblios,
-                                      import_batch_id => $import_batch_id,
-                                      "overlay_action_${overlay_action}" => 1,
-                                      overlay_action => $overlay_action,
-                                      "nomatch_action_${nomatch_action}" => 1,
-                                      nomatch_action => $nomatch_action,
-                                      "item_action_${item_action}" => 1,
-                                      item_action => $item_action
-                                     );
+                        num_results => $num_biblios,
+                        import_batch_id => $import_batch_id,
+                        "overlay_action_${overlay_action}" => 1,
+                        overlay_action => $overlay_action,
+                        "nomatch_action_${nomatch_action}" => 1,
+                        nomatch_action => $nomatch_action,
+                        "item_action_${item_action}" => 1,
+                        item_action => $item_action
+                    );
     batch_info($template, $batch);
 }
 
index c573035..914ca7e 100755 (executable)
@@ -213,7 +213,7 @@ if ( $op eq 'delete_confirm' ) {
 
     for ( my $i = 0 ; $i < $count ; $i++ ) {
         my $rrp = $results[$i]->{'listprice'};
-               my $qty = $results[$i]->{'quantity'};
+               my $qty = $results[$i]->{'quantity'} || 0;
 
         my $budget = GetBudget(  $results[$i]->{'budget_id'} );
         $rrp = ConvertCurrency( $results[$i]->{'currency'}, $rrp );
@@ -272,18 +272,14 @@ if ( $op eq 'delete_confirm' ) {
         basketbooksellernote => $basket->{booksellernote},
         basketcontractno     => $basket->{contractnumber},
         basketcontractname   => $contract->{contractname},
-        creationdate         => format_date( $basket->{creationdate} ),
+        creationdate         => C4::Dates->new($basket->{creationdate},'iso')->output,
         authorisedby         => $basket->{authorisedby},
         authorisedbyname     => $basket->{authorisedbyname},
-        closedate            => format_date( $basket->{closedate} ),
+        closedate            => C4::Dates->new($basket->{closedate},'iso')->output,
         active               => $bookseller->{'active'},
         booksellerid         => $bookseller->{'id'},
         name                 => $bookseller->{'name'},
-        address1             => $bookseller->{'address1'},
-        address2             => $bookseller->{'address2'},
-        address3             => $bookseller->{'address3'},
-        address4             => $bookseller->{'address4'},
-        entrydate            => format_date( $results[0]->{'entrydate'} ),
+        entrydate            => C4::Dates->new($results[0]->{'entrydate'},'iso')->output,
         books_loop           => \@books_loop,
         count                => $count,
         gist_rate            => sprintf( "%.2f", $gist * 100 ) . '%',
index 56f2483..58e5773 100755 (executable)
@@ -99,7 +99,7 @@ if ( $op eq 'add_form' ) {
     my $count = scalar @contractloop;
     if ( $count > 0) {
         $template->param(contractloop => \@contractloop,
-                                           basketcontractnumber => $basket->{'contractnumber'});
+                         basketcontractnumber => $basket->{'contractnumber'});
     }
     $template->param( add_form => 1,
                     basketname => $basket->{'basketname'},
index f4e13fa..6be14ec 100755 (executable)
@@ -42,8 +42,8 @@ the title of this new record.
 =item author
 the author of this new record.
 
-=item copyright
-the copyright of this new record.
+=item publication year
+the publication year of this new record.
 
 =item ordnum
 the number of this order.
@@ -74,7 +74,7 @@ use C4::Input;
 use C4::Auth;
 use C4::Budgets;
 use C4::Input;
-#use C4::Bookfund;
+use C4::Dates;
 
 use C4::Bookseller;            # GetBookSellerFromId
 use C4::Acquisition;
@@ -88,23 +88,22 @@ use C4::Members;
 use C4::Search qw/FindDuplicate BiblioAddAuthorities/;
 
 #needed for z3950 import:
-use C4::ImportBatch qw/GetImportRecordMarc/;
-
-my $input        = new CGI;
-my $booksellerid = $input->param('booksellerid');      # FIXME: else ERROR!
-my $budget_id    = $input->param('budget_id'); # FIXME: else ERROR!
-my $title        = $input->param('title');
-my $author       = $input->param('author');
-my $copyright    = $input->param('copyright');
-my $bookseller   = GetBookSellerFromId($booksellerid); # FIXME: else ERROR!
-my $ordnum       = $input->param('ordnum') || '';
-my $biblionumber = $input->param('biblionumber');
-my $basketno     = $input->param('basketno');
-my $purchaseorder= $input->param('purchaseordernumber');
-my $suggestionid = $input->param('suggestionid');
-# my $donation     = $input->param('donation');
-my $close        = $input->param('close');
-my $uncertainprice = $input->param('uncertainprice');
+use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
+
+my $input           = new CGI;
+my $booksellerid    = $input->param('booksellerid');   # FIXME: else ERROR!
+my $budget_id       = $input->param('budget_id');      # FIXME: else ERROR!
+my $title           = $input->param('title');
+my $author          = $input->param('author');
+my $publicationyear = $input->param('publicationyear');
+my $bookseller      = GetBookSellerFromId($booksellerid);      # FIXME: else ERROR!
+my $ordnum          = $input->param('ordnum') || '';
+my $biblionumber    = $input->param('biblionumber');
+my $basketno        = $input->param('basketno');
+my $suggestionid    = $input->param('suggestionid');
+my $close           = $input->param('close');
+my $uncertainprice  = $input->param('uncertainprice');
+my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order !
 my $data;
 my $new = 'no';
 
@@ -121,8 +120,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
+my $basket = GetBasket($basketno);
+my $contract = &GetContract($basket->{contractnumber});
+
 #simple parameters reading (all in one :-)
 my $params = $input->Vars;
+my $listprice; # the price, that can be in MARC record if we have one
 if ( $ordnum eq '' and defined $params->{'breedingid'}){
 #we want to import from the breeding reservoir (from a z3950 search)
     my ($marcrecord, $encoding) = MARCfindbreeding($params->{'breedingid'});
@@ -131,27 +134,35 @@ if ( $ordnum eq '' and defined $params->{'breedingid'}){
     my $duplicatetitle;
 #look for duplicates
     if (! (($biblionumber,$duplicatetitle) = FindDuplicate($marcrecord))){
-        my $itemtypes = GetItemTypes();
-        my $marcflavour = C4::Context->preference("marcflavour");
-#         warn("$marcflavour----itemtype"."-------------marcflavour".$marcflavour."---------subfield".$marcrecord->subfield('200', 'b'));
-#use the itemtype field of the UNIMARC standard.
-        if ( $marcflavour eq 'UNIMARC' ) {
-            my $itemtype = $marcrecord->subfield('200', 'b');
-#Check wether the itemtype is known
-            warn(grep { $itemtypes->{$_}->{itemtype} =~ /$itemtype/ } keys %$itemtypes);
-            if (scalar(grep { $itemtypes->{$_}->{itemtype} =~ /$itemtype/ } keys %$itemtypes) == 0) {
-                my @itemtypes = sort {lc($itemtypes->{$a}->{'description'}) cmp lc($itemtypes->{$b}->{'description'})} keys %$itemtypes;
-                $itemtype = $itemtypes[0];
-#                warn(YAML->Dump(@itemtypes));
-                $marcrecord->field('200')->update('b' => $itemtype);
-            }
-        }
         if (C4::Context->preference("BiblioAddsAuthorities")){
-              my ($countlinked,$countcreated)=BiblioAddAuthorities($marcrecord, $params->{'frameworkcode'});
+            my ($countlinked,$countcreated)=BiblioAddAuthorities($marcrecord, $params->{'frameworkcode'});
         }
         my $bibitemnum;
         $params->{'frameworkcode'} or $params->{'frameworkcode'} = "";
         ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $params->{'frameworkcode'} );
+        # get the price if there is one.
+        # filter by storing only the 1st number
+        # we suppose the currency is correct, as we have no possibilities to get it.
+        if ($marcrecord->subfield("345","d")) {
+            $listprice = $marcrecord->subfield("345","d");
+            if ($listprice =~ /^([\d\.,]*)/) {
+                $listprice = $1;
+                $listprice =~ s/,/\./;
+            } else {
+                $listprice = 0;
+            }
+        }
+        elsif ($marcrecord->subfield("010","d")) {
+            $listprice = $marcrecord->subfield("010","d");
+            if ($listprice =~ /^([\d\.,]*)/) {
+                $listprice = $1;
+                $listprice =~ s/,/\./;
+            } else {
+                $listprice = 0;
+            }
+        }
+        $listprice=100;
+        SetImportRecordStatus($params->{'breedingid'}, 'imported');
     }
 }
 
@@ -169,7 +180,7 @@ if ( $ordnum eq '' ) {    # create order
 # get suggestion fields if applicable. If it's a subscription renewal, then the biblio already exists
 # otherwise, retrieve suggestion information.
     if ($suggestionid) {
-               $data = ($biblionumber) ? GetBiblioData($biblionumber) : GetSuggestion($suggestionid);
+        $data = ($biblionumber) ? GetBiblioData($biblionumber) : GetSuggestion($suggestionid);
     }
 }
 else {    #modify order
@@ -197,33 +208,22 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
     push @loop_currency, \%line;
 }
 
-    # ##  @loop_currency
-
-
-# build itemtype list
-my $itemtypes = GetItemTypes;
-
-my @itemtypesloop;
-foreach my $thisitemtype (sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'}} keys %$itemtypes) {
-    push @itemtypesloop, { itemtype => $itemtypes->{$thisitemtype}->{'itemtype'} , desc =>  $itemtypes->{$thisitemtype}->{'description'} } ;
-}
-
 # build branches list
 my $onlymine=C4::Context->preference('IndependantBranches') && 
-             C4::Context->userenv && 
-             C4::Context->userenv->{flags}!=1 && 
-             C4::Context->userenv->{branch};
+            C4::Context->userenv && 
+            C4::Context->userenv->{flags}!=1 && 
+            C4::Context->userenv->{branch};
 my $branches = GetBranches($onlymine);
 my @branchloop;
 foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
-     my %row = (
+    my %row = (
         value      => $thisbranch,
         branchname => $branches->{$thisbranch}->{'branchname'},
     );
-       $row{'selected'} = 1 if( $thisbranch eq $data->{branchcode}) ;
+    $row{'selected'} = 1 if( $thisbranch eq $data->{branchcode}) ;
     push @branchloop, \%row;
 }
-$template->param( branchloop => \@branchloop , itypeloop => \@itemtypesloop );
+$template->param( branchloop => \@branchloop );
 
 # build bookfund list
 my $borrower= GetMember('borrowernumber' => $loggedinuser);
@@ -251,11 +251,10 @@ my $budget_dropbox = CGI::scrolling_list(
 
 if ($close) {
     $budget_id      =  $data->{'budget_id'};
-    $budget_name    =   $budget->{'budget_name'};      
+    $budget_name    =   $budget->{'budget_name'};
 
 }
 
-
 my $CGIsort1;
 if ($budget) {    # its a mod ..
     if ( defined $budget->{'sort1_authcat'} ) {    # with custom  Asort* planning values
@@ -292,31 +291,14 @@ if ($CGIsort2) {
     $template->param( sort2 => $data->{'sort2'} );
 }
 
-
-
-# #do a biblioitems lookup on bib
-# my @bibitems = GetBiblioItemByBiblioNumber($biblionumber);
-# my $bibitemscount = scalar @bibitems;
-# 
-# if ( $bibitemscount > 0 ) {
-#     # warn "NEWBIBLIO: bibitems for $biblio exists\n";
-#     my @bibitemloop;
-#     for ( my $i = 0 ; $i < $bibitemscount ; $i++ ) {
-#         my %line;
-#         $line{biblioitemnumber} = $bibitems[$i]->{'biblioitemnumber'};
-#         $line{isbn}             = $bibitems[$i]->{'isbn'};
-#         $line{itemtype}         = $bibitems[$i]->{'itemtype'};
-#         $line{volumeddesc}      = $bibitems[$i]->{'volumeddesc'};
-#         push( @bibitemloop, \%line );
-# 
-#         $template->param( bibitemloop => \@bibitemloop );
-#     }
-#     $template->param( bibitemexists => "1" );
-# }
-
 if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordnum) {
     # prepare empty item form
-    my $cell = PrepareItemrecordDisplay();
+    my $cell = PrepareItemrecordDisplay('','','','ACQ');
+#     warn "==> ".Data::Dumper::Dumper($cell);
+    unless ($cell) {
+        $cell = PrepareItemrecordDisplay('','','','');
+        $template->param('NoACQframework' => 1);
+    }
     my @itemloop;
     push @itemloop,$cell;
     
@@ -328,59 +310,59 @@ $template->param(
     close        => $close,
     budget_id    => $budget_id,
     budget_name  => $budget_name
-  )
-  if ($close);
+) if ($close);
 
-    # ## @loop_currency,
 $template->param(
     existing         => $biblionumber,
     ordnum           => $ordnum,
-    basketno         => $basketno,
-    booksellerid     => $booksellerid,
+    # basket informations
+    basketno             => $basketno,
+    basketname           => $basket->{'basketname'},
+    basketnote           => $basket->{'note'},
+    booksellerid         => $basket->{'booksellerid'},
+    basketbooksellernote => $basket->{booksellernote},
+    basketcontractno     => $basket->{contractnumber},
+    basketcontractname   => $contract->{contractname},
+    creationdate         => C4::Dates->new($basket->{creationdate},'iso')->output,
+    authorisedby         => $basket->{'authorisedby'},
+    authorisedbyname     => $basket->{'authorisedbyname'},
+    closedate            => C4::Dates->new($basket->{'closedate'},'iso')->output,
+    # order details
     suggestionid     => $suggestionid,
     biblionumber     => $biblionumber,
     uncertainprice   => $data->{'uncertainprice'},
     authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'},
-       biblioitemnumber => $data->{'biblioitemnumber'},
-    itemtype         => $data->{'itemtype'},
-    itemtype_desc    => $itemtypes->{$data->{'itemtype'}}->{description},
+    biblioitemnumber => $data->{'biblioitemnumber'},
     discount_2dp     => sprintf( "%.2f",  $bookseller->{'discount'}) ,   # for display
     discount         => $bookseller->{'discount'},
     listincgst       => $bookseller->{'listincgst'},
     invoiceincgst    => $bookseller->{'invoiceincgst'},
-    invoicedisc      => $bookseller->{'invoicedisc'},
-    nocalc           => $bookseller->{'nocalc'},
     name             => $bookseller->{'name'},
-    cur_active_sym   => $cur->{symbol},
-    cur_active       => $cur->{currency},
+    cur_active_sym   => $cur->{'symbol'},
+    cur_active       => $cur->{'currency'},
     currency         => $bookseller->{'listprice'}, # eg: 'EUR'
     loop_currencies  => \@loop_currency,
     orderexists      => ( $new eq 'yes' ) ? 0 : 1,
     title            => $data->{'title'},
     author           => $data->{'author'},
-    copyrightdate    => $data->{'copyrightdate'},
+    publicationyear  => $data->{'publicationyear'},
     budget_dropbox   => $budget_dropbox,
     isbn             => $data->{'isbn'},
     seriestitle      => $data->{'seriestitle'},
     quantity         => $data->{'quantity'},
     quantityrec      => $data->{'quantity'},
-
-
     rrp              => $data->{'rrp'},
-    list_price       => sprintf("%.2f", $data->{'listprice'}), # watch the '-'
-    total            => sprintf("%.2f", $data->{ecost}*$data->{quantity} ),
-    invoice          => $data->{'booksellerinvoicenumber'},
+    list_price       => sprintf("%.2f", $data->{'listprice'}||$listprice),
+    total            => sprintf("%.2f", $data->{'ecost'}*$data->{'quantity'} ),
     ecost            => $data->{'ecost'},
-    purchaseordernumber => $data->{'purchaseordernumber'},
     notes            => $data->{'notes'},
     publishercode    => $data->{'publishercode'},
-
+    
+    import_batch_id  => $import_batch_id,
 
 # CHECKME: gst-stuff needs verifing, mason.
-    gstrate          => $bookseller->{gstrate} || C4::Context->preference("gist"),
+    gstrate          => $bookseller->{'gstrate'} || C4::Context->preference("gist"),
     gstreg           => $bookseller->{'gstreg'},
-
-#     donation         => $donation
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
@@ -426,7 +408,7 @@ sub MARCfindbreeding {
                 $record->insert_fields_ordered($f100);
             }
         }
-               
+        
         if ( !defined(ref($record)) ) {
             return -1;
         }
@@ -437,28 +419,28 @@ sub MARCfindbreeding {
             {
                 my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author");
 
- #                 my $summary = C4::Context->preference("z3950authortemplate");
+#                 my $summary = C4::Context->preference("z3950authortemplate");
                 my $auth_fields =
-                  C4::Context->preference("z3950AuthorAuthFields");
+                C4::Context->preference("z3950AuthorAuthFields");
                 my @auth_fields = split /,/, $auth_fields;
                 my $field;
 
                 if ( $record->field($tag) ) {
                     foreach my $tmpfield ( $record->field($tag)->subfields ) {
 
-       #                        foreach my $subfieldcode ($tmpfield->subfields){
+    #                        foreach my $subfieldcode ($tmpfield->subfields){
                         my $subfieldcode  = shift @$tmpfield;
                         my $subfieldvalue = shift @$tmpfield;
                         if ($field) {
                             $field->add_subfields(
                                 "$subfieldcode" => $subfieldvalue )
-                              if ( $subfieldcode ne $subfield );
+                            if ( $subfieldcode ne $subfield );
                         }
                         else {
                             $field =
-                              MARC::Field->new( $tag, "", "",
+                            MARC::Field->new( $tag, "", "",
                                 $subfieldcode => $subfieldvalue )
-                              if ( $subfieldcode ne $subfield );
+                            if ( $subfieldcode ne $subfield );
                         }
                     }
                 }
@@ -474,15 +456,15 @@ sub MARCfindbreeding {
 #                         $field->add_subfields("$subfield"=>"[ ".ucfirst($title).ucfirst($firstname)." ".$number." ]");
                         $field->add_subfields(
                                 "$subfield" => ucfirst($title) . " "
-                              . ucfirst($firstname) . " "
-                              . $number );
+                            . ucfirst($firstname) . " "
+                            . $number );
                     }
                     else {
 
 #                       $field->add_subfields("$subfield"=>"[ ".ucfirst($firstname).", ".ucfirst($lastname)." ]");
                         $field->add_subfields(
                             "$subfield" => ucfirst($firstname) . ", "
-                              . ucfirst($lastname) );
+                            . ucfirst($lastname) );
                     }
                 }
                 $record->insert_fields_ordered($field);
index dce702b..12cf936 100644 (file)
@@ -50,7 +50,7 @@ function isNum(v,maybenull) {
     if (maybenull==0 && v.value=='') {
 
 
-     return false;
+    return false;
     }
     return true;
 }
@@ -417,7 +417,7 @@ function enterpressed(event){
 
     if (keycode == 13)
     {
-         return true;
+        return true;
     }
     else return false;
 }
@@ -603,12 +603,12 @@ function rename(event, bgid, name){
 function log(message) {
     if (!log.window_ || log.window_.closed) {
         var win = window.open("", null, "width=400,height=200," +
-                              "scrollbars=yes,resizable=yes,status=no," +
-                              "location=no,menubar=no,toolbar=no");
+                            "scrollbars=yes,resizable=yes,status=no," +
+                            "location=no,menubar=no,toolbar=no");
         if (!win) return;
         var doc = win.document;
         doc.write("<html><head><title>Debug Log</title></head>" +
-                  "<body></body></html>");
+                "<body></body></html>");
         doc.close();
         log.window_ = win;
     }
@@ -621,7 +621,7 @@ function log(message) {
 
 
     function ownerPopup(f) {
-      window.open("/cgi-bin/koha/admin/aqbudget_owner_search.pl?op=budget",'PatronPopup','width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+    window.open("/cgi-bin/koha/admin/aqbudget_owner_search.pl?op=budget",'PatronPopup','width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
     }
         //
 //=======================================================================
@@ -669,7 +669,7 @@ function calcTotalRow(cell) {
         remainingTotal.style.color = 'black';
     }
     else if ( remainingNew   > 0   )       {
-         remainingTotal.style.color = 'green';
+        remainingTotal.style.color = 'green';
     } else  {    // if its negative, make it red..
         remainingTotal.style.color = 'red';
     }
@@ -724,74 +724,75 @@ function messenger(X,Y,etc){    // FIXME: unused?
 
 //  NEXT BLOCK IS USED BY NEWORDERBEMPTY
 
-function calcNeworderTotal(f){
-       //collect values
-       var quantity = new Number(f.quantity.value);
-       var discount = new Number(f.discount.value);
-       var listinc  = new Number (f.listinc.value);
-       var currency = f.currency.value;
-       var applygst = new Number (f.applygst.value);
-       var list_price   =  new Number(f.list_price.value);
-       var invoiceingst =  new Number (f.invoiceincgst.value);
-       var exchangerate =  new Number(f.elements[currency].value);      //get exchange rate
-       var gst_on=(!listinc && invoiceingst);
-
-       //do real stuff
-       var rrp   = new Number(list_price*exchangerate);
-       var ecost = new Number(rrp * (100 - discount ) / 100);
-       var GST   = new Number(0);
-       if (gst_on) {
-           rrp=rrp * (1+f.gstrate.value / 100);
-           GST=ecost * f.gstrate.value / 100;
-       }
-
-       var total =  new Number( (ecost + GST) * quantity);
-
-       f.rrp.value = rrp.toFixed(2);
+function calcNeworderTotal(){
+    //collect values
+    var f        = document.getElementById('Aform');
+    var quantity = new Number(f.quantity.value);
+    var discount = new Number(f.discount.value);
+    var listinc  = new Number (f.listinc.value);
+    var currency = f.currency.value;
+    var applygst = new Number (f.applygst.value);
+    var list_price   =  new Number(f.list_price.value);
+    var invoiceingst =  new Number (f.invoiceincgst.value);
+    var exchangerate =  new Number(f.elements[currency].value);      //get exchange rate
+    var gst_on=(!listinc && invoiceingst);
+
+    //do real stuff
+    var rrp   = new Number(list_price*exchangerate);
+    var ecost = new Number(rrp * (100 - discount ) / 100);
+    var GST   = new Number(0);
+    if (gst_on) {
+            rrp=rrp * (1+f.gstrate.value / 100);
+        GST=ecost * f.gstrate.value / 100;
+    }
+
+    var total =  new Number( (ecost + GST) * quantity);
+
+    f.rrp.value = rrp.toFixed(2);
 
 //     f.rrp.value = rrp
 //     f.rrp.value = 'moo'
 
-       f.ecost.value = ecost.toFixed(2);
-       f.total.value = total.toFixed(2);
-       f.list_price.value =  list_price.toFixed(2);
+    f.ecost.value = ecost.toFixed(2);
+    f.total.value = total.toFixed(2);
+    f.list_price.value =  list_price.toFixed(2);
 
 //  gst-stuff needs verifing, mason.
-       if (f.GST) {
-               f.GST.value=GST;
+    if (f.GST) {
+        f.GST.value=GST;
     }
-       return true;
+    return true;
 }
 
 // ----------------------------------------
 //USED BY NEWORDEREMPTY.PL
 /*
 function fetchSortDropbox(f) {
-       var  budgetId=f.budget_id.value;
-       var handleSuccess = function(o){
-       if(o.responseText !== undefined){
-           sort_dropbox.innerHTML   = o.responseText;
-           }
-       }
-
-       var callback = {   success:handleSuccess };
+    var  budgetId=f.budget_id.value;
+    var handleSuccess = function(o){
+        if(o.responseText !== undefined){
+            sort_dropbox.innerHTML   = o.responseText;
+        }
+    }
+
+    var callback = {   success:handleSuccess };
     var sUrl = '../acqui/fetch_sort_dropbox.pl?sort=1&budget_id='+budgetId
     var sort_dropbox = document.getElementById('sort1');
     var request1 = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
-       var rr = '00';
+    var rr = '00';
 
 // FIXME: ---------  twice , coz the 2 requests get mixed up otherwise
 
-       var handleSuccess2 = function(o){
+    var handleSuccess2 = function(o){
     if(o.responseText !== undefined){
         sort2_dropbox.innerHTML   = o.responseText;
-       }
-       }
+        }
+    }
 
-       var callback2 = {   success:handleSuccess };
-       var sUrl2 = '../acqui/fetch_sort_dropbox.pl?sort=2&budget_id='+budgetId;
-       var sort2_dropbox = document.getElementById('sort2');
-       var request2 = YAHOO.util.Connect.asyncRequest('GET', sUrl2, callback2);
+    var callback2 = {   success:handleSuccess };
+    var sUrl2 = '../acqui/fetch_sort_dropbox.pl?sort=2&budget_id='+budgetId;
+    var sort2_dropbox = document.getElementById('sort2');
+    var request2 = YAHOO.util.Connect.asyncRequest('GET', sUrl2, callback2);
 
 }
 */
@@ -802,7 +803,7 @@ function fetchSortDropbox(f) {
 function fetchSortDropbox(f) {
     var  budgetId=f.budget_id.value;
 
- for (i=1;i<=2;i++) {
+for (i=1;i<=2;i++) {
 
     var sort_dropbox = document.getElementById('sort'+i);
     var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
@@ -818,14 +819,14 @@ function fetchSortDropbox(f) {
 
     xmlhttp.onreadystatechange = function() {
         if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
-      // stupid JS...
-          } else {
-      // wait for the call to complete
-          }
-     };
-     // rc =  eval ( xmlhttp.responseText );
+    // stupid JS...
+        } else {
+    // wait for the call to complete
+        }
+    };
+    // rc =  eval ( xmlhttp.responseText );
     sort_dropbox.innerHTML  =  xmlhttp.responseText;
- }
+}
 }
 
 
@@ -852,12 +853,12 @@ function totalExceedsBudget(budgetId, total) {
 
             actTotal = eval ( xmlhttp.responseText );
 
-               if (  Math.abs(actTotal) < Math.abs(total)  ) {
-               // if budget is to low :(
-                   return true ;
-           } else {
-                   return false;
-           }
+            if (  Math.abs(actTotal) < Math.abs(total)  ) {
+            // if budget is to low :(
+                return true ;
+            } else {
+                return false;
+            }
         }
     }
 }
@@ -887,22 +888,22 @@ if ( newBudgetParent  ) { url +=  '&parent_id=' + newBudgetParent};
     xmlhttp.send(null);
 
     xmlhttp.onreadystatechange = function() {
-          if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
-      // stupid JS...
-          } else {
-      // wait for the call to complete
-          }
-     };
+        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+    // stupid JS...
+        } else {
+    // wait for the call to complete
+        }
+    };
 
     var result = eval ( xmlhttp.responseText );
 
-     if (result == '1') {
+    if (result == '1') {
             return _("- Budget total exceeds parent allocation\n");
-     } else if (result == '2') {
+    } else if (result == '2') {
             return _("- Budget total exceeds period allocation\n");
-     } else  {
-             return false;
-     }
+    } else  {
+            return false;
+    }
 }
 
 
@@ -921,22 +922,22 @@ function checkBudgetParent(budgetId, newBudgetParent) {
     xmlhttp.send(null);
 
     xmlhttp.onreadystatechange = function() {
-          if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
-      // do something with the results
-          } else {
-      // wait for the call to complete
-          }
-     };
+        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+    // do something with the results
+        } else {
+    // wait for the call to complete
+        }
+    };
 
-     var result = eval ( xmlhttp.responseText );
+    var result = eval ( xmlhttp.responseText );
 
-     if (result == '1') {
+    if (result == '1') {
             return _("- New budget-parent is beneath budget\n");
 //     } else if (result == '2') {
 //            return "- New budget-parent has insufficent funds\n";
 //     } else  {
 //              return false;
-     }
+    }
 }
 
 
index 42380e7..16d490a 100644 (file)
@@ -6,50 +6,6 @@
  &rsaquo; Batch List
 <!-- /TMPL_IF -->
 </title>
-<!-- <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/additem.js"></script> -->
-<script type="text/javascript">
-//need to override cloneItemBlock to not generate a random itemid
-function cloneItemBlock(index) {    
-    var original = document.getElementById('itemblock-' + index); //original <div>
-    var clone = original.cloneNode(true);
-    var random = Math.floor(Math.random()*100000); // get a random itemid.
-    // set the attribute for the new 'div' subfields
-    clone.setAttribute('id','itemblock-' + index + '-' + random);//set another id.
-    var NumTabIndex;
-    NumTabIndex = parseInt(original.getAttribute('tabindex'));
-    if(isNaN(NumTabIndex)) NumTabIndex = 0;
-    clone.setAttribute('tabindex',NumTabIndex+1);
-    var CloneButtonPlus;
-    var CloneButtonMinus;
-        CloneButtonPlus = clone.getElementsByTagName('a')[0];
-        CloneButtonPlus.setAttribute('onclick',"cloneItemBlock('" + index  + '-' +  random + "')");
-    CloneButtonMinus = clone.getElementsByTagName('a')[1];
-    CloneButtonMinus.setAttribute('onclick',"deleteItemBlock('" + index + '-' + random + "')");
-    CloneButtonMinus.setAttribute('style',"display:inline");
-    // change itemids of the clone
-    var elems = clone.getElementsByTagName('input');
-    for( i = 0 ; elems[i] ; i++ )
-    {
-        if(elems[i].name.match(/^itemid/)) {
-            elems[i].value += "-" + random;
-        }
-    }
-    var itemid = index.split("-");
-    itemid=itemid[0];
-    original.parentNode.insertBefore(clone,original.nextSibling);
-    var quantityrec = document.getElementById('quantityrec-' + itemid);
-    quantityrec.setAttribute('value',parseFloat(quantityrec.getAttribute('value'))+1);
-}
-function deleteItemBlock(index) {
-    var aDiv = document.getElementById('itemblock-' + index);
-    var elems = aDiv.getElementsByTagName('input');
-    var itemid = index.split("-");
-    itemid=itemid[0];
-    aDiv.parentNode.removeChild(aDiv);
-    var quantityrec = document.getElementById('quantityrec-' + itemid);
-    quantityrec.setAttribute('value',parseFloat(quantityrec.getAttribute('value'))-1);
-}
-</script>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
@@ -59,14 +15,12 @@ function deleteItemBlock(index) {
    <div id="bd">
        <div id="yui-main">
            <div class="yui-b">
-             <h1>Add orders from iso2709 file</h1>
+             <h1>Add orders from staged file: <!-- TMPL_VAR name="comments" --></h1>
              <!-- TMPL_IF name="batch_details" -->
-               <h2>From batch id <!-- TMPL_VAR name="import_batch_id" --></h2>
                <div>
                      <dl>
-                       <dd><strong>File name</strong><!-- TMPL_VAR name="file_name" --></dd>
-                       <dd><strong>Comments</strong><!-- TMPL_VAR name="comments" --></dd>
-                       <dd><strong>Staged</strong><!-- TMPL_VAR name="upload_timestamp" --></dd>
+                       <dd><strong>File name:</strong> <!-- TMPL_VAR name="file_name" --></dd>
+                       <dd><strong>Staged on:</strong> <!-- TMPL_VAR name="upload_timestamp" --></dd>
                      </dl>
                </div>
                <div>
@@ -76,52 +30,17 @@ function deleteItemBlock(index) {
                          <th>#</th>
                          <th>Citation</th>
                          <th>Match?</th>
-                         <th>Order?</th>
+                         <th>Order</th>
                        </tr>
                        <!-- TMPL_LOOP name="biblio_list" -->
                          <tr>
                              <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=<!-- TMPL_VAR name="import_record_id" -->" rel="gb_page_center[600,500]"><!-- TMPL_VAR name="record_sequence"--></a></td>
                              <td>
                                 <!-- TMPL_VAR name="citation"-->
-                                    <!-- TMPL_IF name="items" -->
-                                    <fieldset class="rows">
-                                        <label>Itemtype</label>
-                                        <select id="itemtype-<!-- TMPL_VAR name="import_record_id" -->" name="itemtype-<!-- TMPL_VAR name="import_record_id" -->" >
-                                            <!-- TMPL_LOOP name="itemtypes" -->
-                                                <option value="<!-- TMPL_VAR name="itemtype" -->"><!-- TMPL_VAR name="description" --></option>
-                                            <!-- /TMPL_LOOP -->
-                                        </select>
-                                        <!-- TMPL_LOOP NAME="items" -->
-                                        <div id="outeritemblock">
-                                        <div id="itemblock-<!-- TMPL_VAR name="import_record_id" -->">
-                                            <ol><!-- TMPL_LOOP NAME="iteminformation" --><li>
-                                                <div class="subfield_line" style="<!-- TMPL_VAR NAME='hidden' -->;" id="subfield<!-- TMPL_VAR NAME='serialid' --><!-- TMPL_VAR NAME='countitems' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->">
-                                                    <label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
-                                                    <!-- TMPL_VAR NAME="marc_value" -->
-                                                    <input type="hidden" name="itemid" value="<!-- TMPL_VAR name="import_record_id" -->" />
-                                                    <input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
-                                                    <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->" />
-                                                    <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" />
-                                                    <input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
-                                                    <!-- TMPL_IF NAME="ITEM_SUBFIELDS_ARE_NOT_REPEATABLE" -->
-                                                        <span class="buttonPlus" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='serialid' --><!-- TMPL_VAR NAME='countitems' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')">+</span>
-                                                    <!-- /TMPL_IF -->
-                                                </div></li>
-                                            <!-- /TMPL_LOOP-->
-                                            </ol>
-                                            <a style="cursor: pointer; color: grey; font-size: 180%;" onclick="cloneItemBlock('<!-- TMPL_VAR name="import_record_id" -->')">+</a>
-                                            <a style="display:none; cursor: pointer; color: grey; font-size: 180%;" onclick="deleteItemBlock('itemblock-<!-- TMPL_VAR name="import_record_id" -->')">-</a>
-                                        </div><!-- /iteminformation -->
-                                        </div>
-                                        
-                                        <input type="hidden" name="quantityrec-<!-- TMPL_VAR name="import_record_id" -->" id="quantityrec-<!-- TMPL_VAR name="import_record_id" -->" value="1" />
-                                        <!--/TMPL_LOOP--> <!-- /items -->
-                                    </fieldset>
-                                    <!-- /TMPL_IF --> <!-- items -->
 
                              </td>
                              <td><!-- TMPL_VAR name="overlay_status"--></td>
-                             <td><input type="checkbox" name="order-<!-- TMPL_VAR name="import_record_id" -->" value="1" checked /></td>
+                             <td><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=<!--TMPL_VAR name="booksellerid" -->&basketno=<!-- TMPL_VAR name="basketno" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->&breedingid=<!-- TMPL_VAR name="import_record_id" -->&import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->">Add order</a></td>
                          </tr>
                          <!-- TMPL_IF name="match_biblionumber" -->
                            <tr>
@@ -131,9 +50,6 @@ function deleteItemBlock(index) {
                          <!-- /TMPL_IF -->
                        <!-- /TMPL_LOOP -->
                      </table>
-                     <input type="hidden" name="op" value="import_records" />
-                     <input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
-                     <input type="hidden" name="basketno" value="<!-- TMPL_VAR name="basketno" -->" />
                      <input type="button" value="Save" onclick="this.form.submit()" />
                    </form>
                </div>
@@ -152,23 +68,21 @@ function deleteItemBlock(index) {
                <div>
                    <table>
                      <tr>
-                       <th>#</th>
                        <th>File name</th>
                        <th>Comments</th>
                        <th>Status</th>
                        <th>Staged</th>
                        <th># Bibs</th>
-                       <th># Items</th>
+                       <th>&nbsp;</th>
                      </tr>
                      <!-- TMPL_LOOP name="batch_list" -->
                      <tr>
-                       <td><a href="<!-- TMPL_VAR name="scriptname" -->?import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->&basketno=<!-- TMPL_VAR name="basketno" -->"><!-- TMPL_VAR name="import_batch_id" --></a></td>
-                       <td><!-- TMPL_VAR name="file_name" --></td>
+                        <td><!-- TMPL_VAR name="file_name" --></td>
                        <td><!-- TMPL_VAR name="comments" --></td>
                        <td><!-- TMPL_VAR name="import_status" --></td>
                        <td><!-- TMPL_VAR name="upload_timestamp" --></td>
                        <td><!-- TMPL_VAR name="num_biblios" --></td>
-                       <td><!-- TMPL_VAR name="num_items" --></td>
+                       <td><a href="<!-- TMPL_VAR name="scriptname" -->?import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->&basketno=<!-- TMPL_VAR name="basketno" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Add orders</a></td>
                      </tr>
                      <!-- /TMPL_LOOP -->
                    </table>
index d07f2ad..b42e473 100644 (file)
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!-- TMPL_VAR NAME="booksellerid" -->"><!-- TMPL_VAR NAME="name" --></a> &rsaquo; <!-- TMPL_UNLESS name="basketno" -->New <!-- /TMPL_UNLESS --><!-- TMPL_IF NAME="delete_confirm" -->Delete <!-- /TMPL_IF -->Basket <!-- TMPL_VAR NAME="basketname" --> (<!-- TMPL_VAR NAME="basketno" -->) for <!-- TMPL_VAR NAME="name" --></div>
 
 <div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
+
+<div id="bd">
+    <div id="yui-main">
+    <div class="yui-b">
         <!-- TMPL_UNLESS name="confirm_close" -->
         <!-- TMPL_UNLESS name="selectbasketg" -->
             <!-- TMPL_UNLESS name="closedate" -->
             </span>
             </h2>
         <!-- /TMPL_IF -->
-        <!-- TMPL_IF NAME="basketno" --><div id="acqui_basket_summary">
-            <h2>Basket Details</h2>
-                       <!-- TMPL_IF NAME="basketnote" --><p>Internal note: <!-- TMPL_VAR NAME="basketnote" --></p><!-- /TMPL_IF -->
-                       <!-- TMPL_IF NAME="basketbooksellernote" --><p>Bookseller note: <!-- TMPL_VAR NAME="basketbooksellernote" --></p><!-- /TMPL_IF -->
-            <!-- TMPL_IF NAME="basketcontractno" -->
-            <p>Contract number: <!-- TMPL_VAR NAME="basketcontractno" --></p>
-            <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
-            <!-- /TMPL_IF -->
-                       <!-- TMPL_IF NAME="authorisedbyname" --><p>Managed by:  <!-- TMPL_VAR NAME="authorisedbyname" --></p><!-- /TMPL_IF -->
-                       <!-- TMPL_IF NAME="creationdate" --><p>Open on:  <!-- TMPL_VAR NAME="creationdate" --></p><!-- /TMPL_IF -->
-                       <!-- TMPL_IF NAME="booksellerid" --><p>For vendor ID: <!-- TMPL_VAR NAME="booksellerid" --></p><!-- /TMPL_IF -->
-                       <!-- TMPL_IF NAME="booksellerinvoicenumber" --><p>Invoice number: <!-- TMPL_VAR NAME="booksellerinvoicenumber" --></p><!-- /TMPL_IF -->
-            <!-- TMPL_IF name="closedate" -->
-            <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
-            <p>Closed On:  <!-- TMPL_VAR name="closedate" --></p>
-            <!-- TMPL_IF name="basketgroups" -->
-                <p> basketgroup: <select id="basketgroupid" name="basketgroupid">
-                    <!-- TMPL_LOOP name="basketgroups" -->
-                        <!-- TMPL_IF name="default" -->
-                        <option value="<!-- TMPL_VAR name="id" -->" selected="selected"><!-- TMPL_VAR name="name" --></option>
-                        <!-- TMPL_ELSE -->
-                        <option value="<!-- TMPL_VAR name="id" -->"><!-- TMPL_VAR name="name" --></option>
-                        <!-- /TMPL_IF -->
-                    <!-- /TMPL_LOOP -->
-                    </select>
-                    <input type="hidden" id="basketno" value="<!-- TMPL_VAR name="basketno" -->" name="basketno" />
-                    <input type="hidden" value="mod_basket" name="op" />
-                    <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR name="booksellerid" -->" />
-                    <input type="submit" value="Change basketgroup" />
-                </p>
-            </form>
-            <!-- /TMPL_IF -->
-            <!-- /TMPL_IF -->
-            <p>Number of orders: <!-- TMPL_VAR name="count" --></p>
-        </div><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="basketno" -->
+            <div id="acqui_basket_summary"  class="yui-g">
+                <h2>Basket details</h2>
+                <!-- TMPL_IF NAME="basketnote" --><p>Internal note: <!-- TMPL_VAR NAME="basketnote" --></p><!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="basketbooksellernote" --><p>Bookseller note: <!-- TMPL_VAR NAME="basketbooksellernote" --></p><!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="basketcontractno" -->
+                    <p>Contract number: <!-- TMPL_VAR NAME="basketcontractno" --></p>
+                    <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
+                <!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="authorisedbyname" --><p>Managed by:  <!-- TMPL_VAR NAME="authorisedbyname" --></p><!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="creationdate" --><p>Open on:  <!-- TMPL_VAR NAME="creationdate" --></p><!-- /TMPL_IF -->
+                <!-- TMPL_IF name="closedate" -->
+                <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
+                <p>Closed on:  <!-- TMPL_VAR name="closedate" --></p>
+                <!-- TMPL_IF name="basketgroups" -->
+                    <p> basketgroup: <select id="basketgroupid" name="basketgroupid">
+                        <!-- TMPL_LOOP name="basketgroups" -->
+                            <!-- TMPL_IF name="default" -->
+                            <option value="<!-- TMPL_VAR name="id" -->" selected="selected"><!-- TMPL_VAR name="name" --></option>
+                            <!-- TMPL_ELSE -->
+                            <option value="<!-- TMPL_VAR name="id" -->"><!-- TMPL_VAR name="name" --></option>
+                            <!-- /TMPL_IF -->
+                        <!-- /TMPL_LOOP -->
+                        </select>
+                        <input type="hidden" id="basketno" value="<!-- TMPL_VAR name="basketno" -->" name="basketno" />
+                        <input type="hidden" value="mod_basket" name="op" />
+                        <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR name="booksellerid" -->" />
+                        <input type="submit" value="Change basketgroup" />
+                    </p>
+                </form>
+                <!-- /TMPL_IF -->
+                <!-- /TMPL_IF -->
+            </div>
+        <!-- /TMPL_IF -->
         
         <!-- TMPL_UNLESS name="delete_confirm" -->
         <div id="acqui_basket_content">
         <h2>Order Details</h2>
         <!-- TMPL_IF name="books_loop" -->
             <table id="orders">
-               <thead>
-                           <tr>
-                               <th>Order</th>
-                               <th>Title</th>
-                               <th>ISBN</th>
-                               <th>Publisher</th>
-                               <th>RRP</th>
-                               <th>Est.</th>
-                               <th>Qty.</th>
-                               <th>Total</th>
-                               <th>Budget</th>
-                               <!-- TMPL_IF name="active" -->
-                                   <!-- TMPL_UNLESS name="closedate" -->
-                                       <th>Modify</th>
-                                       <th>Delete</th>
-                                   <!-- /TMPL_UNLESS -->
-                               <!-- /TMPL_IF -->
-                           </tr>
+                <thead>
+                    <tr>
+                        <th>Order</th>
+                        <th>RRP</th>
+                        <th>Est.</th>
+                        <th>Qty.</th>
+                        <th>Total</th>
+                        <th>Budget</th>
+                        <!-- TMPL_IF name="active" -->
+                            <!-- TMPL_UNLESS name="closedate" -->
+                                <th>Modify</th>
+                                <th>Delete</th>
+                            <!-- /TMPL_UNLESS -->
+                        <!-- /TMPL_IF -->
+                    </tr>
                 </thead>
                 <tbody>
                 <!-- TMPL_LOOP NAME="books_loop" -->
                     <!-- TMPL_IF NAME="order_received" --><tr class="disabled"><!-- TMPL_ELSE --><!-- TMPL_IF NAME="toggle" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF --><!-- /TMPL_IF -->
-                        <td><!-- TMPL_VAR NAME="ordernumber" -->
-                                <!-- TMPL_IF NAME="order_received" --> (rcvd)<!-- /TMPL_IF --></td>
-                            <td>
-                                <p>
-                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a></p>
-                                    <p><!-- TMPL_VAR NAME="author" -->
-                                    <!-- TMPL_IF name="notes" --></p><p><!--TMPL_VAR name="notes" --><!-- /TMPL_IF -->
-                                </p>
+                        <td>
+                            <p><!-- TMPL_IF NAME="order_received" --> (rcvd)<!-- /TMPL_IF -->
+                                <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a> by <!-- TMPL_VAR NAME="author" -->
+                                    <!-- TMPL_IF name="notes" --> <!--TMPL_VAR name="notes" --><!-- /TMPL_IF -->
+                                    <!-- TMPL_IF name="isbn"--> - <!-- TMPL_VAR name="isbn" --><!-- /TMPL_IF -->
+                                    <!-- TMPL_IF name="publishercode" -->, <!-- TMPL_VAR NAME="publishercode" --><!-- /TMPL_IF -->
+                                    <!-- TMPL_IF name="publicationyear" -->, <!-- TMPL_VAR NAME="publicationyear" --><!-- /TMPL_IF -->
+                            </p>
                             </td>
-                        <td><!-- TMPL_IF name="isbn"--><!-- TMPL_VAR name="isbn" --><!-- /TMPL_IF --></td>
-                        <td><!-- TMPL_VAR NAME="publishercode" --></td>
                         <td class="number"><!-- TMPL_VAR NAME="rrp" --></td>
                         <td class="number"><!-- TMPL_VAR NAME="ecost" --></td>
                         <td class="number"><!-- TMPL_VAR NAME="quantity" --></td>
                 <!-- /TMPL_LOOP -->
                 </tbody>
                 <tr>
-                    <td colspan="2" rowspan="3">
-                        <input type="hidden" name="number" value="<!-- TMPL_VAR NAME="count" -->" />
-                        <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
-                    </td>
-                    <th colspan="2">Total GST Exc.</th>
+                    <th>Total GST Exc.</th>
                     <th><!-- TMPL_VAR NAME="total_rrp_gste" --></th>
                     <th>&nbsp;</th>
                     <th><!-- TMPL_VAR name="qty_total" --></th>
                         <!-- /TMPL_IF -->
                 </tr>
                 <tr>
-                    <th colspan="2">GST (<!-- TMPL_VAR NAME="gist_rate" -->)</th>
+                    <th>GST (<!-- TMPL_VAR NAME="gist_rate" -->)</th>
                     <th><!-- TMPL_VAR NAME="gist_rrp" --></th>
                     <th>&nbsp;</th>
                     <th>&nbsp;</th>
                     <th><!-- TMPL_VAR NAME="gist_est" --></th>
                 </tr>
                 <tr>
-                    <th colspan="2">Total GST Inc. (<!-- TMPL_VAR NAME="currency" -->)</th>
+                    <th>Total GST Inc. (<!-- TMPL_VAR NAME="currency" -->)</th>
                     <th><!-- TMPL_VAR NAME="total_rrp_gsti" --></th>
                     <th>&nbsp;</th>
                     <th><!-- TMPL_VAR name="qty_total" --></th>
 <!-- /TMPL_IF -->    <!-- TMPL_ELSE --> <!-- if we want just to select a basketgroup for a closed basket -->
     <!-- /TMPL_UNLESS -->
 <!-- TMPL_IF name="confirm_close" -->
-           <div id="closebasket_needsconfirmation" class="dialog alert">
+        <div id="closebasket_needsconfirmation" class="dialog alert">
+
+        <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm">
+        <fieldset>
+        <legend>Closing basket <!-- TMPL_VAR name="basketname" --></legend>
+            <p>Are you sure you want to close this basket ?</p>
+            <p>
+            <label for="createorder">Create order ?</label>
+            <input type="checkbox" id="createorder" name="createorder"/>
+            </p>
+            <input type="hidden" id="basketno" value="<!-- TMPL_VAR name="basketno" -->" name="basketno" />
+            <input type="hidden" value="close" name="op" />
+            <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR name="booksellerid" -->" />
+            <input type="hidden" name="confirm" value="1" />
+            <input type="hidden" name="basketgroupname" value="<!-- TMPL_VAR name="basketgroupname" -->" />
+            <input type="submit" class="approve" value="Yes, Close (Y)" accesskey="y" />
+            <input type="submit" class="deny" value="No, Don't Close (N)" accesskey="n" onclick="javascript:window.location='/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR name="basketno" -->';return false;" />
+        </fieldset>
+        </form>
+        </div>
+    <!-- /TMPL_IF -->
 
-           <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm">
-           <fieldset>
-               <legend>Closing basket <!-- TMPL_VAR name="basketname" --></legend>
-                   <p>Are you sure you want to close this basket ?</p>
-                   <p>
-                       <label for="createorder">Create order ?</label>
-                       <input type="checkbox" id="createorder" name="createorder"/>
-                   </p>
-                   <input type="hidden" id="basketno" value="<!-- TMPL_VAR name="basketno" -->" name="basketno" />
-                   <input type="hidden" value="close" name="op" />
-                   <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR name="booksellerid" -->" />
-                   <input type="hidden" name="confirm" value="1" />
-                   <input type="hidden" name="basketgroupname" value="<!-- TMPL_VAR name="basketgroupname" -->" />
-                   <input type="submit" class="approve" value="Yes, Close (Y)" accesskey="y" />
-                   <input type="submit" class="deny" value="No, Don't Close (N)" accesskey="n" onclick="javascript:window.location='/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR name="basketno" -->';return false;" />
-           </fieldset>
-           </form>
-           </div>
-       <!-- /TMPL_IF -->
-  
 
 
 </div>
index 87528c9..4d159af 100644 (file)
@@ -135,7 +135,7 @@ li.list2 {
                 <!-- TMPL_IF NAME="contractloop" -->
                     <li><label for="basketcontractnumber">Contract</label>
                         <select id="basketcontractnumber" name="basketcontractnumber">
-                            <option value="">No contract</option>
+                            <option value=""></option>
                             <!-- TMPL_LOOP NAME="contractloop" -->
                                 <!-- TMPL_IF NAME="selected" -->
                                     <option value="<!-- TMPL_VAR NAME="contractnumber" -->" selected="selected"><!-- TMPL_VAR NAME="contractname" --></option>
index 29b9c82..87e93da 100644 (file)
@@ -6,7 +6,7 @@
 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/additem.js"></script>
 <script type="text/javascript">
 //<![CDATA[
- actTotal = "";
+actTotal = "";
 
 function Check(ff) {
     var ok=0;
@@ -34,17 +34,17 @@ function Check(ff) {
                     _alertString += "\n- " + _("Total must be a number");
     }
 
-       if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
-       ok=1;
-       _alertString += "\n- " + "Order total (" + ff.total.value + ") exceeds budget available ("+actTotal+")";
+    if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
+        ok=1;
+        _alertString += "\n- " + "Order total (" + ff.total.value + ") exceeds budget available ("+actTotal+")";
     }
 
-   if (ok) {
+if (ok) {
         alert(_alertString);
     return false;
     }
 
-   ff.submit();
+ff.submit();
 
 }
 
@@ -52,7 +52,7 @@ function Check(ff) {
 //]]>
 </script>
 </head>
-<body>
+<body onload="calcNeworderTotal()">
 
 <div  name="<!-- TMPL_VAR NAME="ordnum" -->" >
 
@@ -63,9 +63,9 @@ function Check(ff) {
 
 <div id="doc3" class="yui-t2">
 
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
+<div id="bd">
+    <div id="yui-main">
+    <div class="yui-b">
 
 <h1>
     <!-- TMPL_IF name="ordnum" -->
@@ -78,59 +78,77 @@ function Check(ff) {
 
 <!-- TMPL_IF name="basketno" -->
 <fieldset class="rows">
-<div id="basket-details">Basket Details
-  <ul>  <li>Basket number: <!-- TMPL_VAR NAME="basketno" --></li>
-    <li>Managed by: <!-- TMPL_VAR NAME="authorisedbyname" --></li>
-    <li>Open on: <!-- TMPL_VAR NAME="creationdate" --></li>
-    <li>For vendor ID: <!-- TMPL_VAR NAME="booksellerid" --></li>
-    <li>Invoice number: <!-- TMPL_VAR NAME="booksellerinvoicenumber" --></li>
-    <!-- TMPL_IF name="closedate" --><li>Closed on: <!-- TMPL_VAR name="closedate" --></li><!-- /TMPL_IF --></ul>
-</div>
+    <div id="acqui_basket_summary"  class="yui-g">
+        <h2>Basket details</h2>
+        <!-- TMPL_IF NAME="basketnote" --><p>Internal note: <!-- TMPL_VAR NAME="basketnote" --></p><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="basketbooksellernote" --><p>Bookseller note: <!-- TMPL_VAR NAME="basketbooksellernote" --></p><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="basketcontractno" -->
+            <p>Contract number: <!-- TMPL_VAR NAME="basketcontractno" --></p>
+            <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
+        <!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="authorisedbyname" --><p>Managed by:  <!-- TMPL_VAR NAME="authorisedbyname" --></p><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="creationdate" --><p>Open on:  <!-- TMPL_VAR NAME="creationdate" --></p><!-- /TMPL_IF -->
+        <!-- TMPL_IF name="closedate" -->
+        <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
+        <p>Closed on:  <!-- TMPL_VAR name="closedate" --></p>
+        <!-- TMPL_IF name="basketgroups" -->
+            <p> basketgroup: <select id="basketgroupid" name="basketgroupid">
+                <!-- TMPL_LOOP name="basketgroups" -->
+                    <!-- TMPL_IF name="default" -->
+                    <option value="<!-- TMPL_VAR name="id" -->" selected="selected"><!-- TMPL_VAR name="name" --></option>
+                    <!-- TMPL_ELSE -->
+                    <option value="<!-- TMPL_VAR name="id" -->"><!-- TMPL_VAR name="name" --></option>
+                    <!-- /TMPL_IF -->
+                <!-- /TMPL_LOOP -->
+                </select>
+                <input type="hidden" id="basketno" value="<!-- TMPL_VAR name="basketno" -->" name="basketno" />
+                <input type="hidden" value="mod_basket" name="op" />
+                <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR name="booksellerid" -->" />
+                <input type="submit" value="Change basketgroup" />
+            </p>
+        </form>
+        <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
+    </div>
 </fieldset>
 <!-- /TMPL_IF -->
 
-<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" name="Aform">
-
-
+<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
 
 <fieldset class="rows">
         <legend>Catalog details</legend>
         <!-- TMPL_UNLESS name="existing" -->
-               <input type="hidden" name="existing" value="no" />
+        <input type="hidden" name="existing" value="no" />
         <!-- /TMPL_UNLESS -->
         <input type="hidden" name="ordnum" value="<!-- TMPL_VAR NAME="ordnum" -->" />
         <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
         <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
         <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
         <input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
-        <input type="hidden" name="oldtype" value="<!-- TMPL_VAR NAME="itemtype" -->" />
         <input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
         <input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
         <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
         <input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
         <input type="hidden" name="invoiceincgst" value="<!-- TMPL_VAR NAME="invoiceincgst" -->" />
-
-
         <input type="hidden" name="gstrate" value="<!-- TMPL_VAR NAME="gstrate" -->" />
-
         <input type="hidden" name="suggestionid" value="<!-- TMPL_VAR NAME="suggestionid" -->" />
+        <input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
+
         <!-- TMPL_LOOP NAME="loop_currencies" -->
             <input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
         <!-- /TMPL_LOOP -->
         <ol><li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Title</span>
+            <span class="label">Title</span>
                 <input type="hidden" size="20" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="HTML" -->" /> <span class="title"><!-- TMPL_VAR NAME="title" --></span>
             <!-- TMPL_ELSE -->
             <label for="entertitle" class="required">Title: </label>
                 <input type="text" id="entertitle" size="20" name="title" value="<!-- TMPL_VAR NAME="title" ESCAPE="HTML" -->" />
             <!-- /TMPL_IF -->
         </li>
-
-
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Author: </span>
+            <span class="label">Author: </span>
                 <input type="hidden" size="20" name="author" id="author" value="<!-- TMPL_VAR NAME="author" -->" /><!-- TMPL_VAR NAME="author" -->
             <!-- TMPL_ELSE -->
             <label for="author">Author: </label>
@@ -139,7 +157,7 @@ function Check(ff) {
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Publisher: </span>
+            <span class="label">Publisher: </span>
                 <input type="hidden" size="20" name="publishercode" id="publishercode" value="<!-- TMPL_VAR NAME="publishercode" -->" /><!-- TMPL_VAR NAME="publishercode" -->
             <!-- TMPL_ELSE -->
             <label for="publishercode"> Publisher: </label>
@@ -148,29 +166,16 @@ function Check(ff) {
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Copyright date: </span>
-                <input type="hidden" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" /><!-- TMPL_VAR NAME="copyrightdate" -->
+            <span class="label">Publication year: </span>
+                <input type="hidden" size="20" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" /><!-- TMPL_VAR NAME="publicationyear" -->
             <!-- TMPL_ELSE -->
-            <label for="copyrightdate">Copyright date: </label>
-                <input type="text" size="20" name="copyrightdate" id="copyrightdate" value="<!-- TMPL_VAR NAME="copyrightdate" -->" />
+            <label for="publicationyear">Publication year: </label>
+                <input type="text" size="20" name="publicationyear" id="publicationyear" value="<!-- TMPL_VAR NAME="publicationyear" -->" />
             <!-- /TMPL_IF -->
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Item type: </span>
-                <input type="hidden" size="20" name="itemtype" id="itemtype" value="<!-- TMPL_VAR NAME="itemtype" -->" /><!-- TMPL_VAR NAME="itemtype_desc" -->
-                       <!-- TMPL_ELSE -->
-            <label for="format">Item type: </label>
-            <select name="format" id="format">
-            <!-- TMPL_LOOP name="itypeloop" -->
-                               <option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="desc" --></option>
-            <!-- /TMPL_LOOP -->
-            </select>
-                        <!-- /TMPL_IF -->
-        </li>
-        <li>
-            <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">ISBN: </span>
+            <span class="label">ISBN: </span>
                 <input type="hidden" size="20" name="ISBN" id="ISBN" value="<!-- TMPL_VAR NAME="isbn" -->" /><!-- TMPL_VAR NAME="isbn" -->
             <!-- TMPL_ELSE -->
             <label for="ISBN">ISBN: </label>
@@ -179,18 +184,21 @@ function Check(ff) {
         </li>
         <li>
             <!-- TMPL_IF name="biblionumber" -->
-                       <span class="label">Series: </span>
+            <span class="label">Series: </span>
                 <input type="hidden" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" /><span class="title"><!-- TMPL_VAR NAME="seriestitle" --></span>
             <!-- TMPL_ELSE -->
             <label for="series">Series: </label>
                 <input type="text" size="20" name="series" id="series" value="<!-- TMPL_VAR NAME="seriestitle" -->" />
             <!-- /TMPL_IF -->
         </li>
-               </ol>
+        </ol>
     </fieldset>
     <!-- TMPL_IF name="items" -->
     <fieldset class="rows">
         <legend>Item</legend>
+        <!-- TMPL_IF name="NoACQframework" -->
+            <p class="required">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</p>
+        <!-- /TMPL_IF -->
 
         <!-- TMPL_LOOP NAME="items" -->
         <div id="outeritemblock">
@@ -220,43 +228,40 @@ function Check(ff) {
         <!--/TMPL_LOOP--> <!-- /items -->
     </fieldset>
     <!-- /TMPL_IF --> <!-- items -->
-       <fieldset class="rows">
+    <fieldset class="rows">
         <legend>Accounting Details</legend>
-               <ol>
+        <ol>
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label required">Quantity: </span>
+            <span class="label required">Quantity: </span>
                     <input type="hidden" size="20" id="quantity" name="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" /><!-- TMPL_VAR NAME="quantity" -->
                 <!-- TMPL_ELSE -->
                 <label class="required" for="quantity">Quantity: </label>
                     <!-- TMPL_IF name="items" -->
-                        <input type="text" READONLY size="20" id="quantityrec" name="quantity" value="1" onchange="calcNeworderTotal(this.form);" />
+                        <input type="text" READONLY size="20" id="quantityrec" name="quantity" value="1" onchange="calcNeworderTotal();" />
                     <!-- TMPL_ELSE -->
-                        <input type="text" size="20" id="quantityrec" name="quantity" value="<!-- TMPL_VAR name="quantityrec" -->" onchange="calcNeworderTotal(this.form);" />
+                        <input type="text" size="20" id="quantityrec" name="quantity" value="<!-- TMPL_VAR name="quantityrec" -->" onchange="calcNeworderTotal();" />
                     <!-- /TMPL_IF -->
                 <!--/TMPL_IF-->
                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
                 <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="1" />
             </li>
-
-
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label">Budget: </span>
+            <span class="label">Budget: </span>
                     <input type="hidden" size="20" name="budget_id" id="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" /><!-- TMPL_VAR NAME="Budget_name" -->
                 <!-- TMPL_ELSE -->
                 <label for="budget_id">Budget: </label>
                     <!-- TMPL_VAR NAME="budget_dropbox" -->
                 <!--/TMPL_IF-->
             </li>
-
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <span class="label">Vendor price: </span>
+            <span class="label">Vendor price: </span>
                     <input type="hidden" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="list_price" -->" /><!-- TMPL_VAR NAME="list_price" -->
                 <!-- TMPL_ELSE -->
                 <label for="list_price">Vendor price: </label>
-                    <input type="text" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="list_price" -->" onchange="calcNeworderTotal(this.form)" /> (entered as <!-- TMPL_VAR NAME="currency" -->)
+                    <input type="text" size="20" name="list_price" id="list_price" value="<!-- TMPL_VAR NAME="list_price" -->" onchange="calcNeworderTotal()" /> (entered as <!-- TMPL_VAR NAME="currency" -->)
 
                 <!--/TMPL_IF-->
             </li>
@@ -267,11 +272,11 @@ function Check(ff) {
                     <input type="checkbox" name="uncertainprice" value="1" checked />
                     <!-- TMPL_ELSE -->
                     <input type="checkbox" name="uncertainprice" value="1" />
-                   <!--/TMPL_IF-->
+                <!--/TMPL_IF-->
             </li>
             <!-- /TMPL_UNLESS -->
                 <!-- TMPL_IF name="close" -->
-                       <span class="label">Replacement cost: </span>
+            <span class="label">Replacement cost: </span>
                     <input type="hidden" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /><!-- TMPL_VAR NAME="rrp" -->
                 <!-- TMPL_ELSE -->
                 <label for="rrp">Replacement cost: </label>
@@ -280,7 +285,7 @@ function Check(ff) {
             </li>
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <label for="ecost">Budgeted cost: </label>
+            <label for="ecost">Budgeted cost: </label>
                     <input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" readonly="readonly"  />
                 <!-- TMPL_ELSE -->
                 <label for="ecost">Budgeted cost: </label>
@@ -291,49 +296,37 @@ function Check(ff) {
             </li>
             <!-- TMPL_IF NAME="GST"-->
             <li>
-                               <!-- TMPL_IF name="close" -->
-                       <label for="GST">Budgeted GST: </label>
+                <!-- TMPL_IF name="close" -->
+            <label for="GST">Budgeted GST: </label>
                 <input type="text" id="" size="20" name="GST" value="" id="GST" readonly="readonly" />
-                               <!-- TMPL_ELSE -->
+                <!-- TMPL_ELSE -->
                 <label for="GST">Budgeted GST: </label>
                 <input type="text" size="20" name="GST" id="GST" value="" />
-                               <!--/TMPL_IF-->
+                <!--/TMPL_IF-->
             </li>
             <!-- /TMPL_IF -->
-
             <li>
                 <!-- TMPL_IF name="close" -->
-                       <label for="total">Total: </label>
-                               <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" readonly="readonly" />
-                               <!-- TMPL_ELSE -->
+            <label for="total">Total: </label>
+                <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" readonly="readonly" />
+                <!-- TMPL_ELSE -->
                 <label for="total">Total: </label>
                 <input type="text" id="total" size="20" name="total" value="<!-- TMPL_VAR name="total" -->" /> (budgeted cost * quantity)
-                               <!--/TMPL_IF-->
+                <!--/TMPL_IF-->
             </li>
             <li>
-                               <!-- TMPL_IF name="close" -->
-                       <label for="cost">Actual cost: </label>
+                <!-- TMPL_IF name="close" -->
+            <label for="cost">Actual cost: </label>
                 <input type="text" id="cost" size="20" name="cost" value="<!-- TMPL_VAR name="ecost"-->" readonly="readonly" />
-                               <!-- TMPL_ELSE -->
+                <!-- TMPL_ELSE -->
                 <label for="cost">Actual cost: </label>
                 <input type="text" id="cost" size="20" name="cost" value="<!-- TMPL_VAR name="ecost"-->" />
-                               <!--/TMPL_IF-->
-            </li>
-            <li>
-                <label for="purchaseordernumber">Purchase order: </label>
-                <input type="text" id="purchaseordernumber" size="20" name="purchaseordernumber"  value="<!-- TMPL_VAR name="purchaseordernumber" -->" />
-            </li>
-            <li>
-                <label for="invoice">Invoice number: </label>
-                <input type="text" id="invoice" size="20" name="invoice"  value="<!-- TMPL_VAR name="invoice" -->" /> (Fill when receiving)
+                <!--/TMPL_IF-->
             </li>
             <li>
                 <label for="notes">Notes: </label>
                 <textarea id="notes" cols="30" rows="3" name="notes"><!-- TMPL_VAR NAME="notes" --></textarea>
             </li>
-
-
-
             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
                 <label for="sort1">Planning value1: </label>
 
@@ -344,8 +337,6 @@ function Check(ff) {
                     <input type="text" id="sort1" size="20" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
                 <!--/TMPL_IF -->
             </li>
-
-
             <li>
                 <label for="sort2">Planning value2: </label>
 
@@ -355,9 +346,6 @@ function Check(ff) {
                     <input type="text" id="sort2" size="20" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
                 <!--/TMPL_IF -->
             </li>
-
-
-
 </ol>
     </fieldset>
     <fieldset class="action">