From 937e0d73dff337d07cec3c5245d99062c6e417e7 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Wed, 16 Sep 2009 17:40:34 +0200 Subject: [PATCH] fix for #3620: basket management - 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 - --- C4/Biblio.pm | 28 ++- C4/ImportBatch.pm | 13 +- acqui/addorder.pl | 26 ++- acqui/addorderiso2709.pl | 56 ++--- acqui/basket.pl | 12 +- acqui/basketheader.pl | 2 +- acqui/neworderempty.pl | 206 ++++++++---------- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 175 +++++++-------- .../en/modules/acqui/addorderiso2709.tmpl | 102 +-------- .../prog/en/modules/acqui/basket.tmpl | 180 ++++++++------- .../prog/en/modules/acqui/basketheader.tmpl | 2 +- .../prog/en/modules/acqui/neworderempty.tmpl | 176 +++++++-------- 12 files changed, 432 insertions(+), 546 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0e92d90025..e15b93fbe8 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -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} ) { diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index aa2c06292c..8f259a33f7 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -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 ?"; diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 255dd7e4f0..198cdf0e76 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -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"); +} diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index d975ef7818..7ca6746c7e 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -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); } diff --git a/acqui/basket.pl b/acqui/basket.pl index c5730351c1..914ca7ed9b 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -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 ) . '%', diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index 56f2483ad3..58e5773332 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -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'}, diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index f4e13faab2..6be14ec923 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -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); diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index dce702be91..12cf936020 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -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("Debug Log" + - ""); + ""); 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; - } + } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl index 42380e73bf..16d490ab90 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl @@ -6,50 +6,6 @@ › Batch List -/js/additem.js"> --> - @@ -59,14 +15,12 @@ function deleteItemBlock(index) {
-

Add orders from iso2709 file

+

Add orders from staged file:

-

From batch id

-
File name
-
Comments
-
Staged
+
File name:
+
Staged on:
@@ -76,52 +30,17 @@ function deleteItemBlock(index) { # Citation Match? - Order? + Order " rel="gb_page_center[600,500]"> - -
- - - -
-
"> -
  1. -
    "> - - - " /> - " /> - " /> - " /> - " /> - - ')">+ - -
  2. - -
- ')">+ - ')">- -
-
- - " id="quantityrec-" value="1" /> - -
- - " value="1" checked /> + &basketno=&booksellerid=&breedingid=&import_batch_id=">Add order @@ -131,9 +50,6 @@ function deleteItemBlock(index) { - - " /> - " />
@@ -152,23 +68,21 @@ function deleteItemBlock(index) {
- - + - - + - +
# File name Comments Status Staged # Bibs# Items 
?import_batch_id=&basketno="> ?import_batch_id=&basketno=&booksellerid=">Add orders
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl index d07f2ad1e8..b42e473a3e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl @@ -51,10 +51,10 @@
- -
-
-
+ +
+
+
@@ -134,80 +134,74 @@ -
-

Basket Details

-

Internal note:

-

Bookseller note:

- -

Contract number:

-

Contract name: ">

- -

Managed by:

-

Open on:

-

For vendor ID:

-

Invoice number:

- -
-

Closed On:

- -

basketgroup: - " name="basketno" /> - - " /> - -

-
- - -

Number of orders:

-
+ +
+

Basket details

+

Internal note:

+

Bookseller note:

+ +

Contract number:

+

Contract name: ">

+ +

Managed by:

+

Open on:

+ +
+

Closed on:

+ +

basketgroup: + " name="basketno" /> + + " /> + +

+
+ + +
+

Order Details

- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - @@ -227,11 +221,7 @@ - - + @@ -245,14 +235,14 @@ - + - + @@ -289,28 +279,28 @@ -
+
+ +
+
+ Closing basket +

Are you sure you want to close this basket ?

+

+ + +

+ " name="basketno" /> + + " /> + + " /> + + ';return false;" /> +
+ +
+ -
-
- Closing basket -

Are you sure you want to close this basket ?

-

- - -

- " name="basketno" /> - - " /> - - " /> - - ';return false;" /> -
- -
- - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl index 87528c9967..4d159afc9a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tmpl @@ -135,7 +135,7 @@ li.list2 {
  • + + + + + + + + + " name="basketno" /> + + " /> + +

    + + + + -
    - - +
    Catalog details - + " /> " /> " /> " /> " /> - " /> " /> " /> " /> " /> " /> - - " /> - " /> + " /> + " value="" />
    1. - Title + Title " /> " />
    2. - -
    3. - Author: + Author: " /> @@ -139,7 +157,7 @@ function Check(ff) {
    4. - Publisher: + Publisher: " /> @@ -148,29 +166,16 @@ function Check(ff) {
    5. - Copyright date: - " /> + Publication year: + " /> - - " /> + + " />
    6. - Item type: - " /> - - - - -
    7. -
    8. - - ISBN: + ISBN: " /> @@ -179,18 +184,21 @@ function Check(ff) {
    9. - Series: + Series: " /> " />
    10. -
    +
    Item + +

    No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used

    +
    @@ -220,43 +228,40 @@ function Check(ff) {
    -
    +
    Accounting Details -
      +
      1. - Quantity: + Quantity: " /> - + - " onchange="calcNeworderTotal(this.form);" /> + " onchange="calcNeworderTotal();" />
      2. - -
      3. - Budget: + Budget: " />
      4. -
      5. - Vendor price: + Vendor price: " /> - " onchange="calcNeworderTotal(this.form)" /> (entered as ) + " onchange="calcNeworderTotal()" /> (entered as )
      6. @@ -267,11 +272,11 @@ function Check(ff) { - + - Replacement cost: + Replacement cost: " /> @@ -280,7 +285,7 @@ function Check(ff) {
      7. - + " readonly="readonly" /> @@ -291,49 +296,37 @@ function Check(ff) {
      8. - - + + - + - +
      9. -
      10. - - " readonly="readonly" /> - + + " readonly="readonly" /> + " /> (budgeted cost * quantity) - +
      11. - - + + " readonly="readonly" /> - + " /> - -
      12. -
      13. - - " /> -
      14. -
      15. - - " /> (Fill when receiving) +
      16. - - -
      17. The 2 following fields are available for your own usage. They can be useful for statistical purposes
        @@ -344,8 +337,6 @@ function Check(ff) { " />
      18. - -
      19. @@ -355,9 +346,6 @@ function Check(ff) { " />
      20. - - -
    -- 2.39.5
  • OrderTitleISBNPublisherRRPEst.Qty.TotalBudgetModifyDelete
    OrderRRPEst.Qty.TotalBudgetModifyDelete
    - (rcvd) -

    - ">

    -

    -

    -

    +
    +

    (rcvd) + "> by + + - + , + , +

    - " /> - " /> - Total GST Exc.Total GST Exc.  
    GST ()GST ()    
    Total GST Inc. ()Total GST Inc. ()